/* ==========================================================================
   URSY.FM — DARK REGISTER for the ursy-fm-frontend PLUGIN
   Added 11 September 2026.

   WHAT WAS ACTUALLY WRONG. The report said "fm's dark mode is incompletely
   implemented". The THEME's dark register is not incomplete - tokens.css
   declares a full, designed dark palette on `:root, [data-ursy-theme='dark']`
   and says so: "Dark is the hero theme; light is a full peer." It flips
   correctly. Measured on a fresh load with data-ursy-theme='dark':
   --bg #050506, --ink #f6f4f1, --ink2 #a5abb2, and body takes rgb(246,244,241).

   What has NO dark register is the PLUGIN, ursy-fm-frontend. Its three
   stylesheets - shell.css, live-radio.css, polish.css - hard-code 272 colour
   literals (155 distinct, #ffffff alone 71 times) directly onto components,
   and polish.css overrides the plugin's OWN token rules with those literals.
   So no token-level fix can reach them.

   THAT is why the page looked the way it did: the paragraph took the theme's
   dark --ink2 while the ground stayed light, because the ground is painted by
   .ursy-mount / the estate layer, and the h1 took --ursy-text (#1b2027) from
   polish.css, which has no dark value at all. Paragraphs flipped, headings and
   panels did not.

   THREE THINGS HAD TO MOVE TOGETHER, and all three are here or beside it:
     1. the plugin's --ursy-* tokens            (this file, below)
     2. the plugin's hard-coded component paint (this file, generated section)
     3. the estate layer's html background      (ursy-estate-brand.css 1.3.59,
        which had no way to see data-ursy-theme at all - it keys on data-theme)

   THE GENERATED SECTION is emitted by runtime-v2/tools/fm-dark-generate.js from
   the plugin's own CSS, not written by hand: 60 surface selectors and 16 ink
   selectors. Hand-listing ~90 counterparts invites one silent miss, and the two
   bugs caught while building it (a substring replace that turned #fff inside
   #fffaf7 into "var(--card)af7", and a first pass that silently skipped every
   gradient panel) are exactly the kind a hand list hides.

   DELIBERATELY NOT TOUCHED — the FM-1 and its mini player (.ursy-radio__*,
   .ursy-live-mini__*), 64 rules. tokens.css calls the FM-1 "A physical object:
   these barely move between themes" and gives it leather, brass, cloth and an
   LCD. It is meant to look the same in both registers. Flipping its brushed
   metal would break a designed object, not fix a contrast fault.

   ALSO NOT TOUCHED — --ursy-accent and the solid status colours. --ursy-accent
   is a BUTTON GROUND carrying white text (.ursy-button--primary), so lightening
   it for dark would destroy the label it sits under. The tinted *-soft
   backgrounds below are flipped instead, because those are the ones that were
   near-white panels.
   ========================================================================== */

html[data-ursy-theme='dark'],
html[data-ursy-theme='dark'] .ursy-mount {
  /* Surfaces and inks come from the theme's own designed dark palette rather
     than from invented greys, so a future palette change carries through. */
  --ursy-canvas: var(--bg);
  --ursy-canvas-cool: var(--bg);
  --ursy-panel: var(--card);
  --ursy-panel-soft: var(--field);

  --ursy-text: var(--ink);
  --ursy-muted: var(--ink2);
  --ursy-subtle: var(--ink3);

  --ursy-border: var(--line2);
  --ursy-border-soft: var(--line);

  /* The pale status tints were near-white panels; on dark they become a tint of
     their own hue so the meaning survives the flip. */
  --ursy-accent-soft: rgba(15, 143, 196, .22);
  --ursy-success-soft: rgba(45, 160, 95, .22);
  --ursy-danger-soft: rgba(200, 70, 60, .22);
  --ursy-info-soft: rgba(60, 110, 190, .22);
  --ursy-warning-soft: rgba(190, 140, 40, .22);
  --ursy-teal-soft: rgba(20, 150, 140, .22);
  --ursy-purple-soft: rgba(140, 110, 200, .24);

  --ursy-shadow-sm: 0 1px 2px rgba(0, 0, 0, .55), 0 2px 7px rgba(0, 0, 0, .45);
  --ursy-shadow-md: 0 8px 28px rgba(0, 0, 0, .55);
  --ursy-shadow-lg: 0 18px 55px rgba(0, 0, 0, .65);
}

/* --- surfaces: 60 selectors --- */
html[data-ursy-theme='dark'] .ursy-mount { background-image: radial-gradient(1200px 600px at 50% -240px, rgba(15,143,196,.09), transparent 62%),
    radial-gradient(880px 480px at 108% 420px, rgba(58,64,72,.05), transparent 60%),
    linear-gradient(180deg, var(--bg) 0, var(--bg) 26rem, var(--ursy-canvas) 46rem) !important; }
html[data-ursy-theme='dark'] .ursy-family-header { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-family-account>a:hover { background: color-mix(in srgb, #f2d8c9 14%, var(--card)); }
html[data-ursy-theme='dark'] .ursy-header { background: linear-gradient(145deg,var(--card) 0,var(--card) 55%,var(--card) 100%); }
html[data-ursy-theme='dark'] .ursy-nav { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-overview { background: linear-gradient(135deg,var(--card) 0,var(--card) 100%); }
html[data-ursy-theme='dark'] .ursy-overview-grid>a,
html[data-ursy-theme='dark'] .ursy-overview-card { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-card { background: linear-gradient(180deg, var(--card), var(--card)); }
html[data-ursy-theme='dark'] .ursy-button,
html[data-ursy-theme='dark'] .ursy-favourite,
html[data-ursy-theme='dark'] .ursy-view { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-button:disabled { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-mount input[type="search"],
html[data-ursy-theme='dark'] .ursy-mount select { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-directory { background: linear-gradient(135deg,var(--card),var(--card)); }
html[data-ursy-theme='dark'] .ursy-directory-result,
html[data-ursy-theme='dark'] .ursy-podcast-result { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-account { background: linear-gradient(135deg,var(--card),var(--card)); }
html[data-ursy-theme='dark'] .ursy-account-grid>div { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-podcasts { background: linear-gradient(135deg,var(--card),var(--ursy-purple-soft)); }
html[data-ursy-theme='dark'] .ursy-planner { background: linear-gradient(135deg,var(--card),var(--ursy-warning-soft))!important; }
html[data-ursy-theme='dark'] .ursy-planner-toolbar { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-occurrence { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-reminder-delivery article { background: linear-gradient(180deg, var(--card), var(--card)); }
html[data-ursy-theme='dark'] .ursy-recommendations { background: linear-gradient(135deg,var(--card),var(--card))!important; }
html[data-ursy-theme='dark'] .ursy-recommendation-card { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-sleep { background: linear-gradient(135deg,var(--card),var(--ursy-teal-soft))!important; }
html[data-ursy-theme='dark'] .ursy-sleep-toolbar { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-sleep-card { background: linear-gradient(180deg, var(--card), var(--card)); }
html[data-ursy-theme='dark'] .ursy-world { background: linear-gradient(135deg,var(--card),var(--ursy-info-soft))!important; }
html[data-ursy-theme='dark'] .ursy-country-signal { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-country-summary article { background: linear-gradient(180deg, var(--card), var(--card)); }
html[data-ursy-theme='dark'] .ursy-world [data-ursy-country-panel] { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-europe-foundations { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-country-foundation { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-world-atlas { background: linear-gradient(135deg,var(--card),var(--card)); }
html[data-ursy-theme='dark'] .ursy-atlas-language { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-atlas-card { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-atlas-audit { background: linear-gradient(135deg,var(--card),var(--card)); }
html[data-ursy-theme='dark'] .ursy-atlas-audit[data-ursy-audit-state="PRIMARY_SOURCE_GAP_RECORDED"],
html[data-ursy-theme='dark'] .ursy-atlas-audit[data-ursy-audit-state="REVIEWED_WITH_SAFETY_GAP"] { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-legal { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-legal details { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-player { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-player-visual { background: radial-gradient(circle at 28% 25%,var(--card) 0 8%,transparent 9%),linear-gradient(145deg,var(--card),#ed8d43 58%,#9f471f); }
html[data-ursy-theme='dark'] .ursy-now-playing>div { background: var(--card); }
html[data-ursy-theme='dark'] body.ursy-app-page { background: var(--bg); }
html[data-ursy-theme='dark'] .ursy-directory-results li,
html[data-ursy-theme='dark'] .ursy-podcast-results li { background: linear-gradient(180deg, var(--card), var(--card)); }
html[data-ursy-theme='dark'] .ursy-button { background: linear-gradient(180deg, var(--card), var(--card)); }
html[data-ursy-theme='dark'] .ursy-directory-search input,
html[data-ursy-theme='dark'] .ursy-podcast-search input,
html[data-ursy-theme='dark'] .ursy-france-search input,
html[data-ursy-theme='dark'] .ursy-search input,
html[data-ursy-theme='dark'] #ursy-search-input,
html[data-ursy-theme='dark'] .ursy-directory-search select,
html[data-ursy-theme='dark'] .ursy-podcast-search select,
html[data-ursy-theme='dark'] .ursy-france-search select,
html[data-ursy-theme='dark'] .ursy-timer-controls select,
html[data-ursy-theme='dark'] .ursy-planner-toolbar select { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-preview-status { background: linear-gradient(90deg, var(--ursy-accent-soft), var(--card) 60%); }
html[data-ursy-theme='dark'] .ursy-occurrences > li { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-recommendation-grid > *,
html[data-ursy-theme='dark'] .ursy-library-items > li { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-legal-grid > * { background: linear-gradient(180deg,var(--card),var(--card)); }
html[data-ursy-theme='dark'] #ursy-local { background: linear-gradient(180deg,var(--card),var(--card)); }
html[data-ursy-theme='dark'] .ursy-empty { background: var(--card); }
html[data-ursy-theme='dark'] #ursy-account .ursy-account-grid > *,
html[data-ursy-theme='dark'] .ursy-account-card { background: linear-gradient(180deg,var(--card),var(--card)); }
html[data-ursy-theme='dark'] .ursy-app .ursy-family-header { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-live__field input[type="search"],
html[data-ursy-theme='dark'] .ursy-live__field select { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-live__toggle { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-live__chip { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-live-card { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-live-card[aria-current="true"] { background: linear-gradient(180deg, var(--card), var(--card)); }
html[data-ursy-theme='dark'] .ursy-live__more { background: var(--card); }
html[data-ursy-theme='dark'] .ursy-live-modal__close { background: var(--card); }

/* --- inks: 16 selectors --- */
html[data-ursy-theme='dark'] .ursy-family-primary a { color: color-mix(in srgb, #ffffff 58%, #494c50); }
html[data-ursy-theme='dark'] .ursy-badge,
html[data-ursy-theme='dark'] .ursy-status { color: color-mix(in srgb, #ffffff 58%, #45484b); }
html[data-ursy-theme='dark'] .ursy-search label,
html[data-ursy-theme='dark'] .ursy-directory-search>label,
html[data-ursy-theme='dark'] .ursy-podcast-search>label,
html[data-ursy-theme='dark'] .ursy-france-search>label,
html[data-ursy-theme='dark'] .ursy-europe-search>label,
html[data-ursy-theme='dark'] .ursy-atlas-search>label,
html[data-ursy-theme='dark'] .ursy-atlas-language>label { color: color-mix(in srgb, #ffffff 58%, #3c4043); }
html[data-ursy-theme='dark'] .ursy-podcast-safety,
html[data-ursy-theme='dark'] .ursy-sleep-disclaimer,
html[data-ursy-theme='dark'] .ursy-country-boundary,
html[data-ursy-theme='dark'] .ursy-legal-gate { color: color-mix(in srgb, #ffffff 58%, #5b4a22); }
html[data-ursy-theme='dark'] .ursy-podcast-safety strong,
html[data-ursy-theme='dark'] .ursy-sleep-disclaimer strong,
html[data-ursy-theme='dark'] .ursy-country-boundary strong,
html[data-ursy-theme='dark'] .ursy-legal-gate strong { color: color-mix(in srgb, #ffffff 58%, #674600); }
html[data-ursy-theme='dark'] .ursy-atlas-audit summary { color: color-mix(in srgb, #ffffff 58%, #733b17); }
html[data-ursy-theme='dark'] .ursy-atlas-audit__state { color: color-mix(in srgb, #ffffff 58%, #733b17); }
html[data-ursy-theme='dark'] .ursy-atlas-boundary { color: color-mix(in srgb, #ffffff 58%, #173f73); }
html[data-ursy-theme='dark'] .ursy-status--play { color: color-mix(in srgb, #ffffff 58%, #0f5c28); }
html[data-ursy-theme='dark'] .ursy-status--official-link { color: color-mix(in srgb, #ffffff 58%, #17457f); }
html[data-ursy-theme='dark'] .ursy-country-boundary,
html[data-ursy-theme='dark'] .ursy-sleep-disclaimer,
html[data-ursy-theme='dark'] .ursy-podcast-safety { color: color-mix(in srgb, #ffffff 58%, #5a4300); }
html[data-ursy-theme='dark'] .ursy-live-card__meta { color: color-mix(in srgb, #ffffff 58%, #6b7784); }
html[data-ursy-theme='dark'] .ursy-live-card__badge { color: color-mix(in srgb, #ffffff 58%, #0f8fc4); }
html[data-ursy-theme='dark'] .ursy-live-card__badge--ext { color: color-mix(in srgb, #ffffff 58%, #7d8894); }
html[data-ursy-theme='dark'] .ursy-live-card[aria-current="true"] .ursy-live-card__art { color: color-mix(in srgb, #ffffff 58%, #04222f); }
html[data-ursy-theme='dark'] .ursy-live-modal__close { color: color-mix(in srgb, #ffffff 58%, #202124); }

/* --- accent used as text: 25 selectors --- */
html[data-ursy-theme='dark'] .ursy-family-wordmark small { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent)); }
html[data-ursy-theme='dark'] .ursy-family-account>a { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
html[data-ursy-theme='dark'] .ursy-preview-status strong { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
html[data-ursy-theme='dark'] .ursy-eyebrow { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
html[data-ursy-theme='dark'] .ursy-nav a[aria-current="location"] { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
html[data-ursy-theme='dark'] .ursy-overview-grid strong,
html[data-ursy-theme='dark'] .ursy-overview-card strong { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
html[data-ursy-theme='dark'] .ursy-account-gates summary { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
html[data-ursy-theme='dark'] .ursy-detail summary { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
html[data-ursy-theme='dark'] .ursy-legal details[open] summary { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
html[data-ursy-theme='dark'] .ursy-player-time { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
html[data-ursy-theme='dark'] .ursy-volume output { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
html[data-ursy-theme='dark'] .ursy-footer nav a:hover { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
html[data-ursy-theme='dark'] .ursy-eyebrow::before { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent)); }
html[data-ursy-theme='dark'] .ursy-badge { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
html[data-ursy-theme='dark'] .ursy-nav a:hover { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
html[data-ursy-theme='dark'] .ursy-directory-results li a,
html[data-ursy-theme='dark'] .ursy-podcast-results li a { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
html[data-ursy-theme='dark'] .ursy-view:hover:not(.is-active) { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
html[data-ursy-theme='dark'] .ursy-app .ursy-family-primary a:hover { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
html[data-ursy-theme='dark'] .ursy-live__toggle:hover { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
html[data-ursy-theme='dark'] .ursy-live__chip:hover { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
html[data-ursy-theme='dark'] .ursy-live-card__fav:hover { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
html[data-ursy-theme='dark'] .ursy-live__more:hover { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
html[data-ursy-theme='dark'] .ursy-live-ext:hover { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
html[data-ursy-theme='dark'] .ursy-live-card__fav.is-on { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent)); }
html[data-ursy-theme='dark'] .ursy-live-save.is-on { color: color-mix(in srgb, #ffffff 40%, var(--ursy-accent-deep)); }
