/* Preserve — preserve.ng Design Tokens (W3C DTCG / OKLCH + sRGB fallbacks)
   Grounded in Preserve archival paper & ink principles and Design Factory Stage 3 lock. */

@font-face {
  font-family: 'Newsreader';
  src: url('./fonts/newsreader-latin-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Newsreader';
  src: url('./fonts/newsreader-latin-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Sans';
  src: url('./fonts/ibm-plex-sans-latin-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Sans';
  src: url('./fonts/ibm-plex-sans-latin-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  /* Chromatic system — Warm Archival Paper (default) */
  --bg: #f6f2ea;
  --surface: #fbf8f2;
  --surface-subtle: #efeae0;
  --ink: #1b1916;
  --ink-muted: #504a42;
  --rule: rgba(27, 25, 22, 0.14);
  --rule-strong: rgba(27, 25, 22, 0.28);
  --hover-wash: rgba(251, 248, 242, 0.72);
  --accent: #8c3e1f;
  --accent-ink: #fbf8f2;
  --btn-ink-bg: #1b1916;
  --btn-ink-fg: #fbf8f2;

  /* Typography — Strict Vignelli 4-step harmonic chord (15, 17, 24, 64 px) */
  --font-display: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --text-label: 0.9375rem;    /* 15px */
  --text-body: 1.0625rem;     /* 17px desktop */
  --text-title: 1.5rem;       /* 24px */
  --text-display: clamp(2.375rem, 4.9vw, 4rem); /* 38px mobile -> 64px desktop */

  /* Spatial rhythm — Strict 4px / 8px Swiss scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  --container-max: 1120px;
  --gutter: clamp(20px, 5vw, 64px);
  --radius: 2px;

  /* Motion physics — calm editorial deceleration */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 180ms;
}

@supports (color: oklch(0.96 0.01 84)) {
  :root {
    --bg: oklch(0.9620 0.0115 84.6);
    --surface: oklch(0.9798 0.0086 84.6);
    --surface-subtle: oklch(0.9382 0.0144 84.6);
    --ink: oklch(0.2146 0.0066 78.2);
    --ink-muted: oklch(0.4124 0.0153 75.2);
    --accent: oklch(0.4618 0.1150 41.0);
    --accent-ink: oklch(0.9798 0.0086 84.6);
    --btn-ink-bg: oklch(0.2146 0.0066 78.2);
    --btn-ink-fg: oklch(0.9798 0.0086 84.6);
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161618;
    --surface: #1e1e21;
    --surface-subtle: #111113;
    --ink: #edeae3;
    --ink-muted: #aca79e;
    --rule: rgba(237, 234, 227, 0.13);
    --rule-strong: rgba(237, 234, 227, 0.28);
    --hover-wash: rgba(237, 234, 227, 0.04);
    --accent: #d48b62;
    --accent-ink: #161618;
    --btn-ink-bg: #edeae3;
    --btn-ink-fg: #161618;
  }

  @supports (color: oklch(0.2 0.01 286)) {
    :root {
      --bg: oklch(0.2011 0.0039 286.0);
      --surface: oklch(0.2350 0.0050 286.0);
      --ink: oklch(0.9374 0.0099 87.5);
      --ink-muted: oklch(0.7280 0.0120 84.0);
      --accent: oklch(0.7150 0.1020 50.0);
      --accent-ink: oklch(0.2011 0.0039 286.0);
      --btn-ink-bg: oklch(0.9374 0.0099 87.5);
      --btn-ink-fg: oklch(0.2011 0.0039 286.0);
    }
  }
}
