/* Claro por defecto: el diseño Tailwind del HTML. El oscuro se aplica solo si el sistema lo pide. */
:root {
    color-scheme: light dark;
    /* Paleta clara para las páginas legales (legal.css); el bloque oscuro de abajo la sustituye. */
    --template-bg: #FAFAFA;
    --template-bg-soft: #FFFFFF;
    --template-surface: rgba(255, 255, 255, 0.78);
    --template-surface-strong: rgba(255, 255, 255, 0.94);
    --template-border: rgba(23, 23, 23, 0.1);
    --template-border-strong: rgba(180, 83, 9, 0.35);
    --template-text: #171717;
    --template-muted: #525252;
    --template-muted-strong: #404040;
    --template-faint: #737373;
    --template-accent: #B45309;
    --template-accent-soft: #D97706;
    --template-accent-dark: #92400E;
    --template-shadow: 0 24px 60px rgba(23, 23, 23, 0.08);
    --primary-blue: #B45309;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(23, 23, 23, 0.1);
    --text-primary: #171717;
    --text-secondary: #525252;
}

@media (prefers-color-scheme: dark) {
    :root {
        --template-bg: #020617;
        --template-bg-soft: #0F172A;
        --template-surface: rgba(15, 23, 42, 0.58);
        --template-surface-strong: rgba(15, 23, 42, 0.86);
        --template-border: rgba(255, 255, 255, 0.08);
        --template-border-strong: rgba(245, 158, 11, 0.36);
        --template-text: #F8FAFC;
        --template-muted: #94A3B8;
        --template-muted-strong: #CBD5E1;
        --template-faint: #64748B;
        --template-accent: #F59E0B;
        --template-accent-soft: #FBBF24;
        --template-accent-dark: #B45309;
        --template-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
        --primary-blue: var(--template-accent);
        --card-bg: var(--template-surface);
        --card-border: var(--template-border);
        --text-primary: var(--template-text);
        --text-secondary: var(--template-muted);
    }

    .template-dark {
        min-height: 100vh;
        background-color: var(--template-bg);
        background-image:
            radial-gradient(at 0% 0%, rgba(166, 3, 33, 0.08) 0, transparent 48%),
            radial-gradient(at 100% 0%, rgba(140, 92, 50, 0.15) 0, transparent 50%),
            radial-gradient(at 100% 100%, rgba(217, 165, 119, 0.12) 0, transparent 50%);
        color: var(--template-muted);
    }

    .template-dark.bg-neutral-50 {
        background-color: var(--template-bg) !important;
    }

    .template-dark.text-neutral-900 {
        color: var(--template-muted) !important;
    }

    .template-dark .bg-grid {
        background-size: 40px 40px;
        background-image:
            linear-gradient(to right, rgba(248, 250, 252, 0.05) 1px, transparent 1px),
            linear-gradient(to bottom, rgba(248, 250, 252, 0.05) 1px, transparent 1px);
    }

    .template-dark .glass-card {
        background: rgba(15, 23, 42, 0.72) !important;
        border-color: var(--template-border) !important;
        box-shadow: var(--template-shadow) !important;
    }

    .template-dark .bg-white,
    .template-dark .bg-white\/80,
    .template-dark .bg-neutral-50,
    .template-dark .bg-neutral-100 {
        background-color: var(--template-surface) !important;
    }

    .template-dark .bg-neutral-900 {
        background-color: var(--template-bg-soft) !important;
    }

    .template-dark .bg-neutral-800,
    .template-dark .bg-neutral-800\/50 {
        background-color: rgba(30, 41, 59, 0.72) !important;
    }

    .template-dark .bg-white\/5,
    .template-dark .bg-white\/10,
    .template-dark .bg-white\/15 {
        background-color: rgba(255, 255, 255, 0.06) !important;
    }

    .template-dark .bg-eu-blue,
    .template-dark .bg-eu-gold {
        background-color: var(--template-accent) !important;
        color: var(--template-bg) !important;
    }

    .template-dark .bg-eu-blue\/5,
    .template-dark .bg-eu-blue\/10,
    .template-dark .bg-eu-gold\/5,
    .template-dark .bg-eu-gold\/10,
    .template-dark .bg-eu-gold\/15,
    .template-dark .bg-eu-gold\/20 {
        background-color: rgba(245, 158, 11, 0.12) !important;
    }

    .template-dark .from-neutral-100 {
        --tw-gradient-from: rgba(15, 23, 42, 0.86) var(--tw-gradient-from-position) !important;
        --tw-gradient-to: rgba(15, 23, 42, 0) var(--tw-gradient-to-position) !important;
        --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
    }

    .template-dark .to-white {
        --tw-gradient-to: rgba(30, 41, 59, 0.72) var(--tw-gradient-to-position) !important;
    }

    .template-dark .from-eu-blue {
        --tw-gradient-from: var(--template-accent) var(--tw-gradient-from-position) !important;
        --tw-gradient-to: rgba(245, 158, 11, 0) var(--tw-gradient-to-position) !important;
        --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
    }

    .template-dark .to-eu-bluedark {
        --tw-gradient-to: var(--template-accent-dark) var(--tw-gradient-to-position) !important;
    }

    .template-dark .border-neutral-100,
    .template-dark .border-neutral-200,
    .template-dark .border-neutral-200\/60,
    .template-dark .border-neutral-300,
    .template-dark .border-neutral-700,
    .template-dark .border-white\/10,
    .template-dark .border-white\/15 {
        border-color: var(--template-border) !important;
    }

    .template-dark .border-eu-blue\/15,
    .template-dark .border-eu-gold\/20,
    .template-dark .hover\:border-eu-gold\/50:hover,
    .template-dark .hover\:border-neutral-300:hover {
        border-color: var(--template-border-strong) !important;
    }

    .template-dark .text-neutral-900,
    .template-dark .text-white {
        color: var(--template-text) !important;
    }

    .template-dark .text-neutral-800,
    .template-dark .text-neutral-700,
    .template-dark .text-neutral-600 {
        color: var(--template-muted-strong) !important;
    }

    .template-dark .text-neutral-500,
    .template-dark .text-neutral-400,
    .template-dark .text-white\/80,
    .template-dark .text-white\/70 {
        color: var(--template-muted) !important;
    }

    .template-dark .text-neutral-300,
    .template-dark .text-neutral-200 {
        color: var(--template-faint) !important;
    }

    .template-dark .text-eu-blue,
    .template-dark .text-eu-blue\/70,
    .template-dark .text-eu-gold {
        color: var(--template-accent) !important;
    }

    .template-dark .hover\:text-neutral-900:hover,
    .template-dark .hover\:text-amber-400:hover {
        color: var(--template-accent) !important;
    }

    .template-dark .hover\:bg-neutral-800:hover,
    .template-dark .hover\:bg-neutral-50:hover,
    .template-dark .hover\:bg-white\/10:hover {
        background-color: rgba(255, 255, 255, 0.08) !important;
    }

    .template-dark .hover\:bg-eu-goldsoft:hover,
    .template-dark .hover\:bg-amber-400:hover {
        background-color: var(--template-accent-soft) !important;
    }

    .template-dark .shadow-neutral-900\/10,
    .template-dark .shadow-eu-gold\/20 {
        --tw-shadow-color: rgba(0, 0, 0, 0.35) !important;
        --tw-shadow: var(--tw-shadow-colored) !important;
    }

    .template-dark .rounded-\[32px\],
    .template-dark .rounded-2xl,
    .template-dark .rounded-xl,
    .template-dark .rounded-lg {
        border-radius: 1rem !important;
    }

    .template-dark .privacy-panel {
        background:
            radial-gradient(at 0% 0%, rgba(245, 158, 11, 0.20) 0, transparent 46%),
            linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.90)) !important;
        border: 1px solid rgba(245, 158, 11, 0.28);
        box-shadow: var(--template-shadow);
    }

    .template-dark .privacy-panel h2,
    .template-dark .privacy-panel h4 {
        color: var(--template-text) !important;
    }

    .template-dark .privacy-panel p {
        color: var(--template-muted-strong) !important;
    }

    .template-dark .privacy-panel a {
        color: var(--template-accent-soft) !important;
    }

    .template-dark .privacy-panel a:hover {
        color: var(--template-text) !important;
    }

    .template-dark .privacy-panel > .absolute {
        color: rgba(245, 158, 11, 0.32) !important;
        opacity: 0.18 !important;
    }

    .template-dark .privacy-panel .bg-white\/10 {
        background-color: rgba(2, 6, 23, 0.42) !important;
        border-color: rgba(245, 158, 11, 0.22) !important;
    }

    .template-dark .privacy-panel iconify-icon.text-eu-gold {
        color: var(--template-accent-soft) !important;
    }
}

/* Bloques que en oscuro son paneles negros: en claro, fondo ámbar suave con contraste AA. */
@media (prefers-color-scheme: light) {
    .tone-soft.bg-neutral-900 {
        background-color: #FFF6E8;
        border: 1px solid rgba(180, 83, 9, 0.14);
    }

    #sources.tone-soft {
        border: 0;
        border-block: 1px solid rgba(180, 83, 9, 0.14);
    }

    .tone-soft.text-white,
    .tone-soft .text-white {
        color: #171717;
    }

    .tone-soft .text-neutral-400 {
        color: #525252;
    }

    .tone-soft .text-neutral-600 {
        color: #737373;
    }

    body .tone-soft .text-eu-gold {
        color: #B45309;
    }

    .tone-soft .bg-neutral-800,
    .tone-soft .bg-neutral-800\/50 {
        background-color: #FFFFFF;
    }

    .tone-soft .bg-neutral-900 {
        background-color: #FDEBCB;
    }

    .tone-soft .border-neutral-700 {
        border-color: rgba(180, 83, 9, 0.16);
    }

    .tone-soft .hover\:border-eu-gold\/50:hover {
        border-color: rgba(180, 83, 9, 0.45);
    }

    .tone-soft .opacity-10 iconify-icon.text-white {
        color: #B45309;
    }
}

/* Texto ámbar legible en claro: #F59E0B sobre blanco solo da 2:1. */
@media (prefers-color-scheme: light) {
    /* «body» sube la especificidad: Tailwind CDN inyecta sus clases después de esta hoja. */
    body .text-eu-blue,
    body .text-eu-gold,
    body .text-eu-blue\/70 {
        color: #B45309;
    }

    /* Titulares grandes: basta 3:1, se conserva un ámbar más vivo. */
    body h1 .text-eu-blue,
    body h2 .text-eu-blue {
        color: #D97706;
    }

    /* El logotipo mantiene el color de marca. */
    body a > span > span.text-eu-blue {
        color: #F59E0B;
    }

    /* Texto blanco sobre ámbar: fondo más oscuro para llegar a 5:1. */
    .bg-eu-blue.text-white,
    .bg-eu-gold.text-white {
        background-color: #B45309;
    }

    .privacy-panel.bg-gradient-to-br {
        background-image: linear-gradient(135deg, #B45309, #92400E);
    }

    .privacy-panel .text-white\/80,
    .privacy-panel .text-white\/70 {
        color: #FFFFFF;
    }

    body .privacy-panel .text-eu-gold {
        color: #FFFFFF;
        text-decoration: underline;
        text-underline-offset: 4px;
    }
}
