/* stepmold Space. Poppins for everything people read; DM Mono only for things that are
   code: step names, JSON, logs. The step rail is the one bold element on the page. */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --ink: #161b26;
  --muted: #677185;
  --line: #e1e6ee;
  --soft: #eef1f6;
  --accent: #2f54eb;
  --accent-ink: #ffffff;
  --accent-soft: #e8edfe;
  --ok: #16834a;
  --ok-soft: #e2f5ea;
  --bad: #d23c2c;
  --bad-soft: #fde8e5;
  --amber: #b26f00;
  --amber-soft: #fcf1d9;
  --shadow: 0 1px 2px rgba(22, 27, 38, 0.04), 0 8px 24px rgba(22, 27, 38, 0.06);
  --sans: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161d;
    --surface: #1a1f28;
    --ink: #e8ebf1;
    --muted: #949db0;
    --line: #2a313d;
    --soft: #222833;
    --accent: #8ea4ff;
    --accent-ink: #0f1633;
    --accent-soft: #242d4f;
    --ok: #55c98f;
    --ok-soft: #173426;
    --bad: #ff8270;
    --bad-soft: #3b1f1c;
    --amber: #f2b54d;
    --amber-soft: #362a15;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14.5px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

code, pre, textarea, #pack-file { font-family: var(--mono); }
code { font-size: 0.9em; }
a { color: var(--accent); }
button, select, textarea, input { font: inherit; color: inherit; }
button:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible,
.segmented input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hero, .examples, .stage, .foot {
  max-width: 1160px;
  margin: 0 auto;
  padding-inline: 24px;
}

/* ------------------------------------------------------------------ hero */

.hero { padding-top: 36px; }
.hero-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.wordmark { display: flex; align-items: center; gap: 14px; margin: 0; font: 800 46px/1 var(--sans); letter-spacing: -0.035em; }
/* The logo's own corner radius is 22% of its width; matching it keeps the ring flush. */
.logo { width: 48px; height: 48px; flex: none; border-radius: 22%; }
@media (prefers-color-scheme: dark) {
  .logo { box-shadow: 0 0 0 1px var(--line); }
}
.links { display: flex; gap: 22px; }
.links a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.links a:hover { color: var(--ink); }
.tagline { margin: 8px 0 0; font-size: 17px; color: var(--muted); }

/* ------------------------------------------------------------------ examples */

.examples { padding-top: 26px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.pills button:hover { color: var(--ink); border-color: var(--muted); }
.pills button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.pills button:disabled { cursor: not-allowed; }
.pack-line { margin: 12px 0 0; color: var(--muted); font-size: 14px; }

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

.stage {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding-top: 20px;
  padding-bottom: 32px;
}
.panel, .results {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

/* ------------------------------------------------------------------ panel */

.panel { position: sticky; top: 16px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--soft); border-radius: 11px; padding: 4px; }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: block;
  text-align: center;
  padding: 7px 10px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
}
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(22, 27, 38, 0.12); }
.segmented input:disabled + span { opacity: 0.45; }
.segmented label:has(input:disabled) { cursor: not-allowed; }

.note { margin: -6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.pane .note { margin: 0; }

.live { display: flex; flex-direction: column; gap: 8px; }
.live .note { margin: 0; }
.live-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.bar { height: 5px; border-radius: 3px; background: var(--soft); overflow: hidden; }
#load-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.25s; }

.field { display: flex; flex-direction: column; min-width: 0; }
.label { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.label-hint { font-weight: 400; color: var(--muted); }

select, textarea {
  width: 100%;
  min-width: 0;
  background: var(--soft);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 13.5px;
}
select:hover, textarea:hover { border-color: var(--line); }
textarea { font-size: 12.5px; line-height: 1.55; resize: vertical; }
textarea[readonly] { color: var(--muted); }

.case-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px; gap: 6px; }
button.primary, button.ghost, button.nudge { border-radius: 10px; cursor: pointer; font-weight: 600; }
button.primary { border: 0; padding: 12px; background: var(--accent); color: var(--accent-ink); font-size: 15px; }
button.primary:not(:disabled):hover { filter: brightness(1.06); }
button.ghost { border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; font-size: 13.5px; }
button.nudge { border: 0; background: var(--soft); font-size: 20px; line-height: 1; padding: 0; color: var(--muted); }
button.nudge:not(:disabled):hover { color: var(--ink); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.status { margin: -4px 0 0; font-size: 13px; color: var(--muted); min-height: 1.4em; }
.status.error { color: var(--bad); }

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

.results { padding: 22px 24px 24px; min-height: 420px; }
.summary { display: flex; flex-direction: column; gap: 6px; }
.badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 10px;
  padding: 7px 13px;
  font-size: 16px;
  font-weight: 600;
}
.badge.pass { background: var(--ok-soft); color: var(--ok); }
.badge.fail { background: var(--bad-soft); color: var(--bad); }
.badge.none, .badge.wait { background: var(--soft); color: var(--muted); }
.summary-line { margin: 0; color: var(--muted); font-size: 14px; }
.summary-line code { color: var(--ink); }
.stopped { margin: 0; color: var(--bad); font-size: 14px; }
.caught { margin: 0; color: var(--amber); font-size: 14px; font-weight: 500; }
.summary .switch { align-self: flex-start; padding: 10px 16px; font-size: 14px; margin-top: 4px; }
.detail-line { margin: 2px 0 0; color: var(--muted); font-size: 12px; font-family: var(--mono); word-break: break-word; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 18px 0 20px; padding: 0 0 14px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.legend li { display: flex; align-items: center; gap: 7px; }
.legend .tick { width: 17px; height: 17px; font-size: 11px; }
.dash { width: 4px; height: 16px; border-radius: 2px; background: repeating-linear-gradient(var(--amber) 0 4px, transparent 4px 7px); }

/* ------------------------------------------------------------------ rail */

.rail { list-style: none; margin: 0; padding: 0; }
.station { position: relative; padding: 0 0 18px 48px; }
.station::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 34px;
  bottom: 2px;
  width: 4px;
  border-radius: 2px;
  background: var(--accent);
}
.station:last-child::before { display: none; }
.station.detour::before { background: repeating-linear-gradient(var(--amber) 0 7px, transparent 7px 12px); }

.dot {
  position: absolute;
  left: 0;
  top: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  background: var(--surface);
  color: var(--accent);
  display: grid;
  place-items: center;
  font: 600 13px/1 var(--sans);
}
.station.retried .dot { border-color: var(--amber); color: var(--amber); }
.station.failed .dot, .station.error .dot, .station.diverted .dot { border-color: var(--bad); color: var(--bad); }
.station.end .dot { border-radius: 10px; background: var(--accent); color: var(--accent-ink); }
.station.pending .dot { border-style: dashed; animation: turn 2.4s linear infinite; }
.station.asked .dot { border-color: var(--line); color: var(--muted); }
@keyframes turn { to { transform: rotate(360deg); } }

.station-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  width: 100%;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.station-head:hover .name { color: var(--accent); }
div.station-head { cursor: default; }
div.station-head:hover .name { color: inherit; }
.name { font: 500 15.5px/1.2 var(--mono); }
.kind { font-size: 11.5px; font-weight: 500; color: var(--muted); background: var(--soft); border-radius: 6px; padding: 2px 8px; }
.ticks { display: inline-flex; gap: 4px; }
.tick { width: 20px; height: 20px; border-radius: 6px; display: inline-grid; place-items: center; font: 700 12px/1 var(--sans); }
.tick.ok { background: var(--ok-soft); color: var(--ok); }
.tick.no { background: var(--bad-soft); color: var(--bad); }
.tick.split { background: var(--amber-soft); color: var(--amber); }
.time { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.more { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 500; }
.time + .more { margin-left: 0; }
.station-head[aria-expanded="true"] .more { color: var(--accent); }
.said { margin: 2px 0 0; font-size: 14px; }
.said span { display: block; }
.said .why { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 64ch; }
.said .why.bad, .said .bad { color: var(--bad); }
.said .warn { color: var(--amber); }

.station-detail {
  margin-top: 12px;
  padding: 16px;
  background: var(--soft);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.station-detail h3 { margin: 4px 0 0; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.config { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.config li { background: var(--surface); border-radius: 6px; padding: 2px 8px; font-size: 12.5px; }
.config code { font-size: 12px; }
.station-detail .code { background: var(--surface); }

.skipped { margin: 2px 0 0 48px; color: var(--muted); font-size: 13px; }
.skipped code { font-size: 12px; }

/* ------------------------------------------------------------------ tabs */

.results.running .tabs, .results.running .pane, .results.running .legend { opacity: 0.35; pointer-events: none; }
.results.failed .tabs, .results.failed .pane, .results.failed .legend { display: none; }
.tabs { display: flex; gap: 4px; margin-top: 26px; overflow-x: auto; scrollbar-width: none; background: var(--soft); border-radius: 11px; padding: 4px; }
.tabs button {
  flex: 1 0 auto;
  background: none;
  border: 0;
  border-radius: 8px;
  padding: 7px 12px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(22, 27, 38, 0.12); }
.count { color: var(--muted); font-weight: 400; }
.pane { padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }

.code {
  margin: 0;
  background: var(--soft);
  border-radius: 10px;
  padding: 12px 14px;
  overflow: auto;
  max-height: 520px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12.5px;
  line-height: 1.6;
}
.log { white-space: pre; font-size: 11.5px; }
.code.prompt { white-space: pre; font-size: 12px; }
.j-key { color: var(--accent); }
.j-str { color: var(--ok); }
.j-num, .j-lit { color: var(--amber); }

.gold-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.gold-table th, .gold-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.gold-table th { font-size: 12px; font-weight: 600; color: var(--muted); }
.gold-table tr:last-child td { border-bottom: 0; }
.gold-table td.mark { width: 28px; text-align: center; }
.gold-table code { font-size: 12.5px; word-break: break-word; }
.match { color: var(--ok); font-weight: 700; }
.miss { color: var(--bad); font-weight: 700; }
.gold-note { margin: 0; color: var(--muted); font-size: 13.5px; }

.calls { display: flex; flex-direction: column; gap: 10px; }
.call { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.call header { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; }
.call header b { font-family: var(--mono); font-weight: 500; }
.tag { border-radius: 6px; padding: 2px 8px; font-size: 12px; background: var(--soft); color: var(--muted); }
.tag.accepted { background: var(--ok-soft); color: var(--ok); }
.tag.rejected, .tag.failed { background: var(--bad-soft); color: var(--bad); }
.call-reason { margin: 6px 0 0; color: var(--bad); font-size: 13px; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 10px; }
.pair h4 { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.pair .code { max-height: 280px; font-size: 12px; }

/* ------------------------------------------------------------------ footer */

.foot { padding-bottom: 44px; }
.foot details { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 20px; }
.foot summary { cursor: pointer; font-weight: 600; }
.foot details p { margin: 10px 0 0; max-width: 72ch; color: var(--muted); font-size: 14px; }
.fine { margin: 14px 0 0; color: var(--muted); font-size: 12.5px; }

/* ------------------------------------------------------------------ smaller screens */

@media (max-width: 920px) {
  .stage { grid-template-columns: minmax(0, 1fr); }
  .panel { position: static; }
}

@media (max-width: 560px) {
  .hero, .examples, .stage, .foot { padding-inline: 16px; }
  .hero { padding-top: 24px; }
  .wordmark { font-size: 38px; gap: 11px; }
  .logo { width: 40px; height: 40px; }
  .tagline { font-size: 15.5px; }
  .pills button { padding: 6px 12px; font-size: 13.5px; }
  .results { padding: 18px 16px; }
  .station { padding-left: 44px; }
  .said .why { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .station.pending .dot { animation: none; }
  #load-fill, .pills button { transition: none; }
}
