:root {
  --bg: #f7f4ee;
  --bg-alt: #efe9dc;
  --text: #23291f;
  --text-soft: #5b6157;
  --primary: #1f3b30;
  --primary-light: #2f4a3d;
  --accent: #c9a227;
  --accent-soft: #e4cf8a;
  --white: #ffffff;
  --black: #0d0d0f;
  --shadow: 0 10px 30px rgba(15, 25, 20, 0.15);
  --radius: 14px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Poppins", "Segoe UI", sans-serif;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* -webkit-tap-highlight-color quita el destello gris al tocar en moviles */
a, button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

h1, h2, h3, .brand-font {
  font-family: "Playfair Display", "Georgia", serif;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* =========================================================
   SPLASH / PRESENTACION
   ========================================================= */
#splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
  transition: opacity 0.6s ease, background-color 0.6s ease;
}

#splash.fading-out {
  opacity: 0;
  pointer-events: none;
}

#splash.bg-white {
  background: #ffffff;
}

.splash-logo-wrap {
  position: relative;
  width: min(46vw, 60vh, 420px);
  height: min(46vw, 60vh, 420px);
}

.splash-logo-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.splash-logo-wrap img#splash-black {
  opacity: 1;
}

.splash-logo-wrap img#splash-white.show {
  opacity: 1;
}

.splash-logo-wrap img#splash-black.hide {
  opacity: 0;
}

body.no-scroll {
  overflow: hidden;
  height: 100%;
}

/* =========================================================
   LAYOUT GENERAL DE PAGINA (contenedor de divisiones)
   ========================================================= */
.page {
  /* calc(var(--vh,1vh)*100) evita el salto por la barra de direcciones en moviles */
  min-height: calc(var(--vh, 1vh) * 100);
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* --- DIV: Titulo --- */
.section-title {
  height: calc(var(--vh, 1vh) * 10);
  min-height: 60px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
  padding: 8px 16px;
  padding-top: calc(8px + env(safe-area-inset-top));
}

.section-title h1 {
  color: var(--white);
  font-size: clamp(1rem, 4vw, 2rem);
  letter-spacing: 0.3px;
  font-weight: 700;
  line-height: 1.25;
}

/* --- DIV: Carrusel (Home) --- */
.section-carousel {
  height: calc(var(--vh, 1vh) * 35);
  min-height: 220px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
  padding: 14px 0;
}

.carousel-wrap {
  width: 79%;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}

.carousel-viewport {
  flex: 1;
  height: 100%;
  overflow: hidden;
  position: relative;
  border-radius: var(--radius);
  /* permite scroll vertical de la pagina mientras el JS controla el swipe horizontal */
  touch-action: pan-y;
}

.carousel-track {
  display: flex;
  height: 100%;
  will-change: transform;
}

.carousel-slide {
  /* el ancho real (33.33% o 100%) se fija por JS via inline style segun cuantas imagenes se ven */
  flex: 0 0 33.3333%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
}

.carousel-slide img {
  width: 100%;
  height: 92%;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0.45;
  transform: scale(0.82);
  transition: opacity 0.5s ease, transform 0.5s ease;
  display: block;
}

.carousel-slide.is-center img {
  opacity: 1;
  transform: scale(1.08);
  box-shadow: 0 16px 40px rgba(15, 25, 20, 0.3);
  cursor: pointer;
}

.carousel-track.no-transition {
  transition: none !important;
}

.carousel-track {
  transition: transform 0.6s cubic-bezier(0.65, 0.05, 0.36, 1);
}

.car-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: var(--white);
  color: var(--primary);
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.car-btn:hover {
  background: var(--primary);
  color: var(--white);
  transform: scale(1.08);
}

.carousel-empty {
  color: var(--text-soft);
  text-align: center;
  padding: 0 20px;
  font-size: 0.95rem;
}

/* =========================================================
   LIGHTBOX (visor de foto a pantalla completa)
   ========================================================= */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 950;
  background: rgba(10, 12, 10, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 86vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transition: opacity 0.2s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-img.fading {
  opacity: 0;
}

.lightbox-close {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  font-size: 1.8rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.06);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%) scale(1.06);
}

.lightbox-prev { left: max(14px, env(safe-area-inset-left)); }
.lightbox-next { right: max(14px, env(safe-area-inset-right)); }

.lightbox-counter {
  position: absolute;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 14px;
  border-radius: 20px;
}

/* --- DIV: Descripcion (Home) --- */
.section-description {
  height: calc(var(--vh, 1vh) * 35);
  min-height: 180px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 16px 0;
}

.description-col {
  width: 79%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.description-heading {
  color: var(--primary);
  font-size: clamp(1rem, 2.6vw, 1.4rem);
  font-weight: 700;
  letter-spacing: 0.2px;
  flex: 0 0 auto;
}

.description-box {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 26px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(31, 59, 48, 0.08);
}

.description-box::-webkit-scrollbar { width: 8px; }
.description-box::-webkit-scrollbar-track { background: var(--bg-alt); border-radius: 8px; }
.description-box::-webkit-scrollbar-thumb { background: var(--accent-soft); border-radius: 8px; }
.description-box::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.description-box p {
  margin-bottom: 14px;
  line-height: 1.7;
  color: var(--text);
  font-size: 1rem;
}

/* --- DIV: Navegacion entre paginas --- */
.section-nav {
  height: calc(var(--vh, 1vh) * 10);
  min-height: 64px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg-alt);
  flex-wrap: wrap;
  padding: 8px 16px;
}

.nav-btn {
  padding: 12px 26px;
  border-radius: 30px;
  background: var(--primary);
  color: var(--white);
  font-weight: 600;
  letter-spacing: 0.3px;
  font-size: clamp(0.85rem, 2.4vw, 1rem);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, background 0.2s ease;
  border: 2px solid var(--primary);
  text-align: center;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-btn:hover {
  transform: translateY(-2px);
  background: var(--primary-light);
}

.nav-btn:active {
  transform: translateY(0);
}

.nav-btn.outline {
  background: transparent;
  color: var(--primary);
}

.nav-btn.outline:hover {
  background: var(--primary);
  color: var(--white);
}

/* --- DIV: WhatsApp --- */
.section-whatsapp {
  height: calc(var(--vh, 1vh) * 10);
  min-height: 64px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #128c3e;
  padding: 8px 16px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
}

.whatsapp-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
  font-weight: 600;
  font-size: clamp(0.85rem, 3.6vw, 1.2rem);
  padding: 10px 20px;
  border-radius: 30px;
  transition: background 0.2s ease, transform 0.2s ease;
  text-align: center;
  min-height: 44px;
}

.whatsapp-link:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.03);
}

.whatsapp-link:active {
  background: rgba(255, 255, 255, 0.15);
}

.whatsapp-link svg { width: 24px; height: 24px; flex: 0 0 auto; }

/* --- DIV: Maps --- */
.section-map {
  height: calc(var(--vh, 1vh) * 75);
  min-height: 320px;
  width: 100%;
  padding: 16px 4%;
  background: var(--bg-alt);
}

.map-frame-wrap {
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.map-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* --- DIV: Recorrido Virtual --- */
.section-tour {
  height: calc(var(--vh, 1vh) * 75);
  min-height: 320px;
  width: 100%;
  padding: 16px 4%;
  background: #17171b;
}

.tour-frame-wrap {
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
}

#panorama {
  width: 100%;
  height: 100%;
}

#tour-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #eaeaea;
  background: #17171b;
  z-index: 10;
  transition: opacity 0.4s ease;
}

#tour-loader.hidden { opacity: 0; pointer-events: none; }

.tour-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   RESPONSIVE - TABLET (<=900px)
   ========================================================= */
@media (max-width: 900px) {
  .carousel-wrap { width: 90%; }
  .description-col { width: 90%; }
  .section-map, .section-tour { padding: 12px 3%; }
}

/* =========================================================
   RESPONSIVE - MOVIL (<=700px)
   ========================================================= */
@media (max-width: 700px) {
  .carousel-wrap { width: 94%; gap: 6px; }
  .description-col { width: 94%; }
  .description-box { padding: 18px; }
  .car-btn { width: 38px; height: 38px; font-size: 1.1rem; }
  .nav-btn { padding: 10px 16px; }
  .section-map, .section-tour { padding: 10px 2.5%; }

  /* Botones de navegacion apilados (uno arriba, otro abajo) en celular,
     para que nunca queden encimados ni cortados por el ancho de pantalla. */
  .section-nav {
    flex-direction: column;
    gap: 10px;
    padding: 10px 16px;
    height: auto;
    min-height: 64px;
  }
  .nav-btn {
    width: 100%;
    max-width: 340px;
  }
}

/* =========================================================
   RESPONSIVE - MOVIL PEQUENO (<=480px)
   Un solo boton de navegacion por fila para maximizar el
   area de toque y evitar texto apretado.
   ========================================================= */
@media (max-width: 480px) {
  .section-title { padding: 6px 12px; }
  .section-title h1 { font-size: clamp(0.95rem, 5vw, 1.3rem); }

  .carousel-wrap { width: 96%; gap: 4px; }
  .car-btn { width: 34px; height: 34px; font-size: 1rem; }
  .carousel-slide { padding: 0 4px; }

  .description-col { width: 96%; }
  .description-heading { font-size: 0.95rem; }
  .description-box { padding: 16px; }
  .description-box p { font-size: 0.92rem; }

  .lightbox-img { max-width: 96vw; max-height: 78vh; }
  .lightbox-close { width: 40px; height: 40px; font-size: 1.5rem; top: 10px; right: 10px; }
  .lightbox-nav { width: 42px; height: 42px; font-size: 1.2rem; }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
  .lightbox-counter { font-size: 0.8rem; padding: 3px 12px; }

  .section-nav {
    flex-direction: column;
    gap: 10px;
    padding: 10px 16px;
  }
  .nav-btn {
    width: 100%;
    max-width: 340px;
  }

  .whatsapp-link { padding: 10px 14px; gap: 8px; }
  .whatsapp-link svg { width: 22px; height: 22px; }

  .section-map, .section-tour { padding: 8px 2%; }
}

/* Pantallas muy angostas (<=360px) */
@media (max-width: 360px) {
  .section-title h1 { font-size: 0.9rem; }
  .whatsapp-link span { font-size: 0.78rem; }
}

/* Modo landscape en telefonos: bajar minimos de alto para que no se corten las secciones */
@media (max-height: 480px) and (orientation: landscape) {
  .section-title, .section-nav, .section-whatsapp { min-height: 48px; }
  .section-carousel { min-height: 160px; }
  .section-description { min-height: 140px; }
  .section-map, .section-tour { min-height: 220px; }
}
