body {
    background: #fff;
    color: #111;
    font-family: 'Inter', sans-serif;
}

body.lightbox-open {
    overflow: hidden;
}

.gallery-title {
    text-align: center;
    margin: 40px 0;
    font-family: 'Playfair Display', serif;
}

/* HEADER GLOBAL */
.header {
    width: 100%;
    padding: 20px 0 10px;
    background: #fff;
}

/* STRUCTURE */
.header-inner {
    max-width: 1100px;
    margin: auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* LOGO */
.logo-nav img {
    height: 40px;
    width: auto;
    display: block;
}

/* NAV PRINCIPALE */
.nav-main {
    display: flex;
    gap: 25px;
}

.nav-main a {
    text-decoration: none;
    color: #111;
    font-size: 14px;
    letter-spacing: 1px;
    position: relative;
}

.nav-main a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 0%;
    height: 1px;
    background: #111;
    transition: width 0.3s ease;
}

.nav-main a:hover::after {
    width: 100%;
}

.gallery-heading {
    width: min(780px, calc(100% - 40px));
    margin: 32px auto 40px;
    text-align: center;
}

.gallery-heading .gallery-title {
    margin: 0;
    text-align: center;
    font-size: 28px;
    overflow-wrap: anywhere;
}

.gallery-description {
    margin: 18px auto 0;
    color: #333;
    font-size: 16px;
    line-height: 1.65;
}

.gallery-description p {
    margin: 0;
}

.gallery-description p + p {
    margin-top: 14px;
}

/* ── MASONRY ── */
.gallery {
    width: 100%;
    columns: 3;
    column-gap: 10px;
    padding: 0 20px;
    margin-bottom: 70px;
}

.gallery-item {
    display: block;
    break-inside: avoid;        /* évite qu'une photo soit coupée entre 2 colonnes */
    margin-bottom: 10px;
    border-radius: 8px;
    overflow: hidden;
    min-width: 0;
}

.gallery-item:focus-visible {
    outline: 2px solid #111;
    outline-offset: 3px;
}

.thumb {
    display: block;
    width: 100%;
    height: auto;               /* hauteur naturelle → aucun recadrage */
    object-fit: unset;
    cursor: pointer;
    border-radius: 8px;
    background: #f3f3f3;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.thumb:hover {
    transform: scale(1.03);
    opacity: 0.9;
}

/* ── LIGHTBOX ── */
#lightbox {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    background: transparent;
    color: #fff;
    box-sizing: border-box;
    padding: 20px;
    overflow: hidden;
}

#lightbox::backdrop {
    background: rgba(0, 0, 0, 0.85);
}

.lightbox-panel {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 52px;
    grid-template-rows: 52px minmax(0, 1fr);
    gap: 12px;
    width: 100%;
    height: 100%;
    padding: 12px;
    border: 1px solid #333;
    border-radius: 8px;
    background: #101010;
}

.lightbox-toolbar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.lightbox-position {
    padding-left: 8px;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    color: #ccc;
}

.lightbox-stage {
    position: relative;
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    min-height: 0;
}

#lightbox-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.lightbox-message {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    margin: 0;
    padding: 12px;
    text-align: center;
    font-size: 14px;
    color: #ccc;
}

.lightbox-button {
    display: grid;
    place-items: center;
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    min-height: 52px;
    padding: 0;
    border: 1px solid #555;
    border-radius: 6px;
    background: #202020;
    color: #fff;
    cursor: pointer;
    font: inherit;
    letter-spacing: 0;
    line-height: 1;
    appearance: none;
    touch-action: manipulation;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.lightbox-button:hover,
.lightbox-button:active {
    background: #363636;
    border-color: #aaa;
    transform: none;
    box-shadow: none;
    opacity: 1;
}

.lightbox-button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.lightbox-button svg {
    display: block;
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.lightbox-nav {
    grid-row: 2;
    align-self: center;
}

.lightbox-prev {
    grid-column: 1;
}

.lightbox-next {
    grid-column: 3;
}

#lightbox [hidden] {
    display: none;
}

/* ── PAGE LISTE DES GALERIES ── */
.galleries-list {
    width: min(1100px, calc(100% - 40px));
    margin: 0 auto 70px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.gallery-card {
    display: grid;
    align-content: start;
    min-width: 0;
    gap: 12px;
    color: #111;
    text-decoration: none;
}

.gallery-card img,
.gallery-card-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
}

.gallery-card img {
    display: block;
    height: auto;
    object-fit: cover;
    background: #f3f3f3;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.gallery-card:hover img {
    transform: scale(1.02);
    opacity: 0.92;
}

.gallery-card-placeholder {
    display: grid;
    place-items: center;
    border: 1px solid #ddd;
    color: #777;
    text-align: center;
}

.gallery-card-info {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.gallery-card-info strong {
    font-family: 'Playfair Display', serif;
    font-size: 22px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.gallery-card-info span {
    color: #777;
    font-size: 13px;
}

.empty-state {
    margin: 0 auto 70px;
    padding: 0 20px;
    max-width: 620px;
    color: #777;
    text-align: center;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {

    .gallery-title {
        margin: 26px 0;
    }

    /* Masonry : 2 colonnes sur tablette/mobile */
    .gallery {
        columns: 2;
        column-gap: 8px;
        padding: 0 10px;
    }

    .gallery-item {
        margin-bottom: 8px;
    }

    .header-inner {
        flex-direction: column;
        gap: 10px;
    }

    .nav-main {
        gap: 15px;
    }

    .logo-nav img {
        height: 35px;
    }

    .gallery-heading {
        width: min(680px, calc(100% - 28px));
        margin: 24px auto 30px;
    }

    .gallery-heading .gallery-title {
        font-size: 26px;
    }

    .gallery-description {
        font-size: 15px;
        line-height: 1.6;
    }

    .header {
        padding: 6px 12px 8px;
    }

    .galleries-list {
        width: calc(100% - 20px);
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .gallery-card-info {
        display: grid;
        gap: 4px;
    }

    .gallery-card-info strong {
        font-size: 19px;
    }

    #lightbox {
        padding: 8px;
        padding-top: max(8px, env(safe-area-inset-top));
        padding-right: max(8px, env(safe-area-inset-right));
        padding-bottom: max(8px, env(safe-area-inset-bottom));
        padding-left: max(8px, env(safe-area-inset-left));
    }

    .lightbox-panel {
        grid-template-rows: 52px minmax(0, 1fr) 52px;
        gap: 8px;
        padding: 8px;
    }

    .lightbox-stage {
        grid-column: 1 / -1;
    }

    .lightbox-nav {
        grid-row: 3;
    }
}

@media (max-width: 320px) {
    /* Masonry : 1 colonne sur très petit écran */
    .gallery {
        columns: 1;
    }
}
