/* Docs site theme. Brand lives in the tokens below: a rebrand changes only this block. */
:root {
  --font-sans: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --bg: #ffffff;
  --surface: #fafaf9;
  --text: #111827;
  --muted: #5b6270;
  --border: #ececea;
  --accent: #3b4fd8;
  --accent-soft: #eef0fd;
  --code-bg: #f5f5f4;
  --radius: 8px;
  --measure: 74ch;
  --topbar-h: 56px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.7 var(--font-sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--bg); padding: 8px 12px; z-index: 20; }
.skip:focus { left: 12px; }
.spacer { flex: 1; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10; height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.88); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1240px; height: 100%; margin: 0 auto; padding: 0 28px;
  display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -0.01em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .mark { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); }
.topnav { display: flex; gap: 22px; font-size: 14px; }
.topnav a { color: var(--muted); }
.topnav a[aria-current="page"] { color: var(--text); font-weight: 550; }
.gh { font-size: 13px; color: var(--muted); border: 1px solid var(--border); padding: 5px 12px; border-radius: 999px; }
.gh:hover { color: var(--text); text-decoration: none; }
.mnav { display: none; position: relative; }
.mnav summary { cursor: pointer; font-size: 14px; color: var(--muted); list-style: none; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 8px; }
.mnav summary::-webkit-details-marker { display: none; }
.mnav-panel { position: absolute; right: 0; top: 42px; width: min(86vw, 340px); max-height: 70vh; overflow: auto;
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px;
  box-shadow: 0 12px 32px rgba(17, 24, 39, 0.12); }
.mnav-panel a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--text); font-size: 14px; }
.mnav-panel a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.mnav-group { margin: 10px 10px 4px; font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* Three-column shell */
.shell {
  max-width: 1240px; margin: 0 auto; padding: 36px 28px 0;
  display: grid; grid-template-columns: 240px minmax(0, 1fr) 210px; gap: 44px;
}
.side, .toc { position: sticky; top: calc(var(--topbar-h) + 28px); align-self: start;
  max-height: calc(100vh - var(--topbar-h) - 56px); overflow: auto; }
.side { font-size: 14px; }
.side details { margin-bottom: 14px; }
.side summary { cursor: pointer; list-style: none; font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.side summary::-webkit-details-marker { display: none; }
.side a { display: block; color: var(--muted); padding: 5px 10px; border-radius: 6px; line-height: 1.4; }
.side a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.side a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 550; }
.toc { font-size: 13px; border-left: 1px solid var(--border); padding-left: 16px; }
.toc-title { margin: 0 0 8px; font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc a { display: block; color: var(--muted); padding: 3px 0; line-height: 1.45; }
.toc a:hover { color: var(--text); text-decoration: none; }

/* Article */
.doc { min-width: 0; max-width: var(--measure); padding-bottom: 24px; }
.doc h1 { font-size: 2.3rem; line-height: 1.15; letter-spacing: -0.025em; margin: 0 0 0.6em; font-weight: 680; }
.doc h2 { font-size: 1.4rem; letter-spacing: -0.015em; margin: 2.2em 0 0.6em; font-weight: 640; }
.doc h3 { font-size: 1.1rem; margin: 1.8em 0 0.4em; font-weight: 620; }
.doc h4 { font-size: 1rem; margin: 1.5em 0 0.4em; font-weight: 620; }
.doc a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.doc a:hover { text-decoration-color: currentColor; }
.doc li { margin: 0.25em 0; }
.doc img { max-width: 100%; height: auto; }
.doc hr { border: 0; border-top: 1px solid var(--border); margin: 2.4em 0; }
.doc code { font: 0.86em/1.5 var(--font-mono); background: var(--code-bg); border: 1px solid var(--border);
  padding: 0.1em 0.38em; border-radius: 6px; }
.doc pre, .doc .highlight pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; overflow: auto; font: 13px/1.65 var(--font-mono); }
.doc pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.doc .highlight { background: none; }
.doc table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 1.2em 0; display: block; overflow-x: auto; }
.doc th, .doc td { border-bottom: 1px solid var(--border); padding: 9px 12px; text-align: left; vertical-align: top; }
.doc th { font-weight: 600; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.doc blockquote { margin: 1.4em 0; padding: 0.3em 1.1em; border-left: 3px solid var(--accent); color: var(--muted);
  background: var(--accent-soft); border-radius: 0 var(--radius) var(--radius) 0; }

/* Footer */
.footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; margin-top: 72px; }
.footer-inner { max-width: 1240px; margin: 0 auto; padding: 22px 28px; display: flex; gap: 18px; flex-wrap: wrap; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--text); }

@media (max-width: 1100px) { .shell { grid-template-columns: 220px minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 780px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding-top: 24px; }
  .side, .topnav { display: none; }
  .mnav { display: block; }
  .topbar-inner { padding: 0 18px; gap: 14px; }
  .doc h1 { font-size: 1.85rem; }
}
@media print { .topbar, .side, .toc, .footer { display: none; } .shell { display: block; } }

/* Recorded replay lab. Native controls keep every interaction keyboard accessible. */
body:has([data-replay-lab]) .shell { grid-template-columns: 210px minmax(0, 1fr); gap: 32px; }
body:has([data-replay-lab]) .doc { max-width: none; }
body:has([data-replay-lab]) .toc { display: none; }
.replay-lab [hidden] { display: none !important; }
.lab-eyebrow { color: var(--accent); font-size: 11px; letter-spacing: 0.12em; font-weight: 700; margin-top: 28px; }
.lab-provenance, .lab-note, #lab-status, #lab-filter-status { color: var(--muted); font-size: 13px; }
.lab-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin: 20px 0; }
.lab-stats > div { display: flex; flex-direction: column; gap: 2px; padding: 16px; background: var(--surface); border-right: 1px solid var(--border); }
.lab-stats > div:last-child { border-right: 0; }
.lab-stats strong { font-size: 30px; color: var(--text); line-height: 1.2; font-variant-numeric: tabular-nums; }
.lab-stats span { font-size: 12px; color: var(--muted); }
.lab-distribution { display: flex; height: 14px; border-radius: 5px; overflow: hidden; background: var(--border); }
.lab-segment { display: block; min-width: 1px; }
.lab-segment.unchanged { background: #c8cfdc; }
.lab-segment.newly-allowed { background: #ca7900; }
.lab-segment.newly-denied { background: #5266c5; }
.lab-segment.newly-indeterminate { background: #b13c55; }
.lab-segment.resolved-indeterminate { background: #227e73; }
.lab-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 8px 0 24px; font-size: 12px; color: var(--muted); }
.lab-key { white-space: nowrap; }
.lab-panel { padding: 24px; border: 1px solid var(--border); border-radius: 12px; margin: 20px 0; scroll-margin-top: 80px; }
.doc .lab-panel h2 { margin: 0 0 10px; font-size: 1.25rem; }
.lab-panel > p { margin: 8px 0 16px; }
.replay-lab fieldset { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }
.replay-lab label, .replay-lab legend { font-size: 13px; font-weight: 600; }
.replay-lab select, .replay-lab input[type="search"] { display: block; width: 100%; min-height: 42px; margin: 5px 0 14px; padding: 8px 10px; font: 14px var(--font-sans); color: var(--text); background: var(--bg); border: 1px solid #b7bfcd; border-radius: 6px; }
.replay-lab button { font: 13px/1.4 var(--font-sans); background: var(--bg); color: var(--accent); border: 1px solid #b7bfcd; border-radius: 6px; padding: 9px 12px; min-height: 40px; cursor: pointer; }
.replay-lab button:hover { background: var(--accent-soft); }
.replay-lab fieldset:disabled button { cursor: wait; opacity: 0.5; }
.lab-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.lab-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 16px 0; }
.lab-steps button[aria-pressed="true"] { background: var(--accent); color: white; border-color: var(--accent); }
.lab-comparison { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; font-size: 14px; }
.lab-comparison strong { font-family: var(--font-mono); }
.lab-badge { border: 1px solid #c9d0eb; background: var(--accent-soft); border-radius: 5px; padding: 2px 8px; font-size: 12px; }
.lab-explanation { padding: 14px 16px; background: #f0f3fb; border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0; min-height: 64px; font-size: 14px; }
.lab-gate-options { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.lab-gate-options legend { margin-bottom: 8px; }
.lab-gate-options label { display: flex; align-items: center; gap: 7px; font-weight: 400; min-height: 36px; }
.lab-gate-options input { width: 18px; height: 18px; accent-color: var(--accent); }
.lab-verdict { background: #f4f5f7; border: 1px solid #c8cfdc; border-radius: 8px; padding: 16px; margin: 16px 0; }
.lab-verdict[data-verdict="fail"] { background: #fff5ec; border-color: #d79a64; }
.lab-verdict[data-verdict="pass"] { background: #edf8f4; border-color: #67a493; }
.lab-verdict p { margin: 5px 0 0; font-size: 14px; }
.lab-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.replay-lab .lab-reset { font-size: 12px; padding: 6px 10px; min-height: 36px; }
.lab-table-wrap { max-height: 560px; overflow: auto; border-top: 1px solid var(--border); }
.doc .lab-table { display: table; font-size: 12px; margin: 0; }
.lab-table caption { text-align: left; font-size: 12px; color: var(--muted); padding: 10px 0; }
.doc .lab-table th { font-size: 10px; position: sticky; top: 0; background: var(--bg); }
.doc .lab-table td, .doc .lab-table th { padding: 10px 8px; }
.replay-lab .lab-command-button { font: 12px/1.5 var(--font-mono); text-align: left; border: 0; padding: 0 4px; min-width: 140px; color: var(--accent); overflow-wrap: anywhere; }
.lab-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 780px) {
  body:has([data-replay-lab]) .shell { grid-template-columns: minmax(0, 1fr); gap: 0; padding-left: 18px; padding-right: 18px; }
  .lab-panel { padding: 16px; }
  .lab-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lab-stats > div { border-bottom: 1px solid var(--border); }
  .lab-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lab-filters { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media print { .lab-table-wrap { max-height: none; overflow: visible; } .replay-lab fieldset { display: none; } }
