/* ============================================
   Obsidian Scion — Cinematic Art Gallery
   Matches the main site's obsidian/gold aesthetic
   ============================================ */

/* Gallery Hero */
#gallery-hero {
    padding: 10rem 0 4rem;
    text-align: center;
    background: transparent;
    position: relative;
    overflow: hidden;
}

#gallery-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(201, 168, 76, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 30% 70%, rgba(120, 60, 180, 0.1) 0%, transparent 50%);
    z-index: 0;
    pointer-events: none;
}

#gallery-hero .container {
    position: relative;
    z-index: 1;
}

.gallery-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.12em;
    margin-bottom: 1.2rem;
    text-shadow:
        0 0 40px rgba(201, 168, 76, 0.25),
        0 0 80px rgba(120, 60, 180, 0.15);
}

.gallery-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto 1rem;
    line-height: 1.7;
}

.gallery-count {
    color: var(--gold-dim);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-top: 1.5rem;
}

/* Gallery Section */
#gallery-section {
    padding: 2rem 0 6rem;
    background: transparent;
}

/* Filters */
.gallery-filters,
.gallery-subfilters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.gallery-subfilters {
    margin-bottom: 2rem;
}

.gallery-filter,
.gallery-subfilter {
    padding: 0.6rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.gallery-filter:hover,
.gallery-subfilter:hover {
    border-color: var(--border-gold);
    color: var(--gold);
    background: var(--bg-card-hover);
}

.gallery-filter.active,
.gallery-subfilter.active {
    background: linear-gradient(135deg, var(--gold) 0%, #a88a3b 100%);
    color: var(--bg-void);
    border-color: var(--gold);
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.2);
}

.gallery-subfilter {
    font-size: 0.75rem;
    padding: 0.5rem 1.2rem;
    background: transparent;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    min-height: 400px;
}

/* Gallery Item */
.gallery-item {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: var(--transition);
    aspect-ratio: 3 / 4;
    opacity: 0;
    transform: translateY(20px);
    animation: galleryItemFadeIn 0.5s ease forwards;
}

@keyframes galleryItemFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-item:hover {
    border-color: var(--border-gold);
    transform: translateY(-6px);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(201, 168, 76, 0.1);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
}

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

/* Overlay */
.gallery-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(8, 4, 13, 0.7) 50%,
        rgba(8, 4, 13, 0.95) 100%);
    padding: 2rem 1rem 1rem;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item:hover .gallery-item-overlay {
    transform: translateY(0);
}

.gallery-item-title {
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--gold-bright);
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
    line-height: 1.3;
}

.gallery-item-category {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

/* Always show title on touch devices */
@media (hover: none) {
    .gallery-item-overlay {
        transform: translateY(0);
        background: linear-gradient(180deg,
            transparent 0%,
            rgba(8, 4, 13, 0.5) 70%,
            rgba(8, 4, 13, 0.9) 100%);
        padding-top: 3rem;
    }
}

/* Loading state */
.gallery-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 0;
    color: var(--text-muted);
}

.gallery-loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    border: 2px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Empty state */
.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 0;
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Load More */
.gallery-load-more {
    text-align: center;
    margin-top: 3rem;
}

#load-more-btn {
    padding: 1rem 3rem;
}

/* Back to site */
#back-to-site {
    text-align: center;
    padding: 3rem 0;
    background: transparent;
    border-top: 1px solid var(--border);
}

/* ============================================
   Lightbox — Cinematic Full-Screen Viewer
   ============================================ */

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 2, 8, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active .lightbox-backdrop {
    opacity: 1;
}

.lightbox-content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox.active .lightbox-content {
    transform: scale(1);
    opacity: 1;
}

.lightbox-image {
    max-width: 90vw;
    max-height: 78vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.7),
        0 0 60px rgba(201, 168, 76, 0.1);
    border: 1px solid rgba(201, 168, 76, 0.15);
}

.lightbox-info {
    text-align: center;
    margin-top: 1rem;
    padding: 0 2rem;
}

.lightbox-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--gold-bright);
    letter-spacing: 0.08em;
    margin-bottom: 0.3rem;
}

.lightbox-category {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 0.2rem;
}

.lightbox-counter {
    font-size: 0.75rem;
    color: var(--gold-dim);
    letter-spacing: 0.1em;
}

/* Lightbox Controls */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    z-index: 2;
    background: rgba(25, 16, 38, 0.6);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close {
    top: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.8rem;
    line-height: 1;
}

.lightbox-prev,
.lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
}

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

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(40, 26, 58, 0.8);
    border-color: var(--gold);
    color: var(--gold-bright);
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.15);
}

.lightbox-prev:hover { transform: translateY(-50%) translateX(-3px); }
.lightbox-next:hover { transform: translateY(-50%) translateX(3px); }

/* Lightbox image transition */
.lightbox-image.changing {
    opacity: 0;
    transform: scale(0.95);
}

.lightbox-image {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }

    .gallery-filter,
    .gallery-subfilter {
        font-size: 0.7rem;
        padding: 0.5rem 1rem;
    }

    .lightbox-prev { left: 0.5rem; }
    .lightbox-next { right: 0.5rem; }
    .lightbox-close { top: 1rem; right: 1rem; }

    .lightbox-info {
        padding: 0 4rem;
    }

    .gallery-title {
        font-size: 2.2rem;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .gallery-item {
        aspect-ratio: 3 / 4;
    }
}
