/* Optional light palette. The original dark palette remains the default. */
:root { color-scheme: dark; }

.au-theme-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.au-theme-toggle {
    --theme-scale: var(--film-page-scale, var(--au-scale));
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: calc(44px / var(--theme-scale));
    height: calc(44px / var(--theme-scale));
    padding: 0;
    border: 1px solid rgba(185, 166, 255, .22);
    border-radius: 50%;
    background: var(--au-surface);
    color: var(--au-text);
    cursor: pointer;
}
.au-theme-toggle:hover { border-color: var(--au-accent); }
.au-theme-toggle svg { display: block; width: 20px; height: 20px; }
.au-theme-toggle .au-theme-moon { display: none; }
.au-theme-toggle[aria-pressed="true"] .au-theme-sun { display: none; }
.au-theme-toggle[aria-pressed="true"] .au-theme-moon { display: block; }
.au-bar { min-height: 56px; }
.kl-bar-end:has(.au-theme-toggle) { gap: 8px; }
@media (max-width: 359px) {
    .au-theme-actions { gap: 6px; }
    .kl-bar-end:has(.au-theme-toggle) { gap: 6px; }
}
@media (prefers-reduced-motion: no-preference) {
    .au-theme-toggle { transition: background .2s ease, color .2s ease, border-color .2s ease; }
}

:root[data-theme="light"] {
    color-scheme: light;
    --au-bg: #F7F7FC;
    --au-surface: #FFFFFF;
    --au-text: #252338;
    --au-muted: #625E77;
    --au-muted-2: #69647D;
    --au-dim: #726D85;
    --au-accent: #6255C9;
    --au-violet: #7950C4;
    --au-deep: #5144B4;
    --au-lavender: #7258B5;
    --au-pale: #DED9F4;
    --au-live: #C72D58;
    --au-ring-lime: #5543B5;
    --theme-border: rgba(72, 57, 118, .16);
    --theme-panel: rgba(255, 255, 255, .82);
    --theme-shadow: 0 16px 48px rgba(54, 38, 105, .08);
    --theme-heading: linear-gradient(100deg, #252338 0%, #514866 45%, #29243D 70%, #665B80 100%);
    --theme-serif: linear-gradient(100deg, #6255C9 0%, #8B59AF 45%, #5144B4 75%, #7950C4 100%);
}

:root[data-theme="light"] a:hover { color: var(--au-deep); }
:root[data-theme="light"] .au-star { background: #8674BA; }
:root[data-theme="light"] .au-theme-toggle { border-color: var(--theme-border); box-shadow: 0 3px 12px rgba(54, 38, 105, .05); }
:root[data-theme="light"] .au-bar {
    background: rgba(247, 247, 252, calc(.9 * var(--bar-fill, 0)));
    border-color: rgba(72, 57, 118, calc(.12 * var(--bar-fill, 0)));
}
:root[data-theme="light"] :is(.au-bar-live, .lib-live, .lib-pill, .live-email-input,
    .kl-sections-btn, .kl-code-input, .kl-ghost, .kl-sheet, .kl-tick-label, .kl-contents,
    .kl-dnode, .kl-cardlet, .kl-table-wrap, .kl-chip, .kl-cyc-node, .kl-cmp-panel,
    .kl-cmp-vs, .kl-flow-badge, .kl-part-point, .kl-check, .kl-files, .lib-next) {
    border-color: var(--theme-border);
    background: var(--theme-panel);
    color: var(--au-text);
}
:root[data-theme="light"] .kl-bar { background: rgba(247, 247, 252, .9); }
:root[data-theme="light"] .kl-sheet-back { background: rgba(47, 36, 77, .24); }
:root[data-theme="light"] :is(.kl-dnode, .kl-cyc-node, .kl-files) { box-shadow: var(--theme-shadow); }
:root[data-theme="light"] :is(.lib-pill[aria-pressed="true"], .kl-sheet-item.is-on, .kl-dnode.is-gate) {
    background: #EDE9FA;
    border-color: #B4A7E4;
}
:root[data-theme="light"] .kl-prog { background: #DFD9ED; }
:root[data-theme="light"] .kl-tick::before { background: #C1B7D8; }
:root[data-theme="light"] .kl-tick:is(.is-on, :hover)::before { background: var(--au-accent); }
:root[data-theme="light"] .kl-unlock-card {
    background: radial-gradient(ellipse at 50% 0%, rgba(124, 103, 218, .08), transparent 64%), #FFF;
    border-color: var(--theme-border);
    box-shadow: var(--theme-shadow);
}
:root[data-theme="light"] .kl-locked-thumb { box-shadow: 0 12px 36px rgba(54, 38, 105, .12); }

/* Keep the original gradient travel and serif faces; change only their inks. */
:root[data-theme="light"] :is(.hero-grad, .kl-hero-word),
:root[data-theme="light"] .lib-h1-mask:first-child .lib-h1-line { background-image: var(--theme-heading); }
:root[data-theme="light"] .lib-h1-mask:last-child .lib-h1-line,
:root[data-theme="light"] .kl-hero-serif { background-image: var(--theme-serif); }
:root[data-theme="light"] :is(.kl-next-strong, .kl-hero-skip, .kl-chip-word,
    .kl-cap-serif, .kl-dnode-mark, .kl-cardlet-tag, .kl-callout-title, .kl-th, .kl-cmp-tag,
    .builds-guide-tag, .builds-guide-bars, .lib-narrator-tag, .lib-narrator-bars,
    .lib-narrator-words, .hero-builds, .au-bar-kicker, .lib-live-kicker) { color: var(--au-accent); }
:root[data-theme="light"] :is(.kl-dlabel, .kl-blk-li, .kl-callout-body, .kl-td, .kl-nova-line,
    .kl-cmp-line, .kl-chip-label, .kl-part-point, .kl-files-name, .kl-file, .kl-ghost, .builds-guide-line, .builds-guide-name,
    .lib-narrator-line, .live-follow) { color: var(--au-muted); }
:root[data-theme="light"] #how-h .au-serif,
:root[data-theme="light"] #builds-h .au-serif,
:root[data-theme="light"] .live-title .au-serif { color: var(--au-accent); }
:root[data-theme="light"] :is(.live-pill, .live-email-error) { color: #A82049; }
:root[data-theme="light"] .kl-callout.is-warn .kl-callout-title { color: #92520E; }
:root[data-theme="light"] .kl-callout.is-warn { border-color: #D7B78C; background: #FFF7EB; }
:root[data-theme="light"] :is(.kl-th, .kl-td, .kl-file, .kl-files-head) { border-color: var(--theme-border); }
:root[data-theme="light"] :is(.kl-pill, .kl-code-btn, .kl-cta:not(.kl-dl-btn)) {
    background: linear-gradient(180deg, #7969DF, #6255C9);
    color: #FFF;
}
:root[data-theme="light"] :is(.kl-ddot, .kl-cyc-dot, .kl-flow-packet) { background: var(--au-accent); }
:root[data-theme="light"] .kl-chip-word { background: #EDE9FA; }
:root[data-theme="light"][data-nova-talk-switch="off"] .hero-builds { color: #0A0A1A; }
:root[data-theme="light"] :is(.kl-dl-btn, .hero-talk, .builds-talk, .live-talk, .live-email-button, .lib-talk):hover { color: #0A0A1A; }

/* Use the supplied light artwork at its original colors. White paper blends
   into the canvas; native images and flying pixels share that same treatment. */
:root[data-theme="light"] :is(.nova-stage, .builds-star, .live-star, .lib-nova-frame, [data-film-pieces]) {
    --au-bg: #FFFFFF;
    filter: none;
    mix-blend-mode: multiply;
}
:root[data-theme="light"] .nova-breathe > img,
:root[data-theme="light"] [data-film] #builds .builds-star-fig > img {
    filter: none;
    mix-blend-mode: multiply;
}
:root[data-theme="light"] .lib-cta-frame img { mix-blend-mode: multiply; }
:root[data-theme="light"] :is(.lib-cta, .lib-cta-frame) {
    background: var(--theme-panel);
    border-color: var(--theme-border);
    box-shadow: var(--theme-shadow);
}
:root[data-artwork-ready="false"] :is(.nova-stage, .builds-star, .live-star,
    .lib-nova-frame, .lib-cta-frame, [data-film-pieces], [data-film-dots]) { visibility: hidden; }
:root[data-theme="light"] [data-film-dots] { filter: invert(1) hue-rotate(180deg); }
:root[data-theme="light"] .film-vignette { background: radial-gradient(ellipse 75% 70% at 50% 45%, transparent 55%, rgba(213, 205, 235, .18)); }
:root[data-theme="light"] .film-streak { background: linear-gradient(180deg, transparent, rgba(107, 87, 173, .7), transparent); }
:root[data-theme="light"] .film-shoot { filter: invert(1) hue-rotate(180deg); }

/* Thumbnail photography and terminal examples retain their own dark canvas. */
:root[data-theme="light"] :is(.lib-card, .builds-card, .kl-term) {
    --au-text: #ECECF4;
    --au-muted: #A3A3B8;
    --au-muted-2: #AAA6C4;
    --au-accent: #A89DFF;
    --au-dim: #A3A3B8;
}
:root[data-theme="light"] :is(.lib-card, .builds-card) { color: var(--au-text); }
:root[data-theme="light"] :is(.lib-card, .builds-card) a:hover { color: var(--au-text); }
:root[data-theme="light"] :is(.lib-card, .builds-card).is-marked { box-shadow: 0 16px 38px rgba(54, 38, 105, .18); }
:root[data-theme="light"] .au-debug-panel { color: var(--au-text); }

:root[data-theme="light"] .nova-voice :is(.nova-voice-close, .nova-voice-card,
    .nova-voice-chip, .nova-voice-form, .nova-voice-end) {
    border-color: var(--theme-border);
    background: var(--theme-panel);
    color: var(--au-text);
}
