/* ─── TOKENS · B8LAB v2 ─────────────────────────────────────────────────────
   Source of truth: plan/01-DESIGN-FRAMEWORK.md §2. Hex on purpose (theme.json and
   emails copy these verbatim). Themes: semantic tokens bind per html[data-theme="dark"|"light"]
   (dark is the default); raw ramps and bench plates are theme-independent (01 §2.14).
   ───────────────────────────────────────────────────────────────────────── */

/* ─── FONT · Saira variable (wdth 50–125 × wght 100–900), latin subset ─── */
@font-face {
  font-family: "Saira";
  src: url("../assets/fonts/saira/Saira%5Bwdth,wght%5D.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 50% 125%;
  font-style: normal;
  font-display: swap;
}
/* Metric override on Arial so the swap barely shifts (01 §8, V2 T20) */
@font-face {
  font-family: "Saira Fallback";
  src: local("Arial"), local("ArialMT"), local("Liberation Sans"), local("Arimo");
  size-adjust: 107.5%;
  ascent-override: 105.6%;
  descent-override: 40.8%;
  line-gap-override: 0%;
}

/* Registered plate stops so a tone change transitions a gradient (01 §5.6, V2 T23) */
@property --_p0 { syntax: "<color>"; inherits: false; initial-value: #F3F6F8; }
@property --_p1 { syntax: "<color>"; inherits: false; initial-value: #E9EEF2; }
@property --_p2 { syntax: "<color>"; inherits: false; initial-value: #DCE3E8; }

:root {
  /* ─── 2.1 brand blue ─── */
  --b8-blue-50: #E9F5FC;
  --b8-blue-100: #CFE9F8;
  --b8-blue-200: #A3D5F1;
  --b8-blue-300: #72BFE8;
  --b8-blue-400: #45ACDF;
  --b8-blue-500: #239AD7;
  --b8-blue-600: #1B7FB4;
  --b8-blue-700: #176A96;
  --b8-blue-800: #145472;
  --b8-blue-900: #0F3D53;
  --b8-blue-950: #0A2837;

  /* ─── 2.2 ink (hue ≈ 207) ─── */
  --b8-ink-50: #F3F6F8;
  --b8-ink-100: #E6EBEF;
  --b8-ink-200: #CBD4DB;
  --b8-ink-300: #A9B6BF;
  --b8-ink-400: #7F8D97;
  --b8-ink-500: #5F6E78;
  --b8-ink-600: #46545E;
  --b8-ink-700: #303C46;
  --b8-ink-800: #1F2A33;
  --b8-ink-900: #131C24;
  --b8-ink-950: #0B1219;

  /* ─── 2.3 CI steel and grey ─── */
  --b8-ci-teal: #3887A5;
  --b8-ci-slate: #5F7D84;
  --b8-ci-grey: #8B8D8E;

  /* ─── 2.4 sale red ───
     Orange removed from the framework (client review 2026-09-25, plan 10 §1.1): blue is the only
     UI accent. Sale is the one non-blue marker. 300 = sale text on ink (7.2:1), 500 = badge fill with
     white text (4.63:1), 700 = sale text on paper (5.57:1). */
  --b8-sale-300: #FF7479;
  --b8-sale-500: #D63A40;
  --b8-sale-700: #C62A2F;

  /* ─── 2.5 semantic states ─── */
  --b8-success: #3FBF7F;
  --b8-error: #E5544B;
  --b8-warning: #E9A23B;
  --b8-info: #45ACDF;
  --b8-success-fill: #3FBF7F; /* "Added" button fill; carries ink text in both themes */

  /* ─── 2.6a bench plate · follows the color (plate_tone), never the page theme ─── */
  --b8-plate-0: #F3F6F8;
  --b8-plate-1: #E9EEF2;
  --b8-plate-2: #DCE3E8;
  --b8-plate-dark-0: #17303F;
  --b8-plate-dark-1: #10222E;
  --b8-plate-dark-2: #0B1820;
  --b8-plate: radial-gradient(120% 100% at 50% 40%, var(--b8-plate-0) 0%, var(--b8-plate-1) 55%, var(--b8-plate-2) 100%);
  --b8-plate-flat: #EDF1F4;
  --b8-plate-dark: radial-gradient(120% 100% at 50% 40%, var(--b8-plate-dark-0) 0%, var(--b8-plate-dark-1) 55%, var(--b8-plate-dark-2) 100%);
  --b8-plate-flat-dark: #10222E;
  --b8-swatch-frame-light: inset 0 0 0 1px rgba(11, 18, 25, .12);
  --b8-swatch-frame-dark: inset 0 0 0 1px rgba(255, 255, 255, .14);
  --b8-google-fill: #FFFFFF;
  --b8-google-text: #1F1F1F;
  --b8-google-border: #DADCE0;
  /* light theme values (raw; bound to semantic tokens under [data-theme="light"]) */
  --b8-paper-0: #F4F7F9;
  --b8-paper-1: #E9EEF2;
  --b8-paper-2: #FFFFFF;
  --b8-paper-4: #E3E9EE;
  --b8-light-success-bg: #E3F4EB;
  --b8-light-success-fg: #13603B;
  --b8-light-error-bg: #FBE8E6;
  --b8-light-error-fg: #9C2A21;
  --b8-light-warning-bg: #FBEFD9;
  --b8-light-warning-fg: #6E4608;
  --b8-light-info-bg: #E2F1FA;
  --b8-light-info-fg: #145472;
  /* ─── 2.7 typography ─── */
  --b8-font-sans: "Saira", "Saira Fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --b8-font-display: var(--b8-font-sans);
  --b8-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --b8-wdth-display: 80%;
  --b8-wdth-heading: 90%;
  --b8-wdth-body: 100%;
  --b8-weight-regular: 400;
  --b8-weight-medium: 500;
  --b8-weight-semibold: 600;
  --b8-weight-bold: 700;
  --b8-weight-display: 800;

  --b8-text-2xs: .6875rem;
  --b8-text-xs: .75rem;
  --b8-text-sm: .8125rem;
  --b8-text-base: .9375rem;
  --b8-text-md: 1rem;
  --b8-text-lg: 1.125rem;
  --b8-text-xl: clamp(1.25rem, 1.05rem + .6vw, 1.5rem);
  --b8-text-2xl: clamp(1.5rem, 1.2rem + 1vw, 1.875rem);
  --b8-text-3xl: clamp(1.875rem, 1.35rem + 1.6vw, 2.5rem);
  --b8-text-4xl: clamp(2.25rem, 1.5rem + 2.4vw, 3.25rem);
  --b8-text-5xl: clamp(2.75rem, 1.6rem + 3.6vw, 4.5rem);
  --b8-text-6xl: clamp(3.25rem, 1.8rem + 5.2vw, 6rem);

  --b8-leading-none: 1;
  --b8-leading-tight: 1.08;
  --b8-leading-snug: 1.25;
  --b8-leading-normal: 1.55;
  --b8-leading-relaxed: 1.7;

  --b8-tracking-display: -.025em;
  --b8-tracking-tight: -.01em;
  --b8-tracking-normal: 0;
  --b8-tracking-wide: .03em;
  --b8-tracking-caps: .08em;

  --b8-nums: tabular-nums lining-nums;

  /* ─── 2.8 spacing (4px grid) ─── */
  --b8-space-0: 0;
  --b8-space-px: 1px;
  --b8-space-0_5: .125rem;
  --b8-space-1: .25rem;
  --b8-space-1_5: .375rem;
  --b8-space-2: .5rem;
  --b8-space-3: .75rem;
  --b8-space-4: 1rem;
  --b8-space-5: 1.25rem;
  --b8-space-6: 1.5rem;
  --b8-space-7: 1.75rem;
  --b8-space-8: 2rem;
  --b8-space-10: 2.5rem;
  --b8-space-12: 3rem;
  --b8-space-14: 3.5rem;
  --b8-space-16: 4rem;
  --b8-space-20: 5rem;
  --b8-space-24: 6rem;
  --b8-space-28: 7rem;
  --b8-space-32: 8rem;
  /* (plan 13 G2, Sean 2026-10-03: 80–100 px between sections on desktop) max 96 / 56 px (was 112 / 64) */
  --b8-section-py: clamp(3rem, 3.5vw + 2.25rem, 6rem);   /* 1280: 81 px · 1440: 86 px · 390: 50 px */
  --b8-section-py-tight: clamp(2rem, 2vw + 1rem, 3.5rem);
  --b8-gutter: clamp(1rem, 1.5vw + .5rem, 2rem);
  --b8-card-pad: clamp(.875rem, 1vw + .5rem, 1.25rem);

  /* ─── 2.9 radius ─── */
  --b8-radius-xs: 2px;
  --b8-radius-sm: 4px;
  --b8-radius-md: 6px;
  --b8-radius-lg: 8px;
  --b8-radius-xl: 12px;
  --b8-radius-pill: 9999px;

  /* ─── 2.11 z-index ─── */
  --b8-z-base: 0;
  --b8-z-raised: 10;
  --b8-z-dropdown: 100;
  --b8-z-sticky-sub: 190;
  --b8-z-sticky: 200;
  --b8-z-mega: 250;
  --b8-z-overlay: 400;
  --b8-z-modal: 500;
  --b8-z-consent: 650;
  --b8-z-toast: 700;
  --b8-z-tooltip: 800;
  --b8-z-max: 9999;

  /* ─── 2.12 motion ─── */
  --b8-ease-out: cubic-bezier(.16, 1, .3, 1);
  --b8-ease-in: cubic-bezier(.7, 0, .84, 0);
  --b8-ease-in-out: cubic-bezier(.83, 0, .17, 1);
  --b8-ease-snap: cubic-bezier(.2, .9, .3, 1.1);
  --b8-dur-fast: 120ms;
  --b8-dur-base: 200ms;
  --b8-dur-slow: 320ms;
  --b8-dur-bench: 900ms;

  /* ─── 2.13 breakpoints (reference only; media queries use the literal px), containers, chrome ─── */
  --b8-bp-sm: 480px;
  --b8-bp-md: 720px;
  --b8-bp-lg: 1024px;
  --b8-bp-xl: 1280px;
  --b8-bp-2xl: 1536px;
  --b8-container: 1320px; /* (plan 13 G1, Sean 2026-10-03: boxed content 1200–1400 px; was 1440) */
  --b8-container-wide: 1680px;
  --b8-container-narrow: 1120px;
  --b8-container-prose: 68ch;
  --b8-container-px: clamp(1rem, 2vw + .5rem, 2.5rem);
  --b8-topbar-h: 52px; /* (plan 13) now the trust strip under the nav (.b8-trustbar); the old topbar is gone */
  /* (BUILD 2026-09-18, user) main row 72 -> 94 and nav row 52 -> 58 so the nav reads as its own bar;
     the in-flow header box is 152px at >= 1024 (was 124) and still constant while it condenses. */
  --b8-header-h: 94px;
  --b8-nav-h: 58px;
  --b8-header-h-compact: 64px;
  --b8-header-h-mobile: 60px;
  --b8-sticky-bar-h: 64px;
  --b8-sticky-offset: 60px;
}

/* ─── 2.6b SEMANTIC TOKENS · theme-bound (01 §2.14). Components use only these, never raw ramps,
   except inside bench plates and on brand fills (which don't follow the page theme). ─── */
:root, [data-theme="dark"] {
  color-scheme: dark;
  --b8-surface-0: var(--b8-ink-950);
  --b8-surface-1: #101923;
  --b8-surface-2: var(--b8-ink-900);
  --b8-surface-3: var(--b8-ink-800);
  --b8-surface-4: #26343F;
  --b8-field-bg: var(--b8-ink-900);
  --b8-fill-muted: var(--b8-ink-800);
  --b8-autofill-bg: var(--b8-blue-950);

  --b8-text: var(--b8-ink-100);
  --b8-text-strong: var(--b8-ink-50);
  --b8-text-soft: var(--b8-ink-200);
  --b8-text-muted: var(--b8-ink-300);
  --b8-text-subtle: var(--b8-ink-400);
  --b8-text-disabled: var(--b8-ink-500);
  --b8-text-heading: #F7F9FB;
  --b8-text-on-plate: var(--b8-ink-900);
  --b8-text-on-brand: var(--b8-ink-950);
  /* Primary + purchase buttons: brand blue with WHITE text, like b8lab.com (user, 2026-09-18).
     #1A7AAE is the brand blue darkened just enough for white text to clear 4.5:1 (4.73), while the
     button itself still clears 3:1 against both page surfaces (3.98 ink / 4.40 paper).
     Reverses the "orange = purchase" rule in 01 §1. Orange is gone entirely since 2026-09-25 (plan 10). */
  --b8-btn-brand: #1A7AAE;
  --b8-btn-brand-hover: #176A96;
  --b8-btn-brand-active: #145472;
  --b8-text-on-btn: #FFFFFF;
  --b8-link: var(--b8-blue-400);
  --b8-link-hover: var(--b8-blue-300);
  --b8-focus: var(--b8-blue-400);
  --b8-sale-text: var(--b8-sale-300);
  --b8-accent-soft-bg: var(--b8-blue-900);
  --b8-accent-soft-fg: var(--b8-blue-100);
  --b8-inverse-bg: var(--b8-ink-50);
  --b8-inverse-fg: var(--b8-ink-950);
  --b8-legal-text: var(--b8-ci-grey);

  --b8-success-bg: #0F2A1E; --b8-success-fg: #9FE3C0;
  --b8-error-bg: #331414; --b8-error-fg: #FFB4AE;
  --b8-warning-bg: #33240C; --b8-warning-fg: #FFD79A;
  --b8-info-bg: #0F2A3A; --b8-info-fg: #A3D5F1;

  --b8-border: var(--b8-ink-700);
  --b8-border-strong: var(--b8-ink-600);
  --b8-border-control: var(--b8-ink-500);
  --b8-border-hover: var(--b8-ink-400);
  --b8-border-faint: rgba(255, 255, 255, .06);
  --b8-hover-veil: rgba(255, 255, 255, .05);
  --b8-skeleton-0: var(--b8-ink-800);
  --b8-skeleton-1: var(--b8-ink-700);
  --b8-hairline: linear-gradient(90deg, transparent, var(--b8-ci-slate) 30%, var(--b8-ci-teal) 50%, var(--b8-ci-slate) 70%, transparent);
  --b8-highlight: inset 0 1px 0 rgba(255, 255, 255, .05);
  --b8-overlay: rgba(11, 18, 25, .72);
  --b8-overlay-soft: rgba(11, 18, 25, .4);
  --b8-focus-ring: 0 0 0 2px var(--b8-ink-950), 0 0 0 4px var(--b8-blue-400);
  --b8-swatch-frame: var(--b8-swatch-frame-dark);

  /* plate edge per page theme (the plate's own tone decides light/dark edge; the theme adds ambient depth) */
  --b8-plate-edge: inset 0 0 0 1px rgba(11, 18, 25, .08);
  /* (BUILD) dark-plate edge .14, not .08: .08 measures 1.18:1 against a surface-2 card, 01 §2.6 */
  --b8-plate-edge-dark: inset 0 0 0 1px rgba(255, 255, 255, .14);
  --b8-plate-ambient: 0 0 0 0 transparent;

  --b8-shadow-1: var(--b8-highlight), 0 1px 2px rgba(0, 0, 0, .4);
  --b8-shadow-2: var(--b8-highlight), 0 8px 24px -8px rgba(0, 0, 0, .55);
  --b8-shadow-3: var(--b8-highlight), 0 24px 64px -16px rgba(0, 0, 0, .7);
  --b8-shadow-plate: var(--b8-plate-edge), 0 12px 32px -12px rgba(0, 0, 0, .6);
  --b8-shadow-strike: 0 0 0 1px var(--b8-btn-brand-active), 0 6px 20px -6px rgba(26, 122, 174, .45);   /* purchase is brand blue now (see --b8-btn-brand) */
}

/* ─── LIGHT THEME · "lit lab": cool daylight paper, white cards, ink text, same accent rule ─── */
[data-theme="light"] {
  color-scheme: light;
  --b8-surface-0: var(--b8-paper-0);
  --b8-surface-1: var(--b8-paper-1);
  --b8-surface-2: var(--b8-paper-2);
  --b8-surface-3: var(--b8-paper-2);
  --b8-surface-4: var(--b8-paper-4);
  --b8-field-bg: var(--b8-paper-2);
  --b8-fill-muted: var(--b8-ink-100);
  --b8-autofill-bg: var(--b8-blue-50);

  --b8-text: var(--b8-ink-900);
  --b8-text-strong: var(--b8-ink-950);
  --b8-text-soft: var(--b8-ink-800);
  --b8-text-muted: var(--b8-ink-600);
  --b8-text-subtle: var(--b8-ink-500);
  --b8-text-disabled: var(--b8-ink-400);
  --b8-text-heading: var(--b8-ink-950);
  --b8-link: var(--b8-blue-700);
  --b8-link-hover: var(--b8-blue-800);
  --b8-focus: var(--b8-blue-700);
  --b8-sale-text: var(--b8-sale-700);
  --b8-accent-soft-bg: var(--b8-blue-100);
  --b8-accent-soft-fg: var(--b8-blue-800);
  --b8-inverse-bg: var(--b8-ink-950);
  --b8-inverse-fg: var(--b8-ink-50);
  --b8-legal-text: var(--b8-ink-500);
  /* status bases darkened for icons, dots and borders on paper (≥ 3:1) */
  --b8-success: #1F8A55; --b8-error: #CC3A30; --b8-warning: #A86F0E; --b8-info: #1B7FB4;

  --b8-success-bg: var(--b8-light-success-bg); --b8-success-fg: var(--b8-light-success-fg);
  --b8-error-bg: var(--b8-light-error-bg); --b8-error-fg: var(--b8-light-error-fg);
  --b8-warning-bg: var(--b8-light-warning-bg); --b8-warning-fg: var(--b8-light-warning-fg);
  --b8-info-bg: var(--b8-light-info-bg); --b8-info-fg: var(--b8-light-info-fg);

  --b8-border: var(--b8-ink-200);
  --b8-border-strong: var(--b8-ink-300);
  --b8-border-control: var(--b8-ink-500);
  --b8-border-hover: var(--b8-ink-600);
  --b8-border-faint: rgba(11, 18, 25, .08);
  --b8-hover-veil: rgba(11, 18, 25, .04);
  --b8-skeleton-0: var(--b8-paper-4);
  --b8-skeleton-1: var(--b8-ink-100);
  --b8-highlight: inset 0 1px 0 rgba(255, 255, 255, .9);
  --b8-overlay: rgba(11, 18, 25, .45);
  --b8-overlay-soft: rgba(11, 18, 25, .18);
  --b8-focus-ring: 0 0 0 2px var(--b8-paper-2), 0 0 0 4px var(--b8-blue-700);
  --b8-swatch-frame: var(--b8-swatch-frame-light);

  /* (BUILD) light page: plate gets a stronger inset hairline plus ambient shadow so it reads as an object */
  --b8-plate-edge: inset 0 0 0 1px rgba(11, 18, 25, .12);
  --b8-plate-edge-dark: inset 0 0 0 1px rgba(255, 255, 255, .10);
  --b8-plate-ambient: 0 1px 2px rgba(11, 18, 25, .06), 0 10px 24px -14px rgba(11, 18, 25, .28);

  --b8-shadow-1: 0 1px 2px rgba(11, 18, 25, .06), 0 0 0 1px rgba(11, 18, 25, .04);
  --b8-shadow-2: 0 10px 28px -10px rgba(11, 18, 25, .22), 0 0 0 1px rgba(11, 18, 25, .05);
  --b8-shadow-3: 0 28px 64px -18px rgba(11, 18, 25, .32), 0 0 0 1px rgba(11, 18, 25, .05);
  --b8-shadow-plate: var(--b8-plate-edge), 0 12px 32px -12px rgba(11, 18, 25, .3);
}

@media (min-width: 1024px) { :root { --b8-sticky-offset: 152px; } }   /* 94 + 58 (BUILD 2026-09-18) */
@media (max-width: 719.98px) { :root { --b8-sticky-bar-h: 56px; } }

/* ─── COLOR REGISTRY · fallback for slugs without term meta (01 §5.6) ───
   --_base / --_flake / --_base2 / --_pour / --_glow / --_ring feed .b8-swatch;
   the tone list below feeds .b8-plate and .b8-media. */
[data-color="junebug"] { --_base: #2E1238; --_flake: #5AD37A; }
[data-color="green-pumpkin"] { --_base: #5B5A21; --_flake: #0B1219; }
[data-color="black-blue-flake"] { --_base: #101418; --_flake: #45ACDF; }
[data-color="black-red-flake"] { --_base: #101418; --_flake: #E5544B; }
[data-color="iced-out-silver-flake"] { --_base: #E9EDF0; --_flake: #8B8D8E; --_ring: rgba(255, 255, 255, .2); }
[data-color="evil-kraw"] { --_base: #161214; --_flake: #F15A24; }
[data-color="pumpkin-green-fluo"] {
  --_base: #B4531F; --_base2: #C6F53A; --_flake: #C6F53A; --_glow: #C6F53A;
  --_pour: linear-gradient(180deg, var(--_base) 50%, var(--_base2) 50%);
}
[data-color="kraw"] { --_base: #3A1C10; --_flake: #F15A24; }

/* ==== P3 shop additions (home hero display scale, 09 L5) ==== */
/* The live hero is 80 / 64 / 36px stepped; these are the same proportions as one fluid ramp,
   built the way 01 §2.7 builds the rest of the scale. Home hero only. */
:root {
  --b8-text-hero: clamp(2.75rem, 1.3rem + 6vw, 6rem);             /* 44 @390 · ~82 @1024 · 96 @1280+ */
  --b8-text-hero-lead: clamp(1.125rem, .95rem + .72vw, 1.5rem); /* 18 @390 · ~23 @1024 · 24 @1280+ */
}
/* ==== end P3 ==== */
