/* PHOTO_TOUR_SCROLLABLE — réplica UX Airbnb */
:root {
  --air-text: #222;
  --air-mute: #6a6a6a;
  --air-line: #ebebeb;
  --air-bg: #fff;
  --air-font: "Nunito Sans", system-ui, sans-serif;
  --gap: 0.5rem;
  --radius: 12px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.tour-page {
  margin: 0;
  font-family: var(--air-font);
  color: var(--air-text);
  background: var(--air-bg);
  -webkit-font-smoothing: antialiased;
}

/* Sticky shell: chrome + carrusel de ambientes siempre visible */
.tour-sticky {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--air-line);
}

.tour-chrome {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem 0.35rem;
}

.tour-chrome-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tour-back {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--air-text);
  border-radius: 999px;
  text-decoration: none;
}
.tour-back:hover { background: #f7f7f7; }

.tour-chrome-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  justify-self: end;
}

.tour-text-btn {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--air-text);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.tour-text-btn:hover { background: #f7f7f7; }
.tour-text-btn[aria-pressed="true"] svg path {
  fill: var(--air-text);
  stroke: var(--air-text);
}

.tour-carousel-bar {
  display: grid;
  grid-template-columns: 2.25rem 1fr 2.25rem;
  gap: 0.35rem;
  align-items: center;
  width: min(1120px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 0.35rem 0 0.85rem;
}

.tour-nav {
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--air-line);
  border-radius: 999px;
  background: #fff;
  color: var(--air-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
}
.tour-nav:hover:not(:disabled) { background: #f7f7f7; }
.tour-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.tour-main {
  width: min(1120px, calc(100% - 2.5rem));
  margin: 0 auto 4rem;
  padding-top: 0.5rem;
}

/* Carrusel horizontal sticky de ambientes */
.tour-jump {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 0.15rem;
  padding: 0.15rem 0.1rem 0.35rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tour-jump::-webkit-scrollbar { display: none; }

.tour-jump-item {
  flex: 0 0 auto;
  width: min(28vw, 118px);
  scroll-snap-align: start;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--air-text);
}

.tour-jump-media {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  background: #ebebeb;
  transition: opacity 0.2s var(--ease);
}

.tour-jump-label {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tour-jump-item:not(.is-active):hover .tour-jump-media {
  opacity: 0.88;
}

.tour-jump-item:focus-visible .tour-jump-media,
.tour-jump-item.is-active .tour-jump-media {
  outline: 2px solid var(--air-text);
  outline-offset: 2px;
}

/* Room sections */
.tour-room {
  scroll-margin-top: 11.5rem;
  padding: 2.25rem 0;
  border-top: 1px solid var(--air-line);
}

.tour-room-layout {
  display: grid;
  gap: 1.25rem;
}

.tour-room-title {
  margin: 0 0 0.65rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tour-amenities {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0;
  color: var(--air-mute);
  font-size: 0.92rem;
  line-height: 1.45;
  max-width: 36rem;
}

.tour-amenities li:not(:last-child)::after {
  content: "·";
  margin: 0 0.4rem;
  color: var(--air-mute);
}

.tour-amenities .tour-more {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 600;
  color: var(--air-text);
  text-decoration: underline;
  text-underline-offset: 0.16em;
  cursor: pointer;
}
.tour-amenities .tour-more::after { content: none; }

.tour-photos-stack {
  display: grid;
  gap: var(--gap);
}

/* Photo grids — patrones Airbnb por cantidad / orientación */
.tour-photos {
  display: grid;
  gap: var(--gap);
}

.tour-photos button {
  margin: 0;
  padding: 0;
  border: 0;
  background: #f0f0f0;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.tour-photos img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  vertical-align: top;
  transition: transform 0.45s var(--ease), filter 0.25s var(--ease);
}

.tour-photos button:hover img {
  transform: scale(1.02);
  filter: brightness(0.96);
}

/* 1 foto */
.tour-photos[data-count="1"] {
  grid-template-columns: 1fr;
}
.tour-photos[data-count="1"] button {
  max-height: min(70vh, 560px);
}
.tour-photos[data-count="1"] img {
  aspect-ratio: auto;
  max-height: min(70vh, 560px);
  width: 100%;
  object-fit: contain;
  background: #f7f7f7;
}

.tour-photos[data-count="1"] button.is-portrait img {
  object-fit: cover;
  aspect-ratio: 3 / 4;
  max-height: min(70vh, 640px);
  margin: 0 auto;
}

/* 2 fotos */
.tour-photos[data-count="2"] {
  grid-template-columns: 1fr 1fr;
}
.tour-photos[data-count="2"] img { aspect-ratio: 4 / 3; }

/* 3 fotos — 2 apiladas + 1 alta (patrón Airbnb) */
.tour-photos[data-count="3"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  min-height: min(52vw, 420px);
}
.tour-photos[data-count="3"] .span-tall {
  grid-column: 2;
  grid-row: 1 / -1;
}
.tour-photos[data-count="3"] img { aspect-ratio: auto; min-height: 100%; }

/* 4+ legacy classes kept for safety */
.tour-photos.is-many {
  grid-template-columns: 1fr 1fr;
}

/* Desktop: meta izquierda + fotos derecha */
@media (min-width: 880px) {
  .tour-jump-item {
    width: 128px;
  }

  .tour-room {
    scroll-margin-top: 10.5rem;
  }

  .tour-room-layout {
    grid-template-columns: minmax(200px, 280px) minmax(0, 1fr);
    gap: 2.5rem;
    align-items: start;
  }

  .tour-room-meta {
    position: sticky;
    top: 10.5rem;
  }

  .tour-photos[data-count="3"] {
    min-height: 440px;
  }
}

@media (min-width: 1128px) {
  .tour-chrome,
  .tour-carousel-bar {
    width: min(1120px, calc(100% - 2rem));
    margin-inline: auto;
    padding-inline: 0;
  }

  .tour-chrome {
    width: min(1120px, calc(100% - 2rem));
    padding-top: 0.85rem;
  }
}

@media (max-width: 560px) {
  .tour-text-btn span { display: none; }
  .tour-chrome-title { font-size: 0.92rem; }
  .tour-main { width: min(100% - 1.5rem, 1120px); }
  .tour-jump-item { width: min(32vw, 108px); }
  .tour-room { scroll-margin-top: 10.75rem; }
  .tour-photos[data-count="2"],
  .tour-photos[data-count="3"],
  .tour-photos.is-many {
    grid-template-columns: 1fr 1fr;
  }
  .tour-photos[data-count="3"] {
    min-height: 280px;
  }
}

/* Viewer (lightbox) */
.tour-viewer {
  border: 0;
  padding: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  background: #000;
  color: #fff;
}
.tour-viewer::backdrop { background: #000; }

.viewer-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100%;
}

.viewer-top {
  display: grid;
  grid-template-columns: 2.75rem 1fr 1fr;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
}

.viewer-btn,
.viewer-nav {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.viewer-btn:hover,
.viewer-nav:hover { background: rgba(255, 255, 255, 0.16); }

.viewer-progress,
.viewer-room {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}
.viewer-room { text-align: right; color: rgba(255, 255, 255, 0.75); }

.viewer-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 0 3.5rem;
}

.viewer-img {
  max-width: min(1100px, 100%);
  max-height: calc(100vh - 9rem);
  object-fit: contain;
  border-radius: 4px;
}

.viewer-prev { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); }
.viewer-next { position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%); }

.viewer-caption {
  margin: 0;
  padding: 0.85rem 1.25rem 1.25rem;
  text-align: center;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.8);
  min-height: 2.75rem;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tour-photos img { transition: none; }
}
