/* legal.css — the two standalone legal pages (terms.html, privacy.html).
 *
 * Deliberately NOT styles.css. That file is 362 KB, is the source app's whole
 * unpruned stylesheet, and carries layout assumptions about .app and the view
 * containers that these pages don't have. A legal page is a column of text; it
 * should not pull the entire application's CSS to render one.
 *
 * The cost is a copy of the design tokens. The block below MIRRORS styles.css
 * (its :root and [data-theme="light"] blocks, near the top of the file) — if a
 * token changes there, change it here. Only the tokens these pages actually
 * use are copied, so the list is short on purpose.
 *
 * Theme: both pages run a tiny inline script that reads `mm_theme` from
 * localStorage — the same key app-shell.js writes — and stamps data-theme on
 * <html> before first paint. A visitor who set light mode in the app sees a
 * light legal page and no flash of dark. */

:root {
  --font-display: 'Archivo', system-ui, sans-serif;
  --font-black:   'Archivo Black', 'Archivo', Impact, sans-serif;
  --font-body:    'Archivo', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, Menlo, monospace;

  --bg:           #0b0b0d;
  --surface:      #121216;
  --surface-2:    #1a1a20;
  --border:       #2c2c36;
  --text:         #f5f3ee;
  --text-dim:     #9a9aa6;
  --accent:       #b21c22;
  --accent-dim:   #cc2a31;
  --accent-muted: #241012;
  --on-accent:    #ffffff;
  --radius:       2px;
  --transition:   150ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Light — newsprint. Cool grey stock, not cream. */
[data-theme="light"] {
  --bg:           #e6e5e1;
  --surface:      #f7f7f4;
  --surface-2:    #dbdad5;
  --border:       #b5b4ac;
  --text:         #131317;
  --text-dim:     #5c5c66;
  --accent:       #a3161c;
  --accent-dim:   #851014;
  --accent-muted: #f0dcdc;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[data-theme="light"] a { color: var(--accent-dim); }

/* ── Masthead ─────────────────────────────────────────────────────────────
   The newsstand rule from the app: an all-caps eyebrow over a heavy slab,
   sitting on a hard red rule. No serif, no gold. */

.legal-bar {
  border-bottom: 3px solid var(--accent);
  background: var(--surface);
}

.legal-bar-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.legal-home {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.legal-home:hover { text-decoration: none; }

.legal-home img { width: 34px; height: 34px; display: block; }

.legal-eyebrow {
  display: block;
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--text-dim);
  line-height: 1;
  margin-bottom: 3px;
}

.legal-badge {
  display: inline-block;
  font-family: var(--font-black);
  font-size: 17px;
  line-height: 1;
  letter-spacing: 0.015em;
  background: var(--accent);
  color: var(--on-accent);
  padding: 4px 7px 3px;
  border-radius: var(--radius);
  text-transform: uppercase;
}

.legal-back {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.legal-back:hover { color: var(--accent); text-decoration: none; }

/* ── Page body ───────────────────────────────────────────────────────── */

.legal {
  max-width: 760px;
  margin: 0 auto;
  padding: 44px 24px 80px;
  line-height: 1.65;
  font-size: 15px;
}

.legal h1 {
  font-family: var(--font-black);
  font-size: clamp(30px, 6vw, 46px);
  line-height: 1.02;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin: 0 0 10px;
}

.legal-updated {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

/* The one-paragraph plain-English summary above the formal text. Every page
   gets one; if a section below cannot be summarised honestly in a sentence,
   the section is wrong, not the summary. */
.legal-tldr {
  background: var(--surface);
  border-left: 3px solid var(--accent);
  padding: 16px 20px;
  margin: 0 0 36px;
  font-size: 15px;
}
.legal-tldr strong {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-dim);
  margin-bottom: 6px;
}
[data-theme="light"] .legal-tldr strong { color: var(--accent); }
.legal-tldr p { margin: 0; }

.legal h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-dim);
  margin: 40px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
[data-theme="light"] .legal h2 { color: var(--accent); }

.legal h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  margin: 26px 0 8px;
}

.legal p { margin: 0 0 14px; }
.legal ul { margin: 0 0 16px; padding-left: 20px; }
.legal li { margin-bottom: 7px; }

.legal strong { font-weight: 700; }

.legal code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1px 5px;
}

/* Wide tables must scroll inside their own box rather than pushing the page
   sideways on a phone. */
.legal-table-wrap { overflow-x: auto; margin: 0 0 20px; }

.legal table {
  border-collapse: collapse;
  width: 100%;
  min-width: 460px;
  font-size: 13.5px;
}
.legal th, .legal td {
  border: 1px solid var(--border);
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
}
.legal th {
  background: var(--surface-2);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}
.legal td code { background: none; border: none; padding: 0; }

.legal-contact {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-top: 36px;
}
.legal-contact p:last-child { margin-bottom: 0; }

/* Featured Chessable course on the About page. The cover art links out too,
   so the whole card reads as one call to action. */
.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0 0 40px;
}
.course-art { display: block; line-height: 0; }
.course-art img {
  display: block;
  width: 100%;
  height: auto;
  transition: opacity var(--transition);
}
.course-art:hover img { opacity: 0.92; }

.course-intro { padding: 18px 22px 16px; }
.course-intro p { margin: 0; }

.course-body { padding: 20px 22px 22px; }
.course-body p { margin: 0 0 16px; }

.course-eyebrow {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-dim);
  margin-bottom: 6px;
}
[data-theme="light"] .course-eyebrow { color: var(--accent); }

/* Reset the section-divider look .legal h2 carries. */
.legal .course-title {
  font-family: var(--font-black);
  font-weight: 400;
  font-size: clamp(22px, 4.2vw, 30px);
  line-height: 1.08;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--text);
  margin: 0 0 8px;
  padding: 0;
  border: 0;
}
[data-theme="light"] .legal .course-title { color: var(--text); }

.legal .course-moves {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  margin: 0 0 14px;
}

.course-cta {
  display: inline-block;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 11px 18px;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.course-cta:hover { background: var(--accent-dim); text-decoration: none; }
[data-theme="light"] .course-cta { color: var(--on-accent); }

.legal-foot {
  margin-top: 44px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

@media (max-width: 560px) {
  .legal { padding: 32px 18px 60px; }
  .legal-bar-inner { padding: 14px 18px; }
}
