/* ==============================
   GLOBAL SETTINGS
================================= */

:root {
    --color-bg: #e9ded4;
    --color-text: #1f1f1f;
    --color-text-soft: #555555;

    --color-primary: #3ba7a6;
    --color-primary-dark: #2f8f8d;
    --color-primary-light: #42aba7;

    --color-white: #ffffff;
    --color-surface: rgba(255, 255, 255, 0.78);

    --shadow-soft: 0 20px 50px rgba(31, 31, 31, 0.09);
    --shadow-medium: 0 28px 70px rgba(31, 31, 31, 0.13);

    --radius-card: 28px;
    --radius-pill: 999px;

    --font-title: "Poppins", sans-serif;
    --font-body: "Noto Sans", sans-serif;
    --font-accent: "Playfair Display", serif;

    --header-height: 88px;
    --anchor-gap: 20px;

    --z-background: 0;
    --z-content: 10;
    --z-header: 3000;
    --z-display-controls: 2300;
    --z-dropdown: 2400;

}

/* ==============================
   RESET
================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + var(--anchor-gap));
}

body {
    position: relative;
    min-height: 100vh;
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    overflow-x: hidden;
}

main {
    position: relative;
    z-index: 1;
    margin: 0;
}

/* ==============================
   GLOBAL TYPOGRAPHY
================================= */

h1,
h2,
h3 {
    margin: 0;
    color: var(--color-text);
    font-family: var(--font-title);
    font-weight: 800;
}

h1 {
    font-size: clamp(3rem, 6vw, 4.6rem);
    line-height: 0.98;
    letter-spacing: -0.06em;
}

h2 {
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1.1;
    letter-spacing: -0.04em;
}

h3 {
    font-size: clamp(1.2rem, 2vw, 1.45rem);
    line-height: 1.2;
    letter-spacing: -0.03em;
}

p {
    margin: 0;
    color: var(--color-text-soft);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.7;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
}

/* ==============================
   GLOBAL SECTIONS
================================= */

section {
    position: relative;
    padding: 96px 8%;
}

.section-heading {
    max-width: 760px;
    margin: 0 auto 48px;
    text-align: center;
}

.section-heading p {
    max-width: 620px;
    margin: 18px auto 0;
}

.section-eyebrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    margin-bottom: 26px;
    padding: 8px 16px;

    color: var(--color-primary-dark);
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: var(--radius-pill);

    font-family: var(--font-title);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;

    box-shadow: 0 10px 24px rgba(31, 31, 31, 0.07);
    backdrop-filter: blur(10px);
}

/* Variante décorative si besoin */
.script-title {
    color: var(--color-primary-dark);
    font-family: var(--font-accent);
    font-size: clamp(2.4rem, 5vw, 4rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.04em;
}

/* Ancres */
.anchor {
    display: block;
    width: 1px;
    height: 1px;
    scroll-margin-top: calc(var(--header-height) + 32px);
}

/* Messages */
.success {
    color: green;
    font-weight: 600;
}

/* ==============================
   GLOBAL BUTTONS
================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 52px;
    padding: 0 24px;

    border-radius: var(--radius-pill);
    border: none;
    text-decoration: none;
    cursor: pointer;

    font-family: var(--font-title);
    font-size: 0.95rem;
    font-weight: 700;

    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-white);
    box-shadow: 0 16px 32px rgba(59, 167, 166, 0.32);
}

.btn-primary:hover {
    background: var(--color-primary-light);
}

.btn-secondary {
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 12px 30px rgba(31, 31, 31, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.92);
    border-color: var(--color-white);
    box-shadow: 0 16px 34px rgba(31, 31, 31, 0.12);
}

/* ==============================
   FOOTER BASE
================================= */

footer {
    position: relative;
    height: auto;
}

#img_footer {
    display: block;
    width: 100%;
    height: auto;
}

/* ==============================
   TABLETTE
================================= */

@media screen and (max-width: 1024px) {
    section {
        padding: 50px 6%;
    }

    .section-heading {
        margin-bottom: 40px;
    }
}

/* ==============================
   MOBILE
================================= */

@media screen and (max-width: 768px) {
    :root {
        --header-height: 76px;
    }

    section {
        padding: 42px 20px;
    }

    h1 {
        font-size: clamp(2.4rem, 11vw, 3.5rem);
        line-height: 1;
    }

    h2 {
        font-size: clamp(2rem, 9vw, 2.8rem);
    }

    h3 {
        font-size: 1.25rem;
    }

    p {
        font-size: 0.95rem;
    }

    .section-heading {
        margin-bottom: 34px;
    }

    .section-eyebrow {
        font-size: 0.76rem;
        padding: 7px 13px;
    }

    .btn {
        width: 100%;
        min-height: 48px;
    }
}

/* ==============================
   DISPLAY CONTROLS
================================= */

.display-controls {
    position: fixed;
    top: calc(16px + var(--header-height) + 14px);
    right: max(16px, calc((100vw - 1440px) / 2));

    z-index: var(--z-display-controls);

    width: auto;
    max-width: min(1440px, calc(100vw - 32px));
    padding: 8px;

    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;

    background: rgba(255, 255, 255, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.58);
    border-radius: var(--radius-pill);

    box-shadow: 0 14px 34px rgba(31, 31, 31, 0.10);

    backdrop-filter: blur(18px) saturate(1.16);
    -webkit-backdrop-filter: blur(18px) saturate(1.16);
}

.display-toggle {
    min-height: 36px;
    padding: 0 13px 0 6px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    color: var(--color-text);
    background: transparent;
    border: none;
    border-radius: var(--radius-pill);

    font-family: var(--font-title);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.display-toggle:hover {
    background: rgba(255, 255, 255, 0.42);
    transform: translateY(-1px);
}

.display-toggle-switch {
    position: relative;

    width: 34px;
    height: 20px;

    flex: 0 0 auto;

    display: inline-flex;
    align-items: center;

    background: rgba(31, 31, 31, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: var(--radius-pill);

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

.display-toggle-switch span {
    position: absolute;
    left: 3px;

    width: 14px;
    height: 14px;

    background: var(--color-white);
    border-radius: 50%;

    box-shadow: 0 4px 10px rgba(31, 31, 31, 0.18);

    transition: transform 0.25s ease;
}

.display-toggle.is-active .display-toggle-switch {
    background: var(--color-primary);
    border-color: rgba(255, 255, 255, 0.82);
}

.display-toggle.is-active .display-toggle-switch span {
    transform: translateX(14px);
}

/* ==============================
   NIGHT MODE BASE
================================= */

body.theme-night {
    background-color: #07111f;
}

/* Surfaces sombres : navbar, footer, options d'affichage */
body.theme-night #navbar,
body.theme-night .footer-container,
body.theme-night .display-controls {
    background: rgba(11, 25, 43, 0.58);
    border-color: rgba(255, 255, 255, 0.16);

    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24);

    backdrop-filter: blur(24px) saturate(1.18);
    -webkit-backdrop-filter: blur(24px) saturate(1.18);
}

/* ==============================
   NIGHT MODE - TEXTES
================================= */

/* Navbar desktop : liens blancs */
body.theme-night #dropdown a,
body.theme-night #dropdown a svg,
body.theme-night .display-toggle {
    color: #f5f7fb;
}

/* Hover turquoise uniquement sur les liens classiques, jamais sur le CTA Contact */
body.theme-night #dropdown a:not([href="#Contact"]):hover,
body.theme-night .footer-nav a:hover,
body.theme-night .footer-legal a:hover {
    color: var(--color-primary-light);
}

/* Burger */
body.theme-night #burger-button span {
    background: #f5f7fb;
}

/* Titres principaux hors cards */
body.theme-night .hero-text h1,
body.theme-night .section-heading h2 {
    color: #f5f7fb;
}

/* Paragraphes hors cards */
body.theme-night .hero-description,
body.theme-night .section-heading p {
    color: rgba(245, 247, 251, 0.76);
}

/* Eyebrows : texte uniquement */
body.theme-night .hero-eyebrow,
body.theme-night .section-eyebrow,
body.theme-night .closing-kicker,
body.theme-night .hero-eyebrow *,
body.theme-night .section-eyebrow *,
body.theme-night .closing-kicker * {
    color: var(--color-primary-dark);
}

/* ==============================
   NIGHT MODE - CONTENU DES CARDS
================================= */

/*
 * Seuls les composants dont tout le contenu doit rester
 * sombre sont ciblés.
 *
 * Les projets, les filtres et la section About conservent
 * leurs couleurs définies dans leurs propres fichiers CSS.
 */

body.theme-night .hero-card,
body.theme-night .hero-card *,
body.theme-night .floating-card,
body.theme-night .floating-card *,
body.theme-night .service-card,
body.theme-night .service-card *,
body.theme-night .closing-card,
body.theme-night .closing-card *,
body.theme-night .hero-skills span {
    color: #1f1f1f;
}


/* ==============================
   FILTRES DES PROJETS
================================= */

body.theme-night .filter-button,
body.theme-night .filter-button * {
    color: var(--color-text);
}

body.theme-night .filter-button:hover,
body.theme-night .filter-button:hover *,
body.theme-night .filter-button.active,
body.theme-night .filter-button.active * {
    color: var(--color-white);
}


/* ==============================
   OVERLAY DES PROJETS
================================= */

body.theme-night .project-overlay h3 {
    color: var(--color-text);
}

body.theme-night .project-details p {
    color: var(--color-text-soft);
}

body.theme-night .project-type {
    color: var(--color-white);
}

body.theme-night .technologies-list li,
body.theme-night .technologies-list li span {
    color: var(--color-primary-dark);
}


/* ==============================
   SECTION ABOUT
================================= */

/*
 * Aucun changement de couleur en mode nuit.
 * Les spans, badges et boutons conservent les couleurs
 * définies dans le CSS propre à la section About.
 */

/* Bouton submit : texte blanc uniquement */
body.theme-night .closing-card .contact-submit,
body.theme-night .closing-card .contact-submit * {
    color: var(--color-white);
}

/* Champs formulaire : texte uniquement */
body.theme-night .closing-card input,
body.theme-night .closing-card textarea,
body.theme-night .closing-card select {
    color: #1f1f1f;
}

body.theme-night .closing-card input::placeholder,
body.theme-night .closing-card textarea::placeholder {
    color: rgba(31, 31, 31, 0.58);
}

/* Footer : texte blanc uniquement */
body.theme-night .footer-container,
body.theme-night .footer-container p,
body.theme-night .footer-container a,
body.theme-night .footer-brand p,
body.theme-night .footer-copyright,
body.theme-night .footer-legal a {
    color: rgba(245, 247, 251, 0.76);
}

body.theme-night .footer-nav a {
    color: #f5f7fb;
}

/* ==============================
   STARS LAYER
================================= */

.background::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;

    background:
        radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.95) 0 1px, transparent 2px),
        radial-gradient(circle at 28% 42%, rgba(255, 255, 255, 0.72) 0 1px, transparent 2px),
        radial-gradient(circle at 44% 14%, rgba(255, 255, 255, 0.88) 0 1px, transparent 2px),
        radial-gradient(circle at 62% 28%, rgba(255, 255, 255, 0.68) 0 1px, transparent 2px),
        radial-gradient(circle at 78% 12%, rgba(255, 255, 255, 0.9) 0 1px, transparent 2px),
        radial-gradient(circle at 88% 48%, rgba(255, 255, 255, 0.76) 0 1px, transparent 2px),
        radial-gradient(circle at 18% 72%, rgba(255, 255, 255, 0.72) 0 1px, transparent 2px),
        radial-gradient(circle at 52% 82%, rgba(255, 255, 255, 0.86) 0 1px, transparent 2px),
        radial-gradient(circle at 74% 70%, rgba(255, 255, 255, 0.72) 0 1px, transparent 2px);

    opacity: 0;
    pointer-events: none;

    transition: opacity 0.45s ease;
}

body.theme-night .background::before {
    opacity: 1;
}

.far-back-layer,
.back-layer,
.front-layer {
    z-index: 1;
}

/* ==============================
   CLOUDS TOGGLE
================================= */

.back-clouds,
.front-clouds {
    transition:
        opacity 0.55s ease,
        filter 0.55s ease;
}

body.clouds-hidden .back-clouds,
body.clouds-hidden .front-clouds {
    opacity: 0;
    filter: blur(10px);
}

body.clouds-disabled .back-clouds,
body.clouds-disabled .front-clouds {
    opacity: 0;
    filter: none;
    background-image: none;
    animation: none;
}

/* ==============================
   TABLETTE
================================= */

@media screen and (max-width: 1024px) {
    .display-controls {
        top: calc(16px + var(--header-height) + 12px);
        right: 20px;
    }
}

/* ==============================
   MOBILE
================================= */

@media screen and (max-width: 768px) {
    .display-controls {
        top: 88px;
        right: 12px;

        max-width: calc(100vw - 24px);
        padding: 7px;
        gap: 6px;
    }

    .display-toggle {
        min-height: 34px;
        padding: 0 8px 0 5px;

        font-size: 0.68rem;
    }

    .display-toggle-switch {
        width: 30px;
        height: 18px;
    }

    .display-toggle-switch span {
        width: 12px;
        height: 12px;
    }

    .display-toggle.is-active .display-toggle-switch span {
        transform: translateX(12px);
    }

    body.theme-night #dropdown {
        background: rgba(11, 25, 43, 0.72);
        border-color: rgba(255, 255, 255, 0.16);

        box-shadow:
            -18px 18px 44px rgba(0, 0, 0, 0.28),
            inset 1px 0 0 rgba(255, 255, 255, 0.08);

        backdrop-filter: blur(24px) saturate(1.18);
        -webkit-backdrop-filter: blur(24px) saturate(1.18);
    }
}