/* ============================================================
   Light / dark theme
   The theme is set on <html data-theme="..."> by an inline script
   in <head> (saved choice, else the system setting).
   ============================================================ */

:root {
    color-scheme: light;
    --surface: #ffffff;
    --focus-ring: rgba(37, 99, 235, 0.35);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --primary: #5b9bff;
    --primary-dark: #8ab8ff;
    --text-primary: #e7edf6;
    --text-secondary: #b6c2d4;
    --text-light: #8d9cb3;
    --bg-white: #0b1220;
    --bg-gray: #121b2e;
    --border: #24314b;
    --surface: #141e33;
    --focus-ring: rgba(79, 143, 247, 0.45);
}

html[data-theme="dark"] img {
    filter: brightness(0.94);
}

html[data-theme="dark"] ::selection {
    background: rgba(79, 143, 247, 0.35);
}

/* Theme toggle button (in the nav) */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.theme-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.theme-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Active topic chip on the blog page keeps its accent fill in dark mode */
html[data-theme="dark"] .filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #0b1220;
}

html[data-theme="dark"] .filter-btn.active .count {
    background: rgba(11, 18, 32, 0.18);
    color: #0b1220;
}

/* Inline style attributes */

/* Inline style attributes */

/* Inline style attributes */

/* Inline style attributes */
/* dark-theme:auto:start */
html[data-theme="dark"] [style^="background: var(--primary)"], html[data-theme="dark"] [style*="; background: var(--primary)"] { color: #0b1220 !important; }
html[data-theme="dark"] [style^="background: #e5e7eb"], html[data-theme="dark"] [style*="; background: #e5e7eb"] { background: #2a2c2f !important; }
html[data-theme="dark"] [style^="background: #f0fdf4"], html[data-theme="dark"] [style*="; background: #f0fdf4"] { background: #193220 !important; }
html[data-theme="dark"] [style^="background: #fee2e2"], html[data-theme="dark"] [style*="; background: #fee2e2"] { background: #3a1818 !important; }
html[data-theme="dark"] [style^="background: #fef2f2"], html[data-theme="dark"] [style*="; background: #fef2f2"] { background: #331717 !important; }
html[data-theme="dark"] [style^="background: #fef3c7"], html[data-theme="dark"] [style*="; background: #fef3c7"] { background: #443c1b !important; }
html[data-theme="dark"] [style^="background: white"], html[data-theme="dark"] [style*="; background: white"] { background: #141d31 !important; }
html[data-theme="dark"] [style^="color: #15803d"], html[data-theme="dark"] [style*="; color: #15803d"] { color: #a5efc1 !important; }
html[data-theme="dark"] [style^="color: #374151"], html[data-theme="dark"] [style*="; color: #374151"] { color: #c2cad6 !important; }
html[data-theme="dark"] [style^="color: #b45309"], html[data-theme="dark"] [style*="; color: #b45309"] { color: #edbe9b !important; }
html[data-theme="dark"] [style^="color: #b91c1c"], html[data-theme="dark"] [style*="; color: #b91c1c"] { color: #ec9595 !important; }
/* dark-theme:auto:end */
