/* Semantic palette for opt-in surfaces. Unconverted pages keep their existing styles. */
html[data-theme-enabled] {
    color-scheme: light;
    --theme-bg: #faf7f0;
    --theme-surface: #fffdf8;
    --theme-raised: #f3eadc;
    --theme-text: #302a25;
    --theme-muted: #6b6055;
    --theme-border: #d9cbb5;
    --theme-accent: #594270;
    --theme-gold: #826035;
    --theme-input: #fffefa;
    --theme-action: #62377a;
    --theme-on-action: #fff6e5;
}
html[data-theme-enabled][data-theme="dark"] {
    color-scheme: dark;
    --theme-bg: #1b1522;
    --theme-surface: #261e30;
    --theme-raised: #33283e;
    --theme-text: #f4ead8;
    --theme-muted: #c1b4c8;
    --theme-border: #65516f;
    --theme-accent: #d2afe8;
    --theme-gold: #e0bb70;
    --theme-input: #241c2e;
    --theme-action: #76518b;
}
.theme-control[hidden] { display: none !important; }
.theme-control { order: 2; flex: 0 0 auto; }
html[data-theme-enabled] .luminous-navbar .navbar-collapse { order: 1; }
.theme-toggle { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--theme-border); border-radius: 8px; background: var(--theme-surface); color: var(--theme-accent); }
.theme-control .dropdown-menu { min-width: 180px; }
.theme-control .dropdown-item { gap: 10px; }
.theme-control .dropdown-item[aria-pressed="true"] { font-weight: 750; box-shadow: inset 3px 0 var(--theme-gold); }
.theme-control button:focus-visible { outline: 3px solid var(--theme-gold); outline-offset: 3px; }
@media (max-width: 1199.98px) {
    html[data-theme-enabled] .luminous-navbar .luminous-nav-shell { gap: 6px; }
    .theme-control { order: 0; margin-left: auto; }
    html[data-theme-enabled] .luminous-navbar .navbar-toggler { order: 1; }
    html[data-theme-enabled] .luminous-navbar .navbar-collapse { order: 3; }
    html[data-theme-enabled] .theme-control .dropdown-menu { position: absolute; width: 180px; right: 0; left: auto; }
}
@media (max-width: 575px) {
    html[data-theme-enabled] .luminous-navbar .navbar-brand { font-size: .85rem; gap: 6px; }
    html[data-theme-enabled] .luminous-navbar .navbar-brand img { width: 28px; height: 28px; }
    html[data-theme-enabled] .luminous-navbar .navbar-toggler { width: 44px; padding: 6px; }
}
/* Bootstrap-backed controls and dialogs shared by all opted-in pages. */
html[data-theme-enabled][data-theme="dark"] body :is(.modal-content, .dropdown-menu, .list-group-item) { background-color: var(--theme-surface); color: var(--theme-text); border-color: var(--theme-border); }
html[data-theme-enabled][data-theme="dark"] body :is(.modal-header, .modal-footer, .dropdown-divider) { border-color: var(--theme-border); }
html[data-theme-enabled][data-theme="dark"] body :is(.form-control, .form-select, .input-group-text) { background-color: var(--theme-input); color: var(--theme-text); border-color: var(--theme-border); }
html[data-theme-enabled][data-theme="dark"] body :is(input, textarea)::placeholder { color: var(--theme-muted); opacity: 1; }
html[data-theme-enabled][data-theme="dark"] body .form-select { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23f4ead8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); }
html[data-theme-enabled][data-theme="dark"] body .text-muted { color: var(--theme-muted) !important; }
html[data-theme-enabled][data-theme="dark"] body .text-dark { color: var(--theme-text) !important; }
html[data-theme-enabled][data-theme="dark"] body :is(.bg-light, .bg-white) { background-color: var(--theme-raised) !important; }
html[data-theme-enabled][data-theme="dark"] body .btn-close { filter: invert(1); }
html[data-theme-enabled][data-theme="dark"] body :is(.btn-outline-secondary, .btn-outline-primary, .btn-link) { color: var(--theme-accent); border-color: var(--theme-border); }
html[data-theme-enabled][data-theme="dark"] body :is(.form-control, .form-select):focus { border-color: var(--theme-gold); box-shadow: 0 0 0 3px #e0bb7033; }
