/* ===== Gallery Page ===== */

.gallery-hero {
    background: var(--primary-accent);
    color: var(--white);
    /* Negative margin pulls the hero flush against the fixed header */
    margin-top: -110px;
    padding: calc(110px + 3rem) 2rem 3rem;
    text-align: center;
}

.gallery-hero-inner {
    max-width: 700px;
    margin: 0 auto;
}

.gallery-hero h2 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--white);
}

.gallery-hero p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
}

/* ===== Section & Container ===== */
.gallery-section {
    padding: 3rem 2rem 4rem;
    background: var(--page-bg);
    min-height: 400px;
}

.gallery-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== Category Filters ===== */
.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 2.5rem;
}

.filter-btn {
    padding: 0.5rem 1.25rem;
    border: 2px solid var(--text-primary);
    border-radius: 999px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.filter-btn:hover {
    background: var(--text-primary);
    color: var(--white);
}

.filter-btn.active {
    background: var(--text-primary);
    color: var(--white);
    border-color: var(--text-primary);
}

/* ===== Loading ===== */
.gallery-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 4rem 0;
    color: var(--text-secondary);
}

.gallery-loading[hidden],
.gallery-error[hidden],
.gallery-empty[hidden],
.gallery-filters[hidden] {
    display: none !important;
}

.gallery-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(0, 0, 0, 0.15);
    border-top-color: var(--primary-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Error / Empty States ===== */
.gallery-error,
.gallery-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
}

.gallery-error a,
.gallery-empty a {
    color: var(--primary-accent);
    text-decoration: underline;
    font-weight: 600;
}

/* ===== Grid ===== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* ===== Card ===== */
.gallery-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
}

.gallery-card:focus-visible {
    outline: 3px solid var(--primary-accent);
    outline-offset: 2px;
}

.gallery-card-img-wrap {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #e8edf0;
}

.gallery-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease, opacity 0.2s ease;
    display: block;
}

.gallery-card-img-wrap img.is-fading {
    opacity: 0.45;
}

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

.gallery-card-category {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: var(--primary-accent);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.gallery-card-body {
    padding: 1.1rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
}

.gallery-card-body h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
    margin: 0;
}

.gallery-card-body p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery-card-body time {
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.75;
    margin-top: auto;
    padding-top: 0.5rem;
}

/* ===== CTA Banner ===== */
.gallery-cta {
    background: var(--primary-accent);
    padding: 4rem 2rem;
    text-align: center;
}

.gallery-cta-inner {
    max-width: 600px;
    margin: 0 auto;
}

.gallery-cta h3 {
    color: var(--white);
    font-size: clamp(1.4rem, 3vw, 2rem);
    margin-bottom: 0.75rem;
}

.gallery-cta p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.05rem;
    margin-bottom: 1.75rem;
}

.btn-cta {
    display: inline-block;
    padding: 0.85rem 2.5rem;
    background: var(--primary-accent);
    color: var(--white);
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    letter-spacing: 0.01em;
}

.btn-cta:hover {
    background: #4b95c1;
    box-shadow: 0 4px 16px rgba(95, 168, 211, 0.45);
}

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

.gallery-lightbox[hidden] {
    display: none;
}

.lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 20, 30, 0.92);
}

.lightbox-content {
    position: relative;
    z-index: 1;
    max-width: min(92vw, 1100px);
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
}

.lightbox-img-wrap {
    width: 100%;
    max-height: 75vh;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    overflow: hidden;
    background: #0a141e;
}

.lightbox-img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    display: block;
    border-radius: 8px;
}

.lightbox-close {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: var(--white);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    z-index: 2;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: var(--white);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    z-index: 2;
}

.lightbox-prev { left: -3.5rem; }
.lightbox-next { right: -3.5rem; }

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-nav:disabled {
    opacity: 0.25;
    cursor: default;
}

.lightbox-caption {
    margin-top: 1rem;
    text-align: center;
    color: var(--white);
    max-width: 700px;
    width: 100%;
}

.lightbox-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    color: var(--white);
}

.lightbox-desc {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.55;
    margin-bottom: 0.5rem;
}

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

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .lightbox-prev { left: 0.25rem; }
    .lightbox-next { right: 0.25rem; }
    .lightbox-nav {
        top: auto;
        bottom: 4.5rem;
        transform: none;
        width: 42px;
        height: 42px;
    }
}

@media (max-width: 640px) {
    .gallery-section {
        padding: 2rem 1.25rem 3rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-cta {
        padding: 3rem 1.25rem;
    }
}
