/* Showroom virtual ahb — portada, planta interactiva y recorrido 360.
   Componentes y paleta tomados del sitio de ahb Arquitectos & Asociados:
   botones rectangulares con borde de 1px, versalitas 700 con letter-spacing,
   Poppins 300 para titulares, Manrope para interfaz, foco dorado. */

:root {
  --ink: #191b18;
  --paper: #f3f2ed;
  --white: #fffefa;
  --line: #cbc9bf;
  --muted: #666d66;
  --moss: #506655;
  --moss-dark: #3e5243;
  --sand: #b69a73;
  --night: #0e100e;
  --edge: rgba(255, 254, 250, .34);
  --edge-soft: rgba(255, 254, 250, .15);
  --hover: rgba(255, 254, 250, .13);
  --display: Poppins, Manrope, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--night);
  color: var(--white);
  font: 400 16px/1.6 Manrope, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 300; text-wrap: balance; }
:focus-visible { outline: 2px solid #c58f48; outline-offset: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.label {
  margin: 0;
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--sand);
}
.icon-arrow {
  width: 12px; height: 12px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.4;
  stroke-linecap: round; stroke-linejoin: round;
}

/* Botón principal, igual que el del sitio */
.button {
  display: inline-flex;
  min-height: 44px;
  padding: 10px 22px;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  border: 1px solid var(--moss);
  background: var(--moss);
  color: var(--white);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  transition: background-color .2s ease, color .2s ease, transform .2s ease;
}
.button:hover { transform: translateY(-2px); background: var(--moss-dark); }
.button--light { border-color: var(--white); background: var(--white); color: var(--ink); }
.button--ghost { border-color: var(--edge); background: transparent; color: var(--white); }
.button--ghost:hover { background: var(--hover); border-color: var(--white); }
.button--light:hover { background: var(--sand); border-color: var(--sand); color: var(--ink); }

/* Botón secundario sobre imagen, mismo lenguaje que la barra del visor del sitio */
.chip {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--edge);
  background: transparent;
  color: var(--white);
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.chip:hover { background: var(--hover); }
.chip--solid { border-color: var(--sand); background: var(--sand); color: var(--ink); }
.chip--solid:hover { background: #c7ac86; border-color: #c7ac86; }
.chip--dark { border-color: var(--ink); color: var(--ink); }
.chip--dark:hover { background: var(--ink); color: var(--white); }

/* ================= PORTADA ================= */
.cover { position: fixed; inset: 0; overflow: hidden; }
.cover__media { position: absolute; inset: 0; }
.cover__media video { width: 100%; height: 100%; object-fit: cover; }
.cover__media::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(14,16,14,.42) 0%, rgba(14,16,14,.22) 45%, rgba(14,16,14,.62) 100%);
}
.cover__inner {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: clamp(1.4rem, 4vw, 3rem);
  text-align: center;
}
.cover__title {
  font-size: clamp(3.2rem, 11vw, 8rem);
  line-height: .95;
  letter-spacing: -.02em;
}
.cover__place {
  margin: clamp(1rem, 2.4vh, 1.5rem) 0 clamp(2rem, 5vh, 3rem);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  opacity: .78;
}
.cover__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

.cover__lang {
  position: absolute;
  right: clamp(1.4rem, 4vw, 3rem);
  bottom: clamp(1.4rem, 4vw, 3rem);
  display: flex;
  gap: 7px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  opacity: .75;
}
.cover__lang a[aria-current] { color: var(--sand); }

/* ================= PLANTA ================= */
.plan {
  position: fixed; inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}
.plan__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(1rem, 3vw, 2.2rem);
  border-bottom: 1px solid var(--edge-soft);
}
.plan__head h2 { font-size: 1.2rem; }

.plan__body { display: grid; grid-template-columns: minmax(0, 1fr) min(360px, 32vw); min-width: 0; min-height: 0; }
.plan__stage { display: grid; place-items: center; padding: clamp(1rem, 2.5vw, 2rem); min-width: 0; min-height: 0; }
.plan__canvas { position: relative; width: 100%; max-width: min(1100px, calc((100% - 0px)));
  max-height: 100%; aspect-ratio: 1672 / 941; }
.plan__image { width: 100%; height: 100%; object-fit: contain; }
.plan__zones { position: absolute; inset: 0; width: 100%; height: 100%; }
.plan__zones polygon {
  fill: rgba(182, 154, 115, 0);
  stroke: rgba(182, 154, 115, 0);
  stroke-width: 3;
  cursor: pointer;
  pointer-events: auto;
  transition: fill .2s ease, stroke .2s ease;
}
.plan__zones polygon:hover,
.plan__zones polygon.is-active { fill: rgba(182, 154, 115, .28); stroke: rgba(182, 154, 115, .95); }

.plan__pins { position: absolute; inset: 0; pointer-events: none; }
.plan__pin {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  pointer-events: auto;
}
.plan__pin--left { flex-direction: row-reverse; }
.plan__pin i {
  display: grid; place-items: center;
  width: 24px; height: 24px; flex: none;
  border: 1px solid rgba(255,254,250,.9);
  border-radius: 50%;
  background: rgba(14,16,14,.5);
  font-style: normal;
  transition: background-color .2s ease, border-color .2s ease;
}
.plan__pin i::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--white); }
.plan__pin span {
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 1px 10px rgba(0,0,0,.9);
}
.plan__pin:hover i,
.plan__pin.is-active i { background: var(--sand); border-color: var(--sand); }
.plan__pin.is-active span { color: var(--sand); }

.plan__detail {
  border-left: 1px solid var(--edge-soft);
  padding: clamp(1.1rem, 2vw, 1.7rem);
  min-width: 0;
  overflow-y: auto;
}
.plan__detail-empty { margin: 0; font-size: .82rem; line-height: 1.6; opacity: .5; }
.plan__detail-card img { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; margin-bottom: 16px; }
.plan__detail-card h3 { margin: 5px 0 10px; font-size: 1.5rem; }
.plan__detail-summary { margin: 0 0 16px; font-size: .86rem; line-height: 1.65; opacity: .8; }
.plan__detail-features { margin: 0 0 22px; padding: 0; list-style: none; display: grid; gap: 7px; }
.plan__detail-features li { display: flex; gap: 9px; font-size: .76rem; opacity: .76; }
.plan__detail-features li::before { content: ""; margin-top: .58em; width: 12px; height: 1px; flex: none; background: var(--sand); }
.plan__detail-card .button { width: 100%; }

.plan__exteriors { padding: 12px clamp(1rem, 3vw, 2.2rem) 16px; border-top: 1px solid var(--edge-soft); }
.plan__exteriors .label { margin-bottom: 9px; color: var(--white); opacity: .5; }
.plan__exteriors ul { display: flex; gap: 10px; margin: 0; padding: 0 0 4px; list-style: none; overflow-x: auto; overscroll-behavior-x: contain; }
.ext-thumb {
  flex: 0 0 auto; width: 146px; padding: 0;
  border: 1px solid transparent; background: none; text-align: left;
  transition: border-color .2s ease, transform .2s ease;
}
.ext-thumb img { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; }
.ext-thumb span { display: block; padding: 6px 2px 0; font-size: .68rem; font-weight: 600; }
.ext-thumb:hover { transform: translateY(-2px); border-color: var(--sand); }

/* ================= RECORRIDO 360 ================= */
.tour { position: fixed; inset: 0; overflow: hidden; }
.tour__stage { position: absolute; inset: 0; touch-action: none; cursor: grab; }
.tour__stage.is-dragging { cursor: grabbing; }
.tour__stage canvas { display: block; }
.tour__fader {
  position: absolute; inset: 0; z-index: 3;
  background: var(--night);
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease;
}
.tour__fader.is-active { opacity: 1; }

.tour__loader { position: absolute; top: 0; left: 0; right: 0; height: 2px; z-index: 8; opacity: 0; transition: opacity .24s ease; }
.tour__loader.is-active { opacity: 1; }
.tour__loader span { display: block; height: 100%; width: 0; background: var(--sand); transition: width .22s ease; }

/* La interfaz se atenúa sola cuando el visitante deja de interactuar,
   para que la panorámica quede limpia mientras gira o se arrastra. */
.tour__chrome { position: absolute; inset: 0; z-index: 6; pointer-events: none; transition: opacity .45s ease; }
.tour__chrome > * { pointer-events: auto; }
.tour.is-idle .tour__chrome { opacity: .12; }
.tour.is-idle .tour__stage { cursor: default; }

.tour__top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px clamp(1rem, 3vw, 2rem);
  background: linear-gradient(180deg, rgba(14,16,14,.6), transparent);
}
.tour__brand {
  margin: 0;
  font-family: var(--display);
  font-weight: 300;
  font-size: 1.1rem;
  letter-spacing: .01em;
}

.tour__bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
  padding: 18px clamp(1rem, 3vw, 2rem);
  background: linear-gradient(0deg, rgba(14,16,14,.62), transparent);
}
.tour__cluster { display: flex; align-items: center; }
.icon-btn {
  display: grid; place-items: center;
  min-width: 44px; height: 42px;
  padding-inline: 12px;
  border: 1px solid var(--edge);
  background: transparent;
  color: var(--white);
  transition: background-color .2s ease, color .2s ease;
}
.icon-btn + .icon-btn { border-left: 0; }
.icon-btn:hover { background: var(--hover); }
.icon-btn.is-active { color: var(--sand); }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .icon-play { fill: currentColor; stroke: none; }
.icon-btn--label {
  gap: 8px;
  grid-auto-flow: column;
  font-size: .65rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}

.daynight { display: flex; }
.daynight button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--edge);
  background: transparent;
  color: var(--white);
  font-size: .62rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  opacity: .7;
  transition: background-color .2s ease, color .2s ease, opacity .2s ease;
}
.daynight button + button { border-left: 0; }
.daynight button:hover { background: var(--hover); opacity: 1; }
.daynight button.is-active { background: var(--sand); border-color: var(--sand); color: var(--ink); opacity: 1; }

/* Hotspots */
.tour__hotspots { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.hotspot {
  position: absolute; top: 0; left: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 0; border: 0; background: none;
  pointer-events: auto;
  visibility: hidden;
}
.hotspot__ring {
  position: relative;
  display: grid; place-items: center;
  width: 40px; height: 40px; flex: none;
  border: 1px solid rgba(255,254,250,.75);
  border-radius: 50%;
  background: rgba(14,16,14,.46);
  transition: transform .22s cubic-bezier(.23,1,.32,1), background-color .22s ease, border-color .22s ease;
}
.hotspot__ring::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--white); }
.hotspot::before {
  content: "";
  position: absolute; top: 0; left: 0;
  width: 40px; height: 40px;
  border: 1px solid rgba(255,254,250,.45);
  border-radius: 50%;
  animation: pulse 2.8s ease-out infinite;
}
.hotspot__label {
  max-width: 0; overflow: hidden; white-space: nowrap;
  font-size: .62rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  opacity: 0;
  text-shadow: 0 1px 8px rgba(0,0,0,.8);
  transition: max-width .26s cubic-bezier(.23,1,.32,1), opacity .2s ease;
}
.hotspot:hover .hotspot__ring,
.hotspot:focus-visible .hotspot__ring { transform: scale(1.1); background: var(--sand); border-color: var(--sand); }
.hotspot:hover .hotspot__label,
.hotspot:focus-visible .hotspot__label { max-width: 220px; opacity: 1; }
@keyframes pulse {
  0% { transform: scale(1); opacity: .75; }
  70%, 100% { transform: scale(1.8); opacity: 0; }
}

/* Menú de escenas */
.scene-menu {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 7;
  width: min(340px, 88vw);
  padding: 70px 20px 26px;
  background: var(--paper);
  color: var(--ink);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: -18px 0 48px rgba(14,16,14,.36);
  transform: translateX(101%);
  transition: transform .34s cubic-bezier(.23,1,.32,1);
}
.scene-menu.is-open { transform: none; }
.scene-menu .chip--dark { margin-bottom: 20px; }
.menu-close {
  position: absolute; top: 14px; right: 16px;
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  background: none; color: var(--ink);
  font-size: 1.4rem; line-height: 1;
}
.menu-close:hover { background: var(--ink); color: var(--white); border-color: var(--ink); }
.menu-group + .menu-group { margin-top: 20px; }
.menu-group h3 {
  margin: 0 0 10px;
  font-family: Manrope, sans-serif;
  font-size: .6rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted);
}
.menu-group ul { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 0; padding: 0; list-style: none; }
.menu-thumb {
  display: block; width: 100%; padding: 0;
  border: 1px solid transparent;
  background: none; text-align: left;
  transition: border-color .2s ease, transform .2s ease;
}
.menu-thumb img { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; }
.menu-thumb span { display: block; padding: 6px 2px 8px; font-size: .72rem; font-weight: 600; }
.menu-thumb:hover { transform: translateY(-2px); }
.menu-thumb.is-current { border-color: var(--moss); }
.menu-thumb.is-current span { color: var(--moss); }

/* ================= Responsive ================= */
@media (max-width: 1000px) {
  .plan__body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .plan__detail { border-left: 0; border-top: 1px solid var(--edge-soft); max-height: 44vh; }
  .plan__detail-card img { display: none; }
  .plan__pin span { display: none; }
  .plan__detail-summary, .plan__detail-features li { overflow-wrap: anywhere; }
}

@media (max-width: 860px) {
  .plan__head { flex-wrap: wrap; gap: 10px; }
  .plan__head h2 { order: -1; width: 100%; }
  .tour__bar { justify-content: center; }
  .hotspot__label { display: none; }
  .cover__title { font-size: clamp(2.8rem, 15vw, 4.5rem); }
}

@media (prefers-reduced-motion: reduce) {
  .hotspot::before { animation: none; }
  .tour__fader, .scene-menu, .icon-btn, .menu-thumb, .button, .chip, .tour__chrome { transition: none; }
}

/* ================= Móvil: horizontal obligatorio ================= */
/* En Android se bloquea la orientación de verdad; en iOS no existe esa API,
   así que este aviso cubre la pantalla mientras el teléfono siga vertical. */
.rotate-gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 28px;
  background: var(--night);
  text-align: center;
}
.rotate-gate__phone { margin-bottom: 8px; }
.rotate-gate__phone svg {
  width: 54px;
  height: 90px;
  fill: none;
  stroke: var(--sand);
  stroke-width: 2;
  stroke-linecap: round;
  transform-origin: 50% 50%;
  animation: rotate-phone 2.8s cubic-bezier(.6, 0, .2, 1) infinite;
}
.rotate-gate__title {
  margin: 0;
  font-family: var(--display);
  font-weight: 300;
  font-size: 1.5rem;
}
.rotate-gate__text {
  margin: 0;
  max-width: 26ch;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  opacity: .6;
}
@keyframes rotate-phone {
  0%, 18%   { transform: rotate(0deg); }
  46%, 78%  { transform: rotate(-90deg); }
  96%, 100% { transform: rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) {
  .rotate-gate__phone svg { animation: none; transform: rotate(-90deg); }
}

/* Teléfono en horizontal: hay poco alto, la planta pasa a dos columnas
   y se recortan las franjas que roban altura. */
@media (orientation: landscape) and (max-height: 560px) {
  .plan { grid-template-rows: auto 1fr; }
  .plan__head { padding: 7px clamp(.7rem, 2vw, 1.2rem); gap: 10px; }
  .plan__head h2 { order: 0; width: auto; font-size: .92rem; }
  .plan__body { grid-template-columns: minmax(0, 1fr) min(290px, 38vw); grid-template-rows: minmax(0, 1fr); }
  .plan__stage { padding: 8px; }
  .plan__detail {
    border-left: 1px solid var(--edge-soft);
    border-top: 0;
    max-height: none;
    padding: 12px 14px;
  }
  .plan__detail-card img { display: none; }
  .plan__detail-card h3 { font-size: 1.15rem; margin: 4px 0 7px; }
  .plan__detail-summary { font-size: .76rem; margin-bottom: 12px; }
  .plan__detail-features { gap: 5px; margin-bottom: 14px; }
  .plan__detail-features li { font-size: .7rem; }
  .plan__detail-card .button { min-height: 38px; padding: 8px 14px; }
  .plan__exteriors { display: none; }   /* los exteriores quedan en el menú del recorrido */
  .plan__pin span { display: none; }

  .tour__top { padding: 9px clamp(.7rem, 2vw, 1.2rem); }
  .tour__bar { padding: 9px clamp(.7rem, 2vw, 1.2rem); justify-content: flex-end; }
  .tour__brand { font-size: .92rem; }
  .icon-btn { min-width: 40px; height: 38px; padding-inline: 10px; }
  .daynight button { min-height: 38px; padding: 0 12px; }
  .scene-menu { width: min(300px, 52vw); padding: 56px 14px 18px; }
  .menu-group ul { gap: 7px; }
  .cover__title { font-size: clamp(2.4rem, 9vh, 4rem); }
  .cover__place { margin: .6rem 0 1.1rem; }
}
