/* --- VARIABLES DE THÈME --- */

:root {
    --bg-main: linear-gradient(135deg, rgb(63, 63, 63), black);
    --text-main: #f5f5f5;
    --text-muted: rgba(245, 245, 245, 0.8);

    --nav-bg: rgba(0, 0, 0, 0.65);
    --nav-border: rgba(255, 255, 255, 0.18);

    --card-bg: rgba(255, 255, 255, 0.04);
    --card-border: rgba(255, 255, 255, 0.18);

    --card-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);

    --button-bg: linear-gradient(135deg, #1e1e1e, #2c2c2c);
    --button-bg-hover: linear-gradient(135deg, #3a3a3a, #505050);

    --footer-text: rgba(245, 245, 245, 0.8);
}

/* Thème clair (body[data-theme="light"]) */
body[data-theme="light"] {
    --bg-main: linear-gradient(135deg, #f3f4f7, #d9dde5);
    --text-main: #111111;
    --text-muted: #444444;

    --nav-bg: rgba(255, 255, 255, 0.9);
    --nav-border: rgba(0, 0, 0, 0.06);

    --card-bg: rgba(255, 255, 255, 0.95);
    --card-border: rgba(0, 0, 0, 0.05);

    --card-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);

    --button-bg: linear-gradient(135deg, #111111, #333333);
    --button-bg-hover: linear-gradient(135deg, #000000, #222222);

    --footer-text: rgba(0, 0, 0, 0.6);
}

/* --- BASE GÉNÉRALE --- */

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    background: var(--bg-main);
    font-family: Arial, sans-serif;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
}

/* --- LOADER --- */

.loader-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 55%),
                radial-gradient(circle at bottom, rgba(0, 0, 0, 0.85), #000000);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    z-index: 2000;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.loader-overlay.loader-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-spinner {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
    animation: loader-spin 0.8s linear infinite;
    margin-bottom: 12px;
}

.loader-text {
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.85;
}

/* --- HEADER --- */

.hautdepage {
    padding-top: 20px;
}

.hautdepage, main {
    font-variant: small-caps;
}

.hautdepage h1,
.hautdepage p {
    display: flex;
    justify-content: center;
    margin: 0;
}

.hautdepage p.undertitle {
    margin-top: 5px;
    font-size: 0.95rem;
    opacity: 0.85;
}

/* --- NAVBAR (DESKTOP) --- */

nav {
    position: relative;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 24px 0 10px;
}

/* “Pilule” contenant les liens */
.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;

    padding: 4px;
    background: var(--nav-bg);
    border-radius: 999px;
    border: 1px solid var(--nav-border);
    backdrop-filter: blur(10px);
}

/* Liens */
.navbutton {
    padding: 8px 18px;

    border-radius: 999px;
    background: transparent;

    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0.4px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.navbutton:hover {
    background: rgba(255, 255, 255, 0.12);
}

.navbutton.active {
    background: #f5f5f5;
    color: #111;
}

/* Burger */

.menu-toggle {
    display: none;
}

.menu-icon {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;

    padding: 8px;
    border-radius: 8px;
    cursor: pointer;

    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.menu-icon span {
    width: 22px;
    height: 2px;
    background: #ffffff;
    border-radius: 999px;
}

/* --- SWITCH DE THÈME (SLIDER) --- */

.theme-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
    margin-left: 12px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;

    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(6px);
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);

    transition: background 0.3s ease;
}

.slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;

    left: 3px;
    top: 50%;
    transform: translateY(-50%);

    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);

    transition: transform 0.3s ease, background 0.3s ease;
}

.theme-switch input:checked + .slider {
    background: #ffd86b;
}

.theme-switch input:checked + .slider::before {
    transform: translate(22px, -50%);
    background: #fff7d1;
}

/* Mode clair, ton un peu différent */
body[data-theme="light"] .slider {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(0, 0, 0, 0.12);
}

body[data-theme="light"] .slider::before {
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

body[data-theme="light"] .theme-switch input:checked + .slider {
    background: #2f7cf0;
}

body[data-theme="light"] .theme-switch input:checked + .slider::before {
    background: #e3eeff;
}

/* --- MAIN / HERO / SECTIONS --- */

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;

    padding: 40px 20px 30px;
    box-sizing: border-box;
}

.hero {
    max-width: 800px;
    text-align: center;
    margin-bottom: 30px;

    opacity: 0;
    transform: translateY(18px);
    animation: fadeUp 0.6s ease forwards;
    animation-delay: 0.05s;
}

.hero-title {
    font-size: 2.3rem;
    margin: 0 0 10px 0;
}

.hero-subtitle {
    margin: 0 0 18px 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.secondary-link {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid var(--nav-border);
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.9rem;
}

/* Section générique */

.section {
    width: 100%;
    max-width: 1100px;
}

.section-title {
    text-align: center;
    margin: 0 0 16px 0;
    font-size: 1.4rem;
}

/* --- CARTES --- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    width: 100%;
    max-width: 1000px;
    margin-top: 10px;
}

.card {
    background: var(--card-bg);
    padding: 20px 22px;
    border-radius: 16px;
    border: 1px solid var(--card-border);
    backdrop-filter: blur(9px);

    box-shadow: var(--card-shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;

    opacity: 0;
    transform: translateY(18px);
    animation: fadeUp 0.6s ease forwards;
}

.card:nth-child(1) { animation-delay: 0.15s; }
.card:nth-child(2) { animation-delay: 0.25s; }
.card:nth-child(3) { animation-delay: 0.35s; }

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 35px rgba(0, 0, 0, 0.5);
    background: rgba(255, 255, 255, 0.06);
}

.card h2 {
    margin-top: 0;
    margin-bottom: 10px;
}

.card p {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.card-list {
    margin: 0;
    padding-left: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Boutons */

.card-btn,
.primary-btn,
.error-btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 12px;
    background: var(--button-bg);
    text-decoration: none;
    color: #ffffff;
    font-weight: 600;
    letter-spacing: 0.5px;
    border: none;
    cursor: pointer;
    transition: 0.25s ease;
}

.card-btn:hover,
.primary-btn:hover,
.error-btn:hover {
    background: var(--button-bg-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

/* --- FORMULAIRE CONTACT --- */

.contact-wrapper {
    width: 100%;
    max-width: 600px;
    margin-top: 20px;
}

.contact-card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--card-border);
    backdrop-filter: blur(9px);
    padding: 24px 24px 28px;
    box-shadow: var(--card-shadow);

    opacity: 0;
    transform: translateY(18px);
    animation: fadeUp 0.6s ease forwards;
    animation-delay: 0.2s;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.form-group input,
.form-group textarea {
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.45);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
}

body[data-theme="light"] .form-group input,
body[data-theme="light"] .form-group textarea {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.12);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.55);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3);
}

/* --- PAGE 404 --- */

.error404-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
    padding: 20px;
    width: 100%;
}

.error404-card {
    text-align: center;
    padding: 30px 40px;
    border-radius: 16px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    max-width: 450px;
    box-shadow: var(--card-shadow);

    opacity: 0;
    transform: translateY(18px);
    animation: fadeUp 0.6s ease forwards;
    animation-delay: 0.15s;
}

.error-code {
    font-size: 4rem;
    font-weight: 800;
    margin: 0 0 10px 0;
    letter-spacing: 4px;
}

.error-title {
    font-size: 1.6rem;
    margin: 0 0 10px 0;
}

.error-text {
    font-size: 0.95rem;
    margin-bottom: 25px;
    line-height: 1.5;
    opacity: 0.9;
}

/* --- FOOTER --- */

.site-footer {
    text-align: center;
    padding: 10px 0 18px;
    font-size: 0.85rem;
    color: var(--footer-text);
}

/* --- ANIMATIONS --- */

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes loader-spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- RESPONSIVE (Burger + layout) --- */

@media (max-width: 900px) {

    nav {
        width: calc(100% - 40px);
        justify-content: space-between;

        padding: 10px 14px;
        margin-top: 16px;

        background: var(--nav-bg);
        border-radius: 10px;
        border: 1px solid var(--nav-border);
    }

    .menu-icon {
        display: flex;
    }

    .nav-links {
        position: absolute;
        z-index: 999;
        top: 100%;
        left: 0;
        right: 0;

        margin-top: 8px;
        padding: 0 10px;

        flex-direction: column;
        align-items: stretch;
        gap: 8px;

        background: rgba(0, 0, 0, 0.9);
        border-radius: 10px;
        border: 1px solid rgba(255, 255, 255, 0.2);

        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transform: translateY(-5px);
        transition: max-height 0.25s ease, opacity 0.25s ease, transform 0.25s ease;
    }

    body[data-theme="light"] .nav-links {
        background: rgba(255, 255, 255, 0.97);
        border-color: rgba(0, 0, 0, 0.08);
    }

    .menu-toggle:checked + .menu-icon + .nav-links {
        max-height: 300px;
        opacity: 1;
        transform: translateY(0);
        padding-bottom: 10px;
        padding-top: 10px;
    }

    .navbutton {
        justify-content: flex-start;
        width: 100%;
        padding: 12px 16px;
    }

    main {
        padding: 24px 16px 20px;
    }

    .card-grid {
        grid-template-columns: 1fr;
        max-width: 600px;
    }

    .contact-wrapper {
        max-width: 100%;
    }

    .error404-card {
        padding: 24px 18px;
        margin-top: 10px;
    }
}

/* --- RESPONSIVE TÉLÉPHONES --- */

@media (max-width: 480px) {

    .hautdepage h1 {
        font-size: 1.6rem;
    }

    .page-title,
    .hero-title {
        font-size: 1.6rem;
    }

    .page-subtitle,
    .hero-subtitle {
        font-size: 0.9rem;
    }

    .card {
        padding: 16px 16px;
    }

    .contact-card {
        padding: 18px 16px 20px;
    }
}