/* Dark appearance for the signed-in web app (islands/app, /home/**).

   Applies only under <html data-theme="dark">, which public/js/theme.js sets
   from the reader's Settings > Appearance choice before the first paint. With
   Light (the default) not one rule here matches, so the page is exactly the
   light page it was.

   Why an override sheet and not dark: variants: the web's Tailwind palette is
   fixed light values (tailwind.config.js, generated), shared with the marketing
   site, which stays light. Remapping the handful of utilities the app uses
   here costs no island bundle bytes (the app's gzip budget is nearly full).

   Colours are @mdb/design-tokens' dark pairs, the same as rn-app's Dark:
     primaryBackground #1C1C1E   secondaryBackground #2C2C2E
     primaryText       #F2F2F7   divider             #3A3A3C
     accent (dark)     #B591DE
   Muted greys follow the iOS dark system greys so secondary text still
   reads at 4.5:1 or better on #2C2C2E.

   Kept deliberately: text-white and the black scrims over artwork (hero
   images, tiles), and the map's own light tiles (OpenFreeMap liberty). */

html[data-theme="dark"] {
  color-scheme: dark;
  /* Off a themed page, ui.ts `tone` falls back to these. */
  --page-accent-ink: #B591DE;
  /* design-tokens.css vars, for anything reading them. */
  --color-primary-bg: #1C1C1E;
  --color-secondary-bg: #2C2C2E;
  --color-primary-text: #F2F2F7;
  --color-accent: #B591DE;
  --color-accent-dark: #8A5FC0;
  --color-accent-light: #CBAEE8;
  --color-highlight: #B0B3C0;
  --color-divider: #3A3A3C;
}

/* A page with its own accent (AppPage, lib/accent.ts) carries the dark ink
   beside the light one; Dark swaps it in. !important beats the inline value. */
html[data-theme="dark"] [style*="--page-accent-ink-dark"] {
  --page-accent-ink: var(--page-accent-ink-dark) !important;
}

/* Page */
html[data-theme="dark"] body,
html[data-theme="dark"] .bg-primary-bg { background-color: #1C1C1E; }
html[data-theme="dark"] body { color: #F2F2F7; }

/* Surfaces */
html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .hover\:bg-white:hover { background-color: #2C2C2E; }
html[data-theme="dark"] .bg-white\/95 { background-color: rgb(44 44 46 / 0.95); }
html[data-theme="dark"] .bg-white\/90 { background-color: rgb(44 44 46 / 0.9); }
html[data-theme="dark"] .bg-white\/80 { background-color: rgb(28 28 30 / 0.8); }
html[data-theme="dark"] .bg-secondary-bg { background-color: #2C2C2E; }
html[data-theme="dark"] .bg-secondary-bg\/90 { background-color: rgb(44 44 46 / 0.9); }
html[data-theme="dark"] .bg-gray-50,
html[data-theme="dark"] .hover\:bg-gray-50:hover { background-color: #333336; }
html[data-theme="dark"] .bg-gray-100,
html[data-theme="dark"] .hover\:bg-gray-100:hover { background-color: #3A3A3C; }
html[data-theme="dark"] .bg-gray-200 { background-color: #48484A; }
html[data-theme="dark"] .bg-gray-300 { background-color: #636366; }
html[data-theme="dark"] .bg-amber-100 { background-color: rgb(245 158 11 / 0.18); }
/* The payment-problem banner (BillingIssueBanner). */
html[data-theme="dark"] .bg-red-50 { background-color: rgb(239 68 68 / 0.16); }
html[data-theme="dark"] .text-red-900 { color: #FECACA; }
html[data-theme="dark"] .border-red-300 { border-color: rgb(248 113 113 / 0.5); }

/* The inverse chip (Calendar's "today" marker) flips with the palette. */
html[data-theme="dark"] .bg-primary-text { background-color: #F2F2F7; }
html[data-theme="dark"] .text-primary-bg { color: #1C1C1E; }
html[data-theme="dark"] .bg-primary-text\/5 { background-color: rgb(242 242 247 / 0.05); }
html[data-theme="dark"] .bg-primary-text\/10,
html[data-theme="dark"] .hover\:bg-primary-text\/10:hover { background-color: rgb(242 242 247 / 0.1); }
html[data-theme="dark"] .bg-primary-text\/\[0\.03\],
html[data-theme="dark"] .hover\:bg-primary-text\/\[0\.03\]:hover { background-color: rgb(242 242 247 / 0.04); }

/* Text */
html[data-theme="dark"] .text-primary-text,
html[data-theme="dark"] .hover\:text-primary-text:hover,
html[data-theme="dark"] .text-gray-900 { color: #F2F2F7; }
html[data-theme="dark"] .text-gray-700 { color: #E5E5EA; }
html[data-theme="dark"] .text-gray-600 { color: #C7C7CC; }
html[data-theme="dark"] .text-gray-500 { color: #AEAEB2; }
html[data-theme="dark"] .text-gray-400 { color: #98989D; }
html[data-theme="dark"] .text-gray-300 { color: #8E8E93; }
html[data-theme="dark"] .text-accent,
html[data-theme="dark"] .hover\:text-accent:hover { color: #B591DE; }
html[data-theme="dark"] .text-accent-dark,
html[data-theme="dark"] .hover\:text-accent-dark:hover { color: #CBAEE8; }
html[data-theme="dark"] .text-red-600 { color: #EF5350; }
html[data-theme="dark"] .text-green-700 { color: #81C784; }
html[data-theme="dark"] .text-amber-600 { color: #FFB74D; }
html[data-theme="dark"] .text-daily-reflections { color: #E07A98; }
html[data-theme="dark"] .text-daily-readings { color: #A9ABC6; }
html[data-theme="dark"] .text-bible { color: #7CC0D3; }
html[data-theme="dark"] .text-map-green { color: #9CCC65; }

/* Lines */
html[data-theme="dark"] .border-gray-100,
html[data-theme="dark"] .border-gray-200,
html[data-theme="dark"] .divide-gray-100 > :not([hidden]) ~ :not([hidden]) { border-color: #3A3A3C; }
html[data-theme="dark"] .border-gray-300,
html[data-theme="dark"] .border-gray-400 { border-color: #636366; }
html[data-theme="dark"] .border-white { border-color: #1C1C1E; }
html[data-theme="dark"] .ring-gray-200,
html[data-theme="dark"] .ring-gray-300 { --tw-ring-color: #48484A; }

/* Form fields */
html[data-theme="dark"] input:not([type="radio"]):not([type="checkbox"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea { background-color: #2C2C2E; color: #F2F2F7; border-color: #48484A; }
html[data-theme="dark"] ::placeholder { color: #98989D; }

/* The app bar, launcher and Home search (shared-components.js APP_HEADER_CSS,
   which pins light values). */
html[data-theme="dark"] .mdb-appbar { background-color: rgb(28 28 30 / 0.85); border-color: #3A3A3C; }
html[data-theme="dark"] .mdb-launch-btn { color-scheme: dark; color: #F2F2F7; background: #2C2C2E; }
html[data-theme="dark"] .mdb-launch-btn:hover,
html[data-theme="dark"] .mdb-launch-btn[aria-expanded="true"] { color: #B591DE; }
html[data-theme="dark"] .mdb-launcher { color-scheme: dark; background: #2C2C2E; border-color: #3A3A3C; box-shadow: 0 20px 40px -12px rgba(0, 0, 0, .7); }
html[data-theme="dark"] .mdb-launch-tile { color: #F2F2F7; }
html[data-theme="dark"] a.mdb-launch-tile:hover,
html[data-theme="dark"] .mdb-launch-tile[aria-current="page"] { background: #3A3A3C; color: #CBAEE8; }
html[data-theme="dark"] .mdb-launch-art { background: #3A3A3C; }
html[data-theme="dark"] .mdb-launch-soon { color: #98989D; }
html[data-theme="dark"] .mdb-home-search { color-scheme: dark; }
html[data-theme="dark"] .mdb-home-search-icon { color: #AEAEB2; }
html[data-theme="dark"] #mdb-home-search { background: #2C2C2E; color: #F2F2F7; border-color: #48484A; }
html[data-theme="dark"] #mdb-home-search::placeholder { color: #AEAEB2; }
html[data-theme="dark"] #mdb-home-search:focus { background: #1C1C1E; border-color: #B591DE; box-shadow: 0 0 0 2px #B591DE; }
html[data-theme="dark"] .mdb-appfooter { border-color: #3A3A3C; }

/* Settings > Appearance: the segmented control (routes/Settings.tsx). Its
   track and card would both be #2C2C2E, so the track sinks and the chosen
   segment lifts. */
html[data-theme="dark"] .mdb-seg { background-color: #1C1C1E; }
html[data-theme="dark"] .mdb-seg-on { background-color: #48484A; }

/* The cookie banner (consent.js) styles itself inline, hence !important. */
html[data-theme="dark"] #mdb-consent-banner { background: #2C2C2E !important; color: #F2F2F7 !important; border-top-color: #3A3A3C !important; box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.6) !important; }
html[data-theme="dark"] #mdb-consent-banner a { color: #CBAEE8 !important; }
html[data-theme="dark"] #mdb-consent-banner button:first-child { color: #F2F2F7 !important; border-color: rgba(255, 255, 255, 0.28) !important; }
