/* =====================================================
   MARKETSWAVE — Shared Glass/Gradient Primitives
   Extracted from styles.css (Client Dashboard Visual Treatment, 2026-09-06) so the
   Tailwind-based dashboard family (which never loads styles.css — see CLAUDE.md's Tech
   Stack boundary) can reuse the EXACT SAME .glass/.glass-subtle/.gradient-text/.blob/
   .grid-overlay/.blob-field rules the public site already established (Homepage Visual
   Redesign, Stages 1-2, 2026-09-05), rather than forking a second copy of them.

   This file is now the single source of truth for these six primitives. styles.css
   @imports it at the very top (see styles.css's own "4A" section, which now just points
   here) instead of defining them itself; every dashboard page that uses glass loads this
   file directly via its own <link> tag.
===================================================== */

/* ---- Token block, self-contained on purpose ----
   Dashboard pages define their navy/cream tokens as Tailwind config JS, not CSS custom
   properties, so the four tokens these primitives depend on (--primary, --accent-teal,
   --accent-teal-soft, --accent-gold-soft) are declared here too, values copied verbatim
   from styles.css's own :root. This is a small, disclosed duplication of four color
   VALUES only (not logic/rules) — the same tolerated-duplication category already
   established for this project's locked color tokens and rate tables (see CLAUDE.md's
   Known Structural Debt section) — kept deliberately minimal rather than pulling in
   styles.css's much larger :root block (--bg/--surface/--text/etc.), which dashboard
   pages have no use for and which could shadow their own Tailwind-driven styling. */
:root {
  --primary: var(--brand-navy);             /* Plum Ink — text */
  --primary-ground: var(--brand-navy-ground);   /* the same plum as a surface (pre-rebrand luminance) */
  --accent-teal: var(--brand-teal);
  --accent-teal-soft: #70D5CC;
  --accent-gold-soft: #FFC0A4;
}

/* ---- .glass — the liquid-glass card recipe: layered translucency gradient,
   light-catching border (brighter top/left, darker bottom/right — the "light hitting an
   edge" cue), inset + outer shadow for real depth, and a top-left sheen highlight via
   ::before. Works on any element — badges, buttons, cards. Navy at an alpha is written
   rgba(var(--brand-navy-rgb), a): a custom property cannot be decomposed into R/G/B, so
   brand-tokens.css publishes each brand colour's channels as --brand-X-rgb (row 303). ---- */
.glass {
  position: relative;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.22) 100%);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-bottom-color: rgba(var(--brand-navy-ground-rgb),0.12);
  border-right-color: rgba(var(--brand-navy-ground-rgb),0.08);
  box-shadow:
    0 20px 40px -12px rgba(var(--brand-navy-ground-rgb),0.18),
    inset 0 1px 1px rgba(255, 255, 255, 0.9),
    inset 0 -1px 1px rgba(var(--brand-navy-ground-rgb),0.06);
  overflow: hidden;
}
.glass::before {
  content: '';
  position: absolute;
  top: -40%;
  left: -30%;
  width: 70%;
  height: 70%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
  pointer-events: none;
}

/* ---- .glass-lift — the card's CONTENT sits above the sheen, not under it (2026-09-12).
   The ::before sheen is positioned, so it composites OVER a card's in-flow content, and
   its box covers the card's top-left (x to 40% of the width, y to 30% of the height) at up
   to 0.8 alpha. Text placed there is washed out — MEASURED across every .glass on every
   page (scripts/verify-glass-sheen.mjs): 165 text elements under a sheen, 53 below 4.5:1
   with it composited that clear comfortably without it — a queue page's "Pending" heading
   2.21:1 vs 17.05:1, the dashboard's "Market snapshot" 2.97:1 vs 11.57:1, the portfolio
   value figure 4.02:1 vs 11.48:1. This is an OPT-IN containment fix, applied per card, the
   same shape row 151 chose for the slate-500 override: the recipe itself is untouched and
   every card that never had text in that corner renders byte-identically. Do not lift by
   editing .glass::before — do add this class to any .glass card whose heading or figure
   sits in that corner, and re-run the audit. ---- */
.glass-lift > * {
  position: relative;
  z-index: 1;
}

/* ---- .gradient-text — navy -> teal -> gold headline accent. Apply to an inline
   element (a <span>) wrapping the text to be gradient-filled, not a block-level
   heading itself. ---- */
.gradient-text {
  color: var(--primary); /* fallback if background-clip:text isn't supported anywhere —
                             solid navy, never invisible text */
  /* ★ THE RAMP'S OWN STOPS ARE MEASURED, AND TWO OF THEM WERE FAILING (fixed 2026-09-11).
     This is TEXT, so every stop has to clear 4.5:1 on the ground it is painted on -- and the
     decorative accents did not. On the hero ground, `var(--brand-gold)` measured 2.69:1 and
     `var(--accent-teal)` (var(--brand-teal)) 4.44:1. That was PRE-EXISTING, not caused by the glow
     added behind the headline the same day: with the glow suppressed the gold still read
     2.69:1, so the glow accounts for 0.09 of it. dashboard.html's own comment had already
     recorded the same problem when this primitive was tried on the portfolio figure and
     rejected -- the finding was known in one place and never fixed at the source.
     The replacements are not new colours: #137254 is the teal row 180 derived for text after
     --accent-teal failed the same way, and #8A5C07 is the gold row 151 established. Measured
     on the lit hero ground: navy 9.91:1, teal 5.01:1, gold 4.93:1.
     --accent-teal and var(--brand-gold) remain correct for DECORATION (blobs, rails, icon strokes);
     what changed is only their use as a text fill here. */
  background: linear-gradient(135deg, var(--primary-ground) 15%, #05706b 55%, #985231 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---- .blob — a blurred, softly-glowing gradient accent shape, meant to sit behind
   glass content on a light background. Composed from a base class plus a size modifier
   (--sm/--md/--lg) plus a color modifier (--teal/--gold/--blue/--rose/--violet):
     <div class="blob blob--lg blob--teal"></div>
   POSITION is deliberately NOT part of this shared utility — where a blob sits is
   inherently specific to whatever section it's decorating, so each section defines its
   own small set of position classes/inline styles that pair with these shared size/color
   modifiers. Only --teal/--gold draw from the documented accent tokens above;
   --blue/--rose/--violet are decorative, blob-only accent hues — NOT promoted to named
   palette tokens, since the documented palette expansion is deliberately scoped to
   teal + gold only. ---- */
.blob {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
/* --xl added by the Homepage Depth Pass (2026-09-08): the section-rhythm design calls for
   deliberately larger, more confident blobs that are CROPPED by their section edges rather
   than politely contained inside them. --lg at 560px reads as contained at section scale;
   720px genuinely overflows and gets cut, which is the intended effect. */
.blob--xl { width: 720px; height: 720px; filter: blur(120px); }
.blob--lg { width: 560px; height: 560px; filter: blur(100px); }
.blob--md { width: 420px; height: 420px; filter: blur(100px); }
.blob--sm { width: 180px; height: 180px; filter: blur(50px); }

.blob--teal   { background: radial-gradient(circle, var(--accent-teal-soft) 0%, transparent 70%); }
.blob--gold   { background: radial-gradient(circle, var(--accent-gold-soft) 0%, transparent 70%); }
.blob--blue   { background: radial-gradient(circle, #D8BCE0 0%, transparent 70%); }
.blob--rose   { background: radial-gradient(circle, #F7A6A6 0%, transparent 70%); }
.blob--violet { background: radial-gradient(circle, #DAB5E5 0%, transparent 70%); }

/* ---- .grid-overlay — a faint architectural grid texture, radially masked so it fades
   toward the edges of its container rather than cutting off hard. Absolutely positioned
   to fill whatever ancestor establishes position:relative (typically the section itself).
   Navy channels from --brand-navy-rgb, as in .glass above. ---- */
.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(var(--brand-navy-ground-rgb),0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--brand-navy-ground-rgb),0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse at center, black 0%, transparent 72%);
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 72%);
  pointer-events: none;
}

/* ---- .glass-subtle — a deliberately calmer sibling of .glass: half the blur, a much
   lighter background/shadow, and no sheen ::before at all. A genuine, documented,
   reusable SECOND intensity level for the same primitive family — not a per-page fork —
   for the situation this was first built for: several small items sitting side by side
   (e.g. a 4-across grid), where the full .glass recipe's strong blur+sheen would compound
   into visual noise at that density. ---- */
.glass-subtle {
  position: relative;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.15) 100%);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 10px 24px -10px rgba(var(--brand-navy-ground-rgb),0.12);
}

/* ---- .glass-dark — Client Dashboard Visual Treatment, Stage 2 (2026-09-06). A THIRD
   formally-documented intensity/variant in this same shared file, added the exact same way
   .glass-subtle itself was: a genuine, reusable second (here, third) recipe for the family,
   not a per-page one-off. Built specifically for navigation chrome sitting on ITS OWN dark
   navy identity (the client sidebar) — .glass/.glass-subtle are both light-toned by design
   (a translucent white gradient meant to sit on a light page) and would wash a dark, opaque,
   branded surface into a pale, illegible wash if applied directly; forcing that would be the
   wrong trade, not a restrained one. This keeps the same structural language (backdrop blur,
   a soft top-light edge highlight, layered translucency) but in navy tones instead, and
   DELIBERATELY uses a gentler blur (16px, between .glass's 24px and .glass-subtle's 14px)
   and no ::before sheen at all — per the task's own explicit instruction that a heavy blur
   on fixed nav chrome reads as noisy, not premium. The navy and dark-navy channels below
   come from --brand-navy-rgb / --brand-navy-dark-rgb (brand-tokens.css, row 303). ---- */
.glass-dark {
  position: relative;
  background: linear-gradient(180deg, rgba(var(--brand-navy-ground-rgb),0.90) 0%, rgba(var(--brand-navy-dark-rgb),0.94) 100%);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 4px 0 24px -8px rgba(0, 0, 0, 0.25), inset -1px 0 0 rgba(255, 255, 255, 0.04);
}

/* ---- .glass-slate — Admin/PM Tool Visual Treatment (2026-09-06). A FOURTH formal variant,
   added the exact same way .glass-dark itself was: a genuine, reusable recipe for a
   different context, not a per-page one-off. Built specifically for the admin tool's own
   sidebar, which is DELIBERATELY a wholesale distinct color scheme from the client tool
   (slate-900 + amber accents, never navy/cream — see CLAUDE.md's Admin/PM Tool Tech Stack
   entry: "so the two can never be visually confused"). Reusing .glass-dark as-is here would
   defeat that on purpose: its background is ~90%+ opaque navy, meaning the sidebar would
   visibly read as navy-tinted rather than slate, blurring the exact distinction the whole
   admin tool exists to keep unambiguous. .glass-slate is byte-for-byte .glass-dark's own
   structure (same blur amount, same border/shadow language, same lack of ::before sheen) —
   ONLY the two background color stops are swapped from navy to Tailwind's own slate-900/
   slate-950 RGB values (15,23,42 / 2,6,23), so the admin sidebar keeps its own real slate
   identity under the glass effect instead of borrowing the client tool's. ---- */
.glass-slate {
  position: relative;
  background: linear-gradient(180deg, rgba(var(--brand-ink-rgb), 0.90) 0%, rgba(14, 3, 18, 0.94) 100%);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 4px 0 24px -8px rgba(0, 0, 0, 0.25), inset -1px 0 0 rgba(255, 255, 255, 0.04);
}

/* ---- .glass-on-dark — Homepage Depth Pass (2026-09-08). A FIFTH formal variant, added the
   same way .glass-dark and .glass-slate were: a genuine reusable recipe for a context the
   existing four do not serve.

   Why none of the existing four work for a card sitting ON a dark section:
   - .glass / .glass-subtle are LIGHT-toned (white-ish backgrounds, dark text). On a navy
     gradient they read as opaque white plates, and their own dark body text is exactly the
     illegibility this variant exists to prevent.
   - .glass-dark / .glass-slate are ~90% OPAQUE panels built for a sidebar — they are the
     dark surface itself, not a translucent card floating on top of one. Using them here
     would produce a navy card on a navy background with almost no separation.

   This is the inverse of .glass: instead of white translucency over light content, it is a
   whisper of white lifted OFF a dark background — a very low-alpha white gradient, a soft
   white hairline border, and an inset top highlight, so the card reads as a lit pane of
   glass rather than a painted box. Text placed on it must be light (the section's own dark
   context already implies that). Contrast on this surface was measured, not eyeballed —
   see the Homepage Depth Pass entry in CLAUDE.md for the real figures. ---- */
.glass-on-dark {
  position: relative;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0.03) 100%);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.18), 0 18px 36px -18px rgba(0, 0, 0, 0.45);
}

/* ---- .blob-field — a plain, reusable marker for "this section hosts background blobs" —
   just position:relative + a real overflow:hidden, so any section can drop 1-3 .blob
   children into itself for page-wide atmosphere without those blobs' own negative offsets
   ever contributing to horizontal page scroll. Deliberately does NOT set a background
   color itself — it's a pure blob host, layered over whatever the section's own
   background already is. NOTE for dashboard pages: a scrollable <main
   class="overflow-y-auto"> cannot use this marker directly — its symmetric
   overflow:hidden would also kill vertical scrolling. Those pages instead add
   `relative overflow-x-hidden` (Tailwind utilities) directly to <main>, achieving the
   same "contain blob bleed" goal asymmetrically without forking this rule. ---- */
.blob-field {
  position: relative;
  overflow: hidden;
}
/* Keeps real content above the blobs — a descendant selector (not just direct child) so
   this also reaches .container instances nested one level deeper. Scoped to blob-field
   context only, since .container itself is shared far too widely to change generally. */
.blob-field .container {
  position: relative;
  z-index: 2;
}

/* ---- .page-grain — Resources redesign (2026-09-08). A page-wide film grain: an
   SVG-turbulence data-URI multiplied over the whole viewport so a page reads as one
   printed material rather than flat screen white. Fixed rather than absolute, so it does
   not scroll with content and does not need a positioned ancestor.

   This is the SECOND texture primitive here, alongside .grid-overlay, and the first that
   is page-wide rather than section-scoped. The homepage's own .hero-grain and .field-grain
   are deliberately NOT folded into it in this task: both are section-scoped, both are
   tuned to their own surface (.field-grain in particular is calibrated against the stone
   field's measured contrast floor), and consolidating them is a real refactor with its own
   verification burden rather than a rename. See the register entry for the recommendation.

   Layering note: z-index 40 sits above page content but below the site header (100) and
   any modal, so the grain never lands on top of chrome or a dialog.

   mix-blend-mode: multiply means this DARKENS everything beneath it — every text colour on
   a page carrying this class must be contrast-measured composited, never against its own
   flat value. That is exactly what produced the darkened tones on resources.html. ---- */
.page-grain {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  /* The mockup's .42 was dialled back: this grain multiplies over every piece of body copy
     on the page, and measured composited it cost about 0.2:1 across the board. */
  opacity: .3;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='pg'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23pg)' opacity='.34'/%3E%3C/svg%3E");
}

/* ---- Contrast Audit fix (2026-09-06) — real, measured, systemic finding: Tailwind's
   text-slate-400/text-slate-500 utility classes are used as body/label copy in 83 real
   instances across 22 client-dashboard and admin-tool files, and every one of them sits
   inside a .glass or .glass-subtle card. On a genuinely SOLID bg-white card these colors
   are marginal-but-passing (text-slate-500 measures 4.759:1 on pure white — itself close
   to the WCAG floor, a pre-existing Tailwind-palette characteristic, not new); .glass's own
   translucent white-over-page-background composite is very slightly dimmer than pure white
   at its low-alpha corner (roughly 248,248,246 on this project's real cream/slate-100 page
   backgrounds, computed directly, not assumed), and that small drop is enough to tip
   text-slate-500 to 4.48:1-4.43:1 and text-slate-400 to ~2.4:1 — both genuinely below
   4.5:1, a real regression the glass treatment itself introduced, not present before glass
   was added to these cards. Fixed the same way the TPV gradient-text issue was resolved —
   by changing the treatment at the point of failure, not by re-tuning the shared .glass/
   .glass-subtle background recipe itself (which would have required nearly doubling its
   low-alpha stop, visibly changing the "glassiness" of every already-verified-good surface
   project-wide, just to accommodate one marginal Tailwind color choice). A scoped
   descendant override — real specificity (0,2,0) beats Tailwind's own bare utility class
   (0,1,0), so no !important needed — bumps both colors to slate-600 (#475569) specifically
   when they appear inside any of the four glass variants: slate-600 measures 7.06:1-7.13:1
   against these same real backgrounds, clearing 4.5:1 with genuine margin, not another
   marginal pass. .glass-dark/.glass-slate included defensively (grepped and confirmed
   zero real text-slate-400/500 usage inside either today, both being white-text-on-dark-
   navy/slate contexts already verified separately at 7-12:1) — closes this off for any
   future addition, not just today's known instances. Every OTHER real slate-400/500 use
   outside a glass container (the vast majority of the 267 total project-wide occurrences —
   plain bg-white cards, table rows, form labels) is deliberately untouched — it was never
   failing and this override cannot reach it, since the descendant selector only matches
   inside an actual glass ancestor. */
.glass .text-slate-400,
.glass-subtle .text-slate-400,
.glass-dark .text-slate-400,
.glass-slate .text-slate-400,
.glass .text-slate-500,
.glass-subtle .text-slate-500,
.glass-dark .text-slate-500,
.glass-slate .text-slate-500 {
  color: #5f4e63;
}
