/*
 * Fixes from the dark theme and appearance audit (docs/dark-theme-audit-2026-12-03.md). This sheet is linked after every other
 * one, because several rules have to follow the `background` shorthands they complete. The numbers are the audit's findings.
 * Regression tests: tests/e2e/dark-fixes.spec.js.
 */

/* 1. The canvas takes the body's background colour. The backdrop is only a gradient, so the colour was transparent and the
   reserved scrollbar gutter (html{scrollbar-gutter:stable}) showed as a white strip. Each colour is taken from the backdrop it
   sits beside; a wallpaper without its own line gets the default one. */
body.framed { background-color: #c6cbd3; }
body.dark.framed { background-color: #171b24; }
html body.framed[data-wallpaper] { background-color: #c6cbd3; }
html body.dark.framed[data-wallpaper] { background-color: #171b24; }
html body.framed[data-wallpaper="dusk"] { background-color: #d99ab8; }
html body.dark.framed[data-wallpaper="dusk"] { background-color: #2d2150; }
html body.framed[data-wallpaper="harbor"] { background-color: #5ea3c4; }
html body.dark.framed[data-wallpaper="harbor"] { background-color: #0f2f3e; }
html body.framed[data-wallpaper="meadow"] { background-color: #d4ebf4; }
html body.dark.framed[data-wallpaper="meadow"] { background-color: #152b3c; }
html body.framed[data-wallpaper="slate"] { background-color: #6f7c92; }
html body.dark.framed[data-wallpaper="slate"] { background-color: #20262f; }
html body.framed[data-wallpaper="plain"] { background-color: #d9dde4; }
html body.dark.framed[data-wallpaper="plain"] { background-color: #12151b; }

/* 4. Until frame-boot.js has chosen the theme, theme-head.js marks a dark visit on <html> (it removes nothing and saves
   nothing; frame-boot.js takes the mark away). The minimum height stops the early backdrop, painted while the body is still
   empty, from repeating in bands. */
html.bootDark body.framed:not(.dark) { background: #171b24; }
body.framed { min-height: 100vh; min-height: 100dvh; }

/* 5. The page's own scrollbar follows the theme (only <body> switched its colour scheme). */
html:has(body.dark) { color-scheme: dark; }

/* 2. White on the light dark-theme accent was 1.97:1. The Contacts tile keeps its own colours (a more specific rule). */
body.dark .primary { background: #176ad1; color: #fff; }

/* 3. The map popup is white in both themes, so the category chip is mixed with white, not with the dark paper. */
.mapCanvas6 .pitCard .pitChip { background: color-mix(in srgb, var(--pit, #44546a) 14%, #fff); border-color: color-mix(in srgb, var(--pit, #44546a) 55%, #fff); }

/* 6. Placeholders in dark windows, the Apps launcher and Spotlight. Scoped so the light sticky notes keep their own. */
body.dark .app5 input::placeholder,
body.dark .v06-search input::placeholder { color: var(--muted); opacity: 1; }

/* 7. The card under the pit stop list (shown when the map cannot load) is not on white. */
.pitDetail .pit-popup .pitLink { color: var(--accent-ink, #0f4fa8); }

/* 8. Selected Finder items, and the same selection inside Overview thumbnails (where the buttons are no longer buttons). */
.dark .side5 .on, .dark .file5.on, .dark .file5.on b { color: var(--accent-ink); }

/* 9. Mail: the "Delete N items now" confirmation. */
.dark .mailEmptyTrash.confirm { color: #ff8a93; }

/* 10. A dark Glass window keeps the Flat window's edge; 60% of the paper colour was invisible on the dark desktop. */
body.dark[data-surface="glass"] .osWindow { border-color: #727c8b4a; }
