/* Archetypes — archetypesapp.com
 *
 * Token values are MIRRORED from the app's design system, not invented here. The single
 * source of truth is ios/Sources/ArchetypesDesignSystem/Tokens/ArchetypesColors.swift
 * (`defaultLight` / `defaultDark`), which Android mirrors via the same slot names. Slot
 * names below are kept verbatim so a drift is greppable across all three surfaces.
 *
 * Light is the DEFAULT brightness (matching the app since the 2026-06-30 theming overhaul);
 * dark is served via prefers-color-scheme from the `defaultDark` set.
 *
 * Fonts are SELF-HOSTED (subset to woff2 from the same .ttf the app bundles in
 * ios/App/Resources/Fonts/). No font CDN — deliberately: a third-party font host would be a
 * data flow this site's own privacy policy would have to disclose.
 */

/* ── fonts ─────────────────────────────────────────────────────────────────── */

@font-face {
  font-family: "Saira Condensed";
  src: url("fonts/saira-condensed-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("fonts/inter-var.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-var.woff2") format("woff2-variations");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-italic-var.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

/* ── tokens (slot names verbatim from ArchetypesColors.swift) ───────────────── */

:root {
  color-scheme: light dark;

  /* defaultLight */
  --canvas: #f1f3f6;
  --card: #ffffff;
  --card-sunken: #f3f5f7;
  --rule: #dce0e5;
  --rule-soft: #e9ecef;
  --ink: #15181c;
  --muted: #5b626b;
  --muted-deep: #8a919a;
  --accent: #c98a4b;
  --accent-text: #a6651e;
  --wordmark: #b0701f;
  --bg-top: #ffffff;
  --bg-mid: #eef1f4;
  --bg-bottom: #e1e6eb;

  --display: "Saira Condensed", ui-sans-serif, system-ui, sans-serif;
  --body: "Inter", ui-sans-serif, system-ui, sans-serif;
  --data: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --editorial: "Newsreader", Georgia, serif;

  /* Spacing scale mirrors DSSpacing's intent: a small set, used consistently. */
  --s1: 0.5rem;
  --s2: 1rem;
  --s3: 1.5rem;
  --s4: 2.5rem;
  --s5: 4rem;
  --measure: 34rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* defaultDark */
    --canvas: #070809;
    --card: #101316;
    --card-sunken: #0c0f12;
    --rule: #23272b;
    --rule-soft: #16191c;
    --ink: #f6f8f9;
    --muted: #aab1b8;
    --muted-deep: #5b626a;
    --accent: #c98a4b;
    --accent-text: #c98a4b;
    --wordmark: #c98a4b;
    --bg-top: #1b1e22;
    --bg-mid: #121417;
    --bg-bottom: #0a0b0d;
  }
}

/* ── base ──────────────────────────────────────────────────────────────────── */

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--canvas);
  /* The app's DSBackground radial: top-lit broadcast atmosphere. */
  background-image: radial-gradient(
    120% 80% at 50% 0%,
    var(--bg-top) 0%,
    var(--bg-mid) 45%,
    var(--bg-bottom) 100%
  );
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.65;
  font-variation-settings: "opsz" 16;
}

main {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding: var(--s5) var(--s3) var(--s4);
}

/* ── wordmark ──────────────────────────────────────────────────────────────── */

.wordmark {
  font-family: var(--display);
  font-weight: 700;
  color: var(--wordmark);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
  margin: 0;
  font-size: clamp(2rem, 9vw, 3.25rem);
}

a.wordmark {
  text-decoration: none;
}

.rule-accent {
  width: 3.5rem;
  height: 2px;
  border: 0;
  margin: var(--s3) 0;
  background: var(--accent);
}

/* ── type ──────────────────────────────────────────────────────────────────── */

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
  color: var(--ink);
}

h1 {
  font-size: clamp(1.75rem, 6vw, 2.5rem);
  margin: 0 0 var(--s2);
}

h2 {
  font-size: 1.4rem;
  margin: var(--s4) 0 var(--s1);
}

h3 {
  font-size: 1.1rem;
  margin: var(--s3) 0 var(--s1);
}

p {
  margin: 0 0 var(--s2);
}

.lede {
  font-family: var(--editorial);
  font-style: italic;
  font-size: clamp(1.2rem, 4.5vw, 1.6rem);
  line-height: 1.35;
  color: var(--ink);
  margin: 0 0 var(--s3);
  font-variation-settings: "opsz" 32;
}

.stamp {
  font-family: var(--data);
  font-size: 0.75rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  /* --muted, not --muted-deep: measured 2.81:1 on bg-mid, below the 4.5:1 small-text
     threshold. --muted clears 5.44:1 there and 4.91:1 on the darkest light stop. */
  color: var(--muted);
  margin: 0 0 var(--s2);
}

.muted {
  color: var(--muted);
}

/* Links carry their affordance in the ACCENT UNDERLINE, not the text colour.
   Why: `accentText` is tuned for the app's WHITE card surfaces (measured 4.66:1 on
   #FFFFFF — its Swift comment is accurate). This site sets text on the tinted radial
   canvas, where it falls to 4.11:1 on bg-mid and 3.71:1 on bg-bottom, and even
   `accentPressed` only reaches 4.15:1 there. Rather than invent a darker brand hex the
   app doesn't have, ink carries the text (15.71:1) and the accent carries the signal. */
a {
  color: var(--ink);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-color: currentColor;
}

a:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
  border-radius: 2px;
}

ul {
  padding-left: 1.15rem;
  margin: 0 0 var(--s2);
}

li {
  margin-bottom: var(--s1);
}

dt {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-top: var(--s2);
}

dd {
  margin: 0.15rem 0 0;
  color: var(--muted);
}

/* ── card ──────────────────────────────────────────────────────────────────── */

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: var(--s3);
  margin: var(--s3) 0;
}

.card > :last-child {
  margin-bottom: 0;
}

/* ── footer ────────────────────────────────────────────────────────────────── */

footer {
  flex: 0 0 auto;
  border-top: 1px solid var(--rule);
  padding: var(--s3);
}

.footer-inner {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
}

footer nav {
  margin-bottom: var(--s2);
  font-size: 0.9rem;
}

footer nav a + a {
  margin-left: var(--s2);
}

/* Responsible-play notice. Kept per the 5.3.4 classification memo §6 — voluntary,
   norm-aligned (AGA code), and it reinforces the reference-only posture. */
.rg {
  font-size: 0.8rem;
  line-height: 1.5;
  /* --muted, not --muted-deep: measured 2.53:1 (light) / 3.19:1 (dark) on the footer's
     bg-bottom stop. --muted gives 4.91:1 / 9.09:1. A disclosure has to be readable. */
  color: var(--muted);
  margin: 0;
}

.rg strong {
  color: var(--ink);
  font-weight: 600;
}

@media (min-width: 40em) {
  main {
    padding-top: 6rem;
  }
}
