/*
 * Desert Future tokens for nevsky.me
 * This layer remaps the legacy theme palette onto a warmer editorial system
 * without forcing a full rewrite of the upstream theme CSS.
 */

:root,
html[data-theme="light"],
html.sepia-mode,
html:not(.dark-mode):not([data-theme="dark"]) {
    color-scheme: light;

    --brand-night: #0D0A06;
    --brand-shadow: #1C1509;
    --brand-sand: #F5EDD8;
    --brand-sunset: #FF6B35;
    --brand-sky: #00D4FF;
    --brand-signal: #C8FF00;
    --brand-threshold: #9B5FFF;
    --brand-digital: #FF3366;
    --brand-heritage: #E8C96A;

    --theme-background: #F5EDD8;
    --theme-surface: #EFE4CC;
    --theme-surface-elevated: #FFF8EA;
    --theme-text-primary: #0D0A06;
    --theme-text-secondary: rgba(13, 10, 6, 0.72);
    --theme-text-muted: rgba(13, 10, 6, 0.48);
    --theme-border-subtle: rgba(13, 10, 6, 0.10);
    --theme-border-strong: rgba(13, 10, 6, 0.18);
    --theme-accent-primary: #FF6B35;
    --theme-accent-secondary: #00A9CC;
    --theme-accent-signal: #9DBF00;
    --theme-link: var(--brand-night);
    --theme-link-hover: var(--theme-accent-primary);
    --theme-button-primary-bg: var(--brand-night);
    --theme-button-primary-text: var(--brand-sand);
    --theme-button-secondary-bg: transparent;
    --theme-button-secondary-text: var(--brand-night);
    --theme-button-secondary-border: rgba(13, 10, 6, 0.12);
    --theme-card-bg: rgba(255, 248, 234, 0.82);
    --theme-card-border: rgba(13, 10, 6, 0.08);
    --theme-chip-bg: rgba(255, 107, 53, 0.10);
    --theme-chip-text: var(--theme-accent-primary);
    --theme-tag-bg: rgba(0, 169, 204, 0.10);
    --theme-tag-text: var(--theme-accent-secondary);
    --theme-quote-bg: rgba(232, 201, 106, 0.12);
    --theme-quote-border: var(--theme-accent-primary);
    --theme-navigation-bg: rgba(255, 248, 234, 0.96);
    --theme-navigation-text: var(--theme-text-primary);
    --theme-navigation-border: rgba(13, 10, 6, 0.10);

    --tracking-body: 0;
    --tracking-display: 0;
    --tracking-mono: 0.02em;
    --tracking-mono-caps: 0.05em;

    /* Legacy theme variable mapping */
    --color-font-one: var(--theme-text-primary);
    --color-font-two: var(--brand-sand);
    --color-font-black: var(--brand-night);
    --color-font-white: var(--brand-sand);

    --color-one: var(--brand-night);
    --color-two: var(--theme-surface);
    --color-three: var(--theme-surface-elevated);
    --color-four: var(--brand-night);
    --color-five: var(--theme-surface);

    --color-body: var(--theme-background);
    --color-white: var(--brand-sand);
    --color-black: var(--brand-night);
    --color-border: var(--theme-border-subtle);

    --ghost-accent-color: var(--theme-accent-primary);
    --ghost-bg-color: var(--theme-surface);
}

[data-theme="dark"],
html.dark-mode {
    color-scheme: dark;

    --theme-background: #0D0A06;
    --theme-surface: #1C1509;
    --theme-surface-elevated: #261C0F;
    --theme-text-primary: #F5EDD8;
    --theme-text-secondary: rgba(245, 237, 216, 0.72);
    --theme-text-muted: rgba(245, 237, 216, 0.48);
    --theme-border-subtle: rgba(245, 237, 216, 0.10);
    --theme-border-strong: rgba(245, 237, 216, 0.18);
    --theme-accent-primary: #FF6B35;
    --theme-accent-secondary: #00D4FF;
    --theme-accent-signal: #C8FF00;
    --theme-link: var(--brand-sand);
    --theme-link-hover: var(--brand-sky);
    --theme-button-primary-bg: var(--brand-sunset);
    --theme-button-primary-text: var(--brand-night);
    --theme-button-secondary-text: var(--brand-sand);
    --theme-button-secondary-border: rgba(245, 237, 216, 0.12);
    --theme-card-bg: rgba(38, 28, 15, 0.82);
    --theme-card-border: rgba(245, 237, 216, 0.08);
    --theme-chip-bg: rgba(255, 107, 53, 0.14);
    --theme-chip-text: var(--theme-accent-primary);
    --theme-tag-bg: rgba(0, 212, 255, 0.12);
    --theme-tag-text: var(--theme-accent-secondary);
    --theme-quote-bg: rgba(28, 21, 9, 0.94);
    --theme-quote-border: var(--theme-accent-primary);
    --theme-navigation-bg: rgba(28, 21, 9, 0.96);
    --theme-navigation-text: var(--theme-text-primary);
    --theme-navigation-border: rgba(245, 237, 216, 0.10);

    --color-font-one: var(--theme-text-primary);
    --color-font-two: var(--brand-night);
    --color-font-black: var(--brand-night);
    --color-font-white: var(--brand-sand);

    --color-one: var(--brand-sand);
    --color-two: var(--theme-surface-elevated);
    --color-three: var(--theme-surface);
    --color-four: var(--theme-surface-elevated);
    --color-five: #22190C;

    --color-body: var(--theme-background);
    --color-white: var(--brand-sand);
    --color-black: var(--brand-night);
    --color-border: var(--theme-border-subtle);

    --ghost-accent-color: var(--theme-accent-primary);
    --ghost-bg-color: var(--theme-surface);
}

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

@media (prefers-color-scheme: dark) {
    html.auto-dark-mode:not([data-theme="light"]) {
        color-scheme: dark;

        --theme-background: #0D0A06;
        --theme-surface: #1C1509;
        --theme-surface-elevated: #261C0F;
        --theme-text-primary: #F5EDD8;
        --theme-text-secondary: rgba(245, 237, 216, 0.72);
        --theme-text-muted: rgba(245, 237, 216, 0.48);
        --theme-border-subtle: rgba(245, 237, 216, 0.10);
        --theme-border-strong: rgba(245, 237, 216, 0.18);
        --theme-accent-primary: #FF6B35;
        --theme-accent-secondary: #00D4FF;
        --theme-accent-signal: #C8FF00;
        --theme-link: var(--brand-sand);
        --theme-link-hover: var(--brand-sky);
        --theme-button-primary-bg: var(--brand-sunset);
        --theme-button-primary-text: var(--brand-night);
        --theme-button-secondary-text: var(--brand-sand);
        --theme-button-secondary-border: rgba(245, 237, 216, 0.12);
        --theme-card-bg: rgba(38, 28, 15, 0.82);
        --theme-card-border: rgba(245, 237, 216, 0.08);
        --theme-chip-bg: rgba(255, 107, 53, 0.14);
        --theme-chip-text: var(--theme-accent-primary);
        --theme-tag-bg: rgba(0, 212, 255, 0.12);
        --theme-tag-text: var(--theme-accent-secondary);
        --theme-quote-bg: rgba(28, 21, 9, 0.94);
        --theme-quote-border: var(--theme-accent-primary);
        --theme-navigation-bg: rgba(28, 21, 9, 0.96);
        --theme-navigation-text: var(--theme-text-primary);
        --theme-navigation-border: rgba(245, 237, 216, 0.10);

        --color-font-one: var(--theme-text-primary);
        --color-font-two: var(--brand-night);
        --color-font-black: var(--brand-night);
        --color-font-white: var(--brand-sand);

        --color-one: var(--brand-sand);
        --color-two: var(--theme-surface-elevated);
        --color-three: var(--theme-surface);
        --color-four: var(--theme-surface-elevated);
        --color-five: #22190C;

        --color-body: var(--theme-background);
        --color-white: var(--brand-sand);
        --color-black: var(--brand-night);
        --color-border: var(--theme-border-subtle);

        --ghost-accent-color: var(--theme-accent-primary);
        --ghost-bg-color: var(--theme-surface);
    }
}

body {
    color: var(--theme-text-primary);
    background-color: var(--theme-background);
}

a {
    color: var(--theme-link);
}

a:hover,
a:focus-visible {
    color: var(--theme-link-hover);
}

.post-content a {
    color: var(--theme-accent-secondary);
}

.post-content a:hover,
.post-content a:focus-visible {
    color: var(--theme-accent-primary);
}

.g-btn {
    color: var(--theme-button-primary-text);
}

.g-btn::after {
    background-color: var(--theme-button-primary-bg);
}

.header-dropdown ul {
    background-color: var(--theme-navigation-bg);
    border: 1px solid var(--theme-navigation-border);
}

.header-dropdown a {
    color: var(--theme-navigation-text);
}

.post-content blockquote:not([class]),
.post-content blockquote.kg-blockquote-alt {
    background-color: var(--theme-quote-bg);
    border-left-color: var(--theme-quote-border);
}

.signup-content :is(input, textarea),
.kg-card.kg-bookmark-card .kg-bookmark-container,
.kg-card.kg-file-card .kg-file-card-container,
.kg-card.kg-audio-card,
.kg-card.kg-toggle-card .kg-toggle-card-icon,
.kg-card.kg-callout-card,
.kg-card.kg-product-card .kg-product-card-container {
    background-color: var(--theme-card-bg);
    border-color: var(--theme-card-border);
}
