/**
 * PhotoSision Portal · Escena a escala del Simulador de sala (SPRINT-123X, maqueta 18)
 *
 * Parte del simulador separada de sim-sala.css por responsabilidad (dibujo de la sala) y tamaño.
 * El ancho de la escena equivale a --W unidades (1 unidad = 1 cm de pared); el piso, el sofá y la madera del cuadro
 * son ilustración (no identidad de marca) y la pared llega como variable (--pared, --pared2) desde el modelo.
 */

/* ---------- escena a escala ---------- */
.sim-escena {
  --W: 320;
  --pared: #EBD9BC;
  --pared2: #D9C39F;
  container-type: inline-size;
  position: relative;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  aspect-ratio: 320 / var(--hc, 276);
  overflow: hidden;
  isolation: isolate;
  background: var(--pared);
}

/* SPRINT-257: en celular y tablet la escena se recorta por arriba (se corta pared vacía; el sofá y los cuadros no cambian de
   escala porque todo se ancla al piso). Alto en unidades de pared = alto del cuadro + 141 de base + holgura. */
.sim-escena[data-medida="20x30"] { --hc: 190; }
.sim-escena[data-medida="30x45"] { --hc: 205; }
.sim-escena[data-medida="50x70"] { --hc: 230; }
.sim-escena[data-medida="70x100"] { --hc: 262; }

/* Pantalla #simulador en PC: escena completa, nunca más alta que la pantalla. */
@media (min-width: 1024px) {
  .sim-sala:not(.sim-sala-embedded) .sim-escena {
    --hc: 276;
    max-width: min(100%, calc((100dvh - 168px) * 1.159));
    border-radius: 20px;
  }
}

.sim-escena::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(70% 90% at 12% 18%, rgba(255, 255, 255, 0.55), transparent 62%),
    linear-gradient(180deg, transparent 55%, color-mix(in srgb, var(--pared2) 55%, transparent));
}

.sim-escena > * {
  --u: calc(100cqw / var(--W));
}

.sim-sala-foto {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sim-piso {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(36 * var(--u));
  z-index: 1;
  background: linear-gradient(180deg, #B89B80, #9C7F66);
}

.sim-piso::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(-7 * var(--u));
  height: calc(7 * var(--u));
  background: #F6F0E8;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}

.sim-sofa {
  position: absolute;
  z-index: 2;
  left: calc((var(--W) - 200) / 2 * var(--u));
  width: calc(200 * var(--u));
  bottom: calc(30 * var(--u));
  height: calc(91 * var(--u));
  color: color-mix(in srgb, var(--pared2) 80%, #5A3A2A);
}

.sim-sofa .respaldo {
  position: absolute;
  left: calc(8 * var(--u));
  right: calc(8 * var(--u));
  top: 0;
  height: calc(58 * var(--u));
  border-radius: calc(14 * var(--u)) calc(14 * var(--u)) calc(4 * var(--u)) calc(4 * var(--u));
  background: color-mix(in srgb, var(--pared2) 72%, #fff);
  border: 1.5px solid currentColor;
}

.sim-sofa .asiento {
  position: absolute;
  left: calc(22 * var(--u));
  right: calc(22 * var(--u));
  top: calc(50 * var(--u));
  height: calc(26 * var(--u));
  border-radius: calc(8 * var(--u));
  background: color-mix(in srgb, var(--pared2) 60%, #fff);
  border: 1.5px solid currentColor;
}

.sim-sofa .brazo {
  position: absolute;
  top: calc(34 * var(--u));
  width: calc(26 * var(--u));
  height: calc(48 * var(--u));
  border-radius: calc(12 * var(--u));
  background: color-mix(in srgb, var(--pared2) 66%, #fff);
  border: 1.5px solid currentColor;
}

.sim-sofa .brazo.izq {
  left: 0;
}

.sim-sofa .brazo.der {
  right: 0;
}

.sim-sofa .pata {
  position: absolute;
  bottom: 0;
  width: calc(6 * var(--u));
  height: calc(12 * var(--u));
  background: currentColor;
  opacity: 0.6;
  border-radius: 2px;
}

.sim-sofa .pata.izq {
  left: calc(14 * var(--u));
}

.sim-sofa .pata.der {
  right: calc(14 * var(--u));
}

.sim-cota-sofa {
  position: absolute;
  z-index: 3;
  left: calc((var(--W) - 200) / 2 * var(--u));
  width: calc(200 * var(--u));
  bottom: calc(14 * var(--u));
  height: calc(10 * var(--u));
  border-left: 1.5px solid #5A3A2A;
  border-right: 1.5px solid #5A3A2A;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.sim-cota-sofa::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1.5px solid #5A3A2A;
}

.sim-cota-sofa b {
  position: relative;
  background: var(--pared);
  padding: 0 6px;
  font-size: clamp(9px, calc(7 * var(--u)), 12px);
  color: #5A3A2A;
  font-weight: 600;
}

.sim-escena.con-cotas .sim-cota-sofa,
.sim-escena.con-cotas .sim-cota {
  opacity: 1;
}

.sim-obras {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: calc((36 + 105) * var(--u));
  height: 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: calc(var(--gap, 0) * var(--u));
}

.sim-pieza {
  position: relative;
  flex: none;
  width: calc(var(--w) * var(--u));
  height: calc(var(--h) * var(--u));
  padding: 0;
  background: var(--sf);
  box-shadow:
    0 calc(1.2 * var(--u)) calc(1.5 * var(--u)) rgba(0, 0, 0, 0.25),
    calc(1.5 * var(--u)) calc(4 * var(--u)) calc(9 * var(--u)) rgba(0, 0, 0, 0.2);
  transition: width 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), height 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.sim-pieza[hidden] {
  display: none;
}

.sim-paspartu {
  position: relative;
  width: 100%;
  height: 100%;
  background: transparent;
  padding: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.sim-foto {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sim-vacio {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #E8DFD2;
  color: #5A3A2A;
  font-size: clamp(8px, calc(6 * var(--u)), 11px);
  font-weight: 600;
  text-align: center;
}

.sim-paspartu .sim-marca {
  inset: 0;
}

.sim-cota {
  position: absolute;
  opacity: 0;
  transition: opacity 0.2s;
  font-size: clamp(9px, calc(7 * var(--u)), 12px);
  font-weight: 600;
  color: #5A3A2A;
  white-space: nowrap;
}

.sim-cota[hidden] {
  display: none;
}

.sim-cota.ancho {
  left: 0;
  right: 0;
  top: calc(-9 * var(--u));
  height: calc(7 * var(--u));
  border-left: 1.5px solid #5A3A2A;
  border-right: 1.5px solid #5A3A2A;
  text-align: center;
  line-height: calc(7 * var(--u));
}

.sim-cota.ancho::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1.5px solid #5A3A2A;
}

.sim-cota b {
  position: relative;
  background: var(--pared);
  padding: 0 5px;
  font-weight: 600;
}

.sim-cota.alto {
  top: 0;
  bottom: 0;
  right: calc(-10 * var(--u));
  width: calc(7 * var(--u));
  border-top: 1.5px solid #5A3A2A;
  border-bottom: 1.5px solid #5A3A2A;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sim-cota.alto::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  border-left: 1.5px solid #5A3A2A;
}

.sim-cota.alto b {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  padding: 5px 0;
}
