/* ─────────────────────────────────────────────────────────────────────────
   Site theme: fonts and colour tokens shared by every page.

   "Paper & ink", borrowed from the PiPilot app
   (research-assistant-codex-claude/DESIGN.md): warm cream paper in light,
   gentle low-glare slate in dark, teal identity. Pages link this file
   before their own stylesheet (index.html, post.css, papers/report.css,
   blog.html, papers/index.html); those keep layout only. Change a colour
   here, not in a page.

   Fonts are self-hosted (no CDN): Inter (variable, cv01–cv04) for words,
   Commit Mono for tags and code. Both SIL OFL 1.1; see fonts/FONTS-LICENSE.md.
   ───────────────────────────────────────────────────────────────────────── */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/Inter-Variable-Latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/Inter-Variable-LatinExt.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
@font-face {
  font-family: "Commit Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/CommitMono-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "Commit Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/CommitMono-Bold.woff2") format("woff2");
}

/* Light theme (default): cream paper */
:root,
[data-theme="light"] {
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  --font-mono: "Commit Mono", "SF Mono", Monaco, Menlo, "JetBrains Mono",
    Consolas, monospace;

  --sys-surface-canvas: #f6f1e7;
  /* Cards and panels are a lighter sheet laid on the cream (as in dark,
     where raised surfaces are lighter than the page). */
  --sys-surface-panel: #faf7f0;
  --sys-surface-raised: #ebe3d1;
  --sys-surface-popover: #fbf9f3;
  --sys-surface-hover: rgba(27, 23, 19, 0.045);
  --sys-surface-selected: rgba(27, 23, 19, 0.08);

  --sys-text-primary: #1b1713;
  --sys-text-secondary: #463e36;
  --sys-text-muted: #6b6256;
  --sys-text-inverse: #fbf8f1;
  --sys-text-on-accent: #fbf8f1;
  /* Emphasis ink (bold phrases in reports and posts): deep teal. */
  --sys-text-strong: #123f3a;

  --sys-border-default: #c8bca3;
  --sys-border-subtle: color-mix(in srgb, #c8bca3 70%, transparent);
  --sys-border-strong: #7f7767;

  --sys-accent-primary: #146a60;
  --sys-accent-primary-hover: #0e544c;
  --sys-accent-soft-bg: rgba(20, 106, 96, 0.07);
  --sys-accent-soft-border: rgba(20, 106, 96, 0.3);
  /* Highlighted rows (publications with a paper report): a lighter sheet
     lifted off the paper, with a hint of teal. */
  --sys-report-bg: color-mix(in srgb, #146a60 4%, #fbf9f3);

  --nav-bg: rgba(246, 241, 231, 0.86);
  /* Figures are drawn on white; give them a near-white sheet. */
  --fig-bg: #fffdf8;

  /* Warm, paper-tinted shadows rather than grey screen shadows. */
  --shadow-soft: 0 1px 2px rgba(60, 48, 30, 0.09), 0 1px 1px rgba(60, 48, 30, 0.07);
  --shadow-lift: 0 4px 14px -4px rgba(60, 48, 30, 0.18),
    0 2px 6px -3px rgba(60, 48, 30, 0.12);
  --shadow-lift-accent: 0 6px 18px -6px rgba(20, 106, 96, 0.28),
    0 2px 6px -3px rgba(60, 48, 30, 0.12);
  --shadow-pop: 0 18px 44px -14px rgba(60, 48, 30, 0.27),
    0 7px 16px -8px rgba(60, 48, 30, 0.16);

  color-scheme: light;
}

/* Dark theme: gentle low-glare slate */
[data-theme="dark"] {
  --sys-surface-canvas: #1a2027;
  --sys-surface-panel: #232b33;
  --sys-surface-raised: #2f3a44;
  --sys-surface-popover: #232b33;
  --sys-surface-hover: rgba(255, 255, 255, 0.05);
  --sys-surface-selected: rgba(255, 255, 255, 0.08);

  --sys-text-primary: #d5dde3;
  --sys-text-secondary: #b4bec5;
  --sys-text-muted: #98a4ad;
  --sys-text-inverse: #1a2027;
  /* White on the bright dark-theme teal fails contrast; dark ink reads at
     about 8.8:1. */
  --sys-text-on-accent: #0d1f1c;
  --sys-text-strong: #c9f0e9;

  --sys-border-default: #3d4955;
  --sys-border-subtle: color-mix(in srgb, #3d4955 75%, transparent);
  --sys-border-strong: #79838c;

  --sys-accent-primary: #34d0ba;
  --sys-accent-primary-hover: #5eead4;
  --sys-accent-soft-bg: rgba(52, 208, 186, 0.07);
  --sys-accent-soft-border: rgba(52, 208, 186, 0.28);
  --sys-report-bg: color-mix(in srgb, #34d0ba 5%, #232b33);

  --nav-bg: rgba(26, 32, 39, 0.86);
  /* White-background figures stay on a light sheet so they remain legible. */
  --fig-bg: #eef1f3;

  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.34);
  --shadow-lift: 0 5px 16px -4px rgba(0, 0, 0, 0.5),
    0 2px 6px -3px rgba(0, 0, 0, 0.4);
  --shadow-lift-accent: 0 6px 20px -6px rgba(52, 208, 186, 0.22),
    0 2px 6px -3px rgba(0, 0, 0, 0.4);
  --shadow-pop: 0 20px 48px -14px rgba(0, 0, 0, 0.62),
    0 8px 18px -8px rgba(0, 0, 0, 0.46);

  color-scheme: dark;
}

::selection {
  background: color-mix(in srgb, var(--sys-accent-primary) 28%, transparent);
}

body {
  font-family: var(--font-sans);
  font-feature-settings: "kern", "liga", "calt", "cv01", "cv02", "cv03", "cv04";
}

/* Light only: two faint radial washes give the paper some depth. The
   selector outranks a page's own `body { background: … }` shorthand. */
[data-theme="light"] body {
  background-image:
    radial-gradient(1200px 700px at 8% -10%, rgba(168, 70, 46, 0.035), transparent 60%),
    radial-gradient(1000px 600px at 95% 110%, rgba(107, 122, 90, 0.04), transparent 60%);
  background-attachment: fixed;
}
