/* legal.css — editorial treatment for the Privacy Policy and Terms of Use.
   Direction: a formal legal document. Geist (the brand sans) is kept for all
   page chrome and the navigational table of contents; the long-form prose is
   set in Spectral, a screen-optimised serif, for gravitas and readability.
   Reuses the landing design tokens (theme.css) and adds a sticky-TOC layout. */

:root {
  /* Higher-contrast ink than --fg-2 (#666) for comfortable long reading. */
  --legal-ink: #1f2328;
  --legal-muted: #5b6168;
  --legal-rule: #e7e7e4;
  --legal-measure: 82ch;
}

/* ---- Document header ---- */
.legal-meta {
  color: var(--fg-3);
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  margin-top: 0.85rem;
}
.legal-lede {
  font-family: "Spectral", Georgia, serif;
  font-size: clamp(1.0625rem, 0.5vw + 1rem, 1.1875rem);
  line-height: 1.6;
  color: var(--legal-muted);
  max-width: 52ch;
  margin-top: 1.25rem;
}

/* ---- Two-column layout: sticky contents + prose ---- */
.legal-layout { display: block; }

@media (min-width: 1024px) {
  .legal-layout {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr);
    gap: clamp(3rem, 5vw, 5rem);
    align-items: start;
  }
  .legal-aside {
    position: sticky;
    top: 6.5rem;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* ---- Table of contents (stays in Geist — it is UI, not prose) ---- */
.legal-toc {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  padding: 1.1rem 1.25rem;
}
.legal-toc[open] { padding-bottom: 1.25rem; }

.legal-toc-title {
  font-size: 0.6875rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.legal-toc-title::-webkit-details-marker { display: none; }
.legal-toc-title::after {
  content: "";
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--fg-3);
  border-bottom: 1.5px solid var(--fg-3);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}
.legal-toc[open] .legal-toc-title::after { transform: rotate(-135deg); }

.legal-toc nav { margin-top: 1rem; }
.legal-toc ol {
  list-style: none;
  counter-reset: toc;
  display: grid;
  gap: 0.1rem;
  font-size: 0.875rem;
}
.legal-toc li { counter-increment: toc; }
.legal-toc a {
  display: flex;
  gap: 0.6rem;
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
  color: var(--fg-2);
  text-decoration: none;
  line-height: 1.35;
  border-left: 2px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.legal-toc a::before {
  content: counter(toc);
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  min-width: 1.1rem;
  text-align: right;
  flex-shrink: 0;
  padding-top: 0.06rem;
}
.legal-toc a:hover { color: var(--fg); background: var(--surface-hover); }
.legal-toc a.is-active {
  color: var(--fg);
  font-weight: 500;
  background: var(--surface);
  border-left-color: var(--accent-to);
}
.legal-toc a.is-active::before { color: var(--accent-to); }

@media (min-width: 1024px) {
  /* On desktop the contents are always visible; the disclosure arrow only
     matters on mobile where the panel collapses. */
  .legal-toc-title { cursor: default; pointer-events: none; }
  .legal-toc-title::after { display: none; }
  .legal-toc { background: transparent; border: none; padding: 0; }
  .legal-toc nav { margin-top: 0.85rem; border-top: 1px solid var(--legal-rule); padding-top: 0.85rem; }
}

/* ---- Prose ---- */
.legal-prose {
  /* Fill the grid column; the sticky-TOC layout already bounds the measure. */
  max-width: var(--legal-measure);
  font-family: "Spectral", Georgia, serif;
}
@media (min-width: 1024px) {
  .legal-prose { max-width: none; }
}
.legal-prose section { scroll-margin-top: 6.5rem; }
.legal-prose section + section {
  margin-top: 2.75rem;
  padding-top: 2.75rem;
  border-top: 1px solid var(--legal-rule);
}

.legal-prose h2 {
  font-family: "Spectral", Georgia, serif;
  font-size: clamp(1.3rem, 0.6vw + 1.15rem, 1.5rem);
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.25;
  color: var(--legal-ink);
  margin-bottom: 1rem;
  text-wrap: balance;
}
.legal-prose h3 {
  font-family: "Spectral", Georgia, serif;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--legal-ink);
  margin: 1.75rem 0 0.6rem;
}

.legal-prose p,
.legal-prose li {
  color: var(--legal-ink);
  font-size: 1.0625rem;
  line-height: 1.78;
}
.legal-prose p { margin-bottom: 1.15rem; }

.legal-prose ul,
.legal-prose ol {
  margin: 0 0 1.15rem;
  padding-left: 1.5rem;
  display: grid;
  gap: 0.55rem;
}
.legal-prose ul { list-style: disc; }
.legal-prose ol { list-style: decimal; }
.legal-prose li::marker { color: var(--fg-3); }

.legal-prose strong { color: var(--legal-ink); font-weight: 600; }
.legal-prose a {
  color: var(--legal-ink);
  text-decoration: underline;
  text-decoration-color: var(--accent-ring);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  transition: text-decoration-color 0.15s ease;
}
.legal-prose a:hover { text-decoration-color: var(--accent-to); }

/* ---- Disclaimer callout ---- */
.legal-callout {
  margin: 1.5rem 0;
  padding: 1.15rem 1.4rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-to);
  border-radius: 12px;
  background: var(--accent-tint);
}
.legal-callout p { color: var(--legal-ink); margin-bottom: 0.65rem; }
.legal-callout p:last-child { margin-bottom: 0; }

/* ---- Sub-processor / reference table ---- */
.legal-table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0 1.4rem;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.legal-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Geist", system-ui, sans-serif;
  font-size: 0.9375rem;
}
.legal-table thead th {
  background: var(--surface-2);
  color: var(--fg);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.legal-table th,
.legal-table td {
  text-align: left;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--legal-muted);
  line-height: 1.55;
}
.legal-table tbody td:first-child { color: var(--legal-ink); font-weight: 500; white-space: nowrap; }
.legal-table tr:last-child td { border-bottom: none; }

/* ---- Print: a clean, chrome-free legal document ---- */
@media print {
  .lp-nav, .lp-footer, .legal-aside, .lp-glow, .lp-grain { display: none !important; }
  .lp-section { padding: 0 !important; }
  .legal-layout { display: block; }
  .legal-prose { max-width: none; color: #000; }
  .legal-prose p, .legal-prose li, .legal-prose h2, .legal-prose h3 { color: #000; }
  .legal-prose a { color: #000; text-decoration: none; }
  .legal-prose section + section { border-top: none; page-break-inside: avoid; }
}
