/* Pinnacle foreground contract — September 27, 2026.
   This first named layer deliberately uses important foreground declarations:
   layered important rules outrank the older unlayered important color rules.
   Do not put backgrounds, geometry, fonts, animation, or palette tokens here.
   A surface owns its foreground; nested surfaces reset it independently.
   Orange text is reserved for dark surfaces (orange on white is only 2.56:1).
   Original images, logos, SVG artwork, and their embedded labels are untouched. */
@layer pa-text-legibility {
  :where(html, body) {
    --pa-text-base: #000000;
    --pa-text-accent: #000000;
    color: #000000 !important;
  }

  /* Inheritance prevents an old gray, blue, red, transparent, or black child
     rule from defeating the foreground of the surface that actually holds it. */
  :where(body, body *:not(svg, svg *)) {
    color: inherit !important;
    -webkit-text-fill-color: currentColor !important;
    caret-color: currentColor !important;
  }
  :where(body) { color: var(--pa-text-base) !important; }
  :where(body *:not(svg, svg *))::before,
  :where(body *:not(svg, svg *))::after,
  :where(body *:not(svg, svg *))::marker {
    color: inherit !important;
    -webkit-text-fill-color: currentColor !important;
  }
  :where(input, textarea)::placeholder {
    color: inherit !important;
    -webkit-text-fill-color: currentColor !important;
    opacity: 1 !important;
  }

  /* Actual light surfaces, including nested cards in dark sections. Do not
     replace this with a generic .card or .panel selector: several are dark. */
  :where(
    .g-nav, .g-drop, .g-dr, .g-drf, .g-sp, .g-quick-links > *,
    .search-panel, .drawer, .submenu, .g-noscript-nav,
    .pd-panel, .pd-assist, .pda-log, .pda-msg.bot, .pda-quick, .pda-form, .pda-note,
    .pda-mark, .pda-quick button, .pd-row button,
    .fact-card, .form-card, .consultation-path, .patient-section-nav, .pb-card,
    .patient-preparation-links a, .video-finder, .vf-results, .vf-tasks button,
    .vf-fields input, .vf-fields select, .vf-fields button,
    .mfr-page .pcard, .mfr-page .acc-card, .mfr-page .info-cell,
    .mfr-page .family-card, .mfr-page .style-card,
    .pa-pathways, .ha-compare, .ha-model, .ha-feature-list span,
    .ha-filter, .ccol.otc, .intro-card:not(.intro-card-dark),
    .res-pillars, .res-quote, .res-clinician, .res-detail-card:not(.dark),
    .apd-ready, .apd-measure, .apd-note, .apd-aud .ac,
    .apd-cmp .cc, .apd-rec .r, .apd-dom span, .apd-team .tm,
    .help-strip, .basics, .video-index, .scard,
    .editorial-section.is-featured, .art-body.editorialized .callout,
    .pa-family-journal .sources, .pa-family-journal .clinical-sources,
    .pa-family-journal .source-list,
    .pa-family-technology .brand-card, .pa-family-technology .mfr-card,
    .pa-family-technology .device-card, .pa-family-technology .product-card,
    .pa-family-technology .tech-card, .pa-family-technology .cov,
    .pa-family-technology .step,
    .pa-family-protection .pin-card, .pa-family-protection .use-card,
    .pa-family-protection .product-card, .pa-family-protection .feature-card,
    .pa-family-protection .cov, .pa-family-protection .step,
    body[data-pa-route="/services"] .remote .state,
    body.flagship-hearing .band, body.flagship-hearing #consultation,
    body[data-pa-route="/hearing-aid-videos"] .vcta,
    body[data-pa-route="/hearing-aid-videos"] .brand-pick,
    body[data-pa-route="/hearing-aid-videos"] #vsections .vsec,
    body[data-pa-route="/westone-color-guide"] .chips .chip,
    main input, main select, main textarea, .pda-form input
  ) {
    --pa-text-base: #000000;
    --pa-text-accent: #000000;
    color: var(--pa-text-base) !important;
  }

  /* Existing dark components. These bindings change foregrounds only. */
  :where(
    .g-topbar, .topbar, .announce, footer.g-footer, body > footer,
    .g-call, .g-mobile-callbar, .site-skip,
    .dark-band, .pin-band, .care-proof-grid, .std-plate,
    .about-quote, .el-anatomy,
    .areas,
    body[data-pa-route="/journal/hearing-loss-balance-fall-risk"] .pull,
    body[data-pa-route^="/journal/best-hearing-aids-nyc"] main section[style*="background:#0E0D0B"],
    body[data-pa-route^="/journal/best-hearing-aids-nyc"] main div[style*="background:var(--ink)"],
    .clinical-team-panel, .flag-team, .flag-concierge-brief,
    .portrait .plate, .practice-editorial-card, .conc-band,
    .hero-note, .hero-authority, .hero-mobile-team,
    .ha-brand-index, .ha-cost-next, .ccol.pro,
    .formband, .remote, .insurance-specialist,
    .support-links, .ev-hero, .evidence-band, .pgal-dark, body[data-pa-route="/reviews"] .pgal,
    .res-mentor-card, .res-dossier, .res-scope, .res-scope-item,
    .res-detail-card.dark, .res-cta,
    .hac-routine, .hac-cta, .hac-dark, .hac-kit, .hac-stop, .mfr-dark, .dark-section, .cta-dark,
    body[data-pa-route="/"] #cta,
    body[data-pa-route="/hearing-accessibility"] #how,
    body[data-pa-route="/hearing-accessibility"] #assess,
    .apd-ready .rl, .apd-band, .apd-statement, .apd-cta-dark,
    .patient-start-card, .patient-decision, .patient-decision-options > a,
    .pa-answer-snapshot, .pa-epc-card, .pa-epc-caption, .hp-cap,
    .pa-office-photo, .post-grid .pcard.feat,
    .editorial-section.is-sources, .art-body.editorialized .pull,
    .hp-marquee, .pill.ink, .brief-panel.dark, .sw-tip,
    .pd-load-feedback, .pda-head, .pda-msg.user,
    .price-snapshot caption, .cart-count,
    #home-patient-hero .pe-title-accent, #home-patient-hero .pe-photo figcaption,
    body[data-pa-route="/"] #care-guide,
    body[data-pa-route="/"] .photo-break,
    body[data-pa-route="/"] .loc-img .tag,
    body[data-pa-route="/"] .services-intro-media figcaption,
    body[data-pa-route="/insurance"] .fin,
    body[data-pa-route="/hearing-health"] .why,
    body[data-pa-route="/hearing-aid-videos"] .vid-hero,
    body[data-pa-route="/hearing-aid-videos"] .vcard,
    body[data-pa-route="/hearing-aid-videos"] .hotlines,
    body[data-pa-route="/hearing-aid-videos"] .hcard,
    body[data-pa-route="/hearing-aid-videos"] .bp-btn,
    .vg-play, .vg-video,
    body.flagship-hearing .midcta,
    body.pa-family-journal blockquote, body.pa-family-journal .pullquote,
    body.pa-family-journal .quote,
    body[data-pa-route="/resources"] .quote,
    body:is([data-pa-route="/evidence-based-hearing-care"], [data-pa-route="/hearing-accessibility"], [data-pa-route="/hearing-aid-videos"], [data-pa-route="/performance-hearing"], [data-pa-route="/practice-websites"], [data-pa-route="/referral"], [data-pa-route="/store"], [data-pa-route^="/videos/"]) :is(.hero.dark, .band, .quote),
    body[data-pa-route="/auditory-processing-disorder"] .hero-chip,
    body[data-pa-route="/real-ear-measurement"] .hero-chip,
    body[data-pa-route="/concierge"] .hero-chip,
    body[data-pa-route="/tinnitus"] .hero-chip,
    body[data-pa-route="/dizziness-vertigo"] .hero-chip,
    body[data-pa-route="/fittings"] .hero-chip
  ) {
    --pa-text-base: #FFFFFF;
    --pa-text-accent: #F08647;
    color: var(--pa-text-base) !important;
  }

  /* Dark route-family heroes exist only under the art-direction shell.
     Standard-shell manufacturer heroes are light and must not be whitened. */
  :where(
    body.pa-family-technology main > :is(.hero,.page-hero,.mfr-hero,.mfr-sec):first-child,
    body.pa-family-technology main > .mfr-page > .mfr-hero:first-child,
    body.pa-family-technology > :is(.hero,.page-hero,.mfr-hero,.mfr-sec):first-of-type,
    body.pa-family-protection main > :is(.hero,.page-hero,.pin-hero,.mfr-sec):first-child,
    body.pa-family-protection main > .mfr-page > .mfr-hero:first-child,
    body.pa-family-protection > :is(.hero,.page-hero,.pin-hero,.mfr-sec):first-of-type,
    body.pa-family-technology .band,
    body.pa-family-technology .midcta,
    body.pa-editorial-system.pa-tile-heavy main > :is(.section,.pad):nth-of-type(4n+3) .card-grid > .card:first-child,
    body.pa-editorial-system.pa-route-family-location main .cov-grid > .cov:first-child,
    body.pa-editorial-system:is(.pa-tile-heavy,.pa-no-content-media):not(.pa-route-family-journal):not(.pa-route-family-video) main :is(.cta-banner,.cta,.midcta),
    body.home-page .cta,
    body.pa-route-family-journal .cta,
    body[data-pa-route="/journal"] .cta,
    body[data-pa-route="/reviews"] .cta,
    body[data-pa-route="/at-home-audiology"] .cta,
    body[data-pa-route="/transfer"] .cta,
    body[data-pa-route="/contact"] .cta,
    body[data-pa-route="/industry"] .cta,
    body[data-pa-route="/industrial-audiology"] .cta,
    body[data-pa-route="/senior-care"] .cta,
    body[data-pa-route="/signia-hearing-protection"] .cta,
    body[data-pa-route="/phonak-hearing-protection"] .cta,
    body[data-pa-route="/westone-hearing-protection"] .cta,
    body[data-pa-route="/westone-color-guide"] .cta,
    body[data-pa-route="/sensaphonics-iem"] .cta
  ) {
    --pa-text-base: #FFFFFF;
    --pa-text-accent: #F08647;
    color: var(--pa-text-base) !important;
  }

  /* Existing even-row editorial paint can make an areas section light. */
  :where(body.pa-editorial-system.pa-tile-heavy main > .areas:is(.section,.pad):nth-of-type(even):not(.cta)) {
    --pa-text-base: #000000;
    --pa-text-accent: #000000;
    color: var(--pa-text-base) !important;
  }

  /* These editorial variants retain light call-to-action panels. */
  :where(body:is([data-pa-route="/journal/best-hearing-aids-nyc"],
    [data-pa-route="/journal/nyc-sirens-subways-urban-noise-hearing-health"],
    [data-pa-route="/journal/why-hearing-aids-get-a-bad-reputation"],
    [data-pa-route="/journal/why-do-my-ears-feel-clogged"]) .cta) {
    --pa-text-base: #000000;
    --pa-text-accent: #000000;
    color: var(--pa-text-base) !important;
  }

  /* Existing emphasis keeps the orange on dark surfaces and clean black on
     light surfaces. Children inherit the emphasis instead of reverting gray. */
  :where(
    h1 em, h2 em, h3 em, .display em, .h1 em, .h2 em,
    .eyebrow, .hero-eyebrow, .sec-label, .section-label, .kicker,
    .mfr-kicker, .vg-kicker, .hac-kicker, .res-eyebrow, .res-kicker,
    .pa-path-kicker, .pa-path-label, .pa-path-arrow, .fc-eyebrow,
    .ctp-kicker, .ctp-copy > span, .ctp-arrow,
    .patient-start-label, .patient-decision-kicker, .patient-decision-options span,
    .pe-title-shimmer, .pa-epc-label, .g-call-label,
    .stars, .stars2, .star, .rating-star, .g-trust-stars,
    .ak, .ck, .gk, .ik, .hl-k, .pin-proof__n,
    .res-detail-card.dark .res-kicker,
    .g-footer a:hover, .g-footer a:focus-visible,
    .g-topbar a:hover, .g-topbar a:focus-visible
  ) {
    color: var(--pa-text-accent) !important;
  }

  /* Controls own their surface independently of the surrounding section. */
  :where(
    body[data-pa-route="/journal/hearing-loss-balance-fall-risk"] .btn:not(.ghost),
    body[data-pa-route="/audiologist-long-island"] .areas .step,
    .hac-kit-top, .hac-stop-mark,
    .patient-decision-options > a.patient-decision-book,
    .g-book, .g-fbt, .g-skip, .btn.accent, .btn.primary, .btn.light,
    .hac-btn.primary, .hac-brand-action, .pin-btn, .pin-badge,
    .res-btn.primary, .mb-book, .mobile-bar .mb-book,
    .btn-tile.tile-accent, .tile-accent, .pcard-badge, .pcard-tag.flag,
    .step-n, .step .sn, .badge, .scope-note .si,
    .hac-routine-card.featured .hac-routine-list > li > b,
    .faq-item[open] summary .pm, .acc-item[open] .acc-q .ic,
    .pinn-dock .pd-btn.pd-orange, .pinn-dock .pd-btn.pd-ask,
    .pda-form button, .subnav-inner a.active,
    .video-index .featured-guides-grid a,
    body[data-pa-route="/hearing-aid-videos"] .bp-btn.on,
    body[data-pa-route="/services"] .remote .state .ab,
    body[data-pa-route="/"] .sec-no b,
    body[data-pa-route="/"] .ix-a,
    body[data-pa-route="/"] .team-ledger .ta,
    body.pa-editorial-system main .btn.ghost,
    body.pa-editorial-system main .hac-btn.ghost,
    #install-banner, #install-btn, #install-close
  ) {
    --pa-text-base: #000000;
    --pa-text-accent: #000000;
    color: var(--pa-text-base) !important;
  }
  :where(
    .pcard-media-dark .pcard-badge,
    .btn.dark, .hac-btn.dark, .padd.added, .res-btn.ink, .g-trust-links a.g-trust-all,
    .pinn-dock #pdA11y, .video-index > .wrap > a,
    .ha-filter[aria-pressed="true"], .vf-tasks button[aria-pressed="true"],
    .fchip.active, .fbtn.on,
    .g-sbtn:hover, .g-hbg:hover, .g-scl:hover, .g-drx:hover,
    .g-drf .g-ghost:hover, .nav-phone:hover, .nav-search-btn:hover,
    .search-close:hover, .jrnl-bar-cta:hover, .pb-btn:hover,
    body.flagship-hearing .ha-editorial .btn.ghost:hover,
    body[data-pa-route="/"] .ix-cta .btn-tile:not(.tile-accent),
    #contactFab.open .cfab-toggle
  ) {
    --pa-text-base: #FFFFFF;
    --pa-text-accent: #F08647;
    color: var(--pa-text-base) !important;
  }
  :where(.g-trust-links a.g-trust-all:hover) {
    --pa-text-base: #000000;
    --pa-text-accent: #000000;
    color: var(--pa-text-base) !important;
  }
  @media (hover:hover) {
    :where(.pa-pathways .pa-path-card:hover,
      .review-proof-intro:hover, .review-proof-platform:hover) {
      --pa-text-base: #FFFFFF;
      --pa-text-accent: #F08647;
      color: var(--pa-text-base) !important;
    }
  }

  /* The patient companion has its own lightweight shell and dynamic cards. */
  :where(.pa-app, .pa-card:not(.dark), .pa-card.tint, .pa-q, .pa-acard,
    .pa-vbody, .pa-sheet, .pa-input, .pa-iconbtn, .pa-chip, .pa-seg,
    .pa-ws .wsc, .pa-home24-contact,
    .pa-btn.accent, .pa-badge, .pa-check.on .box) {
    --pa-text-base: #000000;
    --pa-text-accent: #000000;
    color: var(--pa-text-base) !important;
  }
  :where(.pa-card.dark, .pa-card[data-comment-anchor="home-care"],
    .pa-iconbtn.solid, .pa-btn.dark, .pa-chip.on, .pa-seg button.on,
    .pa-ws .wsc.sel, .pa-ws .wsc.hit, .pa-wsword.done,
    .pa-home24-device, .pa-tabbar, .pa-home24-contact-actions a,
    .pa-btn.accent:active) {
    --pa-text-base: #FFFFFF;
    --pa-text-accent: #F08647;
    color: var(--pa-text-base) !important;
  }
  :where(.pa-home24-contact-actions a:last-child,
    .pa-home24-device-actions button:first-child) {
    --pa-text-base: #000000;
    --pa-text-accent: #000000;
    color: var(--pa-text-base) !important;
  }
  :where(.pa-app.hc .pa-tabbar, .pa-app.hc .pa-card, .pa-app.hc .pa-q, .pa-app.hc .pa-vcard,
    .pa-app.hc .pa-acard, .pa-app.hc .pa-togrow, .pa-app.hc .pa-acc,
    .pa-app.hc .pa-iconbtn, .pa-app.hc .pa-chip) {
    --pa-text-base: #000000;
    --pa-text-accent: #000000;
    color: var(--pa-text-base) !important;
  }
  :where(.pa-app.hc .pa-badge) {
    --pa-text-base: #FFFFFF;
    --pa-text-accent: #F08647;
    color: var(--pa-text-base) !important;
  }

  /* User-selected forced-colors mode must retain its system contrast palette. */
  @media (forced-colors: active) {
    :where(body, body *:not(svg, svg *)) {
      color: CanvasText !important;
      -webkit-text-fill-color: currentColor !important;
    }
    :where(body a) { color: LinkText !important; }
  }
}
