/* =========================================================================
   Podlink — dashboard chrome remap (P-06 phase 1)
   =========================================================================

   WHAT THIS FILE IS
   -----------------
   App-shell-only policy: it remaps the stock theme's RUNTIME CSS custom
   properties (declared in resources/views/default/scss/base/_vars.scss and
   compiled into the committed public/build/ bundle) onto the Podlink
   --pl-* tokens that podlink-tokens.css already declares on every panel
   page. Colour only: no layout, no spacing, no radii, no type sizes, and
   no component selectors beyond the single :focus-visible rule below.

   LOAD ORDER (panel/layout/partials/head.blade.php)
   -------------------------------------------------
     @vite bundle  ->  podlink-tokens.css  ->  THIS FILE
   It must load AFTER podlink-tokens.css (it consumes --pl-* tokens) and
   after the @vite bundle (it wins the theme's :root / .theme-dark
   declarations: same specificity, later in source — and the bundle's vars
   sit in @layer base while this file is unlayered). Cache-busted by
   config/marketing.php -> asset_version, the same ?v= as the token file.
   BUMP THAT VERSION whenever this file changes.

   WHY A SEPARATE FILE: podlink-tokens.css is shared with the marketing
   site and contractually sets no element styles and no theme-var
   overrides. This remap is dashboard-scoped policy and stays small enough
   to read in one sitting.

   CONTRAST FIGURES in the comments are WCAG 2.1 relative-luminance ratios
   computed from the actual HSL values in this file and _vars.scss.
   BRAND.md quotes the same pairs within hex-rounding (its 8.20 is this
   file's 8.27: #0f0f12 vs the exact hsl(240 9% 6%) = #0E0E11).
   ========================================================================= */

:root {

	/* -------------------------------------------------------------------
	   1. BUTTONS / FILLED ACCENT SURFACES
	   Stock: --primary-foreground and --accent-foreground are white on
	   the orange --primary/--accent fill — #FFFFFF on #FF8C00 = 2.33:1.
	   FAILS AA text (4.5:1) and AA UI (3:1). BRAND.md §1 rule 1: ink on
	   orange is the only compliant filled-button pair.
	   Remap -> --pl-text-on-accent (ink, --pl-neutral-900): 8.27:1 on
	   #FF8C00 (AAA).
	   ------------------------------------------------------------------- */
	--primary-foreground: var(--pl-text-on-accent, 240 9% 6%);
	--accent-foreground: var(--pl-text-on-accent, 240 9% 6%);

	/* -------------------------------------------------------------------
	   2. BORDERS / HAIRLINES
	   Stock --border (200 12% 95%, #F1F3F4) is 1.12:1 against the white
	   page surface — effectively invisible; the Tabler BC var
	   --tblr-card-border-color (#f1f3f4) is the same line at 1.11:1.
	   Remap -> --pl-border (--pl-neutral-200, 210 13% 92%, #E8EBED):
	   1.20:1 — a visible hairline. (Hairline borders carry no WCAG
	   minimum; the 3:1 UI rule is for meaningful graphics.)
	   --input-border / --card-border / --navbar-border / --header-border
	   all alias var(--border) on :root (remapping --border alone would
	   cascade), but each is remapped explicitly so the policy survives
	   any future direct declaration upstream.
	   ------------------------------------------------------------------- */
	--border: var(--pl-border, 210 13% 92%);
	--input-border: var(--pl-border, 210 13% 92%);
	--card-border: var(--pl-border, 210 13% 92%);
	--navbar-border: var(--pl-border, 210 13% 92%);
	--header-border: var(--pl-border, 210 13% 92%);
	/* Tabler BC var is a literal colour, not a bare HSL triplet. */
	--tblr-card-border-color: hsl(var(--pl-border, 210 13% 92%));

	/* -------------------------------------------------------------------
	   3. SIDEBAR (x-navbar) HOVER / ACTIVE TEXT
	   Stock --navbar-foreground-hover / --navbar-foreground-active are
	   var(--primary) — brand orange #FF8C00 as TEXT on the light navbar
	   = 2.33:1, FAILS AA. BRAND.md §1 rule 2: orange text on a light
	   background uses --pl-accent-text-safe (--pl-orange-700, #B85600):
	   4.83:1 on white — AA normal text.
	   ------------------------------------------------------------------- */
	--navbar-foreground-hover: var(--pl-accent-text-safe, 28 100% 36%);
	--navbar-foreground-active: var(--pl-accent-text-safe, 28 100% 36%);
}

/* -----------------------------------------------------------------------
   4. FOCUS
   The stock dashboard ships no consistent visible focus ring. One global
   :focus-visible rule — keyboard-only by definition (:focus-visible does
   not match on mouse/touch focus, so pointer users see no change).
   Ring colour --pl-focus-ring = --pl-orange-600 (#DB6E00): 3.37:1 on
   white and 5.73:1 on ink, so one ring clears the 3:1 UI minimum on both
   (BRAND.md §1 rule 3 — raw brand orange at 2.33:1 is banned as a ring on
   white). The token file's dark scope flips --pl-focus-ring to
   --pl-orange-400 (9.85:1 on the dark surface), and its forced-colors
   block widens the ring to 3px. outline only: no layout shift, no
   directional properties (RTL-safe).
   ----------------------------------------------------------------------- */
:focus-visible {
	outline: var(--pl-focus-ring-width, 2px) solid hsl(var(--pl-focus-ring, 30 100% 43%));
	outline-offset: var(--pl-focus-ring-offset, 3px);
}

/* -----------------------------------------------------------------------
   5. DARK MODE MIRROR
   Convention check: tailwind.config.js declares
   darkMode: ['class', '.theme-dark'] and the dash_theme setting applies
   the class to <body>. _vars.scss re-declares the theme vars in its own
   .theme-dark block, which would otherwise clobber the :root remaps
   above — so every remapped var is mirrored here. The var() references
   are the SAME tokens: podlink-tokens.css flips the --pl-* values inside
   its own dark scope (.theme-dark / :root:has(body.theme-dark)), so each
   reference below resolves to the dark value where it is declared.
   ----------------------------------------------------------------------- */
.theme-dark {

	/* Buttons: still ink on orange — #FF8C00 is at its best against ink.
	   Stock dark keeps white-on-orange (2.33:1); ink is 8.27:1 (AAA). */
	--primary-foreground: var(--pl-text-on-accent, 240 9% 6%);
	--accent-foreground: var(--pl-text-on-accent, 240 9% 6%);

	/* Borders: dark --pl-border (240 6% 18%, #2B2B31) on the dark surface
	   (240 9% 6%) = 1.37:1, vs the stock dark --border (223 9% 15%) at
	   1.25:1 — the hairline stays a hairline, slightly more present. */
	--border: var(--pl-border, 240 6% 18%);
	--input-border: var(--pl-border, 240 6% 18%);
	--card-border: var(--pl-border, 240 6% 18%);
	--navbar-border: var(--pl-border, 240 6% 18%);
	--header-border: var(--pl-border, 240 6% 18%);
	--tblr-card-border-color: hsl(var(--pl-border, 240 6% 18%));

	/* Sidebar hover/active text: BRAND.md §1 rule 4 — the text-safe
	   orange flips LIGHTER in dark mode. --pl-accent-text-safe resolves
	   to --pl-orange-400 (#FFA538) here: 9.85:1 on the dark surface.
	   (Stock dark used raw #FF8C00 at 8.27:1 — passing, but off-policy;
	   the token keeps light and dark on one rule.) */
	--navbar-foreground-hover: var(--pl-accent-text-safe, 33 100% 61%);
	--navbar-foreground-active: var(--pl-accent-text-safe, 33 100% 61%);
}
