/* ==========================================================================
   ST. LAWRENCE JUNIOR SCHOOL KABOWA — GALLERY & LIGHTBOX EDITORIAL REDESIGN
   Light, professional, image-focused, fully dynamic
   Colors: Navy (#0b3366), School Red (#dc3545), Pure White (#ffffff), Slate (#64748b)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. EDITORIAL HERO SECTION
   -------------------------------------------------------------------------- */
.gallery-hero-editorial {
    background-color: #ffffff;
    padding: 40px 0 24px 0;
    position: relative;
    border-bottom: 1px solid #f1f5f9;
}

.gallery-hero-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
}

.gallery-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.86rem;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 18px;
}

.gallery-breadcrumb a {
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s ease;
}

.gallery-breadcrumb a:hover {
    color: #0b3366;
}

.gallery-breadcrumb .separator {
    color: #cbd5e1;
}

.gallery-breadcrumb .current {
    color: #0b3366;
    font-weight: 600;
}

.gallery-hero-grid {
    display: grid;
    grid-template-columns: 1fr 440px;
    gap: 36px;
    align-items: center;
}

.gallery-hero-left {
    padding-right: 15px;
}

.gallery-eyebrow-wrap {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.gallery-eyebrow-bar {
    width: 32px;
    height: 3px;
    background-color: #dc3545;
    border-radius: 2px;
    display: inline-block;
}

.gallery-eyebrow-text {
    font-family: 'Poppins', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #dc3545;
    text-transform: uppercase;
}

.gallery-hero-title {
    font-family: 'Poppins', sans-serif;
    font-size: 3.2rem;
    font-weight: 700;
    line-height: 1.15;
    color: #0b3366;
    margin: 0 0 14px 0;
    letter-spacing: -0.025em;
}

.gallery-hero-title .text-red {
    color: #dc3545;
}

.gallery-hero-subtitle {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #64748b;
    margin: 0;
    max-width: 560px;
}

/* Right side banner with students & tagline */
.gallery-hero-right {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(11, 51, 102, 0.06);
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    height: 170px;
    display: flex;
    align-items: center;
}

.gallery-hero-banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    display: block;
}

.gallery-hero-banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 40%, rgba(11, 51, 102, 0.35) 100%);
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 18px 22px;
}

.gallery-banner-tagline {
    text-align: right;
}

.gallery-cursive-tag {
    font-family: 'Caveat', 'Segoe Script', cursive;
    font-size: 1.7rem;
    line-height: 1.1;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    display: block;
}

.gallery-cursive-line {
    width: 50px;
    height: 3px;
    background-color: #dc3545;
    margin-left: auto;
    margin-top: 4px;
    border-radius: 2px;
}

/* --------------------------------------------------------------------------
   2. GALLERY CONTROLS TOOLBAR (SEARCH, EVENT FILTER, COUNT)
   -------------------------------------------------------------------------- */
.gallery-section-main {
    background-color: #f8fafc;
    padding: 40px 0 90px 0;
    min-height: 600px;
}

.gallery-main-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
}

.gallery-toolbar-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 32px;
    box-shadow: 0 2px 8px rgba(11, 51, 102, 0.03);
    flex-wrap: wrap;
}

.gallery-search-wrap {
    flex: 1;
    min-width: 260px;
    position: relative;
    display: flex;
    align-items: center;
}

.gallery-search-icon {
    position: absolute;
    left: 14px;
    color: #94a3b8;
    font-size: 0.9rem;
    pointer-events: none;
}

.gallery-search-input {
    width: 100%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 10px 14px 10px 38px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: #1e293b;
    outline: none;
    transition: all 0.2s ease;
}

.gallery-search-input:focus {
    border-color: #0b3366;
    box-shadow: 0 0 0 3px rgba(11, 51, 102, 0.12);
}

.gallery-filters-group {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.gallery-filter-select {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 10px 34px 10px 14px;
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    color: #334155;
    outline: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px 16px;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.2s ease;
    min-width: 160px;
}

.gallery-filter-select:focus {
    border-color: #0b3366;
}

/* Layout Switcher (Masonry vs Grid) */
.gallery-layout-toggle {
    display: inline-flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
    gap: 3px;
    border: 1px solid #e2e8f0;
}

.gallery-layout-toggle .layout-btn {
    border: none;
    background: transparent;
    color: #64748b;
    padding: 7px 12px;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.gallery-layout-toggle .layout-btn:hover {
    color: #0b3366;
}

.gallery-layout-toggle .layout-btn.active {
    background: #ffffff;
    color: #0b3366;
    box-shadow: 0 1px 4px rgba(11, 51, 102, 0.08);
}

.gallery-count-badge {
    font-size: 0.88rem;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
    padding-left: 4px;
}

/* --------------------------------------------------------------------------
   3. GALLERY IMAGE GRID & MASONRY
   -------------------------------------------------------------------------- */
.gallery-grid-clean {
    width: 100%;
    transition: opacity 0.25s ease;
}

/* 1. Masonry Layout (Default: Full uncropped photos, natural heights, zero cut-off heads) */
.gallery-grid-clean.layout-masonry {
    display: block;
    columns: 3 320px;
    column-gap: 22px;
}

.gallery-grid-clean.layout-masonry .gallery-card-item {
    break-inside: avoid;
    display: inline-block;
    width: 100%;
    margin-bottom: 22px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(11, 51, 102, 0.03);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    position: relative;
    vertical-align: top;
}

.gallery-grid-clean.layout-masonry .gallery-card-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: transform 0.35s ease;
}

/* 2. Grid Layout (Uniform cards with smart top-framing so heads & faces are never chopped off) */
.gallery-grid-clean.layout-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}

.gallery-grid-clean.layout-grid .gallery-card-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(11, 51, 102, 0.03);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    position: relative;
    aspect-ratio: 4 / 3;
    margin-bottom: 0;
}

.gallery-grid-clean.layout-grid .gallery-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center; /* Focus on heads and faces */
    display: block;
    transition: transform 0.35s ease;
}

/* Card hover states */
.gallery-card-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(11, 51, 102, 0.09);
    border-color: #cbd5e1;
}

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

/* Subtle hover overlay with view indicator */
.gallery-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(11, 51, 102, 0.32);
    opacity: 0;
    transition: opacity 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.gallery-card-zoom-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ffffff;
    color: #0b3366;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: scale(0.85);
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.gallery-card-item:hover .gallery-card-zoom-btn {
    transform: scale(1);
}

.gallery-card-item:hover .gallery-card-zoom-btn:hover {
    background: #dc3545;
    color: #ffffff;
}

/* Empty & Loading States */
.gallery-empty-card,
.gallery-loading-card {
    grid-column: 1 / -1;
    text-align: center;
    padding: 70px 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.gallery-loading-card i {
    font-size: 2.2rem;
    color: #0b3366;
    margin-bottom: 14px;
}

.gallery-empty-card i {
    font-size: 2.4rem;
    color: #94a3b8;
    margin-bottom: 16px;
}

.gallery-empty-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: #0b3366;
    margin: 0 0 6px 0;
}

.gallery-empty-desc {
    font-size: 0.95rem;
    color: #64748b;
    margin: 0 0 20px 0;
}

.gallery-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #0b3366;
    color: #ffffff;
    border: none;
    padding: 10px 22px;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.gallery-reset-btn:hover {
    background: #08254a;
}

/* --------------------------------------------------------------------------
   4. MODERN PREMIUM DARK EDITORIAL LIGHTBOX (APPROVED MOCKUP)
   Solid deep charcoal (#0b0e14), generous negative space, quiet text controls
   -------------------------------------------------------------------------- */
.editorial-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    background-color: #0b0e14;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.editorial-lightbox.active {
    display: flex;
    flex-direction: column;
    opacity: 1;
    visibility: visible;
}

.lightbox-scrim {
    position: absolute;
    inset: 0;
    background-color: #0b0e14;
}

.lightbox-shell {
    position: relative;
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    z-index: 10;
}

/* 4.1 Top Toolbar: Counter (02 / 89) & Minimal Text Controls */
.lightbox-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 38px 16px 38px;
    background: transparent;
    flex-shrink: 0;
    z-index: 30;
}

.lightbox-counter-display {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1.05rem;
    font-weight: 400;
    color: #f3f4f6;
    letter-spacing: 0.05em;
    user-select: none;
}

.lightbox-counter-display .current-idx {
    color: #ffffff;
    font-weight: 500;
}

.lightbox-counter-display .divider {
    color: #6b7280;
    margin: 0 4px;
    font-weight: 300;
}

.lightbox-counter-display .total-idx {
    color: #9ca3af;
    font-weight: 400;
}

.lightbox-actions-group {
    display: flex;
    align-items: center;
    gap: 28px;
}

/* Plain text action buttons: Like, Download, Close */
.lightbox-action-link {
    background: none;
    border: none;
    padding: 4px 6px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.88rem;
    font-weight: 400;
    color: #9ca3af;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.18s ease;
    letter-spacing: 0.01em;
    text-decoration: none;
    user-select: none;
}

.lightbox-action-link:hover {
    color: #ffffff;
}

.lightbox-action-link:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.45);
    outline-offset: 3px;
    border-radius: 3px;
}

.lightbox-action-link.liked {
    color: #ef4444;
    font-weight: 500;
}

.lightbox-close-link .close-x-svg {
    stroke: currentColor;
    margin-left: 2px;
    transition: transform 0.18s ease;
}

.lightbox-close-link:hover .close-x-svg {
    transform: scale(1.15);
}

/* 4.2 Main Stage: Centered Image & Side Text Navigation */
.lightbox-stage {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 10px 140px;
}

.lightbox-main-img-wrap {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.lightbox-main-image {
    max-width: calc(100vw - 320px);
    max-height: calc(100vh - 210px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    transition: opacity 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
}

/* Subtle Side Text Navigation: ← Previous and Next → */
.lightbox-nav-text-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #8b949e;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.94rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    transition: color 0.18s ease;
    z-index: 25;
    user-select: none;
}

.lightbox-nav-text-btn:hover {
    color: #ffffff;
}

.lightbox-nav-text-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.45);
    outline-offset: 3px;
    border-radius: 4px;
}

.lightbox-nav-prev {
    left: 40px;
}

.lightbox-nav-next {
    right: 40px;
}

.nav-arrow-svg {
    stroke: currentColor;
    flex-shrink: 0;
    transition: transform 0.18s ease;
}

.lightbox-nav-prev:hover .nav-arrow-svg {
    transform: translateX(-3px);
}

.lightbox-nav-next:hover .nav-arrow-svg {
    transform: translateX(3px);
}

/* 4.3 Bottom Area: Filmstrip + Caption */
.lightbox-bottom-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 24px 24px 24px;
    background: transparent;
    flex-shrink: 0;
    z-index: 30;
    gap: 14px;
}

/* Filmstrip Row */
.lightbox-filmstrip-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    max-width: 100%;
}

.filmstrip-nav-btn {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    transition: color 0.18s ease, transform 0.18s ease;
    flex-shrink: 0;
}

.filmstrip-nav-btn:hover {
    color: #ffffff;
}

.filmstrip-prev:hover {
    transform: translateX(-2px);
}

.filmstrip-next:hover {
    transform: translateX(2px);
}

.filmstrip-nav-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.45);
    border-radius: 3px;
}

.lightbox-thumbs-scroll {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    max-width: 780px;
    padding: 3px 2px;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Hide default scrollbar for pure editorial aesthetic */
    -ms-overflow-style: none;
}

.lightbox-thumbs-scroll::-webkit-scrollbar {
    display: none;
}

.lightbox-thumb-item {
    width: 58px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.45;
    flex-shrink: 0;
    transition: opacity 0.2s ease, border-color 0.2s ease;
    box-sizing: border-box;
    background: #141820;
}

.lightbox-thumb-item:hover {
    opacity: 0.8;
}

.lightbox-thumb-item.active {
    opacity: 1;
    border-color: #ffffff; /* Crisp white active border as in approved mockup */
}

.lightbox-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 4.4 Gallery Caption Row */
.lightbox-caption-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    max-width: 760px;
    text-align: center;
}

.caption-divider-line {
    width: 52px;
    height: 1px;
    background: rgba(255, 255, 255, 0.16);
    flex-shrink: 0;
}

.caption-text {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.82rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: #8b949e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   5. RESPONSIVE BREAKPOINTS
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .gallery-grid-clean.layout-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }

    .lightbox-stage {
        padding: 10px 100px;
    }

    .lightbox-main-image {
        max-width: calc(100vw - 230px);
    }

    .lightbox-nav-prev {
        left: 20px;
    }

    .lightbox-nav-next {
        right: 20px;
    }

    .lightbox-thumbs-scroll {
        max-width: 560px;
    }
}

@media (max-width: 860px) {
    .gallery-hero-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .gallery-hero-right {
        height: 140px;
    }

    .lightbox-topbar {
        padding: 18px 24px 12px 24px;
    }

    .lightbox-stage {
        padding: 8px 70px;
    }

    .lightbox-nav-text-btn {
        padding: 8px 10px;
        font-size: 0.86rem;
        gap: 8px;
    }

    .lightbox-nav-prev {
        left: 12px;
    }

    .lightbox-nav-next {
        right: 12px;
    }

    .lightbox-main-image {
        max-width: calc(100vw - 160px);
        max-height: calc(100vh - 195px);
    }

    .lightbox-thumbs-scroll {
        max-width: 440px;
    }
}

@media (max-width: 600px) {
    .gallery-hero-title {
        font-size: 2.3rem;
    }

    .gallery-toolbar-card {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
        gap: 12px;
    }

    .gallery-filters-group {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .gallery-filter-select {
        width: 100%;
    }

    .gallery-layout-toggle {
        width: 100%;
        display: flex;
    }

    .gallery-layout-toggle .layout-btn {
        flex: 1;
        justify-content: center;
    }

    .gallery-count-badge {
        padding-left: 0;
        text-align: center;
    }

    .gallery-grid-clean.layout-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Lightbox Mobile Adjustments */
    .lightbox-topbar {
        padding: 14px 18px 10px 18px;
    }

    .lightbox-counter-display {
        font-size: 0.95rem;
    }

    .lightbox-actions-group {
        gap: 18px;
    }

    .lightbox-action-link {
        font-size: 0.82rem;
        padding: 4px;
    }

    .lightbox-stage {
        padding: 6px 12px;
    }

    .lightbox-nav-text-btn {
        padding: 8px;
        background: rgba(11, 14, 20, 0.6);
        border-radius: 4px;
    }

    .lightbox-nav-text-btn .nav-btn-label {
        display: none; /* Icon-only on mobile to conserve screen space */
    }

    .lightbox-nav-prev {
        left: 8px;
    }

    .lightbox-nav-next {
        right: 8px;
    }

    .lightbox-main-image {
        max-width: calc(100vw - 28px);
        max-height: calc(100vh - 175px);
    }

    .lightbox-bottom-area {
        padding: 8px 12px 16px 12px;
        gap: 10px;
    }

    .lightbox-filmstrip-row {
        gap: 8px;
    }

    .filmstrip-nav-btn {
        width: 22px;
        height: 22px;
    }

    .lightbox-thumbs-scroll {
        max-width: calc(100vw - 64px);
        gap: 6px;
    }

    .lightbox-thumb-item {
        width: 48px;
        height: 34px;
    }

    .lightbox-caption-row {
        gap: 10px;
        max-width: 90vw;
    }

    .caption-divider-line {
        width: 26px;
    }

    .caption-text {
        font-size: 0.75rem;
    }
}
