/* Legal pages (Privacy, Terms, Cookies) and the 404 page. 20 Nov 2026. Builder: docs/legal-build/build_legal.py.
   Rhythm on desktop: the title block starts ~195px from the top of the window, blocks are 98px apart. */

/* ---------- Title block ---------- */
.legal-hero { display: grid; gap: 28px; padding-block: clamp(24px, 3vw, 44px) clamp(56px, 6.8vw, 98px); }
.legal-hero h1 { font-size: var(--t-title); }
.legal-hero h1 span { display: block; }
.legal-hero-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px 48px; }
.legal-hero .hero-copy { max-width: 36em; font-size: var(--t-lead); line-height: 1.55; color: var(--ink-2); }
.legal-meta { display: flex; flex-wrap: wrap; gap: 8px 24px; font-family: var(--mono); font-size: var(--t-label); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.legal-meta b { font-weight: 500; color: var(--ink); }

/* ---------- Body: contents on the left, text on the right ---------- */
.legal-body { display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 760px); justify-content: space-between; gap: 48px clamp(48px, 7vw, 120px); padding-block: clamp(56px, 6.8vw, 98px) clamp(72px, 9vw, 128px); }
.legal-toc { position: sticky; top: 108px; align-self: start; max-height: calc(100vh - 140px); overflow: auto; }
.legal-toc-label, .legal-label { margin-bottom: 16px; font-family: var(--mono); font-size: var(--t-label); letter-spacing: .08em; text-transform: uppercase; color: #6b665f; }
.legal-toc ol { list-style: none; padding: 0; display: grid; gap: 2px; counter-reset: toc; }
.legal-toc a { position: relative; display: grid; grid-template-columns: 28px 1fr; gap: 4px; padding: 7px 0; font-size: var(--t-small); line-height: 1.4; color: #6b665f; text-decoration: none; transition: color .2s var(--ease); }
.legal-toc a::before { counter-increment: toc; content: counter(toc, decimal-leading-zero); font-family: var(--mono); font-size: 11px; line-height: 20px; color: var(--faint); }
.legal-toc a:hover, .legal-toc a[aria-current] { color: var(--ink); }
.legal-toc a[aria-current]::before { color: var(--red); }

.legal-text { min-width: 0; font-feature-settings: 'liga' 0, 'calt' 0, 'dlig' 0; } /* keeps “(c)” from turning into © */
.legal-text > section { padding-top: 48px; margin-top: 48px; border-top: 1px solid var(--hair); scroll-margin-top: 96px; }
.legal-text > section:first-of-type { margin-top: 56px; }
.legal-text h2 { display: grid; grid-template-columns: 44px 1fr; align-items: baseline; margin-bottom: 20px; font-size: clamp(24px, .8vw + 18px, 30px); line-height: 1.2; letter-spacing: -.02em; }
.legal-n { font-family: var(--mono); font-size: var(--t-small); letter-spacing: 0; color: var(--faint); }
.legal-text h3 { margin: 28px 0 10px; font-size: var(--t-lead); font-weight: 500; }
.legal-text p, .legal-text li { line-height: 1.65; color: var(--ink-2); }
.legal-text p + p, .legal-text p + ul, .legal-text ul + p, .legal-text p + .legal-table, .legal-text .legal-table + p { margin-top: 14px; }
.legal-text ul { display: grid; gap: 8px; padding: 0; list-style: none; }
.legal-text ul li { position: relative; padding-left: 22px; }
.legal-text ul li::before { content: ''; position: absolute; left: 2px; top: .7em; width: 6px; height: 6px; background: var(--graphic); }
.legal-text a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.legal-text a:hover { color: var(--red); }
.legal-text strong { font-weight: 600; color: var(--ink); }
.legal-text section > :where(p, ul, .legal-table, h3) { margin-left: 44px; }

/* "In short": a filled grey card, small red squares as bullets. */
.legal-short { padding: var(--card-pad); border-radius: var(--r-l); background: var(--surface); }
.legal-short h2 { display: block; margin-bottom: 18px; font-size: var(--t-h3); }
.legal-short ul { gap: 12px; }
.legal-short li { color: var(--ink); }
.legal-short ul li::before { background: var(--red); }

/* Data tables: real tables on desktop, stacked cards on phones. */
.legal-table { width: calc(100% - 44px); border-collapse: collapse; font-size: var(--t-small); }
.legal-table th { padding: 0 16px 12px 0; font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; text-align: left; color: #6b665f; border-bottom: 1px solid var(--ink); }
.legal-table td { padding: 14px 16px 14px 0; line-height: 1.55; vertical-align: top; color: var(--ink-2); border-bottom: 1px solid var(--hair); }
.legal-table td:first-child { font-weight: 500; color: var(--ink); }
.legal-table code { font-family: var(--mono); font-size: 13px; color: var(--ink); }
.legal-chip { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: var(--r-pill); background: var(--surface-2); font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }

/* Facts Eugene still has to confirm: visible on purpose until they are filled in. */
.legal-todo { padding: 0 4px; border-radius: 4px; background: var(--surface-2); color: var(--ink); box-shadow: inset 0 -2px 0 var(--red); }

.legal-related { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 64px; padding-top: 32px; border-top: 1px solid var(--hair); }

/* ---------- 404 ---------- */
.nf { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: center; gap: 48px clamp(48px, 6vw, 96px); min-height: calc(100vh - 76px); padding-block: clamp(48px, 7vw, 98px); }
.nf-text { display: grid; gap: 24px; justify-items: start; }
.nf h1 { font-size: clamp(48px, 5.6vw, 96px); line-height: .98; letter-spacing: -.045em; }
.nf h1 span { display: block; }
.nf-copy { max-width: 30em; font-size: var(--t-lead); line-height: 1.55; color: var(--ink-2); }
.nf .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.nf-links { width: 100%; max-width: 520px; margin-top: 16px; border-top: 1px solid var(--hair); list-style: none; padding: 0; }
.nf-links a { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--hair); text-decoration: none; transition: color .2s var(--ease); }
.nf-links a span { font-size: var(--t-small); color: var(--muted); }
.nf-links a::after { content: '→'; color: var(--faint); transition: transform .25s var(--ease), color .2s var(--ease); }
.nf-links b { font-weight: 500; }
.nf-links a:hover { color: var(--red); }
.nf-links a:hover::after { color: var(--red); transform: translateX(4px); }
.nf-art { position: relative; }
.nf-art svg { display: block; width: 100%; height: auto; overflow: visible; }
.nf-lost { transform-box: fill-box; }
@media (prefers-reduced-motion: no-preference) {
  .nf-lost { animation: nf-bob 3.2s var(--ease) infinite alternate; }
  .nf-lost-shadow { animation: nf-shadow 3.2s var(--ease) infinite alternate; transform-box: fill-box; transform-origin: center; }
}
@keyframes nf-bob { from { transform: translateY(0); } to { transform: translateY(-14px); } }
@keyframes nf-shadow { from { opacity: .22; transform: scale(1); } to { opacity: .12; transform: scale(.82); } }

/* ---------- Breakpoints ---------- */
@media (min-width: 1081px) {
  .legal-hero { padding-top: 44px; }
}
@media (max-width: 1080px) {
  .legal-body { grid-template-columns: 1fr; }
  .legal-toc { position: static; max-height: none; padding: var(--card-pad); border-radius: var(--r-l); background: var(--surface); }
  .legal-toc ol { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); column-gap: 24px; }
  .nf { grid-template-columns: 1fr; min-height: 0; }
  .nf-art { order: -1; max-width: 560px; }
}
@media (max-width: 760px) {
  .legal-hero h1 { font-size: clamp(40px, 11.5vw, 56px); }
  .legal-text h2 { grid-template-columns: 36px 1fr; }
  .legal-text section > :where(p, ul, .legal-table, h3) { margin-left: 0; }
  .legal-table { width: 100%; }
  .legal-table thead { display: none; }
  .legal-table, .legal-table tbody, .legal-table tr, .legal-table td { display: block; }
  .legal-table tr { padding: 14px 0; border-bottom: 1px solid var(--hair); }
  .legal-table td { padding: 3px 0; border: 0; }
  .legal-table td[data-label]:not(:first-child)::before { content: attr(data-label) ': '; color: var(--muted); }
  .nf h1 { font-size: clamp(40px, 11vw, 56px); }
}
