/* Gallery page – frontend (hero uses .hero from style.css) */
.gallery-page {
    padding-bottom: 4rem;
}
.gallery-hero-visual {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    padding: var(--space-6, 1.5rem);
    background: var(--gray-50, #f9fafb);
    border-radius: var(--radius-2xl, 1rem);
}
.gallery-hero-visual .blog-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4, 1rem);
}
.gallery-hero-visual .stat-item {
    text-align: center;
    padding: var(--space-4, 1rem);
    background: white;
    border-radius: var(--radius-lg, 0.5rem);
    box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0,0,0,0.1));
    transition: transform 0.2s, box-shadow 0.2s;
}
.gallery-hero-visual .stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}
.gallery-hero-visual .stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color, #1e3a8a);
    margin-bottom: 0.25rem;
}
.gallery-hero-visual .stat-number i {
    color: var(--primary-color, #1e3a8a);
}
.gallery-hero-visual .stat-label {
    font-size: var(--text-sm, 0.875rem);
    color: var(--text-secondary, #6b7280);
    font-weight: 500;
}
@media (max-width: 768px) {
    .gallery-hero-visual .blog-stats {
        grid-template-columns: 1fr;
    }
}
.gallery-controls {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-light, #e5e7eb);
    background: var(--gray-50, #f9fafb);
}
.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
}
.gallery-filter-btn,
.gallery-filter-pills .pill {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    border: 1px solid var(--border-medium, #d1d5db);
    background: var(--white, #fff);
    color: var(--text-secondary, #4b5563);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.gallery-filter-btn:hover,
.gallery-filter-pills .pill:hover {
    background: var(--primary-color, #1e3a8a);
    color: var(--white, #fff);
    border-color: var(--primary-color, #1e3a8a);
}
.gallery-filter-btn.active,
.gallery-filter-pills .pill.active {
    background: var(--primary-color, #1e3a8a);
    color: var(--white, #fff);
    border-color: var(--primary-color, #1e3a8a);
}
.gallery-filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.gallery-grid-section {
    padding: 2.5rem 0;
}
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}
.gallery-card {
    background: var(--white, #fff);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0,0,0,0.1));
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
}
.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(30, 58, 138, 0.25);
}
.gallery-card-image {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--gray-100, #f3f4f6);
}
.gallery-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.gallery-card:hover .gallery-card-image img {
    transform: scale(1.05);
}
.gallery-card-body {
    padding: 1.25rem;
}
.gallery-card-category {
    display: inline-block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary-color, #1e3a8a);
    margin-bottom: 0.35rem;
}
.gallery-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
    color: var(--text-primary, #111827);
    line-height: 1.3;
}
.gallery-card-desc {
    font-size: 0.9rem;
    color: var(--text-secondary, #6b7280);
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.gallery-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary, #6b7280);
}
.gallery-empty p {
    margin: 0;
    font-size: 1.1rem;
}

/* Lightbox */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.gallery-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}
.gallery-lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: background 0.2s;
}
.gallery-lightbox-close:hover {
    background: rgba(255,255,255,0.2);
}
.gallery-lightbox-prev,
.gallery-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: background 0.2s;
}
.gallery-lightbox-prev { left: 1.5rem; }
.gallery-lightbox-next { right: 1.5rem; }
.gallery-lightbox-prev:hover,
.gallery-lightbox-next:hover {
    background: rgba(255,255,255,0.2);
}
.gallery-lightbox-content {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.gallery-lightbox-main-image {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}
.gallery-lightbox-main-image img,
.gallery-lightbox-content .gallery-lightbox-main-image img {
    max-width: 100%;
    max-height: 60vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}
.gallery-lightbox-thumbnails {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 90vw;
    margin-bottom: 1rem;
}
.gallery-lightbox-thumbnail {
    width: 56px;
    height: 56px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    background: rgba(255,255,255,0.1);
    cursor: pointer;
    flex-shrink: 0;
    overflow: hidden;
    transition: border-color 0.2s ease, opacity 0.2s ease;
}
.gallery-lightbox-thumbnail:hover {
    border-color: rgba(255,255,255,0.5);
}
.gallery-lightbox-thumbnail.active {
    border-color: #fff;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.3);
}
.gallery-lightbox-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gallery-lightbox-caption {
    margin-top: 1rem;
    text-align: center;
    color: #fff;
    max-width: 480px;
}
.gallery-lightbox-count {
    font-size: 0.9rem;
    opacity: 0.85;
    margin-bottom: 0.25rem;
}
.gallery-lightbox-caption h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.25rem;
}
.gallery-lightbox-caption p {
    margin: 0;
    font-size: 0.95rem;
    opacity: 0.9;
}

@media (max-width: 640px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .gallery-grid-section {
        padding: 1.5rem 0;
    }
    .gallery-controls {
        padding: 1rem 0;
    }
    .gallery-lightbox {
        padding: 1rem;
        padding-top: env(safe-area-inset-top, 1rem);
        padding-bottom: env(safe-area-inset-bottom, 1rem);
        padding-left: env(safe-area-inset-left, 1rem);
        padding-right: env(safe-area-inset-right, 1rem);
    }
    .gallery-lightbox-content {
        max-width: 100%;
        max-height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .gallery-lightbox-main-image img,
    .gallery-lightbox-content .gallery-lightbox-main-image img {
        max-height: 50vh;
    }
    .gallery-lightbox-thumbnails {
        max-width: 100%;
        margin-bottom: 0.75rem;
        gap: 6px;
    }
    .gallery-lightbox-thumbnail {
        width: 48px;
        height: 48px;
    }
    .gallery-lightbox-caption {
        margin-top: 0.75rem;
        max-width: 100%;
    }
    .gallery-lightbox-caption h3 {
        font-size: 1.1rem;
    }
    .gallery-lightbox-caption p {
        font-size: 0.875rem;
    }
    .gallery-lightbox-close {
        top: max(0.75rem, env(safe-area-inset-top));
        right: max(0.75rem, env(safe-area-inset-right));
        width: 44px;
        height: 44px;
    }
    .gallery-lightbox-prev,
    .gallery-lightbox-next {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }
    .gallery-lightbox-prev {
        left: max(0.5rem, env(safe-area-inset-left));
    }
    .gallery-lightbox-next {
        right: max(0.5rem, env(safe-area-inset-right));
    }
}

@media (max-width: 380px) {
    .gallery-card-body {
        padding: 1rem;
    }
    .gallery-card-title {
        font-size: 1rem;
    }
    .gallery-lightbox-thumbnail {
        width: 44px;
        height: 44px;
    }
}
