* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background: #0e0e0e;
    color: #fff;
    overflow-x: hidden;
}

/* =========================
   HERO
   ========================= */
.hero {
    position: relative;
    height: 100svh;
    overflow: hidden;
}

.hero-video {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: translate(-50%, -50%);
    z-index: 0;
    transition: opacity 0.4s ease;
}

.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero h1 {
    font-size: 4rem;
    text-align: center;
}

/* =========================
   SECTIONS
   ========================= */
.portfolio {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

/* BACKGROUND IMAGE */
.bg-image {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: brightness(0.35) blur(2px);
    transform: scale(1.05);
    z-index: 0;
}

/* CONTENU */
.content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 60px;
    padding: 80px 10%;
}

/* =========================
   VIDEO
   ========================= */
.video-box {
    position: relative;
}

.video-box video {
    width: 100%;
    max-width: 490px;   /* ⬅ PLUS GRAND (tu peux ajuster 550 / 650) */
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}



.video-box-36 video {
    width: 100%;
    max-width: 600px;   /* ⬅ PLUS GRAND (tu peux ajuster 550 / 650) */
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.video-box-hcsr04 video {
    width: 100%;
    max-width: 600px;   /* ⬅ PLUS GRAND (tu peux ajuster 550 / 650) */
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

/* =========================
   VOLUME
   ========================= */
.volume-control {
    position: absolute;
    bottom: 15px;
    right: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    z-index: 5;
}

.volume-slider {
    width: 120px;
    cursor: pointer;
    opacity: 0.85;
}

.video-box:hover .volume-slider {
    opacity: 1;
}

.volume-icon svg {
    width: 20px;
    height: 20px;
    stroke: white;
    fill: none;
    stroke-width: 2;
    display: none;
}

.volume-icon svg.active {
    display: block;
}

/* =========================
   TEXTE
   ========================= */
.explain-box {
    max-width: 700px;
    background: rgba(255,255,255,0.05);
    padding: 30px;
    border-radius: 16px;
    backdrop-filter: blur(10px);
}

.explain-box-hcsr04 {
    max-width: 850px;
    background: rgba(255,255,255,0.05);
    padding: 30px;
    border-radius: 16px;
    backdrop-filter: blur(10px);
    max-height: 1000px;
}

.explain-box h2 {
    margin-bottom: 15px;
}

.explain-box p {
    line-height: 1.6;
    opacity: 0.9;
}

/* =========================
   IMAGES (CORRIGÉ ICI)
   ========================= */
.images {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center; /* ⬅ centre */
    gap: 15px;
}

.images img {
    width: 100%;
    max-width: 480px;   /* ⬅ PLUS GRAND MAIS PAS TROP */
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

.images img.td {
    width: 100%;
    max-width: 700px;   /* ⬅ PLUS GRAND MAIS PAS TROP */
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

/*.images img.arduino {
    width: 100%;
    max-width: 700px;   /* ⬅ PLUS GRAND MAIS PAS TROP */
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    max-height: 500px;
}*/

/* =========================
   ANIMATIONS
   ========================= */
.reveal {
    opacity: 0;
    transform: translateY(80px);
    transition: 0.9s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* =========================
   HERO FADE
   ========================= */
.fade {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeUp 1s forwards;
}

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

/* =========================
   MOBILE
   ========================= */
@media (max-width: 768px) {

    .hero h1 {
        font-size: 2.3rem;
        padding: 0 15px;
    }

    .content {
        flex-direction: column;
        gap: 30px;
        padding: 50px 20px;
    }

    .video-box video {
        width: 100%;
    }

    .explain-box {
        max-width: 100%;
        padding: 20px;
    }

    /* images encore plus clean mobile */
    .images img {
        max-width: 100%;
    }

    .volume-slider {
        width: 140px;
    }

    .bg-image {
        filter: brightness(0.3) blur(1px);
        transform: scale(1.02);
    }
}
/* GALERIE */
.gallery-section {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.gallery-slider {
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.gallery-track {
    display: flex;
    gap: 20px; /* espace entre les images */
    transition: transform 0.5s ease;
}

.gallery-track img {
    width: 400px;   /* agrandi par rapport à 350px */
    height: auto;
    border-radius: 10px;
    flex-shrink: 0;
    cursor: grab;
    user-select: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.gallery-track img:hover {
    transform: scale(1.05);
    opacity: 1;
}

/* MOBILE */
@media (max-width: 768px) {
    .gallery-track img {
        width: 90vw; /* images encore plus grandes sur mobile */
    }

    .gallery-section {
        gap: 20px;
    }
}

/* LIGHTBOX PLEIN ÉCRAN */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    cursor: zoom-out;
    overflow: hidden;
}

.lightbox-open {
    overflow: hidden; /* bloque le scroll de la page quand lightbox ouverte */
}

.lightbox-img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.lightbox .close,
.lightbox .prev,
.lightbox .next {
    position: absolute;
    font-size: 2.5rem;
    color: #fff;
    cursor: pointer;
    user-select: none;
    padding: 10px;
    background: rgba(0,0,0,0.4);
    border-radius: 50%;
    transition: background 0.2s;
}

.lightbox .close:hover,
.lightbox .prev:hover,
.lightbox .next:hover {
    background: rgba(255,255,255,0.3);
}

.lightbox .close { top: 20px; right: 30px; }
.lightbox .prev { top: 50%; left: 30px; transform: translateY(-50%); }
.lightbox .next { top: 50%; right: 30px; transform: translateY(-50%); }

/* CARROUSEL PHOTOS */
.gallery-slider {
    overflow: hidden;
    position: relative;
}

.gallery-track {
    display: flex;
    gap: 20px;
    transition: transform 0.5s ease;
}

.gallery-track img {
    flex-shrink: 0;
    cursor: grab;
    user-select: none;
    border-radius: 12px;
    width: 450px; /* taille images */
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.gallery-track img:hover {
    transform: scale(1.05);
}

/* Ajoute un espace vertical entre les lignes de galerie */
.gallery-track + .gallery-track {
    margin-top: 20px; /* ajuste la valeur selon ton design */
}



/* =========================
   FIX RESPONSIVE PROPRE (NE CASSE RIEN)
   ========================= */

/* Empêche les éléments trop larges */
img, video {
    max-width: 100%;
    height: auto;
}

/* Empêche les débordements horizontaux */
body {
    overflow-x: hidden;
}

/* Ajustement global */
.content {
    flex-wrap: wrap; /* ⬅ évite que ça déborde */
}

/* =========================
   TABLETTE
   ========================= */
@media (max-width: 1024px) {

    .content {
        flex-direction: column;
        gap: 40px;
        padding: 60px 40px;
    }

    .video-box video,
    .video-box-36 video,
    .video-box-hcsr04 video {
        max-width: 90%;
    }

    .explain-box,
    .explain-box-hcsr04 {
        max-width: 100%;
    }
}

/* =========================
   MOBILE
   ========================= */
@media (max-width: 768px) {

    /* HERO */
    .hero h1 {
        font-size: 2.2rem;
        padding: 0 15px;
    }

    /* SECTIONS */
    .content {
        flex-direction: column;
        gap: 30px;
        padding: 40px 20px;
    }

    /* VIDEOS */
    .video-box video,
    .video-box-36 video,
    .video-box-hcsr04 video {
        width: 100%;
        max-width: 100%;
    }

    /* TEXTE */
    .explain-box,
    .explain-box-hcsr04 {
        max-width: 100%;
        padding: 20px;
    }

    /* IMAGES EXPLICATION */
    .images {
        width: 100%;
    }

    .images img,
    .images img.td {
        max-width: 100%;
    }

    /* GALERIE */
    .gallery-track {
        flex-wrap: wrap; /* ⬅ IMPORTANT : passe en grille */
        justify-content: center;
    }

    .gallery-track img {
        width: 45%; /* 2 images par ligne */
    }

    /* ESPACE ENTRE LIGNES */
    .gallery-track + .gallery-track {
        margin-top: 15px;
    }

    /* VOLUME SLIDER PLUS GROS */
    .volume-slider {
        width: 140px;
    }
}

/* =========================
   PETIT MOBILE
   ========================= */
@media (max-width: 480px) {

    .hero h1 {
        font-size: 1.8rem;
    }

    .gallery-track img {
        width: 100%; /* 1 image par ligne */
    }
}


/* =========================
   GALERIE GRID PROPRE
   ========================= */

/* PAR DÉFAUT = DESKTOP */
.gallery-grid .gallery-track {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 images */
    gap: 20px;
}

.gallery-grid img {
    width: 100%;
}

/* =========================
   TABLETTE
   ========================= */
@media (max-width: 1024px) {
    .gallery-grid .gallery-track {
        grid-template-columns: repeat(2, 1fr) !important; /* ⬅ force 2 */
    }
}

/* =========================
   MOBILE
   ========================= */
@media (max-width: 480px) {
    .gallery-grid .gallery-track {
        grid-template-columns: 1fr !important; /* ⬅ force 1 */
    }
}

/* TABLETTE - réduire seulement la vidéo audio */
@media (max-width: 1024px) {
    .video-box.video-audio video {
        max-width: 60%; /* Ajuste ici pour que ce soit plus petit */
    }
}

/* =========================
   TABLETTE ET MOBILE - cacher le slider
   ========================= */
@media (max-width: 1024px) { /* tablette et plus petit */
    .volume-slider {
        display: none !important; /* cache le slider */
    }
}

@media (max-width: 1024px) {
    .volume-slider,
    .volume-icon {
        display: none !important;
    }
}


/* =========================
   PLAY ICON UNIQUEMENT VIDEO AUDIO (FIX)
   ========================= */

.video-box::before {
    content: "▶";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    color: rgba(255,255,255,0.85);
    z-index: 10; /* 🔴 important */
    pointer-events: none;
    display: none;
    text-shadow: 0 0 20px rgba(0,0,0,0.6);
}

/* Affiche seulement sur mobile/tablette */
@media (max-width: 1024px) {
    .video-box::before {
        display: block;
    }
}

/* Cache quand la vidéo joue */
.video-box.playing::before {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
}




@media (max-width: 1024px) {
    .mobile-play-btn {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 4rem;
        color: white;
        cursor: pointer;
        z-index: 10;
        user-select: none;
        background: rgba(0,0,0,0.3);
        padding: 20px;
        border-radius: 50%;
    }
}
@media (min-width: 1024px) {
    .mobile-play-btn {
        display: none !important;
    }
}


/* Désactive le ::before pour audio-reac-cube-c uniquement sur mobile/tablette */
.video-box[data-audio-reac-cube]::before {
    display: none !important;
}
/* Stack des vidéos (section anim 36) */
.video-stack-36 {
    display: flex;
    flex-direction: column;
    gap: 20px;
}