/* ==================== Gallery section (OpenBox theme) ==================== */
.gallery-section {
    padding: var(--space-12, 3em) 0 var(--space-16, 4em);
    background: radial-gradient(circle at top left, rgba(229, 99, 99, 0.06) 0, transparent 50%),
        radial-gradient(circle at bottom right, rgba(61, 90, 128, 0.06) 0, transparent 55%),
        var(--color-neutral-0, #fff);
}


.gallery-title {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold, 700);
    color: var(--color-neutral-900, #171717);
    text-align: center;
    margin: 0 0 var(--space-4);
}

.gallery-card {
    padding: var(--space-6, 1.5em);
    background: var(--color-neutral-0);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.06);
}

/* Filter tabs */
.gallery-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2, 0.5em);
    list-style: none;
    margin: 0 0 var(--space-8, 2em);
    padding: 0;
}

.shuffle-btn {
    display: inline-block;
    padding: 8px 16px;
    line-height: normal;
    font-size: var(--text-base);
    font-weight: var(--font-medium, 500);
    color: var(--color-neutral-600, #525252);
    background: var(--color-neutral-0);
    backdrop-filter: blur(8px);
    border: 1px solid var(--color-neutral-900);
    border-radius: 12px;
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.shuffle-btn:hover {
    color: var(--color-neutral-900, #171717);
    background: var(--color-neutral-0);
    border-color: var(--color-neutral-900);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
}

.shuffle-btn.shuffle-active {
    color: var(--color-neutral-0, #fff);
    background: var(--color-neutral-900, #e56363);
    border-color: var(--color-neutral-900, #e56363);
}


/* Masonry layout for gallery-grid only — CSS Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    grid-auto-rows: 10px;
    /* base row height */
    gap: 16px;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: inherit;
}



/* Glassmorphism card + hover */
.gallery-item-inner {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background: var(--color-neutral-0);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--color-neutral-900);
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 var(--color-neutral-0);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.gallery-item-inner:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12),
        0 0 0 1px rgba(229, 99, 99, 0.15),
        inset 0 1px 0 var(--color-neutral-0);
    border-color: rgba(229, 99, 99, 0.2);
}

.gallery-item-inner a {
    display: block;
    position: relative;
    line-height: 0;
}


.gallery-item-inner img {
    width: 100%;
    height: auto;
    display: block;
    vertical-align: middle;
    transition: transform 0.4s ease;
}

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

/* Subtle overlay on hover */
.gallery-item-inner a::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top,
            rgba(0, 0, 0, 0.15) 0%,
            transparent 40%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gallery-item-inner:hover a::after {
    opacity: 1;
}

/* Video play icon (CSS-only) */
.gallery-item-inner a[data-gallery-link="video"]::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 48px;
    height: 48px;
    margin: -24px 0 0 -24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0.9;
    transition: transform 0.2s ease, background 0.2s ease;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.gallery-item-inner a[data-gallery-link="video"]::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    margin: -10px 0 0 -6px;
    border-width: 10px 0 10px 18px;
    border-style: solid;
    border-color: transparent transparent transparent rgba(255, 255, 255, 0.95);
    z-index: 1;
    pointer-events: none;
}

.gallery-item-inner:hover a[data-gallery-link="video"]::after {
    transform: scale(1.1);
    background: var(--color-neutral-900);
}

/* Lightbox overrides to match theme */
.lb-data .lb-caption {
    font-size: 1rem;
    font-weight: var(--font-medium, 500);
    color: var(--color-neutral-900, #fff);
}

.lb-nav a.lb-prev,
.lb-nav a.lb-next {
    opacity: 0.9;
}

.lb-close {
    opacity: 0.9;
}


.gallery-wrapper {
    position: relative;
}

/* Hide gallery initially */
.gallery-grid {
    opacity: 0;
    visibility: hidden;
    transition: 0.5s ease;
}

/* Show when loaded */
.gallery-grid.loaded {
    opacity: 1;
    visibility: visible;
}

/* Loader centered */
.gallery-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-neutral-200);
    backdrop-filter: blur(6px);
    z-index: 10;
}

/* Spinner */
.gallery-loader span {
    width: 45px;
    height: 45px;
    border: 3px solid var(--color-neutral-200);
    border-top: 3px solid var(--color-neutral-200);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.gallery-item {
    transform: translateY(20px);
    opacity: 0;
    transition: 0.4s ease;
}

.gallery-grid.loaded .gallery-item {
    transform: translateY(0);
    opacity: 1;
}