/* Explain: Styles for the image gallery, filters, and lightbox viewer. */
/* ===== معرض الصور — شبكة صور التحميل والوصول ===== */
.gallery-filter {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    background: var(--background-color);
    padding: 0.55rem 1.4rem;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.gallery-filter:hover {
    border-color: rgba(200, 16, 46, 0.42);
    color: var(--text-color);
    transform: translateY(-2px);
}

.gallery-filter.is-active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 14px 34px rgba(200, 16, 46, 0.28);
}

.gallery-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border: 1px solid var(--glass-border);
    border-radius: 1.8rem;
    background: linear-gradient(150deg, #ffffff 0%, var(--background-color) 100%);
    padding: 0.7rem 0.7rem 1.2rem;
    text-align: start;
    box-shadow: 0 18px 50px rgba(19, 19, 22, 0.07);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.5s ease, border-color 0.5s ease;
}

.gallery-card.is-hidden {
    display: none;
}

.gallery-card:hover {
    border-color: rgba(200, 16, 46, 0.45);
    box-shadow: 0 30px 70px rgba(200, 16, 46, 0.18);
    transform: translateY(-6px);
}

.gallery-frame {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 1.3rem;
    aspect-ratio: 4 / 3;
    background: var(--ink-color);
}

.gallery-img {
    height: 100%;
    width: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.gallery-badge {
    position: absolute;
    top: 0.8rem;
    inset-inline-start: 0.8rem;
    display: inline-flex;
    border-radius: 999px;
    background: rgba(200, 16, 46, 0.92);
    padding: 0.35rem 0.9rem;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 800;
    box-shadow: 0 10px 26px rgba(14, 14, 16, 0.3);
    backdrop-filter: blur(8px);
}

.gallery-caption {
    display: block;
    padding-inline: 0.5rem;
}

.gallery-title {
    display: block;
    color: var(--text-color);
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.6;
}

.gallery-text {
    display: block;
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.8;
}

/* ===== العارض المكبّر ===== */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: none;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    background: rgba(10, 10, 12, 0.9);
    padding: 1rem;
    backdrop-filter: blur(10px);
}

.gallery-lightbox.is-open {
    display: flex;
}

.gallery-lightbox-panel {
    position: relative;
    display: flex;
    width: 100%;
    max-width: 58rem;
    margin: auto;
    flex-direction: column;
    gap: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 1.8rem;
    background: var(--ink-color);
    padding: 1rem;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
}

.gallery-lightbox-media {
    position: relative;
    overflow: hidden;
    border-radius: 1.3rem;
    background: #0A0A0C;
}

.gallery-lightbox-img {
    display: block;
    max-height: 66vh;
    width: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.gallery-lightbox-img.is-ready {
    opacity: 1;
}

.gallery-lightbox-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2.6rem;
    height: 2.6rem;
    margin: -1.3rem 0 0 -1.3rem;
    border: 3px solid rgba(255, 255, 255, 0.22);
    border-top-color: var(--accent-color);
    border-radius: 999px;
    opacity: 0;
    animation: gallerySpin 0.85s linear infinite;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.gallery-lightbox-loader.is-loading {
    opacity: 1;
}

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

.gallery-lightbox-info {
    text-align: center;
    padding-inline: 0.5rem;
}

.gallery-lightbox-title {
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 800;
}

.gallery-lightbox-text {
    margin-top: 0.4rem;
    color: var(--text-on-dark-muted);
    font-size: 0.9rem;
    line-height: 1.9;
}

.gallery-lightbox-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.gallery-lightbox-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.9rem;
    height: 2.9rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    backdrop-filter: blur(10px);
    transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.gallery-lightbox-btn:hover {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.26);
    transform: translateY(-2px);
}

.gallery-lightbox-close {
    position: absolute;
    top: 1.5rem;
    inset-inline-end: 1.5rem;
    z-index: 3;
}

@media (max-width: 639px) {
    .gallery-lightbox-img {
        max-height: 52vh;
    }

    .gallery-lightbox-close {
        top: 1.1rem;
        inset-inline-end: 1.1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-card,
    .gallery-img,
    .gallery-filter,
    .gallery-lightbox-btn,
    .gallery-lightbox-img {
        transition: none;
    }

    .gallery-card:hover .gallery-img {
        transform: none;
    }
}