/* =========================================================
   Apes Alpha -- legal pages (Terms, Privacy)

   Legal pages are read in two completely different ways: a
   few people read them start to finish, and everyone else is
   hunting for one clause ("can I cancel?", "do they sell my
   data?"). The layout serves the second reader without
   punishing the first -- a contents rail that stays put and
   marks where you are, and a comfortable measure for the body
   text.

   These pages are also, quietly, a trust surface: a policy
   that looks carelessly typeset undermines the document it
   contains.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* The old stylesheet this replaced set the page background
   here, and base.html does not set one -- without this the
   body falls back to Bootstrap's white and the light body
   text disappears against it. */
body { background: #0a0d12; }

.legal-page {
  --panel:    #12161d;
  --panel-2:  #171c24;
  --border:   #262c36;
  --border-2: #333c49;
  --text:     #e2e7ee;
  --head:     #ffffff;
  --muted:    #8a93a3;
  --accent:   #1f9be0;
  --green:    #17e88f;

  max-width: 1060px;
  margin: 0 auto;
  padding: 40px 22px 90px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: var(--text);
  font-size: .945rem;
  line-height: 1.72;
}

/* ---------- masthead ---------- */
.legal-head { margin: 0 0 34px; padding: 0 0 26px; border-bottom: 1px solid var(--border); }

.legal-head h1 {
  margin: 0 0 10px;
  font-size: 2rem; font-weight: 800; letter-spacing: -.028em; line-height: 1.15;
  color: var(--head);
}

.legal-updated {
  display: inline-flex; align-items: center; gap: 7px;
  margin: 0 0 20px; padding: 5px 11px;
  font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.legal-updated::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 0 3px rgba(23,232,143,.16);
}

.legal-intro {
  max-width: 72ch; margin: 0;
  font-size: 1rem; line-height: 1.68; color: #b6bec9;
}

/* ---------- two columns ---------- */
.legal-cols {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 52px;
  align-items: start;
}

/* ---------- contents rail ---------- */
.legal-toc {
  position: sticky; top: 22px;
  max-height: calc(100vh - 44px); overflow-y: auto;
  padding: 18px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 13px;
  scrollbar-width: thin;
}
.legal-toc > strong {
  display: block; margin: 0 0 12px;
  font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
}
.legal-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.legal-toc li { counter-increment: toc; margin: 0; }
.legal-toc a {
  display: flex; gap: 9px;
  padding: 6px 9px; border-radius: 7px;
  font-size: .815rem; line-height: 1.4; color: var(--muted); text-decoration: none;
  border-left: 2px solid transparent;
  transition: color .12s ease, background-color .12s ease, border-color .12s ease;
}
.legal-toc a::before {
  content: counter(toc);
  flex: none; min-width: 15px;
  font-variant-numeric: tabular-nums; font-weight: 700; color: #5d6675;
}
.legal-toc a:hover { color: var(--text); background: rgba(255,255,255,.04); text-decoration: none; }
/* Set by the scroll-spy so the rail says where you are, which
   is the whole reason a long document gets one. */
.legal-toc a.here {
  color: var(--head); background: rgba(31,155,224,.1);
  border-left-color: var(--accent);
}
.legal-toc a.here::before { color: var(--accent); }

/* ---------- body ---------- */
.legal-body { max-width: 72ch; }

.legal-body h2 {
  margin: 40px 0 12px;
  font-size: 1.1rem; font-weight: 800; letter-spacing: -.015em; line-height: 1.35;
  color: var(--head);
  /* offset so an anchor jump doesn't hide the heading under the
     sticky rail's top edge */
  scroll-margin-top: 26px;
}
.legal-body > h2:first-child { margin-top: 0; }

.legal-body h3 {
  margin: 24px 0 8px;
  font-size: .93rem; font-weight: 700; color: #cfd6e0;
}

.legal-body p { margin: 0 0 14px; }
.legal-body ul { margin: 0 0 16px; padding: 0; list-style: none; }
.legal-body li { position: relative; margin: 0 0 9px; padding-left: 19px; }
.legal-body li::before {
  content: ""; position: absolute; left: 3px; top: .62em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--border-2);
}

.legal-body strong { color: var(--head); font-weight: 700; }
.legal-body a { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(31,155,224,.35); }
.legal-body a:hover { color: #4fb4ea; border-bottom-color: #4fb4ea; }

/* The all-caps warranty and liability blocks are legally
   conventional but brutal to read as body text; setting them
   smaller, in their own frame, keeps them prominent as
   notices without turning two screens into shouting. */

.legal-caps {
  padding: 16px 18px; margin: 0 0 14px;
  font-size: .82rem; line-height: 1.65; letter-spacing: .008em;
  color: #b6bec9;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.legal-foot {
  margin: 46px 0 0; padding: 18px 20px;
  font-size: .85rem; color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.legal-foot a { color: var(--accent); }

/* ---------- phones ---------- */
@media (max-width: 900px) {
  .legal-cols { grid-template-columns: 1fr; gap: 26px; }
  .legal-toc {
    position: static; max-height: none;
  }
  .legal-toc ol { columns: 2; column-gap: 14px; }
  .legal-toc a { break-inside: avoid; }
}
@media (max-width: 560px) {
  .legal-page { padding: 26px 16px 64px; font-size: .92rem; }
  .legal-head h1 { font-size: 1.5rem; }
  .legal-toc ol { columns: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .legal-toc a { transition: none; }
  html { scroll-behavior: auto; }
}
