/* ==========================================================================
   Themes: a base palette x an accent colour.
   data-theme = "<base>-<accent>", e.g. "charcoal-coral", "paper-indigo".
   Bases  : charcoal (default, defined in app.css), midnight, amoled, paper.
   Accents: coral, crimson, amber, lime, emerald, cyan, indigo, violet.
   ========================================================================== */

/* ---- Base palettes -------------------------------------------------------- */
:root[data-theme^="midnight-"] {
    color-scheme: dark;
    --bg: #0b1020; --surface: #121a2e; --surface-2: #1a2440; --stage: #060911;
    --border: #243152; --text: #e7ecf8; --muted: #9aa6c2; --faint: #5d6b8c;
    --shadow: 0 12px 40px rgba(2, 6, 20, .65);
}
:root[data-theme^="amoled-"] {
    color-scheme: dark;
    --bg: #000000; --surface: #0c0c0d; --surface-2: #151517; --stage: #000000;
    --border: #1f1f23; --text: #f3f3f4; --muted: #9b9ba3; --faint: #5a5a62;
    --shadow: 0 12px 40px rgba(0, 0, 0, .9);
}
:root[data-theme^="paper-"] {
    color-scheme: light;
    --bg: #f5f3ee; --surface: #ffffff; --surface-2: #efebe3; --stage: #e6e1d6;
    --border: #d9d3c6; --text: #1d1c1a; --muted: #6a655b; --faint: #a09a8c;
    --shadow: 0 10px 30px rgba(60, 45, 20, .14);
}

/* ---- Accents (dark bases) ------------------------------------------------- */
:root[data-theme$="-coral"]   { --accent: #ff5a4f; --accent-hover: #ff746b; --accent-fg: #1a0605; --accent-soft: rgba(255, 90, 79, .16);  --accent-border: rgba(255, 90, 79, .55); }
:root[data-theme$="-crimson"] { --accent: #f43f5e; --accent-hover: #fb7185; --accent-fg: #ffffff; --accent-soft: rgba(244, 63, 94, .16);  --accent-border: rgba(244, 63, 94, .55); }
:root[data-theme$="-amber"]   { --accent: #f59e0b; --accent-hover: #fbbf24; --accent-fg: #140d04; --accent-soft: rgba(245, 158, 11, .16); --accent-border: rgba(245, 158, 11, .55); }
:root[data-theme$="-lime"]    { --accent: #84cc16; --accent-hover: #a3e635; --accent-fg: #080c09; --accent-soft: rgba(132, 204, 22, .16); --accent-border: rgba(132, 204, 22, .55); }
:root[data-theme$="-emerald"] { --accent: #10b981; --accent-hover: #34d399; --accent-fg: #04130d; --accent-soft: rgba(16, 185, 129, .16); --accent-border: rgba(16, 185, 129, .55); }
:root[data-theme$="-cyan"]    { --accent: #06b6d4; --accent-hover: #22d3ee; --accent-fg: #041318; --accent-soft: rgba(6, 182, 212, .16);  --accent-border: rgba(6, 182, 212, .55); }
:root[data-theme$="-indigo"]  { --accent: #6366f1; --accent-hover: #818cf8; --accent-fg: #ffffff; --accent-soft: rgba(99, 102, 241, .18); --accent-border: rgba(99, 102, 241, .55); }
:root[data-theme$="-violet"]  { --accent: #a855f7; --accent-hover: #c084fc; --accent-fg: #ffffff; --accent-soft: rgba(168, 85, 247, .18); --accent-border: rgba(168, 85, 247, .55); }

/* ---- Accents on the light Paper base (darker for text contrast) ---------- */
:root[data-theme^="paper-"][data-theme$="-coral"]   { --accent: #d8473c; --accent-hover: #b8392f; --accent-fg: #ffffff; --accent-soft: rgba(216, 71, 60, .12);  --accent-border: rgba(216, 71, 60, .45); }
:root[data-theme^="paper-"][data-theme$="-crimson"] { --accent: #e11d48; --accent-hover: #be123c; --accent-fg: #ffffff; --accent-soft: rgba(225, 29, 72, .12);  --accent-border: rgba(225, 29, 72, .45); }
:root[data-theme^="paper-"][data-theme$="-amber"]   { --accent: #b45309; --accent-hover: #92400e; --accent-fg: #ffffff; --accent-soft: rgba(180, 83, 9, .12);   --accent-border: rgba(180, 83, 9, .45); }
:root[data-theme^="paper-"][data-theme$="-lime"]    { --accent: #4d7c0f; --accent-hover: #3f6212; --accent-fg: #ffffff; --accent-soft: rgba(77, 124, 15, .12);  --accent-border: rgba(77, 124, 15, .45); }
:root[data-theme^="paper-"][data-theme$="-emerald"] { --accent: #047857; --accent-hover: #065f46; --accent-fg: #ffffff; --accent-soft: rgba(4, 120, 87, .12);   --accent-border: rgba(4, 120, 87, .45); }
:root[data-theme^="paper-"][data-theme$="-cyan"]    { --accent: #0e7490; --accent-hover: #155e75; --accent-fg: #ffffff; --accent-soft: rgba(14, 116, 144, .12); --accent-border: rgba(14, 116, 144, .45); }
:root[data-theme^="paper-"][data-theme$="-indigo"]  { --accent: #4f46e5; --accent-hover: #4338ca; --accent-fg: #ffffff; --accent-soft: rgba(79, 70, 229, .12);  --accent-border: rgba(79, 70, 229, .45); }
:root[data-theme^="paper-"][data-theme$="-violet"]  { --accent: #7e22ce; --accent-hover: #6b21a8; --accent-fg: #ffffff; --accent-soft: rgba(126, 34, 206, .12); --accent-border: rgba(126, 34, 206, .45); }

/* ---- Surfaces that were hard-coded for dark mode -------------------------- */
.navbar {
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    backdrop-filter: saturate(160%) blur(12px);
}
.detail-hero::after {
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--surface) 96%, transparent) 0%,
        color-mix(in srgb, var(--surface) 74%, transparent) 55%,
        color-mix(in srgb, var(--surface) 36%, transparent) 100%);
}
.detail-desc, .genre-chip { color: color-mix(in srgb, var(--text) 82%, var(--muted)); }
.genre-chip { background: var(--surface-2); }

/* ---- Theme picker (built by assets/js/theme.js) --------------------------- */
.theme-section-label {
    font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: var(--faint); margin: 14px 0 8px;
}
.theme-section-label:first-child { margin-top: 2px; }
.theme-base-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.theme-base {
    display: flex; flex-direction: column; gap: 8px; padding: 10px; text-align: left;
    background: var(--surface-2); color: var(--text);
    border: 1px solid var(--border); border-radius: 12px; cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.theme-base:hover { border-color: var(--accent-border); }
.theme-base.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.theme-base-name { font-size: .84rem; font-weight: 700; }
.theme-base-note { font-size: .72rem; color: var(--muted); margin-top: -6px; }
.theme-preview {
    position: relative; height: 56px; border-radius: 8px; overflow: hidden;
    background: var(--pv-bg); border: 1px solid rgba(127, 127, 127, .25);
}
.theme-preview::before {
    content: ""; position: absolute; left: 8px; right: 8px; top: 8px; height: 14px;
    border-radius: 4px; background: var(--pv-surf);
}
.theme-preview::after {
    content: ""; position: absolute; left: 8px; bottom: 8px; width: 34px; height: 10px;
    border-radius: 99px; background: var(--pv-accent);
}
.theme-accent-row { display: flex; flex-wrap: wrap; gap: 10px; }
.theme-accent {
    width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
    background: var(--ac); border: 2px solid transparent;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25);
    display: grid; place-items: center; color: #fff; font-size: .8rem;
}
.theme-accent.is-active { border-color: var(--surface); box-shadow: 0 0 0 2px var(--ac); }
.theme-accent .fa-check { opacity: 0; }
.theme-accent.is-active .fa-check { opacity: 1; }
.theme-current { font-size: .78rem; color: var(--muted); margin-top: 14px; }
