/* =========================================================
   GALERIE — SABLAGE 45
   ========================================================= */

* {
    box-sizing: border-box;
}


/* =========================================================
   PAGE ET INTRODUCTION
   ========================================================= */

.gallery-page {
    width: 100%;
}

.gallery-hero {
    width: calc(100% - 40px);
    max-width: 1100px;
    margin: 2.2rem auto 2.5rem;
    text-align: center;
}

.gallery-hero h1 {
    margin: 0 0 1rem;
    color: #ffffff;
    font-size: clamp(2rem, 4vw, 3.3rem);
    line-height: 1.15;
}

.gallery-hero p {
    max-width: 850px;
    margin: 0 auto;
    color: #e4e4ff;
    font-size: 1.1rem;
    line-height: 1.8;
}


/* =========================================================
   STRUCTURE GÉNÉRALE
   ========================================================= */

.gallery-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 28px;
    width: calc(100% - 40px);
    max-width: 1400px;
    margin: 0 auto 3rem;
    align-items: start;
}


/* =========================================================
   FILTRES
   ========================================================= */

.gallery-filters {
    position: sticky;
    top: 20px;
    padding: 22px;
    background: #0a0f2d;
    border: 1px solid rgba(255, 0, 255, 0.22);
    border-radius: 20px;
    box-shadow: 0 0 18px rgba(255, 0, 255, 0.13);
}

.filters-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.filters-heading h2 {
    margin: 0;
    color: #ffffff;
    font-size: 1.35rem;
}

.close-filters-button {
    display: none;
    border: 0;
    background: transparent;
    color: #ffffff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.filter-field label {
    color: #ffffff;
    font-weight: 800;
}

.filter-field select {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 11px;
    background: #ffffff;
    color: #111827;
    font: inherit;
}

.filter-field select:focus {
    border-color: #66c6ff;
    outline: 3px solid rgba(102, 198, 255, 0.2);
}

.reset-filters-button {
    width: 100%;
    padding: 11px 14px;
    border: 0;
    border-radius: 999px;
    background: #0077c8;
    color: #ffffff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.2s ease;
}

.reset-filters-button:hover {
    background: #0090f0;
}


/* =========================================================
   CONTENU ET BARRE SUPÉRIEURE
   ========================================================= */

.gallery-content {
    min-width: 0;
}

.gallery-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 1.4rem;
}

.gallery-toolbar h2 {
    margin: 0 0 0.35rem;
    color: #ffffff;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.gallery-count {
    margin: 0;
    color: #c9cbff;
    font-size: 0.98rem;
}

.open-filters-button {
    display: none;
    padding: 10px 16px;
    border: 0;
    border-radius: 999px;
    background: #0077c8;
    color: #ffffff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}


/* =========================================================
   GRILLE D’IMAGES
   ========================================================= */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.gallery-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    background: #0a0f2d;
    border: 1px solid rgba(255, 0, 255, 0.22);
    border-radius: 18px;
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.12);
    color: #e4e4ff;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}

.gallery-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 0, 255, 0.45);
    box-shadow: 0 12px 28px rgba(255, 0, 255, 0.18);
}

.gallery-card-button {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: #050817;
    cursor: zoom-in;
}

.gallery-card-image {
    display: block;
    width: 100%;
    height: 240px;
    object-fit: cover;
    object-position: center;
    transition: transform 0.35s ease;
}

.gallery-card:hover .gallery-card-image {
    transform: scale(1.035);
}

.gallery-card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    background: linear-gradient(
        to top,
        rgba(5, 8, 23, 0.75),
        rgba(5, 8, 23, 0.05) 60%
    );
    opacity: 0;
    transition: opacity 0.2s ease;
}

.gallery-card:hover .gallery-card-overlay,
.gallery-card-button:focus-visible .gallery-card-overlay {
    opacity: 1;
}

.gallery-card-zoom {
    display: inline-block;
    padding: 8px 13px;
    border-radius: 999px;
    background: rgba(0, 119, 200, 0.95);
    color: #ffffff;
    font-weight: 800;
}

.gallery-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 15px;
}

.gallery-card-title {
    margin: 0 0 0.7rem;
    color: #ffffff;
    font-size: 1.1rem;
    line-height: 1.35;
}

.gallery-card-description {
    margin: 0 0 0.9rem;
    color: #e4e4ff;
    font-size: 0.95rem;
    line-height: 1.55;
}

.gallery-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: auto;
}

.gallery-card-tags span {
    display: inline-block;
    padding: 6px 9px;
    border-radius: 999px;
    background: rgba(0, 119, 200, 0.18);
    border: 1px solid rgba(102, 198, 255, 0.25);
    color: #dff4ff;
    font-size: 0.83rem;
    font-weight: 700;
}

.gallery-message {
    grid-column: 1 / -1;
    margin: 0;
    padding: 35px 20px;
    background: #0a0f2d;
    border: 1px dashed rgba(255, 255, 255, 0.22);
    border-radius: 18px;
    color: #e4e4ff;
    text-align: center;
}


/* =========================================================
   MODALE IMAGE
   ========================================================= */

body.gallery-modal-open {
    overflow: hidden;
}

.gallery-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    padding: 25px;
    background: rgba(0, 0, 0, 0.88);
    overflow-y: auto;
}

.gallery-overlay[hidden] {
    display: none;
}

.gallery-modal {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: calc(100vh - 50px);
}

.gallery-modal-figure {
    width: 100%;
    max-width: 1150px;
    margin: 0;
}

.gallery-modal-figure img {
    display: block;
    width: 100%;
    max-height: 76vh;
    object-fit: contain;
    object-position: center;
    background: #050817;
    border-radius: 16px 16px 0 0;
}

.gallery-modal-caption {
    padding: 18px 20px;
    background: #0a0f2d;
    border-radius: 0 0 16px 16px;
    color: #e4e4ff;
}

.gallery-modal-caption h2 {
    margin: 0 0 0.6rem;
    color: #ffffff;
    font-size: 1.35rem;
}

.modal-description {
    margin: 0 0 0.85rem;
    line-height: 1.6;
}

.modal-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.modal-details span {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(0, 119, 200, 0.2);
    color: #dff4ff;
    font-size: 0.9rem;
    font-weight: 700;
}

.gallery-modal-close {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 3;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 50%;
    background: #ffffff;
    color: #111827;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

.gallery-modal-navigation {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 50px;
    height: 58px;
    border: 0;
    border-radius: 10px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.92);
    color: #111827;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
}

.gallery-modal-previous {
    left: 8px;
}

.gallery-modal-next {
    right: 8px;
}


/* =========================================================
   CONTACT
   ========================================================= */

.gallery-contact {
    width: calc(100% - 40px);
    max-width: 1000px;
    margin: 2rem auto 3rem;
}

.gallery-contact .InfoContact {
    border-radius: 20px;
}

.gallery-contact h2 {
    color: #ffffff;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1150px) {
    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gallery-card-image {
        height: 250px;
    }
}

@media (max-width: 850px) {
    .gallery-layout {
        display: block;
    }

    .open-filters-button {
        display: inline-flex;
    }

    .gallery-filters {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 9998;
        width: min(340px, 88vw);
        height: 100vh;
        overflow-y: auto;
        border-radius: 0 20px 20px 0;
        transform: translateX(-105%);
        transition: transform 0.25s ease;
    }

    .gallery-filters.mobile-open {
        transform: translateX(0);
    }

    .close-filters-button {
        display: block;
    }
}

@media (max-width: 650px) {
    .gallery-hero,
    .gallery-layout,
    .gallery-contact {
        width: calc(100% - 24px);
    }

    .gallery-hero {
        margin-top: 1.5rem;
    }

    .gallery-toolbar {
        align-items: flex-end;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .gallery-card-image {
        height: 190px;
    }

    .gallery-overlay {
        padding: 10px;
    }

    .gallery-modal {
        min-height: calc(100vh - 20px);
    }

    .gallery-modal-navigation {
        top: auto;
        bottom: 95px;
        width: 46px;
        height: 50px;
    }

    .gallery-modal-previous {
        left: 10px;
    }

    .gallery-modal-next {
        right: 10px;
    }

    .gallery-modal-close {
        top: 8px;
        right: 8px;
    }
}

@media (max-width: 430px) {
    .gallery-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .open-filters-button {
        justify-content: center;
    }

    .gallery-card-image {
        height: 160px;
    }

    .gallery-modal-caption {
        padding: 15px;
    }
}