/* Kahn1 site: every page but the playground and Snake, which keep their CSS
   inline with the same tokens. Warm paper, one ink, one accent; Instrument
   Serif for titles, IBM Plex Sans for text, IBM Plex Mono for labels and code. */
:root {
  --bg: #faf8f5;
  --ink: #1c1b19;
  --text: #3d3a35;
  --muted: #5f5a52;
  --faint: #8f897f;
  --rule: #e4dfd6;
  --dot: #bdb6ab;
  --track: #f1ede6;
  --accent: #d9542b;
  --serif: "Libre Caslon Display", "Instrument Serif", Georgia, serif;  /* the first holds only the digit 1 */
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --side: 240px;
  --wrap: 1120px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  /* Docking progress of the home logo, 0 in the hero, 1 in the corner. Other pages stay at 1. */
  --p: 1;
  --pe: 1;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.6;
}
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
p { margin: 0 0 14px; }
em { font-style: italic; }
code {
  font-family: var(--mono); font-size: 0.875em; background: var(--track); padding: 2px 6px;
}
:focus-visible { outline: 1px dashed var(--ink); outline-offset: 3px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 40; }
.skip:focus { left: 16px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 14px; }

/* -- shell: logo, sidebar, top bar, menu ---------------------------------- */
.brand {
  position: fixed; left: 32px; top: 28px; z-index: 20;
  font-family: var(--mono); font-weight: 600; font-size: 29px; line-height: 30px; letter-spacing: 5.8px;
  text-decoration: none; color: var(--ink);
}
.brand span, .wordmark span { color: var(--accent); }
.brand:hover { color: var(--ink); }

.side {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--side); z-index: 10;
  padding: 0 28px 24px 32px; overflow-y: auto; scrollbar-width: none;
  display: flex; flex-direction: column; gap: 24px;
  background: var(--bg); border-right: 1px solid var(--rule);
  opacity: var(--p); transform: translateX(calc((1 - var(--pe)) * -24px));
}
/* The logo sits over the top of the sidebar: when the sidebar scrolls, its
   content passes under this band instead of under the letters. */
.side::before {
  content: ""; position: sticky; top: 0; z-index: 1; flex: none; height: 64px;
  margin: 0 -28px 0 -32px; background: var(--bg);
}
html:not(.docked) .side { pointer-events: none; }
.side .menu-head { display: none; }
.kick { font-family: var(--mono); font-size: 11px; letter-spacing: 2px; color: var(--faint); }
.otp .kick { padding-bottom: 12px; }
.otp-list { position: relative; display: grid; padding-left: 22px; }
.otp-list .track, .otp-list .fill { position: absolute; left: 4px; width: 1px; background: var(--rule); }
.otp-list .fill { background: var(--ink); height: 0; transition: height .18s linear; }
.otp-list .dot {
  position: absolute; left: 0; top: 0; width: 9px; height: 9px; margin-top: -4.5px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px var(--bg); opacity: 0; transition: top .18s linear, opacity .3s;
}
.otp-list a {
  display: flex; align-items: center; min-height: 36px; padding: 6px 0; text-decoration: none;
  font-size: 15px; line-height: 1.25; color: var(--faint); transition: color .3s; text-wrap: pretty;
}
.otp-list a.on, .otp-list a:hover { color: var(--ink); }
.side-links { display: grid; gap: 8px; margin-top: auto; }
.side-links .rule { height: 1px; background: var(--rule); margin-bottom: 4px; }
.side-links .kick { padding: 6px 0 2px; }
.side-links > a { text-decoration: none; font-size: 14px; line-height: 1.3; }
.side-links > a[aria-current="page"] { color: var(--accent); }
.icons { display: flex; gap: 8px; padding-top: 12px; flex-wrap: wrap; align-items: center; }
.icons a {
  display: flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border: 1px solid var(--rule); text-decoration: none; color: var(--ink); font-size: 17px; line-height: 1;
}
.icons a:hover { border-color: var(--ink); color: var(--ink); }
.icons svg { width: 18px; height: 18px; fill: currentColor; }

/* Language and cookies: a small tag in the bottom-right corner, out of the way
   while the consent banner is open (the banner sits in the same place). */
.prefs {
  position: fixed; right: 16px; bottom: 16px; z-index: 12;
  display: flex; align-items: center; gap: 10px; padding: 7px 12px;
  background: rgba(250, 248, 245, 0.92); border: 1px solid var(--rule);
  font-family: var(--mono); font-size: 11px; letter-spacing: 2px; line-height: 1; color: var(--faint);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.prefs a, .prefs button { color: var(--faint); text-decoration: none; }
.prefs button { font: inherit; letter-spacing: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.prefs a:hover, .prefs button:hover, .prefs a[aria-current="page"] { color: var(--ink); }
.prefs i { width: 1px; height: 11px; background: var(--rule); }
.consent:not([hidden]) ~ .prefs, html.menu-open .prefs { display: none; }

.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 60px; z-index: 11;
  display: none; align-items: center; justify-content: flex-end; padding: 0 clamp(16px, 4vw, 32px);
}
.topbar::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--bg);
  border-bottom: 1px solid var(--rule); opacity: calc((var(--p) - 0.6) * 2.5);
}
.menu-btn, .menu-close {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 4px; background: none; border: 0; cursor: pointer;
  font-family: var(--mono); font-size: 13px; letter-spacing: 2px; color: var(--ink);
}
.menu-btn { opacity: calc(0.35 + 0.65 * var(--p)); }
.menu-btn i { display: grid; gap: 4px; }
.menu-btn i::before, .menu-btn i::after { content: ""; display: block; width: 18px; height: 1px; background: var(--ink); }

.shell { padding-left: var(--side); }
main.page { max-width: var(--wrap); margin: 0 auto; padding: 0 clamp(20px, 4vw, 32px); }

@media (max-width: 899px) {
  html { scroll-padding-top: 72px; }
  .brand { top: 15px; }
  .topbar { display: flex; }
  .side { display: none; }
  .shell { padding-left: 0; }
  /* The menu is the sidebar, full screen. */
  html.menu-open { overflow: hidden; }
  html.menu-open .side {
    display: flex; justify-content: flex-start; gap: 32px; width: auto; right: 0; z-index: 30;
    padding: 20px clamp(20px, 5vw, 40px) 40px; border-right: 0; opacity: 1; transform: none; pointer-events: auto;
  }
  .side::before { display: none; }
  .side .menu-head { display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
  .wordmark { font-family: var(--mono); font-weight: 600; font-size: 22px; letter-spacing: 1px; }
  html.menu-open .otp .kick { padding-bottom: 8px; }
  html.menu-open .otp-list { padding-left: 0; }
  html.menu-open .otp-list .track, html.menu-open .otp-list .fill, html.menu-open .otp-list .dot { display: none; }
  html.menu-open .otp-list a {
    height: auto; min-height: 48px; gap: 12px; border-bottom: 1px solid var(--rule);
    font-family: var(--serif); font-size: 28px; color: var(--ink);
  }
  html.menu-open .otp-list a::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: transparent; flex: none; }
  html.menu-open .otp-list a.on::before { background: var(--accent); }
  html.menu-open .side-links { gap: 12px; margin-top: 0; }
  html.menu-open .side-links > a { font-size: 16px; padding: 10px 0; }
  html.menu-open .icons a { width: 44px; height: 44px; }
}

/* -- type ----------------------------------------------------------------- */
.kicker { font-family: var(--mono); font-size: 13px; letter-spacing: 3px; color: var(--accent); }
.display, .sec > h2, .page-hero h1 {
  margin: 0; font-family: var(--serif); font-weight: 400; line-height: 1.02; text-wrap: pretty;
}
.display, .sec > h2 { font-size: clamp(40px, 4.4vw, 64px); }
.lede { margin: 0; font-size: 18px; line-height: 1.65; color: var(--text); text-wrap: pretty; max-width: 760px; }
.label-s { font-family: var(--mono); font-size: 12px; letter-spacing: 2px; color: var(--faint); }

/* -- sections ------------------------------------------------------------- */
.sec {
  padding: clamp(72px, 11vw, 120px) 0; border-top: 1px solid var(--rule);
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 48px;
}
.sec > * { margin: 0; min-width: 0; }
.head { display: grid; gap: 16px; max-width: 760px; }
.head p { margin: 0; font-size: 18px; line-height: 1.6; color: var(--text); text-wrap: pretty; }

/* Content pages: a hero, then ruled sections with a serif title. */
.page-hero { padding: 112px 0 36px; display: grid; gap: 20px; }
.page-hero h1 { font-size: clamp(48px, 6vw, 88px); }
.page-hero .lead { margin: 0; font-size: 19px; line-height: 1.6; color: var(--text); max-width: 760px; text-wrap: pretty; }
.toc { border: 1px solid var(--rule); padding: 16px 22px; max-width: 760px; }
.toc ol { margin: 0; padding: 0 0 0 26px; columns: 2; column-gap: 28px; font-size: 15px; line-height: 2; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--ink); text-decoration: underline; }
@media (min-width: 900px) { .toc { display: none; } }  /* the sidebar lists the sections */
/* Caveats page: one compact row per caveat, the number in the margin. */
.sec.cv {
  padding: 28px 0 30px; grid-template-columns: 56px minmax(0, 820px); gap: 8px 0;
}
.sec.cv::before {
  content: attr(data-n); grid-column: 1; grid-row: 1; padding-top: 7px;
  font-family: var(--mono); font-size: 13px; letter-spacing: 1px; color: var(--accent);
}
.sec.cv > h2 { grid-column: 2; font-size: clamp(24px, 2.2vw, 30px); line-height: 1.2; }
.sec.cv > p { grid-column: 2; font-size: 16px; line-height: 1.65; color: var(--text); }
.page-hero + .sec.cv { margin-top: 0; }
@media (max-width: 599px) { .sec.cv { grid-template-columns: 36px minmax(0, 1fr); } }
.sec.doc { gap: 20px; padding: clamp(36px, 4.5vw, 52px) 0; }
.sec.doc > h2 { margin-bottom: 4px; }
.sec.doc > p, .sec.doc > ul { max-width: 820px; }
.sec.doc > p { color: var(--text); font-size: 16px; line-height: 1.65; }
.sec h3 { margin: 16px 0 0; font-size: 20px; line-height: 1.35; font-weight: 500; }
.sec h3.sub { margin-top: 32px; }
.sec .tbl-wrap { margin: 8px 0; }
.sec.doc .tbl td code, .sec.doc p code, .plain code { white-space: nowrap; }
.intro { max-width: 760px; font-size: 18px; line-height: 1.6; color: var(--text); }
.note { font-family: var(--mono); font-size: 12px; letter-spacing: 1px; color: var(--faint); }
ul.plain { margin: 0; padding: 0; list-style: none; }
ul.plain li { padding: 14px 0; border-bottom: 1px solid var(--rule); font-size: 16px; line-height: 1.6; color: var(--text); }
ul.plain li:first-child { border-top: 1px solid var(--rule); }
ul.plain b { color: var(--ink); font-weight: 500; }
.callout { border-left: 2px solid var(--accent); padding: 4px 0 4px 18px; font-size: 16px; line-height: 1.65; color: var(--text); max-width: 820px; }
.callout b { color: var(--ink); font-weight: 500; }

/* buttons */
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  font-family: var(--mono); font-size: 12px; letter-spacing: 2px; padding: 10px 18px; text-decoration: none;
  color: var(--ink); border: 1px solid var(--ink); background: transparent;
}
.btn:hover { background: var(--ink); color: var(--bg); }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.more { font-family: var(--mono); font-size: 14px; letter-spacing: 2px; justify-self: start; }

/* tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.tbl th {
  text-align: left; font-weight: 400; font-family: var(--mono); font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--faint); padding: 12px; white-space: nowrap;
}
.tbl th.k1 { color: var(--accent); }
.tbl td, .tbl tbody th { padding: 14px 12px; border-top: 1px solid var(--rule); vertical-align: top; }
.tbl tbody th {
  font-family: var(--mono); font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--ink); white-space: normal;
}
.tbl td.r, .tbl th.r { text-align: right; }
.tbl td b { font-weight: 600; }
.tbl.cmp { min-width: 560px; }

/* code blocks: ink panels */
.term, pre.src {
  margin: 0; background: var(--ink); color: var(--bg); padding: 16px 18px;
  font-family: var(--mono); font-size: 13px; line-height: 1.6; overflow-x: auto; white-space: pre;
}
.term .c { color: var(--dot); }
.term .d { color: var(--faint); user-select: none; }
pre.src { white-space: pre-wrap; overflow-wrap: anywhere; }

/* numbers */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); border: 1px solid var(--rule); }
.stat { padding: 22px 22px 20px; border-left: 1px solid var(--rule); margin-left: -1px; }
.stat .n { display: block; font-family: var(--serif); font-size: 44px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat .l { display: block; margin-top: 10px; font-family: var(--mono); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; }
.stat .s { display: block; margin-top: 4px; font-size: 13px; line-height: 1.5; color: var(--muted); }

/* horizontal accuracy bars (benchmarks) */
.bars { display: flex; flex-direction: column; gap: 12px; }
.row {
  display: grid; grid-template-columns: 300px minmax(0, 1fr) 76px; gap: 12px; align-items: center;
  font-family: var(--mono); font-size: 13px; line-height: 1.45; color: var(--muted);
}
.row .opt small { display: block; font-size: 11px; letter-spacing: 1px; color: var(--faint); }
.row .bar { height: 10px; background: var(--track); position: relative; }
.row .bar b { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); }
.row.base .bar b { background: var(--dot); }
.row .bar i { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 1px dashed var(--muted); }
.row .pct { text-align: right; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.legend { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.legend i { display: inline-block; width: 0; height: 12px; border-left: 1px dashed var(--muted); margin: 0 6px -2px 0; }
.label {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 2px; color: var(--faint);
}

/* -- vertical head-to-head chart (Kahn1 vs JEV) --------------------------- *
 * Kahn1 4B in the accent, Kahn1 3B hatched in the accent, JEV in grey. */
.vchart { margin: 0; }
.vc-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; font-family: var(--mono); font-size: 12px; letter-spacing: 1px; color: var(--muted); margin-bottom: 26px; }
.vc-legend i { display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px; background: var(--accent); }
.vc-legend i.jev, .vc-b.jev { background: var(--dot); }
.vc-legend i.k3, .vc-b.k3 {
  background: repeating-linear-gradient(135deg, var(--accent) 0 2px, #f3d3c7 2px 4px);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.vc-sets { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 40px 48px; }
.vc-set { min-width: 0; }
.vc-title { font-family: var(--mono); font-size: 12px; letter-spacing: 2px; font-weight: 600; margin-bottom: 4px; }
.vc-sub { font-family: var(--mono); font-size: 11px; letter-spacing: 1px; color: var(--faint); margin-bottom: 18px; }
.vc-plot { position: relative; height: 220px; margin-left: 34px; border-bottom: 1px solid var(--ink); }
.vc-grid { position: absolute; inset: 0; pointer-events: none; }
.vc-grid span { position: absolute; left: 0; right: 0; border-top: 1px solid var(--track); }
.vc-grid em {
  position: absolute; left: -34px; width: 28px; text-align: right; transform: translateY(-50%);
  font-style: normal; font-family: var(--mono); font-size: 10px; color: var(--faint); font-variant-numeric: tabular-nums;
}
.vc-cols { position: absolute; inset: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.vc-g { display: flex; justify-content: center; align-items: flex-end; gap: 3px; height: 100%; position: relative; }
.vc-g.total::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; border-left: 1px solid var(--rule); }
.vc-b { position: relative; width: 22px; background: var(--accent); outline: none; }
.vc-b .val {
  position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 10px; line-height: 1; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.vc-b.hi .val { color: var(--ink); font-weight: 600; }
.vc-b::after {  /* tooltip */
  content: attr(data-tip); position: absolute; bottom: calc(100% + 22px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 6px 9px; font-family: var(--mono); font-size: 11px; line-height: 1.4; letter-spacing: 0.5px;
  white-space: pre; pointer-events: none; opacity: 0; transition: opacity 120ms; z-index: 5;
}
.vc-b:hover::after, .vc-b:focus-visible::after { opacity: 1; }
.vc-b:not(:hover):not(:focus-visible)::after { display: none; }
.vc-b:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--ink); }
.vc-g:hover .vc-b:not(:hover) { opacity: 0.55; }
.vc-x { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin-left: 34px; padding-top: 8px; }
.vc-x span { text-align: center; font-family: var(--mono); font-size: 11px; letter-spacing: 1px; color: var(--muted); }
.vc-x span.total { font-weight: 600; color: var(--ink); }
.vc-foot { margin-top: 28px; display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.vc-foot details { font-size: 14px; color: var(--muted); width: 100%; }
.vc-foot summary { cursor: pointer; font-family: var(--mono); letter-spacing: 2px; font-size: 12px; }
.vc-foot details .tbl-wrap { margin-top: 10px; }
.vc-more { font-family: var(--mono); font-size: 13px; letter-spacing: 1px; }

/* -- models page: the two-size table stacks on narrow screens ------------- */
@media (max-width: 859px) {
  .tbl.models thead { display: none; }
  .tbl.models, .tbl.models tbody, .tbl.models tr, .tbl.models th, .tbl.models td { display: block; width: auto; }
  .tbl.models tr { padding: 10px 0; border-top: 1px solid var(--rule); }
  .tbl.models th[scope="row"] { padding: 0 0 6px; border: 0; }
  .tbl.models td { padding: 3px 0; border: 0; overflow-wrap: anywhere; }
  .tbl.models td::before { content: attr(data-label) " · "; color: var(--faint); font-family: var(--mono); font-size: 11px; letter-spacing: 1px; }
  .tbl.models td code { white-space: normal; overflow-wrap: anywhere; }
}

/* -- setup prompt (guide) -------------------------------------------------- */
.prompt-box { border: 1px solid var(--ink); }
.prompt-box .bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  border-bottom: 1px solid var(--rule); padding: 10px 14px; font-family: var(--mono); font-size: 11px; letter-spacing: 2px; color: var(--faint);
}
.prompt-box pre {
  margin: 0; padding: 16px 18px; font-family: var(--mono); font-size: 12px; line-height: 19px; white-space: pre-wrap;
  overflow-wrap: anywhere; max-height: 360px; overflow-y: auto; scrollbar-width: thin; color: var(--ink);
}
.launch { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 18px; }
.launch a { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--rule); padding: 16px 18px; text-decoration: none; }
.launch a:hover { border-color: var(--ink); color: var(--ink); }
.launch a b { font-family: var(--mono); font-size: 13px; letter-spacing: 2px; font-weight: 600; }
.launch a span { font-size: 14px; line-height: 1.5; color: var(--muted); }
.launch a.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.launch a.primary span { color: var(--rule); }
.launch a.primary:hover { background: var(--accent); border-color: var(--accent); }
.copy-btn {
  font-family: var(--mono); font-size: 12px; letter-spacing: 2px; cursor: pointer; background: var(--ink); color: var(--bg);
  border: 1px solid var(--ink); padding: 6px 12px;
}
.copy-btn:hover { background: var(--accent); border-color: var(--accent); }

/* -- footer ---------------------------------------------------------------- */
.foot {
  border-top: 1px solid var(--rule); padding: 40px clamp(20px, 4vw, 32px);
  display: flex; flex-wrap: wrap; gap: 20px 24px; justify-content: space-between;
  font-family: var(--mono); font-size: 13px; letter-spacing: 1px; color: var(--muted);
}
.foot nav { display: flex; flex-wrap: wrap; gap: 20px; }
.foot .disc { flex-basis: 100%; font-size: 12px; color: var(--faint); letter-spacing: 0.5px; }

/* -- consent banner (same as the playground) ------------------------------- */
.consent {
  position: fixed; right: 16px; bottom: 16px; z-index: 35; max-width: 400px;
  background: var(--bg); border: 1px solid var(--ink); padding: 18px 20px;
  font-size: 14px; line-height: 1.5; color: var(--text);
}
.consent p { margin: 0 0 14px; }
.consent .row2 { display: flex; gap: 8px; }
.consent button {
  flex: 1; font-family: var(--mono); font-size: 12px; letter-spacing: 2px; padding: 10px 14px;
  background: transparent; color: var(--ink); border: 1px solid var(--ink); cursor: pointer;
}
.consent button.primary { background: var(--ink); color: var(--bg); }
.consent button:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }
@media (max-width: 599px) { .consent { left: 16px; right: 16px; max-width: none; } }

/* -- 404 -------------------------------------------------------------------- */
.lost { min-height: 100vh; display: grid; place-content: center; gap: 22px; padding: 80px 24px; text-align: center; }
.lost h1 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(44px, 6vw, 80px); line-height: 1.05; }
.lost p { margin: 0; color: var(--text); font-size: 18px; }
.lost .cta { justify-content: center; }

/* ========================================================================== *
 * Home page                                                                  *
 * ========================================================================== */
@keyframes k1cue { 0% { transform: translateY(-100%) } 60%, 100% { transform: translateY(300%) } }

/* The logo: five slots, fixed, moved by site.js from the hero to the corner. */
.k1-logo > div { position: fixed; left: 0; top: 0; width: 200px; height: 500px; z-index: 20; transform-origin: 0 0; pointer-events: none; }
.k1-logo.docked > div { pointer-events: auto; cursor: pointer; }
.k1-slot { position: absolute; inset: 0; }
.k1-glyph { position: absolute; top: 0; width: 200px; height: 300px; }
.k1-glyph > div {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 600; font-size: 290px; line-height: 1;
}
.k1-glyph .scan {
  inset: -10px -30px; opacity: 0;
  background: repeating-linear-gradient(0deg, rgba(250,248,245,.55) 0 2px, transparent 2px 6px);
}
.k1-dist { position: absolute; left: 0; top: 0; width: 200px; }
.k1-dist b { position: absolute; width: 34px; }
.k1-dist i { position: absolute; top: 462px; width: 34px; text-align: center; font-style: normal; font-family: var(--mono); font-size: 18px; }
.k1-static {  /* without JS */
  display: block; text-align: center; padding-top: 30vh;
  font-family: var(--mono); font-weight: 600; font-size: clamp(72px, 16vw, 200px); line-height: 1; letter-spacing: .1em;
}
.k1-static span { color: var(--accent); }
.js .k1-static { display: none; }

.hero-k { position: relative; height: 100vh; min-height: 560px; overflow: hidden; }
.hero-k .tag {
  position: absolute; left: 0; right: 0; top: calc(42vh + min(150px, 10.64vw) + 40px);
  display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 0 24px; text-align: center;
}
html:not(.js) .hero-k .tag { position: static; padding-top: 48px; }
.hero-k h1 {
  margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(36px, 4.6vw, 76px); line-height: 1.05; text-wrap: pretty;
}
.facts {
  font-family: var(--mono); font-size: 13px; letter-spacing: 3px; color: var(--muted);
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; column-gap: 14px; row-gap: 8px;
}
.facts i { color: var(--accent); font-style: normal; }
.cue {
  position: absolute; left: 50%; bottom: 32px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-decoration: none; color: var(--faint);
  font-family: var(--mono); font-size: 12px; letter-spacing: 3px; opacity: 0;
}
.cue:hover { color: var(--ink); }
.cue span:last-child { position: relative; width: 1px; height: 56px; background: var(--rule); overflow: hidden; display: block; }
.cue span:last-child::after {
  content: ""; position: absolute; left: 0; top: 0; width: 1px; height: 18px; background: var(--ink);
  animation: k1cue 1.8s cubic-bezier(.65, 0, .35, 1) infinite;
}
@media (max-height: 639px) { .cue { display: none; } }
.home .shell { transition: padding-left .5s var(--ease); }

/* reveal on scroll (site.js adds .rv, then .in) */
.rv { opacity: 0; transform: translateY(28px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.rv.in { opacity: 1; transform: none; }

/* Why "Kahn1" */
.why { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: clamp(32px, 6vw, 64px); align-items: center; }
.portrait { margin: 0; display: grid; gap: 12px; width: 100%; max-width: 440px; }
.portrait .ph { position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: var(--track); filter: grayscale(1) contrast(1.05); }
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.portrait figcaption { font-family: var(--mono); font-size: 12px; letter-spacing: 2px; color: var(--muted); }
.why .copy { display: grid; gap: 24px; align-content: center; }
.why .copy p { margin: 0; }

/* Three primitives: one state, three typed questions */
.onestate { display: grid; gap: 10px; padding: clamp(20px, 4vw, 32px); border: 1px solid var(--ink); }
.onestate p { margin: 0; font-family: var(--serif); font-size: clamp(26px, 2.6vw, 36px); line-height: 1.25; text-wrap: pretty; }
.prims { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 24px; }
.prim { display: grid; grid-template-rows: auto 1fr; }
.prim .stem { justify-self: center; width: 1px; height: 48px; background: var(--rule); position: relative; overflow: hidden; }
.prim .stem::after { content: ""; position: absolute; left: 0; top: 0; width: 1px; height: 0; background: var(--ink); transition: height .6s ease var(--d0, 0s); }
.prim-card { display: grid; grid-template-rows: auto auto auto 1fr; align-content: start; gap: 16px; padding: 24px; border: 1px solid var(--rule); background: var(--bg); }
.prim-card .hd { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.prim-card h3 { margin: 0; font-family: var(--mono); font-size: 17px; font-weight: 600; }
.prim-card .q { margin: 0; font-size: 16px; line-height: 1.5; min-height: 48px; }
.pbars { display: grid; gap: 10px; align-content: start; }
.pbar { display: grid; grid-template-columns: minmax(0, 72px) minmax(0, 1fr) 40px; gap: 10px; align-items: center; font-family: var(--mono); font-size: 13px; }
.pbar > span:nth-child(2) { height: 8px; background: var(--track); position: relative; }
.pbar b { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--dot); transition: width .9s var(--ease) var(--d1, 0s); }
.pbar.win b { background: var(--accent); }
.pbar > span:last-child { text-align: right; color: var(--muted); }
.prims-note { padding-top: 20px; font-family: var(--mono); font-size: 11px; letter-spacing: 2px; color: var(--faint); }
.primset.on .stem::after { height: 100%; }
.primset.on .pbar b { width: var(--w); }

/* Landscape */
.ico-legend { display: flex; flex-wrap: wrap; gap: 24px; font-family: var(--mono); font-size: 12px; letter-spacing: 2px; color: var(--muted); }
.ico-legend span { display: flex; align-items: center; gap: 8px; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; flex: none; }
.land { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.land > div { display: grid; gap: 14px; align-content: start; padding: 24px; border: 1px solid var(--rule); }
.land .hd { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.land h3 { margin: 0; font-family: var(--mono); font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.land .hd > span { font-family: var(--mono); font-size: 12px; letter-spacing: 2px; color: var(--faint); }
.land p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--text); text-wrap: pretty; }
.land > .me { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.land > .me .hd > span { color: var(--accent); }
.land > .me p { color: var(--rule); }

/* dark panel */
.darkp { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: clamp(20px, 4vw, 40px); padding: clamp(24px, 4vw, 36px); background: var(--ink); color: var(--bg); }
.darkp > div { display: grid; gap: 16px; align-content: start; }
.darkp .kicker { font-size: 12px; letter-spacing: 2px; }
.darkp h3 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 3vw, 42px); line-height: 1.1; text-wrap: pretty; }
.darkp p { margin: 0; font-size: 16px; line-height: 1.65; color: var(--rule); text-wrap: pretty; }
.darkp p.fine { font-size: 14px; color: var(--dot); }
.darkp a { color: var(--bg); }

/* Use cases */
.uses { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 48px 40px; }
.uses > div { display: grid; gap: 10px; align-content: start; }
.uses .n { font-family: var(--mono); font-size: 13px; letter-spacing: 2px; color: var(--accent); }
.uses h3 { margin: 0; font-size: 20px; font-weight: 500; }
.uses p { margin: 0; font-size: 16px; line-height: 1.6; color: var(--text); }

/* Caveats */
.cav { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); column-gap: 40px; counter-reset: c; }
.cav li { display: flex; gap: 16px; padding: 18px 0; border-top: 1px solid var(--rule); counter-increment: c; }
.cav li::before { content: counter(c, decimal-leading-zero); font-family: var(--mono); font-size: 13px; color: var(--accent); padding-top: 3px; }
.cav li span { font-size: 17px; line-height: 1.45; }


/* -- narrow screens --------------------------------------------------------- */
@media (max-width: 899px) {
  .page-hero { padding-top: 96px; }
  .row { grid-template-columns: minmax(0, 1fr) 64px; row-gap: 4px; }
  .row .opt { grid-column: 1 / -1; }
  .sec.doc .tbl td code, .sec.doc p code, .plain code { white-space: normal; overflow-wrap: anywhere; }
  .toc ol { columns: 1; }
  .vc-b { width: 15px; }
  .vc-g { gap: 2px; }
  .vc-b .val { font-size: 8.5px; letter-spacing: -0.3px; }
  .stat .n { font-size: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .rv { opacity: 1; transform: none; transition: none; }
  .prim .stem::after, .pbar b, .home .shell { transition: none; }
  .cue span:last-child::after { animation: none; }
}
