/* ============================================
   CHING MO - Gallery Page Stylesheet
   ============================================ */

/* ===== PAGE HERO ===== */
.page-hero {
    position: relative;
    min-height: 340px;
    display: flex;
    align-items: flex-end;
    background: url('/images/gallery-hero.webp') center/cover no-repeat;
    padding-bottom: var(--space-2xl);
    margin-top: var(--header-height);
}

.page-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(26, 26, 46, 0.55) 0%,
        rgba(26, 26, 46, 0.92) 100%
    );
    z-index: 1;
}

.page-hero-content {
    position: relative;
    z-index: 2;
    color: var(--color-white);
}

.page-hero-title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: var(--space-md);
}

.page-hero-description {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: rgba(255, 255, 255, 0.85);
    max-width: 550px;
    line-height: 1.7;
}

/* ===== BREADCRUMB ===== */
.breadcrumb { margin-bottom: var(--space-md); }
.breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs);
    list-style: none;
    padding: 0;
    margin: 0;
}
.breadcrumb li {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.875rem;
    color: rgba(255,255,255,0.6);
}
.breadcrumb a { color: rgba(255,255,255,0.6); transition: color var(--transition-fast); }
.breadcrumb a:hover { color: var(--color-accent); }
.breadcrumb-sep { color: rgba(255,255,255,0.3); }
.breadcrumb [aria-current="page"] { color: var(--color-accent); font-weight: 500; }

/* ===== FILTER BAR ===== */
.gallery-filter-section {
    background: var(--color-off-white);
    padding: var(--space-lg) 0;
    border-bottom: 1px solid var(--color-light-grey);
    position: sticky;
    top: var(--header-height);
    z-index: 800;
}

.filter-bar {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    align-items: center;
}

@media (max-width: 767px) {
    .filter-bar {
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: none;
        padding-bottom: 4px;
    }
    .filter-bar::-webkit-scrollbar { display: none; }
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1.2rem;
    border: 2px solid var(--color-light-grey);
    border-radius: var(--radius-full);
    background: var(--color-white);
    color: var(--color-grey);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.filter-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: rgba(196, 30, 58, 0.04);
}

.filter-btn.active,
.filter-btn[aria-pressed="true"] {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-white);
}

/* ===== GALLERY SECTION ===== */
.gallery-section {
    padding-top: var(--space-xl);
}

/* ===== GALLERY GRID ===== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

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

@media (min-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Wide item spans 2 columns */
.gallery-item--wide {
    grid-column: span 2;
}

/* ===== GALLERY ITEM ===== */
.gallery-item {
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-off-white);
}

.gallery-item.hidden {
    display: none;
}

.gallery-item-btn {
    display: block;
    width: 100%;
    border: none;
    padding: 0;
    background: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-md);
}

.gallery-item-btn img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
    transition: transform var(--transition-slow);
}

.gallery-item-btn:hover img,
.gallery-item-btn:focus-visible img {
    transform: scale(1.05);
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(26, 26, 46, 0.65);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    color: var(--color-white);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.gallery-overlay span {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.gallery-item-btn:hover .gallery-overlay,
.gallery-item-btn:focus-visible .gallery-overlay {
    opacity: 1;
}

.gallery-caption {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--color-grey);
    text-align: center;
    background: var(--color-off-white);
}

/* ===== NO RESULTS ===== */
.gallery-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-2xl) 0;
    color: var(--color-grey);
}

.gallery-no-results svg {
    margin: 0 auto var(--space-md);
    color: var(--color-light-grey);
}

.gallery-no-results p {
    font-size: 1.1rem;
    font-weight: 500;
}

/* ===== GALLERY COUNT ===== */
.gallery-count {
    text-align: center;
    margin-top: var(--space-lg);
    font-size: 0.875rem;
    color: var(--color-grey);
}

/* ===== LIGHTBOX ===== */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox[hidden] {
    display: none;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.94);
    cursor: pointer;
}

.lightbox-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: var(--space-md);
    max-width: 95vw;
    max-height: 95vh;
    width: 100%;
    padding: 0 var(--space-md);
}

.lightbox-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    max-height: 90vh;
    overflow: hidden;
}

.lightbox-img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    display: block;
    animation: lightboxFadeIn 0.3s ease;
}

@keyframes lightboxFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.lightbox-caption {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    text-align: center;
    font-weight: 500;
}

.lightbox-counter {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--color-white);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    transform: scale(1.1);
}

.lightbox-close {
    position: absolute;
    top: -60px;
    right: 0;
}

@media (max-width: 576px) {
    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
    }

    .lightbox-close {
        top: -50px;
        width: 40px;
        height: 40px;
    }
}