/* ========== RESET ========== */
:where(:not(html, iframe, canvas, img, svg, video, audio):not(svg *, symbol *)) {
    all: unset;
    display: revert;
}
*, *::after, *::before { box-sizing: border-box; }
* {
    outline: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    cursor: none;
}

/* ========== VARIABLES ========== */
:root {
    --color-black: #000;
    --color-white: #fff;
    --color-grey: #7f7f7f;
    --fast: 250ms;
    --ease-in: cubic-bezier(0.895, 0.03, 0.685, 0.22);
    --ease-out: cubic-bezier(0.165, 0.84, 0.44, 1);
    --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
    --body-padding: 1.3rem;
    --z-nav: 10;
    --z-cursor: 9999;
    --z-splash: 30;
    --vh: 1vh;
}

/* ========== BASE ========== */
html {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
body {
    background: var(--color-white);
    color: var(--color-black);
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* ========== LOADING SCREEN ========== */
.loader {
    position: fixed;
    inset: 0;
    z-index: var(--z-splash);
    background: var(--color-white);
    display: flex;
    align-items: center;
    justify-content: center;
}
.loader.done {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s var(--ease-out);
}
/* Dot — pops first with scale */
.loader-dot {
    width: 3px;
    height: 3px;
    background: rgba(0, 0, 0, 0.7);
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -1.5px;
    margin-left: -1.5px;
    opacity: 0;
    transform: scale(0);
}
.loader-dot.pop {
    animation: dotPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes dotPop {
    0%   { opacity: 0; transform: scale(0); }
    60%  { opacity: 1; transform: scale(1.4); }
    100% { opacity: 1; transform: scale(1); }
}

/* Cross — wraps both lines, rotates 45deg */
.loader-cross {
    position: absolute;
    width: 9px;
    height: 9px;
    top: 50%;
    left: 50%;
    margin-top: -4.5px;
    margin-left: -4.5px;
    opacity: 0;
    transform: rotate(0deg);
}
.loader-cross.spin {
    animation: crossSpin 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes crossSpin {
    0%   { opacity: 0; transform: rotate(0deg); }
    30%  { opacity: 1; }
    100% { opacity: 1; transform: rotate(45deg); }
}
.loader-cross-h {
    position: absolute;
    width: 9px;
    height: 1px;
    top: 50%;
    left: 0;
    margin-top: -0.5px;
    background: rgba(0, 0, 0, 0.4);
}
.loader-cross-v {
    position: absolute;
    width: 1px;
    height: 9px;
    left: 50%;
    top: 0;
    margin-left: -0.5px;
    background: rgba(0, 0, 0, 0.4);
}

/* Square cursor — pops with bounce */
.loader-cursor {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(0, 0, 0, 0.5);
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -14px;
    margin-left: -14px;
    opacity: 0;
    transform: scale(0);
}
.loader-cursor.pop {
    animation: cursorPop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes cursorPop {
    0%   { opacity: 0; transform: scale(0); }
    50%  { opacity: 1; transform: scale(1.12); }
    70%  { opacity: 1; transform: scale(0.94); }
    100% { opacity: 1; transform: scale(1); }
}

/* ========== SCROLL CONTAINER ========== */
.scroll-container {
    height: calc(var(--vh, 1vh) * 100);
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}

/* ========== CURSOR (SQUARE) ========== */
.cursor {
    position: fixed;
    z-index: var(--z-cursor);
    pointer-events: none;
    mix-blend-mode: difference;
    opacity: 0;
    transition: opacity 0.4s var(--ease-out);
}
.cursor.visible {
    opacity: 1;
}
.cursor-outer {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width var(--fast) var(--ease-in-out),
                height var(--fast) var(--ease-in-out),
                border-color var(--fast) var(--ease-in-out),
                background var(--fast) var(--ease-in-out);
}
.cursor-center {
    width: 3px;
    height: 3px;
    background: rgba(255, 255, 255, 0.8);
    position: absolute;
    transition: opacity var(--fast) var(--ease-in-out);
}
.cursor-cross-h,
.cursor-cross-v {
    position: absolute;
    background: rgba(255, 255, 255, 0.5);
    transition: opacity var(--fast) var(--ease-in-out),
                transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.cursor.hover .cursor-cross-h {
    transform: rotate(45deg);
}
.cursor.hover .cursor-cross-v {
    transform: rotate(45deg);
}
.cursor-cross-h {
    width: 9px;
    height: 1px;
}
.cursor-cross-v {
    width: 1px;
    height: 9px;
}
.cursor-corner {
    position: absolute;
    width: 10px;
    height: 10px;
    border-color: rgba(255, 255, 255, 0.7);
    border-style: solid;
    border-width: 0;
    opacity: 0;
    transition: opacity var(--fast) var(--ease-in-out);
}
.cursor-corner--tl { top: -1px; left: -1px; border-top-width: 1px; border-left-width: 1px; }
.cursor-corner--tr { top: -1px; right: -1px; border-top-width: 1px; border-right-width: 1px; }
.cursor-corner--bl { bottom: -1px; left: -1px; border-bottom-width: 1px; border-left-width: 1px; }
.cursor-corner--br { bottom: -1px; right: -1px; border-bottom-width: 1px; border-right-width: 1px; }

.cursor.hover .cursor-outer {
    border-color: transparent;
    background: none;
}
.cursor.hover .cursor-corner {
    opacity: 1;
}

/* ========== NAVIGATION (FIXED) ========== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-nav);
    pointer-events: none;
    padding: var(--body-padding);
    background: none;
}

.nav-logo {
    pointer-events: auto;
    font-weight: 400;
    letter-spacing: -0.01em;
    color: var(--color-white);
    mix-blend-mode: difference;
    transform-origin: top left;
    opacity: 0;
    transform: translateY(-80px);
    background: transparent;
    display: block;
    width: fit-content;
}
.nav-logo:hover { opacity: 0.5; }
.nav-logo.revealed {
    animation: logoSlideDown 0.5s var(--ease-out) forwards;
}
@keyframes logoSlideDown {
    0% {
        opacity: 0;
        transform: translateY(-80px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== BOTTOM NAV (FIXED) ========== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: var(--z-nav);
    pointer-events: none;
    padding: var(--body-padding);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.nav-btn {
    pointer-events: auto;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--color-black);
    border: 1px solid rgba(0, 0, 0, 0.25);
    padding: 0.65rem 1.4rem;
    border-radius: 0px;
    opacity: 0;
    transform: translateY(20px);
}
.nav-btn:hover {
    background: var(--color-black);
    color: var(--color-white);
    border-color: var(--color-black);
}
.nav-btn.revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s var(--ease-out),
                transform 0.6s var(--ease-out),
                background var(--fast) var(--ease-out),
                color var(--fast) var(--ease-out),
                border-color var(--fast) var(--ease-out);
}
.drive-link {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: var(--z-nav);
    padding: var(--body-padding);
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--color-grey);
    pointer-events: auto;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: color var(--fast) var(--ease-out);
}
.drive-link:hover {
    color: var(--color-black);
}
.drive-link.revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s var(--ease-out),
                transform 0.6s var(--ease-out),
                color var(--fast) var(--ease-out);
}

.nav-star {
    pointer-events: auto;
    font-size: 1.5rem;
    color: var(--color-black);
    opacity: 0;
    margin-left: 0.5rem;
    transform: translateY(20px);
}
.nav-star.revealed {
    opacity: 0.6;
    transform: translateY(0);
    transition: opacity 0.6s var(--ease-out),
                transform 0.6s var(--ease-out);
}
.nav-star:hover {
    opacity: 1;
    transform: rotate(90deg);
    transition: opacity var(--fast) var(--ease-out),
                transform 0.6s var(--ease-in-out);
}

/* ========== SLIDE (GENERIC) ========== */
.slide {
    width: 100%;
    height: calc(var(--vh, 1vh) * 100);
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
    background: transparent;
}

/* ========== SLIDE TYPE 1 : CINEMASCOPE ========== */
.slide--fullbleed {
    display: flex;
    align-items: center;
    justify-content: center;
}
.slide--fullbleed .slide-media {
    width: 100%;
    height: calc(33.25vh + 18px);
    margin-top: -7px;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transition: opacity 1.2s var(--ease-out);
}
.slide--fullbleed .slide-media.revealed {
    opacity: 1;
}
.slide--fullbleed .slide-media video,
.slide--fullbleed .slide-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: transparent;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 730px) {
    .bottom-nav {
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    .nav-btn {
        font-size: 0.6rem;
        padding: 0.35rem 0.65rem;
    }
}
/* ========== DOT GRID BACKGROUND ========== */
.dot-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.2s var(--ease-out);
}
.dot-grid.revealed {
    opacity: 1;
}
.dot-grid.blurred {
    filter: blur(20px);
    transition: filter 0.6s var(--ease-out);
}
.dot-grid.unblurred {
    filter: blur(0px);
    transition: filter 0.6s var(--ease-out);
}
.dot-grid canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ========== POPUPS (IE2000 SOBER) ========== */
.popup {
    position: fixed;
    width: 70vw;
    height: 70vh;
    background: var(--color-white);
    border: 1px solid var(--color-black);
    z-index: 15;
    display: flex;
    flex-direction: column;
    transform-origin: center center;
}
.popup.opening {
    animation: popupOpen 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    will-change: transform, opacity;
}
.popup.closing {
    animation: popupClose 0.35s cubic-bezier(0.55, 0, 1, 0.45) forwards;
    pointer-events: none;
    will-change: transform, opacity;
}
@keyframes popupOpen {
    0%   { opacity: 0; transform: scale(0.15); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes popupClose {
    0%   { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.15); }
}
.popup-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 32px;
    min-height: 32px;
    padding: 0 10px;
    background: var(--color-black);
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-white);
}
.popup-titlebar-drag {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
}
.popup-close {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--color-white);
    opacity: 0.5;
    transition: opacity var(--fast) var(--ease-out);
    pointer-events: auto;
    flex-shrink: 0;
}
.popup-close:hover {
    opacity: 1;
}
.popup-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem;
    position: relative;
    font-size: 0.85rem;
    font-weight: 300;
    line-height: 1.6;
    color: var(--color-black);
    scrollbar-width: thin;
    scrollbar-color: var(--color-black) transparent;
}
.popup-body::-webkit-scrollbar {
    width: 6px;
    background: transparent;
}
.popup-body::-webkit-scrollbar-track {
    background: transparent;
}
.popup-body::-webkit-scrollbar-thumb {
    background: var(--color-black);
    border-radius: 0 !important;
    -webkit-border-radius: 0 !important;
}
.popup-body::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
}
.popup-body::-webkit-scrollbar-corner {
    background: transparent;
}
.popup-body h2 {
    font-size: 1.4rem;
    font-weight: 400;
    letter-spacing: -0.01em;
    margin-bottom: 1rem;
    display: block;
}
.popup-body p {
    margin-bottom: 1rem;
    opacity: 0.7;
    display: block;
}
.popup-body .popup-video {
    width: 100%;
    aspect-ratio: 16/9;
    background: rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.1);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-grey);
}

/* ========== POPUP SIZE VARIANTS ========== */
/* 1200–1919px : taille verrouillée à la référence 1920px */
.popup[data-name="project"] {
    width: 1440px !important;
    height: 960px !important;
}

/* ≥1920px : légèrement plus grand */
@media (min-width: 1920px) {
    .popup[data-name="project"] {
        width: 78vw !important;
        height: 83vh !important;
    }
}
.popup[data-name="lab"] {
    width: 62vw !important;
    height: 94vh !important;
}
.popup[data-name="lab"] .popup-body {
    padding: 0;
    overflow-y: auto;
}
.popup[data-name="contact"] {
    width: 36vw !important;
    height: auto !important;
    min-height: 0;
}

/* ========== POPUP RESIZE HANDLES ========== */
.popup-resize {
    position: absolute;
    z-index: 2;
}
.popup-resize--e {
    top: 0; right: -4px; width: 8px; height: 100%;
    cursor: e-resize;
}
.popup-resize--s {
    bottom: -4px; left: 0; width: 100%; height: 8px;
    cursor: s-resize;
}
.popup-resize--w {
    top: 0; left: -4px; width: 8px; height: 100%;
    cursor: w-resize;
}
.popup-resize--n {
    top: -4px; left: 0; width: 100%; height: 8px;
    cursor: n-resize;
}
.popup-resize--se {
    bottom: -5px; right: -5px; width: 14px; height: 14px;
    cursor: se-resize;
}
.popup-resize--sw {
    bottom: -5px; left: -5px; width: 14px; height: 14px;
    cursor: sw-resize;
}
.popup-resize--ne {
    top: -5px; right: -5px; width: 14px; height: 14px;
    cursor: ne-resize;
}
.popup-resize--nw {
    top: -5px; left: -5px; width: 14px; height: 14px;
    cursor: nw-resize;
}

/* ========== PROJECT PAGE — SVG FOLDER STACK ========== */
.folder-stack {
    position: relative;
    width: 100%;
}
.folder-stack svg {
    width: 100%;
    height: 100%;
    display: block;
}
.folder-stack .folder-item {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}
.folder-stack .folder-item.open {
    transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Content panels — tied to their folder, hidden until clicked */
.folder-content-area {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}
.folder-cover-svg {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}
.folder-cover-svg svg {
    width: 100%;
    height: 100%;
    display: block;
}
.folder-cover-svg .folder-item {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.folder-content-panel {
    position: absolute;
    padding: 1.2rem 1.6rem;
    overflow: hidden;
    pointer-events: none;
    scrollbar-width: thin;
    scrollbar-color: var(--color-black) transparent;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.folder-content-panel.active {
    opacity: 1;
    pointer-events: none;
    overflow: clip;
}
.folder-content-panel.active .folder-row {
    overflow-y: auto;
    height: 100%;
}
.folder-content-panel.active .popup-video-wrap {
    pointer-events: auto;
}
.folder-content-panel .folder-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}
.folder-content-panel:nth-child(even) .folder-row {
    align-items: flex-end;
}
.folder-content-panel .folder-media-col {
    width: 68%;
}
.folder-content-panel .folder-text-col {
    width: auto;
}
.folder-content-panel h3 {
    display: block;
    font-size: 0.77rem;
    font-weight: 400;
    letter-spacing: -0.01em;
    margin-bottom: 0.35rem;
}
.folder-content-panel p {
    display: block;
    margin-bottom: 0.4rem;
    opacity: 0.7;
    font-size: 0.55rem;
    line-height: 1.6;
}
/* Custom video player */
.popup-video-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    overflow: hidden;
    cursor: pointer;
}
.popup-video-wrap video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.popup-video-wrap video:fullscreen        { object-fit: contain; background: #000; width: 100vw; height: 100vh; }
.popup-video-wrap video:-webkit-full-screen{ object-fit: contain; background: #000; width: 100vw; height: 100vh; }
.popup-video-wrap video:-moz-full-screen  { object-fit: contain; background: #000; width: 100vw; height: 100vh; }
.popup-video-wrap video:-ms-fullscreen    { object-fit: contain; background: #000; width: 100vw; height: 100vh; }
.popup-video-wrap .vid-play-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.25);
    opacity: 1;
    transition: opacity 0.25s ease;
    pointer-events: none;
}
.popup-video-wrap:hover .vid-play-btn { opacity: 1; }
.popup-video-wrap.playing .vid-play-btn { opacity: 0 !important; }
.vid-play-btn svg {
    width: 2rem;
    height: 2rem;
    fill: #fff;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
}
/* Video bottom bar */
.vid-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
}
.popup-video-wrap:hover .vid-controls { opacity: 1; pointer-events: auto; }
/* Progress / scrubber bar */
.vid-progress {
    width: 100%;
    height: 2px;
    background: rgba(255,255,255,0.2);
    cursor: pointer;
    flex-shrink: 0;
    transition: height 0.15s ease;
}
.vid-progress:hover { height: 4px; }
.vid-progress-fill {
    height: 100%;
    background: #fff;
    width: 0%;
    pointer-events: none;
}
/* Buttons row */
.vid-controls-btns {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0.3rem 0.4rem;
}
.vid-controls-btns button {
    background: none;
    border: none;
    padding: 0;
    width: 1.1rem;
    height: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.vid-controls-btns button svg { width: 0.7rem; height: 0.7rem; fill: #fff; }
/* Keep old selector working */
.vid-controls button {
    background: none;
    border: none;
    padding: 0;
    width: 1.1rem;
    height: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.vid-controls button svg { width: 0.7rem; height: 0.7rem; fill: #fff; }
/* Mute icon toggle */
.vid-mute-btn .icon-unmuted { display: none; }
.popup-video-wrap.vid-unmuted .vid-mute-btn .icon-muted { display: none; }
.popup-video-wrap.vid-unmuted .vid-mute-btn .icon-unmuted { display: block; }
/* Volume slider — horizontal, YouTube style */
.vid-volume-group {
    display: flex;
    align-items: center;
    gap: 0;
}
.vid-vol-range {
    width: 0;
    opacity: 0;
    appearance: none;
    -webkit-appearance: none;
    height: 3px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    transition: width 0.2s ease, opacity 0.2s ease, margin 0.2s ease;
    margin: 0;
}
.vid-volume-group:hover .vid-vol-range {
    width: 3rem;
    opacity: 1;
    margin-left: 0.2rem;
}
.vid-vol-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}
.vid-vol-range::-moz-range-thumb {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    border: none;
    cursor: pointer;
}
/* Expand button pushed to right */
.vid-expand-btn { margin-left: auto; }

/* Expanded mode — fills the entire popup window */
.popup-video-wrap.vid-expanded {
    position: absolute;
    inset: 0;
    z-index: 99999;
    aspect-ratio: auto;
    border-radius: 0;
    background: #000;
}
.popup-video-wrap.vid-expanded video {
    object-fit: contain;
}
.popup-video-wrap.vid-expanded .vid-controls {
    opacity: 1;
    pointer-events: auto;
}
.popup-video-wrap.vid-expanded .vid-controls-btns {
    padding: 0.5rem 0.8rem;
}
.popup-video-wrap.vid-expanded .vid-controls button,
.popup-video-wrap.vid-expanded .vid-controls-btns button {
    width: 1.5rem;
    height: 1.5rem;
}
.popup-video-wrap.vid-expanded .vid-controls button svg,
.popup-video-wrap.vid-expanded .vid-controls-btns button svg { width: 0.9rem; height: 0.9rem; }
.popup-video-wrap.vid-expanded .vid-volume-group:hover .vid-vol-range { width: 5rem; }
.popup-video-wrap.vid-expanded .vid-progress { height: 3px; }
.popup-video-wrap.vid-expanded .vid-progress:hover { height: 5px; }
.popup-video-wrap.vid-expanded .vid-play-btn svg { width: 3.5rem; height: 3.5rem; }

.folder-content-panel .folder-credits {
    font-size: 0.42rem;
    letter-spacing: 0.03em;
    color: var(--color-grey);
    line-height: 1.4;
    opacity: 0.7;
    margin-top: 0.3rem;
}


/* SVG interactivity */
#fond_noir_folder { pointer-events: none; }

/* Project popup body — bottom-aligned, no padding */
.popup[data-name="project"] .popup-body {
    overflow: hidden;
    padding: 0;
    position: relative;
}
.popup[data-name="project"] .folder-stack {
    position: absolute;
    inset: 0;
}

/* ========== LAB LOADING OVERLAY ========== */
.lab-loader-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    pointer-events: none;
}

/* ========== LAB PAGE — ORGANIC GRID ========== */
.lab-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-auto-rows: 120px;
    grid-auto-flow: row dense;
    gap: 2px;
}
.lab-grid-item {
    position: relative;
    overflow: hidden;
    background: rgba(0,0,0,0.03);
    cursor: pointer;
}
/* ========== LAB LIGHTBOX ========== */
.lab-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0,0,0,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}
.lab-lightbox.active { opacity: 1; }
.lab-lightbox video,
.lab-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 2px;
    cursor: default;
}
.lab-lightbox video { background: #000; }
.lab-lightbox-close {
    position: absolute;
    top: 1.2rem;
    right: 1.5rem;
    font-size: 1.5rem;
    color: #fff;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    font-family: Inter, sans-serif;
    font-weight: 300;
    z-index: 1;
}
.lab-lightbox-close:hover { opacity: 1; }
/* Span variants for organic wall */
.lab-grid-item.s-2x1 { grid-column: span 2; }
.lab-grid-item.s-1x2 { grid-row: span 2; }
.lab-grid-item.s-2x2 { grid-column: span 2; grid-row: span 2; }
.lab-grid-item.s-3x2 { grid-column: span 3; grid-row: span 2; }
.lab-grid-item.s-1x3 { grid-row: span 3; }
.lab-grid-item.s-2x3 { grid-column: span 2; grid-row: span 3; }
.lab-grid-item.s-3x1 { grid-column: span 3; }

/* ========== LAB GRID SEPARATOR ========== */
.lab-grid-separator {
    grid-column: 1 / -1;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 20px 0 10px;
}
.lab-grid-separator::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: rgba(0,0,0,0.3);
}
.lab-grid-separator span {
    position: relative;
    background: var(--color-white);
    padding: 0 1.5rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--color-grey);
}

/* IA section — sous-grille isolée, empêche le dense de remonter les items au-dessus du séparateur */
.lab-ia-section {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-auto-rows: 120px;
    grid-auto-flow: row dense;
    gap: 2px;
}

.lab-grid-item video,
.lab-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ========== CONTACT PAGE ========== */
.contact-layout {
    display: flex;
    flex-direction: column;
    padding: 1.8rem 0 0.6rem;
}
.contact-bio {
    font-size: 0.6rem;
    line-height: 1.7;
    color: var(--color-grey);
    letter-spacing: 0.01em;
    margin-bottom: 1.6rem;
}
.contact-divider {
    width: 100%;
    height: 1px;
    background: rgba(0,0,0,0.1);
    margin-bottom: 1.4rem;
}
.contact-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.contact-email-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.contact-label {
    font-size: 0.42rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-grey);
}
.contact-email {
    font-size: 0.65rem;
    letter-spacing: 0.01em;
    color: var(--color-black);
}
.copy-email {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: opacity 0.2s;
}
.copy-email:hover { opacity: 0.6; }
.copy-icon {
    width: 11px;
    height: 11px;
    flex-shrink: 0;
    opacity: 0.35;
    transition: opacity 0.2s;
}
.copy-email:hover .copy-icon { opacity: 1; }
.copy-icon--check { display: none; }
.copy-email.copied .copy-icon--default { display: none; }
.copy-email.copied .copy-icon--check { display: block; opacity: 1; stroke: #555; }
.copy-email.copied { opacity: 0.6; }
.contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.55rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-black);
    border: 1px solid var(--color-black);
    padding: 0.55rem 1.2rem;
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
}
.contact-btn:hover {
    background: var(--color-black);
    color: var(--color-white);
}
.contact-btn svg {
    width: 12px;
    height: 12px;
    transition: transform 0.2s;
}
.contact-btn:hover svg {
    transform: translateX(3px);
}

/* ========== RESPONSIVE POPUP SIZES ========== */
@media (max-width: 900px) {
    .popup[data-name="lab"],
    .popup[data-name="contact"] {
        width: 90vw !important;
    }
    .popup[data-name="lab"] { width: 92vw !important; height: 90vh !important; }
    .popup[data-name="contact"] { width: 90vw !important; height: auto !important; }
    .lab-grid { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 80px; grid-auto-flow: row dense; }
    .lab-ia-section { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 80px; }
    .contact-bottom { flex-direction: column; gap: 1rem; align-items: flex-start; }
}

/* Hero blur when popups open */
.slide-media.blurred {
    filter: blur(20px);
    transition: filter 0.6s var(--ease-out);
}
.slide-media.unblurred {
    filter: blur(0px);
    transition: filter 0.6s var(--ease-out);
}

/* Make sure content is above the grid */
.scroll-container { position: relative; z-index: 1; background: transparent; }
.nav { z-index: var(--z-nav); }
.bottom-nav { z-index: var(--z-nav); }
.cursor { z-index: var(--z-cursor); }

/* ========== ARCADE EASTER EGG ========== */
#arcadePixel {
    position: fixed;
    bottom: 350px;
    right: 200px;
    width: 100px;
    height: 100px;
    z-index: 11;
    pointer-events: auto;
    cursor: none;
}
#arcadePixel canvas {
    display: none;
}
#arcadePixel .arcade-close {
    display: none;
    color: #fff;
    font-size: 1.2rem;
    font-family: Inter, sans-serif;
    font-weight: 300;
    opacity: 0.4;
    transition: opacity 0.2s;
}
#arcadePixel.active {
    z-index: 21;
    display: flex;
    align-items: center;
    justify-content: center;
}
#arcadePixel.active .arcade-close {
    display: block;
}
#arcadePixel.active .arcade-close:hover {
    opacity: 1;
}
@media (max-width: 768px) {
    #arcadePixel { cursor: auto; }
}
#spaceInvaders {
    position: fixed;
    inset: 0;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: none;
}
#spaceInvaders.visible {
    opacity: 1;
    pointer-events: auto;
}
body.arcade-active .nav-logo,
body.arcade-active .nav-btn,
body.arcade-active .nav-star,
body.arcade-active .drive-link,
body.arcade-active .scroll-container,
body.arcade-active .popup {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.6s ease !important;
}

/* Project popup — mobile/tablet (< 1200px) */
@media (max-width: 1199px) {
    .popup[data-name="project"] {
        width: 95vw !important;
        height: 75vh !important;
        left: 2.5vw !important;
        top: 15vh !important;
    }
}

/* ========== MOBILE RESPONSIVE (≤768px) ========== */
@media (max-width: 768px) {
    /* Restore default cursor on mobile */
    * { cursor: auto; }

    /* Hide custom cursor */
    .cursor { display: none !important; }

    /* Navigation — fixed bottom bar, centered */
    .nav {
        position: fixed;
        top: 0;
        left: 0;
        right: auto;
        padding: 0.8rem;
        pointer-events: none;
    }
    .nav-logo {
        pointer-events: auto;
        color: var(--color-black);
        mix-blend-mode: normal;
    }
    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        justify-content: center;
        padding: 0.8rem;
        flex-wrap: nowrap;
        gap: 0.4rem;
        background: none;
    }
    .nav-btn {
        font-size: 0.75rem;
        padding: 0.5rem 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    .nav-star {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Popups — centered, no drag/resize */
    .popup {
        width: 85vw !important;
        height: 75vh !important;
        left: 7.5vw !important;
        top: 12.5vh !important;
    }
    .popup[data-name="contact"] {
        width: 85vw !important;
        height: auto !important;
    }
    .popup[data-name="lab"] {
        width: 85vw !important;
        height: 80vh !important;
    }
    .popup-resize { display: none; }
    .popup-titlebar {
        height: 40px;
        min-height: 40px;
    }
    .popup-close {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
        opacity: 0.8;
    }
    .popup-body {
        padding: 1rem;
    }
    .popup[data-name="project"] .popup-body {
        padding: 0;
    }

    /* Hero video — smaller on mobile */
    .slide--fullbleed .slide-media {
        height: calc(25vh + 18px);
    }

    /* Lab grid — 2 columns */
    .lab-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 100px;
        grid-auto-flow: row dense;
    }
    .lab-ia-section { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 100px; }
    .lab-grid-item.s-3x2,
    .lab-grid-item.s-2x2 {
        grid-column: span 2;
    }
    .lab-grid-item.s-3x1,
    .lab-grid-item.s-2x1 {
        grid-column: span 2;
    }
    .lab-grid-item.s-1x3 {
        grid-row: span 2;
    }
    .lab-grid-item.s-2x3 {
        grid-column: span 2;
        grid-row: span 2;
    }

    /* Folder content — vertical layout, scaled down 50% */
    .folder-content-panel {
        transform-origin: top left;
    }
    .folder-content-panel .folder-row {
        flex-direction: column;
        align-items: center;
        transform: scale(0.5);
        transform-origin: top left;
        width: 200%;
    }
    .folder-content-panel:nth-child(even) .folder-row {
        flex-direction: column;
        align-items: center;
        transform-origin: top left;
    }
    .folder-content-panel .folder-media-col {
        flex: none;
        width: 100%;
    }
    .folder-content-panel h3 {
        font-size: 0.6rem;
    }
    .folder-content-panel p {
        font-size: 0.45rem;
    }
    .folder-content-panel .folder-credits {
        font-size: 0.35rem;
    }

    /* Video controls — always visible on touch */
    .popup-video-wrap .vid-controls {
        opacity: 1;
        pointer-events: auto;
    }
    .vid-controls button,
    .vid-controls-btns button {
        width: 1.4rem;
        height: 1.4rem;
    }
    .vid-controls button svg,
    .vid-controls-btns button svg {
        width: 0.9rem;
        height: 0.9rem;
    }
    .vid-progress { height: 3px; }
    /* Volume slider always expanded on mobile */
    .vid-vol-range {
        width: 3rem !important;
        opacity: 1 !important;
        margin-left: 0.2rem !important;
    }

    /* Lightbox — larger close button */
    .lab-lightbox-close {
        font-size: 2rem;
        top: 0.8rem;
        right: 0.8rem;
        padding: 0.5rem;
    }

    /* Mobile project grid */
    .mob-project-grid { gap: 0; padding: 0;
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 0;
        overflow-y: auto;
        height: 100%;
    }

    .mob-vid-card { margin-bottom: 0; border-bottom: none;
        border-bottom: 1px solid #2a2a2a;
    }

    /* Video wrap dans la grid occupe toute la largeur */
    .mob-vid-card .popup-video-wrap {
        position: relative;
        width: 100%;
        aspect-ratio: 16/9;
        background: #000;
        cursor: pointer;
        overflow: hidden;
        display: block;
    }

    /* Overlay canvas (poster) par-dessus la vidéo */
    .mob-thumb-overlay {
        position: absolute;
        inset: 0;
        z-index: 2;
        cursor: pointer;
    }

    .mob-thumb-canvas {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    .mob-thumb-title {
        position: absolute;
        bottom: 0.5rem;
        left: 0.75rem;
        color: #fff;
        font-size: 0.85rem;
        font-family: 'Inter', sans-serif;
        font-weight: 400;
        letter-spacing: 0.03em;
        text-shadow: 0 1px 4px rgba(0,0,0,0.8);
        pointer-events: none;
    }

    .mob-thumb-credits {
        position: absolute;
        top: 0.5rem;
        right: 0.75rem;
        color: rgba(255,255,255,0.5);
        font-size: 0.65rem;
        font-family: 'Inter', sans-serif;
        pointer-events: none;
    }

    .mob-thumb-play {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 2.5rem;
        height: 2.5rem;
        background: rgba(255,255,255,0.15);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        pointer-events: none;
        backdrop-filter: blur(4px);
    }

    .mob-thumb-play svg {
        width: 1rem;
        height: 1rem;
        margin-left: 2px;
    }

    /* Active state tap */
    .mob-thumb-overlay:active { opacity: 0.8; }

    .mob-vid-card { margin-bottom: 0; border-bottom: none;
        display: flex;
        flex-direction: column;
        background: #000;
        margin-bottom: 1rem;
        border-bottom: 1px solid #333;
    }
    .mob-vid-title {
        padding: 0.6rem 0.8rem;
        font-size: 0.75rem;
        color: #fff;
        font-weight: 400;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        background: #111;
    }
    .mob-fullscreen-btn {
        position: absolute;
        bottom: 8px;
        right: 8px;
        width: 28px;
        height: 28px;
        background: rgba(0,0,0,0.4);
        border-radius: 3px;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 5;
        border: none;
        opacity: 0.8;
    }
    .mob-fullscreen-btn svg {
        width: 16px;
        height: 16px;
        fill: #fff;
    }
}
