/*
 * PATCH-395 — shared shell for the legal pages (terms.html, privacy.html).
 *
 * These pages are plain documents: no design-system components, no DC runtime.
 * They deliberately do NOT load `_ds_bundle.css` / `styles.css` — those are the
 * product app's shell stylesheets, which pin html/body to a fixed 100dvh with
 * overflow:hidden (the PATCH-1098 trap) and would clip a long document like a
 * privacy policy with no way to scroll to the rest of it. Only `fonts.css` is
 * pulled in; the tokens below are the same values the home page defines.
 */

:root {
  /* PATCH-4131: the page behind everything is the Films page's #141413, so the
     cross-fade to and from /films/ keeps one colour. --bg-app stays the app's
     #1f1f1e for anything that is a surface. */
  --bg-page: #141413;
  --bg-app: #1f1f1e; --bg-rail: #1a1a19; --bg-raised: #221d1a; --bg-input: #1a1a19;
  /* PATCH-1151 (applied here by PATCH-3501): --text-muted was #8a857c, 4.50:1 on
     --bg-app, exactly on the AA line. #948e85 clears ~5.1:1 and still reads as
     secondary next to --text. */
  --text: #ece8e1; --text-secondary: #b8b3aa; --text-muted: #948e85; --text-faint: #66625a;
  --accent: #d97757; --accent-hover: #e2876a; --accent-text: #f0a98e; --accent-soft: rgba(217,119,87,0.15);
  --green-text: #8fce9d; --yellow-text: #ecc680;
  --border: rgba(255,253,247,0.09); --border-soft: rgba(255,253,247,0.055); --border-strong: rgba(255,253,247,0.16);
  --hover: rgba(255,253,247,0.05);
  --r-sm: 6px; --r-md: 9px; --r-lg: 13px; --r-pill: 999px;
  --font-ui: "Hanken Grotesk", "Hanken Grotesk Fallback", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
/* PATCH-6050: no overflow-x: hidden here. It cut off the Privacy tables' last
   144px on a phone with no way to reach them; each table now scrolls in its
   own box (.legal-table-scroll below), so the page has nothing to hide. */
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg-page); color: var(--text);
  font-family: var(--font-ui); font-size: 15px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* PATCH-3788: the header and footer are the site's shared ones. Their rules
   are in site-chrome.css, which each legal page loads after this file. */

/* PATCH-3827: the column is the header's, so the first heading starts under
   the logo: --chrome-width is site-chrome.css's, which every page that loads
   this file loads too, and the 24px is .site-nav's side padding.
   PATCH-4141 (owner ask 2026-10-15): what sits in the column now spans it,
   1132px, as the home page's How it works grid and the Films page do:
   the draft banner and the contents box. The sections, their callouts
   and tables are the reading text, and keep their 772px.
   Running text keeps a reading width of its own, as How it works' intro
   does: a rule below that sets a narrower max-width still wins. */
main { max-width: var(--chrome-width); margin: 0 auto; padding: clamp(36px,5vw,64px) 24px 80px; }
main > * { max-width: 1132px; }
.kicker {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent-text); margin-bottom: 12px;
}
/* PATCH-7272 (design review M1): every inner page's h1 and section heading sizes, site-chrome.css's. */
h1 {
  margin: 0 0 10px; font-size: var(--chrome-h1-size); font-weight: 700;
  letter-spacing: -0.025em; line-height: 1.1;
}
/* PATCH-4142: muted, not faint — #66625a is 3.04:1 on the page, below AA. */
.meta { margin: 0 0 28px; font-family: var(--font-mono); font-size: 12.5px; color: var(--text-muted); }

/* The DRAFT banner. Loud on purpose — nobody should mistake this for signed-off
   legal text while the bracketed items are still open. */
.draft {
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: var(--r-lg); padding: 16px 18px; margin: 0 0 36px;
}
.draft strong { color: var(--accent-text); display: block; margin-bottom: 4px; font-size: 14.5px; }
.draft p { margin: 0; max-width: 772px; font-size: 14px; color: var(--text-secondary); }

.toc {
  background: var(--bg-raised); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); padding: 20px 22px; margin: 0 0 44px;
}
.toc h2 {
  margin: 0 0 12px; font-size: 12px; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.toc ol { margin: 0; padding-left: 20px; columns: 3; column-gap: 28px; font-size: 13.5px; }
.toc li { margin-bottom: 6px; break-inside: avoid; }
.toc a { color: var(--text-secondary); }
.toc a:is(:hover, :focus-visible) { color: var(--text); }

section { max-width: 772px; margin-bottom: 36px; scroll-margin-top: calc(var(--chrome-header-h, 58px) + 18px); }
h2 { margin: 0 0 12px; font-size: var(--chrome-h2-size); font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
/* PATCH-3838: the section a contents link lands on holds the accent on its
   heading while the page scrolls there, then settles. Reduced motion: it stays. */
section:target h2 { color: var(--accent); animation: landed calc(var(--motion-landed) * 0.3) var(--ease-out-soft) calc(var(--motion-landed) * 0.7) forwards; }
@keyframes landed { to { color: var(--text); } }
h3 { margin: 22px 0 8px; font-size: 15.5px; font-weight: 600; color: var(--text); }
p, li { color: var(--text-secondary); }
/* PATCH-6050: with no overflow-x: hidden on html, a word longer than a
   phone's column (a URL in a sentence) breaks rather than push the page sideways. */
p, li { overflow-wrap: break-word; }
p { margin: 0 0 14px; }
ul { margin: 0 0 14px; padding-left: 22px; }
li { margin-bottom: 7px; }
strong { color: var(--text); font-weight: 600; }
code { font-family: var(--font-mono); font-size: 13px; color: var(--accent-text); }

.callout {
  background: var(--bg-raised); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); padding: 16px 18px; margin: 0 0 14px;
}
.callout p:last-child { margin-bottom: 0; }

/* Unresolved items counsel has to fill in. Dashed + monospace so they read as
   holes in the draft rather than as prose. */
.todo {
  border: 1px dashed var(--border-strong); border-radius: var(--r-lg);
  padding: 16px 18px; background: var(--bg-rail);
}
.todo ul { margin: 0; }
.todo li { color: var(--yellow-text); font-family: var(--font-mono); font-size: 13px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0 0 14px; min-width: 480px; }
.tablewrap { overflow-x: auto; margin: 0 0 14px; }
/* PATCH-6050 (Cat, 2026-11-04): on a phone a table, 480px at its narrowest,
   scrolls sideways in its own box and the page never does. legal-tables.js
   puts the table in this box (or marks a page's own .tablewrap), names it by
   its section's heading and makes it a tab stop, with the cue above it shown,
   only while the table is wider than the box. The focus ring is the page's
   own :focus-visible, drawn inside so no box edge can clip it. */
.legal-table-scroll {
  max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain;
  margin: 0 0 14px; border-radius: var(--r-sm);
}
.legal-table-scroll > table { margin-bottom: 0; }
.legal-table-scroll:focus-visible { outline-offset: -2px; }
.legal-table-cue {
  margin: 0 0 6px; font-family: var(--font-mono); font-size: 12px;
  color: var(--text-muted);
}
th {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border);
  color: var(--text); font-weight: 600; font-size: 13px;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); color: var(--text-secondary); vertical-align: top; }

@media (max-width: 899px) { .toc ol { columns: 2; } }
@media (max-width: 560px) { .toc ol { columns: 1; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
