:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --text: #1c1f23;
  --muted: #5b636d;
  --line: #e4e6e9;
  --accent: #0b6e4f;
  --accent-soft: #e3f2ec;
  --code-bg: #f1f3f5;
  --max: 44rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111417;
    --surface: #171b1f;
    --text: #e6e8ea;
    --muted: #9aa3ad;
    --line: #2a3036;
    --accent: #4fd1a1;
    --accent-soft: #15302a;
    --code-bg: #1e2328;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: 0.5rem 0.75rem; z-index: 10; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1rem; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.5rem 1.5rem; padding-top: 0.9rem; padding-bottom: 0.9rem;
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: -0.01em; }
.brand span { color: var(--accent); }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; font-size: 0.95rem; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 0.2rem 0; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); }
.site-nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }

main.wrap { padding-top: 2.5rem; padding-bottom: 3.5rem; }

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.015em; }
h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); margin: 0 0 0.75rem; }
h2 { font-size: 1.35rem; margin: 2.4rem 0 0.6rem; }
h3 { font-size: 1.08rem; margin: 1.6rem 0 0.4rem; }
p, ul, ol { margin: 0 0 1rem; }
li { margin-bottom: 0.35rem; }

.lede { font-size: 1.15rem; color: var(--muted); max-width: 38rem; }
.eyebrow {
  display: inline-block; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 0.6rem;
}

code {
  font: 0.88em/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px;
}

/* Cards */
.cards { display: grid; gap: 1rem; margin: 1.25rem 0 0; padding: 0; list-style: none; }
.card {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 1.1rem 1.2rem; color: inherit; text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
a.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card h3 { margin: 0 0 0.35rem; color: var(--text); }
.card p { margin: 0; color: var(--muted); font-size: 0.96rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.75rem 0 0; padding: 0; list-style: none; }
.tags li {
  margin: 0; font-size: 0.78rem; padding: 0.1rem 0.55rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}

.callout {
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  padding: 0.8rem 1rem; border-radius: 0 8px 8px 0; margin: 1.25rem 0;
}
.callout p:last-child { margin-bottom: 0; }

.shows { border: 1px solid var(--line); background: var(--surface); padding: 0.8rem 1rem; border-radius: 8px; margin: 0 0 1.5rem; }
.shows p { margin: 0; }
.shows .lab-note { margin-top: 0.5rem; font-size: 0.85rem; color: var(--muted); }

/* Tables scroll on their own, never the page */
.table-wrap { overflow-x: auto; margin: 1rem 0 1.25rem; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
th, td { text-align: left; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface); font-weight: 600; }
tr:last-child td { border-bottom: 0; }

.meta { color: var(--muted); font-size: 0.92rem; margin-bottom: 1.75rem; }
.back { display: block; width: fit-content; margin-bottom: 1.25rem; font-size: 0.93rem; }

.next-prev { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--line); font-size: 0.95rem; }

.button {
  display: inline-block; background: var(--accent); color: var(--bg); font-weight: 600;
  padding: 0.6rem 1.1rem; border-radius: 8px; text-decoration: none;
}
.button:hover { filter: brightness(1.08); }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.88rem; }
.site-footer .wrap { padding-top: 1.25rem; padding-bottom: 1.75rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; }
.site-footer a { color: var(--muted); }

@media (min-width: 40rem) {
  .cards.two { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---- Evidence: proof blocks, diagrams, replays ---- */
:root { --term-bg: #0f1419; --term-text: #d6dde4; --term-dim: #8b97a3; --term-ok: #4fd1a1; --term-bad: #ff8a80; --term-warn: #f6c56b; --node: #ffffff; --node-line: #b9c1c9; }
@media (prefers-color-scheme: dark) { :root { --term-bg: #0b0e11; --node: #1d2227; --node-line: #3a424a; } }

.proof { margin: 1.5rem 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.proof-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--line); }
.proof-head strong { font-size: 0.95rem; }
.proof-head span { font-size: 0.8rem; color: var(--muted); }
.proof pre { margin: 0; padding: 0.85rem 0.9rem; background: var(--term-bg); color: var(--term-text); overflow-x: auto;
  font: 0.8rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; tab-size: 2; }
.proof pre code { background: none; padding: 0; font: inherit; color: inherit; }
.proof .note { margin: 0; padding: 0.6rem 0.9rem; font-size: 0.85rem; color: var(--muted); border-top: 1px solid var(--line); }
.t-dim { color: var(--term-dim); } .t-ok { color: var(--term-ok); } .t-bad { color: var(--term-bad); } .t-warn { color: var(--term-warn); }

.diagram { margin: 1.5rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.diagram svg { display: block; width: 100%; max-width: 30rem; height: auto; margin: 0 auto; }
.diagram figcaption { margin-top: 0.75rem; font-size: 0.85rem; color: var(--muted); text-align: center; }
.d-node { fill: var(--node); stroke: var(--node-line); stroke-width: 1.5; }
.d-key { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.d-warn { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 4; }
.d-title { fill: var(--text); font: 600 14px ui-sans-serif, system-ui, sans-serif; }
.d-sub { fill: var(--muted); font: 12px ui-sans-serif, system-ui, sans-serif; }
.d-edge { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.d-edge.dash { stroke-dasharray: 4 4; }
.d-label { fill: var(--accent); font: 600 11.5px ui-sans-serif, system-ui, sans-serif; }
.d-arrow { fill: var(--muted); }

/* Replay: a CSS-only step-through (radio buttons, no script) */
.replay { margin: 1.5rem 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.replay > input { position: absolute; opacity: 0; pointer-events: none; }
.replay-head { padding: 0.7rem 0.9rem 0.2rem; }
.replay-head strong { display: block; font-size: 0.95rem; }
.replay-head span { font-size: 0.82rem; color: var(--muted); }
.replay-dots { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.6rem 0.9rem; margin: 0; list-style: none; }
.replay-dots { counter-reset: dot; }
.replay-dots li { margin: 0; counter-increment: dot; }
.replay-dots label::before { content: counter(dot); }
.replay-dots label { display: inline-grid; place-items: center; min-width: 2rem; height: 2rem; border-radius: 999px;
  border: 1px solid var(--line); font-size: 0.82rem; cursor: pointer; color: var(--muted); }
.replay-steps { list-style: none; margin: 0; padding: 0; }
.replay-step { display: none; padding: 0 0.9rem 0.9rem; }
.replay-step .when { font: 600 0.8rem ui-monospace, Menlo, Consolas, monospace; color: var(--accent); }
.replay-step h4 { margin: 0.2rem 0 0.4rem; font-size: 1rem; }
.replay-step p { margin: 0 0 0.6rem; font-size: 0.95rem; }
.replay-step pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 0.6rem; padding: 0.6rem 0.75rem; border-radius: 6px; background: var(--term-bg); color: var(--term-text);
  overflow-x: auto; font: 0.78rem/1.5 ui-monospace, Menlo, Consolas, monospace; }
.replay-nav { display: flex; justify-content: space-between; gap: 0.5rem; }
.replay-nav label { cursor: pointer; font-size: 0.9rem; font-weight: 600; color: var(--accent); padding: 0.35rem 0; }
.replay-nav .off { visibility: hidden; }

.replay > input:nth-of-type(1):checked ~ .replay-steps > .replay-step:nth-child(1) { display: block; }
.replay > input:nth-of-type(1):checked ~ .replay-dots li:nth-child(1) label { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.replay > input:nth-of-type(1):focus-visible ~ .replay-dots li:nth-child(1) label { outline: 2px solid var(--accent); outline-offset: 2px; }
.replay > input:nth-of-type(2):checked ~ .replay-steps > .replay-step:nth-child(2) { display: block; }
.replay > input:nth-of-type(2):checked ~ .replay-dots li:nth-child(2) label { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.replay > input:nth-of-type(2):focus-visible ~ .replay-dots li:nth-child(2) label { outline: 2px solid var(--accent); outline-offset: 2px; }
.replay > input:nth-of-type(3):checked ~ .replay-steps > .replay-step:nth-child(3) { display: block; }
.replay > input:nth-of-type(3):checked ~ .replay-dots li:nth-child(3) label { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.replay > input:nth-of-type(3):focus-visible ~ .replay-dots li:nth-child(3) label { outline: 2px solid var(--accent); outline-offset: 2px; }
.replay > input:nth-of-type(4):checked ~ .replay-steps > .replay-step:nth-child(4) { display: block; }
.replay > input:nth-of-type(4):checked ~ .replay-dots li:nth-child(4) label { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.replay > input:nth-of-type(4):focus-visible ~ .replay-dots li:nth-child(4) label { outline: 2px solid var(--accent); outline-offset: 2px; }
.replay > input:nth-of-type(5):checked ~ .replay-steps > .replay-step:nth-child(5) { display: block; }
.replay > input:nth-of-type(5):checked ~ .replay-dots li:nth-child(5) label { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.replay > input:nth-of-type(5):focus-visible ~ .replay-dots li:nth-child(5) label { outline: 2px solid var(--accent); outline-offset: 2px; }
.replay > input:nth-of-type(6):checked ~ .replay-steps > .replay-step:nth-child(6) { display: block; }
.replay > input:nth-of-type(6):checked ~ .replay-dots li:nth-child(6) label { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.replay > input:nth-of-type(6):focus-visible ~ .replay-dots li:nth-child(6) label { outline: 2px solid var(--accent); outline-offset: 2px; }
.replay > input:nth-of-type(7):checked ~ .replay-steps > .replay-step:nth-child(7) { display: block; }
.replay > input:nth-of-type(7):checked ~ .replay-dots li:nth-child(7) label { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.replay > input:nth-of-type(7):focus-visible ~ .replay-dots li:nth-child(7) label { outline: 2px solid var(--accent); outline-offset: 2px; }
.replay > input:nth-of-type(8):checked ~ .replay-steps > .replay-step:nth-child(8) { display: block; }
.replay > input:nth-of-type(8):checked ~ .replay-dots li:nth-child(8) label { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.replay > input:nth-of-type(8):focus-visible ~ .replay-dots li:nth-child(8) label { outline: 2px solid var(--accent); outline-offset: 2px; }
.replay > input:nth-of-type(9):checked ~ .replay-steps > .replay-step:nth-child(9) { display: block; }
.replay > input:nth-of-type(9):checked ~ .replay-dots li:nth-child(9) label { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.replay > input:nth-of-type(9):focus-visible ~ .replay-dots li:nth-child(9) label { outline: 2px solid var(--accent); outline-offset: 2px; }
.replay > input:nth-of-type(10):checked ~ .replay-steps > .replay-step:nth-child(10) { display: block; }
.replay > input:nth-of-type(10):checked ~ .replay-dots li:nth-child(10) label { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.replay > input:nth-of-type(10):focus-visible ~ .replay-dots li:nth-child(10) label { outline: 2px solid var(--accent); outline-offset: 2px; }
@media print { .replay-step { display: block !important; } .replay-dots, .replay-nav { display: none; } }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; margin: 1.25rem 0 0.5rem; }
.roles { list-style: none; padding: 0; margin: 1rem 0; }
.roles > li { padding: 0.9rem 0; border-top: 1px solid var(--line); margin: 0; }
.roles > li:last-child { border-bottom: 1px solid var(--line); }
.roles .role { margin: 0 0 0.3rem; display: flex; flex-wrap: wrap; gap: 0 0.6rem; align-items: baseline; }
.roles .role span { color: var(--muted); font-size: 0.92rem; }
.roles > li > p:last-child, .roles ul { margin-bottom: 0; }
.tools { padding-left: 1.1rem; }
