/* Gallery page — load after styles.css and photo.css */

.gallery {
    border-left-color: var(--nord13);
}

.gallery-count {
    margin-bottom: 1rem;
    color: var(--nord3);
    font-size: 0.85rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 1rem 0.9rem;
}

.gallery-item {
    display: block;
    font: inherit;
    color: inherit;
    text-align: left;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.gallery-item img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: var(--nord1);
    border-radius: 3px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s ease;
}

.gallery-item:hover img,
.gallery-item:focus-visible img {
    transform: translateY(-4px);
}

.gallery-cap {
    display: block;
    margin-top: 0.4rem;
    color: var(--nord9);
    font-size: 0.78rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Lightbox (native <dialog>, so Esc and focus handling come for free) */
.lightbox {
    margin: auto;
    padding: 0;
    width: min(1000px, 96vw);
    max-height: 94vh;
    overflow: auto;
    color: var(--nord4);
    background: var(--nord0);
    border: 1px solid var(--nord3);
    border-radius: 8px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    line-height: 1.65;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.lightbox::backdrop {
    background: rgba(20, 23, 29, 0.85);
}

.lightbox-inner {
    padding: 0.9rem 1rem 1.3rem;
}

.lightbox-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.lightbox-count {
    margin-right: auto;
    color: var(--nord3);
    font-size: 0.85rem;
}

.lightbox-bar button {
    font: inherit;
    color: var(--nord4);
    background: var(--nord1);
    border: 1px solid var(--nord3);
    border-radius: 3px;
    padding: 0.15rem 0.7rem;
    cursor: pointer;
}

.lightbox-bar button:hover:not(:disabled) {
    border-color: var(--nord8);
}

.lightbox-bar button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.lightbox-stage {
    display: flex;
    justify-content: center;
}

.lightbox-stage img {
    display: block;
    max-width: 100%;
    max-height: 68vh;
    width: auto;
    height: auto;
    border-radius: 4px;
}

.lightbox-meta {
    margin-top: 1rem;
    max-width: 80ch;
}

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

    .lightbox-stage img {
        max-height: 55vh;
    }
}
