/*
 * RainLily design tokens: the ONLY place a colour, typeface, size, space or radius is defined.
 *
 * site.css reads the SEMANTIC tokens (--color-*, --font-*, --step-*, --space-*), never the raw
 * palette. A restyle to match the app edits this file alone. Dark mode redefines semantic tokens
 * only (bottom of the file).
 *
 * Contrast is enforced, not remembered: scripts/check-contrast.mjs reads this file, composites
 * every wash over the background at its opacity, and fails if any text pair drops below WCAG AA.
 * Raw palette colours that FAIL as text on paper are marked; they are for art only.
 */

@font-face {
  font-family: "Calistoga";
  /* Latin subset; Calistoga has one weight (400), so headings use 400 and never a faux bold. */
  src: url("/fonts/Calistoga-RainLily-latin-v1.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  /* Latin subset; wght 400–700, opsz 14–32. */
  src: url("/fonts/InterVariable-RainLily-latin-v1.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  /* ── Raw palette ──────────────────────────────────────────────────────────────── */
  --paper: #FBF6EC;
  --paper-2: #F4ECDC;
  --paper-3: #FFFDF8;
  --ink: #2B3A32;
  --ink-muted: #4E5A52;
  --poppy: #E07A2E;          /* 2.79:1 on paper: ART ONLY */
  --poppy-strong: #9E4A12;   /* 5.66:1 on paper: accent text */
  --poppy-tint: #F7E3D0;
  --blue-mid: #4F74A8;       /* 4.43:1 on paper: ART ONLY */
  --link-blue: #3D5F92;      /* 6.0:1 on paper: links */
  --sage: #A7BFA0;           /* 1.84:1 on paper: washes only */
  --green-mid: #5E7F57;
  --terracotta: #B5654A;     /* 3.96:1 on paper: art, or display text ≥ 24px */
  --terracotta-strong: #9A4F37;
  --rule: #E3DACA;

  /* ── Semantic colour (light) ───────────────────────────────────────────────────────── */
  --color-bg: var(--paper);
  --color-surface: var(--paper-3);
  --color-surface-2: var(--paper-2);
  --color-text: var(--ink);
  --color-text-muted: var(--ink-muted);
  --color-link: var(--link-blue);
  --color-link-hover: var(--ink);
  --color-underline-hover: var(--poppy);
  --color-accent: var(--poppy);
  --color-accent-text: var(--poppy-strong);
  --color-eyebrow: var(--terracotta-strong);
  --color-focus: var(--link-blue);
  --color-rule: var(--rule);
  --color-pill-bg: var(--poppy-tint);
  --color-pill-text: var(--ink);
  --color-tag-a-bg: #DCE6F2;
  --color-tag-a-text: #2F4E7C;
  --color-tag-b-bg: #E3EBDD;
  --color-tag-b-text: #3F5B39;

  /* Washes and art (decorative; never carry information on their own). */
  --color-wash-sage: var(--sage);
  --color-wash-blue: var(--blue-mid);
  --color-wash-poppy: var(--poppy);
  --wash-opacity-sage: 0.34;
  --wash-opacity-blue: 0.16;
  --wash-opacity-poppy: 0.20;
  --color-art-blue: var(--blue-mid);
  --color-art-green: var(--green-mid);
  --color-art-poppy: var(--poppy);
  --color-art-terracotta: var(--terracotta);
  --color-art-track: #E9E1D1;

  --shadow-card: 0 1px 2px rgb(43 58 50 / 0.06), 0 8px 24px rgb(43 58 50 / 0.08);

  /* ── Type ──────────────────────────────────────────────────────────────────────────── */
  --font-display: "Calistoga", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --weight-body: 400;
  --weight-strong: 600;
  --weight-heading: 400;

  /* Fluid scale (320px → 1280px viewport). */
  --step--1: clamp(0.875rem, 0.85rem + 0.13vw, 0.9375rem);
  --step-0: clamp(1rem, 0.96rem + 0.21vw, 1.125rem);
  --step-1: clamp(1.25rem, 1.2rem + 0.26vw, 1.375rem);
  --step-2: clamp(1.5rem, 1.33rem + 0.83vw, 2rem);
  --step-3: clamp(1.875rem, 1.6rem + 1.4vw, 2.75rem);
  --step-4: clamp(2.25rem, 1.75rem + 2.5vw, 3.75rem);

  --leading-body: 1.6;
  --leading-heading: 1.15;
  --measure: 68ch;

  /* ── Space, size, radius ───────────────────────────────────────────────────────────── */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-s: 1rem;
  --space-m: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --space-l: clamp(1.75rem, 1.5rem + 1.2vw, 2.5rem);
  --space-xl: clamp(2.5rem, 2rem + 2.4vw, 4rem);
  --space-2xl: clamp(3.5rem, 2.6rem + 4.4vw, 6.5rem);
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --wrap: 72rem;
  --radius-s: 6px;
  --radius-m: 14px;
  --radius-l: 22px;
  --radius-pill: 999px;
  --target-min: 44px;
}

/* ── Dark mode: semantic tokens only ─────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #17201B;
    --color-surface: #1E2A23;
    --color-surface-2: #1B2620;
    --color-text: #EDE6D6;
    --color-text-muted: #B8B2A4;
    --color-link: #9DBBE6;
    --color-link-hover: #EDE6D6;
    --color-underline-hover: #F0A060;
    --color-accent: #F0A060;
    --color-accent-text: #F0A060;
    --color-eyebrow: #E09A80;
    --color-focus: #9DBBE6;
    --color-rule: #33413A;
    --color-pill-bg: #3B301E;
    --color-pill-text: #EDE6D6;
    --color-tag-a-bg: #24364F;
    --color-tag-a-text: #CFE0F5;
    --color-tag-b-bg: #2A3A2A;
    --color-tag-b-text: #D2E3CB;

    --color-wash-sage: #7E9E77;
    --color-wash-blue: #5B83BC;
    --color-wash-poppy: #D07A3A;
    --wash-opacity-sage: 0.20;
    --wash-opacity-blue: 0.22;
    --wash-opacity-poppy: 0.13;
    --color-art-blue: #7FA2D4;
    --color-art-green: #8FB287;
    --color-art-poppy: #F0A060;
    --color-art-terracotta: #D88A6E;
    --color-art-track: #2C3A32;

    --shadow-card: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
  }
}
