/* Legal pages (Terms of Service, Privacy Policy) at app.kingofthemat.app/legal/.
   Brand per DESIGN.md: Mona Sans only, neutral ink ground, ivory text, hairline dividers,
   matte cards. Gold belongs to crowns and red to actions, so the only red here is the
   current-page link and the focus ring (DESIGN.md: "red = buttons, active state").

   Fonts: the same Mona Sans woff2 files the marketing site serves (kingofthemat.app/fonts/,
   immutable cache, Access-Control-Allow-Origin: *). The web build only exposes content-
   hashed TTFs under /assets/, which are not a stable path for static pages. Only 400, 600
   and 800 exist there, so this file uses those three weights and nothing in between. */

@font-face {
  font-family: 'Mona Sans';
  src: url('https://kingofthemat.app/fonts/MonaSans-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Mona Sans';
  src: url('https://kingofthemat.app/fonts/MonaSans-SemiBold.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Mona Sans';
  src: url('https://kingofthemat.app/fonts/MonaSans-ExtraBold.woff2') format('woff2');
  font-weight: 800; font-style: normal; font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #0A0709;                      /* DESIGN.md neutral ink ground */
  --bone: #F7F2EA;                     /* solid text, headings */
  --fg2: rgba(247, 242, 234, 0.80);    /* body text */
  --muted: rgba(247, 242, 234, 0.64);
  --dim: rgba(247, 242, 234, 0.50);
  --surface: rgba(255, 255, 255, 0.04);   /* matte card */
  --surface-2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.09);    /* matte card edge */
  --hairline: rgba(255, 255, 255, 0.08);  /* dividers */
  --blood-hi: #DE5B6C;                    /* small red text: active state only */
  --max: 720px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--ink); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ink);
  color: var(--fg2);
  font-family: 'Mona Sans', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 48px 20px 96px; }

:focus-visible { outline: 2px solid var(--blood-hi); outline-offset: 3px; border-radius: 4px; }

/* ── type ────────────────────────────────────────────────────────────────────── */
h1, h2, h3 { color: var(--bone); font-weight: 800; line-height: 1.15; text-wrap: balance; }

h1 { font-size: clamp(34px, 9vw, 52px); letter-spacing: -0.03em; margin: 0 0 14px; }

/* The ♛ glyph before the title: a generic crown is not the brand mark (DESIGN.md rule 3). */
.crown { display: none; }

.doc-kicker {
  font-size: 12px; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 14px;
}

.updated { color: var(--muted); font-size: 14px; margin: 0 0 4px; }
.updated strong { color: var(--fg2); font-weight: 600; }

h2 {
  font-size: clamp(21px, 5.4vw, 26px); letter-spacing: -0.02em;
  margin: 56px 0 14px; padding-top: 22px;
  border-top: 1px solid var(--hairline);
  scroll-margin-top: 24px;
}
/* proportional figures: Mona Sans tabular figures switch to mono-styled digits (dotted zero) */
h2 .num { color: var(--dim); margin-right: 0.4em; }

h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.005em; margin: 32px 0 8px; }

p, li { font-size: 16px; }
p { margin: 0 0 16px; }

a {
  color: var(--bone);
  text-decoration: underline; text-decoration-thickness: 1px;
  text-decoration-color: rgba(247, 242, 234, 0.35); text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease;
}
a:hover { text-decoration-color: var(--bone); }

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

ul, ol { margin: 0 0 18px; padding-left: 22px; }
li { margin: 0 0 9px; }
li::marker { color: var(--dim); }

/* One family only: code reads as a quiet chip, never a monospace face. */
code, .mono {
  font-family: inherit; font-size: 0.94em; font-weight: 600; color: var(--bone);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px;
}

/* ── intro card + contents (matte, DESIGN.md "soft") ───────────────────────────── */
.lede {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  padding: 22px 22px; margin: 32px 0 8px;
}
.lede p:last-child { margin-bottom: 0; }

nav.toc {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 20px 22px 14px; margin: 24px 0 8px;
}
nav.toc .toc-title {
  font-size: 12px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 8px;
}
nav.toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; }
nav.toc li {
  counter-increment: toc; margin: 0; padding: 8px 0;
  display: flex; gap: 12px; align-items: baseline;
  border-top: 1px solid var(--hairline);
}
nav.toc li:first-child { border-top: 0; }
nav.toc li::before {
  content: counter(toc, decimal-leading-zero);
  font-size: 12px; font-weight: 600;
  color: var(--dim); min-width: 22px;
}
nav.toc a { color: var(--fg2); text-decoration: none; }
nav.toc a:hover { color: var(--bone); text-decoration: underline; text-decoration-color: rgba(247, 242, 234, 0.35); }

/* ── tables (privacy) ───────────────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; margin: 0 0 20px; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; min-width: 460px; font-size: 14.5px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
th:first-child, td:first-child { padding-left: 0; }
thead th {
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}
tbody td:first-child { color: var(--bone); font-weight: 600; white-space: nowrap; }

/* ── callouts ──────────────────────────────────────────────────────────────── */
.note {
  border-left: 2px solid rgba(247, 242, 234, 0.28);
  background: var(--surface); border-radius: 0 14px 14px 0;
  padding: 12px 16px; margin: 0 0 20px; font-size: 15px; color: var(--fg2);
}
.note .label {
  display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 4px;
}
.note.risk { border-left-color: rgba(247, 242, 234, 0.6); background: var(--surface-2); }
.note.risk .label { color: var(--bone); }

/* all-caps disclaimers */
.legal-emph {
  border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03); border-radius: 16px;
  padding: 16px 18px; margin: 0 0 20px;
  font-size: 13.5px; letter-spacing: 0.02em; line-height: 1.65; color: var(--fg2);
}

.back-top { display: inline-block; font-size: 12px; color: var(--muted); margin-top: 4px; text-decoration: none; }
.back-top:hover { color: var(--bone); }

/* ── footer ────────────────────────────────────────────────────────────────── */
footer {
  margin-top: 72px; padding-top: 24px; border-top: 1px solid var(--hairline);
  font-size: 14px; color: var(--muted);
}
footer .foot-links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 14px; }
footer .foot-links a { color: var(--fg2); font-weight: 600; text-decoration: none; }
footer .foot-links a:hover { color: var(--bone); }
footer .foot-links a[aria-current="page"] { color: var(--blood-hi); }
footer .fine { color: var(--dim); font-size: 13px; line-height: 1.6; }

@media (min-width: 700px) {
  .wrap { padding: 72px 24px 112px; }
  body, p, li { font-size: 17px; }
  h3 { font-size: 19px; }
  .note { font-size: 16px; }
}
@media (max-width: 480px) {
  .wrap { padding: 32px 20px 72px; }
  .lede { padding: 18px; }
  nav.toc { padding: 18px 18px 12px; }
}
