/* Full-width photo carousel */
#album-slider .photo-marquee {
    width: 100%;
    height: clamp(290px, 39vh, 420px);
    overflow: hidden;
    margin: 0;
    padding: 0;
    cursor: grab;
    touch-action: pan-y;
    -webkit-tap-highlight-color: transparent;
    background-color: var(--rm-brown-dark);
}

#album-slider .photo-marquee.is-dragging {
    cursor: grabbing;
}

#album-slider .photo-marquee.is-dragging .photo-marquee-slide {
    pointer-events: none;
}

#album-slider .photo-marquee-track {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    height: 100%;
    will-change: transform;
    font-size: 0;
    line-height: 0;
}

#album-slider .photo-marquee-slide {
    flex: 0 0 auto;
    height: 100%;
    width: auto;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: stretch;
    -webkit-appearance: none;
    appearance: none;
    line-height: 0;
    touch-action: pan-y;
    -webkit-tap-highlight-color: transparent;
}

#album-slider .photo-marquee-slide img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    flex-shrink: 0;
    object-fit: cover;
    vertical-align: top;
    pointer-events: none;
    user-select: none;
}

.gallery-lightbox {
    border: none;
    padding: 0;
    max-width: min(960px, 96vw);
    width: 100%;
    background: transparent;
    box-shadow: none;
    overflow: visible;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
}

.gallery-lightbox::backdrop {
    background: rgb(0 0 0 / 96%);
    backdrop-filter: blur(5px);
}

.gallery-lightbox__figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
}

.gallery-lightbox__img {
    display: block;
    max-width: min(92vw, 900px);
    max-height: min(82vh, 720px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 0;
    border: 0;
}

.gallery-lightbox__caption {
    color: #fff;
    font-family: var(--rm-font-body);
    font-size: 0.88rem;
    letter-spacing: 0.1em;
    text-align: center;
}

.gallery-lightbox__close {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1010;
    width: 3rem;
    height: 3rem;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: var(--rm-brown-dark);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s, background .2s;
}

.gallery-lightbox__close:hover {
    transform: scale(1.1);
    background: #fff;
}

.gallery-lightbox__nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1010;
    width: 3rem;
    height: 3rem;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: var(--rm-brown-dark);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform .2s, background .2s;
}

.gallery-lightbox__nav:hover {
    transform: translateY(-50%) scale(1.1);
    background: #fff;
}

.gallery-lightbox__nav--prev {
    left: max(var(--rm-space-4), env(safe-area-inset-left));
}

.gallery-lightbox__nav--next {
    right: max(var(--rm-space-4), env(safe-area-inset-right));
}

@media (max-width: 900px) {
    #album-slider .photo-marquee {
        /* Keep photo dimensions stable when mobile browser bars expand or collapse. */
        height: clamp(210px, 64vw, 300px);
    }
    .gallery-lightbox__close {
        top: 1rem;
        right: 1rem;
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.5rem;
    }
    .gallery-lightbox__nav {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.5rem;
    }
}

.photo-marquee-slide:focus-visible {
    outline-offset: -4px;
}


#gallery-lightbox[open] {
  display: flex; align-items: center; justify-content: center;
  inset: 0; margin: 0; width: 100vw; height: 100dvh;
  max-width: none; max-height: none; padding: 0 72px; overflow: hidden;
}
#gallery-lightbox .gallery-lightbox__figure {
  position: relative; display: block; width: max-content; max-width: 100%; margin: 0;
}
#gallery-lightbox .gallery-lightbox__img {
  max-height: 96dvh; max-width: calc(100vw - 144px);
  width: auto; height: auto; object-fit: contain;
}
#gallery-lightbox .gallery-lightbox__caption {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  margin: 0; padding: 4px 12px; border-radius: 99px;
  background: #17110dc9; font: 500 14px/1.5 var(--rm-font-body); color: #fff;
}
#gallery-lightbox .gallery-lightbox__nav {
  transform: translateY(-50%);
  width: 44px; height: 44px; min-width: 44px; padding: 11px;
}
#gallery-lightbox .gallery-lightbox__nav svg { width: 22px; height: 22px; }
#gallery-lightbox .gallery-lightbox__close {
  top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right));
  width: 44px; height: 44px;
}

@media (max-width: 600px) {
  #gallery-lightbox[open] { padding: 12px; }
  #gallery-lightbox .gallery-lightbox__img { max-width: calc(100vw - 24px); max-height: 94dvh; }
  .gallery-lightbox__nav--prev { left: max(var(--rm-space-2), env(safe-area-inset-left)); }
  .gallery-lightbox__nav--next { right: max(var(--rm-space-2), env(safe-area-inset-right)); }
}
