/* =========================================
   1. COULEURS, TYPO, RESET
   Couleurs tirées de l'image de fond (les vagues)
========================================= */
:root {
    --sky: #938ec4;        /* lavande, haut de l'image */
    --dusk: #53568d;       /* vague du milieu */
    --indigo: #1d1755;     /* vague foncée */
    --night: #0a0d2b;      /* fond de page, bas de l'image */
    --ink: #ece9ff;        /* texte principal */
    --muted: #aaa6d8;      /* texte secondaire */
    --sun: #ffc837;        /* accent jaune */

    --font-display: 'Bricolage Grotesque', 'Arial Narrow', system-ui, sans-serif;
    --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;

    --page-x: clamp(20px, 6vw, 96px);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
    background: var(--night);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.65;
    overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

:focus-visible {
    outline: 3px solid var(--sun);
    outline-offset: 3px;
    border-radius: 4px;
}

/* =========================================
   2. BARRE DU HAUT
========================================= */
.topbar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px var(--page-x);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* Ajouté par le JS quand on a défilé */
.topbar.scrolled {
    background: rgba(10, 13, 43, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--indigo);
    transition: color 0.3s ease;
}

.topbar.scrolled .brand { color: var(--ink); }

.brand-avatar {
    border-radius: 8px;
    image-rendering: pixelated; /* garde l'avatar Minecraft net */
}

.menu {
    display: flex;
    align-items: center;
    gap: 32px;
}

.menu a {
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--indigo);
    transition: color 0.3s ease;
}

.topbar.scrolled .menu a { color: var(--muted); }
.topbar.scrolled .menu a:hover { color: var(--ink); }

.menu a.menu-cta,
.topbar.scrolled .menu a.menu-cta {
    background: var(--indigo);
    color: var(--ink);
    padding: 9px 20px;
    border-radius: 999px;
}

.topbar.scrolled .menu a.menu-cta {
    background: var(--sun);
    color: var(--night);
}

.menu-toggle {
    display: none;
    font: 700 0.95rem var(--font-body);
    background: var(--indigo);
    color: var(--ink);
    border: 0;
    border-radius: 999px;
    padding: 9px 18px;
    cursor: pointer;
}

/* =========================================
   3. HERO : le ciel lavande qui descend vers la nuit
========================================= */
.hero {
    position: relative;
    background-color: var(--sky);
    padding: 150px var(--page-x) 0;
}

/* Les vagues : collées en bas du hero, pleine largeur */
.hero::after {
    content: "";
    display: block;
    margin: clamp(-120px, -8vw, -40px) calc(var(--page-x) * -1) 0;
    aspect-ratio: 2576 / 1453;
    background:
        linear-gradient(to bottom, transparent 70%, var(--night) 100%),
        url("assets/background.webp") center top / 100% auto no-repeat;
}

.hero-inner {
    position: relative;
    z-index: 1;
    max-width: 720px;
}

.hero-hello {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    color: var(--indigo);
}

.hero-name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(4.5rem, 15vw, 12rem);
    line-height: 0.85;
    letter-spacing: -0.04em;
    color: var(--night);
    margin: 6px 0 28px -0.04em;
}

.hero-pitch {
    max-width: 34em;
    font-size: clamp(1.05rem, 1.6vw, 1.2rem);
    font-weight: 500;
    color: #1b1946;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 32px;
}

/* =========================================
   4. BOUTONS
========================================= */
.btn {
    display: inline-block;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.98rem;
    padding: 13px 26px;
    border-radius: 999px;
    transition: transform 0.2s ease, background 0.2s ease;
}

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

.btn-primary { background: var(--night); color: var(--sun); }
.btn-ghost { border: 2px solid var(--night); color: var(--night); }
.btn-ghost:hover { background: rgba(10, 13, 43, 0.08); }

/* =========================================
   5. TITRES DE SECTION
========================================= */
.section-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2.6rem, 7vw, 5rem);
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: clamp(40px, 6vw, 72px);
}

/* =========================================
   6. PROJETS (une ligne par projet, image en alternance)
========================================= */
.projects {
    position: relative;
    padding: 0 var(--page-x) 120px;
    max-width: 1280px;
    margin: clamp(-180px, -12vw, -40px) auto 0;
}

.project {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    align-items: center;
    gap: clamp(28px, 5vw, 72px);
    padding: clamp(32px, 5vw, 56px) 0;
    border-top: 1px solid rgba(170, 166, 216, 0.18);
}

.project:nth-of-type(even) .project-media { order: 2; }

.project-media {
    border-radius: 18px;
    overflow: hidden;
    background: var(--indigo);
    aspect-ratio: 16 / 10;
    box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
}

.project-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.project-context {
    color: var(--sun);
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.project h3 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1.7rem, 3vw, 2.3rem);
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 14px;
}

.project-summary {
    color: var(--muted);
    max-width: 32em;
    margin-bottom: 20px;
}

.tech-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tech-list li {
    font-size: 0.82rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 6px;
    background: var(--indigo);
    color: #cfcbff;
}

.project-open {
    margin-top: 26px;
    font: 700 0.98rem var(--font-body);
    color: var(--ink);
    background: none;
    border: 0;
    border-bottom: 2px solid var(--sun);
    padding: 2px 0;
    cursor: pointer;
}

.project-open:hover { color: var(--sun); }

/* =========================================
   7. COMPÉTENCES
========================================= */
.skills {
    background: var(--indigo);
    padding: clamp(72px, 9vw, 120px) var(--page-x);
}

.skills > * { max-width: 1280px; margin-left: auto; margin-right: auto; }

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 40px 32px;
}

.skill-group {
    border-top: 3px solid var(--sun);
    padding-top: 18px;
}

.skill-group h3 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.skill-group p { color: var(--muted); }

/* =========================================
   8. CONTACT
========================================= */
.contact {
    padding: clamp(96px, 12vw, 160px) var(--page-x);
    text-align: center;
}

.contact-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2rem, 5vw, 3.6rem);
    letter-spacing: -0.03em;
    line-height: 1.05;
    max-width: 16em;
    margin: 0 auto 14px;
}

.contact-text { color: var(--muted); margin-bottom: 28px; }

.contact-mail {
    display: inline-block;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.3rem, 3.5vw, 2.2rem);
    color: var(--sun);
    text-decoration: none;
    border-bottom: 2px solid currentColor;
    word-break: break-all;
}

.contact-mail:hover { color: var(--ink); }

.contact-links {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-top: 32px;
}

.contact-links a {
    color: var(--muted);
    font-weight: 700;
    text-decoration: none;
}

.contact-links a:hover { color: var(--ink); }

/* =========================================
   9. FOOTER
========================================= */
.footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 24px var(--page-x);
    border-top: 1px solid rgba(170, 166, 216, 0.15);
    color: var(--muted);
    font-size: 0.9rem;
}

.footer a { text-decoration: none; }
.footer a:hover { color: var(--ink); }

/* =========================================
   10. FENÊTRE DÉTAIL D'UN PROJET
========================================= */
.project-dialog {
    width: min(760px, calc(100% - 32px));
    max-height: calc(100vh - 48px);
    margin: auto;
    padding: clamp(22px, 4vw, 36px);
    background: var(--night);
    color: var(--ink);
    border: 1px solid rgba(170, 166, 216, 0.25);
    border-radius: 20px;
    overflow-y: auto;
}

.project-dialog::backdrop {
    background: rgba(10, 13, 43, 0.75);
    backdrop-filter: blur(6px);
}

.project-dialog[open] { animation: pop 0.25s ease-out; }

@keyframes pop {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

.dialog-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.dialog-head h2 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.dialog-close {
    flex-shrink: 0;
    font: 700 0.9rem var(--font-body);
    background: var(--indigo);
    color: var(--ink);
    border: 0;
    border-radius: 999px;
    padding: 8px 16px;
    cursor: pointer;
}

.dialog-close:hover { background: var(--dusk); }

#dialogImg {
    width: 100%;
    border-radius: 14px;
    margin-bottom: 22px;
}

.dialog-text p {
    color: var(--muted);
    margin-bottom: 14px;
    max-width: 62ch;
}

.dialog-text + .tech-list { margin-top: 20px; }

/* =========================================
   11. RESPONSIVE
========================================= */
@media (max-width: 860px) {
    .project { grid-template-columns: 1fr; }
    .project:nth-of-type(even) .project-media { order: 0; }

    .menu-toggle { display: block; }

    .menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px var(--page-x) 20px;
        background: var(--night);
        border-bottom: 1px solid rgba(170, 166, 216, 0.15);
    }

    .menu.open { display: flex; }

    .menu a,
    .topbar.scrolled .menu a { color: var(--ink); padding: 12px 0; }

    .menu a.menu-cta,
    .topbar.scrolled .menu a.menu-cta {
        margin-top: 8px;
        text-align: center;
        background: var(--sun);
        color: var(--night);
    }

    .hero { padding-top: 120px; }
    .hero::after { margin-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
