/* Visor 3D de la casa · estilos adicionales (los base están en inmueble.css, bloque .c3d) */

/* --- accesibilidad: foco visible en todo lo que se pulsa --- */
.c3d :is(button, a, [tabindex]):focus-visible { outline: 3px solid #F2C6E8; outline-offset: 2px; }
.c3d .c3d__stage:focus-visible { outline-offset: -3px; }
@media (prefers-reduced-motion: reduce) {
  .c3d .c3d__sub-bar { animation: none; width: 100%; opacity: .5; }
  .c3d .c3d__fade { transition: none; }
}

/* --- mando táctil del paseo (solo con pantalla táctil, modo «por dentro») --- */
.c3d .c3d__pad { position: absolute; left: 12px; bottom: 54px; display: grid; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(2, 44px); gap: 4px; touch-action: none; -webkit-user-select: none; user-select: none; }
.c3d .c3d__pad button { font: inherit; width: 44px; height: 44px; border-radius: 12px; border: 1px solid rgba(255,255,255,.3); background: rgba(30,21,33,.66); color: #fff; display: grid; place-items: center; font-size: 1.3rem; cursor: pointer; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); touch-action: none; -webkit-tap-highlight-color: transparent; }
.c3d .c3d__pad button[data-key="w"] { grid-column: 2; grid-row: 1; }
.c3d .c3d__pad button[data-key="a"] { grid-column: 1; grid-row: 2; }
.c3d .c3d__pad button[data-key="s"] { grid-column: 2; grid-row: 2; }
.c3d .c3d__pad button[data-key="d"] { grid-column: 3; grid-row: 2; }
.c3d .c3d__pad button.is-on { background: #F2C6E8; color: #4E1254; }
.c3d__stage[data-modo="dentro"]:has(.c3d__pad:not([hidden])) .c3d__hint { bottom: 160px; }

/* --- chinchetas: miniatura de la foto real al pasar el ratón (escritorio) --- */
.c3d .c3d-pin { overflow: visible; }
.c3d .c3d-pin__mini { display: none; position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%); width: 168px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; border: 2px solid rgba(255,255,255,.8); box-shadow: 0 10px 30px rgba(0,0,0,.45); pointer-events: none; }
@media (hover: hover) and (pointer: fine) {
  .c3d .c3d-pin:hover .c3d-pin__mini, .c3d .c3d-pin:focus-visible .c3d-pin__mini { display: block; }
  .c3d .c3d-pin:hover { z-index: 3; }
}

/* --- minimapa clicable --- */
.c3d .c3d__map { cursor: pointer; pointer-events: auto; }
.c3d .c3d__map:hover { border-color: rgba(242,198,232,.8); }

/* --- visita guiada: pausa y cierre --- */
.c3d .c3d__sub.is-pausa .c3d__sub-bar { animation-play-state: paused; }
.c3d .c3d__sub-btns button[data-g="pausa"][aria-pressed="true"] { background: #F2C6E8; color: #4E1254; }
.c3d .c3d__cierre { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(19,10,22,.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); z-index: 3; padding: 20px; }
.c3d .c3d__cierre-in { display: grid; gap: 8px; text-align: center; width: min(92%, 440px); padding: 26px 24px; border-radius: 20px; background: rgba(30,21,33,.92); border: 1px solid rgba(255,255,255,.18); box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.c3d .c3d__cierre-in small { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: #F2C6E8; }
.c3d .c3d__cierre-in strong { font-family: var(--f-display); font-weight: 520; font-size: clamp(1.4rem, 3vw, 1.9rem); line-height: 1.1; }
.c3d .c3d__cierre-in p { margin: 0; font-size: .88rem; line-height: 1.4; color: rgba(255,255,255,.8); }
.c3d .c3d__cierre-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.c3d .c3d__cierre-btns .btn { color: var(--brand-deep); background: #fff; }
.c3d .c3d__cierre-btns .btn:hover { background: #F2C6E8; }
.c3d .c3d__cierre-btns .btn--ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); }
.c3d .c3d__cierre-btns .btn--ghost:hover { background: rgba(255,255,255,.12); }

/* --- carga lenta / sin WebGL: aviso amable, la página sigue --- */
.c3d .c3d__load.is-tarde { background: rgba(19,10,22,.82); }
.c3d .c3d__load.is-tarde span { color: #fff; font-size: .9rem; }
.c3d .c3d__stage.is-sin3d .c3d__load { background: linear-gradient(160deg, #2a1830, #130a16); }
.c3d .c3d__stage.is-sin3d .c3d__load-in i { display: none; }

/* --- pista con enlace copiable --- */
.c3d .c3d__hint code { font-size: .72rem; word-break: break-all; color: #F2C6E8; }
.c3d .c3d__hint:has(code) { pointer-events: auto; user-select: all; }

/* --- botones ocultos de verdad (la regla display:flex de los botones anulaba [hidden]: «Giro» salía en escritorio) --- */
.c3d .c3d__tools button[hidden], .c3d .c3d__modes button[hidden] { display: none; }

/* --- alto del visor: que quepa entero bajo la cabecera fija con su pie (pista, estancias, minimapa) --- */
.c3d .c3d__stage { height: clamp(360px, min(62vw, 100vh - 260px), 700px); height: clamp(360px, min(62vw, 100svh - 260px), 700px); }
.c3d .c3d__stage:fullscreen { height: 100vh; }

/* --- pantalla completa sin API (Safari de iPhone): el visor ocupa la ventana; la barra de herramientas sigue a mano --- */
.c3d.is-pantalla { position: fixed; inset: 0; z-index: 70; border-radius: 0; overflow: auto; padding: 10px; grid-template-rows: auto minmax(0, 1fr) auto; }
.c3d.is-pantalla .c3d__stage { height: auto; min-height: 240px; }
.c3d.is-pantalla .c3d__foot { display: none; }   /* como en la pantalla completa de verdad: solo el visor y sus controles */
/* tableta y móvil: en la visita guiada el subtítulo ocupa el ancho y el minimapa quedaría debajo */
@media (max-width: 900px) { .c3d .c3d__stage[data-modo="visita"] .c3d__map { display: none; } }

/* --- móvil: botones de modo más tocables, mando y minimapa sin solaparse --- */
@media (max-width: 760px) {
  .c3d .c3d__modes button, .c3d .c3d__tools button { min-height: 40px; }
  .c3d .c3d__tools button span { display: none; }
  .c3d .c3d__tools button { padding: .45em .8em; min-width: 40px; justify-content: center; }
  .c3d .c3d__map { width: 92px; height: 148px; }
  /* objetivos de 40 px; sin flex-shrink las estancias se aplastan («Dormi», «Entrad») */
  .c3d .c3d__floors button, .c3d .c3d__rooms button { min-height: 40px; min-width: 40px; flex-shrink: 0; }
  .c3d .c3d__map, .c3d .c3d__pad { bottom: 62px; }
  .c3d .c3d__stage .c3d__hint { bottom: 62px; }
  /* visor más alto en vertical y visita guiada que no tape media casa */
  .c3d .c3d__stage { height: min(68vh, 560px); height: min(68svh, 560px); }
  .c3d .c3d__stage[data-modo="visita"] .c3d__map { display: none; }
  .c3d .c3d__sub { bottom: 8px; width: calc(100% - 16px); padding: 10px 12px; gap: 8px; }
  .c3d .c3d__sub-txt strong { font-size: 1rem; }
  .c3d .c3d__sub-btns button { width: 44px; height: 44px; }
  /* paseo con mando táctil: la pista sube arriba (ahí no hay selector de plantas) y no pisa el minimapa */
  .c3d .c3d__stage[data-modo="dentro"]:has(.c3d__pad:not([hidden])) .c3d__hint { top: 12px; bottom: auto; max-width: calc(100% - 24px); }
}
/* 8 herramientas × 40 px no caben en una fila a 360-390 px: rejilla de 4 × 2 */
@media (max-width: 420px) {
  .c3d .c3d__tools { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; }
}
/* pantallas táctiles (también tabletas de 768 px): objetivos de 44 px */
@media (pointer: coarse) {
  .c3d .c3d__modes button, .c3d .c3d__tools button { min-height: 44px; min-width: 44px; justify-content: center; }
  .c3d .c3d__floors button, .c3d .c3d__rooms button { min-height: 40px; flex-shrink: 0; }
  .c3d .c3d-pin { padding: .55em .85em .55em .6em; min-height: 40px; }
  .c3d .c3d__sub-btns button { width: 44px; height: 44px; }
}
