/* Aqua Airbnb Gallery v1.0.0 - grille 1+4, mobile scroll-snap, lightbox */

.abg { position: relative; }

.abg-grid {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    height: 480px;
    border-radius: 14px;
    overflow: hidden;
}

.abg-cell { display: block; overflow: hidden; position: relative; cursor: pointer; }
.abg-cell img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: filter .25s ease;
}
.abg-cell:hover img { filter: brightness(.92); }

.abg-main { grid-row: 1 / span 2; }

/* 5+ images : grande a gauche, 2x2 a droite */
.abg-n5 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.abg-n5 .abg-main { grid-column: 1 / span 2; grid-row: 1 / span 2; }

/* 3-4 images : grande + colonne */
.abg-n4 { grid-template-columns: 2fr 1fr 1fr; }
.abg-n4 .abg-main { grid-column: 1; grid-row: 1 / span 2; }
.abg-n3 { grid-template-columns: 2fr 1fr; }
.abg-n3 .abg-main { grid-column: 1; grid-row: 1 / span 2; }
.abg-n2 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.abg-n2 .abg-main { grid-row: 1; }
.abg-n1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.abg-n1 .abg-main { grid-row: 1; }

.abg-btn {
    position: absolute; right: 16px; bottom: 16px; z-index: 3;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 14px; border-radius: 8px;
    background: #ffffff; color: #222222;
    border: 1px solid #222222;
    font-size: 14px; font-weight: 600; line-height: 1.2;
    cursor: pointer; transition: transform .15s ease, box-shadow .15s ease;
}
.abg-btn:hover { transform: scale(1.03); box-shadow: 0 2px 8px rgba(0,0,0,.18); }

.abg-counter {
    position: absolute; right: 14px; bottom: 14px; z-index: 3;
    background: rgba(0,0,0,.55); color: #fff;
    padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600; letter-spacing: .03em;
}

/* ---- Mobile : scroll-snap horizontal, une image par ecran ---- */
@media (max-width: 767px) {
    .abg-grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        height: 300px;
        border-radius: 12px;
    }
    .abg-grid::-webkit-scrollbar { display: none; }
    .abg-cell { flex: 0 0 100%; scroll-snap-align: start; }
    .abg-btn span { display: none; }           /* icone seule sur mobile */
    .abg-btn { padding: 8px; }
    .abg-counter[hidden] { display: inline-block !important; }
}

/* ---- Lightbox (overlay teleporte dans body) ---- */
.abg-lb {
    position: fixed; inset: 0; z-index: 999999;
    background: rgba(10, 10, 10, .96);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity .25s ease;
}
.abg-lb.abg-visible { opacity: 1; }
.abg-lb img {
    max-width: 92vw; max-height: 86vh;
    object-fit: contain; border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
.abg-lb-close, .abg-lb-prev, .abg-lb-next {
    position: absolute; z-index: 2;
    background: rgba(255,255,255,.12); color: #fff;
    border: 1px solid rgba(255,255,255,.35);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    border-radius: 50%; width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 20px; line-height: 1;
    transition: background .2s ease;
}
.abg-lb-close:hover, .abg-lb-prev:hover, .abg-lb-next:hover { background: rgba(255,255,255,.28); }
.abg-lb-close { top: 18px; right: 18px; }
.abg-lb-prev  { left: 14px; top: 50%; transform: translateY(-50%); }
.abg-lb-next  { right: 14px; top: 50%; transform: translateY(-50%); }
.abg-lb-count {
    position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
    color: #fff; font-size: 14px; font-weight: 600; letter-spacing: .04em;
}
@media (max-width: 767px) {
    .abg-lb-prev, .abg-lb-next { width: 38px; height: 38px; }
}

body.abg-locked { overflow: hidden; }
