/*
 * usecase/theme-tokens.css — shared color tokens for header.html / footer.html.
 *
 * Two independent axes; the attributes may sit on <html>, <body>, or any
 * ancestor of the header/footer fragments — CSS custom properties inherit
 * down the subtree, and the nearest matching ancestor wins:
 *   data-theme="light" | "dark"   — background / text / border colors
 *   data-accent="pw" | "comm" | "edu" — brand / CTA button color
 *
 * A page sets both, e.g.:
 *   <body data-theme="dark" data-accent="edu">
 *
 * MUST be linked before header.html/footer.html render (in <head>, or at
 * minimum before the fragments appear in the body) — these are custom
 * properties, not a stylesheet that can load lazily without a flash of
 * unstyled color.
 *
 * Do NOT add fallback values (var(--x, #fallback)) to component CSS that
 * consumes these tokens — an undefined token should render visibly broken,
 * not silently fall back to an unrelated color. See Global Constraints.
 */

/* ---- Theme axis: light / dark ---- */

[data-theme="dark"] {
  /* Originally copied from usecase/header.html's #nr_main_header rules; the
     ground has since been set by design (Fiona 2026-08-18) to pure #000 in
     dark / #fff in light -- it was #171719. */
  --nr-header-bg: #000000;
  --nr-header-fg: #fff;
  --nr-header-fg-muted: #e5f1ff;
  /* Full-strength interactive text: the header's text nav
     ("Personal"/"Commercial"/"Chrome"/"More") and the footer's selected
     category tab. Pure white in dark, pure black in light -- deliberately
     stronger than --nr-header-fg-muted / --nr-footer-fg-muted, which stay the
     softer secondary-text values. Shared across both fragments, hence the
     role-neutral name. Fiona 2026-08-18. */
  --nr-link-fg: #ffffff;
  --nr-dropdown-bg: rgba(0,0,0,.85);
  --nr-dropdown-border: rgba(255,255,255,.2);

  /* Brand mark / hamburger icon color. Fixed white in dark theme (Figma 5:95);
     in light theme this instead follows the product accent (Figma 3:834 colors
     the logo mark #146ef4, not the neutral #1e1e1e text color) — see the
     [data-theme="light"] block below, where this is redefined per-accent.
     Deliberately distinct from --nr-header-fg, which stays neutral text color
     in both themes. */
  --nr-icon-brand: #fff;

  /* footer.html has no dark variant today — values taken from the Figma
     dark footer node (23:2236's dark sibling, pulled 2026-08-14):
     text-[color:var(--neutrals-dark-mode/high-emphasis,rgba(255,255,255,0.87))]
     text-[color:var(--neutrals-dark-mode/medium-emphasis,rgba(255,255,255,0.6))] */
  --nr-footer-bg: #000000;
  --nr-footer-fg: rgba(255,255,255,.87);
  --nr-footer-fg-muted: rgba(255,255,255,.6);
  --nr-footer-border: rgba(255,255,255,.6);

  /* footer-v2.html only (Figma 3:3755, pulled 2026-08-17): a third, more
     transparent step below --nr-footer-fg-muted, for the tagline, the bottom
     bar's copyright/badges, and the trust-marker separator dots. In dark
     theme it happens to equal --nr-footer-fg-muted exactly (Figma reuses
     rgba(255,255,255,.6) for both roles there) -- see the light block for
     where the two genuinely diverge. */
  --nr-footer-fg-subtle: rgba(255,255,255,.6);
}

[data-theme="light"] {
  /* Copied verbatim from usecase/footer.html's current #nr_main_footer rules
     (footer.html is currently light-only — this IS its existing light theme) */
  --nr-header-bg: #ffffff;
  --nr-header-fg: #1e1e1e;
  --nr-link-fg: #000000;
  --nr-header-fg-muted: rgba(0,0,0,.6);
  --nr-dropdown-bg: #ffffff;
  --nr-dropdown-border: rgba(0,0,0,.12);

  /* Light theme: brand mark / hamburger take the accent color rather than
     staying the fixed white they are in dark theme (see the dark block's
     comment). Resolves through whichever [data-accent] value is in scope —
     both attributes are expected on the same element or ancestor chain. */
  --nr-icon-brand: var(--nr-accent);

  --nr-footer-bg: #ffffff;
  --nr-footer-fg: rgba(0,0,0,.87);
  --nr-footer-fg-muted: rgba(0,0,0,.6);
  --nr-footer-border: rgba(0,0,0,.12);

  /* footer-v2.html only (Figma 3:716, pulled 2026-08-17): genuinely distinct
     from --nr-footer-fg-muted here, unlike in dark theme -- #646464 is a
     lighter gray than rgba(0,0,0,.6)'s ~#3d3d3d. Figma's own title/link
     values for footer-v2 (#1e1e1e / #4f4f4f) are close to but not exactly
     --nr-footer-fg/-muted's rgba(0,0,0,.87)/.6 (~#212121/#3d3d3d) -- reusing
     those two rather than adding two more near-duplicate tokens, per Fiona's
     2026-08-17 call to keep the token count down; the ~5% delta is visually
     negligible and was not worth a fifth token. */
  --nr-footer-fg-subtle: #646464;
}

/* ---- Accent axis: product brand color ---- */
/* Values per Fiona, 2026-08-14: pw=#146EF4, comm=#16869F, edu=#913DFF */

[data-accent="pw"] {
  --nr-accent: #146EF4;
  --nr-accent-hover: #134DCD; /* existing hover shade from header.html's .btn-flat-primary:hover */
}

[data-accent="comm"] {
  --nr-accent: #16869F;
  --nr-accent-hover: #106179; /* ~20% darker, no existing hover value to copy — confirm with design if this reads too dark/light */
}

[data-accent="edu"] {
  --nr-accent: #913DFF;
  --nr-accent-hover: #7A1FE0; /* ~20% darker, same caveat as comm */
}

/* Text painted on top of --nr-accent (the CTA button). Figma (node 3:868,
   "Get Started Free") specifies this as a fixed white regardless of theme or
   accent — it is a property of "text on a saturated brand color", not of the
   light/dark theme axis, so it does NOT come from [data-theme]. Do not reuse
   --nr-header-fg here: that token flips to near-black in light theme, which
   read as low-contrast dark text on a colored button. */
:root {
  --nr-accent-fg: #ffffff;
}
