/* ==========================================================================
   SOI ÓPTICAS — Probador virtual
   Hoja aparte a propósito: si la función no se aprueba, se retira borrando
   este archivo, probador.js y probador.html, sin tocar el resto del sitio.
   ========================================================================== */

.u-lock { overflow: hidden; }

/* ---------- Contenedor ---------- */
.tryon { display: grid; gap: 0; }

/* ---------- Escenario ---------- */
.tryon__stage {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #0c0c0c;
  overflow: hidden;
}
@media (max-width: 700px) { .tryon__stage { aspect-ratio: 3 / 4; } }

.tryon__stage canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;          /* cámara: inmersivo, sin franjas */
  display: none;
}
.tryon__stage.is-photo canvas { object-fit: contain; }  /* fotos: sin recortar */
.tryon__stage.is-live canvas { display: block; }
.tryon__video { display: none; }

/* ---------- Ficha del modelo y botones del visor ---------- */
.tryon__topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1rem;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, .5), transparent);
}
.tryon__chip {
  display: grid;
  gap: .1rem;
  color: var(--white);
  text-shadow: 0 1px 8px rgba(0, 0, 0, .6);
}
.tryon__chip__brand {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--brand);
}
.tryon__chip__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(.95rem, 2vw, 1.25rem);
  text-transform: uppercase;
  letter-spacing: .02em;
}
.tryon__chip__cal {
  justify-self: start;
  margin-top: .3rem;
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .14em;
  padding: .22rem .55rem;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 100px;
  color: rgba(255, 255, 255, .9);
}

.tryon__stagebtns { display: flex; gap: .5rem; pointer-events: auto; }
.tryon__iconbtn {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(12, 12, 12, .55);
  backdrop-filter: blur(8px);
  color: var(--white);
  cursor: pointer;
  transition: background-color .25s var(--ease), transform .25s var(--ease);
}
.tryon__iconbtn:hover { background: rgba(12, 12, 12, .8); transform: scale(1.06); }
.tryon__iconbtn[hidden] { display: none; }

/* ---------- Deslizador vertical de tamaño ---------- */
.vslider {
  position: absolute;
  right: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: min(42%, 240px);
  z-index: 4;
  display: none;
  cursor: pointer;
  touch-action: none;
}
.tryon__stage.is-live .vslider { display: block; }
.vslider__rail {
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 4px;
  transform: translateX(-50%);
  border-radius: 100px;
  background: rgba(255, 255, 255, .35);
  backdrop-filter: blur(4px);
}
.vslider__knob {
  position: absolute;
  left: 50%; top: 50%;
  width: 22px; height: 22px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .45);
  transition: transform .15s var(--ease);
}
.vslider:hover .vslider__knob,
.vslider:focus-visible .vslider__knob { transform: translate(-50%, -50%) scale(1.18); }
.vslider:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; border-radius: 100px; }

/* ---------- Obturador ---------- */
.tryon__shutter {
  position: absolute;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%);
  width: 58px; height: 58px;
  border-radius: 50%;
  border: 3px solid var(--white);
  background: transparent;
  display: none;
  place-items: center;
  cursor: pointer;
  z-index: 4;
  transition: transform .2s var(--ease);
}
.tryon__stage.is-live .tryon__shutter { display: grid; }
.tryon__shutter span {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--white);
  transition: transform .15s var(--ease);
}
.tryon__shutter:hover { transform: translateX(-50%) scale(1.06); }
.tryon__shutter:active span { transform: scale(.82); }

.tryon__flash {
  position: absolute;
  inset: 0;
  background: var(--white);
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}
.tryon__flash.is-on { animation: tryonFlash .45s var(--ease); }
@keyframes tryonFlash { 0% { opacity: .85; } 100% { opacity: 0; } }

/* ---------- Estado inicial ---------- */
.tryon__idle {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.1rem;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  text-align: center;
  color: rgba(255, 255, 255, .72);
  z-index: 3;
}
.tryon__stage.is-live .tryon__idle { display: none; }
.tryon__idle svg { color: var(--brand); }
.tryon__idle h3 {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  text-transform: uppercase;
  color: var(--white);
}
.tryon__idle p { font-size: .88rem; line-height: 1.6; max-width: 46ch; }
.tryon__idle__micro { font-size: .68rem !important; color: rgba(255, 255, 255, .45); }

/* ---------- Pantalla de carga ---------- */
.tryon__load {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1rem;
  background: rgba(12, 12, 12, .8);
  backdrop-filter: blur(6px);
  color: var(--white);
  font-size: .85rem;
  z-index: 6;
}
.tryon__load[hidden] { display: none; }
.tryon__spin {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .25);
  border-top-color: var(--brand);
  animation: tryonSpin .8s linear infinite;
}
@keyframes tryonSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .tryon__spin { animation-duration: 2.4s; }
  .tryon__flash.is-on { animation: none; }
}

/* ---------- Avisos ---------- */
.tryon__hint {
  position: absolute;
  left: 50%;
  bottom: 6rem;
  transform: translateX(-50%);
  padding: .5rem 1rem;
  border-radius: 16px;
  background: rgba(10, 10, 10, .7);
  backdrop-filter: blur(6px);
  color: rgba(255, 255, 255, .85);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  /* Sin nowrap: los mensajes largos se recortaban por ambos extremos en
     móviles estrechos (el escenario tiene overflow: hidden). */
  white-space: normal;
  text-align: center;
  width: max-content;
  max-width: min(88%, 46ch);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
  z-index: 4;
}
.tryon__hint.is-on { opacity: 1; }
.tryon__hint.is-warn { background: rgba(200, 69, 44, .85); }

/* ---------- Tira de modelos ---------- */
.tryon__strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(118px, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-top: 0;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.tryon__frame {
  background: var(--white);
  aspect-ratio: 5 / 4;
  padding: .6rem .6rem 1.4rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 0;
  position: relative;
  scroll-snap-align: start;
  transition: background-color .25s var(--ease);
}
/* Las miniaturas son los recortes con fondo transparente, así que el fondo se
   queda claro también al seleccionar: sobre negro desaparecerían las monturas
   oscuras, que son casi todas. La selección se marca con un aro. */
.tryon__frame img { width: 100%; height: 100%; object-fit: contain; }
.tryon__frame:hover { background: var(--bone); }
.tryon__frame.is-on { background: var(--bone); box-shadow: inset 0 0 0 2px var(--brand); }
.tryon__frame__name {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  font-size: .54rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-align: center;
  padding: .3rem .2rem;
  color: var(--ink-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tryon__frame.is-on .tryon__frame__name { color: var(--ink); }

/* ---------- Pantalla completa (superposición propia: funciona también donde
   la API Fullscreen no existe, como iOS) ---------- */
.tryon--fs {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: #0c0c0c;
  display: grid;
  grid-template-rows: 1fr auto;
}
.tryon--fs .tryon__stage { aspect-ratio: auto; height: 100%; min-height: 0; }
.tryon--fs .tryon__strip {
  border: 0;
  background: rgba(12, 12, 12, .92);
  gap: 0;
}
.tryon--fs .tryon__frame { background: transparent; }
.tryon--fs .tryon__frame img { filter: invert(1) brightness(1.5); }
.tryon--fs .tryon__frame:hover { background: rgba(255, 255, 255, .06); }
.tryon--fs .tryon__frame.is-on { background: rgba(255, 255, 255, .08); box-shadow: inset 0 2px 0 var(--brand); }
.tryon--fs .tryon__frame__name { color: rgba(255, 255, 255, .6); }
.tryon--fs .tryon__frame.is-on .tryon__frame__name { color: var(--white); }
.tryon [data-fs-close] { display: none; }
.tryon--fs [data-fs-close] { display: grid; }
.tryon--fs [data-fs] { display: none; }

/* ---------- Ficha, ajustes y notas bajo el visor ---------- */
.tryon-meta { background: var(--bone); }
.tryon__meta {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
}
@media (min-width: 900px) { .tryon__meta { grid-template-columns: 1.1fr 1fr; } }

.tryon__info { display: grid; gap: 1rem; justify-items: start; }
.tryon__price {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
}
.tryon__slider { display: grid; gap: .4rem; width: min(100%, 340px); }
.tryon__slider label {
  display: flex;
  justify-content: space-between;
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.tryon__slider input[type="range"] { width: 100%; accent-color: var(--brand); }
.tryon__actions { display: flex; flex-wrap: wrap; gap: .6rem; }

.tryon__notes { display: grid; gap: 1.25rem; }
.tryon__note {
  font-size: .78rem;
  line-height: 1.6;
  color: var(--ink-mute);
  border-left: 2px solid var(--brand);
  padding-left: .9rem;
}
.tryon__note strong { color: var(--ink); font-weight: 600; }
