/* Approved visual layer, adapted from prototype 132bb8339378b9e3d78046a099bfb72c9e9067af. No demo scripts. */
/* ------------------------------------------------------------------ base */
:root[data-theme] { --exp-ink: var(--ink); --exp-green: var(--mint); --exp-paper: var(--bg); --exp-border: var(--line); --exp-muted: var(--quiet);
  --muted: var(--quiet); --green: var(--mint); --panel: var(--surface); --soft: var(--surface-2); --text: var(--ink);
  --platform-accent: var(--mint); --platform-line: var(--line); --ui-border: var(--line); --ui-green: var(--mint); --ui-ink: var(--ink); }
:root[data-theme],
:root[data-theme] body,
:root[data-theme] body.experience,
:root[data-theme] body.experience .wrap,
:root[data-theme] body.player-experience .wrap { background: var(--bg); color: var(--ink); }
:root[data-theme] body.experience { font-family: 'Inter',system-ui,sans-serif; }
:root[data-theme] .experience :is(h1, h2, h3),
:root[data-theme] .experience .exp-card-top h3,
:root[data-theme] .experience :is(.card, .cg-panel) :is(h1, h2, h3) { font-family: 'Rubik',Inter,sans-serif; font-weight: 800; letter-spacing: 0; color: var(--ink); font-style: italic; }
:root[data-theme] .experience h1 { font-weight: 800; font-style: italic; }
:root[data-theme] .experience :is(button, a, input, select, textarea):focus-visible { outline: 2px solid var(--prop-dot); outline-offset: 2px; }

/* ------------------------------------------------------------------ top bar (App navigation kept) */
:root[data-theme] .header .header-controls { gap: 10px; }
:root[data-theme] .header .lang-switch button.lang-active { background: var(--mint); color: var(--mint-ink); }
:root[data-theme] .header :is(.icon-btn-badge, #accountMenuName) { color: var(--ink); }
:root[data-theme] .header #accountMenuName::before { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
:root[data-theme] .header .home-top-breadcrumb { color: var(--ink); }
:root[data-theme] .account-menu-panel { background: var(--surface); border-color: var(--line); color: var(--ink); }
/* sidebar + mobile tabs stay navy in both themes (as in v7.3) */
:root[data-theme] .exp-app-sidebar { background: var(--navy); color: var(--navy-ink); }
:root[data-theme] .exp-app-sidebar nav a { color: var(--navy-ink); }
:root[data-theme] .exp-app-sidebar nav a.active,
:root[data-theme] .exp-app-sidebar .exp-sidebar-bottom.active { background: var(--mint); color: var(--mint-ink); }
:root[data-theme] .exp-mobile-nav { background: var(--navy); border-top-color: var(--navy-line); }
:root[data-theme] .exp-mobile-nav a { color: var(--navy-quiet); }
:root[data-theme] .exp-mobile-nav a.active { color: var(--mint); }

/* ------------------------------------------------------------------ cards / surfaces */
:root[data-theme] .experience :is(section.card:not(.md-hero):not(.md-ticket), details.card, .exp-game-card, .exp-venue-card, .social-post, .social-composer, .home-discover-card,
  .cg-panel, .cg-preview, .cg-steps, .exp-empty, .exp-map-panel, .exp-map-sidebar, .home-post-menu, .pi-req, .pi-book, .pi-res, .exp-map-layout, .exp-partner-form) {
  background: var(--surface); border: 1px solid var(--line); border-radius:6px; color: var(--ink); box-shadow: var(--shadow); }
:root[data-theme] .experience .exp-empty { border-style: dashed; color: var(--quiet); }
:root[data-theme] .experience .cg-preview-body { background: var(--surface); color: var(--ink); }
:root[data-theme] .experience .cg-preview-stats, :root[data-theme] .experience .cg-controls, :root[data-theme] .experience .cg-pair,
:root[data-theme] .experience .cg-location-heading, :root[data-theme] .experience #pgCommentForm, :root[data-theme] .experience .pi-hubres { border-color: var(--line); }
:root[data-theme] .experience .md-view-toggle, :root[data-theme] .experience .profile-hub-nav { background: var(--surface-2); color: var(--ink); }
:root[data-theme] .experience .md-view-toggle button { color: var(--ink-2); }
:root[data-theme] .experience .md-view-toggle button[aria-pressed="true"] { background: var(--mint); color: var(--mint-ink); }
:root[data-theme] .experience summary { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
:root[data-theme] .experience .exp-price { border-color: var(--line); color: var(--pend); }

/* ------------------------------------------------------------------ text colours */
:root[data-theme] .experience :is(.exp-location, .exp-note, .exp-price small, .sub, .exp-map-item p, .exp-facilities, .exp-date,
  .home-community-intro, .exp-section-heading p, .venues-v2-hero p, .pi-note, .cg-note, .cg-computed-help, .md-about p, .md-booking-note) { color: var(--quiet); }
:root[data-theme] .experience .exp-date { color: var(--ink-2); }
:root[data-theme] .experience :is(.page-link, a.page-link, .pi-link, #pgEditLink, .exp-section-heading a) { color: var(--link); background: transparent; border-color: transparent; }
:root[data-theme] .experience #pgEditLink.page-link { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }

/* ------------------------------------------------------------------ buttons (v7.3 .btn) */
:root[data-theme] .experience :is(.exp-button, a.exp-button, button.primary, .cg-next, button.md-join, .pi-req .exp-button:not(.secondary)) {
  background: var(--mint); background-image: none; color: var(--mint-ink); border: 1px solid var(--mint); border-radius:3px;
  font-family: 'Inter',system-ui,sans-serif; font-weight: 700; font-size: 17px; letter-spacing: 0; box-shadow: none; }
:root[data-theme] .experience :is(.exp-button, a.exp-button, button.primary, .cg-next, button.md-join):hover { filter: brightness(.96); }
:root[data-theme] .experience :is(.exp-button.secondary, a.exp-button.secondary, button.md-manage, .md-outline, a.md-outline, .cg-back, .pi-draft,
  #appVenueFilters, #appVenueFavorites, .venue-favorite, .exp-map-controls button) {
  background: var(--surface); background-image: none; color: var(--ink); border: 1px solid var(--line); border-radius:3px;
  font-family: 'Inter',system-ui,sans-serif; font-weight: 700; letter-spacing: 0; }
:root[data-theme] .experience .pi-cancel-game { background: var(--surface); color: var(--bad); border: 1px solid var(--bad-dot); border-radius:6px; font-family: 'Inter',system-ui,sans-serif; font-weight: 700; font-size: 16px; }
:root[data-theme] .experience :is(.exp-button, button.primary):disabled,
:root[data-theme] .experience button.exp-button:disabled { background: var(--neu-bg); border-color: var(--line); color: var(--quiet); opacity: 1; }
/* buttons sitting on the dark hero / ticket keep the light-on-dark treatment */
:root[data-theme] .experience :is(.md-hero, .md-ticket, .exp-home-team) :is(.md-outline, button.md-outline) { background: transparent; color: #F2EEE8; border-color: rgba(255, 255, 255, .55); }

/* ------------------------------------------------------------------ fields (v7.3 .field) */
:root[data-theme] .experience :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius:0px; }
:root[data-theme] .experience :is(input, textarea)::placeholder { color: var(--quiet); opacity: 1; }
:root[data-theme] .experience :is(input, select, textarea):focus { border-color: var(--prop-dot); }
:root[data-theme] .experience label { color: var(--ink-2); }

/* ------------------------------------------------------------------ status pills (v7.3 .bk: pill with dot) */
:root[data-theme] .experience .pi-status { display: inline-flex; align-items: center; gap: 6px; border-radius:3px; padding: 4px 10px; font: 500 12px 'Inter',system-ui,sans-serif; letter-spacing: 0; }
:root[data-theme] .experience .pi-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
:root[data-theme] .experience .pi-status.wait { background: var(--pend-bg); color: var(--pend); }
:root[data-theme] .experience .pi-status.prop { background: var(--prop-bg); color: var(--prop); }
:root[data-theme] .experience .pi-status.ok { background: var(--ok-bg); color: var(--ok); }
:root[data-theme] .experience .pi-status.bad { background: var(--bad-bg); color: var(--bad); }
:root[data-theme] .experience .pi-status.off { background: var(--neu-bg); color: var(--neu); }
:root[data-theme] .experience .pi-status.decl { background: transparent; color: var(--club); border: 1.5px dashed var(--club); }
:root[data-theme] .experience .exp-badge.verified { background: var(--ok-bg); color: var(--ok); }
:root[data-theme] .experience .exp-badge.unverified { background: var(--pend-bg); color: var(--pend); }
:root[data-theme] .experience #appVenueCount { background: var(--mint-soft); color: var(--mint-text); }

/* ------------------------------------------------------------------ alerts (v7.3 .banner) */
:root[data-theme] .experience .pi-alert { border: 0; border-radius:6px; }
:root[data-theme] .experience .pi-alert.warn { background: var(--pend-bg); color: var(--pend); }
:root[data-theme] .experience .pi-alert.bad { background: var(--bad-bg); color: var(--bad); }
:root[data-theme] .experience .pi-alert.ok { background: var(--ok-bg); color: var(--ok); }
:root[data-theme] .experience .pi-alert.info { background: var(--prop-bg); color: var(--prop); }
:root[data-theme] .experience :is(.cg-warning, .cg-reservation) { background: var(--pend-bg); color: var(--pend); }

/* ------------------------------------------------------------------ booking components added by the prototype */
:root[data-theme] .experience :is(.pi-pitch, .pi-slot) { background: var(--surface); color: var(--ink); border-color: var(--line); font-family: 'Inter',system-ui,sans-serif; font-size: 16px; }
:root[data-theme] .experience :is(.pi-pitch, .pi-slot)[aria-pressed="true"] { background: var(--mint-soft); color: var(--mint-text); border: 2px solid var(--mint); box-shadow: none; }
:root[data-theme] .experience .pi-slot.want { border-style: dashed; }
:root[data-theme] .experience .pi-slot small { color: var(--quiet); font-family: 'Inter',system-ui,sans-serif; }
:root[data-theme] .experience .pi-req-sum { color: var(--quiet); }
:root[data-theme] .experience .pi-req-sum b, :root[data-theme] .experience .pi-req-head strong { color: var(--ink); }
:root[data-theme] .experience .pi-req-head small { color: var(--quiet); }
:root[data-theme] .experience .pi-compare > div { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
:root[data-theme] .experience .pi-compare .new { background: var(--prop-bg); color: var(--prop); }
:root[data-theme] .pi-toast { background: var(--navy); color: #F2EEE8; }
:root[data-theme] .pi-dialog { background: var(--surface); color: var(--ink); border-color: var(--line); }

/* ------------------------------------------------------------------ the theme toggle in the App top bar */
:root[data-theme] .header .sq-theme-btn { height: 38px; }

/* ------------------------------------------------------------------ venue detail (Marketing v1 page inside the App flow)
 * Marketing names some tokens differently (--mint = soft green fill, --white = card); map them to the shared ones. */
:root[data-theme] body[data-page="venue"] {
  --paper: var(--bg); --white: var(--surface); --sage: var(--surface-2); --mint: var(--mint-soft);
  --green: var(--j-accent); --green-ink: var(--mint-text); --green-dark: var(--mint-text); --muted: var(--quiet);
  --amber-bg: var(--pend-bg); --amber: var(--pend); --info-bg: var(--prop-bg); --info: var(--prop);
  --display: 'Rubik',Inter,sans-serif; --body: 'Inter',system-ui,sans-serif;
  background: var(--bg); color: var(--ink); font-family: 'Inter',system-ui,sans-serif;
}
:root[data-theme] body[data-page="venue"] .btn { background: var(--j-accent); color: var(--mint-ink); border-color: var(--j-accent); font-family: 'Inter',system-ui,sans-serif; font-weight: 700; border-radius:3px; }
:root[data-theme] body[data-page="venue"] .btn.ghost, :root[data-theme] body[data-page="venue"] .btn.line { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
:root[data-theme] body[data-page="venue"] .nav-actions { gap: 10px; }

/* ------------------------------------------------------------------ v2.4 · corrections found by the contrast audit */
/* Dark: the Dev CSS hard-codes dark navy text on many elements. Low-specificity defaults (:where) with !important;
   the semantic colours below (pills, alerts, links, buttons) are more specific and win. */
:root[data-theme="dark"] .experience :where(main, aside.cg-preview, .cg-panel, .card, article, section, .social-post, .social-composer) :where(h1, h2, h3, h4, h5, strong, b, dt, label, legend) { color: var(--ink) !important; }
:root[data-theme="dark"] .experience :where(main, aside.cg-preview, .cg-panel, .card, article, section, .social-post, .social-composer) :where(p, small, li, dd, td, th, figcaption, time, em) { color: var(--ink-2) !important; }
:root[data-theme="dark"] .experience :where(.exp-facilities, .exp-facilities span, .exp-location, .exp-note, .sub, .md-participants-head p, .md-host-row small, .md-venue > p, .md-rules p, .home-community-intro, .venues-v2-hero p, .home-discover-card p, .cg-computed-help, .cg-note) { color: var(--quiet) !important; }
:root[data-theme="dark"] .experience :is(#pgHostLink, .pg-host-link, .exp-map-item strong) { color: var(--ink) !important; }
:root[data-theme="dark"] .experience :is(.exp-venue-card, .exp-game-card, .exp-map-sidebar, .exp-map-panel, .home-discover-card, .social-post, .social-composer, section.card:not(.md-hero):not(.md-ticket), details.card, .cg-panel, .cg-preview, .cg-steps, .exp-empty) { background: var(--surface) !important; border-color: var(--line) !important; }
:root[data-theme="dark"] .experience :is(.exp-map-item) { border-color: var(--line-2); }
:root[data-theme="dark"] body.home-feed-v2.player-experience #home.home-reference .home-next-match .exp-card-body,
:root[data-theme="dark"] body.home-feed-v2.player-experience #home.home-reference #upcomingGames > .home-next-match { background: var(--surface) !important; border-color: var(--line) !important; }
:root[data-theme="dark"] body.home-feed-v2.player-experience #home #upcomingGames .home-next-match :is(.exp-date, .exp-location, .home-match-format) { color: var(--ink-2) !important; }
:root[data-theme] body.home-feed-v2.player-experience #home.home-reference #upcomingGames .home-next-match h3 { color: #F2EEE8 !important; }
:root[data-theme] body.home-feed-v2.player-experience #home.home-reference #upcomingGames .home-next-match .home-match-label { color: #104b40 !important; }
:root[data-theme="dark"] .experience .md-avatar, :root[data-theme="dark"] .experience .social-avatar { background: var(--surface-2); color: var(--ink); }
:root[data-theme="dark"] .experience :is(textarea#socialBody, #pgCommentInput) { background: var(--surface-2) !important; color: var(--ink) !important; border-color: var(--line) !important; }
:root[data-theme="dark"] .experience :is(.home-discover-banner) { filter: brightness(.82) saturate(.9); }
/* texts on the dark hero / ticket / team cards stay light in both themes */
:root[data-theme] .experience :is(.md-hero, .md-ticket, .exp-home-team) :is(h1, h2, h3, strong, p, span, small, b) { color: #F2EEE8; }
:root[data-theme] .experience .exp-home-team p#experienceTeam,
:root[data-theme] .experience .exp-home-team p { color: var(--j-ink-2) !important; }
:root[data-theme] .experience .md-hero .md-open-spots { color: #FFD66B !important; }
/* Light: Dev colours under 4.5:1 on white */
:root[data-theme] .experience :is(.home-community-intro, .social-post small, .home-discover-card p, .venues-v2-hero p, main#playerVenues > p.exp-note, .exp-note) { color: var(--quiet); }
:root[data-theme] .experience .exp-price { color: var(--pend) !important; }
:root[data-theme] .experience .social-post button > span { color: var(--mint-text); }
:root[data-theme] .experience .venue-map-number { background: var(--ok-bg); color: var(--ok); }
:root[data-theme] .exp-map-pin span { background: #8A6400 !important; }
:root[data-theme] .exp-map-pin.verified span { background: #0B7A50 !important; }
:root[data-theme] .experience :is(.exp-venue-card .exp-actions a.exp-button:not(.secondary), a.exp-button:not(.secondary), button.exp-button:not(.secondary):not(:disabled)) { background: var(--mint) !important; background-image: none !important; color: var(--mint-ink) !important; border-color: var(--mint) !important; }
:root[data-theme] .experience :is(a.exp-button.secondary, button.exp-button.secondary) { background: var(--surface) !important; color: var(--ink) !important; border-color: var(--line) !important; }
:root[data-theme] .experience :is(.platform-float-btn) { background: var(--surface) !important; color: var(--ink) !important; border: 1px solid var(--line) !important; font-family: 'Inter',system-ui,sans-serif; font-weight: 700; }
:root[data-theme] .experience :is(.platform-float-btn.primary, .platform-float-btn.platform-float-primary) { background: var(--mint) !important; color: var(--mint-ink) !important; border-color: var(--mint) !important; }
:root[data-theme] .experience .exp-badge.verified { background: var(--ok-bg) !important; color: var(--ok) !important; }
:root[data-theme] .experience .exp-badge.unverified { background: var(--pend-bg) !important; color: var(--pend) !important; }
:root[data-theme] .experience .pi-status.decl { color: var(--club) !important; }
/* venue page (Marketing) notes */
:root[data-theme] body[data-page="venue"] .note.sage { background: var(--mint-soft); color: var(--mint-text); }
:root[data-theme] body[data-page="venue"] .note.amber { background: var(--pend-bg); color: var(--pend); }
:root[data-theme] body[data-page="venue"] .badge.b-green { background: var(--ok-bg); color: var(--ok); }
:root[data-theme] body[data-page="venue"] .badge.b-amber { background: var(--pend-bg); color: var(--pend); }
:root[data-theme] body[data-page="venue"] .header .sq-theme-btn { background: var(--navy-2); color: var(--navy-ink); border-color: var(--navy-line); }

:root[data-theme] .experience .social-post small { color: var(--quiet) !important; }
:root[data-theme="dark"] .experience :is(.social-avatar, .md-avatar) { background: var(--surface-2) !important; color: var(--ink) !important; }
:root[data-theme="dark"] .experience :is(.home-post-options summary, .venue-map-list-toggle) { color: var(--ink-2) !important; background: transparent !important; }
:root[data-theme="dark"] .experience a.exp-button.secondary > span, :root[data-theme] .experience :is(a, button).exp-button.secondary > span { color: inherit !important; }
/* Marketing uses --white as both card fill and text-on-navy: keep the text on the navy header / intro white */
:root[data-theme] body[data-page="venue"] :is(.header, .intro) { color: #F2EEE8; }
:root[data-theme] body[data-page="venue"] .header :is(.links a, .lang button, .menu-btn) { color: var(--j-ink-2); }
:root[data-theme] body[data-page="venue"] .header :is(.links a[aria-current="page"], .lang button[aria-pressed="true"]) { color: var(--j-link); }

:root[data-theme] .experience .home-discover-card :is(a, a > span) { color: var(--link) !important; }
:root[data-theme] .leaflet-control-attribution { background: var(--surface) !important; color: var(--quiet) !important; }
:root[data-theme] .leaflet-control-attribution a { color: var(--link) !important; }
:root[data-theme] body[data-page="venue"] .btn:not(.ghost) { background: var(--j-accent) !important; color: var(--j-on-accent) !important; border-color: var(--j-accent) !important; }
:root[data-theme] body[data-page="venue"] .btn.ghost { background: var(--surface) !important; color: var(--ink) !important; border: 1px solid var(--line) !important; }
:root[data-theme] body #home .home-discover-card a.exp-button.secondary,
:root[data-theme] body #home .home-discover-card a.exp-button.secondary > span { color: var(--link) !important; background: transparent !important; border-color: transparent !important; }
:root[data-theme] body.experience #topbarLanguageToggle button.lang-active { color: var(--mint-ink) !important; background: var(--mint) !important; }

/* ------------------------------------------------------------------ top bar: desktop is a light surface (as in v7.3);
   on mobile (<= 800px) the App keeps its own navy top bar, so the controls keep their light-on-navy look. */
@media (min-width: 801px) {
:root[data-theme] body.experience .wrap > .header:not(#v34-id) { background: var(--surface) !important; border-bottom: 1px solid var(--line) !important; color: var(--ink) !important; }
:root[data-theme] body.experience .wrap > .header .header-controls > :is(button, a, summary):not(.sq-theme-btn) { color: var(--ink) !important; }
:root[data-theme] body.experience .wrap > .header .header-controls .sq-theme-btn { background: var(--surface) !important; color: var(--ink) !important; border: 1px solid var(--line) !important; border-radius:3px!important; }
:root[data-theme] body.experience .header .lang-switch { background: var(--surface-2) !important; border-color: var(--line) !important; }
:root[data-theme] body.experience .header .lang-switch button { color: var(--ink-2) !important; }
:root[data-theme] body.experience .header .lang-switch button.lang-active { color: var(--mint-ink) !important; }
:root[data-theme] body.experience .header .header-controls > button[data-i18n="app.nav.home"] { background: var(--surface) !important; color: var(--ink) !important; border: 1px solid var(--line) !important; }
:root[data-theme] body.experience .wrap > .header .lang-switch button:not(.lang-active) { color: var(--ink-2) !important; background: transparent !important; }
:root[data-theme] body.experience #topbarLanguageToggle button:not(.lang-active) { color: var(--ink-2) !important; background: transparent !important; }
}
@media (max-width: 800px) {
  :root[data-theme] body.experience .wrap > .header .header-controls > .sq-theme-btn { display: none; }
}
/* the toggle also lives in the account menu (the only place for it on mobile, where the top bar is full) */
:root[data-theme] .account-menu-panel .sq-theme-btn.in-menu { width: 100%; justify-content: flex-start; height: 40px; margin: 0 0 6px; padding: 0 10px; }
:root[data-theme] .account-menu-panel .sq-theme-btn.in-menu .sq-theme-label { display: inline; }

/* dark: Home details the contrast audit cannot see (pseudo-element avatar, SVG icons, disabled button, comment field) */
:root[data-theme="dark"] body.home-feed-v2.player-experience #home .social-composer:before { background-color: var(--surface-2) !important; color: var(--ink) !important; }
:root[data-theme="dark"] .experience #home :is(.exp-card-body, .social-post) .exp-icon,
:root[data-theme="dark"] .experience #home .social-post :is(button, a) svg { color: var(--quiet) !important; }
:root[data-theme="dark"] .experience #home .social-post button:first-child svg { color: var(--mint) !important; }
:root[data-theme="dark"] .experience :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) { background: var(--surface-2) !important; color: var(--ink) !important; border-color: var(--line) !important; }
:root[data-theme="dark"] .experience button.exp-button:disabled { background: var(--neu-bg) !important; color: var(--quiet) !important; border-color: var(--line) !important; }
/* icons (non-text contrast 3:1) */
@media (min-width: 801px) {
  :root[data-theme] body.experience .wrap > .header :is(#messengerLink, #notificationsLink) { color: var(--ink) !important; }
}
:root[data-theme] .experience #home .social-post footer button:first-child { color: #0E8F61 !important; }
:root[data-theme] .experience #home .social-post footer button:first-child svg { color: #0E8F61 !important; fill: currentColor; }
:root[data-theme="dark"] .experience #home .social-post footer button:first-child,
:root[data-theme="dark"] .experience #home .social-post footer button:first-child svg { color: var(--mint) !important; }
/* map: empty canvas follows the theme (OSM tiles stay as published) */
:root[data-theme="dark"] .experience .exp-map { background: var(--surface-2) !important; }
