/* ============================================================
   HARDTWALDBATTERIE – Gallery Page Styles
   Used by templates/gallery.html → dist/galerie/[slug].html
   ============================================================ */

/* ── Hero ────────────────────────────────────────────────────────────────── */

.gallery-hero {
    padding: 8rem 2rem 3rem;
    text-align: center;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(201, 162, 39, 0.06) 0%, transparent 60%),
        var(--gradient-ritual, linear-gradient(180deg, #0a0a0a 0%, #0f0a05 100%));
}

.gallery-hero-eyebrow {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 0.7rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--accent-gold, #c9a227);
    opacity: 0.7;
    margin-bottom: 1rem;
}

.gallery-title {
    font-family: var(--font-display, 'Cinzel', serif);
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 700;
    color: var(--text-light, #f5f0e8);
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
}

.gallery-subtitle {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    color: var(--accent-gold, #c9a227);
    opacity: 0.6;
    text-transform: uppercase;
}

/* ── Main grid area ──────────────────────────────────────────────────────── */

.gallery-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem 5rem;
}

/* ── Masonry-style grid ─────────────────────────────────────────────────── */
/*
   CSS columns give true masonry behavior (no JS required).
   Images fill columns top-to-bottom, naturally staggering heights.
*/

.gallery-grid {
    columns: 3;
    column-gap: 0.75rem;
}

/* ── Individual gallery item ────────────────────────────────────────────── */

.gallery-item {
    display: block;
    break-inside: avoid;       /* prevent an image from splitting across columns */
    margin: 0 0 0.75rem;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid transparent;
    transition:
        border-color 0.25s ease,
        box-shadow   0.25s ease;
    position: relative;
}

.gallery-item:hover,
.gallery-item:focus-within {
    border-color: rgba(201, 162, 39, 0.5);
    box-shadow:
        0 0 0 1px rgba(201, 162, 39, 0.15),
        0 4px 20px rgba(0, 0, 0, 0.5);
    outline: none;
}

.gallery-item:focus {
    outline: 2px solid var(--accent-gold, #c9a227);
    outline-offset: 2px;
}

/* Active thumbnail when lightbox is open for it */
.gallery-item.is-active {
    border-color: var(--accent-gold, #c9a227);
}

.gallery-img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.4s ease;
}

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

/* ── Lightbox ────────────────────────────────────────────────────────────── */

.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(5, 3, 0, 0.96);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.lightbox.is-open {
    display: flex;
    flex-direction: column;
    animation: lb-fade-in 0.2s ease;
}

@keyframes lb-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.lightbox-img-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    width: 100%;
    max-height: calc(100vh - 8rem);
}

.lightbox-img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow:
        0 2px 8px  rgba(0, 0, 0, 0.4),
        0 8px 32px rgba(0, 0, 0, 0.6);
    animation: lb-img-in 0.2s ease;
}

@keyframes lb-img-in {
    from { opacity: 0; transform: scale(0.97); }
    to   { opacity: 1; transform: scale(1); }
}

.lightbox-counter {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    color: rgba(201, 162, 39, 0.6);
    text-align: center;
    margin-top: 0.75rem;
}

/* Lightbox buttons */

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: fixed;
    background: transparent;
    border: 1px solid rgba(201, 162, 39, 0.2);
    color: var(--text-light, #f5f0e8);
    cursor: pointer;
    transition:
        background     0.2s ease,
        border-color   0.2s ease,
        color          0.2s ease,
        transform      0.15s ease;
    z-index: 1001;
    line-height: 1;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    padding: 0;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(201, 162, 39, 0.12);
    border-color: rgba(201, 162, 39, 0.5);
    color: var(--accent-gold, #c9a227);
}

.lightbox-close:focus-visible,
.lightbox-prev:focus-visible,
.lightbox-next:focus-visible {
    outline: 2px solid var(--accent-gold, #c9a227);
    outline-offset: 2px;
}

.lightbox-close {
    top: 1.5rem;
    right: 1.5rem;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.5rem;
    border-radius: 50%;
}

.lightbox-close:hover {
    transform: rotate(90deg);
}

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

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

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

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

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
    .gallery-grid {
        columns: 2;
    }

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

@media (max-width: 540px) {
    .gallery-main {
        padding: 1.5rem 0.75rem 4rem;
    }

    .gallery-grid {
        columns: 1;
        column-gap: 0;
    }

    .gallery-item {
        margin-bottom: 0.5rem;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.5rem;
    }

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