/* vitruvian.css — gallery page for Vitruvian Magazine */

/* ── Page header ── */
.gallery-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.gallery-header .section-label {
    margin-top: 0;
    margin-bottom: 0.2rem;
}

.gallery-count {
    font-size: 0.75rem;
    color: #999;
}

/* ── Filter switch ── */
.filter-switch {
    display: flex;
    gap: 1px;
    background: #ccc;
    border: 1px solid #ccc;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 0.2rem;
}

.filter-btn {
    background: #fff;
    border: none;
    padding: 0.35rem 0.85rem;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.72rem;
    color: #555;
    cursor: pointer;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition:
        background 0.1s,
        color 0.1s;
}
.filter-btn:hover {
    background: #f0f0f0;
    color: #000;
}
.filter-btn.active {
    background: #000;
    color: #fff;
}

/* ── Gallery grid ── */
/*
  Two separate column widths: rectangles sit in a 4-col grid
  (narrower columns to honour portrait ratio), squares in a 3-col grid.
  We achieve this by letting all cards flow in one grid but using
  different aspect-ratio values — the browser handles height naturally.
*/
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.gallery-card {
    overflow: hidden;
    cursor: pointer;
    background: #f4f4f4;
    position: relative;
}

/* Portrait rectangles */
.gallery-card.rect {
    aspect-ratio: 1748 / 2480; /* ~0.7 — all three rect ratios are close enough */
}

/* Squares */
.gallery-card.square {
    aspect-ratio: 1 / 1;
}

.gallery-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.2s;
}
.gallery-card:hover img {
    opacity: 0.85;
}

/* ── Lightbox ── */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
.lightbox.open {
    display: flex;
}

.lb-img-wrap {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lb-img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    display: block;
}

.lb-caption {
    color: #888;
    font-family: "Courier New", Courier, monospace;
    font-size: 0.7rem;
    margin-top: 0.75rem;
    letter-spacing: 0.06em;
}

/* Lightbox controls */
.lb-close,
.lb-prev,
.lb-next {
    position: absolute;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.5rem;
    opacity: 0.6;
    transition: opacity 0.15s;
    line-height: 1;
}
.lb-close:hover,
.lb-prev:hover,
.lb-next:hover {
    opacity: 1;
}

.lb-close {
    top: 1.25rem;
    right: 1.5rem;
    font-size: 1rem;
}
.lb-prev {
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
}
.lb-next {
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 520px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.35rem;
    }
    .filter-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.65rem;
    }
    .lb-prev {
        left: 0.5rem;
    }
    .lb-next {
        right: 0.5rem;
    }
}
