/* A restrained navy theme; flag colors remain accents and image heroes stay intact. */
:root,
[data-theme="light"] {
    --page-bg: #ffffff;
    --page-text: #1a1a2e;
    --page-muted: #626d79;
    --page-surface: #ffffff;
    --page-surface-alt: #f4f1ea;
    --page-border: #e2e6e8;
    --page-alt: #f4f1ea;
}

[data-theme="dark"] {
    --page-bg: #0d1824;
    --page-text: #edf3f4;
    --page-muted: #bbc7cc;
    --page-surface: #172635;
    --page-surface-alt: #1e3040;
    --page-border: #344858;
    --page-alt: #122130;
    --texte: var(--page-text);
    --muted: var(--page-muted);
    --gris: var(--page-surface-alt);
    --surface: var(--page-surface);
    color-scheme: dark;
}

[data-theme="dark"] .site-public,
[data-theme="dark"] .auth-shell {
    background: var(--page-bg);
    color: var(--page-text);
}

/* Section backgrounds and cards have distinct depths for clear hierarchy. */
[data-theme="dark"] .site-public section.bg-white,
[data-theme="dark"] .site-public .section-cream,
[data-theme="dark"] .auth-shell.bg-white {
    background-color: var(--page-bg) !important;
}
[data-theme="dark"] .site-public .section-alt,
[data-theme="dark"] .site-public .presentation-tour,
[data-theme="dark"] .site-public .surface-creme {
    background-color: var(--page-alt) !important;
}
[data-theme="dark"] .site-public :not(section).bg-white,
[data-theme="dark"] .site-public .card,
[data-theme="dark"] .site-public .catalog-card,
[data-theme="dark"] .site-public .presentation-card,
[data-theme="dark"] .auth-shell .bg-white {
    background-color: var(--page-surface) !important;
    color: var(--page-text);
    border-color: var(--page-border);
}
[data-theme="dark"] .site-public .bg-gray-50,
[data-theme="dark"] .site-public .bg-gray-100,
[data-theme="dark"] .auth-shell .bg-gray-50 {
    background-color: var(--page-surface-alt) !important;
}
[data-theme="dark"] .site-public .section-title,
[data-theme="dark"] .site-public .presentation-card h3,
[data-theme="dark"] .site-public .text-nuit,
[data-theme="dark"] .auth-shell .text-nuit {
    color: var(--page-text) !important;
}
[data-theme="dark"] .site-public .section-subtitle,
[data-theme="dark"] .site-public .presentation-card p,
[data-theme="dark"] .site-public .presentation-heading > p,
[data-theme="dark"] .site-public .search-result-description,
[data-theme="dark"] .auth-shell [style*="var(--muted)"] {
    color: var(--page-muted) !important;
}
[data-theme="dark"] .site-public .border-gray-100,
[data-theme="dark"] .site-public .border-gray-200,
[data-theme="dark"] .auth-shell .border-gray-100,
[data-theme="dark"] .auth-shell .border-gray-200 {
    border-color: var(--page-border) !important;
}
[data-theme="dark"] .site-public .card:hover,
[data-theme="dark"] .site-public .presentation-card:hover {
    border-color: #58af91;
    box-shadow: 0 14px 32px rgba(0, 0, 0, .22);
}

/* Form controls and placeholders retain contrast in both site layouts. */
[data-theme="dark"] .site-public input:not([type="checkbox"]):not([type="radio"]),
[data-theme="dark"] .site-public textarea,
[data-theme="dark"] .site-public select,
[data-theme="dark"] .auth-shell input:not([type="checkbox"]),
[data-theme="dark"] .auth-shell textarea,
[data-theme="dark"] .auth-shell select {
    background: var(--page-surface);
    border-color: var(--page-border);
    color: var(--page-text);
}
[data-theme="dark"] .site-public input::placeholder,
[data-theme="dark"] .site-public textarea::placeholder,
[data-theme="dark"] .auth-shell input::placeholder {
    color: #a9bac2;
}
[data-theme="dark"] .site-public input:focus,
[data-theme="dark"] .site-public textarea:focus,
[data-theme="dark"] .site-public select:focus,
[data-theme="dark"] .auth-shell input:focus {
    outline-color: #58af91;
    border-color: #58af91;
}

/* Keep image and hero treatments stable; only neutral surfaces are remapped. */
[data-theme="dark"] .site-public .skeleton {
    background: linear-gradient(90deg, #1c2d3b 25%, #2a3d4c 50%, #1c2d3b 75%);
    background-size: 200% 100%;
}
[data-theme="dark"] .site-public .catalog-cover,
[data-theme="dark"] .site-public .catalog-placeholder,
[data-theme="dark"] .site-public .content-detail-cover {
    background: var(--page-surface-alt);
}
.search-page-input { background: #ffffff; color: #0d1b2a; border: 1px solid #d6dfe3; }
.search-page-input::placeholder { color: #5b6972; }
[data-theme="dark"] .site-public .search-page-input { background: var(--page-surface); color: var(--page-text); border-color: var(--page-border); }
[data-theme="dark"] .site-public .badge-gris { background: var(--page-surface-alt); color: var(--page-muted); }
[data-theme="dark"] .site-public .badge-jaune { color: #f4d65b; }
[data-theme="dark"] .site-public .text-vert,
[data-theme="dark"] .site-public .editorial-label:not([class*="text-white"]),
[data-theme="dark"] .site-public .presentation-card-link,
[data-theme="dark"] .site-public .presentation-card-label { color: #65c5a2 !important; }

/* Auth and dashboard headers share the same theme control behavior. */
[data-theme="dark"] .auth-header {
    background: rgba(13, 24, 36, .97) !important;
    border-color: var(--page-border) !important;
}
[data-theme="dark"] .auth-header .logo-title { color: var(--page-text) !important; }
[data-theme="dark"] .auth-header .auth-lang { border-color: var(--page-border) !important; }
[data-theme="dark"] .auth-header .auth-lang a:not(.active) { color: var(--page-muted) !important; }
[data-theme="dark"] .auth-header .auth-lang a.active { background: var(--page-surface) !important; color: var(--page-text) !important; }
[data-theme="light"] .auth-header .auth-lang a.active { background: #0d1b2a; color: #fff; }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: .625rem;
    border: 1px solid var(--page-border);
    background: transparent;
    color: inherit;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}
.theme-toggle:hover { background: rgba(0, 122, 94, .1); color: #007a5e; }
[data-theme="dark"] .theme-toggle { color: var(--page-muted); }
[data-theme="dark"] .theme-toggle:hover { color: #fcd116; background: rgba(252, 209, 22, .08); }
[data-theme="dark"] [data-theme-icon="moon"] { display: none !important; }
[data-theme="dark"] [data-theme-icon="sun"] { display: block !important; }
