/**
 * CA Vijay Aryan & Associates - Premium Photo Gallery Stylesheet
 * Photo-frame card layout, responsive CSS grid, and accessible lightbox
 */

/* ==========================================================================
   Gallery Page Container & Header
   ========================================================================== */
.gallery-section-wrap {
    background:
        radial-gradient(circle at top center, rgba(49, 113, 155, 0.04), transparent 35%),
        #f8fafc;
    min-height: 600px;
}

.gallery-header-meta {
    max-width: 720px;
    margin: 0 auto;
}

/* ==========================================================================
   Category Filter Tabs
   ========================================================================== */
.gallery-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 32px;
    list-style: none;
    padding: 0 4px;
}

@media (max-width: 768px) {
    .gallery-filter-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        margin-left: -4px;
        margin-right: -4px;
        padding: 2px 4px 10px;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .gallery-filter-btn {
        scroll-snap-align: start;
    }

    .gallery-filter-tabs::-webkit-scrollbar {
        display: none;
    }
}

.gallery-filter-btn {
    appearance: none;
    min-height: 40px;
    border: 1px solid #dce5ee;
    background: rgba(255, 255, 255, 0.92);
    color: #274766;
    font-size: 13px;
    font-weight: 600;
    padding: 9px 18px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.035);
}

.gallery-filter-btn:hover {
    transform: translateY(-1px);
    background: #f7fbff;
    border-color: rgba(49, 113, 155, 0.35);
    color: #31719b;
}

.gallery-filter-btn.active {
    background: #31719b;
    border-color: #31719b;
    color: #ffffff;
    box-shadow: 0 7px 18px rgba(49, 113, 155, 0.20);
}

/* ==========================================================================
   Responsive Gallery Grid
   ========================================================================== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    align-items: stretch;
    margin-bottom: 40px;
}

@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }
}

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

/* ==========================================================================
   Photo-Frame Card Layout (Polished & Refined)
   ========================================================================== */
.gallery-card {
    position: relative;
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid rgba(15, 61, 117, 0.08);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.02),
        0 10px 30px rgba(15, 23, 42, 0.055);
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    overflow: hidden;
    text-align: left;
}

.gallery-card:hover {
    transform: translateY(-4px);
    border-color: rgba(49, 113, 155, 0.20);
    box-shadow:
        0 4px 10px rgba(15, 23, 42, 0.04),
        0 18px 38px rgba(15, 23, 42, 0.09);
}

/* Card Image Frame (65-70% Visual Focus) */
.gallery-card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 1.42 / 1;
    border-radius: 13px;
    overflow: hidden;
    background: #f1f5f9;
    margin-bottom: 13px;
}

.gallery-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

/* Subtle Image Overlay on Hover */
.gallery-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: 13px;
}

.gallery-zoom-badge {
    padding: 6px 11px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.55);
    color: #0f2948;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 5px 15px rgba(15, 23, 42, 0.12);
    transform: scale(0.92);
    transition: transform 0.2s ease;
}

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

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

/* Card Information & Metadata */
.gallery-card-info {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 2px 4px 5px;
}

/* Crisp & Compact Calendar/Event Icon */
.gallery-icon-pill {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: linear-gradient(145deg, #f5f9ff, #eef6ff);
    color: #31719b;
    border: 1px solid rgba(49, 113, 155, 0.08);
    box-shadow: 0 5px 12px rgba(49, 113, 155, 0.07);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    margin-top: 2px;
}

.gallery-card-content {
    flex-grow: 1;
    min-width: 0;
}

/* Refined Event Title with Balanced Line-Height & Equal Height */
.gallery-card-title {
    font-size: 15.5px;
    font-weight: 700;
    line-height: 1.42 !important;
    letter-spacing: -0.01em;
    color: #102f50;
    margin: 0 0 7px;
    min-height: 44px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.gallery-card:hover .gallery-card-title {
    color: #31719b;
}

/* Cleaner Metadata Line with Smooth Wrapping */
.gallery-card-subtitle {
    font-size: 11.75px;
    font-weight: 500;
    color: #718096;
    margin: 0;
    line-height: 1.55;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.gallery-card-subtitle .meta-dot {
    display: inline-block;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #31719b;
    opacity: 0.55;
}

@media (max-width: 640px) {
    .gallery-card {
        padding: 10px;
        border-radius: 16px;
    }

    .gallery-card-media {
        border-radius: 12px;
        margin-bottom: 12px;
    }

    .gallery-card-overlay {
        border-radius: 12px;
    }

    .gallery-card-title {
        font-size: 15px;
    }

    .gallery-card-subtitle {
        font-size: 11.5px;
    }
}

/* ==========================================================================
   Social Highlights & Facebook Embeds
   ========================================================================== */
.fb-social-section {
    margin-top: 48px;
    padding-top: 40px;
    border-top: 1px solid #e2e8f0;
}

.fb-post-col {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-width: 0;
}

.fb-post-card-frame {
    display: flex;
    flex-direction: column;
    width: 350px;
    max-width: 100%;
    min-height: 400px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    background: #ffffff;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.fb-post-card-frame:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
}

.fb-post-card-frame .fb-post {
    display: block !important;
    max-width: 100% !important;
}

.fb-post-card-frame .fb-post iframe,
.fb-post-card-frame .fb-post span {
    max-width: 100% !important;
}

.fb-skeleton-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 480px;
    color: #94a3b8;
    background: #f8fafc;
}

/* ==========================================================================
   Full-Screen Accessible Lightbox Modal
   ========================================================================== */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(8, 18, 32, 0.94);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    flex-direction: column;
    justify-content: space-between;
    opacity: 0;
    transition: opacity 0.25s ease-in-out;
}

.gallery-lightbox.active {
    display: flex;
    opacity: 1;
}

/* Lightbox Header */
.lightbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    z-index: 10;
}

.lightbox-counter {
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.lightbox-close-btn {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.11);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.lightbox-close-btn:hover {
    background: rgba(255, 255, 255, 0.20);
    border-color: rgba(255, 255, 255, 0.20);
}

/* Lightbox Body / Media Area */
.lightbox-body {
    position: relative;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 80px;
    overflow: hidden;
}

.lightbox-img-wrap {
    position: relative;
    max-width: 90vw;
    max-height: 72vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-main-img {
    max-width: 100%;
    max-height: 72vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
    transition: opacity 0.2s ease;
}

/* Nav Buttons */
.lightbox-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.11);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.35rem;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    z-index: 5;
}

.lightbox-nav-btn:hover {
    background: rgba(255, 255, 255, 0.20);
    border-color: rgba(255, 255, 255, 0.20);
}

.lightbox-prev-btn {
    left: 24px;
}

.lightbox-next-btn {
    right: 24px;
}

@media (max-width: 768px) {
    .lightbox-body {
        padding: 10px 20px;
    }
    .lightbox-nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    .lightbox-prev-btn { left: 8px; }
    .lightbox-next-btn { right: 8px; }
}

/* Lightbox Footer Caption */
.lightbox-footer {
    padding: 18px 24px 22px;
    text-align: center;
    background: linear-gradient(to top, rgba(8, 18, 32, 0.78), rgba(8, 18, 32, 0));
}

.lightbox-caption-title {
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 6px 0;
}

.lightbox-caption-meta {
    color: #94a3b8;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Clear keyboard focus without affecting pointer interactions. */
.gallery-card:focus-visible,
.gallery-filter-btn:focus-visible,
.lightbox-nav-btn:focus-visible,
.lightbox-close-btn:focus-visible {
    outline: 3px solid rgba(49, 113, 155, 0.35);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .gallery-card,
    .gallery-card-img,
    .gallery-card-overlay,
    .gallery-zoom-badge,
    .gallery-filter-btn,
    .lightbox-nav-btn,
    .lightbox-close-btn {
        transition: none !important;
    }
}
