/* VRSecLabs: theme layer. Loaded LAST on every public page.
   Dark is the brand default and is defined in css/style.css; this file adds an opt-in light
   theme (html[data-theme="light"], set by the toggle in js/theme.js and remembered per browser)
   plus the toggle's own styles. The signature green is kept: buttons stay #1FBF75, and green text
   and rules use a deeper shade of the same hue so they stay legible on a light ground. */

:root {
    /* RGB triplets for the few translucent overlays that must flip with the theme */
    --void-rgb: 8, 9, 11;
    --ink-rgb: 255, 255, 255;
}

html[data-theme="light"] {
    color-scheme: light;

    --void-rgb: 245, 246, 243;
    --ink-rgb: 8, 9, 11;

    /* Surfaces: a warm off-white ground, pure white panels that lift off it */
    --bg-void: #F5F6F3;
    --bg-surface: #FFFFFF;
    --bg-surface-2: #F0F2EE;
    --bg-surface-3: #E8EBE6;

    --border: rgba(8, 9, 11, 0.10);
    --border-strong: rgba(8, 9, 11, 0.22);

    /* Text (all >= 4.6:1 on the ground) */
    --text-primary: #0B0D10;
    --text-secondary: #4A525E;
    --text-tertiary: #667080;

    /* Same green hue, deeper for text/rules on light (5:1). Fills on buttons stay bright, see below. */
    --accent: #0A7F47;
    --accent-rgb: 10, 127, 71;
    --accent-strong: #076B3B;
    --accent-dim: rgba(10, 127, 71, 0.09);
    --accent-text: #08090B;

    --shadow-sm: 0 4px 12px rgba(8, 9, 11, 0.06);
    --shadow-md: 0 12px 28px rgba(8, 9, 11, 0.08);
    --shadow-lg: 0 24px 60px rgba(8, 9, 11, 0.10);
    --shadow-glow: 0 0 0 1px rgba(10, 127, 71, 0.25), 0 8px 30px rgba(10, 127, 71, 0.10);

    --announce-bg: #E3F4EB;
    --announce-text: var(--text-primary);

    /* BreachCheck severity colours, darkened for white backgrounds */
    --bc-red: #C42B2B;
    --bc-red-text: #9F1F1F;
    --bc-amber: #A15C07;
}

/* ── Header ── */
html[data-theme="light"] header {
    background: rgba(245, 246, 243, 0.8);
}

html[data-theme="light"]:has(.hx-hero) header:not(.scrolled) {
    background: transparent;
}

html[data-theme="light"] header.scrolled {
    background: rgba(245, 246, 243, 0.9);
    box-shadow: 0 8px 24px rgba(8, 9, 11, 0.06);
}

/* ── Buttons: keep the bright brand green + dark label; hover inverts to ink ── */
html[data-theme="light"] .btn-primary:not(.btn-ghost) {
    background: #1FBF75;
    border-color: #1FBF75;
}

html[data-theme="light"] .btn-primary:not(.btn-ghost):hover {
    background: var(--text-primary);
    border-color: var(--text-primary);
    color: #FFFFFF !important;
}

html[data-theme="light"] .form-group select {
    color-scheme: light;
}

/* ── Toggle button (injected by js/theme.js, next to the language picker) ── */
.theme-toggle {
    position: relative;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
    border: 1px solid var(--border-strong, rgba(255, 255, 255, 0.18));
    border-radius: var(--radius-sm, 2px);
    background: transparent;
    color: var(--text-secondary, #9CA3AF);
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    color: var(--text-primary, #F4F5F7);
    border-color: var(--accent, #1FBF75);
}

.theme-toggle svg {
    position: absolute;
    width: 15px;
    height: 15px;
    transition: transform 0.5s var(--ease-p3out, ease-out), opacity 0.3s ease;
}

/* Dark shows the sun (click for light); light shows the moon (click for dark) */
.theme-toggle .i-moon {
    opacity: 0;
    transform: rotate(-70deg) scale(0.6);
}

html[data-theme="light"] .theme-toggle .i-sun {
    opacity: 0;
    transform: rotate(70deg) scale(0.6);
}

html[data-theme="light"] .theme-toggle .i-moon {
    opacity: 1;
    transform: none;
}

@media (max-width: 768px) {
    .theme-toggle {
        margin: 0.4rem 0;
    }
}

/* Theme switch: a circle of the new theme grows out of the toggle (View Transitions API).
   Browsers without it simply swap instantly. */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

::view-transition-old(root) {
    z-index: 1;
}

::view-transition-new(root) {
    z-index: 2;
}

@media (prefers-reduced-motion: reduce) {
    .theme-toggle svg {
        transition: none;
    }
}
