/**
 * Absolute last, UNIVERSAL SURFACE CONTRAST for ALL Ready themes (T1–T1000).
 *
 * Structural law (not per-theme):
 *  PHOTO overlay copy = .hx:has(.hx__media) .hx__frame (etc)  → WHITE type + strong veil
 *  LIGHT panels / type-only heroes                             → DARK type
 *  LIGHT page chrome                                           → DARK type (scheme-light)
 *  DARK bands / solid fills                                    → LIGHT type
 *
 * Critical: split heroes (twin/swiss/grove) CONTAIN .hx__media but type lives in a
 * light panel, never paint those panels with photo-white.
 */

/* , ,  PHOTO VEIL (make white type always readable on busy photos) , ,  */
body.atelier[class*="theme-t"] main .hx:has(.hx__media) .hx__veil {
  background:
    linear-gradient(105deg, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.42) 40%, rgba(0, 0, 0, 0.18) 62%, rgba(0, 0, 0, 0.55) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.08) 35%, rgba(0, 0, 0, 0.72) 100%) !important;
}

/* , ,  PHOTO OVERLAY TYPE , ,  */
body.atelier[class*="theme-t"] main .hx:has(.hx__media) :is(
  .hx__frame, .hx__thumb-top, .hx__thumb-dock, .hx__credit, .hx__caption,
  .hx__dossier, .hx__workshop, .hx__poem, .hx__voyage, .hx__column, .hx__flash, .hx__mast
) {
  color: #ffffff !important;
}

body.atelier[class*="theme-t"] main .hx:has(.hx__media) :is(
  .hx__frame, .hx__thumb-top, .hx__thumb-dock, .hx__credit, .hx__caption,
  .hx__dossier, .hx__workshop, .hx__poem, .hx__voyage, .hx__column, .hx__flash, .hx__mast
) :is(
  h1, h2, h3, h4, p, li, small, strong, em, b, cite, label,
  span:not(.an-btn__label),
  .hx__brand, .hx__line, .hx__sub, .hx__proof, .hx__chip, .hx__stamp,
  .hx__spec, .hx__role, .hx__dossier-id, .hx__timer, .hx__timer b, .hx__timer small,
  .hx__still-name, .hx__kicker, .hx__credit, .an-kicker, .an-h2, .an-lead
) {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  opacity: 1 !important;
  visibility: visible !important;
  text-shadow: none !important;
}

/* Photo overlay CTAs */
body.atelier[class*="theme-t"] main .hx:has(.hx__media) :is(
  .hx__frame, .hx__thumb-dock, .hx__mast, .hx__caption
) :is(.an-btn--solid, .ui-btn--solid, .ui-btn--invert) {
  background: #ffffff !important;
  border-color: #ffffff !important;
  color: #141210 !important;
  -webkit-text-fill-color: #141210 !important;
}
body.atelier[class*="theme-t"] main .hx:has(.hx__media) :is(
  .hx__frame, .hx__thumb-dock, .hx__mast, .hx__caption
) :is(.an-btn--solid, .ui-btn--solid, .ui-btn--invert) :is(.an-btn__label, span, .an-icon, svg) {
  color: #141210 !important;
  -webkit-text-fill-color: #141210 !important;
  background: transparent !important;
}
body.atelier[class*="theme-t"] main .hx:has(.hx__media) :is(
  .hx__frame, .hx__thumb-dock, .hx__mast, .hx__caption
) :is(.an-btn--ghost, .an-btn--ghost-dark, .ui-btn--ghost, .ui-btn--ghost-ink, .ui-btn--outline) {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.85) !important;
  background: rgba(0, 0, 0, 0.35) !important;
}
body.atelier[class*="theme-t"] main .hx:has(.hx__media) :is(
  .hx__frame, .hx__thumb-dock, .hx__mast, .hx__caption
) :is(.an-btn--ghost, .an-btn--ghost-dark, .ui-btn--ghost, .ui-btn--ghost-ink, .ui-btn--outline)
  :is(.an-btn__label, span, .an-icon, svg) {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

/* , ,  LIGHT HEROES + LIGHT PANELS , ,  */
body.atelier[class*="theme-t"] main .hx:not(:has(.hx__media)),
body.atelier[class*="theme-t"] main .hx:is(.hx--null, .hx--grove, .hx--ledger, .hx--desk, .hx--ledger-buy),
body.atelier[class*="theme-t"] main .hx :is(
  .hx__twin-copy, .hx__swiss-cell--type, .hx__split-copy, .hx__desk, .hx__ledger-row
) {
  color: #141210 !important;
}

body.atelier[class*="theme-t"] main .hx:not(:has(.hx__media)) :is(
  h1, h2, h3, h4, p, li, small, strong, em, b, cite, label,
  span:not(.an-btn__label),
  .hx__brand, .hx__line, .hx__sub, .hx__proof, .hx__chip, .hx__stamp,
  .hx__spec, .hx__role, .hx__kicker, .an-kicker, .an-h2, .an-lead
),
body.atelier[class*="theme-t"] main .hx:is(.hx--null, .hx--grove, .hx--ledger, .hx--desk, .hx--ledger-buy) :is(
  h1, h2, h3, h4, p, li, small, strong, em, span:not(.an-btn__label),
  .hx__brand, .hx__line, .hx__sub, .hx__proof, .hx__chip, .hx__kicker, .an-kicker
),
body.atelier[class*="theme-t"] main .hx :is(
  .hx__twin-copy, .hx__swiss-cell--type, .hx__split-copy
) :is(
  h1, h2, h3, h4, p, li, small, strong, em, span:not(.an-btn__label),
  .hx__brand, .hx__line, .hx__sub, .hx__proof, .hx__kicker, .an-kicker
) {
  color: #141210 !important;
  -webkit-text-fill-color: #141210 !important;
  opacity: 1 !important;
  text-shadow: none !important;
}

/* Light hero / panel CTAs */
body.atelier[class*="theme-t"] main .hx:not(:has(.hx__media)) :is(.an-btn--solid, .ui-btn--solid),
body.atelier[class*="theme-t"] main .hx:is(.hx--null, .hx--grove, .hx--ledger, .hx--desk, .hx--ledger-buy)
  :is(.an-btn--solid, .ui-btn--solid),
body.atelier[class*="theme-t"] main .hx :is(.hx__twin-copy, .hx__swiss-cell--type, .hx__split-copy)
  :is(.an-btn--solid, .ui-btn--solid) {
  background: var(--cta-bg, #0b3d30) !important;
  border-color: var(--cta-border, var(--cta-bg, #0b3d30)) !important;
  color: var(--cta-fg, #ffffff) !important;
  -webkit-text-fill-color: var(--cta-fg, #ffffff) !important;
}
body.atelier[class*="theme-t"] main .hx:not(:has(.hx__media))
  :is(.an-btn--solid, .ui-btn--solid) :is(.an-btn__label, span, .an-icon, svg),
body.atelier[class*="theme-t"] main .hx:is(.hx--null, .hx--grove, .hx--ledger, .hx--desk, .hx--ledger-buy)
  :is(.an-btn--solid, .ui-btn--solid) :is(.an-btn__label, span, .an-icon, svg),
body.atelier[class*="theme-t"] main .hx :is(.hx__twin-copy, .hx__swiss-cell--type, .hx__split-copy)
  :is(.an-btn--solid, .ui-btn--solid) :is(.an-btn__label, span, .an-icon, svg) {
  color: var(--cta-fg, #ffffff) !important;
  -webkit-text-fill-color: var(--cta-fg, #ffffff) !important;
  background: transparent !important;
}
body.atelier[class*="theme-t"] main .hx:not(:has(.hx__media))
  :is(.an-btn--ghost, .ui-btn--ghost, .ui-btn--outline),
body.atelier[class*="theme-t"] main .hx:is(.hx--null, .hx--grove, .hx--ledger, .hx--desk, .hx--ledger-buy)
  :is(.an-btn--ghost, .ui-btn--ghost, .ui-btn--outline),
body.atelier[class*="theme-t"] main .hx :is(.hx__twin-copy, .hx__swiss-cell--type, .hx__split-copy)
  :is(.an-btn--ghost, .ui-btn--ghost, .ui-btn--outline) {
  color: #141210 !important;
  -webkit-text-fill-color: #141210 !important;
  border-color: color-mix(in srgb, #141210 55%, transparent) !important;
  background: transparent !important;
}
body.atelier[class*="theme-t"] main .hx:not(:has(.hx__media))
  :is(.an-btn--ghost, .ui-btn--ghost, .ui-btn--outline) :is(.an-btn__label, span, .an-icon, svg),
body.atelier[class*="theme-t"] main .hx:is(.hx--null, .hx--grove, .hx--ledger, .hx--desk, .hx--ledger-buy)
  :is(.an-btn--ghost, .ui-btn--ghost, .ui-btn--outline) :is(.an-btn__label, span, .an-icon, svg),
body.atelier[class*="theme-t"] main .hx :is(.hx__twin-copy, .hx__swiss-cell--type, .hx__split-copy)
  :is(.an-btn--ghost, .ui-btn--ghost, .ui-btn--outline) :is(.an-btn__label, span, .an-icon, svg) {
  color: #141210 !important;
  -webkit-text-fill-color: #141210 !important;
}

/* , ,  LIGHT PAGE CHROME (never bare main, that painted photo heroes dark) , ,  */
body.atelier.scheme-light[class*="theme-t"] :is(
  .an-header, .an-footer:not(.an-footer--checkout),
  .an-section, .an-rail-block, .an-block, .an-buy, .an-product__meta,
  .an-checkout-stage, .an-checkout-summary__card, .an-checkout-panel, .an-drawer
) :is(
  h1, h2, h3, h4, p, li, label, small, strong, em,
  .an-h2, .an-lead, .an-kicker:not(.an-kicker--on-dark),
  .an-logo__theme, .sys-logo__theme, .an-menu-btn,
  .an-nav a:not(:hover):not(:focus-visible):not(:active),
  .an-util, .an-util span,
  .an-footer a:not(.an-btn), .an-product__meta h3, .an-price > span,
  .an-field__label, .an-check__text, .an-checkout-stage__title, .an-checkout-stage__sub,
  a:not(.an-btn):not(.ui-btn):not(.an-bag-cta):not(.an-product):not(.an-filter)
) {
  color: var(--ink, #141210) !important;
  -webkit-text-fill-color: var(--ink, #141210) !important;
  opacity: 1 !important;
}

/* Page ghosts only, never override photo-hero ghost CTAs */
body.atelier.scheme-light[class*="theme-t"] :is(
  .an-header, .an-footer, .an-section, .an-rail-block, .an-buy, .an-drawer,
  .hx:not(:has(.hx__media)),
  .hx :is(.hx__twin-copy, .hx__swiss-cell--type, .hx__split-copy)
) :is(.an-btn--ghost, .an-btn--ghost-dark, .ui-btn--ghost, .ui-btn--outline),
body.atelier.scheme-light[class*="theme-t"] :is(
  .an-header, .an-footer, .an-section, .an-rail-block, .an-buy, .an-drawer,
  .hx:not(:has(.hx__media)),
  .hx :is(.hx__twin-copy, .hx__swiss-cell--type, .hx__split-copy)
) :is(.an-btn--ghost, .an-btn--ghost-dark, .ui-btn--ghost, .ui-btn--outline)
  :is(.an-btn__label, span, .an-icon, svg) {
  color: var(--ink, #141210) !important;
  -webkit-text-fill-color: var(--ink, #141210) !important;
  background: transparent !important;
}

body.atelier.scheme-dark[class*="theme-t"] :is(
  .an-header, .an-footer:not(.an-footer--checkout), .an-section, .an-rail-block, .an-buy
) :is(
  h1, h2, h3, p, li, label, .an-h2, .an-lead,
  .an-nav a:not(:hover):not(:focus-visible):not(:active),
  .an-util, .an-util span, .an-logo__theme, .an-footer a:not(.an-btn), .an-product__meta h3
) {
  color: var(--ink, #f4efe6) !important;
  -webkit-text-fill-color: var(--ink, #f4efe6) !important;
  opacity: 1 !important;
}

/* , ,  DARK BANDS , ,  */
body.atelier[class*="theme-t"] :is(
  .an-topbar, .an-news, .an-marquee, .an-sale-banner,
  .an-cta-band--urgency, .an-cta-band[data-surface="dark"], [data-surface="dark"],
  .an-footer--checkout, .an-cinema, .an-look, .an-dest__panel
) :is(
  h1, h2, h3, h4, p, li, a:not(.an-btn):not(.ui-btn),
  span:not(.an-btn__label):not(.an-bag-cta__label):not(.an-bag-cta__count),
  small, strong, em, label, .an-h2, .an-lead, .an-kicker, .an-news__lead
) {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  opacity: 1 !important;
}

/* , ,  SOLID FILLS (BAG / page CTAs) , ,  */
body.atelier[class*="theme-t"] :is(
  .an-btn--solid, .ui-btn--solid, .an-bag-cta, .an-convert-dock__cta,
  .an-paybtn, .an-checkout-summary__pay
) {
  background: var(--cta-bg, #0b3d30) !important;
  border-color: var(--cta-border, var(--cta-bg, #0b3d30)) !important;
  color: var(--cta-fg, #ffffff) !important;
  -webkit-text-fill-color: var(--cta-fg, #ffffff) !important;
}
body.atelier[class*="theme-t"] :is(
  .an-btn--solid, .ui-btn--solid, .an-bag-cta, .an-convert-dock__cta,
  .an-paybtn, .an-checkout-summary__pay
) :is(
  .an-btn__label, .an-bag-cta__label, .an-icon,
  span:not(.an-bag-cta__count):not(.an-btn__count), strong, em, small, svg
) {
  color: var(--cta-fg, #ffffff) !important;
  -webkit-text-fill-color: var(--cta-fg, #ffffff) !important;
}

/* Re-assert photo overlay inverted solids AFTER page solid law */
body.atelier[class*="theme-t"] main .hx:has(.hx__media) :is(
  .hx__frame, .hx__thumb-dock, .hx__mast, .hx__caption
) :is(.an-btn--solid, .ui-btn--solid, .ui-btn--invert) {
  background: #ffffff !important;
  border-color: #ffffff !important;
  color: #141210 !important;
  -webkit-text-fill-color: #141210 !important;
}
body.atelier[class*="theme-t"] main .hx:has(.hx__media) :is(
  .hx__frame, .hx__thumb-dock, .hx__mast, .hx__caption
) :is(.an-btn--solid, .ui-btn--solid, .ui-btn--invert) :is(.an-btn__label, span, .an-icon, svg) {
  color: #141210 !important;
  -webkit-text-fill-color: #141210 !important;
  background: transparent !important;
}

body.atelier[class*="theme-t"] :is(.an-header, [class*="-nav"], .an-utils, .an-drawer) .an-bag-cta,
body.atelier[class*="theme-t"] :is(.an-header, [class*="-nav"], .an-utils, .an-drawer) .an-bag-cta
  :is(.an-bag-cta__label, span:not(.an-bag-cta__count), .an-icon, svg) {
  color: var(--cta-fg, #ffffff) !important;
  -webkit-text-fill-color: var(--cta-fg, #ffffff) !important;
}

body.atelier[class*="theme-t"] .an-bag-cta__count {
  background: var(--sale, #e11d48) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

body.atelier[class*="theme-t"] :is(
  .an-filter.is-on, .ui-chip.is-on, .an-chip.is-on, .chip.is-on
) {
  background: var(--cta-bg, #0b3d30) !important;
  color: var(--cta-fg, #ffffff) !important;
  -webkit-text-fill-color: var(--cta-fg, #ffffff) !important;
}
body.atelier[class*="theme-t"] :is(
  .an-product__badge, .an-product__badge--sale, .an-fomo__badge, .an-sale-banner__badge
),
body.atelier[class*="theme-t"] :is(
  .an-product__badge, .an-product__badge--sale, .an-fomo__badge, .an-sale-banner__badge
) :is(span, strong) {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

/* Toolbar search, never white-on-white */
body.atelier .an-toolbar :is(input, [type="search"], [data-toolbar-search]) {
  color: #062e27 !important;
  -webkit-text-fill-color: #062e27 !important;
  background: #ffffff !important;
}
body.atelier .an-toolbar :is(input, [type="search"])::placeholder {
  color: #5a7a70 !important;
  -webkit-text-fill-color: #5a7a70 !important;
  opacity: 1 !important;
}
