/* ==============================================================
   Vistaarly · components/gallery.css
   Single-image-at-a-time swipeable gallery for pages/listing.php.
   Same blurred-background-fill technique as card-listing.css but
   larger. Foreground image never cropped, never stretched.
   Paired with assets/js/components/gallery-swipe.js.
   ============================================================== */

.v-gallery {
    position: relative;
    width: 100%;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: var(--sh-card);
}

.v-gallery-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;  /* Square box — any image ratio contained inside, remaining area filled with blur */
    background: var(--color-bg-alt);
    overflow: hidden;
    touch-action: pan-y pinch-zoom;
    isolation: isolate;
}
@media (min-width: 768px) { .v-gallery-viewport { aspect-ratio: 1 / 1; } }

.v-gallery-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 300ms ease-out;
    pointer-events: none;
}
.v-gallery-slide.is-active {
    opacity: 1;
    pointer-events: auto;
    z-index: 1;
}
.v-gallery-slide-bg {
    position: absolute;
    inset: -8%;
    width: 116%;
    height: 116%;
    object-fit: cover;
    filter: blur(36px) saturate(1.2) brightness(0.85);
    transform: scale(1.15);
    z-index: 0;
    pointer-events: none;
}
.v-gallery-slide-fg {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center center !important;
    z-index: 1;
    padding: 16px;
    box-sizing: border-box;
    display: block;
}
.v-gallery-caption {
    position: absolute;
    top: var(--space-3);
    left: var(--space-3);
    padding: 6px 12px;
    background: rgba(11, 15, 25, 0.72);
    color: #fff;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    z-index: 3;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    letter-spacing: 0.02em;
}

/* Arrow controls */
.v-gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--color-primary);
    border: 0;
    cursor: pointer;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    transition: background-color var(--t-fast), transform var(--t-fast);
    -webkit-tap-highlight-color: transparent;
}
.v-gallery-arrow:hover { background: #fff; transform: translateY(-50%) scale(1.04); }
.v-gallery-arrow:disabled { opacity: 0.4; cursor: not-allowed; }
.v-gallery-prev { left: var(--space-3); }
.v-gallery-next { right: var(--space-3); }
@media (max-width: 480px) {
    .v-gallery-arrow { width: 40px; height: 40px; }
    .v-gallery-prev { left: 8px; }
    .v-gallery-next { right: 8px; }
}

/* Dots */
.v-gallery-dots {
    display: flex;
    gap: var(--space-2);
    justify-content: center;
    align-items: center;
    padding: var(--space-3);
    background: var(--color-bg);
    border-top: 1px solid var(--color-border-soft);
}
.v-gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--color-border);
    cursor: pointer;
    border: 0;
    padding: 0;
    transition: background-color var(--t-fast), width var(--t-fast);
}
.v-gallery-dot:hover { background: var(--color-text-muted); }
.v-gallery-dot.is-active {
    background: var(--color-primary);
    width: 24px;
    border-radius: 999px;
}
.v-gallery-count {
    margin-left: var(--space-2);
    font-family: var(--mono, monospace);
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Fallback when there's only one image */
.v-gallery.is-single .v-gallery-arrow,
.v-gallery.is-single .v-gallery-dots {
    display: none;
}
