/* ==========================================================================
   KAIRIVA — Gallery Page CSS
   ========================================================================== */

/* Hero Banner */
.gallery-hero {
    height: 60vh;
    min-height: 400px;
    background: var(--brand-dark);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 0 !important;
}

.gallery-hero-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 30%;
    filter: brightness(0.45);
}

.gallery-hero-content {
    position: relative;
    z-index: 2;
    color: var(--brand-white);
    max-width: 800px;
    padding-top: 80px;
}

.gallery-hero-content h1 {
    font-size: clamp(32px, 8vw, 80px);
    margin-bottom: 20px;
    font-weight: 500;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Category Filter Tabs */
.gallery-filters-section {
    padding: 60px 0 20px;
    background-color: var(--brand-surface-cream);
}

.gallery-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 40px;
}

.gallery-filter-btn {
    background: transparent;
    border: 1px solid var(--brand-border-form);
    color: var(--brand-muted);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 12px 28px;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
}

.gallery-filter-btn:hover,
.gallery-filter-btn.active {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: var(--brand-white);
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

/* Gallery Card */
.gallery-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 3 / 4;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(var(--brand-dark-rgb), 0.05);
    background-color: var(--brand-surface-alt);
    transition: var(--transition);
}

.gallery-card-img-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.gallery-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Hover Overlay Styles */
.gallery-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(var(--brand-primary-rgb), 0.75);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.4s ease;
    text-align: center;
    border: 12px solid rgba(var(--brand-accent-rgb), 0.25);
    box-sizing: border-box;
}

.gallery-card-overlay-icon {
    font-size: 24px;
    color: var(--brand-accent);
    margin-bottom: 12px;
    transform: translateY(15px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-card-overlay-title {
    font-family: var(--font-display);
    font-size: 20px;
    color: var(--brand-white);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.05s;
}

.gallery-card-overlay-category {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    color: var(--brand-accent);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transform: translateY(25px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.1s;
}

/* Hover effects */
.gallery-card:hover {
    box-shadow: 0 15px 35px rgba(var(--brand-dark-rgb), 0.15);
    transform: translateY(-5px);
}

.gallery-card:hover img {
    transform: scale(1.08);
}

.gallery-card:hover .gallery-card-overlay {
    opacity: 1;
}

.gallery-card:hover .gallery-card-overlay-icon,
.gallery-card:hover .gallery-card-overlay-title,
.gallery-card:hover .gallery-card-overlay-category {
    transform: translateY(0);
}

/* Lightbox Modal Styles */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    background-color: rgba(var(--brand-dark-rgb), 0.96);
    z-index: 2500;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.gallery-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.gallery-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gallery-lightbox-img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(var(--brand-black-rgb), 0.5);
    transform: scale(0.95);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-lightbox.active .gallery-lightbox-img {
    transform: scale(1);
}

.gallery-lightbox-caption {
    margin-top: 15px;
    color: var(--brand-white);
    text-align: center;
}

.gallery-lightbox-title {
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--brand-white);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.gallery-lightbox-category {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    color: var(--brand-accent);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* Control Buttons */
.gallery-lightbox-btn {
    position: absolute;
    background: transparent;
    border: none;
    color: rgba(var(--brand-white-rgb), 0.8);
    font-size: 24px;
    cursor: pointer;
    padding: 12px;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2520;
    line-height: 1;
}

.gallery-lightbox-btn:hover {
    color: var(--brand-white);
}

.gallery-lightbox-close,
.lightbox-close {
    top: 28px;
    right: 32px;
    font-size: 24px;
    color: rgba(var(--brand-white-rgb), 0.85);
    background: transparent;
    border: none;
    padding: 8px;
    opacity: 0.9;
    transition: transform 0.2s ease, opacity 0.2s ease, color 0.2s ease;
}

.gallery-lightbox-close:hover,
.lightbox-close:hover {
    color: var(--brand-white);
    opacity: 1;
    transform: scale(1.15);
}

.gallery-lightbox-prev {
    left: 40px;
    top: 50%;
    transform: translateY(-50%);
}

.gallery-lightbox-prev:hover {
    transform: translateY(-50%);
}

.gallery-lightbox-next {
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
}

.gallery-lightbox-next:hover {
    transform: translateY(-50%);
}

/* Block background scroll while lightbox is open */
body.lightbox-open {
    overflow: hidden !important;
}

/* Pagination container overriding default */
.gallery-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding-top: 20px;
    margin-bottom: 40px;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px;
    }
    .gallery-lightbox-prev {
        left: 20px;
    }
    .gallery-lightbox-next {
        right: 20px;
    }
}

@media (max-width: 768px) {
    .gallery-hero {
        height: 50vh;
    }
    .gallery-filters {
        gap: 8px;
    }
    .gallery-filter-btn {
        padding: 10px 20px;
        font-size: 11px;
    }
    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }
    .gallery-lightbox-btn {
        font-size: 24px;
    }
    .gallery-lightbox-prev {
        left: 10px;
        background: rgba(var(--brand-dark-rgb), 0.4);
        border-radius: 50%;
        width: 44px;
        height: 44px;
        padding: 0;
    }
    .gallery-lightbox-next {
        right: 10px;
        background: rgba(var(--brand-dark-rgb), 0.4);
        border-radius: 50%;
        width: 44px;
        height: 44px;
        padding: 0;
    }
    .gallery-lightbox-close {
        top: 15px;
        right: 15px;
    }
}

@media (max-width: 576px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .gallery-hero-content h1 {
        font-size: 38px;
    }
}
