/* Showroom virtual · demo de Brim (proyecto ficticio Brisa Alta).
   Sin estilos en línea en el HTML: la CSP del sitio no los permite. */
@font-face { font-family: "Archivo"; src: url("/fuentes/archivo-latin.woff2") format("woff2"); font-weight: 700 800; font-stretch: 112% 125%; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("/fuentes/figtree-latin.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }

:root {
  --tinta: #0E1214;
  --papel: #F4F2ED;
  --amanecer: #FFB020;
  --profundo: #E07B00;
  --disponible: #2fbf71;
  --reservada: #f0a020;
  --vendida: #e0483c;
  --display: "Archivo", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --texto: "Figtree", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  --hueco: 16px;
  /* Colores de la interfaz: cambian juntos cuando la maqueta pasa a noche. */
  --ui: rgba(250, 249, 246, 0.84);
  --ui-solido: #FAF9F6;
  --ui-texto: #0E1214;
  --ui-sec: #59625F;
  --ui-linea: rgba(14, 18, 20, 0.12);
  --ui-suave: rgba(14, 18, 20, 0.05);
  --accion: #0E1214;
  --accion-texto: #F4F2ED;
  --sombra: 0 8px 28px rgba(14, 18, 20, 0.14);
}
body.es-noche {
  --ui: rgba(16, 21, 26, 0.78);
  --ui-solido: #141A1F;
  --ui-texto: #F4F2ED;
  --ui-sec: #A3ACA9;
  --ui-linea: rgba(244, 242, 237, 0.14);
  --ui-suave: rgba(244, 242, 237, 0.07);
  --accion: #FFB020;
  --accion-texto: #0E1214;
  --sombra: 0 8px 28px rgba(0, 0, 0, 0.45);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  overflow: hidden;
  overscroll-behavior: none;
  background: #dfe9ee;
  color: var(--ui-texto);
  font: 400 1rem/1.45 var(--texto);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--amanecer); outline-offset: 2px; }
svg[viewBox="0 0 24 24"] { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Cielo, maqueta y etiquetas: capas a pantalla completa. */
.cielo, #lienzo, .etiquetas { position: fixed; inset: 0; width: 100%; height: 100%; }
#cielo-dia { background: linear-gradient(#9fc2da, #d9e6ec 45%, #e6edee); }
#cielo-noche { background: linear-gradient(#040a14, #0c1828 45%, #14233a); opacity: 0; }
#lienzo { display: block; touch-action: none; cursor: grab; }
#lienzo:active { cursor: grabbing; }
.etiquetas { pointer-events: none; overflow: hidden; }

[data-estado="disponible"] { --c: var(--disponible); }
[data-estado="reservada"] { --c: var(--reservada); }
[data-estado="vendida"] { --c: var(--vendida); }

.chip {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.4rem 0.7rem 0.4rem 0.55rem;
  border: 0;
  border-radius: 999px;
  background: var(--ui-solido);
  color: var(--ui-texto);
  font: 600 0.8rem/1 var(--texto);
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(14, 18, 20, 0.22);
  pointer-events: auto;
  will-change: transform;
  transition: opacity 0.25s, background-color 0.25s, color 0.25s;
}
.chip::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  bottom: -4px;
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  background: inherit;
  transform: rotate(45deg);
}
.chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, #999); }
.chip.activo { background: var(--accion); color: var(--accion-texto); }
.chip.apagado { opacity: 0.3; }
.sin-colores .chip i, .sin-colores .leyenda { display: none; }

/* Barras de arriba y abajo. Dejan pasar el arrastre a la maqueta salvo en sus botones. */
.arriba, .abajo {
  position: fixed;
  left: 0;
  right: 0;
  padding: var(--hueco);
  padding-left: max(var(--hueco), env(safe-area-inset-left));
  padding-right: max(var(--hueco), env(safe-area-inset-right));
  pointer-events: none;
}
.arriba > *, .abajo > * { pointer-events: auto; }
.arriba { top: 0; z-index: 6; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-top: max(var(--hueco), env(safe-area-inset-top)); }
.abajo { bottom: 0; z-index: 4; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 12px; padding-bottom: max(var(--hueco), env(safe-area-inset-bottom)); }
.vidrio {
  background: var(--ui);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: var(--sombra);
  transition: background-color 0.6s, color 0.6s;
}

.marca { flex: none; padding: 0.9rem 1.15rem 0.8rem; border-radius: 16px; }
.marca-nombre { margin: 0; font: 800 1.45rem/1 var(--display); font-stretch: 125%; letter-spacing: 0.01em; text-transform: uppercase; }
.marca-bajada { margin: 0.4rem 0 0; color: var(--ui-sec); font-size: 0.875rem; }
.marca-brim { display: inline-block; margin-top: 0.6rem; color: var(--ui-sec); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em; text-decoration: none; text-transform: uppercase; }
.marca-brim b { color: var(--ui-texto); font-family: var(--display); font-stretch: 125%; font-weight: 800; letter-spacing: 0.04em; }
.marca-brim:hover b { color: var(--profundo); }

.caja-herramientas { position: relative; }
.herramientas { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.boton-ui {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 2.75rem;
  padding: 0 1rem;
  border: 0;
  border-radius: 999px;
  color: var(--ui-texto);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}
.boton-ui svg { width: 1.15rem; height: 1.15rem; flex: none; }
.boton-ui.solo-icono { width: 2.75rem; padding: 0; justify-content: center; }
.boton-ui[aria-pressed="true"] { background: var(--accion); color: var(--accion-texto); }
.menu { position: absolute; top: calc(100% + 8px); right: 0; display: grid; min-width: 13rem; padding: 6px; border-radius: 16px; }
.menu button { padding: 0.8rem 0.9rem; border: 0; border-radius: 10px; background: none; font-weight: 600; text-align: left; }
.menu button:hover { background: var(--ui-suave); }

.leyenda { grid-area: 2 / 1; justify-self: start; display: flex; gap: 14px; margin: 0; padding: 0.65rem 1rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; list-style: none; }
.leyenda li { display: inline-flex; align-items: center; gap: 7px; }
.leyenda i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.vistas { grid-area: 2 / 2; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 999px; }
.vistas button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 2.75rem; height: 2.75rem; padding: 0; border: 0; border-radius: 999px; background: none; font-size: 0.875rem; font-weight: 600; }
.vistas button:hover { background: var(--ui-suave); }
.vistas button.con-texto { padding: 0 1rem 0 0.8rem; margin-left: 4px; background: var(--accion); color: var(--accion-texto); }
.vistas svg { width: 1.2rem; height: 1.2rem; }
.vistas-nombre { padding: 0 4px; color: var(--ui-sec); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.ayuda { grid-area: 1 / 1 / 2 / -1; justify-self: center; margin: 0; padding: 0.65rem 1rem; border-radius: 999px; color: var(--ui-sec); font-size: 0.8rem; transition: opacity 0.6s; }
.usado .ayuda { opacity: 0; pointer-events: none; }
.si-tactil { display: none; }
@media (pointer: coarse) { .si-tactil { display: inline; } .si-mouse { display: none; } }

/* Panel de información: a la derecha en horizontal, desde abajo en vertical. */
.panel {
  position: fixed;
  z-index: 5;
  top: 5.5rem;
  right: max(var(--hueco), env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  width: min(25rem, calc(100vw - 2 * var(--hueco)));
  max-height: calc(100vh - 11rem);
  max-height: calc(100dvh - 11rem);
  border-radius: 20px;
  background: var(--ui-solido);
  color: var(--ui-texto);
  box-shadow: 0 18px 50px rgba(14, 18, 20, 0.28);
  container-type: inline-size;
  outline: none;
  animation: entrar 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: background-color 0.6s, color 0.6s;
}
@keyframes entrar { from { opacity: 0; transform: translateX(16px); } }
@keyframes subir { from { opacity: 0; transform: translateY(32px); } }
.panel-cuerpo { overflow-y: auto; overscroll-behavior: contain; padding: 1.6rem 1.5rem 1.5rem; -webkit-user-select: text; user-select: text; }
.cerrar { position: absolute; z-index: 1; top: 12px; right: 12px; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border: 0; border-radius: 50%; background: var(--ui-solido); box-shadow: inset 0 0 0 1px var(--ui-linea), 0 2px 8px rgba(14, 18, 20, 0.12); }
.cerrar svg { width: 1.1rem; height: 1.1rem; }

.panel h2 { margin: 0; font: 800 1.6rem/1.05 var(--display); font-stretch: 125%; }
.panel-contacto h2 { padding-right: 2.5rem; font-size: 1.35rem; line-height: 1.15; }
.panel h3 { margin: 1.4rem 0 0.5rem; color: var(--ui-sec); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.panel p { margin: 0.6rem 0 0; }
.panel .sello { margin: 0 0 0.5rem; padding-right: 2.5rem; color: var(--ui-sec); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.titulo-fila { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-right: 2.5rem; }
.insignia { padding: 0.3rem 0.7rem; border-radius: 999px; background: var(--c); color: var(--tinta); font-size: 0.75rem; font-weight: 600; }
.panel .precio { margin-top: 0.4rem; font: 700 1.3rem/1.2 var(--display); font-stretch: 112%; }
.panel .entrega { margin-top: 0.2rem; color: var(--ui-sec); font-size: 0.85rem; }
.datos { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 1rem 0 0; overflow: hidden; border: 1px solid var(--ui-linea); border-radius: 12px; background: var(--ui-linea); }
.datos div { padding: 0.6rem 0.85rem; background: var(--ui-solido); transition: background-color 0.6s; }
.datos dt { color: var(--ui-sec); font-size: 0.72rem; }
.datos dd { margin: 2px 0 0; font-weight: 600; }
@container (min-width: 34rem) { .datos { grid-template-columns: repeat(4, 1fr); } }

.acciones { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 1.25rem; }
.boton {
  flex: 1 1 auto;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.1rem;
  padding: 0 1.25rem;
  border: 0;
  border-radius: 999px;
  background: var(--accion);
  color: var(--accion-texto);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}
.boton-claro { background: transparent; color: var(--ui-texto); box-shadow: inset 0 0 0 1.5px var(--ui-linea); }
.boton:hover { filter: brightness(1.08); }
.boton-claro:hover { background: var(--ui-suave); filter: none; }
.panel .aviso { margin-top: 1.1rem; color: var(--ui-sec); font-size: 0.75rem; }

.planta { display: block; width: 100%; height: auto; color: var(--ui-texto); }
.pl-recinto { fill: var(--ui-suave); stroke: currentColor; stroke-width: 1.6; }
.pl-terraza { fill: rgba(224, 123, 0, 0.12); stroke: var(--profundo); stroke-width: 1; stroke-dasharray: 4 3; }
.pl-texto { fill: currentColor; font: 600 10px var(--texto); text-anchor: middle; dominant-baseline: central; }
.pl-titulo { fill: var(--ui-sec); font: 600 10px var(--texto); letter-spacing: 0.08em; text-anchor: middle; text-transform: uppercase; }
.qr { display: flex; align-items: center; gap: 16px; margin-top: 1.25rem; padding: 14px; border-radius: 14px; background: var(--ui-suave); }
.qr svg { flex: none; width: 7rem; height: 7rem; border-radius: 8px; }
.panel .qr p { margin: 0; color: var(--ui-sec); font-size: 0.9rem; }

.filtros { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 1rem; }
.filtros label { display: grid; gap: 4px; color: var(--ui-sec); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.filtros select { height: 2.75rem; padding: 0 0.75rem; border: 1px solid var(--ui-linea); border-radius: 10px; background: var(--ui-solido); color: var(--ui-texto); font-size: 0.95rem; letter-spacing: 0; text-transform: none; }
.lista, .lugares { margin: 0.9rem 0 0; padding: 0; list-style: none; }
.lista button, .lugares button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 0.75rem 0.4rem; border: 0; border-bottom: 1px solid var(--ui-linea); background: none; text-align: left; }
.lista button:hover, .lugares button:hover, .lugares button.activa { background: var(--ui-suave); }
.lista i { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.lista span, .lugares span { flex: 1; font-weight: 600; }
.lista small { display: block; color: var(--ui-sec); font-size: 0.8rem; font-weight: 400; }
.lista b, .lugares b { font-weight: 600; white-space: nowrap; }
.lugares button.activa span { color: var(--profundo); }
.vacio { padding: 1rem 0; color: var(--ui-sec); }

.mapa { display: block; width: 100%; height: auto; margin-top: 0.9rem; border-radius: 12px; }
.m-tierra { fill: #ebe6d8; }
.m-mar { fill: #9cc7d8; }
.m-costa { fill: none; stroke: #e6d6ae; stroke-width: 7; }
.m-autopista { fill: none; stroke: #f2c35c; stroke-width: 7; stroke-linecap: round; }
.m-calle { fill: none; stroke: #fff; stroke-width: 4; stroke-linecap: round; }
.m-etiqueta { fill: #3f7489; font: 600 11px var(--texto); letter-spacing: 0.12em; text-anchor: middle; text-transform: uppercase; }
.ruta { fill: none; stroke: var(--profundo); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; opacity: 0; }
.ruta.activa { opacity: 1; animation: trazo 1.1s ease-out forwards; }
@keyframes trazo { to { stroke-dashoffset: 0; } }
.lugar circle { fill: #fff; stroke: var(--tinta); stroke-width: 2.5; }
.lugar.activa circle { fill: var(--amanecer); }
.lugar text, .proyecto text { fill: var(--tinta); font: 600 11px var(--texto); text-anchor: middle; paint-order: stroke; stroke: rgba(255, 255, 255, 0.9); stroke-width: 3px; }
.lugar { cursor: pointer; }
.proyecto circle { fill: var(--tinta); stroke: #fff; stroke-width: 3; }
.proyecto text { font: 800 12px var(--display); font-stretch: 125%; }

.sin-3d { position: fixed; inset: 0; z-index: 10; display: grid; place-content: center; gap: 12px; padding: 24px; background: var(--papel); color: var(--tinta); text-align: center; }

/* Vertical (TV táctil o celular): el panel sale desde abajo. Mismo corte que HOJA en app.js. */
@media (orientation: portrait), (max-width: 760px) {
  .panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: min(45rem, 100%);
    max-height: 70vh;
    max-height: 70dvh;
    margin: 0 auto;
    padding-bottom: env(safe-area-inset-bottom);
    border-radius: 22px 22px 0 0;
    animation-name: subir;
  }
  body:has(.panel:not([hidden])) .abajo { visibility: hidden; }
}
/* Celular: marca compacta, herramientas debajo y solo con ícono. */
@media (max-width: 760px) {
  :root { --hueco: 12px; }
  .arriba { flex-direction: column; gap: 8px; }
  .marca { padding: 0.65rem 0.9rem 0.6rem; border-radius: 14px; }
  .marca-nombre { font-size: 1.1rem; }
  .marca-bajada { margin-top: 0.25rem; font-size: 0.8rem; }
  .marca-brim { margin-top: 0.35rem; font-size: 0.62rem; }
  .herramientas { gap: 6px; }
  .boton-ui { padding: 0 0.85rem; }
  .boton-ui .largo, .boton-ui .etiqueta { display: none; }
  .boton-ui:has(.etiqueta) { width: 2.75rem; padding: 0; justify-content: center; }
  .menu { left: 0; right: auto; }
  .abajo { grid-template-columns: 1fr; justify-items: center; gap: 8px; }
  .leyenda, .vistas, .ayuda { grid-area: auto; justify-self: center; }
  .ayuda { order: -1; }
  .leyenda { order: 1; }
  .usado .ayuda { display: none; }
}
/* TV vertical de sala de ventas: todo más grande para el dedo. */
@media (orientation: portrait) and (min-width: 1000px) { html { font-size: 20px; } }
@media (orientation: landscape) and (min-width: 1800px) { html { font-size: 18px; } }

@media (prefers-reduced-motion: reduce) {
  .panel { animation: none; }
  .ruta.activa { animation: none; stroke-dashoffset: 0; }
}
