/* =================================================================
   EXPLORADOR 3D — AceroStudio (base Lápiz Rojo)
   Rojo lápiz como acento; colores de revenido del acero como secundarios.
   ================================================================= */
:root {
  --papel: #e9e6df;
  --tinta: #16181b;
  --tinta-suave: #5b6068;
  --acero: #8a9199;
  --linea: rgba(22, 24, 27, 0.14);
  --panel: rgba(250, 249, 246, 0.86);
  --rojo: #cf2a1f;
  --rojo-brillo: rgba(207, 42, 31, 0.45);
  --pajizo: #d9b26a;
  --bronce: #b4733a;
  --purpura: #6e4a8a;
  --azul: #2f4f8f;
  --mono: "DM Mono", ui-monospace, monospace;
  --sans: "Space Grotesk", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--papel);
  color: var(--tinta);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; cursor: pointer; }

#escena { position: fixed; inset: 0; }
#escena canvas { display: block; touch-action: none; }

/* ---------- Paneles comunes ---------- */
.ex-marca, .ex-pisos, .ex-ficha, .ex-btn, .ex-zoom button {
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--linea);
}

/* ---------- Marca ---------- */
.ex-marca {
  position: fixed;
  top: 16px;
  left: 16px;
  padding: 10px 14px;
  z-index: 5;
}
.ex-logo {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
  color: var(--tinta);
  text-decoration: none;
}
.ex-punto { color: var(--rojo); }
.ex-proyecto {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tinta-suave);
}
.ex-migas { color: var(--rojo); }

/* ---------- Acciones ---------- */
.ex-acciones {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 6px;
  z-index: 5;
}
.ex-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ex-btn:hover { border-color: var(--rojo); color: var(--rojo); }

/* ---------- Selector de pisos ---------- */
.ex-pisos {
  position: fixed;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 132px;
  z-index: 5;
}
.ex-pisos ul { list-style: none; margin: 0; padding: 0; }
.ex-pisos li button {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--linea);
}
.ex-pisos li button strong {
  display: block;
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
}
.ex-pisos li button span {
  font-family: var(--mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tinta-suave);
}
.ex-pisos li button::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 14px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--acero);
  transform: rotate(45deg);
}
.ex-pisos li button:hover { background: rgba(207, 42, 31, 0.05); }
.ex-pisos li button.activo { background: var(--tinta); color: #f4f2ec; }
.ex-pisos li button.activo span { color: #b9bec5; }
.ex-pisos li button.activo::after {
  background: var(--rojo);
  border-color: var(--rojo);
  box-shadow: 0 0 8px var(--rojo-brillo);
}
.ex-modos { display: flex; }
.ex-modos button {
  flex: 1;
  padding: 9px 0;
  background: none;
  border: 0;
  border-right: 1px solid var(--linea);
  color: var(--tinta-suave);
  display: grid;
  place-items: center;
}
.ex-modos button:last-child { border-right: 0; }
.ex-modos button.activo { color: var(--rojo); box-shadow: inset 0 -2px 0 var(--rojo); }

/* ---------- Ficha ---------- */
.ex-ficha {
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: min(340px, calc(100vw - 32px));
  padding: 16px 18px 18px;
  z-index: 5;
  border-left: 3px solid var(--rojo);
}
.ex-ficha-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rojo);
  border: 1px solid var(--rojo);
  padding: 2px 6px;
}
.ex-ficha h1 { margin: 10px 0 4px; font-size: 22px; font-weight: 600; line-height: 1.15; }
.ex-ficha p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.45; color: var(--tinta-suave); }
.ex-datos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 14px;
}
.ex-datos:empty { display: none; }
.ex-datos div { border-top: 1px solid var(--linea); padding-top: 6px; }
.ex-datos dt {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tinta-suave);
}
.ex-datos dd { margin: 2px 0 0; font-size: 15px; font-weight: 600; }
.ex-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border: 0;
  background: var(--rojo);
  color: #fff;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 0 14px var(--rojo-brillo);
}
.ex-cta.cancelar { background: var(--tinta); box-shadow: none; }

/* ---------- Aviso ---------- */
.ex-aviso {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 12px);
  padding: 8px 14px;
  background: var(--tinta);
  color: #f4f2ec;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  z-index: 6;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.ex-aviso.visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Zoom ---------- */
.ex-zoom {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 5;
}
.ex-zoom button { width: 34px; height: 34px; font-size: 18px; line-height: 1; }
.ex-zoom button:hover { color: var(--rojo); border-color: var(--rojo); }

/* ---------- Etiquetas 3D (estilo Visor Rojo) ---------- */
#etiquetas { position: fixed; inset: 0; pointer-events: none; z-index: 4; }
.ex-marcador {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  cursor: pointer;
  padding: 0;
  background: none;
  border: 0;
  transition: opacity .25s;
  will-change: transform;
}
.ex-marcador .rombo {
  width: 10px;
  height: 10px;
  background: var(--rojo);
  transform: rotate(45deg);
  box-shadow: 0 0 0 3px rgba(207, 42, 31, 0.18), 0 0 12px var(--rojo-brillo);
  flex: none;
}
.ex-marcador .tag {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(250, 249, 246, 0.92);
  border: 1px solid var(--rojo);
  color: var(--tinta);
  padding: 2px 6px;
  white-space: nowrap;
  transition: background .2s, color .2s;
}
.ex-marcador:hover .tag, .ex-marcador.abierto .tag { background: var(--rojo); color: #fff; }
.ex-marcador.oculto { opacity: 0; pointer-events: none; }

/* ---------- Carga ---------- */
.ex-cargando {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--papel);
  z-index: 10;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--rojo);
  transition: opacity .5s;
}
.ex-cargando.listo { opacity: 0; pointer-events: none; }

/* ---------- Móvil ---------- */
@media (max-width: 720px) {
  .ex-acciones .ex-btn span { display: none; }
  .ex-pisos { top: 110px; transform: none; width: 52px; }
  .ex-pisos li button { padding: 10px 8px; }
  .ex-pisos li button strong { font-size: 16px; }
  .ex-pisos li button span { display: none; }
  .ex-pisos li button::after { right: 8px; top: 13px; width: 6px; height: 6px; }
  .ex-modos { flex-direction: column; }
  .ex-modos button { border-right: 0; border-top: 1px solid var(--linea); }
  .ex-ficha { padding: 12px 14px 14px; width: calc(100vw - 80px); }
  .ex-ficha h1 { font-size: 18px; }
  .ex-ficha p { font-size: 12.5px; }
  .ex-datos dd { font-size: 13px; }
  .ex-aviso { bottom: auto; top: 70px; }
}
