/* IBM Plex, self-hosted (SIL Open Font License, see fonts/OFL.txt). Latin subset. */
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); }

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #ece9e1;
  --ink: #141a22;
  --ink-2: #3d4652;
  --ink-3: #5e6773;
  --line: #d9d4c8;
  --line-strong: #b9b2a2;
  --accent: #a3560b;       /* lantern amber, AA on --bg */
  --accent-ink: #ffffff;
  --accent-soft: #f6e3c9;
  --focus: #1f5fbf;

  --allow: #1d6b43;   --allow-bg: #dcefe3;
  --block: #a8261d;   --block-bg: #f7dedb;
  --deny:  #4b4f8a;   --deny-bg:  #e2e3f3;
  --review:#8a5a00;   --review-bg:#f6ead0;

  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Menlo, monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --max: 72rem;
  --prose: 44rem;
  --shadow: 0 1px 2px rgb(20 26 34 / 6%), 0 4px 16px rgb(20 26 34 / 6%);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0d1218;
    --surface: #141b24;
    --surface-2: #1b2430;
    --ink: #e9e6df;
    --ink-2: #b9bec6;
    --ink-3: #8e96a1;
    --line: #26303c;
    --line-strong: #3a4554;
    --accent: #f0a54a;
    --accent-ink: #1a1206;
    --accent-soft: #3a2a14;
    --focus: #7fb0ff;

    --allow: #6fd19b;   --allow-bg: #12301f;
    --block: #ff8a80;   --block-bg: #3a1714;
    --deny:  #a9adf2;   --deny-bg:  #1f2142;
    --review:#f3c35c;   --review-bg:#382a0c;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 24px rgb(0 0 0 / 25%);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; height: auto; }
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1.5px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.6em; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); letter-spacing: -0.025em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; text-wrap: pretty; }
code, kbd, pre { font-family: var(--font-mono); font-size: 0.9em; }
:not(pre) > code { background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; overflow-wrap: anywhere; }
pre {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 1rem 1.1rem; overflow-x: auto; line-height: 1.5; font-size: 0.85rem; margin: 0 0 1.25rem;
}
hr { border: 0; border-top: 1px solid var(--line); margin: 3rem 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--ink-2); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
ul, ol { padding-left: 1.25rem; margin: 0 0 1em; }
li + li { margin-top: 0.35em; }

.skip-link { position: absolute; left: -999px; top: 0.5rem; background: var(--surface); padding: 0.5rem 1rem; z-index: 100; border-radius: var(--radius-sm); }
.skip-link:focus { left: 0.5rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1rem; }
@media (min-width: 40rem) { .wrap { padding: 0 1.5rem; } }
.prose { max-width: var(--prose); }
.prose h2 { margin-top: 2.5rem; }
.prose h3 { margin-top: 1.75rem; }
.section { padding: 4rem 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { max-width: var(--prose); margin-bottom: 2rem; }
.eyebrow { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin: 0 0 0.75rem; font-weight: 500; }
.lede { font-size: 1.2rem; color: var(--ink-2); max-width: 40rem; }
.muted { color: var(--ink-3); }
.small { font-size: 0.9rem; }
.grid { display: grid; gap: 1rem; }
@media (min-width: 44rem) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 60rem) { .grid-4 { grid-template-columns: repeat(4, 1fr); } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 44rem) and (max-width: 59.99rem) { .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Header / footer ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 1rem; min-height: 4rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 600; text-decoration: none; font-size: 1.1rem; letter-spacing: -0.01em; }
.brand svg { width: 28px; height: 28px; color: var(--accent); }
.nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; font-size: 0.95rem; }
.nav a { text-decoration: none; color: var(--ink-2); padding: 0.25rem 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a[aria-current='page'] { color: var(--ink); border-bottom-color: var(--accent); }
@media (max-width: 47.99rem) {
  .site-header .wrap { padding-top: 0.6rem; padding-bottom: 0.6rem; min-height: 0; }
  .nav { margin-left: 0; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 0.25rem; }
  .nav a { white-space: nowrap; }
}
.site-footer { border-top: 1px solid var(--line); padding: 3rem 0 2.5rem; margin-top: 4rem; font-size: 0.92rem; color: var(--ink-2); }
.site-footer .cols { display: grid; gap: 2rem; }
@media (min-width: 44rem) { .site-footer .cols { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin-bottom: 0.75rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.build-pin { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-3); margin-top: 2rem; overflow-wrap: anywhere; }

/* ---------- Components ---------- */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.15rem; border-radius: 999px; font-weight: 500; text-decoration: none; border: 1.5px solid var(--line-strong); color: var(--ink); background: transparent; font: inherit; font-size: 0.98rem; cursor: pointer; }
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); color: var(--accent-ink); border-color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.35rem 1.4rem; box-shadow: var(--shadow); }
.card h3 { margin-bottom: 0.4rem; }
.card p:last-child { margin-bottom: 0; }

.pill { display: inline-flex; align-items: center; gap: 0.4rem; font-family: var(--font-mono); font-size: 0.78rem; font-weight: 500; letter-spacing: 0.04em; padding: 0.2rem 0.6rem; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-2); background: var(--surface); }
.pill-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.badge { display: inline-block; font-family: var(--font-mono); font-weight: 500; font-size: 0.8rem; letter-spacing: 0.06em; padding: 0.18rem 0.55rem; border-radius: 5px; border: 1px solid currentColor; }
.badge-ALLOW  { color: var(--allow);  background: var(--allow-bg); }
.badge-BLOCK  { color: var(--block);  background: var(--block-bg); }
.badge-DENY   { color: var(--deny);   background: var(--deny-bg); }
.badge-REVIEW { color: var(--review); background: var(--review-bg); }

.outcome { border-top: 4px solid var(--line-strong); }
.outcome-ALLOW  { border-top-color: var(--allow); }
.outcome-BLOCK  { border-top-color: var(--block); }
.outcome-DENY   { border-top-color: var(--deny); }
.outcome-REVIEW { border-top-color: var(--review); }
.outcome dl { margin: 0.75rem 0 0; font-size: 0.95rem; }
.outcome dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin-top: 0.6rem; }
.outcome dd { margin: 0.15rem 0 0; }

.callout { border-left: 4px solid var(--accent); background: var(--accent-soft); padding: 1rem 1.25rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 1.5rem 0; }
.callout > :last-child { margin-bottom: 0; }
.callout-title { font-weight: 600; margin-bottom: 0.3rem; }

.stat { display: flex; flex-direction: column; gap: 0.25rem; }
.stat-value { font-size: 2.4rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-weight: 500; }
.stat-note { font-size: 0.85rem; color: var(--ink-3); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin: 0 0 1.5rem; }
.table-wrap table th, .table-wrap table td { padding: 0.7rem 0.9rem; }
.table-wrap tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.source { font-size: 0.85rem; color: var(--ink-3); margin-top: -0.5rem; margin-bottom: 1.5rem; }
.source a { color: var(--ink-2); }

/* ---------- Hero ---------- */
.hero { padding: 4.5rem 0 3.5rem; position: relative; overflow: hidden; }
.hero h1 { max-width: 15ch; }
.hero .accent { color: var(--accent); }
.hero-grid { display: grid; gap: 3rem; align-items: center; }
@media (min-width: 62rem) { .hero-grid { grid-template-columns: 1.15fr 1fr; } }
.hero-meta { margin-top: 2rem; }
.hero-figure { margin: 0 auto 1rem; }
.hero-figure img { width: 100%; height: auto; display: block; border-radius: var(--radius); }

/* ---------- Pipeline diagram ---------- */
.pipeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; counter-reset: step; }
.pipeline li { margin: 0; display: grid; grid-template-columns: 2.25rem 1fr; gap: 0.85rem; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.95rem 1.1rem; position: relative; }
.pipeline li::before { counter-increment: step; content: counter(step); font-family: var(--font-mono); font-weight: 500; width: 2.25rem; height: 2.25rem; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line-strong); font-size: 0.9rem; }
.pipeline li.is-model { border-style: dashed; }
.pipeline li.is-model::before { border-style: dashed; color: var(--ink-3); }
.pipeline li.is-code::before { border-color: var(--accent); color: var(--accent); }
.pipeline h3 { font-size: 1rem; margin: 0 0 0.15rem; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.pipeline p { margin: 0; font-size: 0.93rem; color: var(--ink-2); }
.who { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.1rem 0.45rem; border-radius: 4px; font-weight: 500; }
.who-code { background: var(--accent-soft); color: var(--accent); }
.who-model { background: var(--surface-2); color: var(--ink-3); }
.who-human { background: var(--deny-bg); color: var(--deny); }
.legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.85rem; color: var(--ink-3); margin-top: 1rem; }

/* ---------- Walkthrough ---------- */
.wt { display: grid; gap: 1.5rem; }
@media (min-width: 62rem) { .wt { grid-template-columns: 19rem 1fr; align-items: start; } .wt-picker { position: sticky; top: 5.5rem; } }
.wt-picker h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin: 1.25rem 0 0.5rem; }
.wt-picker h2:first-child { margin-top: 0; }
.wt-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.35rem; }
.wt-list li { margin: 0; }
.wt-list a { display: block; padding: 0.55rem 0.75rem; border-radius: var(--radius-sm); text-decoration: none; border: 1px solid transparent; font-size: 0.95rem; color: var(--ink-2); }
.wt-list a:hover { background: var(--surface); color: var(--ink); }
.wt-list a[aria-current='true'] { background: var(--surface); border-color: var(--accent); color: var(--ink); font-weight: 500; }
.wt-case { scroll-margin-top: 5.5rem; }
.wt-case + .wt-case { margin-top: 2.5rem; padding-top: 2.5rem; border-top: 1px solid var(--line); }
.js .wt-case[hidden] { display: none; }
.js .wt-case + .wt-case { margin-top: 0; padding-top: 0; border-top: 0; }
.wt-head { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: baseline; margin-bottom: 1rem; }
.wt-head h2 { margin: 0; font-size: 1.6rem; }
.msg { font-size: 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin: 0 0 1rem; box-shadow: var(--shadow); }
.msg blockquote { margin: 0; overflow-wrap: anywhere; }
.msg blockquote::before { content: '\201C'; color: var(--accent); font-size: 1.6em; line-height: 0; vertical-align: -0.35em; margin-right: 0.1em; }
.facts { display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); margin: 0 0 1.75rem; font-size: 0.92rem; }
.fact { background: var(--surface-2); border-radius: var(--radius-sm); padding: 0.6rem 0.8rem; }
.fact b { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); font-weight: 500; }
.fact code { background: none; padding: 0; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.9rem; }
.steps > li { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; }
.steps h3 { font-size: 1rem; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.4rem; }
.steps p { margin: 0 0 0.5rem; color: var(--ink-2); font-size: 0.95rem; }
.steps p:last-child { margin-bottom: 0; }
.step-skipped { opacity: 0.6; }
.scenarios { width: 100%; margin-top: 0.5rem; font-size: 0.93rem; }
.scenarios td:last-child { white-space: nowrap; }
.scenarios tr.is-gap td { background: var(--block-bg); }
.scenarios code { font-size: 0.78rem; }
.reason { display: block; font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-3); margin-top: 0.2rem; }
.registry dl { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.75rem; font-size: 0.88rem; margin: 0; }
.registry dt { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-2); overflow-wrap: anywhere; }
.registry dd { margin: 0; color: var(--ink-3); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.timeline li { margin: 0; padding: 0 0 1.4rem 1.3rem; position: relative; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 0.45rem; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.timeline .cp { font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent); }
.timeline h3 { font-size: 1rem; margin: 0.1rem 0 0.25rem; }
.timeline p { margin: 0; font-size: 0.93rem; color: var(--ink-2); }

.limits-list { list-style: none; padding: 0; display: grid; gap: 0.75rem; }
.limits-list li { margin: 0; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--review); border-radius: var(--radius-sm); padding: 0.9rem 1.1rem; }
.limits-list b { display: block; margin-bottom: 0.2rem; }

@media (prefers-reduced-motion: no-preference) {
  .btn, .nav a, .wt-list a { transition: color 0.15s, background-color 0.15s, border-color 0.15s; }
}
.footer-about { margin-top: 0.75rem; }
.grid > *, .wt > *, .hero-grid > * { min-width: 0; }
.badge-row { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; }
[tabindex='-1']:focus { outline: none; }
