/* hdpf-tokens.css — Refined Blueprint surfaces + Field Notes typography.
 *
 * Surfaces/accent: Blueprint paper + brand blue.
 * Type lock: Newsreader (display) + Public Sans (UI) + IBM Plex Mono.
 * ONLY file with :root and [data-theme="dark"].
 * Namespace: --hdpf-*
 */

:root,
[data-theme="light"] {
  /* Surfaces */
  --hdpf-page: #fbfbfa;
  --hdpf-page-soft: #f4f6f8;
  --hdpf-surface: #ffffff;
  --hdpf-surface-raised: #ffffff;
  --hdpf-surface-inset: #f4f6f8;
  --hdpf-surface-strong: #eef1f4;

  /* Ink */
  --hdpf-ink: #111418;
  --hdpf-ink-strong: #0a0c0e;
  --hdpf-ink-muted: #5b6169;
  --hdpf-ink-faint: #8b919a;
  --hdpf-ink-onAccent: #ffffff;
  --hdpf-ink-onLevel: #ffffff;

  /* Structure */
  --hdpf-border: #e6e4df;
  --hdpf-border-strong: #cfcbc3;
  --hdpf-divider: #eceae5;

  /* Charcoal — form section-header pill. Stays dark in BOTH themes so the pill
   * reads as a filled dark chip with light text (matches the sister-site look). */
  --hdpf-charcoal: #1e242c;
  --hdpf-charcoal-ink: #f5f6f7;

  /* Accent */
  --hdpf-accent: #1571b8;
  --hdpf-accent-hover: #0f5590;
  --hdpf-accent-press: #0d4a7a;
  --hdpf-accent-soft: #eef4fa;
  --hdpf-accent-strong: #0d4a7a;
  --hdpf-accent-ring: rgba(21, 113, 184, 0.35);

  /* Semantic — success */
  --hdpf-success: #1f7a4c;
  --hdpf-success-fg: #145c38;
  --hdpf-success-soft: #e8f5ee;

  /* Semantic — warning */
  --hdpf-warning: #b7791f;
  --hdpf-warning-fg: #8a5a12;
  --hdpf-warning-soft: #fbf3e3;

  /* Semantic — danger */
  --hdpf-danger: #c0392b;
  --hdpf-danger-fg: #9b2c20;
  --hdpf-danger-soft: #fbeceb;

  /* Semantic — info */
  --hdpf-info: #1571b8;
  --hdpf-info-fg: #0f5590;
  --hdpf-info-soft: #eef4fa;

  /* Semantic — neutral */
  --hdpf-neutral: #5b6169;
  --hdpf-neutral-fg: #3d4248;
  --hdpf-neutral-soft: #f0f1f3;

  /* Focus & selection */
  --hdpf-focus-ring: rgba(21, 113, 184, 0.45);
  --hdpf-focus-outline: #1571b8;
  --hdpf-selection-bg: rgba(21, 113, 184, 0.18);
  --hdpf-selection-fg: #0a0c0e;

  /* Theme meta */
  --hdpf-theme-meta: #fbfbfa;

  /* Scrollbar */
  --hdpf-scrollbar-track: #f4f6f8;
  --hdpf-scrollbar-thumb: #cfcbc3;
  --hdpf-scrollbar-thumb-hover: #a8a49c;

  /* Type — families */
  --hdpf-font-display: "Fraunces", "Newsreader", Georgia, "Times New Roman", serif;
  --hdpf-font-ui: "Public Sans", "Segoe UI", sans-serif;
  --hdpf-font-mono: "IBM Plex Mono", ui-monospace, monospace;

  /* Type — size scale */
  --hdpf-fs-display-1: 2.75rem;
  --hdpf-fs-display-2: 2.25rem;
  --hdpf-fs-display-3: 1.75rem;
  --hdpf-fs-headline: 1.375rem;
  --hdpf-fs-title: 1.125rem;
  --hdpf-fs-body: 1rem;
  --hdpf-fs-caption: 0.875rem;
  --hdpf-fs-micro: 0.75rem;

  /* Type — line-height (unitless) */
  --hdpf-lh-tight: 1.15;
  --hdpf-lh-snug: 1.3;
  --hdpf-lh-normal: 1.5;
  --hdpf-lh-relaxed: 1.65;

  /* Type — weight (Newsreader tops out at 800 — Field Notes lock) */
  --hdpf-fw-regular: 400;
  --hdpf-fw-medium: 500;
  --hdpf-fw-semibold: 600;
  --hdpf-fw-bold: 700;
  --hdpf-fw-extrabold: 700;
  --hdpf-fw-black: 800;

  /* Type — tracking */
  --hdpf-tracking-tight: -0.02em;
  --hdpf-tracking-normal: 0;
  --hdpf-tracking-wide: 0.04em;
  --hdpf-tracking-wider: 0.08em;

  /* Spacing — 4px base */
  --hdpf-space-0: 0;
  --hdpf-space-1: 0.25rem;
  --hdpf-space-2: 0.5rem;
  --hdpf-space-3: 0.75rem;
  --hdpf-space-4: 1rem;
  --hdpf-space-5: 1.25rem;
  --hdpf-space-6: 1.5rem;
  --hdpf-space-7: 2rem;
  --hdpf-space-8: 2.5rem;
  --hdpf-space-9: 3rem;
  --hdpf-space-10: 4rem;
  --hdpf-space-11: 5rem;

  /* Radii */
  --hdpf-radius-xs: 0.125rem;
  --hdpf-radius-sm: 0.25rem;
  --hdpf-radius-md: 0.375rem;
  --hdpf-radius-lg: 0.5rem;
  --hdpf-radius-xl: 0.75rem;
  --hdpf-radius-2xl: 1rem;
  --hdpf-radius-pill: 999px;

  /* Shadows (px — do not scale) */
  --hdpf-shadow-xs: 0 1px 2px rgba(17, 20, 24, 0.06);
  --hdpf-shadow-sm: 0 1px 3px rgba(17, 20, 24, 0.08), 0 1px 2px rgba(17, 20, 24, 0.04);
  --hdpf-shadow-md: 0 4px 12px rgba(17, 20, 24, 0.1), 0 2px 4px rgba(17, 20, 24, 0.04);
  --hdpf-shadow-lg: 0 12px 28px rgba(17, 20, 24, 0.12), 0 4px 8px rgba(17, 20, 24, 0.05);
  --hdpf-shadow-modal: 0 24px 48px rgba(17, 20, 24, 0.18);
  --hdpf-shadow-inset: inset 0 1px 2px rgba(17, 20, 24, 0.06);
  --hdpf-shadow-ring-accent: 0 0 0 3px var(--hdpf-accent-ring);

  /* Motion */
  --hdpf-ease-standard: cubic-bezier(0.2, 0.8, 0.2, 1);
  --hdpf-ease-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --hdpf-ease-exit: cubic-bezier(0.4, 0, 1, 1);
  --hdpf-duration-instant: 0ms;
  --hdpf-duration-fast: 120ms;
  --hdpf-duration-normal: 200ms;
  --hdpf-duration-slow: 320ms;

  /* Z-index */
  --hdpf-z-base: 0;
  --hdpf-z-sticky: 10;
  --hdpf-z-sidebar: 20;
  --hdpf-z-topbar: 30;
  --hdpf-z-popover: 40;
  --hdpf-z-overlay: 50;
  --hdpf-z-modal: 60;
  --hdpf-z-toast: 70;
  --hdpf-z-max: 999;

  /* Layout primitives */
  --hdpf-topbar-h: 3.5rem;
  --hdpf-sidebar-w: 16.5rem;
  --hdpf-content-max: 80rem;
  --hdpf-touch-target: 2.75rem;
  --hdpf-drawer-w: 22.5rem;

  /* Overlay scrim */
  --hdpf-scrim: rgba(17, 20, 24, 0.45);
  --hdpf-scrim-strong: rgba(17, 20, 24, 0.4);

  /* Hero photo overlay — always dark (text is light on top of the photo),
   * so these stay fixed across light/dark themes. */
  --hdpf-hero-bg: #0b0e14;
  --hdpf-hero-shade: rgba(10, 14, 20, 0.86);
  --hdpf-hero-shade-mid: rgba(10, 14, 20, 0.52);
  --hdpf-hero-ink: #f7f9fb;
  --hdpf-hero-ink-muted: rgba(247, 249, 251, 0.82);
}

[data-theme="dark"] {
  --hdpf-page: #0d0f12;
  --hdpf-page-soft: #12161c;
  --hdpf-surface: #181d24;
  --hdpf-surface-raised: #1e242c;
  --hdpf-surface-inset: #12161c;
  --hdpf-surface-strong: #232a33;

  --hdpf-ink: #e8eaed;
  --hdpf-ink-strong: #f5f6f7;
  --hdpf-ink-muted: #9aa0a8;
  --hdpf-ink-faint: #6b7280;
  /* Deep navy, not white: the dark accent below is light enough that white
   * text on an accent surface only reaches 3.5:1. See the accent note. */
  --hdpf-ink-onAccent: #06121e;
  --hdpf-ink-onLevel: #ffffff;

  --hdpf-border: #23272e;
  --hdpf-border-strong: #343a44;
  --hdpf-divider: #1f242b;

  /* Charcoal pill — lifted above --hdpf-surface (#181d24) so the chip still
   * separates from the form surface in dark mode; text stays light. */
  --hdpf-charcoal: #2a323c;
  --hdpf-charcoal-ink: #f5f6f7;

  /* Dark-mode accent ramp.
   *
   * The light-mode blue (#1571b8) cannot carry both accent roles on a dark
   * page: as text it needs luminance >= 0.196 to clear 4.5:1 on #0d0f12, but
   * as a background under white text it needs <= 0.183. Those windows do not
   * overlap, so one value cannot satisfy both — #1571b8 measured 3.7:1 as text
   * (eyebrows, links, pills, step labels all failed AA in dark mode).
   *
   * Resolved by lightening the accent for dark mode and flipping
   * --hdpf-ink-onAccent to deep navy, so accent surfaces carry dark text.
   * Light mode is untouched: #1571b8 on paper is 4.96:1 and white on it 5.14:1.
   *
   * Measured (dark): accent text on page 5.5:1 · on surface 4.85:1 ·
   * onAccent on accent 5.41:1 · on hover 7.06:1 · on press 4.82:1 ·
   * accent-strong on page 9.37:1.
   *
   * Hover brightens rather than darkens here — on a dark page that is the
   * direction that reads as "more prominent".
   *
   * One caveat when using these: --hdpf-accent as *text on an accent-soft
   * panel* only reaches 3.9:1 (the tint lifts the background toward the text).
   * Use --hdpf-accent-strong there, as .hdpf-pill--accent and .hdpf-note__label
   * already do. Accent on the plain page or a surface is fine.
   */
  --hdpf-accent: #3a8fd0;
  --hdpf-accent-hover: #5aa5dd;
  --hdpf-accent-press: #3286c6;
  --hdpf-accent-soft: rgba(58, 143, 208, 0.16);
  --hdpf-accent-strong: #7cbceb;
  --hdpf-accent-ring: rgba(58, 143, 208, 0.5);

  --hdpf-success: #3ecf8e;
  --hdpf-success-fg: #6edba8;
  --hdpf-success-soft: rgba(62, 207, 142, 0.14);

  --hdpf-warning: #e0a84a;
  --hdpf-warning-fg: #f0c878;
  --hdpf-warning-soft: rgba(224, 168, 74, 0.14);

  --hdpf-danger: #e5736a;
  --hdpf-danger-fg: #f0a09a;
  --hdpf-danger-soft: rgba(229, 115, 106, 0.14);

  --hdpf-info: #4a9fd8;
  --hdpf-info-fg: #7ab8e4;
  --hdpf-info-soft: rgba(21, 113, 184, 0.18);

  --hdpf-neutral: #9aa0a8;
  --hdpf-neutral-fg: #c4c8ce;
  --hdpf-neutral-soft: rgba(154, 160, 168, 0.14);

  --hdpf-focus-ring: rgba(74, 159, 216, 0.5);
  --hdpf-focus-outline: #4a9fd8;
  --hdpf-selection-bg: rgba(21, 113, 184, 0.35);
  --hdpf-selection-fg: #f5f6f7;

  --hdpf-theme-meta: #0d0f12;

  --hdpf-scrollbar-track: #12161c;
  --hdpf-scrollbar-thumb: #343a44;
  --hdpf-scrollbar-thumb-hover: #4a5160;

  --hdpf-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --hdpf-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.25);
  --hdpf-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45), 0 2px 4px rgba(0, 0, 0, 0.3);
  --hdpf-shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.5), 0 4px 8px rgba(0, 0, 0, 0.35);
  --hdpf-shadow-modal: 0 24px 48px rgba(0, 0, 0, 0.6);
  --hdpf-shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.4);

  --hdpf-scrim: rgba(0, 0, 0, 0.6);
  --hdpf-scrim-strong: rgba(0, 0, 0, 0.55);
}

@media (prefers-reduced-motion: reduce) {
  :root,
  [data-theme="light"],
  [data-theme="dark"] {
    --hdpf-duration-instant: 0ms;
    --hdpf-duration-fast: 0ms;
    --hdpf-duration-normal: 0ms;
    --hdpf-duration-slow: 0ms;
  }
}
