* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    width: 100vw;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    font-family: 'Inter', sans-serif;
    background: #000000 !important;
    color: #ffffff !important;
    position: relative;
    cursor: none;
}

/* Bouton Retour (milieu gauche fixe) */
.home-return-btn {
    position: fixed;
    top: 50%;
    left: 40px;
    transform: translateY(-50%);
    z-index: 100;
    font-family: 'Inter', monospace;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #ffffff;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.home-return-btn:hover {
    background: #ffffff;
    color: #000000;
    border-color: #ffffff;
}

/* HUD Textes des 4 coins */
.hud-micro-text {
    position: fixed;
    font-family: 'Inter', monospace;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.5);
    z-index: 10;
    text-transform: uppercase;
    pointer-events: none;
}

.hud-micro-text.top-left { top: 35px; left: 180px; }
.hud-micro-text.top-right { top: 35px; right: 40px; }
.hud-micro-text.bottom-left { bottom: 35px; left: 40px; }
.hud-micro-text.bottom-right { bottom: 35px; right: 40px; }

/* Lignes verticales de fond */
.vertical-lines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.v-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, 0.08);
}

.v-line.l-1 { left: 18%; }
.v-line.l-2 { left: 35%; }
.v-line.l-3 { left: 64%; }
.v-line.l-4 { left: 85%; }

/* Stage Principal */
.project-stage {
    position: relative;
    width: 80%;
    max-width: 1000px;
    margin: 80px auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 10;
}

.project-header {
    display: flex;
    align-items: baseline;
    gap: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 10px;
}

.proj-index {
    font-family: 'Inter', monospace;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 2px;
}

.project-title {
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 900;
    letter-spacing: -1px;
    text-transform: uppercase;
}

/* Grille Asymétrique Galerie */
.gallery-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 15px;
    height: 480px;
}

.side-grid {
    display: grid;
    grid-template-rows: repeat(3, 1fr);
    gap: 10px;
    height: 100%;
}

.grid-item {
    position: relative;
    background: #050505;
    border: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    overflow: hidden;
    height: 100%;
    transition: border-color 0.3s ease;
}

.grid-item:hover {
    border-color: rgba(255, 255, 255, 0.8);
}

.project-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.grid-item:hover .project-thumb {
    transform: scale(1.05);
}

/* Coins de visée HUD */
.hud-corner {
    position: absolute;
    width: 10px;
    height: 10px;
    border-color: #ffffff;
    border-style: solid;
    pointer-events: none;
    z-index: 5;
}
.hud-corner.top-left { top: 8px; left: 8px; border-width: 2px 0 0 2px; }
.hud-corner.top-right { top: 8px; right: 8px; border-width: 2px 2px 0 0; }
.hud-corner.bottom-left { bottom: 8px; left: 8px; border-width: 0 0 2px 2px; }
.hud-corner.bottom-right { bottom: 8px; right: 8px; border-width: 0 2px 2px 0; }

.item-overlay {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 3px 6px;
    font-family: 'Inter', monospace;
    font-size: 8px;
    letter-spacing: 1px;
    z-index: 6;
}

.project-description-box {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 18px 22px;
    min-height: 85px;
}

.project-description-box p {
    font-size: 11px;
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.85);
}

/* Curseur personnalisé */
.custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cursor-dot {
    width: 3px;
    height: 3px;
    background: #ffffff;
    border-radius: 50%;
}

/* ==========================================
   LIGHTBOX & ANIMATION GLITCH EN BOUCLE
========================================== */
.lightbox-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* Quand la modale est active : apparition globale */
.lightbox-modal.active {
    opacity: 1;
    pointer-events: auto;
    animation: modalAppear 0.3s steps(3, end) forwards;
}

/* Animation en boucle lente et fluide pour l'ensemble du contenu HUD de la modale */
.lightbox-modal.active .lightbox-content {
    animation: hudGlitchLoop 4s infinite ease-in-out;
}

.lightbox-content {
    position: relative;
    max-width: 80%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 65vh;
    object-fit: contain;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
}

/* Les textes HUD et l'encadré de description dans la lightbox héritent du glitch */
.lightbox-desc {
    font-family: 'Inter', monospace;
    font-size: 11px;
    color: #fff;
    letter-spacing: 1px;
    text-align: center;
    background: rgba(0, 0, 0, 0.9);
    padding: 12px 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: hudTextFlicker 4s infinite steps(2, start);
}

.close-lightbox {
    position: absolute;
    top: -40px;
    right: 0;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    font-size: 16px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.close-lightbox:hover {
    background: #fff;
    color: #000;
}

/* Keyframes des Apparitions et Glitches */
@keyframes modalAppear {
    0% {
        opacity: 0;
        transform: scale(0.95) skewX(10deg);
        filter: blur(10px);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.02) skewX(-5deg);
        filter: blur(2px);
    }
    100% {
        opacity: 1;
        transform: scale(1) skewX(0deg);
        filter: blur(0);
    }
}

@keyframes hudGlitchLoop {
    0%, 100% {
        transform: translate(0, 0) skew(0deg);
        filter: drop-shadow(0 0 0 rgba(255,255,255,0));
    }
    48% {
        transform: translate(0, 0) skew(0deg);
    }
    50% {
        transform: translate(-2px, 1px) skew(-1deg);
        filter: drop-shadow(1px 0px rgba(255,255,255,0.4));
    }
    52% {
        transform: translate(2px, -1px) skew(1deg);
        filter: drop-shadow(-1px 0px rgba(255,255,255,0.4));
    }
    54% {
        transform: translate(0, 0) skew(0deg);
        filter: none;
    }
    88% {
        transform: translate(0, 0) skew(0deg);
    }
    90% {
        transform: translate(3px, 2px) skew(2deg);
    }
    92% {
        transform: translate(-2px, -1px) skew(-2deg);
    }
    94% {
        transform: translate(0, 0) skew(0deg);
    }
}

@keyframes hudTextFlicker {
    0%, 100% {
        opacity: 1;
        letter-spacing: 1px;
    }
    51% {
        opacity: 0.7;
        letter-spacing: 1.5px;
    }
    53% {
        opacity: 1;
        letter-spacing: 0.8px;
    }
    91% {
        opacity: 0.6;
    }
    93% {
        opacity: 1;
    }
}