/* =============================================================
   gallery.css — Page Réalisations
   Haussmann Sols Résine
   ============================================================= */

/* ----- Page header ----- */
.page-header {
    padding: 140px 0 64px;
    text-align: center;
}

.page-header h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    color: var(--color-text, #1a1a1a);
    margin-bottom: 0;
}

.page-header h1 strong {
    font-weight: 600;
}

.page-header .accent-line {
    margin: 20px auto;
}

.page-header-subtitle {
    font-size: 1.1rem;
    color: var(--color-muted, #888);
    margin: 0;
}

/* ----- Filter buttons ----- */
.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 48px;
}

.gallery-filter-btn {
    display: inline-block;
    padding: 10px 24px;
    border: 1.5px solid #d0c9be;
    border-radius: 999px;
    background: transparent;
    color: var(--color-text, #1a1a1a);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.gallery-filter-btn:hover {
    background: var(--color-accent-dark, #c0a060);
    border-color: var(--color-accent-dark, #c0a060);
    color: #fff;
}

.gallery-filter-btn.active {
    background: var(--color-accent-dark, #c0a060);
    border-color: var(--color-accent-dark, #c0a060);
    color: #fff;
}

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

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

@media (max-width: 575px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
}

/* ----- Gallery item ----- */
.gallery-item {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    background: #efe8dc;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: scale(1.02);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.14);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.gallery-item:hover img {
    transform: scale(1.04);
}

/* Hidden state (filtering) */
.gallery-item.hidden {
    display: none;
}

/* ----- Title overlay ----- */
.gallery-item-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 32px 16px 14px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.55) 0%, transparent 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    pointer-events: none;
}

/* ----- Avant / Après badge ----- */
.badge-avant-apres {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    background: var(--color-accent-dark, #c0a060);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: 4px;
    pointer-events: none;
}

/* ================================================================
   BEFORE / AFTER SLIDER OVERLAY
   ================================================================ */

.ba-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.88);
    align-items: center;
    justify-content: center;
}

.ba-overlay.active {
    display: flex;
}

.ba-close {
    position: absolute;
    top: 20px;
    right: 24px;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.ba-close:hover {
    opacity: 1;
}

.ba-container {
    position: relative;
    max-width: 90vw;
    max-height: 80vh;
    width: 900px;
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    overflow: hidden;
    user-select: none;
}

/* After image (base layer, full width) */
.ba-container > .ba-after-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Before image (clipped layer on top) */
.ba-before {
    position: absolute;
    inset: 0;
    width: 50%;
    overflow: hidden;
    border-right: 3px solid #fff;
}

.ba-before-img {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: auto;
    /* width is forced via JS to match the container */
    object-fit: cover;
}

/* Range slider */
.ba-slider {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: ew-resize;
    margin: 0;
    z-index: 10;
    -webkit-appearance: none;
    appearance: none;
}

/* Labels */
.ba-label {
    position: absolute;
    bottom: 14px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-radius: 4px;
    pointer-events: none;
    z-index: 5;
}

.ba-label-before {
    left: 14px;
}

.ba-label-after {
    right: 14px;
}

/* Before-image width fix: must fill the ba-container width for correct crop */
.ba-before .ba-before-img {
    width: calc(100vw * 0.9);
    max-width: 900px;
}

/* Responsive */
@media (max-width: 767px) {
    .ba-container {
        width: 95vw;
    }

    .page-header {
        padding: 120px 0 48px;
    }
}
