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

:root {
    --bg: #fff;
    --text: #1a1a1a;
    --muted: #999;
    --border: #e8e8e8;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: "DM Sans", sans-serif;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.08em;
}

/* Header */
header {
    position: fixed;
    inset: 0 0 auto;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 20px 44px;
    background: transparent;
    mix-blend-mode: difference;
    color: #fff;
    font-family: "DM Sans", sans-serif;
    font-size: clamp(28px, 4vw, 56px);
    font-weight: 500;
    line-height: 1;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.burger {
    display: none;
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    cursor: pointer;
    line-height: 1;
}
.burger svg line {
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 0.4s cubic-bezier(0.76, 0, 0.24, 1), opacity 0.25s ease;
}
.burger.open svg line:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger.open svg line:nth-child(2) { opacity: 0; transform: scaleX(0); }
.burger.open svg line:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

header nav {
    display: flex;
    gap: 2rem;
    align-items: baseline;
}

header nav a, header button {
    all: unset;
    cursor: pointer;
    color: inherit;
    font-weight: 300;
    display: inline-block;
    transition: transform 0.45s cubic-bezier(0.76, 0, 0.24, 1);
}

header nav a,
header nav button {
    padding: 6px 16px;
    font-size: 0.55em;
}

/* Grid */
.grid {
    columns: 5;
    gap: 1px;
}

.grid-item {
    break-inside: avoid;
    margin-bottom: 1px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.grid-item.visible { opacity: 1; transform: none; }

.r-16-9 { aspect-ratio: 16 / 9; }
.r-9-16 { aspect-ratio: 9 / 16; }
.r-4-5  { aspect-ratio: 4 / 5;  }
.r-1-1  { aspect-ratio: 1 / 1;  }

.grid-item img,
.grid-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.35s ease;
}
.grid-item:hover img,
.grid-item:hover video { opacity: 0.85; }

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.lightbox.open { opacity: 1; pointer-events: all; }

.lightbox img,
.lightbox video {
    max-width: 82vw;
    max-height: 92vh;
    object-fit: contain;
    display: block;
}

.lb-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 24px;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.2s ease;
}
.lb-arrow:hover { opacity: 1; }
.lb-prev { left: 24px; }
.lb-next { right: 24px; }
.lb-arrow svg { width: 48px; height: 48px; stroke: #fff; stroke-width: 1; fill: none; }


/* Responsive */
@media (max-width: 1024px) {
    .grid { display: block; columns: 2; column-gap: 6px; }
    .grid-item { break-inside: avoid; margin-bottom: 6px; aspect-ratio: unset; }
    .grid-item img, .grid-item video { height: auto; }
    header { padding: 18px 24px; }
}
@media (max-width: 768px) {
    #posts { grid-template-columns: 1fr !important; gap: 0 !important; }
    .grid-item:hover img, .grid-item:hover video, .projet:hover img, .projet:hover video { opacity: 1; }
    #intro { padding: 24px 16px !important; }
    .tag-year { font-size: 0.67em; }
    .tag { font-size: 0.67em !important; padding: 2px 10px !important; border-width: 1px !important; margin-left: 2px !important; }
    #posts .projet { padding: 0 !important; columns: 1 !important; }
    html { scroll-snap-type: y mandatory; }
    .grid {
        display: flex;
        flex-direction: column;
        gap: 0;
        padding-bottom: 50svh;
    }
    .grid-item {
        flex-shrink: 0;
        width: 100%;
        margin-bottom: 0;
        scroll-snap-align: center;
        scroll-snap-stop: always;
        opacity: 0.25;
        filter: blur(5px);
        transform: none;
        transition: opacity 0.3s ease, filter 0.3s ease;
    }
    .grid-item.r-16-9 { aspect-ratio: 16/9; }
    .grid-item.r-9-16 { aspect-ratio: 9/16; }
    .grid-item.r-4-5  { aspect-ratio: 4/5;  }
    .grid-item.r-1-1  { aspect-ratio: 1/1;  }
    .grid-item.mob-active { opacity: 1; filter: none; }
    .grid-item img,
    .grid-item video { height: 100%; object-fit: cover; }
    header {
        flex-direction: column;
        align-items: stretch;
        padding: 0;
        mix-blend-mode: normal;
        overflow: hidden;
        transition: background 0.2s ease;
    }
    .header-left { justify-content: space-between; padding: 14px 16px; gap: 0; }
    .burger { display: flex; }
    header > a { display: none !important; }
    header > nav {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 0 16px;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height 0.4s cubic-bezier(0.76, 0, 0.24, 1), opacity 0.2s ease, padding 0.35s cubic-bezier(0.76, 0, 0.24, 1);
    }
    header > nav.open {
        max-height: 260px;
        opacity: 1;
        padding: 16px;
        padding-bottom: 20px;
    }
    header > nav a {
        all: unset;
        cursor: pointer;
        color: inherit;
        display: inline-block;
        border: 2px solid currentColor;
        border-radius: 999px;
        padding: 6px 20px;
        font-size: 0.6em;
        font-weight: 300;
        opacity: 0;
    }
    header > nav.open a { animation: mob-link-in 0.3s ease forwards; }
    header > nav.open a:nth-child(1) { animation-delay: 0.10s; }
    header > nav.open a:nth-child(2) { animation-delay: 0.18s; }
    header > nav.open a:nth-child(3) { animation-delay: 0.26s; }
    header > nav.open.closing a { animation: mob-link-out 0.22s ease both !important; }
    header > nav.open.closing a:nth-child(1) { animation-delay: 0.08s !important; }
    header > nav.open.closing a:nth-child(2) { animation-delay: 0.04s !important; }
    header > nav.open.closing a:nth-child(3) { animation-delay: 0s !important; }
    .scroll-track {
        position: fixed;
        top: 54px;
        left: 16px;
        width: calc(100% - 32px);
        height: 2px;
        border-radius: 999px;
        background: rgba(255,255,255,0.2);
        z-index: 9999;
        mix-blend-mode: difference;
    }
    .scroll-progress {
        height: 100%;
        width: 0%;
        background: #fff;
        border-radius: 999px;
        transition: width 0.1s linear;
    }
}

@keyframes mob-link-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}
@keyframes mob-link-out {
    from { opacity: 1; transform: none; }
    to   { opacity: 0; transform: translateY(4px); }
}

.mobile-ig {
    display: flex;
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    color: #fff;
    mix-blend-mode: difference;
}


@media (min-width: 769px) {
    .mobile-ig { display: none; }
    .scroll-track { display: none; }
}


/* Pages projet */

#postsIntro {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}
#postsIntro .projet {
    width: 100%;
    height: 100%;
}
#postsIntro img,
#postsIntro video,
#postsIntro iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#posts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
}
.projet {
    overflow: hidden;
}
.projet img,
.projet video,
.projet iframe {
    width: 100%;
    display: block;
}


#intro {
    padding: 40px 44px;
    font-family: "DM Sans", sans-serif;
    font-size: clamp(16px, 2vw, 28px);
    font-weight: 500;
    line-height: 1.2;
    color: var(--text, #1a1a1a);
}
#introTitle {
    font-size: clamp(24px, 3.5vw, 48px);
    line-height: 1;
    margin-bottom: 1.2rem;
}
#intro a { all: unset; }
#intro #italic { font-style: italic; }

.tag-year {
    display: inline-block;
    border: 1px solid var(--text);
    border-radius: 999px;
    padding: 2px 10px;
    background: var(--text);
    color: var(--bg);
    font-size: 0.6em;
    font-weight: 500;
    vertical-align: middle;
}

.tag {
    display: inline-block;
    border: 2px solid currentColor;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 0.45em;
    font-weight: 500;
    vertical-align: middle;
    margin-left: 4px;
    letter-spacing: 0.05em;
}
