/* ==========================================================================
   Art Gallery Styles
   ========================================================================== */

/* Page-level overflow fix */
.page-art {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Header */
.art-header {
    padding: calc(var(--space-xl) + 60px) var(--space-md) var(--space-lg);
    max-width: var(--max-width);
    margin: 0 auto;
    text-align: center;
}

.art-header__title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: normal;
    font-style: italic;
    margin-bottom: var(--space-md);
    color: var(--text);
}

.art-header__avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: var(--space-md);
    opacity: 0.9;
}

.art-header__intro {
    font-size: 1rem;
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto var(--space-sm);
    line-height: 1.7;
}

.art-header__link {
    font-size: 0.875rem;
}

.art-header__link a {
    color: var(--accent-bright);
}

.art-header__nowplaying {
    margin-top: var(--space-md);
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-style: italic;
}

.art-header__nowplaying strong {
    color: var(--text);
    font-weight: normal;
}

/* Gallery Grid */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-md);
    padding: 0 var(--space-md) var(--space-xl);
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.gallery__item {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Prevent grid blowout */
}

.gallery__trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: var(--bg-elevated);
    aspect-ratio: 3/4;
}

.gallery__trigger img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.4s ease, opacity 0.4s ease;
    opacity: 0.9;
}

.gallery__trigger:hover img,
.gallery__trigger:focus img {
    transform: scale(1.02);
    opacity: 1;
}

.gallery__trigger:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.gallery__caption {
    padding: var(--space-xs) 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Lightbox (dialog) */
.lightbox {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background-color: rgba(0, 0, 0, 0.95);
    color: var(--text);
    overflow: hidden;
}

.lightbox::backdrop {
    background-color: rgba(0, 0, 0, 0.95);
}

.lightbox[open] {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.lightbox__close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 48px;
    height: 48px;
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox__close:hover,
.lightbox__close:focus {
    border-color: var(--accent-bright);
    color: var(--accent-bright);
}

.lightbox__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 90vh;
    padding: var(--space-md);
}

.lightbox__content img {
    max-width: 100%;
    max-height: calc(90vh - 100px);
    width: auto;
    height: auto;
    object-fit: contain;
}

.lightbox__content figcaption {
    margin-top: var(--space-md);
    text-align: center;
    font-size: 0.9375rem;
    line-height: 1.5;
}

.lightbox__content figcaption strong {
    font-weight: 500;
    display: block;
    margin-bottom: var(--space-xs);
}

.lightbox__meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .art-header {
        padding-left: var(--space-sm);
        padding-right: var(--space-sm);
    }
    
    .gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
        padding-left: var(--space-sm);
        padding-right: var(--space-sm);
    }
    
    .lightbox__close {
        top: var(--space-sm);
        right: var(--space-sm);
        width: 40px;
        height: 40px;
    }
    
    .lightbox__content {
        padding: var(--space-sm);
    }
}

@media (max-width: 480px) {
    .art-header {
        padding-left: var(--space-xs);
        padding-right: var(--space-xs);
        padding-top: calc(var(--space-xl) + 40px);
    }
    
    .art-header__intro {
        font-size: 0.9375rem;
    }
    
    .gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-xs);
        padding-left: var(--space-xs);
        padding-right: var(--space-xs);
    }
    
    .gallery__caption {
        font-size: 0.75rem;
    }
}