:root {
    --bg: #0a0a0b;
    --surface: #141417;
    --text: #ededf0;
    --muted: #8a8a93;
    --line: rgba(255, 255, 255, 0.09);
    --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --page: 1500px;
    --gutter: clamp(1.25rem, 4vw, 4rem);
    --tile: 270px;
    --radius: 12px;
}

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

html {
    scroll-behavior: smooth;
    background: var(--bg);
}

body {
    margin: 0;
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--text);
    color: var(--bg);
    padding: 0.75rem 1.25rem;
    z-index: 300;
}

.skip-link:focus {
    left: 1rem;
    top: 1rem;
}

/* ---------- En-tête ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.1rem var(--gutter);
    background: rgba(10, 10, 11, 0.72);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    gap: 0.45em;
    text-decoration: none;
    color: var(--text);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.28em;
}

.brand-mark {
    font-weight: 600;
}

.brand-rest {
    font-weight: 300;
    color: var(--muted);
    transition: color 0.4s var(--ease);
}

.brand:hover .brand-rest {
    color: var(--text);
}

.site-nav {
    display: flex;
    gap: clamp(1.25rem, 3vw, 2.5rem);
}

.site-nav a {
    position: relative;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    padding-bottom: 2px;
    transition: color 0.4s var(--ease);
}

.site-nav a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.45s var(--ease);
}

.site-nav a:hover {
    color: var(--text);
}

.site-nav a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* ---------- Introduction ---------- */

.intro {
    max-width: var(--page);
    margin: 0 auto;
    padding: clamp(3.5rem, 9vw, 7rem) var(--gutter) clamp(2.5rem, 5vw, 4rem);
    text-align: center;
}

.intro-title {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    line-height: 1.05;
    margin: 0;
    letter-spacing: -0.015em;
}

.intro-lead {
    margin: 1.1rem auto 0;
    max-width: 34ch;
    color: var(--muted);
    font-size: clamp(0.95rem, 1.6vw, 1.1rem);
    font-weight: 300;
    line-height: 1.6;
}

.intro-meta {
    margin: 1.75rem 0 0;
    color: var(--muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.24em;
}

.intro-gallery {
    padding-bottom: clamp(2rem, 4vw, 3rem);
}

.back-link {
    display: inline-block;
    margin-bottom: 1.75rem;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    transition: color 0.4s var(--ease);
}

.back-link::before {
    content: '\2190';
    margin-right: 0.7em;
    display: inline-block;
    transition: transform 0.4s var(--ease);
}

.back-link:hover {
    color: var(--text);
}

.back-link:hover::before {
    transform: translateX(-4px);
}

.intro-error .back-link {
    margin: 2rem 0 0;
}

/* ---------- Index des séries ---------- */

.collections {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(1.5rem, 3vw, 2.75rem) clamp(1rem, 2vw, 1.75rem);
    max-width: var(--page);
    margin: 0 auto;
    padding: 0 var(--gutter) clamp(4rem, 8vw, 7rem);
}

.collection {
    display: block;
    width: var(--tile);
    text-decoration: none;
    color: inherit;
}

.collection-frame {
    position: relative;
    margin: 0;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--surface);
}

.collection-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.9s var(--ease), filter 0.6s var(--ease);
    filter: brightness(0.92);
}

.collection:hover .collection-frame img,
.collection:focus-visible .collection-frame img {
    transform: scale(1.045);
    filter: brightness(1);
}

.frame-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #5c5c66;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
}

.collection-caption {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 0.9rem;
}

.collection-name {
    margin: 0;
    font-family: var(--serif);
    font-size: 1.02rem;
    font-weight: 400;
    letter-spacing: 0.005em;
    color: var(--text);
}

.collection-count {
    flex: none;
    color: var(--muted);
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    font-variant-numeric: tabular-nums;
    transition: color 0.4s var(--ease);
}

.collection:hover .collection-count {
    color: var(--text);
}

/* ---------- Mosaïque d'une série ---------- */

.mosaic {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(0.75rem, 1.4vw, 1.1rem);
    max-width: var(--page);
    margin: 0 auto;
    padding: 0 var(--gutter) clamp(4rem, 8vw, 7rem);
}

.tile {
    position: relative;
    width: var(--tile);
    aspect-ratio: 4 / 5;
    margin: 0;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--surface);
    cursor: zoom-in;
}

.tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.9s var(--ease), opacity 0.6s var(--ease);
}

.tile::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 11, 0.28);
    opacity: 0;
    transition: opacity 0.5s var(--ease);
    pointer-events: none;
}

.tile:hover img,
.tile:focus-visible img {
    transform: scale(1.035);
}

.tile:hover::after,
.tile:focus-visible::after {
    opacity: 1;
}

.tile:focus-visible {
    outline: 1px solid var(--text);
    outline-offset: 3px;
}

/* ---------- Visionneuse ---------- */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 6, 7, 0.97);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.35s var(--ease);
}

.lightbox[hidden] {
    display: none;
}

.lightbox.is-open {
    opacity: 1;
}

.lightbox-stage {
    margin: 0;
    width: min(94vw, 1500px);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(3.5rem, 8vh, 5.5rem) 0;
}

.lightbox-stage img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius);
    opacity: 0;
    transform: scale(0.985);
    transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
}

.lightbox-stage img.is-loaded {
    opacity: 1;
    transform: none;
}

.lightbox-close,
.lightbox-nav {
    position: absolute;
    background: none;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    font-family: var(--sans);
    line-height: 1;
    transition: color 0.35s var(--ease), transform 0.35s var(--ease);
}

.lightbox-close {
    top: clamp(0.75rem, 2vw, 1.5rem);
    right: clamp(0.75rem, 2vw, 2rem);
    font-size: 2.4rem;
    padding: 0.4rem 0.7rem;
}

.lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
    font-size: clamp(2.4rem, 5vw, 3.6rem);
    padding: 0.5rem 0.9rem;
}

.lightbox-prev {
    left: clamp(0.25rem, 1.5vw, 1.5rem);
}

.lightbox-next {
    right: clamp(0.25rem, 1.5vw, 1.5rem);
}

.lightbox-close:hover,
.lightbox-nav:hover {
    color: var(--text);
}

.lightbox-prev:hover {
    transform: translateY(-50%) translateX(-4px);
}

.lightbox-next:hover {
    transform: translateY(-50%) translateX(4px);
}

.lightbox-nav[disabled] {
    opacity: 0.18;
    cursor: default;
    pointer-events: none;
}

.lightbox-counter {
    position: absolute;
    bottom: clamp(1rem, 3vh, 2rem);
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    color: var(--muted);
    font-size: 0.7rem;
    letter-spacing: 0.22em;
    font-variant-numeric: tabular-nums;
}

body.lightbox-open {
    overflow: hidden;
}

/* ---------- Pied de page ---------- */

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    max-width: var(--page);
    margin: 0 auto;
    padding: 2.25rem var(--gutter) 2.75rem;
    border-top: 1px solid var(--line);
}

.site-footer p {
    margin: 0;
    font-size: 0.72rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
}

.site-footer a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.4s var(--ease);
}

.site-footer a:hover {
    color: var(--text);
}

/* ---------- Apparition au défilement ---------- */

.js .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
    transition-delay: var(--reveal-delay, 0ms);
}

.js .reveal.is-visible {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }

    .js .reveal {
        opacity: 1;
        transform: none;
    }
}

/* Deux vignettes par ligne : en dessous, la largeur fixe laisserait une seule
   colonne perdue au milieu d'un écran de téléphone. */
@media (max-width: 700px) {
    .mosaic {
        gap: 12px;
    }

    .collections {
        gap: 1.5rem 12px;
    }

    .tile,
    .collection {
        width: calc(50% - 6px);
    }
}

@media (max-width: 640px) {
    .site-header {
        padding: 0.9rem var(--gutter);
    }

    .brand {
        font-size: 0.8rem;
        letter-spacing: 0.2em;
    }

    .site-footer {
        justify-content: center;
        text-align: center;
    }
}
