/* =============================================================================
   FOOX BRICKS — COLOUR PASS (Nov 2026)
   One file, load it last (after components.css).

   PART A — BOTH THEMES: contrast fixes that apply in light and dark.
            Uses role tokens (--label-color, --pico-muted-color) so each theme
            resolves its own value: gray-500 on light, gray-300 on dark.
   PART B — DARK MODE ONLY: the surface ladder and dark-specific colouring,
            every rule scoped to html[data-theme="dark"].

   Target: all text ≥ 4.5:1 (≥ 3:1 for large text) in both themes.
   Exempt by WCAG: disabled controls (e.g. pagination "Vorige" on page 1)
   and the decorative .color-guide-arrow.
   ============================================================================= */

/* =============================================================================
   PART A — BOTH THEMES
   ============================================================================= */

/* A1 Muted text. #888882 (gray-400) was the default "muted" grey: 3.6:1 on white,
   3.3:1 on the page grey. Light now uses gray-500 (#5A5A56, 7.0:1 / 6.4:1).
   Black panels keep Pico's dark value through their own data-theme="dark". */
[data-theme="light"],
:root:not([data-theme="dark"]) { --pico-muted-color: var(--color-gray-500); }

/* A2 Small grey labels: moved into components.css, layout.css and pico-custom.css,
   where each label's own rule now says color: var(--label-color) (#1126). Light:
   gray-500 on white 7.0:1. Dark: gray-300, 5.2–7.7:1 (labels on the light image
   well are overridden in B §4). Labels on black panels keep their own colour. */

/* Labels on the product image well (light well in both themes): gray-300 on
   gray-50 was 2.0:1 → gray-500 6.4:1. Dark mode overrides to gray-600 in B §4. */
:is(.product-detail-img-color-label, .product-detail-part-tag) { color: var(--color-gray-500); }


/* A3 Black chrome: header top bar, hero stats, footer (same in both themes) */
/* Top bar: #888882 on #2E2E2B = 3.8:1 → 6.2:1 */
.top-bar span { color: var(--color-gray-300); }

/* Hero stat labels: #5A5A56 on #2E2E2B = 2.0:1 → 6.2:1 */
.hero-stat-label { color: var(--color-gray-300); }

/* Footer: links/tagline #5A5A56 on black = 2.4:1, newsletter label + copyright #3A3A37 = 1.5:1 */
.footer-tagline,
.footer-col a,
.footer-newsletter-label { color: var(--color-gray-300); }          /* 7.7:1 */
.footer-col a:hover { color: var(--color-white); }
.footer-bottom-inner span { color: var(--color-gray-400); }          /* 4.7:1, still reads as small print */


/* A4 Badges */
/* Coral surfaces with white text = 2.8:1 → black text 6.1:1 */
.badge--sale { color: var(--color-black); }

/* "Op voorraad" badge: white on #2a9d5c = 3.5:1 → same dark green as NIEUW (5.3:1) */
.badge--in-stock { background: var(--color-success-dark); }

/* A5 Category tiles: inline styles in templates/home (CSS can't override them cleanly).
   Change the TECHNIC tile there: color:#fff → color:#1D1D1B and its .cat-accent-bar
   background:#fff → #1D1D1B (white on #FF6B6B = 2.8:1, fails even as large text;
   black = 6.1:1). MINIFIGUREN was white on #888882 = 3.56:1; .cat-name is 14px bold
   (small text, needs 4.5:1), so the tile is now #5A5A56 (gray-500): white = 6.93:1,
   the same in both themes because the tile is inline-coloured (#1166). */

/* =============================================================================

   PART B — DARK MODE ONLY

   WHY EVERYTHING IS SCOPED TO html[data-theme="dark"]
   Black panels (header, footer, hero, .panel-dark, login brand…) carry
   data-theme="dark" in the markup in BOTH themes. A plain [data-theme="dark"] .x
   selector would therefore also hit those panels in light mode. Scoping to the
   root element guarantees: only the dark theme changes.

   SURFACE MODEL (all derived from live tokens)
   Light mode reads: black chrome → light page → white sections → white cards.
   Dark mode now mirrors that with one consistent ladder:
     brand black  #1D1D1B  --color-black        header, hero, footer, black panels (unchanged)
     page         #2E2E2B  --color-black-soft   page background, page heads
     section      #262623  --dk-section         the sections that are white in light mode
     card         #3A3A37  --color-black-muted  cards, filter panel, summaries
     well         #D0D0C8  --color-gray-200     product image wells (dimmed light, see §4)
   Before: page = brand black, so every black panel dissolved into the page and
   "white" sections stayed white.
   ============================================================================= */

/* §1 Tokens -------------------------------------------------------------------- */
html[data-theme="dark"] {
  --dk-section: color-mix(in srgb, var(--color-black) 50%, var(--color-black-soft));   /* #262623 */
  --dk-line: color-mix(in srgb, var(--color-gray-500) 60%, var(--color-black-muted));  /* #4D4D4A dividers on cards */
  --dk-well: var(--color-gray-200);

  /* page + cards */
  --pico-background-color: var(--color-black-soft);
  --page-head-background: var(--color-black-soft);
  --pico-card-background-color: var(--color-black-muted);
  --pico-card-border-color: var(--color-black-muted);
  --pico-card-sectioning-background-color: var(--color-black-muted);
  --thumb-background: var(--dk-well);
  --line-color: var(--dk-line);

  /* text: #888882 fails on every dark surface (3.2–4.3:1) → #B0B0A8 (5.2–7.7:1) */
  --pico-muted-color: var(--color-gray-300);
  --pico-muted-border-color: var(--dk-line);

  /* forms: inputs sit inset (darker than the card) with a visible edge */
  --pico-form-element-background-color: var(--dk-section);
  --pico-form-element-active-background-color: var(--dk-section);
  --pico-form-element-selected-background-color: var(--color-black-soft);
  --pico-form-element-border-color: var(--color-gray-500);
  --pico-form-element-placeholder-color: var(--color-gray-400);
  --pico-switch-background-color: var(--color-gray-500);

  /* red text: #b42833 is unreadable on dark (≈2:1) → coral-light */
  --color-error-text: var(--color-coral-light);

  /* shadows: the light-mode 8% black shadows vanish on dark → deeper */
  --shadow-sm: 0 1px 4px rgb(0 0 0 / 30%);
  --shadow-card: 0 2px 10px rgb(0 0 0 / 35%);
  --shadow-card-hover: 0 6px 20px rgb(0 0 0 / 50%);
  --shadow-modal: 0 8px 32px rgb(0 0 0 / 60%);

  /* the light-only wells/highlights */
  --color-thumb-bg: var(--dk-well);
}

/* §2 Sections that are white in light mode ---------------------------------------- */
html[data-theme="dark"] :is(.section-bestsellers, .review-ticker, .pay-banner, .catalog-layout, .foox-pag, .product-detail-related-card, .about-story) {
  background: var(--dk-section);
}
html[data-theme="dark"] .section-bestsellers--alt { background: transparent; }   /* page grey, as in light */
html[data-theme="dark"] .stats-bar { background: var(--color-black-soft); }

/* §3 Text that was hard-coded black or #888882 ------------------------------------------ */
html[data-theme="dark"] :is(
  .section-title, .stat-value, .product-card-name, .product-card-price, .product-card-price-val,
  .product-detail-price, .product-detail-section-title, .product-detail-spec-row dd,
  .product-detail-timeline-dates > span, .product-detail-colors-ever-num, .product-detail-related-hdr h2,
  .foox-pag__strong, .foox-pag__cell, .filter-panel-title
) { color: var(--ink-color); }

/* (muted labels moved to §A: they now use --label-color in both themes) */

html[data-theme="dark"] :is(.section-link, .catalog-breadcrumb a, .filter-clear-link, .product-detail-related-hdr a):hover { color: var(--ink-color); }
html[data-theme="dark"] .product-detail-history-text { color: var(--copy-color); }
html[data-theme="dark"] .catalog-breadcrumb li + li::before { color: var(--color-gray-500); }
html[data-theme="dark"] .filter-panel label { color: var(--copy-color); }

/* §4 Image wells ---------------------------------------------------------------------
   BrickLink images are transparent. Black parts vanish on a dark well (1.4:1) and
   white parts on a light one (light mode already lives with that). A dimmed light
   well (#D0D0C8, black parts 10:1) keeps every part readable without the glare of
   #F5F5F0 next to dark cards. */
html[data-theme="dark"] :is(.product-card-image, .product-card-img-area, .product-detail-main-image) {
  background: var(--dk-well);
  border-color: var(--dk-well);
}
html[data-theme="dark"] :is(.product-detail-img-color-label, .product-detail-part-tag) { color: var(--color-gray-600); }   /* on the light well: 7.4:1 */
html[data-theme="dark"] :is(.product-detail-colors-ever-cell--ghost, .catalog-empty-stud) { background: var(--color-black-soft); }
/* --thumb-background is also used for non-image surfaces: those stay dark */
html[data-theme="dark"] :is(.condition-well, .address-defaults-fieldset) { background: var(--color-black-soft); }
html[data-theme="dark"] .condition-well { border-color: var(--dk-line); }
html[data-theme="dark"] .orders-table tbody tr:hover td { background: var(--color-black-soft); }
html[data-theme="dark"] .catalog-empty-grid > *:nth-child(even) { background: var(--dk-line); }

/* §5 Dividers that were gray-50/100 (invisible or glaring on dark) ------------------- */
html[data-theme="dark"] :is(
  .product-card-footer, .product-detail-history, .product-detail-timeline-section, .product-detail-colors-ever,
  .product-detail-specs-section, .product-detail-spec-row, .foox-pag, .filter-panel-header
) { border-color: var(--dk-line); }
html[data-theme="dark"] .catalog-layout { border-color: var(--color-black-soft); }
html[data-theme="dark"] .filter-panel { border-right-color: var(--dk-line); }
html[data-theme="dark"] .filter-panel details { border-bottom-color: var(--dk-line); }
html[data-theme="dark"] .product-detail-related-card { border-color: var(--color-black-soft); }
html[data-theme="dark"] .stats-bar { border-color: var(--dk-line); }
html[data-theme="dark"] .filter-color-swatch span { border-color: var(--dk-line); }

/* §6 Cards & product detail ------------------------------------------------------------ */
/* the filter panel reads as one card next to the grid */
html[data-theme="dark"] .filter-panel { background: var(--color-black-muted); }
/* colour swatches: black/dark swatches need an edge on a dark card */
html[data-theme="dark"] :is(.product-detail-color-swatch, .product-card-color-dot, .color-guide-swatch) {
  border-color: color-mix(in srgb, var(--color-white) 18%, transparent);
}
html[data-theme="dark"] .product-detail-color-swatch.selected { border-color: var(--color-yellow); }
html[data-theme="dark"] .product-detail-timeline-track,
html[data-theme="dark"] .product-detail-timeline-dot--start { background: var(--color-gray-300); }
html[data-theme="dark"] .product-detail-timeline-dot--end { border-color: var(--color-gray-300); }
html[data-theme="dark"] .product-detail-timeline-tick { background: var(--color-gray-500); }

html[data-theme="dark"] .product-detail-condition-btn {
  background: var(--dk-section); border-color: var(--color-gray-500); color: var(--label-color);
}
html[data-theme="dark"] .product-detail-condition-btn.selected { background: var(--dk-section); color: var(--ink-color); }
html[data-theme="dark"] .product-detail-add-btn:disabled {
  background: var(--color-black-soft) !important; color: var(--label-color) !important; border-color: var(--dk-line) !important;
}

/* quantity −/+ and other plain buttons that inherited black text */
html[data-theme="dark"] .qty-stepper button { color: var(--ink-color); }
html[data-theme="dark"] .qty-stepper button:disabled,
html[data-theme="dark"] .cart-qty-form .qty-stepper button:disabled { color: var(--color-gray-500); }

/* price range slider */
html[data-theme="dark"] .dual-range::before {
  background: linear-gradient(to right,
    var(--color-gray-500) 0%, var(--color-gray-500) var(--min-pct),
    var(--color-yellow) var(--min-pct), var(--color-yellow) var(--max-pct),
    var(--color-gray-500) var(--max-pct), var(--color-gray-500) 100%);
}
html[data-theme="dark"] .dual-range input[type="range"]::-webkit-slider-thumb { border-color: var(--color-gray-50); }
html[data-theme="dark"] .dual-range input[type="range"]::-moz-range-thumb { border-color: var(--color-gray-50); }

/* pagination */
html[data-theme="dark"] .foox-pag__cell:hover:not(.foox-pag__cell--active):not(.foox-pag__nav--disabled):not(.foox-pag__elide) {
  border-color: var(--ink-color); color: var(--ink-color);
}
html[data-theme="dark"] .foox-pag__nav--disabled { color: var(--color-gray-500); }

/* §7 Badges ------------------------------------------------------------------------- */
/* GEBRUIKT / Terugbetaald: a light chip glares on dark cards → tonal */
html[data-theme="dark"] :is(.badge--condition-used, .badge--refunded) {
  background: var(--color-black-soft); color: var(--color-gray-200); border-color: var(--color-black-soft);
}
html[data-theme="dark"] .badge--cancelled { background: transparent; color: var(--label-color); border-color: var(--color-gray-500); }
html[data-theme="dark"] .badge--rare { color: var(--ink-color); border-color: var(--ink-color); }
/* black badges on black-muted cards: add a hairline so they keep their shape */
html[data-theme="dark"] :is(.badge--new, .badge--featured, .badge--pre-order, .badge--address, .badge--shipped) {
  box-shadow: inset 0 0 0 1px var(--dk-line);
}

/* §8 Home ------------------------------------------------------------------------- */
/* category tiles use inline brand colours; the dark ones need an edge on the dark page */
html[data-theme="dark"] .cat-card { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-white) 8%, transparent); }
/* CTA on yellow: Pico's dark "contrast" flips to a light button — keep it black like light mode */
html[data-theme="dark"] :is(.cta-banner, .cta-band) :is(.contrast, [role="button"]) {
  background: var(--color-black); border-color: var(--color-black); color: var(--color-white);
}
html[data-theme="dark"] :is(.cta-banner, .cta-band) :is(.contrast, [role="button"]):hover {
  background: var(--color-black-soft); border-color: var(--color-black-soft);
}
/* review bar sits on the darker section: lift it */
html[data-theme="dark"] .review-ticker-bar { box-shadow: var(--shadow-card), inset 0 0 0 1px var(--dk-line); }

/* §9 Content, account & checkout pages ------------------------------------------- */
/* black panels on the (now lighter) page get the same hairline as the review bar */
html[data-theme="dark"] :is(.panel-dark, .auth-brand, .stats-strip, .company-panel, .faq-ask, .pay-status, .thanks-hero) {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-white) 6%, transparent);
}
/* the auth shell is one card: its border was the page colour */
html[data-theme="dark"] .auth-shell { border-color: var(--color-black-muted); }
/* paper-bag value icon: black outline vanished on the dark card */
html[data-theme="dark"] .value-icon--bag { background: var(--color-black-soft); border-color: var(--color-gray-300); }
html[data-theme="dark"] .value-icon--bag::after { background: var(--color-gray-300); }
html[data-theme="dark"] .paper-bag { border-color: var(--color-gray-600); }
/* checkout */
html[data-theme="dark"] .checkout-card input[role="switch"] { background: var(--color-gray-500); }
html[data-theme="dark"] .checkout-card input[role="switch"]:checked { background: var(--color-black); }
html[data-theme="dark"] .checkout-steps li.is-done .checkout-step-mark { box-shadow: inset 0 0 0 1px var(--dk-line); }
html[data-theme="dark"] .cart-empty-icon svg { stroke: var(--label-color); }
html[data-theme="dark"] .summary-qty { box-shadow: 0 0 0 1px var(--dk-line); }
html[data-theme="dark"] .address-add-plus { box-shadow: inset 0 0 0 1px var(--dk-line); }
