/* The explainer site at https://wba-demo.noetis.dev. Plain CSS; light and dark. */

:root {
  color-scheme: light dark;
  --bg: #fbfbfa;
  --fg: #1c1f23;
  --muted: #5d646d;
  --line: #c9ced4;
  --panel: #ffffff;
  --panel-2: #f1f3f5;
  --accent: #1f5fbf;
  --accent-soft: #e5eefb;
  --ok: #1d7a46;
  --ok-soft: #e3f3ea;
  --bad: #b3261e;
  --bad-soft: #fbe6e4;
  --stopgap: #9a5b00;
  --code: #f1f3f5;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --fg: #e4e7ea;
    --muted: #9aa3ad;
    --line: #3a4148;
    --panel: #1c2024;
    --panel-2: #232830;
    --accent: #7fb0ff;
    --accent-soft: #1d2b40;
    --ok: #6fd39b;
    --ok-soft: #173025;
    --bad: #ff8a80;
    --bad-soft: #3a1d1b;
    --stopgap: #f0b45a;
    --code: #1f242a;
  }
}

* { box-sizing: border-box; }

html { scroll-padding-top: 4rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 var(--sans);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }

code, pre, kbd { font-family: var(--mono); font-size: 0.88em; }
:not(pre) > code { background: var(--code); padding: 0.1em 0.35em; border-radius: 4px; overflow-wrap: anywhere; }

pre {
  background: var(--code);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  line-height: 1.5;
}

/* ── Layout ─────────────────────────────────────────────────────────── */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

.top nav {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  display: flex;
  gap: 0.25rem 1rem;
  align-items: center;
  overflow-x: auto;
  white-space: nowrap;
  font-size: 0.92rem;
}

.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--fg); }
.top nav .home { color: var(--fg); font-weight: 650; margin-right: 0.5rem; }

main { max-width: 64rem; margin: 0 auto; padding: 0 1rem 4rem; }

.intro { padding: 2.5rem 0 1rem; max-width: 46rem; }
.intro h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); line-height: 1.15; margin: 0 0 0.75rem; letter-spacing: -0.01em; }
.intro .lede { font-size: 1.15rem; color: var(--muted); margin: 0 0 1rem; }

section { padding-top: 2.5rem; border-top: 1px solid var(--line); margin-top: 2.5rem; }
section > h2 { font-size: 1.55rem; margin: 0 0 0.75rem; letter-spacing: -0.005em; }
section h3 { font-size: 1.1rem; margin: 1.75rem 0 0.5rem; }
.prose { max-width: 46rem; }
.prose p, .prose li { margin: 0.6rem 0; }

/* ── Status pill (header) ───────────────────────────────────────────── */

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
}
.status .dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--line); }
.status.ok .dot { background: var(--ok); }
.status.bad .dot { background: var(--bad); }

/* ── Figures ────────────────────────────────────────────────────────── */

figure { margin: 1.5rem 0; }
.diagram {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem;
  overflow-x: auto;
}
.diagram svg { display: block; width: 100%; height: auto; min-width: 620px; }
figcaption { color: var(--muted); font-size: 0.92rem; margin-top: 0.5rem; max-width: 46rem; }
.scroll-hint { display: none; }
@media (max-width: 680px) {
  .scroll-hint { display: inline; }
}

/* SVG vocabulary: every diagram draws with these classes, so both themes apply. */
svg text { fill: var(--fg); font-family: var(--sans); font-size: 14px; }
svg .t-title { font-weight: 650; font-size: 15px; }
svg .t-muted { fill: var(--muted); font-size: 13px; }
svg .t-mono { font-family: var(--mono); font-size: 12.5px; }
svg .t-small { font-size: 12.5px; }
svg .t-step { fill: var(--accent); font-weight: 700; }
svg .t-bad { fill: var(--bad); font-weight: 650; }
svg .t-ok { fill: var(--ok); font-weight: 650; }
svg .t-stopgap { fill: var(--stopgap); font-weight: 650; }
svg .box { fill: var(--panel-2); stroke: var(--line); stroke-width: 1.2; }
svg .box-accent { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.4; }
svg .box-ok { fill: var(--ok-soft); stroke: var(--ok); stroke-width: 1.4; }
svg .box-bad { fill: var(--bad-soft); stroke: var(--bad); stroke-width: 1.4; }
svg .box-stopgap { fill: none; stroke: var(--stopgap); stroke-width: 1.4; stroke-dasharray: 6 4; }
svg .frame { fill: none; stroke: var(--line); stroke-width: 1.2; stroke-dasharray: 5 4; }
svg .frame-accent { fill: none; stroke: var(--accent); stroke-width: 1.6; }
svg .wire { fill: none; stroke: var(--fg); stroke-width: 1.4; }
svg .wire-muted { fill: none; stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 5 4; }
svg .wire-bad { fill: none; stroke: var(--bad); stroke-width: 1.4; }
svg .wire-accent { fill: none; stroke: var(--accent); stroke-width: 1.6; }
svg .lifeline { stroke: var(--line); stroke-width: 1.4; stroke-dasharray: 4 5; }
svg .head-fg { fill: var(--fg); }
svg .head-muted { fill: var(--muted); }
svg .head-bad { fill: var(--bad); }
svg .head-accent { fill: var(--accent); }

/* ── Tables, lists, code ───────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.94rem; margin: 1rem 0; }
th, td { text-align: left; vertical-align: top; padding: 0.5rem 0.65rem; border-bottom: 1px solid var(--line); }
th { font-weight: 650; color: var(--muted); font-size: 0.85rem; }
td code { overflow-wrap: anywhere; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.75rem; margin: 1rem 0; }
.card { border: 1px solid var(--line); border-radius: 10px; padding: 0.85rem 1rem; background: var(--panel); }
.card h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.94rem; }
.card a { overflow-wrap: anywhere; }

.callout { border-left: 3px solid var(--stopgap); background: var(--panel); padding: 0.6rem 1rem; border-radius: 0 8px 8px 0; }

/* ── Latest run ─────────────────────────────────────────────────────── */

.run-summary { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; align-items: baseline; margin: 1rem 0; }
.run-summary .verdict { font-size: 1.3rem; font-weight: 700; }
.run-summary .verdict.ok { color: var(--ok); }
.run-summary .verdict.bad { color: var(--bad); }
.run-summary .meta { color: var(--muted); font-size: 0.94rem; }

.history { display: flex; gap: 4px; flex-wrap: wrap; margin: 0.5rem 0 1rem; }
.history span { width: 1.1rem; height: 1.6rem; border-radius: 3px; background: var(--ok); opacity: 0.85; }
.history span.bad { background: var(--bad); }

.steps td.state { font-weight: 700; white-space: nowrap; }
.steps td.state.ok { color: var(--ok); }
.steps td.state.bad { color: var(--bad); }
.steps td.ms { text-align: right; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.steps tr.group th { color: var(--fg); font-size: 0.92rem; padding-top: 1rem; }
.steps td.detail { color: var(--muted); overflow-wrap: anywhere; font-size: 0.88rem; }

details { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); margin: 0.75rem 0; }
details > summary { cursor: pointer; padding: 0.7rem 1rem; font-weight: 600; }
details > div { padding: 0 1rem 1rem; }
details pre { margin: 0.5rem 0; font-size: 0.82rem; }
.headers { white-space: pre-wrap; overflow-wrap: anywhere; }
.headers .name { color: var(--accent); }
.headers .sig { background: var(--accent-soft); }
.note { color: var(--muted); font-size: 0.9rem; }

.empty { border: 1px dashed var(--line); border-radius: 10px; padding: 1rem; color: var(--muted); }

footer { max-width: 64rem; margin: 0 auto; padding: 2rem 1rem 3rem; color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--line); }
