/* ════════════════════════════════════════════════
   GALLERY — gallery.css
   Two swipeable galleries (Horizontal / Vertical),
   toggled with a pure-CSS radio-button tab switch
   (same technique as the mobile nav hamburger).
   No JS required — scrolling is native touch/trackpad.
   ════════════════════════════════════════════════ */

#gallery { padding: 36px 0; border-top: 1px solid #e2e2e2; }

/* Hidden radio inputs drive the tab switch */
.gallery-radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Tabs */
.gallery-tabs {
    display: flex;
    gap: 0.5rem;
    margin: 0.5em 0 1.4em;
}

.gallery-tab {
    display: inline-block;
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.55rem 1.1rem;
    border-radius: 3px;
    border: 1px solid #ccc;
    color: var(--ink);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    user-select: none;
}

.gallery-tab:hover { border-color: var(--ink); }

#gallery-tab-h:checked ~ .gallery-tabs label[for="gallery-tab-h"],
#gallery-tab-v:checked ~ .gallery-tabs label[for="gallery-tab-v"] {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}

/* Panels — only the checked one shows */
.gallery-panel { display: none; }
#gallery-tab-h:checked ~ .gallery-panel--h { display: block; }
#gallery-tab-v:checked ~ .gallery-panel--v { display: block; }

/* Scrollable, swipeable track — no buttons needed */
.gallery-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
}

/* Hide scrollbar — swipe/scroll is the only interaction on mobile */
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-track { scrollbar-width: none; -ms-overflow-style: none; }

.gallery-item {
    flex: 0 0 auto;
    scroll-snap-align: start;
    display: block;
    border-radius: 4px;
    object-fit: cover;
    background: #eee; /* shows while placeholder/real images load */
}

/* Horizontal gallery — wide landscape images, peek of the next one */
.gallery-panel--h .gallery-item {
    width: min(78vw, 480px);
    aspect-ratio: 16 / 9;
}

/* Vertical gallery — tall portrait images, sized for mobile swiping */
.gallery-panel--v .gallery-item {
    width: min(62vw, 300px);
    aspect-ratio: 3 / 4;
}

@media (min-width: 900px) {
    .gallery-panel--h .gallery-item { width: min(38vw, 520px); }
    .gallery-panel--v .gallery-item { width: min(24vw, 320px); }
}

.gallery-copyright {
    font-size: 0.8rem;
    color: #666;
    margin-top: 1.1em;
    max-width: 60ch;
}

/* Mobile: vertical images reach screen edges cleanly, horizontal ones
   can't — so show vertical only, and hide the tab switch since there's
   nothing left to switch between. */
@media (max-width: 899px) {
    .gallery-tabs { display: none; }
    .gallery-panel--h { display: none !important; }
    .gallery-panel--v { display: block !important; }
}

/* Desktop/laptop: reverse — horizontal fills the wide screen edge to
   edge, vertical would leave large empty columns on either side. */
@media (min-width: 900px) {
    .gallery-tabs { display: none; }
    .gallery-panel--v { display: none !important; }
    .gallery-panel--h { display: block !important; }
}


/* ════════════════════════════════════════════════
   LIGHTBOX — fullscreen viewer, opened via :target.
   The overlay shows whenever it contains a targeted
   slide (:has()); the internal track is itself a
   scroll-snap strip, so once open you keep swiping
   between images exactly like the thumbnail strip.
   No JS required.
   ════════════════════════════════════════════════ */

.gallery-item-link { display: block; flex: 0 0 auto; }

.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.95);
}

.lightbox:has(.lightbox-slide:target) { display: block; }

.lightbox-track {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.lightbox-track::-webkit-scrollbar { display: none; }
.lightbox-track { scrollbar-width: none; -ms-overflow-style: none; }

.lightbox-slide {
    flex: 0 0 100%;
    scroll-snap-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.lightbox-close {
    position: fixed;
    top: 16px;
    right: 20px;
    z-index: 2010;
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 3px;
    padding: 0.5rem 0.9rem;
    text-decoration: none;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.22); text-decoration: none; }