/* ══════════════════════════════════════════
   Gallery Page Styles
   Cambridge Cricket Club
══════════════════════════════════════════ */

/* ── Gallery Hero ── */
.gallery-hero {
    position: relative;
    height: 42vh;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--green-deep) url('../assets/images/hero-bg.png') center 40% / cover no-repeat;
    overflow: hidden;
}

.gallery-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(27,58,45,0.88) 0%, rgba(27,58,45,0.7) 100%);
}

.gallery-hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: var(--cream);
}

.gallery-hero-content h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    color: var(--cream);
    margin-bottom: 0.75rem;
    text-shadow: 0 2px 20px rgba(0,0,0,0.4);
}

.gallery-hero-content p {
    font-size: 1.05rem;
    color: rgba(247,243,234,0.78);
    max-width: 540px;
    margin: 0 auto;
}

/* ── Filter Bar ── */
.filter-bar {
    position: sticky;
    top: 70px;
    z-index: 100;
    background: var(--cream);
    border-bottom: 2px solid var(--parchment-dk);
    padding: 0.875rem 0;
    box-shadow: 0 3px 16px rgba(44,20,0,0.07);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-light);
    white-space: nowrap;
}

.filter-btns { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.filter-btn {
    padding: 0.45rem 1.1rem;
    border: 1.5px solid var(--parchment-dk);
    border-radius: 50px;
    background: transparent;
    color: var(--text-mid);
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.filter-btn:hover {
    border-color: var(--green);
    color: var(--green-deep);
    background: var(--green-light);
}

.filter-btn.active {
    background: var(--green-deep);
    border-color: var(--green-deep);
    color: var(--cream);
}

/* ── Gallery Main ── */
.gallery-main { padding: 4rem 0 6rem; }

/* ── Gallery Sections ── */
.gallery-section { margin-bottom: 5rem; }
.gallery-section.hidden { display: none; }
.section-divide.hidden { display: none; }

.gallery-section-header { margin-bottom: 2rem; }

.section-era-tag {
    display: inline-block;
    font-family: var(--font-hand);
    font-size: 1rem;
    color: var(--gold-dark);
    background: var(--gold-pale);
    border: 1px solid var(--parchment-dk);
    padding: 0.2rem 0.875rem;
    border-radius: var(--radius);
    margin-bottom: 0.6rem;
}

.gallery-section-header h2 {
    font-size: clamp(1.7rem, 3.5vw, 2.5rem);
    color: var(--text-dark);
    margin-bottom: 0.4rem;
}

.gallery-section-header p {
    font-size: 0.95rem;
    color: var(--text-light);
    max-width: 580px;
    line-height: 1.7;
}

/* ── Masonry Grid ── */
.photo-grid {
    columns: 4 240px;
    column-gap: 0.875rem;
}

.photo-item {
    break-inside: avoid;
    margin-bottom: 0.875rem;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background: var(--parchment);
    /* Vintage photo border */
    border: 6px solid var(--parchment);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.photo-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.photo-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s ease;
    filter: sepia(8%) contrast(1.04);
}

.photo-item:hover img { transform: scale(1.05); }

/* Hover overlay */
.photo-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(27,58,45,0.65) 0%, transparent 55%);
    opacity: 0;
    transition: opacity 0.3s;
}
.photo-item:hover::after { opacity: 1; }

/* Zoom icon */
.photo-item::before {
    content: '+';
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    z-index: 2;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--brown-dark);
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}
.photo-item:hover::before { opacity: 1; transform: scale(1); }

/* ── Placeholder cards ── */
.photo-placeholder {
    min-height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    border: 2px dashed var(--parchment-dk);
    background: rgba(237,224,200,0.3);
    padding: 2rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.82rem;
}
.photo-placeholder .ph-icon { font-size: 2rem; opacity: 0.4; }
.photo-placeholder code {
    font-size: 0.72rem;
    background: var(--parchment-dk);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    color: var(--text-mid);
    font-family: monospace;
}

/* ── Section Divider ── */
.section-divide {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin: 2rem 0 4rem;
}
.section-divide-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.section-divide-label {
    font-family: var(--font-hand);
    font-size: 1.15rem;
    color: var(--gold-dark);
    font-style: italic;
    white-space: nowrap;
}

/* ── Lightbox ── */
.lb-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10,10,8,0.94);
    z-index: 9000;
    backdrop-filter: blur(8px);
}
.lb-backdrop.open { display: block; }

.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9001;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.lightbox.open { display: flex; }

.lb-inner {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lb-img {
    max-width: 90vw;
    max-height: 82vh;
    object-fit: contain;
    box-shadow: 0 30px 80px rgba(0,0,0,0.7);
    border: 8px solid var(--parchment);
    transition: opacity 0.2s;
}

.lb-caption {
    font-family: var(--font-hand);
    color: rgba(247,243,234,0.65);
    font-size: 1rem;
    margin-top: 0.75rem;
    text-align: center;
}

.lb-close {
    position: fixed;
    top: 1.5rem;
    right: 2rem;
    background: transparent;
    border: none;
    color: var(--cream);
    font-size: 2.5rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    z-index: 9002;
    line-height: 1;
}
.lb-close:hover { opacity: 1; }

.lb-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(247,243,234,0.1);
    border: 1px solid rgba(247,243,234,0.2);
    border-radius: 50%;
    color: var(--cream);
    font-size: 2rem;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 9002;
}
.lb-nav:hover { background: rgba(247,243,234,0.25); }
.lb-prev { left: 1.5rem; }
.lb-next { right: 1.5rem; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .filter-bar { top: 60px; }
    .filter-group { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
    .photo-grid { columns: 2 140px; column-gap: 0.5rem; }
    .photo-item { margin-bottom: 0.5rem; }
    .lb-nav { display: none; }
    .gallery-hero { height: 35vh; }
}

@media (max-width: 480px) {
    .photo-grid { columns: 2 110px; }
}
