/* rapttor/yii2-themes. The chosen theme's variables are emitted inline by Themes::registerHead(); these are the defaults.
   Variables: --bg --surface --text --muted --line --brand --brand-ink --link --accent --elev --elev-sm --elev-in
   Hooks on <html>: data-theme="<id>", data-mode="light|dark" (absent for `system`, which follows the device), data-style="soft".
   Soft (neumorphic) themes set --elev* to dual light/dark shadows: apply `box-shadow: var(--elev)` to raised surfaces
   and `var(--elev-in)` to inset ones (inputs, pressed buttons). Flat themes set them to `none`, so the same CSS fits both. */
:root {
    color-scheme: light dark;
    --bg: #f2f2f7; --surface: #ffffff; --text: #1c1c1e; --muted: #5f5f66; --line: #d9d9de;
    --brand: #0062cc; --brand-ink: #ffffff; --link: #0062cc; --accent: #c93400;
    --elev: none; --elev-sm: none; --elev-in: none;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #000000; --surface: #1c1c1e; --text: #f2f2f7; --muted: #b0b0b8; --line: #2e2e31;
        --brand: #0a84ff; --brand-ink: #0a0a0a; --link: #64a8ff; --accent: #ff9f0a;
    }
}
:root[data-mode=light] { color-scheme: light; }
:root[data-mode=dark] { color-scheme: dark; }

/* --- Picker (ThemePicker widget) --- */
.theme-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.theme-picker label { margin: 0; font-weight: 600; }
.theme-group { grid-column: 1 / -1; display: block; margin-block: 8px 0; padding: 4px 2px; border-block-end: 1px solid var(--line); font-size: .75rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.theme-group:first-child { margin-block-start: 0; }
.theme-picker[data-tab]:not([data-tab=all]) .theme-group:not([data-group=system]) { display: none; }
.theme-option.is-tab-hidden, .theme-option.is-filtered, .theme-card.is-tab-hidden { display: none; }
.theme-filter { display: inline-flex; margin-block-end: 8px; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--bg); }
.theme-filter button { min-block-size: 24px; padding: 1px 10px; border: 0; background: none; font: inherit; font-size: .75rem; line-height: 1.7; font-weight: 600; color: var(--muted); cursor: pointer; }
.theme-filter button.is-on { background: var(--brand); color: var(--brand-ink); }
.theme-tabs { display: flex; gap: 5px; margin-block-end: 8px; padding-block-end: 3px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.theme-tabs[hidden] { display: none; }
@media (min-width: 640px) { .theme-tabs { flex-wrap: wrap; overflow: visible; } }
.theme-tabs button { flex: none; min-block-size: 24px; padding: 1px 10px; border: 1px solid transparent; border-radius: 999px; background: color-mix(in srgb, var(--text) 8%, var(--surface)); font: inherit; font-size: .75rem; line-height: 1.7; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.theme-tabs button:hover { color: var(--text); }
.theme-tabs button.is-on { background: var(--brand); color: var(--brand-ink); }
.theme-tabs button:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
.theme-option { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 6px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; text-align: center; font-size: .78rem; line-height: 1.2; }
.theme-option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.theme-option:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.theme-option:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
.theme-name { inline-size: 100%; text-align: center; }
.theme-swatch { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 3px; inline-size: 100%; block-size: 46px; padding: 6px; border-radius: 8px; background: var(--sw-bg); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sw-text) 18%, transparent); overflow: hidden; }
.theme-swatch b { grid-column: 1 / -1; align-self: start; font-size: .8rem; line-height: 1; color: var(--sw-text); }
.theme-swatch i { display: block; block-size: 8px; border-radius: 4px; }
.theme-swatch i:nth-of-type(1) { background: var(--sw-brand); }
.theme-swatch i:nth-of-type(2) { background: var(--sw-link); }
.theme-swatch i:nth-of-type(3) { background: var(--sw-accent); }
.theme-swatch.is-split { background: linear-gradient(115deg, var(--sw-bg) 0 50%, var(--sw-bg2) 50% 100%); }
.theme-swatch.is-split b { justify-self: center; font-size: .9rem; }
.theme-swatch.is-split b u { text-decoration: none; }
.theme-swatch.is-split b u:first-child { color: var(--sw-text); }
.theme-swatch.is-split b u:last-child { color: var(--sw-text2); }

/* user-defined theme controls (one colour, light or dark) sit under the Custom tile */
.theme-custom { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 4px 2px 8px; }
.theme-custom > label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; margin: 0; }
.theme-custom input[type=color] { inline-size: 44px; block-size: 32px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; cursor: pointer; }
.theme-custom .appearance { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--bg); }
.theme-custom .appearance label { position: relative; margin: 0; }
.theme-custom .appearance input { position: absolute; opacity: 0; }
.theme-custom .app-opt { display: block; padding: 5px 16px; font-size: .85rem; cursor: pointer; }
.theme-custom .appearance label:has(input:checked) { background: var(--brand); color: var(--brand-ink); }
.theme-custom .appearance label:has(input:focus-visible), .theme-custom input[type=color]:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
/* the user-defined theme is a card of its own below the groups */
.theme-card { margin-block-start: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.theme-card-title { margin: 0 0 8px; font-size: .75rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.theme-card-body { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.theme-card .theme-option { inline-size: 92px; }
.theme-card .theme-custom { padding: 0; }
