/* ==========================================================================
   THROUGHLINE — legal documents + 404 · loads LAST, after brand.css
   Long-form technical/legal typography: a 66ch measure, a calm clause scale,
   a sticky in-page ToC at 900px+, and the mono bracket as clause numbering.
   Almost no motion: these are documents and they render immediately.
   Hairlines only, never shadows. Radius ladder 2/6/10. Existing tokens only.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. CROSS-DOCUMENT VIEW TRANSITIONS — the opt-in lives in base.css §14 and
   every page here links base.css, but the 404 must not depend on that file
   staying put: restated with the identical guard and identical value, so a
   transition into /404 never dies silently.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}

/* --------------------------------------------------------------------------
   1. DOC HERO — a document headline, not a pitch. One notch calmer than the
   marketing page-hero; the meta line carries the date in mono brackets.
   -------------------------------------------------------------------------- */
.doc-hero { padding-block: var(--sp-8) var(--sp-10); }
@media (min-width: 900px) { .doc-hero { padding-block: var(--sp-12); } }
.doc-hero .wrap { display: grid; gap: var(--sp-5); justify-items: start; }
.doc-hero h1 {
  font-weight: 800;
  font-size: clamp(2.25rem, 1.6rem + 3vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
  max-width: 18ch;
}
.doc-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); }

/* --------------------------------------------------------------------------
   2. THE FICTION BANNER — unmissable without looking broken. The dashed
   hairline is the system's existing "assumption" signal (see .assume on
   /roi); the accent edge keeps it prominent. No shadow, hairlines only.
   -------------------------------------------------------------------------- */
.fiction {
  max-width: 66ch;
  border: var(--rule) dashed var(--border-strong);
  border-left: 2px solid var(--accent);
  border-radius: var(--r-sm);
  padding: var(--sp-4) var(--sp-5);
  display: grid;
  gap: var(--sp-2);
}
.fiction p:not(.tag) { font-size: var(--t-sm); line-height: 1.55; color: var(--fg); }
.fiction p .tag { display: inline; }

/* --------------------------------------------------------------------------
   3. LAYOUT — single column first; at 900px+ a 15rem ToC rail beside the
   document. The rail is sticky and scrolls internally if taller than the
   viewport. scroll-padding-top (base.css) already clears the site header,
   and the ToC is a SIDE rail, so anchored headings and focused elements are
   never obscured by it (WCAG 2.4.11).
   -------------------------------------------------------------------------- */
.doc { padding-block: 0 var(--sp-20); }
/* minmax(0, …) everywhere: without it the article's min-content width (the
   640px table) wins over the viewport and the page scrolls sideways at 390. */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-10); align-items: start; }
@media (min-width: 900px) {
  .doc-layout { grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: var(--sp-16); }
  .doc-toc {
    position: sticky;
    top: calc(var(--header-h) + var(--sp-6));
    max-height: calc(100svh - var(--header-h) - var(--sp-12));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

.doc-toc { border-top: var(--rule) solid var(--border); padding-top: var(--sp-5); }
.doc-toc .tag { margin-bottom: var(--sp-2); }
.toc-list a[aria-current="page"] { color: var(--fg); }
.toc-list a {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 44px;
  padding-block: var(--sp-1);
  font-size: var(--t-sm);
  line-height: 1.35;
  color: var(--muted);
  text-decoration: none;
  border-bottom: var(--rule) solid var(--border);
  transition: color var(--duration-fast) var(--ease-ui);
}
.toc-list .cno { flex: none; min-width: 3.2ch; }
@media (hover: hover) and (pointer: fine) { .toc-list a:hover { color: var(--fg); } }
.toc-rel { margin-top: var(--sp-8); }

/* --------------------------------------------------------------------------
   4. DOCUMENT TYPOGRAPHY — the measure is the design. 66ch on every prose
   block; clauses separated by a hairline and 64px, paragraphs within by
   16px, so between-group space is 2x+ within-group space.
   -------------------------------------------------------------------------- */
.clause { max-width: 66ch; }
.clause + .clause { border-top: var(--rule) solid var(--border); padding-top: var(--sp-8); margin-top: var(--sp-8); }
.clause > * + * { margin-block-start: var(--sp-4); }

.clause h2 {
  font-size: clamp(1.375rem, 1.15rem + 1vw, 1.75rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.clause h3 {
  font-size: 1.0625rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-block-start: var(--sp-8);
}
.clause p { line-height: 1.6; }

/* THE SIGNATURE, as clause numbering — [1] in the heading, [1.1] below it.
   Mono, tabular, accent ink: the same bracket that labels every section of
   the marketing pages labels every clause of the contract. */
.cno {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums lining-nums;
  font-weight: 500;
  font-size: 0.78em;
  letter-spacing: 0.02em;
  color: var(--accent-text);
  margin-right: 0.4em;
}

/* Inline [illustrative] markers inside prose */
.clause .tag { display: inline; }

/* Document lists — quiet mono middot markers, generous leading */
.doc-list li {
  position: relative;
  padding-left: 1.5em;
  margin-block-start: var(--sp-3);
  line-height: 1.6;
}
.doc-list li::before {
  content: "\00b7";
  position: absolute;
  left: 0.25em;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--accent-text);
}
.doc-list b { color: var(--fg); }

.doc-note { font-size: var(--t-sm); color: var(--muted); }

/* --------------------------------------------------------------------------
   5. DOCUMENT TABLES — real <table> semantics on the .cmp base from
   brand.css. The scroll container is keyboard-reachable (tabindex="0" in
   the HTML) and labelled; the table never forces page scroll at 320px.
   -------------------------------------------------------------------------- */
.doc-table { margin-block-start: var(--sp-6); }
.clause--wide { max-width: 56rem; }
.clause--wide > p, .clause--wide > ul { max-width: 66ch; }

.cmp caption {
  text-align: left;
  padding: var(--sp-4);
  font-family: var(--font-mono);
  font-size: var(--t-tag);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: var(--rule) solid var(--border);
}
.cmp--doc { min-width: 640px; }
.cmp--doc td { color: var(--muted); }
.cmp--doc th[scope="row"], .cmp--doc td:first-child { color: var(--fg); }
.cmp--doc tbody th { white-space: normal; }
.cmp--doc .mono { font-size: 0.8125rem; }

/* --------------------------------------------------------------------------
   6. 404 — the site's one dramatic numeral, then the useful part: why you
   are here and the five places the link probably meant.
   -------------------------------------------------------------------------- */
.nf { padding-block: var(--sp-10) var(--sp-20); }
@media (min-width: 900px) { .nf { padding-block: var(--sp-16) var(--sp-24); } }
.nf-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-10); align-items: start; }
@media (min-width: 900px) { .nf-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--gutter); } }

.nf-code .huge { margin-block: var(--sp-4) var(--sp-5); }
.nf-main h1 {
  font-weight: 800;
  font-size: clamp(2.25rem, 1.6rem + 3vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
  margin-bottom: var(--sp-4);
}
.nf-main .lede { max-width: 52ch; }

.nf-why { margin-block-start: var(--sp-6); max-width: 60ch; }
.nf-why li {
  display: flex;
  gap: var(--sp-3);
  align-items: baseline;
  margin-block-start: var(--sp-3);
  font-size: var(--t-sm);
  line-height: 1.55;
  color: var(--muted);
}
.nf-why .cno { flex: none; }

.nf-links { margin-block-start: var(--sp-8); border-top: var(--rule) solid var(--border); max-width: 34rem; }
.nf-links a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: var(--sp-4);
  row-gap: 2px;
  min-height: 64px;
  padding-block: var(--sp-3);
  border-bottom: var(--rule) solid var(--border);
  text-decoration: none;
}
.nf-links .name { grid-column: 1; font-weight: 500; color: var(--fg); transition: color var(--duration-fast) var(--ease-ui); }
.nf-links .desc { grid-column: 1; font-size: var(--t-sm); color: var(--muted); }
.nf-links .go {
  grid-column: 2;
  grid-row: 1 / 3;
  font-family: var(--font-mono);
  color: var(--accent-text);
}
@media (hover: hover) and (pointer: fine) { .nf-links a:hover .name { color: var(--accent-text); } }
.nf-foot { margin-block-start: var(--sp-6); }
