/* Stylesheet for the server-rendered legal pages (routes/legal.js).
   Standalone: no external fonts, no CDNs, no scripts required. */

:root {
  /* Matches public/styles.css's --primary/--accent so these server-rendered
     pages read as the same product as the app, not a different site glued
     on. Deliberately still no external font/script requests though — see
     the file header comment — so the font stack stays system fonts rather
     than pulling in the app's Google Fonts. */
  --primary: #0B5FFF;
  --primary-dark: #0040CC;
  --accent: #FF6B35;
  --accent-2: #ffb703;
  --accent-strong: #d94e1a;
  --bg: #ffffff;
  /* Matches public/styles.css's new warm off-white page background (was a cooler
     #f6f7f9) so the header/footer bands read as the same site as the app, not a
     slightly different shade of grey glued on. The reading surface (--bg) stays
     pure white for text contrast — only the surrounding chrome moved. */
  --bg-soft: #F3F6FB;
  --bg-elev: #ffffff;
  --text: #1c2026;
  --text-soft: #4b5563;
  --border: #c7cfd9;
  --border-strong: #a9b4c2;
  --link: #b8400f;
  --mark-bg: #fff2a8;
  --mark-text: #4a3b00;
  --note-bg: #fff4ee;
  --note-border: #ffc9b0;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --bg-soft: #171b21;
    --bg-elev: #1b2028;
    --text: #e8eaed;
    --text-soft: #a9b1bc;
    --border: #3a4453;
    --link: #ff9a6c;
    --mark-bg: #5c4a00;
    --mark-text: #ffeaa0;
    --note-bg: #2a1c15;
    --note-border: #5b3624;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
}

a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
a:focus-visible, button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--accent);
  color: #111;
  padding: 8px 14px;
  border-radius: 6px;
  z-index: 100;
  font-weight: 600;
}
.skip-link:focus { left: 8px; }

/* ---------- header ---------- */
.legal-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.legal-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.legal-brand {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  border-left: 5px solid var(--primary);
  padding-left: 10px;
}
.legal-brand:hover { color: var(--primary); }
.legal-nav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.legal-nav a, .legal-menu-trigger {
  color: var(--text-soft);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.95rem;
}
.legal-nav a:hover { background: var(--bg-elev); color: var(--text); }
.legal-home-link { font-weight: 700; color: var(--text); }
/* "Create account" is the primary action here (same blue as the app's own
   sign-up CTA); "Sign in" is secondary, so it's an outline instead of a
   second solid button competing for attention. */
.legal-nav a.cta { background: var(--primary); color: #fff; font-weight: 700; }
.legal-nav a.cta:hover { background: var(--primary-dark); color: #fff; }
.legal-nav a.cta.cta-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); padding: 4.5px 12px; }
.legal-nav a.cta.cta-outline:hover { background: var(--primary); color: #fff; }

/* Cross-page "Legal pages" menu — a <details>/<summary> disclosure, no
   script needed (see the header markup comment in routes/legal.js). */
.legal-menu { position: relative; }
.legal-menu-trigger { cursor: pointer; list-style: none; }
.legal-menu-trigger::-webkit-details-marker { display: none; }
.legal-menu-trigger::after { content: " \25BE"; }
.legal-menu[open] .legal-menu-trigger { background: var(--bg-elev); color: var(--text); }
.legal-menu-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 20;
  display: flex; flex-direction: column; min-width: 220px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px;
  padding: 6px; box-shadow: 0 12px 32px rgba(0,0,0,.14);
}
.legal-menu-panel a {
  color: var(--text-soft); text-decoration: none; padding: 8px 10px; border-radius: 7px; font-size: 0.92rem;
}
.legal-menu-panel a:hover { background: var(--bg-soft); color: var(--text); }
.legal-menu-panel a[aria-current="page"] { color: var(--primary); font-weight: 700; }
@media (max-width: 640px) {
  .legal-menu-panel { position: static; box-shadow: none; margin-top: 4px; }
}

/* ---------- layout ---------- */
.legal-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 16px 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

@media (min-width: 980px) {
  .legal-wrap {
    grid-template-columns: 250px minmax(0, 760px);
    gap: 48px;
    justify-content: center;
    align-items: start;
  }
  .legal-toc {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
  }
}

.legal-toc {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 0.92rem;
  line-height: 1.4;
}
.legal-toc h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  margin: 0 0 8px;
  padding: 0;
  border: 0;
}
.legal-toc ol { margin: 0; padding-left: 1.25em; }
.legal-toc li { margin: 5px 0; }
.legal-toc a { text-decoration: none; color: var(--text); }
.legal-toc a:hover { color: var(--accent); text-decoration: underline; }

@media (max-width: 979px) {
  .legal-toc details:not([open]) ol { display: none; }
}

.legal-toc summary {
  cursor: pointer;
  font-weight: 700;
  list-style-position: inside;
}
@media (min-width: 980px) {
  .legal-toc summary { pointer-events: none; list-style: none; }
  .legal-toc summary::-webkit-details-marker { display: none; }
  .legal-toc details ol { display: block; }
}

/* ---------- prose ---------- */
.legal-main { min-width: 0; max-width: 760px; }

.legal-main h1 {
  font-size: clamp(1.75rem, 4vw, 2.3rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.legal-meta {
  color: var(--text-soft);
  font-size: 0.93rem;
  margin: 0 0 22px;
}
.legal-main h2 {
  font-size: 1.4rem;
  line-height: 1.3;
  margin: 2.2em 0 0.5em;
  padding-top: 0.6em;
  border-top: 1px solid var(--border);
  scroll-margin-top: 16px;
}
.legal-main h3 { font-size: 1.1rem; margin: 1.6em 0 0.3em; scroll-margin-top: 16px; }
.legal-main p { margin: 0.75em 0; }
.legal-main ul, .legal-main ol { padding-left: 1.4em; margin: 0.75em 0; }
.legal-main li { margin: 0.35em 0; }
.legal-main li::marker { color: var(--accent); }
.legal-main strong { font-weight: 700; }
.legal-main code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  overflow-wrap: anywhere;
}

.summary-box, .note-box {
  border: 1px solid var(--note-border);
  border-left: 5px solid var(--accent);
  background: var(--note-bg);
  border-radius: var(--radius);
  padding: 4px 18px 8px;
  margin: 1.2em 0;
}
.summary-box h2 {
  margin: 0.7em 0 0.2em;
  padding: 0;
  border: 0;
  font-size: 1.15rem;
}
.summary-box p, .summary-box ul, .note-box p { margin: 0.5em 0; }

.legal-main mark.todo {
  background: var(--mark-bg);
  color: var(--mark-text);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  outline: 1px dashed #b58900;
}

/* ---------- tables ---------- */
.table-scroll {
  overflow-x: auto;
  margin: 1em 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}
.table-scroll:focus-visible { outline: 3px solid var(--accent); }
.legal-main table {
  border-collapse: collapse;
  width: 100%;
  min-width: 560px;
  font-size: 0.9rem;
  line-height: 1.45;
}
.legal-main caption {
  text-align: left;
  font-weight: 700;
  padding: 10px 12px;
  color: var(--text-soft);
}
.legal-main th, .legal-main td {
  text-align: left;
  vertical-align: top;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}
.legal-main th { background: var(--bg-soft); font-weight: 700; white-space: nowrap; }
.legal-main tbody tr:last-child td { border-bottom: 0; }
.legal-main td code { white-space: normal; }

/* ---------- footer ---------- */
.legal-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-soft);
  font-size: 0.88rem;
}
.legal-footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 36px;
}
.legal-footer ul {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}
.legal-footer a { color: var(--text-soft); }
.legal-footer a:hover { color: var(--accent); }
.legal-footer p { margin: 6px 0; }

.print-only { display: none; }

@media (max-width: 520px) {
  body { font-size: 16px; }
  .legal-main h2 { font-size: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ---------- print ---------- */
@media print {
  :root {
    --bg: #fff; --bg-soft: #fff; --text: #000; --text-soft: #333;
    --border: #999; --link: #000; --note-bg: #fff; --note-border: #999;
    --mark-bg: #eee; --mark-text: #000;
  }
  body { font-size: 11pt; line-height: 1.45; color: #000; background: #fff; }
  .legal-header, .legal-toc, .skip-link { display: none; }
  .legal-wrap { display: block; padding: 0; max-width: none; }
  .legal-main { max-width: none; }
  .legal-main a { text-decoration: underline; color: #000; }
  .legal-main a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; word-break: break-all; }
  .legal-main h2 { break-after: avoid; border-top: 0; }
  .legal-main h3 { break-after: avoid; }
  .legal-main table, .summary-box { break-inside: avoid; }
  .table-scroll { overflow: visible; border: 1px solid #999; }
  .legal-main table { min-width: 0; font-size: 9pt; }
  .legal-footer { background: #fff; border-top: 1px solid #999; }
  .legal-footer ul { display: none; }
  .print-only { display: block; }
}

/* Pages only scroll up and down on phones (2026-09-24) */
html, body { max-width: 100%; overflow-x: hidden; }
@supports (overflow-x: clip) { html, body { overflow-x: clip; } }

/* ---------- 2026-10 refresh: match the redesigned site ---------- */
.legal-header { background: #fff; border-bottom: 0; box-shadow: 0 1px 0 #E2E8F2; position: relative; }
.legal-header::after { content: ''; position: absolute; left: 0; right: 0; bottom: -3px; height: 3px; background: linear-gradient(90deg, #FF6B35 0 50%, #0B5FFF 50% 100%); }
.legal-brand { display: inline-flex; align-items: center; gap: 10px; border-left: 0; padding-left: 0; font-size: 1.2rem; }
.legal-brand img { width: 32px; height: 32px; border-radius: 9px; }
.legal-nav a.cta { border-radius: 12px; background: linear-gradient(135deg, #3B82FF, #0B5FFF); box-shadow: 0 6px 14px -6px rgba(11,95,255,.6); }
.legal-nav a.cta.cta-outline { border-radius: 12px; box-shadow: none; background: #fff; }
@media (max-width: 640px) {
  .legal-header-inner { padding: 10px 12px; gap: 8px; }
  .legal-nav { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .legal-nav::-webkit-scrollbar { display: none; }
  .legal-nav a, .legal-menu-trigger { white-space: nowrap; font-size: .9rem; padding: 7px 11px; }
  .legal-menu { position: static; }
  .legal-menu-panel { left: 12px !important; right: 12px !important; width: auto !important; }
}
