/* Document layer for /privacy/, /terms/ and /security/.
 *
 * Loaded AFTER style.css and depends on it. This file deliberately
 * defines no tokens, no `body`, no reset, no skip-link, no focus ring —
 * style.css owns all of that, and these pages now carry the same
 * .site-head and .site-foot as every other page. An earlier version
 * redeclared the palette and its own body rules, which made the legal
 * pages a parallel design system that drifted from the main site. They
 * are a layout on top of the system, not a second system. */

/* ---- Shell ---------------------------------------------------------- */

.legal-wrap {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: var(--space-40) var(--space-24) var(--space-112);
}

.legal-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-40);
}

@media (min-width: 60rem) {
  .legal-layout {
    /* Second column is capped at the document's own measure rather than
       1fr, and the pair is centred. With 1fr the doc sat hard left with
       ~240px of dead space trailing it, because .legal-doc caps its own
       width at 44rem for readability — the column stretched, the content
       didn't. Capping the track and centring keeps the ~75-character
       measure while the block reads as deliberately placed. */
    grid-template-columns: 15rem minmax(0, 44rem);
    justify-content: center;
    gap: var(--space-56);
  }
}

/* ---- Contents rail --------------------------------------------------- */

.legal-toc {
  font-size: 14px;
  min-width: 0;
}

@media (min-width: 60rem) {
  .legal-toc {
    position: sticky;
    /* Clears the sticky .site-head rather than sliding under it. */
    top: calc(var(--space-72) + var(--space-16));
    align-self: start;
    max-height: calc(100vh - var(--space-112));
    overflow-y: auto;
  }
}

.legal-toc h2 {
  margin: 0 0 var(--space-12);
  font: 600 11px/1 var(--font-body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.legal-toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}

.legal-toc li { counter-increment: toc; }

.legal-toc a {
  display: block;
  position: relative;
  padding: 5px 0 5px 28px;
  color: var(--color-ink-soft);
  text-decoration: none;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  transition: color 0.18s ease, border-color 0.18s ease;
}

.legal-toc a::before {
  content: counter(toc, decimal-leading-zero);
  position: absolute;
  left: 10px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.1);
}

.legal-toc a:hover { color: var(--color-ink); border-left-color: var(--color-accent); }

/* Phone: a 15-item vertical rail buries the document a full screen down.
   Same links, laid out as wrapped chips. */
@media (max-width: 59.99rem) {
  .legal-toc ol { display: flex; flex-wrap: wrap; gap: 6px; }
  .legal-toc a {
    padding: 5px 10px;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-default);
  }
  .legal-toc a::before { content: none; }
  .legal-toc a:hover { border-color: var(--color-accent); }
}

/* ---- Document -------------------------------------------------------- */

.legal-doc {
  max-width: 44rem;
  min-width: 0;
  line-height: 1.7;
}

.legal-eyebrow {
  margin: 0 0 var(--space-8);
  font: 600 11px/1 var(--font-body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.legal-doc h1 {
  margin: 0 0 var(--space-16);
  font: 530 clamp(30px, 4vw, 46px)/1.1 var(--font-display);
  letter-spacing: -0.02em;
}

.legal-stamp {
  margin: 0 0 var(--space-24);
  font-size: 13px;
  color: var(--color-ink-soft);
}

.legal-lede {
  margin: 0 0 var(--space-40);
  font-size: 18px;
  line-height: 1.6;
  color: var(--color-ink-soft);
}

.legal-doc h2 {
  margin: var(--space-56) 0 var(--space-16);
  padding-top: var(--space-24);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font: 530 20px/1.3 var(--font-display);
  letter-spacing: -0.01em;
}

.legal-doc h3 {
  margin: var(--space-24) 0 var(--space-8);
  font: 600 15px/1.4 var(--font-body);
  color: var(--color-accent-soft);
}

.legal-doc p { margin: 0 0 var(--space-16); }
.legal-doc ul, .legal-doc ol { margin: 0 0 var(--space-20); padding-left: 22px; }
.legal-doc li { margin-bottom: var(--space-8); }
.legal-doc strong { color: var(--color-white); font-weight: 600; }

.legal-doc a {
  color: var(--color-ink);
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
  text-underline-offset: 3px;
  transition: color 0.18s ease;
}

.legal-doc a:hover { color: var(--color-accent-soft); }

.legal-doc code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-accent-soft);
  border-radius: var(--radius-default);
}

/* Callout for the things a reader would otherwise be surprised by.
   Uses the app's card surface, not a bespoke panel colour. */
.legal-note {
  margin: var(--space-24) 0;
  padding: var(--space-16) var(--space-20);
  background: var(--color-card);
  border-left: 2px solid var(--color-accent);
  border-radius: var(--radius-default);
  font-size: 15px;
}

.legal-note p:last-child { margin-bottom: 0; }
.legal-note--strong { background: var(--color-surface-2); border-left-color: var(--color-accent-soft); }

/* Wide tables scroll inside their own wrapper so the page never does. */
.legal-table-wrap {
  margin: var(--space-20) 0 var(--space-24);
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-default);
}

.legal-table { width: 100%; min-width: 36rem; border-collapse: collapse; font-size: 14px; }

.legal-table th,
.legal-table td {
  padding: 11px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.legal-table th {
  font: 600 11px/1 var(--font-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent-soft);
  background: var(--color-card);
}

.legal-table tr:last-child td { border-bottom: 0; }

/* Unresolved real-world values — impossible to ship unnoticed. */
.fill {
  padding: 1px 6px;
  background: rgba(255, 60, 74, 0.14);
  border: 1px dashed var(--color-accent);
  border-radius: var(--radius-default);
  color: var(--color-accent-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  white-space: nowrap;
}

/* ---- Print: people do file these. ---- */
@media print {
  body { background: #fff; color: #000; }
  .site-head, .site-foot, .legal-toc, .skip-link, .whatsapp-fab { display: none !important; }
  .legal-layout { display: block; }
  .legal-doc { max-width: none; }
  .legal-doc h1, .legal-doc h2, .legal-doc h3 { color: #000; }
  .legal-doc h2 { border-top-color: #999; page-break-after: avoid; }
  .legal-doc a { color: #000; }
  .legal-doc a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; }
  .legal-lede, .legal-table td { color: #333; }
  .legal-note { background: #f4f4f4; border-left-color: #000; }
  .legal-table th { color: #000; background: #f4f4f4; }
  .fill { border-color: #000; color: #000; background: #eee; }
}
