/*
 * APEX legal pages.
 *
 * Dark by default, because these are reached by tapping a link inside a dark
 * app and a white flash at that moment is jarring. Light mode is honoured for
 * anyone whose system asks for it, and print is given its own rules — legal
 * documents get printed, and a black background wastes a cartridge.
 */

:root {
  --bg: #0b0d10;
  --surface: #15181d;
  --border: #242a33;
  --text: #ffffff;
  --text-secondary: #c3c9d4;
  --text-muted: #8a92a1;
  --accent: #f5d020;
  --accent-ink: #0b0d10;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #ffffff;
    --surface: #f6f7f9;
    --border: #dfe3e9;
    --text: #0b0d10;
    --text-secondary: #384150;
    --text-muted: #5c6575;
    --accent: #8a6d00;
    --accent-ink: #ffffff;
  }
}

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

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

body {
  margin: 0;
  padding: 0 20px 96px;
  background: var(--bg);
  color: var(--text-secondary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

header {
  padding: 56px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.brand {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  margin-bottom: 20px;
}

h1 {
  margin: 0 0 12px;
  font-size: 34px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.dates {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

/* ── Type ────────────────────────────────────────────────────────────────── */

h2 {
  margin: 48px 0 14px;
  font-size: 21px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  scroll-margin-top: 24px;
}

h3 {
  margin: 30px 0 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

p,
li {
  margin: 0 0 14px;
}

ul,
ol {
  padding-left: 22px;
}

li {
  margin-bottom: 8px;
}

strong {
  color: var(--text);
  font-weight: 600;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

/* ── Callout ─────────────────────────────────────────────────────────────── */

.callout {
  margin: 28px 0;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
}

.callout p:last-child,
.callout ul:last-child,
.callout li:last-child {
  margin-bottom: 0;
}

.callout-title {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
  color: var(--text);
}

/* ── Tables ──────────────────────────────────────────────────────────────── */

.table-scroll {
  overflow-x: auto;
  margin: 20px 0 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  min-width: 460px;
}

th,
td {
  padding: 11px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

/* ── Table of contents ───────────────────────────────────────────────────── */

nav.toc {
  margin: 0 0 8px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

nav.toc p {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

nav.toc ol {
  margin: 0;
  padding-left: 20px;
  font-size: 15px;
}

nav.toc li {
  margin-bottom: 5px;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

footer {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
}

footer a {
  color: var(--text-secondary);
}

/* ── Landing page ────────────────────────────────────────────────────────── */

.cards {
  display: grid;
  gap: 14px;
  margin: 32px 0;
}

.card {
  display: block;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  text-decoration: none;
  color: inherit;
}

.card:hover {
  border-color: var(--accent);
}

.card strong {
  display: block;
  font-size: 17px;
  margin-bottom: 4px;
  color: var(--text);
}

.card span {
  font-size: 14.5px;
  color: var(--text-muted);
}

/* ── Small screens ───────────────────────────────────────────────────────── */

@media (max-width: 560px) {
  header {
    padding-top: 36px;
  }

  h1 {
    font-size: 27px;
  }

  h2 {
    font-size: 19px;
  }
}

/* ── Print ───────────────────────────────────────────────────────────────── */

@media print {
  :root {
    --bg: #ffffff;
    --surface: #ffffff;
    --border: #cccccc;
    --text: #000000;
    --text-secondary: #000000;
    --text-muted: #444444;
    --accent: #000000;
  }

  body {
    padding: 0;
    font-size: 11pt;
  }

  nav.toc {
    display: none;
  }

  h2 {
    page-break-after: avoid;
  }

  table,
  .callout {
    page-break-inside: avoid;
  }

  a {
    text-decoration: none;
  }
}
