/* ===== GALLERY PAGE ===== */
/* Zamar Springs Gardens – gallery.css */

/* ─── Hero ─────────────────────────────────────────────────────────────── */
.glry-hero {
    position: relative;
    min-height: 40vh;
    display: flex;
    align-items: center;
    color: #fff;
    margin-top: -80px;
    padding: calc(80px + var(--space-12)) var(--space-4) var(--space-12);
    overflow: hidden;
    background:
        linear-gradient(to bottom right, rgba(20, 53, 26, 0.85), rgba(28, 25, 23, 0.95)),
        url("/static/images/zamar-springs-gardens-entrance.9a3dbd871562.webp") center / cover no-repeat;
}

.glry-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(30, 75, 38, 0.55) 0%, rgba(10, 10, 10, 0.65) 100%);
    pointer-events: none;
}

.glry-hero__body {
    position: relative;
    z-index: 2;
    max-width: 780px;
}

.glry-hero__title {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 5vw, 3.6rem);
    font-weight: 700;
    line-height: 1.1;
    color: var(--gold-medium);
    margin-bottom: var(--space-4);
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.glry-hero__sub {
    font-size: clamp(1rem, 2vw, 1.15rem);
    line-height: 1.75;
    opacity: 0.92;
    margin: 0;
}

/* ─── Filter nav ────────────────────────────────────────────────────────── */
.glry-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: var(--space-6) var(--space-4);
    border-bottom: 1px solid var(--neutral-100);
    justify-content: center;
    align-items: center;
}

.glry-filter a {
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--neutral-600);
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.glry-filter a:hover,
.glry-filter a:focus-visible {
    background: var(--gold-light);
    color: var(--gold-dark);
}

/* ─── Page body ─────────────────────────────────────────────────────────── */
.glry-main {
    padding-top: var(--space-8);
    padding-bottom: var(--space-12);
}

/* ─── Section ────────────────────────────────────────────────────────────── */
.glry-section {
    margin-bottom: var(--space-12);
    padding-top: var(--space-8);
    border-top: 1px solid var(--neutral-200);
    scroll-margin-top: calc(80px + var(--space-4));
}

.glry-section:first-child {
    border-top: none;
    padding-top: 0;
}

.glry-section__head {
    max-width: 760px;
    margin-bottom: var(--space-6);
}

.glry-section__head h2 {
    font-family: var(--font-serif);
    font-size: clamp(1.65rem, 3vw, 2.4rem);
    color: var(--neutral-900);
    margin-bottom: var(--space-3);
}

.glry-section__head p {
    color: var(--neutral-600);
    line-height: 1.75;
    margin: 0;
}

.glry-section.is-revealed .glry-section__head,
.glry-section.is-revealed .glry-layout,
.glry-section.is-revealed .glry-social-grid {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: no-preference) {
    .glry-section__head,
    .glry-social-grid {
        opacity: 0;
        transform: translateY(18px);
        transition: opacity 0.55s ease, transform 0.55s ease;
    }

    .glry-section__head {
        transition-delay: 0.02s;
    }

    .glry-social-grid {
        transition-delay: 0.1s;
    }
}

/* ─── Layout: Bento Grid & Mobile Scroll Snap ───────────────────────────── */

.bento-gallery {
    display: flex;
    gap: var(--space-4);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: var(--space-4); /* for box-shadow breathing room */
    margin-inline: calc(-1 * var(--space-4));
    padding-inline: var(--space-4);
}

.bento-gallery::-webkit-scrollbar {
    display: none;
}

/* Base Item - Mobile Edge-to-Edge Scroll Snap */
.bento-item {
    flex: 0 0 85vw; /* 85% width so next card peeks */
    margin: 0;
    scroll-snap-align: center;
    border-radius: 1.25rem;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--neutral-200);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    background: var(--neutral-100);
    /* Strict aspect ratio for CWV (0 CLS) */
    aspect-ratio: 4 / 3;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.4s ease;
}

.bento-item--featured {
    aspect-ratio: 4 / 3;
}

.bento-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.12);
}

.bento-item .glry-trigger {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    cursor: pointer;
}

.bento-item .bento-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.bento-item .glry-trigger:hover .bento-img,
.bento-item .glry-trigger:focus-visible .bento-img {
    transform: scale(1.04);
}

.bento-item .glry-trigger:focus-visible {
    outline: 3px solid var(--gold-medium);
    outline-offset: -3px;
}

/* View All Overlay */
.bento-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 18, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    pointer-events: none; /* Let click pass to trigger */
    transition: background 0.3s;
}

.bento-item .glry-trigger:hover .bento-overlay {
    background: rgba(15, 23, 18, 0.75);
}

/* Tablet (>= 768px) - 2 Column Grid */
@media (min-width: 768px) {
    .bento-gallery {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-5);
        overflow: visible;
        margin-inline: 0;
        padding-inline: 0;
        padding-bottom: 0;
    }
    .bento-item {
        flex: none;
        width: 100%;
        scroll-snap-align: none;
    }
    .bento-item--featured {
        grid-column: span 2;
        aspect-ratio: 16 / 9; /* Wider for tablet hero */
    }
}

/* Desktop (>= 1024px) - True Bento Mosaic Quantity Queries */
@media (min-width: 1024px) {
    .bento-gallery {
        grid-template-columns: repeat(4, 1fr);
        grid-auto-rows: 240px; /* fixed row height for perfect alignment */
        gap: var(--space-5);
    }
    
    .bento-item {
        aspect-ratio: auto; /* Grid controls size via auto-rows */
    }
    
    /* ========== EXACTLY 1 IMAGE ========== */
    .bento-item:first-child:last-child {
        grid-column: 1 / -1;
        grid-row: 1 / 4; /* Even larger */
    }

    /* ========== EXACTLY 2 IMAGES ========== */
    .bento-item:first-child:nth-last-child(2) {
        grid-column: 1 / 3;
        grid-row: 1 / 3;
    }
    .bento-item:nth-child(2):last-child {
        grid-column: 3 / 5;
        grid-row: 1 / 3;
    }

    /* ========== EXACTLY 3 IMAGES ========== */
    .bento-item:first-child:nth-last-child(3) {
        grid-column: 1 / 3;
        grid-row: 1 / 3;
    }
    .bento-item:nth-child(2):nth-last-child(2) {
        grid-column: 3 / 5;
        grid-row: 1 / 2;
    }
    .bento-item:nth-child(3):last-child {
        grid-column: 3 / 5;
        grid-row: 2 / 3;
    }

    /* ========== 4+ IMAGES (We render 4 visually, max) ========== */
    .bento-item:first-child:nth-last-child(n+4) {
        grid-column: 1 / 3;
        grid-row: 1 / 3; /* 2x2 spans 480px tall + gap */
    }
    .bento-item:nth-child(2):nth-last-child(n+3) {
        grid-column: 3 / 5;
        grid-row: 1 / 2;
    }
    .bento-item:nth-child(3):nth-last-child(n+2) {
        grid-column: 3 / 4;
        grid-row: 2 / 3;
    }
    .bento-item:nth-child(4) {
        grid-column: 4 / 5;
        grid-row: 2 / 3;
    }
}

/* Shared image styles */
.glry-img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    image-orientation: from-image;
    transition: transform 0.5s ease;
}

/* Allow portrait images to display larger without huge side gaps */
.glry-section-slider.is-portrait .glry-slide-img {
    width: auto;
    max-width: min(42vw, 460px);
    max-height: clamp(380px, 66vh, 760px);
    object-fit: contain;
}

/* The clickable trigger button inside tiles and hero cards */
.glry-trigger {
    display: block;
    width: 100%;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    cursor: pointer;
    overflow: hidden;
}

.glry-trigger:focus-visible {
    outline: 2px solid var(--gold-medium);
    outline-offset: 4px;
}

/* ─── Tiles (supporting images) ─────────────────────────────────────────── */
.glry-tiles-wrapper {
    position: relative;
    border: 1px solid var(--neutral-100);
    border-radius: 1.25rem;
    padding: var(--space-4) var(--space-6);
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    overflow: hidden; /* Clips the inner scroller */
}

/* Nav buttons for horizontal thumbnail carousel */
.glry-tiles-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--neutral-200);
    background: white;
    color: var(--neutral-600);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glry-tiles-btn:hover:not(:disabled) {
    background: var(--gold-light);
    color: var(--gold-dark);
    border-color: var(--gold-medium);
    transform: translateY(-50%) scale(1.1);
}

.glry-tiles-btn:active:not(:disabled) {
    transform: translateY(-50%) scale(0.95);
}

.glry-tiles-btn:disabled {
    opacity: 0.3;
    pointer-events: none;
    cursor: default;
}

.glry-tiles-prev {
    left: 8px;
}

.glry-tiles-next {
    right: 8px;
}

/* Extra margin at section level to prevent clipped buttons */
.glry-layout {
    margin-bottom: var(--space-4);
}

/* ─── Tile Grid -> Horizontal Scroller ──────────────────────────────────── */
.glry-tiles {
    display: flex;
    gap: var(--space-4);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 2px; /* Prevent focus outline clipping */
}

.glry-tiles::-webkit-scrollbar {
    display: none;
}

.glry-tile {
    flex: 0 0 calc(33.333% - (var(--space-4) * 2 / 3)); /* 3 visible by default */
    margin: 0;
    scroll-snap-align: start;
}

@media (min-width: 768px) {
    .glry-tile {
        flex: 0 0 calc(25% - (var(--space-4) * 3 / 4)); /* 4 visible on tablets */
    }
}

@media (min-width: 1024px) {
    .glry-tile {
        flex: 0 0 calc(20% - (var(--space-4) * 4 / 5)); /* Exactly 5 visible on desktop */
    }
}

.glry-tile {
    margin: 0;
    border-radius: 1rem;
    overflow: hidden;
    scroll-snap-align: start;
    border: 1px solid var(--neutral-200);
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);

    /* The tile card OWNS its shape — 4:3 on every screen, every container */
    aspect-ratio: 4 / 3;
    position: relative;
}

.glry-tile:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.1);
}

.glry-tile.is-active {
    border-color: var(--gold-medium);
    box-shadow: 0 0 0 2px var(--gold-medium), 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(-3px);
}

@media (min-width: 1024px) {
    .glry-tile--desktop-duplicate {
        display: none;
    }
}

/* Trigger fills the tile card completely */
.glry-tile .glry-trigger {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    cursor: pointer;
    overflow: hidden;
}

/* Image fills the trigger */
.glry-tile .glry-trigger .glry-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* aspect-ratio intentionally omitted — tile card controls the shape */
}

.glry-tile .glry-trigger:hover .glry-img,
.glry-tile .glry-trigger:focus-visible .glry-img {
    transform: scale(1.06);
}

/* ─── Section slideshow: inline prev / next arrows ────────────────────── */
.glry-section-slider {
    position: relative;
    touch-action: pan-y;
}

.glry-slide-prev,
.glry-slide-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.2s, transform 0.15s;
    /* Keep above the hero card image but not over lightbox */
}

.glry-slide-prev {
    left: 12px;
}

.glry-slide-next {
    right: 12px;
}

.glry-slide-prev:hover,
.glry-slide-next:hover {
    background: rgba(0, 0, 0, 0.72);
    transform: translateY(-50%) scale(1.08);
}

.glry-slide-prev:focus-visible,
.glry-slide-next:focus-visible {
    outline: 3px solid var(--gold-medium);
    outline-offset: 2px;
}

/* Slide transition */
.glry-slide-img.is-transitioning {
    opacity: 0;
    transition: opacity 0.22s ease;
}

.glry-slide-img {
    transition: opacity 0.22s ease;
}

.glry-swipe-hint {
    display: none;
    margin-top: 0.65rem;
    color: var(--neutral-500);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}


/* ─── Empty state ───────────────────────────────────────────────────────── */
.glry-empty {
    padding: var(--space-10) var(--space-6);
    text-align: center;
    color: var(--neutral-500);
    border: 2px dashed var(--neutral-300);
    border-radius: 1rem;
    line-height: 1.6;
}

.glry-empty__link {
    display: inline-block;
    margin-top: var(--space-3);
    padding: var(--space-2) var(--space-4);
    background: var(--gold-light);
    color: var(--gold-darker);
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.2s;
}

.glry-empty__link:hover {
    background: var(--gold-medium);
    color: white;
}

/* ─── Social grid ───────────────────────────────────────────────────────── */
.glry-social-grid {
    display: grid;
    gap: var(--space-6);
}

@media (min-width: 768px) {
    .glry-social-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Medium screens (e.g. iPad Pro, small laptops) handled by 1fr 1fr above */

.glry-social-platform {
    background: white;
    border: 2px solid var(--neutral-200);
    border-radius: 1.25rem;
    padding: var(--space-5);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.glry-social-platform h3 {
    font-size: 1.15rem;
    margin: 0 0 var(--space-4);
    color: var(--neutral-900);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.glry-social-post {
    display: grid;
    grid-template-columns: 84px 1fr;
    gap: var(--space-3);
    align-items: center;
    text-decoration: none;
    color: var(--neutral-800);
    border: 1px solid var(--neutral-200);
    border-radius: 0.75rem;
    padding: var(--space-2);
    background: var(--neutral-50);
    margin-bottom: var(--space-2);
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.glry-social-post:last-child {
    margin-bottom: 0;
}

.glry-social-post:hover,
.glry-social-post:focus-visible {
    border-color: var(--gold-medium);
    background: white;
    transform: translateY(-2px);
}

.glry-social-post img {
    width: 84px;
    height: 84px;
    border-radius: 0.5rem;
    object-fit: cover;
}

.glry-social-post p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--neutral-700);
}

.glry-social-empty {
    color: var(--neutral-500);
    font-style: italic;
    font-size: 0.9rem;
}

/* ─── Lightbox ───────────────────────────────────────────────────────────── */
.glry-lb {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.96);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: var(--space-4);
}

.glry-lb.is-open {
    display: flex;
}

.glry-lb__content {
    position: relative;
    width: min(1200px, 95vw);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Spinner while image loads */
.glry-lb__spinner {
    display: none;
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--gold-medium);
    border-radius: 50%;
    animation: glry-spin 0.7s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.glry-lb.is-loading .glry-lb__spinner {
    display: block;
}

.glry-lb.is-loading .glry-lb__img {
    opacity: 0;
}

@keyframes glry-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.glry-lb__img {
    display: block;
    width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 0.25rem;
    transition: opacity 0.2s;
}

.glry-lb__caption {
    margin: var(--space-3) 0 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    text-align: center;
    max-width: 80%;
}

/* Lightbox close + nav buttons */
.glry-lb__close,
.glry-lb__nav {
    position: absolute;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10010;
}

.glry-lb__close {
    top: 16px;
    right: 16px;
    width: 50px;
    height: 50px;
    font-size: 2rem;
}

.glry-lb__nav {
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    font-size: 1.4rem;
}

.glry-lb__prev {
    left: 16px;
}

.glry-lb__next {
    right: 16px;
}

.glry-lb__close:hover,
.glry-lb__nav:hover {
    background: rgba(255, 255, 255, 0.28);
}

.glry-lb__close:focus-visible,
.glry-lb__nav:focus-visible {
    outline: 3px solid var(--gold-medium);
    outline-offset: 2px;
}

.glry-lb__nav:disabled {
    opacity: 0.25;
    cursor: default;
}

@media (max-width: 767px) {
    .glry-section {
        margin-bottom: var(--space-10);
        padding-top: var(--space-6);
    }
}

@media (max-width: 640px) {
    .glry-main {
        padding-top: var(--space-6);
    }

    .glry-lb__close {
        width: 44px;
        height: 44px;
        font-size: 1.7rem;
    }

    .glry-lb__nav {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }

    .glry-lb__prev {
        left: 8px;
    }

    .glry-lb__next {
        right: 8px;
    }

    .glry-filter {
        gap: 0.5rem;
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: var(--space-3);
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .glry-filter::-webkit-scrollbar {
        display: none;
    }

    .glry-filter a {
        font-size: 0.8rem;
        padding: 0.4rem 0.7rem;
        flex: 0 0 auto;
    }

    /* Reduce the hero section height a bit on mobile */
    .glry-hero {
        min-height: 42vh;
    }

    /* Compress section head to save space */
    .glry-section__head {
        margin-bottom: var(--space-4);
    }

    .glry-social-post {
        grid-template-columns: 68px minmax(0, 1fr);
        align-items: start;
    }

    .glry-social-post img {
        width: 68px;
        height: 68px;
    }

    .glry-social-post p {
        font-size: 0.88rem;
        line-height: 1.45;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .glry-lb__spinner {
        animation: none;
    }
}

.glry-lb__embed-container {
    display: none;
    width: min(500px, 90vw);
    height: 80vh;
    max-height: 700px;
    margin: 0 auto;
    border-radius: 1rem;
    overflow: hidden;
    background: #000;
}


