/* Reusable theme support. Colors come from include/theme.php (theme_head()). */
:root {
    --accent-soft: rgba(var(--accent-rgb), .12);
    --accent-line: rgba(var(--accent-rgb), .35);
}

/* Theme dropdown (opens on hover, click or keyboard focus) */
.theme-menu { position: relative; display: inline-flex; }
.theme-toggle { display: inline-flex; align-items: center; gap: 7px; width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--muted); font: inherit; font-size: .8rem; font-weight: 500; transition: .15s; }
.theme-toggle:hover { color: var(--accent-text); border-color: var(--accent-line); }
.theme-toggle span { white-space: nowrap; }
.theme-caret { margin-left: auto; font-size: .7rem; transition: transform .15s; }
.theme-options { position: absolute; left: 0; right: 0; z-index: 20; display: none; min-width: 170px; max-height: min(70vh, 360px); margin: 0; padding: 6px; overflow-y: auto; list-style: none; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .55); }
.theme-menu--up .theme-options { bottom: 100%; margin-bottom: 6px; }
.theme-menu--down .theme-options { top: 100%; margin-top: 6px; }
.theme-menu::before { content: ""; position: absolute; left: 0; right: 0; height: 8px; }
.theme-menu--up::before { bottom: 100%; }
.theme-menu--down::before { top: 100%; }
.theme-menu:hover .theme-options, .theme-menu:focus-within .theme-options, .theme-menu.is-open .theme-options { display: block; }
.theme-menu.is-closed .theme-options { display: none !important; }
.theme-menu--up:hover .theme-caret, .theme-menu--up.is-open .theme-caret { transform: rotate(180deg); }
.theme-menu--down:hover .theme-caret, .theme-menu--down.is-open .theme-caret { transform: rotate(180deg); }
.theme-menu.is-closed .theme-caret { transform: none; }
.theme-options button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; font-size: .82rem; text-align: left; transition: background .12s; }
.theme-options button:hover { background: var(--panel-2); }
.theme-options button .bi-check2 { visibility: hidden; color: var(--accent-text); }
.theme-options button.is-active { color: var(--accent-text); background: var(--accent-soft); }
.theme-options button.is-active .bi-check2 { visibility: visible; }
.theme-divider { height: 1px; margin: 5px 4px; background: var(--line); }
.swatch { flex: none; width: 16px; height: 16px; border-radius: 50%; background: var(--sw); border: 3px solid var(--sw-bg); box-shadow: 0 0 0 1px var(--line), 0 0 0 1px var(--sw); }
.swatch-icon { flex: none; width: 16px; text-align: center; color: var(--muted); }
