/* ============================================================
   legal.css — the Terms of Service, Privacy Policy and Refund
   Policy pages (terms.html, privacy.html, refunds.html).

   The hero is About's (sa-pages.css). This file sets the document
   under it: one measured column for long reading, numbered
   sections, a contents card, and the few tables, lists and
   definition rows the policies need. Section numbers are a CSS
   counter, so the contents list and the headings cannot disagree.

   Tokens only (src/shared/tokens.css). Load after sa-pages.css.
   ============================================================ */

/* The "Last updated" line under the hero's subtitle. */
.legal-updated {
  margin-top: var(--space-8);
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  color: var(--ink-3);
}

/* ---- the document column ---- */
.legal-doc {
  max-width: 70ch;
  margin: 0 auto;
  counter-reset: legal-section;
  font-family: var(--font-sans);
  font-size: var(--fs-body-lg);
  line-height: 1.7;
  color: var(--ink-1);
}

.legal-doc p {
  margin: 0 0 var(--space-6);
  text-wrap: pretty;
}

.legal-doc ul,
.legal-doc ol {
  margin: 0 0 var(--space-6);
  padding-left: 1.4em;
}
.legal-doc li { margin: 0 0 var(--space-3); padding-left: var(--space-1); }
.legal-doc li::marker { color: var(--ink-3); }

.legal-doc a {
  color: var(--cool);
  text-decoration: underline;
  text-decoration-color: var(--cool-soft);
  text-underline-offset: 2px;
  transition: var(--t-color);
}
.legal-doc a:hover { text-decoration-color: currentColor; }
.legal-doc a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }

.legal-doc strong { color: var(--ink); font-weight: 600; }

/* ---- contents ---- */
.legal-toc {
  margin: 0 0 var(--space-20);
  padding: var(--space-10) var(--space-12);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
}
.legal-toc__title {
  margin: 0 0 var(--space-5);
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: var(--ls-kicker);
  text-transform: uppercase;
  color: var(--ink-3);
}
.legal-doc .legal-toc ol {
  margin: 0;
  padding-left: 1.8em;
  columns: 2;
  column-gap: var(--space-16);
  font-size: var(--fs-small);
  line-height: 1.45;
}
.legal-doc .legal-toc li { margin: 0; padding: var(--space-1) 0; break-inside: avoid; }
.legal-doc .legal-toc li::marker { font-variant-numeric: tabular-nums; }
.legal-doc .legal-toc a { color: var(--ink-1); text-decoration: none; }
.legal-doc .legal-toc a:hover { color: var(--brand); text-decoration: underline; }

/* ---- sections ---- */
/* A contents link scrolls its section to the top of the viewport, which is
   under the sticky topbar and ribbon. --sa-rail-top (sa-pages.css) is that
   chrome's measured stuck height, per breakpoint. */
.legal-section {
  scroll-margin-top: calc(var(--sa-rail-top, 158px) + var(--space-8));
}
.legal-section + .legal-section {
  margin-top: var(--space-16);
  padding-top: var(--space-16);
  border-top: 1px solid var(--rule-soft);
}

.legal-section h2 {
  margin: 0 0 var(--space-8);
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-wrap: balance;
}
.legal-section h2::before {
  counter-increment: legal-section;
  content: counter(legal-section) ". ";
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.legal-section h3 {
  margin: var(--space-12) 0 var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--fs-body-lg);
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}

/* ---- a plan table ---- */
.legal-table-wrap {
  margin: 0 0 var(--space-8);
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--card);
}
.legal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-small);
  line-height: 1.45;
}
.legal-table th,
.legal-table td {
  padding: var(--space-5) var(--space-6);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule-soft);
}
.legal-table thead th {
  font-size: var(--fs-mini);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--paper-1);
  white-space: nowrap;
}
.legal-table tbody th { font-weight: 600; color: var(--ink); white-space: nowrap; }
.legal-table tbody tr:last-child th,
.legal-table tbody tr:last-child td { border-bottom: 0; }
.legal-table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- definition rows (who does what, what is kept where) ---- */
.legal-dl {
  margin: 0 0 var(--space-8);
  border-top: 1px solid var(--rule-soft);
}
.legal-dl > div {
  display: grid;
  grid-template-columns: minmax(0, 11rem) minmax(0, 1fr);
  column-gap: var(--space-10);
  padding: var(--space-6) 0;
  border-bottom: 1px solid var(--rule-soft);
}
.legal-dl dt { font-weight: 600; line-height: 1.5; color: var(--ink); }
.legal-dl dd { margin: 0; }
.legal-dl dd p:last-child { margin-bottom: 0; }

/* ---- a choice the owner makes before the page goes live ----
   Dashed, so a draft alternative can never pass for settled text. */
.legal-decision {
  margin: 0 0 var(--space-8);
  padding: var(--space-8) var(--space-10) var(--space-2);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius-lg);
  background: var(--paper-1);
}
.legal-decision__label {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--ink-2);
}

.legal-address { font-style: normal; margin: 0 0 var(--space-6); }

.legal-related {
  margin-top: var(--space-20);
  padding-top: var(--space-10);
  border-top: 1px solid var(--rule);
  font-size: var(--fs-small);
  color: var(--ink-3);
}

@media (max-width: 599px) {
  .legal-toc { padding: var(--space-8) var(--space-8); }
  .legal-doc .legal-toc ol { columns: 1; }
  .legal-dl > div { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-2); }
  .legal-decision { padding: var(--space-6) var(--space-8) var(--space-1); }
}
