/* Signal Brief rebuilt site: the legal pages (privacy.html, terms.html), every .legal-* rule.
   Split out of site.css 2026-11-05 to keep it under the file-size ratchet. Loaded on every rebuilt route
   after /css/site.css and before /css/site-high-zoom.css, so these rules keep the cascade place they had
   inside site.css and the high-zoom overrides still follow them. The shared text-link look for
   .legal-document a stays in site.css with the other text links on paper.
   Authoring copy: design-system/site/2026-08-16/site-legal.css (byte-exact mirror at
   signalbrief-web/css/site-legal.css, checked by tools/build-rebuilt-site-pages.mjs --check). */
.legal-page {
  background: var(--paper);
}
/* Legal pages (privacy, terms; rebuild 2026-11-05 after the owner's "not good" on the old date card).
   One reading column: the title, summary, dates, contents list and every section share its left edge.
   640px keeps 18px system-sans text near 70 characters a line (measured 2026-11-05). The cream header
   band stays full width behind it. */
.legal-header {
  padding: 48px 0 32px;
  background: var(--panel);
  border-bottom: 1px solid var(--gold-soft);
}
.legal-header .wrap,
.legal-body .wrap {
  width: min(640px, calc(100% - var(--gutter) * 2));
}
.legal-header h1 {
  margin: 0 0 12px;
  font-size: clamp(34px, 4vw, 44px);
  line-height: 1.12;
  text-wrap: balance;
}
.legal-summary {
  margin: 0;
  color: var(--body);
  font-size: 18px;
  line-height: 1.4;
  text-wrap: pretty;
}
/* Two plain date lines under the summary; a date never splits across lines. */
.legal-dates {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.4;
}
.legal-dates > span { display: block; }
.legal-dates > span + span { margin-top: 2px; }
.legal-dates time { white-space: nowrap; }
.legal-body {
  padding: 40px 0 var(--chapter-space);
}
/* Reading type: 18px at 1.65 for paragraphs and lists alike (65+ type floor). */
.legal-document {
  color: var(--body);
  font-size: 18px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.legal-document > :first-child { margin-top: 0; }
.legal-document [id] { scroll-margin-top: 16px; }
/* Each numbered section opens under a hairline rule, so sections read as separate steps. */
.legal-document h2 {
  margin: 48px 0 14px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
  color: var(--navy);
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.legal-document h3 {
  margin: 32px 0 10px;
  color: var(--navy);
  font-size: 21px;
  line-height: 1.25;
  text-wrap: balance;
}
.legal-document h4 {
  margin: 26px 0 8px;
  color: var(--navy);
  font-size: 18px;
  line-height: 1.25;
}
.legal-document h2 + h3 { margin-top: 20px; }
.legal-document p { margin: 0 0 14px; }
.legal-document ul {
  margin: 0 0 18px;
  padding-left: 24px;
}
.legal-document li { margin: 0 0 10px; }
.legal-document li > ul { margin: 10px 0 0; }
.legal-document a { font-weight: 650; }
.legal-document a:focus-visible {
  outline: 3px solid var(--mark);
  outline-offset: 3px;
}
.legal-notice {
  margin: 20px 0 28px;
  padding: 20px 24px;
  background: var(--wash);
  border-left: 4px solid var(--navy);
  line-height: 1.4; /* short summary lines (round 3) */
}
.legal-notice > :last-child { margin-bottom: 0; }
.legal-disclaimer {
  margin: 24px 0;
  padding: 20px 24px;
  border: 1px solid var(--rule);
  border-left: 4px solid var(--navy); /* same rule as the "In short" box (owner D2a) */
  background: var(--wash);
}
/* Box headings sit at the top of their box at every width (beats the phone h3 margin). */
.legal-document .legal-disclaimer h3,
.legal-document .legal-notice h3 { margin-top: 0; }
.legal-disclaimer > :last-child { margin-bottom: 0; }
.legal-contact address { font-style: normal; }
/* "On this page": a Mist panel listing every numbered section; on phones the same links sit in a native
   disclosure so the first screen reaches the text. From 1200px it becomes a sticky rail left of the
   640px column (owner D3a, 2026-11-07), so wide screens are not two empty margins. */
.legal-toc {
  margin: 0 0 8px;
  padding: 18px 24px 12px;
  background: var(--wash);
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.legal-document .legal-toc-title {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 16px;
  line-height: 1.25;
  font-weight: 700;
}
.legal-document .legal-toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  /* Two columns that read down, as a grid so wrapped entries keep rows aligned.
     Seven rows fits both pages (privacy 13 sections, terms 14); revisit if a page passes 14. */
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(7, auto);
  grid-auto-flow: column;
  column-gap: 32px;
}
.legal-document .legal-toc-list li { margin: 0; break-inside: avoid; }
.legal-toc-list a {
  display: flex;
  align-items: center;
  padding: 3px 0; /* about 6px between entries; 44px tap height only on touch, below */
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
}
@media (pointer: coarse) { .legal-toc-list a { min-height: 44px; } }
.legal-toc-menu { display: none; }
/* The section number sits in its own span so the wide rail can give it a column; on narrow screens it keeps its space. */
.legal-toc-num { flex: none; margin-right: .3em; white-space: nowrap; }
/* Wide screens: the contents list leaves the column for a sticky rail on its left (owner D3a, 2026-11-07).
   Only where :has() works; elsewhere the in-flow panel stays.
   Rail 296px + 40px gap + 640px column = 976px, centred; the header shares the rail's left edge and keeps a 640px measure. */
@supports selector(:has(*)) {
@media (min-width: 1200px) {
  .legal-page:has(.legal-toc) .legal-header .wrap { width: 976px; margin-left: calc(50% - 488px); }
  .legal-page:has(.legal-toc) .legal-header .wrap > * { max-width: 640px; }
  .legal-body .wrap:has(> .legal-toc) { margin-left: calc(50% - 152px); position: relative; }
  .legal-toc { position: absolute; inset: 0 auto 0 -336px; width: 296px; margin: 0; padding: 0; background: none; border: 0; border-radius: 0; }
  /* Label and list each stick; a thin gold spine runs down the list, numbers sit in a right-aligned column. */
  .legal-document .legal-toc-title { position: sticky; top: 24px; margin: 0; padding: 0 0 10px 0; color: var(--muted); font-size: 16px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
  .legal-document .legal-toc > .legal-toc-list { position: sticky; top: 58px; display: block; max-height: calc(100vh - 82px); overflow-y: auto; background: linear-gradient(var(--gold-soft), var(--gold-soft)) 0 0 / 2px 100% no-repeat; }
  .legal-document .legal-toc-list li + li { margin-top: 2px; }
  .legal-document .legal-toc-list a { display: grid; grid-template-columns: 3ch 1fr; column-gap: 8px; align-items: baseline; padding: 7px 10px 7px 18px; border-radius: 0 4px 4px 0; color: var(--navy); font-size: 16px; font-weight: 500; line-height: 1.3; text-decoration: none; box-shadow: inset 4px 0 0 transparent; }
  .legal-document .legal-toc-num { margin: 0; text-align: right; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
  .legal-document .legal-toc-list a:focus-visible { outline: 3px solid var(--mark); outline-offset: -3px; }
  /* Where supported (Chromium 140+), the section on screen is marked; elsewhere the rail simply has no marker. */
  @supports selector(:target-current) {
    .legal-document .legal-toc > .legal-toc-list { scroll-target-group: auto; }
    .legal-document .legal-toc-list a:target-current { background: var(--wash); box-shadow: inset 4px 0 0 var(--navy); }
    .legal-document .legal-toc-list a:target-current .legal-toc-num { color: var(--navy); }
  }
  /* With the list out of the column, a first section heading no longer needs a rule above it. */
  .legal-toc:first-child + h2 { margin-top: 0; padding-top: 0; border-top: 0; }
}
}
/* Opens the footer's Your privacy choices panel in place (privacy-choices.js); without script the link goes to it.
   Secondary button: navy 1px outline on a Mist fill, since it sits on paper (COLORS.md § Interaction states). */
.legal-choices { margin: 4px 0 22px; }
.legal-document a.legal-choices-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 18px;
  color: var(--navy);
  background: var(--wash);
  border: 1px solid var(--navy);
  border-radius: 4px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
}
/* Phones and narrow tablets (the site.css phone breakpoint). */
@media (max-width: 820px) {
  .legal-header { padding: 28px 0 24px; }
  .legal-header h1 { font-size: 32px; }
  .legal-body { padding: 24px 0 48px; }
  .legal-document h2 { margin-top: 40px; padding-top: 24px; font-size: 24px; }
  .legal-document h3 { margin-top: 28px; font-size: 20px; }
  .legal-notice,
  .legal-disclaimer { padding: 18px; }
}
@media (max-width: 599px) {
  .legal-toc { padding: 0; background: none; border: 0; }
  .legal-toc > .legal-toc-title,
  .legal-toc > .legal-toc-list { display: none; }
  .legal-toc-menu { display: block; background: var(--wash); border: 1px solid var(--rule); border-radius: 4px; }
  .legal-toc-menu summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 16px; color: var(--navy); font-size: 17px; font-weight: 700; line-height: 1.25; list-style: none; cursor: pointer; }
  .legal-toc-menu summary::-webkit-details-marker { display: none; }
  .legal-toc-menu summary::after { content: ""; width: 9px; height: 9px; margin-top: -4px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
  .legal-toc-menu[open] summary::after { margin-top: 4px; transform: rotate(-135deg); }
  .legal-toc-menu summary:focus-visible { outline: 3px solid var(--mark); outline-offset: 3px; }
  .legal-document .legal-toc-menu .legal-toc-list { display: block; padding: 0 16px 8px; border-top: 1px solid var(--rule); }
  /* Keep a usable measure inside the tinted boxes on phones. */
  .legal-notice,
  .legal-disclaimer { padding: 16px 14px 16px 16px; }
  .legal-notice ul { padding-left: 18px; }
}

/* ==========================================================================
   Interaction states: the one home for hover and pressed looks
   (design-system/COLORS.md § Interaction states), for the legal-page rules
   in this sheet. Use only the state tokens in site.css :root.
   ========================================================================== */
/* The legal pages' "Manage your privacy choices" button: the secondary button on paper, Mist fill kept on hover. */
.legal-document a.legal-choices-button:hover { color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); text-decoration: none; }
.legal-document a.legal-choices-button:active { color: var(--navy); background: var(--control-active-fill); box-shadow: inset 0 0 0 1px var(--navy); }
/* The wide contents rail: a hovered entry takes the Mist wash and a gold bar (owner D3a, 2026-11-07). */
@supports selector(:has(*)) {
@media (min-width: 1200px) {
  .legal-document .legal-toc-list a:hover { color: var(--navy); background: var(--wash); box-shadow: inset 4px 0 0 var(--gold); }
}
}
