// ============================================================
// Theme tokens — light (default) and dark
//
// Palette colours are aliases of theme.json's presets, not copies
// (toolkit: starter/scss/base/_root.scss). Dark mode changes the preset
// variables themselves, so the .has-ink-color etc. an author picks in the
// editor follow dark mode too.
//
// Two colour roles (toolkit core-css-traps: "one accent cannot do chrome
// and links at once"):
//   --accent       chrome — borders, markers, a focused field's border
//   --accent-deep  interactive text — links, hover colour, focus ring
// ============================================================

:root {
  color-scheme: light;

  // ---- Palette (theme.json) ----
  --bg: var(--wp--preset--color--base);
  --card-solid: var(--wp--preset--color--surface);
  --ink: var(--wp--preset--color--ink);
  --prose: var(--wp--preset--color--prose);
  --ink-soft: var(--wp--preset--color--ink-soft);
  --ink-faint: var(--wp--preset--color--ink-faint);
  --accent: var(--wp--preset--color--accent);
  --accent-deep: var(--wp--preset--color--accent-deep);

  // ---- Fonts (theme.json) ----
  --font-sans: var(--wp--preset--font-family--sans);
  --font-serif: var(--wp--preset--font-family--serif);

  // ---- Tokens outside the palette ----
  --card: rgba(255, 255, 255, 0.72);
  --glass: rgba(255, 255, 255, 0.6);
  --glass-strong: rgba(255, 255, 255, 0.75);
  --hairline: rgba(255, 255, 255, 0.7);
  --ring: #FBFDFE;
  --on-accent: #F7FAFC;
  --blob-1: #C9DAEB;
  --blob-2: #DCD6EC;
  --blob-3: #CFE4DD;
  --blob-opacity: 0.55;
  --blob-blur: 90px;
  --btn-grad: linear-gradient(140deg, #8AA3BD, #6E88A4);
  --ring-grad: linear-gradient(140deg, #C9DAEB, #DCD6EC 55%, #CFE4DD);
  --thumb-bg: #D5E2EF;
  --img-filter: saturate(0.78) brightness(1.04);
  --fallback-grad: linear-gradient(150deg, #D5E2EF, #C2D2E2);
  --fallback-sheen: rgba(255, 255, 255, 0.55);
  --fallback-letter: rgba(86, 112, 140, 0.32);
  --rule: rgba(117, 144, 172, 0.18);
  --rule-strong: rgba(117, 144, 172, 0.4);
  --code-bg: #2B3743;
  --code-ink: #E3E9F0;
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 10px;
  --shadow-soft: 0 18px 45px -18px rgba(86, 112, 140, 0.22);
  --shadow-hover: 0 24px 55px -18px rgba(86, 112, 140, 0.30);
  --shadow-avatar: 0 8px 20px -10px rgba(86, 112, 140, 0.4);
  --shadow-btn: 0 12px 28px -12px rgba(86, 112, 140, 0.5);
}

// ---- Dark mode ----
// :root[...] (0,2,0) must beat the presets on WordPress's global-styles
// :root (0,1,0) whatever the load order
:root[data-theme="dark"] {
  color-scheme: dark;

  // Change the presets themselves: the tokens and .has-*-color follow
  --wp--preset--color--base: #171E26;
  --wp--preset--color--surface: #1E2731;
  --wp--preset--color--ink: #E3E9F0;
  --wp--preset--color--prose: #C3CDD8;
  --wp--preset--color--ink-soft: #A3B1C0;
  --wp--preset--color--ink-faint: #87949F; // 4.7:1 on the lightest card (D19)
  --wp--preset--color--accent: #8FA9C4;
  --wp--preset--color--accent-deep: #A9C0D8;

  --card: rgba(255, 255, 255, 0.045);
  --glass: rgba(255, 255, 255, 0.05);
  --glass-strong: rgba(255, 255, 255, 0.06);
  --hairline: rgba(255, 255, 255, 0.07);
  --ring: #1E2731;
  --on-accent: #E8EFF6;
  --blob-1: #2E4763;
  --blob-2: #3A3454;
  --blob-3: #26483F;
  --blob-opacity: 0.42;
  --blob-blur: 100px;
  --btn-grad: linear-gradient(140deg, #3E5A78, #2F4A66);
  --ring-grad: linear-gradient(140deg, #3D5876, #4A4368 55%, #2F5A4E);
  --thumb-bg: #223040;
  --img-filter: saturate(0.72) brightness(0.82);
  --fallback-grad: linear-gradient(150deg, #26323F, #1D2833);
  --fallback-sheen: rgba(143, 169, 196, 0.16);
  --fallback-letter: rgba(163, 177, 192, 0.24);
  --rule: rgba(255, 255, 255, 0.07);
  --rule-strong: rgba(143, 169, 196, 0.32);
  --code-bg: #121820;
  --code-ink: #C3CDD8;
  --shadow-soft: 0 20px 48px -20px rgba(0, 0, 0, 0.55);
  --shadow-hover: 0 28px 60px -20px rgba(0, 0, 0, 0.65);
  --shadow-avatar: 0 8px 20px -10px rgba(0, 0, 0, 0.6);
  --shadow-btn: 0 12px 28px -12px rgba(0, 0, 0, 0.6);
}
