/* The room's light on Composer (mix.html), Live Nature (nature.html) and the tape library's pages. The choice is made on the
   welcome page (Menu → Room light, or the clock when it is Auto) and kept in localStorage
   'welcome-room-light'; each page's head script reads it before first paint and sets
   html[data-room-light]. Daylight is each page as it was. Photographs, bird and instrument art,
   the noise swatches and the gift cassette keep their own colours.

   Both pages draw most colour from tokens (Composer: --studio-* over --welcome-*; Live Nature:
   --ink, --muted, --line, --accent), so night redefines those and then the few surfaces each page
   draws in fixed white. Every override names its base selector, so the pressed and hover states keep
   their order over the resting ones. */

/* Dusk: warm paper behind white cards. */
html[data-room-light=dusk]{--welcome-surface:#f3ebe0;background:#f3ebe0}
html[data-room-light=dusk] .studio-header{background:#f3ebe0}

/* Night: the same dark room as the welcome page. The shared controls (css/tapehouse-controls.css:
   Main page, the library and filter buttons, Save, Play, the Live Nature chips) draw from --th-*. */
html[data-room-light=night]{color-scheme:dark;background:#0e0f13;
 --welcome-surface:#101218;--welcome-ink:#ece6da;--welcome-muted:#a59f94;--welcome-accent:#e48b52;
 --studio-muted:#a59f94;--studio-line:#ffffff24;--studio-soft:#ffffff0a;
 --ink:#ece6da;--muted:#a59f94;--line:#ffffff24;--accent:#e48b52;
 --th-ink:#ece6da;--th-surface:#1a1d25;--th-muted:#a59f94;--th-accent:#e48b52;--th-line:#ffffff26}

/* Composer: cards, panels, menus and inputs. */
html[data-room-light=night] .studio-header,
html[data-room-light=night] .studio-header nav,
html[data-room-light=night] .studio-menu-button,
html[data-room-light=night] .studio-search,
html[data-room-light=night] .studio-source-card,
html[data-room-light=night] .studio-source-card[aria-pressed=true],
html[data-room-light=night] .studio-source-art[data-kind=tone]>span,
html[data-room-light=night] .studio-starter,
html[data-room-light=night] .studio-saved-row,
html[data-room-light=night] .studio-mix,
html[data-room-light=night] .studio-signature,
html[data-room-light=night] .studio-layer,
html[data-room-light=night] .studio-mobile-dialog .studio-layer,
html[data-room-light=night] .studio-timer select,
html[data-room-light=night] .studio-save input,
html[data-room-light=night] .studio-mobile-dialog,
html[data-room-light=night] .studio-dialog-close,
html[data-room-light=night] .studio-mobile-category,
html[data-room-light=night] .studio-mobile-category select,
html[data-room-light=night] .studio-noscript{background:#161921}
html[data-room-light=night] .studio-mobile-bar{background:#161921f5}
/* The plain and tone art tiles; noise swatches, photographs and objects keep their own. */
html[data-room-light=night] .studio-source-art:not([data-kind]),
html[data-room-light=night] .studio-source-art[data-kind=tone]{background:#ffffff08}
html[data-room-light=night] .studio-source-art[data-kind=object]{background:#1d2028}
html[data-room-light=night] .studio-tone-ring{border-color:#ffffff2b}
html[data-room-light=night] :is(.studio-mix,.studio-workspace>.studio-mix,.studio-mobile-dialog .studio-mix){box-shadow:0 4px 18px #00000059}
html[data-room-light=night] .studio-header nav{box-shadow:0 12px 34px #00000080}
/* Hover and focus tints, mixed into the night card instead of white (never on a pressed button,
   which keeps the shared cream fill). */
html[data-room-light=night] .studio-groups button:hover:not([aria-pressed=true]),
html[data-room-light=night] .studio-groups button:is(:hover,:focus-visible):not([aria-pressed=true]),
html[data-room-light=night] .studio-individual-filters button:is(:hover,:focus-visible):not([aria-pressed=true]),
html[data-room-light=night] #onlySelected:is(:hover,:focus-visible):not([aria-pressed=true]),
html[data-room-light=night] .studio-source-card:hover,
html[data-room-light=night] .studio-starter:hover,
html[data-room-light=night] .studio-layer-tools button[aria-pressed=true],
html[data-room-light=night] .studio-layer-tools button:is(:hover,:focus-visible),
html[data-room-light=night] .studio-save button:hover,
html[data-room-light=night] .studio-saved-actions button:is(:hover,:focus-visible),
html[data-room-light=night] .studio-dialog-close:is(:hover,:focus-visible),
html[data-room-light=night] .studio-header nav a:hover,
html[data-room-light=night] .studio-menu-button:is(:hover,:focus-visible),
html[data-room-light=night] .studio-player-link:is(:hover,:focus-visible){background:color-mix(in srgb,var(--studio-accent) 14%,#161921)}
/* Fills of the accent or the ink (cream at night) take dark text. */
html[data-room-light=night] :is(.studio-play,.studio-mobile-bar .studio-play,.studio-mobile-dialog .studio-play):not(:hover):not(:disabled),
html[data-room-light=night] .studio-toast,
html[data-room-light=night] .studio-toast button,
html[data-room-light=night] .studio-source-card[aria-pressed=true] .studio-source-toggle{color:#101218}
html[data-room-light=night] .studio-play:disabled{background:#ffffff08;border-color:#ffffff1f;color:#77736b}

/* Live Nature: cards, the transport bar and dialogs. */
html[data-room-light=night] .nature-transport,
html[data-room-light=night] .nature-card,
html[data-room-light=night] dialog:not(.mix-gift){background:#161921}
html[data-room-light=night] .nature-play:not(:hover):not(:disabled){color:#101218}
html[data-room-light=night] .nature-art{background:#e4e2db}
html[data-room-light=night] .nature-check{background:#161921ed;border-color:#ffffff33}
html[data-room-light=night] .nature-card[data-selected=true] .nature-check{color:#101218}
html[data-room-light=night] :is(.nature-status[data-error=true],#natureSaveError){color:#f08a6c}
html[data-room-light=night] .nature-player-link:is(:hover,:focus-visible){background:color-mix(in srgb,var(--accent) 14%,#161921)}

/* The light switch at the end of each page's navigation (js/room-light-switch.js): the same choice
   as the welcome menu's Room light. */
.room-light-switch{display:inline-flex;align-items:center;gap:7px;font:inherit;color:inherit;white-space:nowrap}
.room-light-switch>span{font-size:10px;letter-spacing:.03em;color:var(--studio-muted,var(--muted,#686b64))}
.room-light-switch select{min-height:30px;padding:4px 8px;border:1px solid var(--studio-line,var(--line,#191a1624));border-radius:8px;background:var(--studio-paper,#fff);color:var(--studio-ink,var(--ink,#191a16));font:500 11px/1.2 'DM Sans',Arial,sans-serif;cursor:pointer}
.room-light-switch select:focus-visible{outline:2px solid var(--studio-accent,var(--accent,#C64D20));outline-offset:2px}
html[data-room-light=night] .room-light-switch select{background:#161921}
html[data-room-light=dusk] .room-light-switch select{background:#fffaf3}
.room-light-switch__icon{display:none}
.room-light-switch__icon svg{display:block;width:18px;height:18px}
.room-light-switch__icon g{display:none}
html:not([data-room-light=dusk]):not([data-room-light=night]) .room-light-switch__icon g[data-light=day],
html[data-room-light=dusk] .room-light-switch__icon g[data-light=dusk],
html[data-room-light=night] .room-light-switch__icon g[data-light=night]{display:inline}
/* Composer's phone menu: its name over a full-width select, under the links. */
@media(max-width:600px){
 .studio-header nav .room-light-switch{flex-direction:column;align-items:stretch;gap:6px;margin-top:4px;padding:10px 12px 6px;border-top:1px solid var(--studio-line)}
 .studio-header nav .room-light-switch select{width:100%;min-height:40px}
}
/* Live Nature's phone header: a button in the empty top-right corner, the twin of the back button,
   showing the light now; the native picker sits over it, invisible, and its name stays for screen readers. */
@media(max-width:700px){
 .nature-header nav .room-light-switch{position:absolute;top:12px;right:16px;display:grid;place-items:center;width:44px;height:44px;box-sizing:border-box;border:1px solid var(--th-line,#d9dbd3);border-radius:var(--th-radius,9px);background:var(--th-surface,#fff);color:var(--th-ink,#21221e)}
 .nature-header nav .room-light-switch__name{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
 .nature-header nav .room-light-switch__icon{display:block}
 .nature-header nav .room-light-switch select{position:absolute;inset:0;width:100%;height:100%;min-height:0;margin:0;padding:0;border:0;opacity:0;cursor:pointer}
 .nature-header nav .room-light-switch:focus-within{outline:2px solid var(--th-accent,#C64D20);outline-offset:2px}
}

/* The Tape library, its five collections and every tape page (body.noise-library-page, written by
   tools/build_search_pages.py). Its colours are --noise-* tokens; the cassettes, photographs and the
   play buttons laid over them keep their own. */
html[data-room-light=dusk] body.noise-library-page{background:#f3ebe0}
html[data-room-light=night] body.noise-library-page{background:#0e0f13;
 --noise-ink:#ece6da;--noise-muted:#a59f94;--noise-border:#ffffff1f;--noise-accent:#e48b52;--noise-heart:#ef7f6c}
html[data-room-light=night] .noise-header .intro-tools-content,
html[data-room-light=night] .noise-header .intro-tools-content button,
html[data-room-light=night] .noise-search input,
html[data-room-light=night] .noise-filters button,
html[data-room-light=night] .noise-transport>button,
html[data-room-light=night] .noise-control select,
html[data-room-light=night] #noisePublicStats button{background:#161921}
html[data-room-light=night] .noise-header .intro-tools-content{box-shadow:0 8px 24px #00000080}
html[data-room-light=night] .noise-header .intro-stat-icon{color:#3cc0b4}
html[data-room-light=night] .noise-header .noise-menu-links a:hover{background:#e48b5214;color:#e48b52}
html[data-room-light=night] .noise-filters button[aria-pressed=true],
html[data-room-light=night] .tape-library-sections a[aria-current=page]{background:var(--noise-ink);border-color:var(--noise-ink);color:#101218}
html[data-room-light=night] .tape-library-sections a[aria-current=page] span{color:#4a463f}
html[data-room-light=night] .noise-transport>.noise-primary{background:var(--noise-accent);border-color:var(--noise-accent);color:#101218}
html[data-room-light=night] .noise-library-player{background:#161921f7;border-color:#ffffff1f;color:var(--noise-ink);box-shadow:0 8px 32px #00000099}
/* In the library's menu the switch is a preferences row, as on the welcome page. */
.room-light-switch--menu{display:flex;justify-content:space-between;gap:10px;padding:4px 0;font:500 11px/1.4 'DM Sans',Arial,sans-serif}
.room-light-switch--menu>.room-light-switch__name{font-size:11px;letter-spacing:0;color:inherit}
