/* App palette: ../beta_goat_app/src/theme/themes.ts (Dark / Light Chalk).
   Website-only roles: translucent navigation, shadows, logo and release accent. */
:root {
    color-scheme: light;
    --surface-base: #f0ece3;
    --surface-raised: #fffdf7;
    --surface-overlay: #e8e1d4;
    --surface-elevated: #ffffff;
    --text-primary: #1a1a18;
    --text-secondary: #4a463d;
    --text-tertiary: #666054;
    --chalk: #2f2c25;
    --chalk-hover: #413d33;
    --chalk-pressed: #1d1b16;
    --on-chalk: #fdfbf5;
    --chalk-subtle: #f5f1e6;
    --border-default: #ded7c8;
    --border-subtle: #ebe5d8;
    --border-strong: #b6ae9e;
    --focus-ring: #2f2c25;
    --nav-background: rgba(240, 236, 227, 0.94);
    --page-shadow: 0 0 24px rgba(47, 44, 37, 0.08);
    --logo-shadow: 0 8px 32px rgba(47, 44, 37, 0.12), 0 2px 8px rgba(47, 44, 37, 0.08);
    --logo-background: #ffffff;
    --release-accent: #775315;
}

/* CSS alone follows the system when JavaScript is unavailable. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        color-scheme: dark;
        --surface-base: #1a1a18;
        --surface-raised: #262624;
        --surface-overlay: #363633;
        --surface-elevated: #4a4a46;
        --text-primary: #fffcf2;
        --text-secondary: #d4d1c7;
        --text-tertiary: #9c9990;
        --chalk: #e8e0d0;
        --chalk-hover: #f2ece0;
        --chalk-pressed: #d8d0c0;
        --on-chalk: #1a1a18;
        --chalk-subtle: #2a2925;
        --border-default: #363633;
        --border-subtle: #2e2e2b;
        --border-strong: #4a4a46;
        --focus-ring: #e8e0d0;
        --nav-background: rgba(26, 26, 24, 0.94);
        --page-shadow: 0 0 24px rgba(0, 0, 0, 0.3);
        --logo-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
        --logo-background: #deded8;
        --release-accent: #e6b450;
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --surface-base: #1a1a18;
    --surface-raised: #262624;
    --surface-overlay: #363633;
    --surface-elevated: #4a4a46;
    --text-primary: #fffcf2;
    --text-secondary: #d4d1c7;
    --text-tertiary: #9c9990;
    --chalk: #e8e0d0;
    --chalk-hover: #f2ece0;
    --chalk-pressed: #d8d0c0;
    --on-chalk: #1a1a18;
    --chalk-subtle: #2a2925;
    --border-default: #363633;
    --border-subtle: #2e2e2b;
    --border-strong: #4a4a46;
    --focus-ring: #e8e0d0;
    --nav-background: rgba(26, 26, 24, 0.94);
    --page-shadow: 0 0 24px rgba(0, 0, 0, 0.3);
    --logo-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
    --logo-background: #deded8;
    --release-accent: #e6b450;
}

:where(a, button):focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 4px;
}

/* Keep the original page layout; allow room for the appearance control. */
nav {
    flex-wrap: wrap;
    gap: 12px;
}

.nav-links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.theme-toggle[hidden] {
    display: none;
}

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

.theme-toggle:active {
    background: var(--surface-overlay);
}

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

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

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

@media (max-width: 600px) {
    nav .nav-links {
        gap: 8px;
    }

    .theme-toggle {
        width: 34px;
        height: 34px;
    }
}
