/* Gallery and lightbox styles */

.gallery {
    padding: 3rem 1rem;
}

.gallery h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.gallery-intro {
    margin: -0.6rem auto 1.3rem;
    max-width: 62ch;
    text-align: center;
    line-height: 1.55;
}

.gallery-grid {
    width: min(1200px, 100%);
    margin: 0 auto;
    column-count: 1;
    column-gap: 1rem;
}

.gallery-item {
    display: inline-block;
    width: 100%;
    margin: 0 0 1rem;
    break-inside: avoid;
    border: 0;
    padding: 0;
    background: transparent;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    aspect-ratio: var(--art-aspect-ratio, 4 / 3);
    transition: transform 0.3s ease;
}

.gallery-item-title {
    font-family: var(--font-accent);
    color: #fff;
    font-size: 0.95rem;
    text-align: left;
}

.gallery-item-meta {
    color: #eef5f2;
    font-size: 0.8rem;
    text-align: left;
    letter-spacing: 0.02em;
}

.gallery-item-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 1.5rem 0.75rem 0.45rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
}

.gallery-item-overlay .gallery-item-title {
    padding: 0;
}

.gallery-empty {
    margin: 0;
    padding: 1rem;
    border: 1px dashed #8da89a;
    border-radius: 8px;
    background: #f3f7f4;
}

.gallery-item:hover img,
.gallery-item:focus-visible img {
    transform: scale(1.04);
}

.gallery-item:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px #1f2a35;
}

.gallery-item:focus {
    outline: none;
    box-shadow: 0 0 0 3px #1f2a35;
}

.lightbox {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.88);
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.lightbox-figure {
    margin: 0;
    max-width: min(1100px, 90vw);
    max-height: 84vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.lightbox-image {
    display: block;
    max-width: 100%;
    max-height: calc(84vh - 2.5rem);
    border-radius: 10px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

.lightbox-caption {
    font-family: var(--font-accent);
    color: #f5f5f5;
    text-align: center;
    margin: 0;
}

.lightbox-caption.hidden {
    display: none;
}

.lightbox-close,
.lightbox-nav,
.lightbox-caption-toggle {
    position: absolute;
    border: 0;
    cursor: pointer;
    color: #fff;
    background: rgba(0, 0, 0, 0.45);
}

.lightbox-close {
    top: 1rem;
    right: 1rem;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    font-size: 1.75rem;
    line-height: 1;
}

.lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    font-size: 1.5rem;
}

.lightbox-prev {
    left: 1rem;
}

.lightbox-next {
    right: 1rem;
}

.lightbox-caption-toggle {
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 999px;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
}

.lightbox-close:hover,
.lightbox-nav:hover,
.lightbox-caption-toggle:hover,
.lightbox-close:focus-visible,
.lightbox-nav:focus-visible,
.lightbox-caption-toggle:focus-visible {
    background: rgba(255, 255, 255, 0.25);
    outline: 3px solid #ffffff;
    outline-offset: 2px;
}

body.lightbox-open {
    overflow: hidden;
}