/* Cairn design tokens — copied from design/colors_and_type.css (Claude Design, source of truth).
   Re-copy from design/ when the design system changes; the dark-mode media block at the end is the only site addition. */

/* ──────────────────────────────────────────────────────────────────────────
   Cairn — Design tokens
   ──────────────────────────────────────────────────────────────────────────
   Cool slate neutral foundation, single restrained harbor-blue accent (deep slate-blue),
   honest serif/sans/mono triad. Light + dark designed in tandem.

   Naming: --c-{category}-{role}
     bg     surface backgrounds
     fg     foreground text/icon
     line   borders + dividers
     accent the single restrained accent
     stone  literal stone-tone palette (used in marks, illustrations)
   ────────────────────────────────────────────────────────────────────────── */

:root {
  /* ── Stone palette (literal cairn-stone tones, cool slate) ──────────── */
  --stone-50:  #F4F5F6;   /* fog */
  --stone-100: #E8EAEC;   /* mist */
  --stone-200: #D2D6DA;   /* limestone */
  --stone-300: #B0B6BC;   /* granite-light */
  --stone-400: #878E96;   /* granite */
  --stone-500: #5E656D;   /* slate */
  --stone-600: #444A52;   /* slate-deep */
  --stone-700: #2F343A;   /* basalt */
  --stone-800: #1F2226;   /* basalt-deep */
  --stone-900: #14161A;   /* obsidian */

  /* ── Harbor accent — deep slate-blue, blueprint / cold-water ────────── */
  --harbor-50:  #EAF0F6;
  --harbor-100: #CFD9E5;
  --harbor-200: #A8BBD0;
  --harbor-300: #7E97B6;
  --harbor-400: #54759A;
  --harbor-500: #2E4A6B;   /* primary accent */
  --harbor-600: #243A55;
  --harbor-700: #1A2B3F;
  --harbor-800: #121E2D;

  /* ── Semantic, light mode (default) ─────────────────────────────────── */
  --c-bg-canvas:    #FBFBFA;     /* page */
  --c-bg-surface:   #FFFFFF;     /* raised surfaces */
  --c-bg-sunken:    var(--stone-50);
  --c-bg-overlay:   rgba(20, 22, 26, 0.55);

  --c-fg-primary:   var(--stone-800);
  --c-fg-secondary: var(--stone-600);
  --c-fg-tertiary:  var(--stone-500);
  --c-fg-muted:     var(--stone-400);
  --c-fg-on-accent: #FBFBFA;

  --c-line-strong:  var(--stone-300);
  --c-line:         var(--stone-200);
  --c-line-soft:    var(--stone-100);

  --c-accent:       var(--harbor-500);
  --c-accent-hover: var(--harbor-600);
  --c-accent-soft:  var(--harbor-50);

  /* ── Type scale (modular, 1.2 ratio, base 16) ───────────────────────── */
  --t-12:   12px;   /* meta, labels */
  --t-13:   13px;   /* small body, captions */
  --t-15:   15px;   /* body */
  --t-17:   17px;   /* lede */
  --t-20:   20px;   /* h5 */
  --t-24:   24px;   /* h4 */
  --t-30:   30px;   /* h3 */
  --t-38:   38px;   /* h2 */
  --t-48:   48px;   /* h1 */
  --t-64:   64px;   /* display */

  /* ── Type families ──────────────────────────────────────────────────── */
  --font-display: "Newsreader", "Cairn Symbols", "Source Serif 4", Georgia, serif;
  --font-sans:    "Inter Tight", "Söhne", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --font-mono:    "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --leading-tight: 1.15;
  --leading-snug:  1.3;
  --leading-body:  1.55;
  --leading-loose: 1.7;

  --tracking-tight: -0.01em;   /* display sizes only; Newsreader's optical sizes already tighten large type */
  --tracking-normal: 0;
  --tracking-wide:  0.04em;
  --tracking-caps:  0.08em;

  /* ── Spacing — 4px base ─────────────────────────────────────────────── */
  --s-1:   4px;
  --s-2:   8px;
  --s-3:   12px;
  --s-4:   16px;
  --s-5:   20px;
  --s-6:   24px;
  --s-8:   32px;
  --s-10:  40px;
  --s-12:  48px;
  --s-16:  64px;
  --s-20:  80px;
  --s-24:  96px;

  /* ── Radii ──────────────────────────────────────────────────────────── */
  --r-1: 2px;
  --r-2: 4px;
  --r-3: 6px;
  --r-4: 10px;
  --r-5: 14px;
  --r-6: 20px;
  --r-pill: 999px;

  /* ── Shadows — subtle, single light source, no colored tints ────────── */
  --shadow-1: 0 1px 0 rgba(20, 22, 26, 0.04);
  --shadow-2: 0 1px 2px rgba(20, 22, 26, 0.06), 0 1px 0 rgba(20, 22, 26, 0.03);
  --shadow-3: 0 4px 12px rgba(20, 22, 26, 0.08), 0 1px 2px rgba(20, 22, 26, 0.04);
  --shadow-4: 0 12px 32px rgba(20, 22, 26, 0.12), 0 2px 6px rgba(20, 22, 26, 0.06);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.6);

  /* ── Motion — quiet, considered ─────────────────────────────────────── */
  --ease-out:    cubic-bezier(0.2, 0.7, 0.3, 1);     /* default */
  --ease-in-out: cubic-bezier(0.5, 0, 0.3, 1);       /* state changes */
  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);     /* settles */
  --dur-fast:   120ms;
  --dur-base:   200ms;
  --dur-slow:   360ms;
  --dur-stately: 600ms;
}

/* ── Dark mode ────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --c-bg-canvas:    #16181C;
  --c-bg-surface:   #1D2025;
  --c-bg-sunken:    #111316;
  --c-bg-overlay:   rgba(0, 0, 0, 0.7);

  --c-fg-primary:   #E8EAEC;
  --c-fg-secondary: #B0B6BC;
  --c-fg-tertiary:  #878E96;
  --c-fg-muted:     #5E656D;
  --c-fg-on-accent: #FBFBFA;

  --c-line-strong:  #2F343A;
  --c-line:         #25282D;
  --c-line-soft:    #1F2226;

  --c-accent:       #7E97B6;
  --c-accent-hover: #A8BBD0;
  --c-accent-soft:  rgba(126, 151, 182, 0.10);

  --shadow-1: 0 1px 0 rgba(0, 0, 0, 0.3);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 0 rgba(0, 0, 0, 0.2);
  --shadow-3: 0 4px 12px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-4: 0 12px 32px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ── Semantic element styles ──────────────────────────────────────────── */
.t-display {
  font-family: var(--font-display);
  font-size: var(--t-64);
  font-weight: 400;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}
.t-h1 {
  font-family: var(--font-display);
  font-size: var(--t-48);
  font-weight: 400;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}
.t-h2 {
  font-family: var(--font-display);
  font-size: var(--t-38);
  font-weight: 400;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
}
.t-h3 {
  font-family: var(--font-sans);
  font-size: var(--t-24);
  font-weight: 500;
  line-height: var(--leading-snug);
  letter-spacing: -0.01em;
}
.t-h4 {
  font-family: var(--font-sans);
  font-size: var(--t-20);
  font-weight: 500;
  line-height: var(--leading-snug);
}
.t-lede {
  font-family: var(--font-display);
  font-size: var(--t-20);
  font-weight: 400;
  font-style: italic;
  line-height: var(--leading-body);
  color: var(--c-fg-secondary);
}
.t-body {
  font-family: var(--font-sans);
  font-size: var(--t-15);
  font-weight: 400;
  line-height: var(--leading-body);
  color: var(--c-fg-primary);
}
.t-small {
  font-family: var(--font-sans);
  font-size: var(--t-13);
  font-weight: 400;
  line-height: var(--leading-body);
  color: var(--c-fg-secondary);
}
.t-meta {
  font-family: var(--font-mono);
  font-size: var(--t-12);
  font-weight: 400;
  letter-spacing: var(--tracking-wide);
  color: var(--c-fg-tertiary);
}
.t-label {
  font-family: var(--font-sans);
  font-size: var(--t-12);
  font-weight: 500;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--c-fg-tertiary);
}
.t-mono {
  font-family: var(--font-mono);
  font-size: var(--t-13);
  font-feature-settings: "calt";
}

/* Site addition: follow the visitor's system appearance (same values as [data-theme="dark"] above). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-bg-canvas:    #16181C;
    --c-bg-surface:   #1D2025;
    --c-bg-sunken:    #111316;
    --c-bg-overlay:   rgba(0, 0, 0, 0.7);
  
    --c-fg-primary:   #E8EAEC;
    --c-fg-secondary: #B0B6BC;
    --c-fg-tertiary:  #878E96;
    --c-fg-muted:     #5E656D;
    --c-fg-on-accent: #FBFBFA;
  
    --c-line-strong:  #2F343A;
    --c-line:         #25282D;
    --c-line-soft:    #1F2226;
  
    --c-accent:       #7E97B6;
    --c-accent-hover: #A8BBD0;
    --c-accent-soft:  rgba(126, 151, 182, 0.10);
  
    --shadow-1: 0 1px 0 rgba(0, 0, 0, 0.3);
    --shadow-2: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 0 rgba(0, 0, 0, 0.2);
    --shadow-3: 0 4px 12px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-4: 0 12px 32px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.3);
    --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  }
}
