/* legal.css — Privacy & Security / Terms of Use pages.
   Loaded after main.css; uses only main.css tokens. */

/* ---------- Page header ---------- */
.legal-header .container { max-width: calc(860px + var(--gutter) * 2); }
.legal-header__meta { margin-bottom: 1rem; }
.legal-header__intro { max-width: 60ch; }

/* ---------- Two-column layout ---------- */
.legal { display: grid; gap: 2.5rem; align-items: start; }
.legal__article { max-width: 72ch; }

/* Headings get a gold tick; :target (arrived via TOC) highlights it */
.legal__heading { scroll-margin-top: calc(var(--header-h) + 24px); }
.legal__heading:target { color: var(--gold-dark); }
.prose h2.legal__heading { border-top: 1px solid var(--line); padding-top: 1.4em; }
.prose h2.legal__heading:first-child { border-top: 0; padding-top: 0; }
.prose h2.legal__heading + h3.legal__heading { margin-top: 0.9em; }

/* ---------- Table of contents ---------- */
.toc {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1.1rem;
}
.toc__title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.toc__list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.15rem; }
.toc__item--l2 { margin-top: 0.6rem; }
.toc__item--l2:first-child { margin-top: 0; }
.toc__link {
  display: block;
  padding: 0.3rem 0.5rem;
  margin-inline: -0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 0.92rem;
  line-height: 1.35;
  text-decoration: none;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.toc__link:hover { color: var(--ink); background: color-mix(in srgb, var(--gold) 14%, transparent); }
.toc__item--l2 .toc__link { font-weight: 700; color: var(--ink); }
.toc__related {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
  color: var(--muted);
}
.toc__related-label { display: block; font-weight: 600; margin-bottom: 0.2rem; color: var(--text-2); }
.toc__related-link { font-weight: 500; }

/* Tablet: TOC above the article in two columns */
@media (min-width: 560px) and (max-width: 959.98px) {
  .toc__list { grid-template-columns: 1fr 1fr; column-gap: 1.25rem; }
  .toc__item--l2 { grid-column: 1 / -1; }
}

/* Desktop: sticky TOC on the left */
@media (min-width: 960px) {
  .legal { grid-template-columns: 272px minmax(0, 1fr); gap: clamp(2.5rem, 5vw, 5rem); }
  .legal__aside {
    position: sticky;
    top: calc(var(--header-h) + 24px);
    max-height: calc(100vh - var(--header-h) - 48px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* Dark mode: hover tint stays readable */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .toc__link:hover { background: color-mix(in srgb, var(--gold) 20%, transparent); }
}
:root[data-theme="dark"] .toc__link:hover { background: color-mix(in srgb, var(--gold) 20%, transparent); }
