/* Styles for listings/templates/listings/partials/_room_gallery.html
   (moved out of an inline <style> block so browsers cache them). */

/* ============ Page gallery ============ */
.rg {
  position: relative;
  background: var(--card-sunken);
  overflow: hidden;
}
.rg-track {
  display: flex;
  aspect-ratio: 4 / 3;
  max-height: 72vh;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
}
.rg-track::-webkit-scrollbar { display: none; }
.rg-item {
  position: relative;
  flex: 0 0 100%;
  padding: 0;
  border: 0;
  background: var(--card-sunken);
  scroll-snap-align: center;
  scroll-snap-stop: always;
  cursor: zoom-in;
  overflow: hidden;
}
.rg-item:focus-visible { outline: 3px solid #0B6FBF; outline-offset: -3px; }
.rg-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease, filter 0.25s ease;
}

.rg-counter {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.68);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}
.rg-dots {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  pointer-events: none;
}
.rg-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
  transition: width 0.2s ease, background 0.2s ease;
}
.rg-dot.is-active { width: 16px; background: #fff; }

/* Phones: a round "expand" button in the corner. */
.rg-all {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.62);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.rg-all-text { display: none; }
.rg-all:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.rg-empty {
  aspect-ratio: 16 / 9;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  color: var(--text-muted);
}
.rg-empty p { margin: 0; font-weight: 600; }

/* Wider screens: a photo grid - one large, up to four small. */
@media (min-width: 700px) {
  .rg-track {
    display: grid;
    aspect-ratio: auto;
    height: 440px;
    max-height: none;
    gap: 6px;
    overflow: hidden;
    scroll-snap-type: none;
    grid-template-columns: 2fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
  }
  .rg-item { flex: none; }
  .rg-item:first-child { grid-row: 1 / span 2; }
  .rg-item:nth-child(n + 6) { display: none; }
  .rg[data-count="1"] .rg-track { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .rg[data-count="2"] .rg-track { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
  .rg[data-count="2"] .rg-item:first-child { grid-row: auto; }
  .rg[data-count="3"] .rg-track,
  .rg[data-count="4"] .rg-track { grid-template-columns: 2fr 1fr; }
  .rg[data-count="4"] .rg-item:nth-child(n + 4) { display: none; }
  .rg-item:hover .rg-img { transform: scale(1.04); filter: brightness(0.92); }
  .rg-counter, .rg-dots { display: none; }
  .rg-all {
    top: auto;
    bottom: 14px;
    right: 14px;
    width: auto;
    height: auto;
    padding: 9px 14px;
    border-radius: 10px;
    background: #fff;
    color: #0f172a;
    font-size: 0.86rem;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.22);
    backdrop-filter: none;
  }
  .rg-all:hover { background: #f1f5f9; }
  .rg-all-text { display: inline; }
}

/* ============ Fullscreen viewer ============ */
html.rgv-lock, html.rgv-lock body { overflow: hidden; }
.rgv {
  position: fixed;
  inset: 0;
  z-index: 10040; /* above the Help button and sticky bars, below the idle sign-out warning */
  display: flex;
  flex-direction: column;
  background: #070a12;
  color: #fff;
  animation: rgv-in 0.18s ease-out;
}
.rgv[hidden] { display: none; }
.rgv-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
}
.rgv-count { font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.rgv-actions { display: flex; gap: 8px; }
.rgv-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}
.rgv-btn:hover { background: rgba(255, 255, 255, 0.22); }
.rgv-btn:focus-visible, .rgv-nav:focus-visible, .rgv-thumb:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.rgv.is-zoomed [data-viewer-zoom] { background: #fff; color: #0f172a; }

.rgv-stage { position: relative; flex: 1; min-height: 0; }
.rgv-track {
  display: flex;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
}
.rgv-track::-webkit-scrollbar { display: none; }
.rgv.is-zoomed .rgv-track { overflow-x: hidden; scroll-snap-type: none; }
.rgv-slide {
  position: relative;
  flex: 0 0 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}
.rgv-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.25s ease;
  user-select: none;
  -webkit-user-select: none;
  cursor: zoom-in;
}
.rgv-img.is-loaded { opacity: 1; }
.rgv-slide.is-loading::after {
  content: "";
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  animation: rgv-spin 0.8s linear infinite;
}
.rgv-slide.is-zoomed { overflow: auto; place-items: start; touch-action: pan-x pan-y; }
.rgv-slide.is-zoomed .rgv-img { max-width: none; max-height: none; width: 220%; cursor: zoom-out; }

.rgv-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.rgv-nav:hover { background: rgba(255, 255, 255, 0.26); }
.rgv-nav:disabled { opacity: 0.25; cursor: default; }
.rgv-prev { left: 16px; }
.rgv-next { right: 16px; }
.rgv.is-zoomed .rgv-nav { display: none; }

.rgv-thumbs {
  display: flex;
  gap: 8px;
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
  overflow-x: auto;
  scrollbar-width: none;
  justify-content: safe center;
}
.rgv-thumbs::-webkit-scrollbar { display: none; }
.rgv-thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 48px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}
.rgv-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rgv-thumb:hover { opacity: 0.85; }
.rgv-thumb.is-active { opacity: 1; border-color: #fff; }

/* Touch screens swipe; the big arrows are for mouse and keyboard. */
@media (hover: none) {
  .rgv-nav { display: none; }
}
@keyframes rgv-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rgv-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .rgv, .rg-img, .rgv-img { animation: none; transition: none; }
}
