/* LAMP-ADAPT. One stylesheet, no framework, no web fonts: every request the
   first page load makes is one a first-time visitor waits for. */

:root {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-2: #f0f3f6;
  --text: #1c2430;
  --muted: #5b6676;
  --border: #d9dfe6;
  --accent: #1f6f9f;
  --accent-strong: #185a82;
  --accent-soft: #e4f0f8;
  --ok: #2e7d32;
  --ok-soft: #e8f4ea;
  --warn: #9a6200;
  --warn-soft: #fdf3e1;
  --err: #b3261e;
  --err-soft: #fbeaea;
  --info-soft: #eaf2fb;
  --green: #4caf50;
  --orange: #e8451e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141a;
    --surface: #161d25;
    --surface-2: #1d2631;
    --text: #e3e8ee;
    --muted: #9aa6b4;
    --border: #2b3643;
    --accent: #5aaee0;
    --accent-strong: #7cc0ea;
    --accent-soft: #15293a;
    --ok: #6cc070;
    --ok-soft: #15281a;
    --warn: #e0a84a;
    --warn-soft: #2d2412;
    --err: #f08a80;
    --err-soft: #321816;
    --info-soft: #14243a;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); }
a:hover { color: var(--accent-strong); }

code, .mono { font-family: var(--mono); font-size: 0.92em; }

/* ---- top bar --------------------------------------------------------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.brand {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.2px;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand svg { flex: none; }
.topbar nav { margin-left: auto; display: flex; gap: 4px; }
.topbar nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 500;
}
.topbar nav a:hover { background: var(--surface-2); color: var(--text); }
.topbar nav a.active { color: var(--accent); background: var(--accent-soft); }

main {
  flex: 1;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}
footer .inner { max-width: 1160px; margin: 0 auto; padding: 16px 20px; }

/* ---- type ------------------------------------------------------------ */

h1 { font-size: 30px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -0.3px; }
h2 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.2px; }
h3 { font-size: 16px; margin: 0 0 10px; }
p { margin: 0 0 12px; }
.lede { color: var(--muted); font-size: 17px; margin-bottom: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.caption { color: var(--muted); font-size: 13.5px; margin: 6px 0 12px; }

/* ---- layout pieces --------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.card > h3:first-child { margin-top: 0; }

.page-head { margin-bottom: 18px; }
.page-head .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }

@media (max-width: 760px) {
  .grid-2 { grid-template-columns: 1fr; }
  h1 { font-size: 25px; }
}

/* ---- home ------------------------------------------------------------ */

.hero { text-align: center; padding: 18px 0 8px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 26px 0 30px; }
.choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 26px 24px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.choice:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.08);
  color: inherit;
}
.choice .title { font-size: 20px; font-weight: 700; color: var(--accent); }
.choice p { color: var(--muted); margin: 0; max-width: 34ch; }
.about { max-width: 820px; margin: 0 auto; }
.about ul { padding-left: 20px; }
.about li { margin-bottom: 8px; }
@media (max-width: 760px) { .choices { grid-template-columns: 1fr; } }

/* ---- step indicator -------------------------------------------------- */

.steps {
  display: flex;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  flex-wrap: wrap;
}
.steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
}
.steps li .n {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 700;
}
.steps li.done { color: var(--text); }
.steps li.done .n { background: var(--ok-soft); color: var(--ok); }
.steps li.current { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.steps li.current .n { background: var(--accent); color: #fff; }

/* ---- controls -------------------------------------------------------- */

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn.danger { color: var(--err); }
.btn.big { padding: 12px 22px; font-size: 16px; }
.btn[disabled], .btn.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.segmented button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
}
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

label.field { display: block; font-weight: 600; margin-bottom: 6px; }
.field-help { color: var(--muted); font-size: 13px; font-weight: 400; margin-top: 4px; }

input[type="number"], input[type="password"], input[type="text"], select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
}
textarea { font-family: var(--mono); font-size: 13px; min-height: 200px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .segmented button:focus-visible,
.chip:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 500;
  user-select: none;
}
.chip input { margin: 0; accent-color: var(--accent); }
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }

.dropzone {
  display: block;  /* it is a <label>, which is inline by default */
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
  color: var(--muted);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone strong { color: var(--text); }
.dropzone input { display: none; }

/* ---- feedback -------------------------------------------------------- */

.alert {
  border-radius: 8px;
  padding: 10px 14px;
  margin: 10px 0;
  border: 1px solid transparent;
  overflow-wrap: anywhere;
}
.alert.error { background: var(--err-soft); color: var(--err); border-color: color-mix(in srgb, var(--err) 25%, transparent); }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert.info { background: var(--info-soft); color: var(--text); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }
.alert.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 12px 0; }
.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.metric .label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.metric .value { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }

details.expander {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  margin: 12px 0;
}
details.expander > summary {
  cursor: pointer;
  padding: 10px 14px;
  font-weight: 600;
  list-style: none;
}
details.expander > summary::-webkit-details-marker { display: none; }
details.expander > summary::before { content: "▸"; display: inline-block; width: 16px; color: var(--muted); }
details.expander[open] > summary::before { content: "▾"; }
details.expander > .body { padding: 0 14px 14px; }

pre.code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  overflow: auto;
  max-height: 360px;
  margin: 0;
  white-space: pre;
}

/* ---- run page -------------------------------------------------------- */

.stages { list-style: none; padding: 0; margin: 8px 0 0; }
.stages li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.stages li:last-child { border-bottom: 0; }
.stages .icon {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  margin-top: 1px;
}
.stages .todo .icon { border: 2px solid var(--border); }
.stages .done .icon { background: var(--ok-soft); color: var(--ok); font-weight: 700; }
.stages .now .icon { border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
.stages .label { font-weight: 600; }
.stages .todo .label { color: var(--muted); font-weight: 500; }
.stages .detail { color: var(--muted); font-size: 13.5px; }
.stages .time { margin-left: auto; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--accent-soft);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
  display: inline-block;
  vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.run-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--surface-2);
  color: var(--muted);
}
.badge.running, .badge.queued, .badge.waiting { background: var(--accent-soft); color: var(--accent); }
.badge.succeeded { background: var(--ok-soft); color: var(--ok); }
.badge.failed { background: var(--err-soft); color: var(--err); }
.badge.cancelled { background: var(--warn-soft); color: var(--warn); }

/* ---- results --------------------------------------------------------- */

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 18px 0 0; flex-wrap: wrap; }
.tabs button {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 14px;
  margin-bottom: -1px;
  cursor: pointer;
}
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { padding-top: 6px; }

.table-wrap {
  overflow: auto;
  max-height: 560px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
table.data { border-collapse: collapse; width: max-content; min-width: 100%; font-size: 13.5px; }
table.data th, table.data td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
table.data th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  font-weight: 600;
  z-index: 1;
}
table.data tr:hover td { background: var(--accent-soft); }
table.data td.num { text-align: right; }
table.data td.seq { font-family: var(--mono); font-size: 12.5px; }

.downloads { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---- gate ------------------------------------------------------------ */

.gate { max-width: 420px; margin: 40px auto; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
