/* ============================================================
   ivs-gallery — the V5 "Filmstrip" photo gallery (komponen.md §ivs-gallery).
   Loaded once, by the partial itself (@once). Tokens from ivs-tokens.css
   with literal fallbacks; chevrons come from the ivs-chevnav component.
   The strip below the stage holds EVERY thumbnail and scrolls sideways:
   native touch swipe on phones, mouse drag (JS) on desktop.
   ============================================================ */

/* Host knobs: a page whose photos are low-res can narrow the gallery and
   soften the ratio (less upscaling, less cropping) without forking the
   component — set the vars on its own scope. Defaults stay full cinema. */
.ivs-gal { max-width: var(--ivs-gal-maxw, none); margin-inline: auto; }
.ivs-gal-stage {
    position: relative;
    overflow: hidden;
    background: #000;
    border: 1px solid var(--v5-line, #e4e0d5);
    aspect-ratio: var(--ivs-gal-ratio, 16 / 8);
}
.ivs-gal-stage > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1s ease;
}
.ivs-gal-stage > img.is-on { opacity: 1; }

.ivs-gal-strip {
    display: flex;
    gap: .55rem;
    margin-top: .55rem;
    overflow-x: auto;
    padding-bottom: .4rem;
    cursor: grab;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    scrollbar-color: var(--v5-line, #e4e0d5) transparent;
}
.ivs-gal-strip.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.ivs-gal-strip::-webkit-scrollbar { height: 5px; }
.ivs-gal-strip::-webkit-scrollbar-track { background: transparent; }
.ivs-gal-strip::-webkit-scrollbar-thumb { background: var(--v5-line, #e4e0d5); border-radius: 3px; }
.ivs-gal-strip:hover::-webkit-scrollbar-thumb { background: var(--v5-olive-300, #a9b58f); }

.ivs-gal-strip button {
    position: relative;
    flex: 0 0 auto;
    /* ~6 thumbs visible with the 7th peeking in, so the strip reads as scrollable */
    width: clamp(96px, 15%, 210px);
    aspect-ratio: 3 / 2;
    padding: 0;
    border: 0;
    cursor: pointer;
    overflow: hidden;
    background: #000;
    opacity: .55;
    transition: opacity .3s;
    scroll-snap-align: start;
}
.ivs-gal-strip button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
}
.ivs-gal-strip button:hover { opacity: 1; }
.ivs-gal-strip button.is-on { opacity: 1; outline: 2px solid var(--v5-olive-700, #4a5e2f); outline-offset: -2px; }
.ivs-gal-strip button:focus-visible { opacity: 1; outline: 2px solid var(--v5-olive-700, #4a5e2f); outline-offset: 2px; }

@media (max-width: 640px) {
    .ivs-gal-stage { aspect-ratio: 16 / 10; }
    .ivs-gal-strip button { width: 27vw; }
}

@media (prefers-reduced-motion: reduce) {
    .ivs-gal-stage > img { transition: opacity .3s; }
    .ivs-gal-strip button { transition: none; }
    .ivs-gal-strip { scroll-behavior: auto; }
}
