/* CARDAR jersey themes — Phase 3 themes (token-only recolour).
   Three neutral-named themes, one token set each. Applied through
   :root[data-theme="..."], which outranks every page-local plain :root
   rule, so a theme recolours every token-driven surface without touching
   layout, copy or flow. The pre-paint inline script in each template head
   sets data-theme from localStorage before the first stylesheet applies,
   so the first paint already uses the chosen theme (no dark/light flash).
   All text/button pairs below were computed against WCAG AA 4.5:1
   (see phase3-themes/contrast.py — hard gate ALL PASS).
   Deliberately NOT themed here: /ssp (keeps its PR #908 dark scope),
   search_public (its own dark page), admin pages (untouched).
   Grade token --grade-bgs #b8860b scores 3.20-3.25 on light surfaces
   (pre-existing Step 1 value, UI v4 D2); no badge markup renders it
   today, so the value is left unchanged for a Step 5 decision. */

/* ---- Forced-colour opt-out base (themes-fix F4) ----
   Declares light-only at :root so Chrome auto-dark skips these pages.
   Per-theme rules below take precedence (charcoal keeps dark, which
   itself opts out of auto-dark); the meta tag in each template head
   sets the same default before CSS loads. This does NOT defeat
   harder forced night modes in some browsers — those still need the
   user to switch the browser's forced-dark setting off. */
:root { color-scheme: light only; }

/* ---- Theme 1: warm cream (light) ---- */
:root[data-theme="cream"] {
  color-scheme: light only;
  --bg: #faf6ee; --color-bg: #faf6ee;
  --surface: #fffdf8; --color-surface: #fffdf8;
  --surface-elevated: #f3ecdf;
  --panel: #fffdf8; --panel2: #f3ecdf; --card: #fffdf8;
  --text: #1c2733; --ink: #1c2733;
  --muted: #5d6a7a; --text-secondary: #5d6a7a;
  --line: #e3dccb; --border: #e3dccb;
  --primary: #1d4ed8; --color-primary: #1d4ed8; --primary-hover: #1a44b8;
  --info: #1d4ed8; --accent: #1d4ed8; --accent-soft: #dbe7fb;
  --success: #047857; --good: #047857; --ok: #047857; --ok-soft: #e6f4ea;
  --warning: #b45309; --fair: #b45309;
  --error: #c81e1e; --high: #c81e1e; --hot: #c81e1e;
  --collector-ink: #ffffff;
  --grade-psa: #cc0000; --color-psa: #cc0000;
  --grade-bgs: #b8860b; --color-bgs: #b8860b;
  --grade-sgc: #111111; --color-sgc: #111111;
  --brand-navy: #071427;
}

/* ---- Theme 2: blue gradient (full-page gradient + solid cards) ---- */
:root[data-theme="gradient"] {
  color-scheme: light only;
  --bg: #f7f9fc; --color-bg: #f7f9fc;
  --surface: #ffffff; --color-surface: #ffffff;
  --surface-elevated: #eef2f7;
  --panel: #ffffff; --panel2: #eef2f7; --card: #ffffff;
  --text: #0f1c2e; --ink: #0f1c2e;
  --muted: #5a6b82; --text-secondary: #5a6b82;
  --line: #dde3ec; --border: #dde3ec;
  --primary: #d4a017; --color-primary: #d4a017; --primary-hover: #b8890f;
  --info: #1d4ed8; --accent: #1d4ed8; --accent-soft: #dbe7fb;
  --success: #047857; --good: #047857; --ok: #047857; --ok-soft: #e6f4ea;
  --warning: #b45309; --fair: #b45309;
  --error: #c81e1e; --high: #c81e1e; --hot: #c81e1e;
  --collector-ink: #071427;
  --grade-psa: #cc0000; --color-psa: #cc0000;
  --grade-bgs: #b8860b; --color-bgs: #b8860b;
  --grade-sgc: #111111; --color-sgc: #111111;
  --brand-navy: #071427;
  --header-gradient: linear-gradient(180deg, #0a5e96, #0a2352);
}

/* ---- Theme 3: dark charcoal (Material dark-theme exemplar) ----
   Elevation: higher surfaces carry more white (bg -> surface -> elevated).
   Brand colours are desaturated for dark surfaces (info #8fb8ff). */
:root[data-theme="charcoal"] {
  color-scheme: dark;
  --bg: #171a26; --color-bg: #171a26;
  --surface: #212634; --color-surface: #212634;
  --surface-elevated: #2a2f45;
  --panel: #212634; --panel2: #2a2f45; --card: #212634;
  --text: #f2f5fa; --ink: #f2f5fa;
  --muted: #a9b2c6; --text-secondary: #a9b2c6;
  --line: #333a52; --border: #333a52;
  --primary: #c81e1e; --color-primary: #c81e1e; --primary-hover: #a81818;
  --info: #8fb8ff; --accent: #8fb8ff; --accent-soft: #2a3550;
  --success: #4ade80; --good: #4ade80; --ok: #4ade80; --ok-soft: #22352c;
  --warning: #fbbf24; --fair: #fbbf24;
  --error: #f87171; --high: #f87171; --hot: #f87171;
  --collector-ink: #ffffff;
  --grade-psa: #ff6b6b; --color-psa: #ff6b6b;
  --grade-bgs: #e3b341; --color-bgs: #e3b341;
  --grade-sgc: #e8ecf1; --color-sgc: #e8ecf1;
  --brand-navy: #071427;
}

/* ---- Targeted overrides (variables alone cannot fix rules that derive
   button text colour from --bg: product_theme sets .btn.primary text to
   var(--bg), which fails on gold (gradient) and on dark red (charcoal).
   These selectors outrank product_theme's body .btn.primary. ---- */
html[data-theme="cream"] body .btn.primary,
html[data-theme="cream"] body .btn-primary,
html[data-theme="cream"] body .tab.active,
html[data-theme="cream"] body .mini.add { color: #ffffff; }
html[data-theme="gradient"] body .btn.primary,
html[data-theme="gradient"] body .btn-primary,
html[data-theme="gradient"] body .tab.active,
html[data-theme="gradient"] body .mini.add { color: #071427; }
html[data-theme="charcoal"] body .btn.primary,
html[data-theme="charcoal"] body .btn-primary,
html[data-theme="charcoal"] body .tab.active,
html[data-theme="charcoal"] body .mini.add { color: #ffffff; }

/* ---- Charcoal subtitle override (charcoal-subline refix) ----
   collector_experience.css hardcodes .collector-intro p.collector-subline
   to #3d4d5f at specificity (0,2,1), which beats the head inline
   .collector-subline rule (0,1,0) that F1 (#917) changed — that is why
   F1 did not take effect. This (0,3,2) charcoal-only rule restores the
   charcoal --text-secondary token (#a9b2c6, 8.14:1 on #171a26, WCAG AA
   pass). Cream keeps the hardcoded #3d4d5f (8.03 on light bg, still
   passing); gradient has its own subline rule in the full-page block
   below (its body is no longer light) and is untouched by this rule. ---- */
html[data-theme="charcoal"] .collector-intro p.collector-subline { color: var(--text-secondary); }

/* ---- Gradient theme header: workspace .top is STICKY (workspace head
   inline rule: position:sticky;top:0;z-index:100), so the old transparent
   background used to show white cards scrolling underneath it and drop
   white language text on white cards. .top now carries the SAME fixed
   gradient as the body (identical stops/direction via --header-gradient
   + background-attachment: fixed), so its slice aligns pixel-perfect
   with the body gradient: seamless at the top, opaque when scrolled over
   cards. White header text on the header slice: 6.88 at the top stop
   rising to ~7.6 at the header bottom edge (WCAG AA pass at every scroll
   position). Buttons keep their own colours. ---- */
html[data-theme="gradient"] .top {
  background-color: #0a2352;
  background-image: var(--header-gradient);
  background-attachment: fixed;
  background-repeat: no-repeat;
}
html[data-theme="gradient"] .top a:not(.btn),
html[data-theme="gradient"] .top label { color: #ffffff; }

/* ---- Minimal theme switcher (workspace header, beside language) ---- */
.cardar-theme-select {
  min-height: 44px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 700;
  padding: 0 10px; cursor: pointer;
}

/* ---- Header switcher geometry pin (themes-fix F3) ----
   A bare `select{width:100%}` rule in workspace head styles would
   otherwise stretch this flex item to a full row once styles apply
   (which is why it looked compact pre-CSS and full-row after).
   This higher-specificity rule pins it compact in every state. */
.top > .cardar-theme-select {
  flex: 0 0 auto; width: auto; max-width: 160px;
}

/* ---- Cream confetti dots (themes-fix F5, 23:07 spec) ----
   Jersey-style multi-colour speckles on the page base layer (body),
   cream theme only. Colours sampled from the Dodgers confetti print:
   teal / bright blue / yellow / orange / red, 3-4px dots, one dot per
   large tile (sparse, not dense). Cards (.panel/.card) keep their
   solid token surfaces, so all small body text sits on solid colour;
   only the big hero title sits over dots, which the spec allows.
   Coverage: ~1 dot per 19,000 px2 (~0.05% of area), so text contrast
   is unchanged from the cream values (text 14.04, secondary 5.12). */
html[data-theme="cream"] body {
  background-image:
    radial-gradient(circle at 24px 36px, rgba(42,157,143,.8) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 150px 120px, rgba(33,158,188,.8) 0 2px, transparent 3px),
    radial-gradient(circle at 60px 210px, rgba(233,196,106,.85) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 200px 60px, rgba(244,162,97,.8) 0 2px, transparent 3px),
    radial-gradient(circle at 110px 280px, rgba(231,111,81,.75) 0 1.5px, transparent 2.5px);
  background-size: 260px 340px, 300px 380px, 240px 320px, 280px 360px, 320px 300px;
  background-repeat: repeat;
}

/* ---- Gradient full-page (2026-11-04, Jay: full page, not header only) ----
   Body carries the full-page gradient (fixed, so the header area always
   shows the bright stop and scrolling never stripes); cards stay solid
   and keep dark text. Design rule: body colour flips to white for
   off-card text, so every light-background container MUST get its colour
   reset back to dark in the list below -- anything with a light bg and
   no explicit colour breaks otherwise. --bg/--text tokens stay light
   values on purpose: buttons, tabs, chips and form controls reuse them
   on their own light backgrounds. Every override below is strictly
   higher specificity than the rule it beats, so load order is moot.
   Verified pairs (contrast_final.py, all PASS): white on gradient top
   6.88, subline #d0dce8 4.94, kicker #f0d48a 4.74, in-card link info on
   white 6.70, card dark on white 17.13, card muted on white 5.44.
   Known residuals (page-level secondary text on non-workspace pages,
   left for the page-coverage line -- do NOT fix with a global .muted
   rule, the same classes also appear inside cards): chase
   .coverage-notice, chase page-level .hint, showcase_profile .hint. ---- */
html[data-theme="gradient"] { background-color: #0a2352; }
html[data-theme="gradient"] body {
  background-color: #0a2352;
  background-image: var(--header-gradient);
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: #ffffff;
}
/* Light-background containers: text back to dark. */
html[data-theme="gradient"] .panel,
html[data-theme="gradient"] .collector-path,
html[data-theme="gradient"] .collector-tool-directory,
html[data-theme="gradient"] .binder-card,
html[data-theme="gradient"] .metric,
html[data-theme="gradient"] .parallel-item,
html[data-theme="gradient"] .toggle,
html[data-theme="gradient"] .ebay-listing-row,
html[data-theme="gradient"] .ebay-batch-bar,
html[data-theme="gradient"] .batch-card,
html[data-theme="gradient"] .product-guide,
html[data-theme="gradient"] .ad-reservation,
html[data-theme="gradient"] .workflow-insights article,
html[data-theme="gradient"] .drawer,
html[data-theme="gradient"] .binder-sheet,
html[data-theme="gradient"] .binder-asset-card,
html[data-theme="gradient"] .ebay-listing-dialog,
html[data-theme="gradient"] .sheet-card,
html[data-theme="gradient"] .card,
html[data-theme="gradient"] .collector-filter-chip { color: var(--text); }
/* Workspace hero secondary lines (beat the (0,2,1) hard-coded rules). */
html[data-theme="gradient"] .collector-intro p.collector-subline { color: #d0dce8; }
html[data-theme="gradient"] .collector-kicker { color: #f0d48a; }
/* Chase page-level subtitle (chase-only class, never inside a card). */
html[data-theme="gradient"] .sub { color: #d0dce8; }
/* Off-card links go white; in-card links return to info. Buttons, tabs,
   minis and chips are excluded -- they keep their own colours. */
html[data-theme="gradient"] a:not(.btn):not(.tab):not(.mini):not(.chip) { color: #ffffff; }
html[data-theme="gradient"] .cardar-site-menu-panel a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] .panel a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] .collector-path a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] .collector-tool-directory a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] .binder-card a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] .metric a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] .parallel-item a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] .toggle a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] .ebay-listing-row a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] .ebay-batch-bar a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] .batch-card a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] .product-guide a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] .ad-reservation a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] .workflow-insights article a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] .drawer a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] .binder-sheet a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] .binder-asset-card a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] .ebay-listing-dialog a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] .sheet-card a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] .card a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] #cardarGuide a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] .binder-version-dialog a:not(.btn):not(.tab):not(.mini):not(.chip) { color: var(--info); }
/* Sticky headers: fixed gradient (opaque + viewport-aligned, so the seam
   with the body gradient is invisible). .topbar/.pricing-header are
   sticky; workspace .top is sticky too and gets the same treatment in
   its own block above. */
html[data-theme="gradient"] .topbar,
html[data-theme="gradient"] .pricing-header {
  background-color: #0a2352;
  background-image: var(--header-gradient);
  background-attachment: fixed;
}
/* Header contents can exceed tablet/foldable widths before mobile rules apply. */
.topbar .topbar-inner { flex-wrap: wrap; row-gap: 10px; }
html[data-theme="gradient"] .topbar .back { color: #ffffff; }
/* Direct header links may carry inline muted colours from page templates.
   Scope the override to the dark header, leaving light menu panels alone. */
html[data-theme="gradient"] .topbar > a:not(.btn):not(.tab):not(.mini):not(.chip),
html[data-theme="gradient"] .topbar-inner > a:not(.btn):not(.tab):not(.mini):not(.chip) { color: #ffffff !important; }
html[data-theme="gradient"] .topbar .ui-language label,
html[data-theme="gradient"] .topbar .page-title { color: #ffffff; }
html[data-theme="gradient"] .topbar select { color: var(--text); }

/* ---- Phase 3 Step 4 (H2): anchor offset under sticky headers ----
   D11 scroll-margin-top mechanism. Sticky header heights, measured from
   the templates: workspace .top is 64px min-height + 24px padding on
   desktop and 212px min-height + 24px padding at <=760px; SSP .topbar
   carries a 68px logo + 24px padding (~93px); Chase/market/showcase
   .topbar is ~53px. One 104px base covers every sticky header except
   the tall mobile workspace header, which gets 248px via :has(.top)
   (.top is workspace-only; no other template uses that exact class).
   The SSP #posterResults inline 84px is raised to 104px in its template
   (inline style otherwise wins over this rule). Scroll feel itself
   still needs a real-browser check (see Step 4 report). ---- */
[id] { scroll-margin-top: 104px; }
/* Shared header JS supplies its actual responsive height. Important also
   supersedes older per-page inline offsets; the rules below remain fallbacks. */
html[data-cardar-header-measured] body [id] { scroll-margin-top: var(--cardar-sticky-header-offset) !important; }
@media (max-width: 760px) {
  body:has(.top) [id] { scroll-margin-top: 248px; }
}

/* ---- Phase 3 Step 4 (M10): gradient-theme site footer contrast ----
   _site_footer.html is Step 2 territory and is NOT edited here; its
   links/muted line carry inline var(--info)/var(--muted), which resolve
   to dark blue/grey on the dark gradient body (2.28:1 / 2.81:1, fail).
   Inline styles can only be beaten with !important, so this scoped
   gradient-only override (white links 15.27:1 dark end / 6.88:1 bright
   end; muted #d0dce8 10.97:1 / 4.94:1) lives here instead. Cream and
   charcoal footer pairs already pass and are untouched. The Step 2
   site-nav strip has the same gradient issue but is fenced: measured
   and reported, not changed, in this batch. ---- */
html[data-theme="gradient"] .cardar-site-footer a { color: #ffffff !important; }
html[data-theme="gradient"] .cardar-site-footer p { color: #d0dce8 !important; }

/* ---- Phase 3 Step 5 (7b): gradient-theme Step 2 site-nav contrast ----
   _site_header.html nav links carry inline color:var(--info), which under
   the gradient theme resolves to #1d4ed8 on the dark gradient body:
   2.28:1 at the dark end (#0a2352), 1.03:1 at the bright end (#0a5e96).
   Inline styles can only be beaten with !important (Step 4 footer
   precedent). White links: 15.27:1 dark end / 6.88:1 bright end, AA pass
   at every scroll position. Structure untouched; cream (6.22:1) and
   charcoal (8.64:1) nav pairs already pass and are not overridden. ---- */
html[data-theme="gradient"] .cardar-site-nav a { color: #ffffff !important; }

