/* ═══ UNBLIND por dentro: los lentes en 3D (unblind-3d.js) ═══
   La sección se queda fija mientras se baja; a la izquierda el texto de cada etapa, a la derecha
   la escena. En celular, la escena arriba y el texto abajo. Con «menos movimiento», sin
   JavaScript o sin 3D, se vuelve contenido corrido con la imagen del despiece. */

/* Papel de día que se funde arriba y abajo con el cielo de la página, sin línea */
/* El fundido va en el margen de arriba y de abajo, fuera de la pantalla fija: el texto nunca queda sobre él */
.ub-despiece { position: relative; box-sizing: content-box; height: 720svh; padding: 22svh 0; background: linear-gradient(rgba(244,246,250,0), #f4f6fa 22svh, #f4f6fa calc(100% - 22svh), rgba(244,246,250,0)); }
.ub-despiece-pin { position: sticky; top: 0; height: 100svh; display: flex; align-items: center; padding-top: var(--nav-h); overflow: hidden; }
.ub-despiece-grid { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.38fr); gap: var(--s7); align-items: center; width: 100%; }
.ub-despiece-texto h2 { max-width: 12ch; }

/* Las etapas del texto, una encima de otra: sólo se ve la actual */
.ub-etapas { display: grid; margin-top: var(--s6); }
/* La que sale se va rápido y la que entra espera: nunca se encima un texto con otro */
.ub-etapa { grid-area: 1 / 1; margin: 0; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .28s ease, transform .28s ease; }
.ub-etapa.activa { opacity: 1; transform: none; pointer-events: auto; transition: opacity .5s var(--ease) .26s, transform .5s var(--ease) .26s; }
.ub-etapa p { margin: 0 0 var(--s3); max-width: 44ch; font-size: 17px; color: var(--dim); }
.ub-pista { display: inline-flex; align-items: center; gap: var(--s2); font-size: 14px; color: var(--soft); }
/* Lo que está pasando mientras se abren: sólo se ve el paso actual */
.ub-taller { list-style: none; margin: var(--s4) 0 0; padding: 0; display: grid; }
.ub-taller li { grid-area: 1 / 1; display: flex; align-items: center; gap: var(--s3); font-size: 16px; color: #2563eb; opacity: 0; transform: translateY(6px); transition: opacity .3s ease, transform .3s ease; }
.ub-taller li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #2563eb; }
.ub-taller li.activa { opacity: 1; transform: none; transition: opacity .45s var(--ease) .15s, transform .45s var(--ease) .15s; }
.abriendo .ub-pista { opacity: 0; }
.ub-pista { transition: opacity .3s; }
.ub-pista::after { content: "↓"; animation: pista 1.8s var(--ease) infinite; }
@keyframes pista { 50% { transform: translateY(4px); } }

/* Las piezas y los pasos: la actual resalta, las demás quedan tenues */
.ub-partes, .ub-pasos { list-style: none; padding: 0; display: grid; gap: var(--s3); }
.ub-partes li, .ub-pasos li { display: grid; gap: 2px; opacity: .32; transition: opacity .5s var(--ease); }
.ub-partes li.activa, .ub-pasos li.activa { opacity: 1; }
.ub-partes li > b, .ub-pasos li > b { line-height: 1.2;  font-weight: 300; font-size: 20px; letter-spacing: -.01em; color: var(--paper); }
.ub-pasos li > b { font-size: clamp(24px, 2.2vw, 30px); }
.ub-partes li.activa > b, .ub-pasos li.activa > b { color: #2563eb; }
.ub-partes li > small { font-size: 13px; color: var(--faint); }
.ub-partes li:not(.activa) > small { display: none; }
.ub-partes li > span, .ub-pasos li > span { max-width: 40ch; font-size: 15px; line-height: 1.5; color: var(--dim); }

/* La escena */
.ub-despiece-escena { position: relative; height: min(76svh, 720px); }
.ub-lienzo { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .8s var(--ease); touch-action: pan-y; cursor: grab; }
.ub-lienzo:active { cursor: grabbing; }
.ub-respaldo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity .8s var(--ease); }
.ub-respaldo-despiece { display: none; }
.con-3d .ub-lienzo { opacity: 1; }
.con-3d .ub-respaldo-armado { opacity: 0; }

/* El nombre de la pieza en foco, con una línea fina hasta ella */
.ub-guia { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; opacity: 0; transition: opacity .3s; }
.ub-guia line { stroke: #2563eb; stroke-width: 1.2; }
.ub-guia circle { fill: #2563eb; }
.ub-rotulo { position: absolute; left: 0; top: 0; display: grid; gap: 2px; padding: 10px 14px; border-radius: 12px; background: #0b1f3b; color: #f4f6fa; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .3s; box-shadow: 0 14px 30px rgba(11,31,59,.22); }
.ub-rotulo b { font-weight: 400; font-size: 15px; }
.ub-rotulo small { font-size: 12px; color: #8fb2ff; }

/* «Lo que ve»: la foto de la calle, los recuadros y la frase, durante el pulso */
.ub-ve { position: absolute; left: 0; top: 2%; width: min(26%, 190px); aspect-ratio: 4 / 5; margin: 0; border-radius: 14px; overflow: hidden; box-shadow: 0 18px 40px rgba(11,31,59,.18); opacity: 0; transform: translateY(10px) scale(.98); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.ub-ve img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ub-ve .caja { border-radius: 6px; opacity: 0; transition: opacity .4s var(--ease); }
.ub-ve.visible { opacity: 1; transform: none; }
.ub-ve.cajas .caja { opacity: 1; }
.ub-ve.cajas .caja:nth-of-type(2) { transition-delay: .15s; } .ub-ve.cajas .caja:nth-of-type(3) { transition-delay: .3s; } .ub-ve.cajas .caja:nth-of-type(4) { transition-delay: .45s; }
.ub-dicho { position: absolute; left: 50%; bottom: 3%; width: max-content; max-width: min(92%, 440px); margin: 0; padding: 10px 16px; border-radius: 14px; background: #0b1f3b; color: #f4f6fa; font-size: 15px; line-height: 1.4; text-align: center; opacity: 0; transform: translate(-50%, 8px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.ub-dicho.visible { opacity: 1; transform: translate(-50%, 0); }
.ub-ilus { position: absolute; right: 0; top: 2%; padding: 2px 9px; border-radius: 999px; background: rgba(11,31,59,.08); color: rgba(11,31,59,.7); font-size: 11px; letter-spacing: .02em; }
/* Te lo dice: el botón para oír la calle con audífonos (unblind.js) y el recuadro que suena */
.ub-oir { justify-self: start; align-self: start; display: inline-flex; align-items: center; gap: var(--s3); min-height: 44px; margin-top: var(--s3); padding: 0 var(--s5) 0 var(--s4); border: 1px solid rgba(11,31,59,.18); border-radius: 999px; background: none; color: #0b1f3b; font: inherit; font-size: 14px; cursor: pointer; transition: background .3s, transform .2s var(--ease); }
.ub-oir[hidden] { display: none; }
.ub-oir:hover { background: rgba(11,31,59,.05); }
.ub-oir:active { transform: scale(.97); }
/* Unos audífonos: la diadema y las dos copas */
.ub-oir i { position: relative; width: 15px; height: 12px; border: 1.5px solid currentColor; border-bottom: 0; border-radius: 8px 8px 0 0; }
.ub-oir i::before, .ub-oir i::after { content: ""; position: absolute; bottom: -3px; width: 4px; height: 7px; border-radius: 2px; background: currentColor; }
.ub-oir i::before { left: -2.5px; } .ub-oir i::after { right: -2.5px; }
.ub-oir[aria-pressed="true"] { background: #0b1f3b; color: #f4f6fa; border-color: #0b1f3b; }
.ub-despiece:not(.corrida) .ub-pasos li:not(.activa) > .ub-oir { visibility: hidden; }
.ub-ve .caja { transition: opacity .4s var(--ease), border-color .25s, border-width .25s; }
.ub-ve .caja.suena { border-width: 3px; border-color: #2563eb; }

/* Lo que hace: la pieza que hace posible cada función */
.ub-funciones button small { margin-top: 2px; font-size: 12.5px; letter-spacing: .02em; color: var(--soft); }

/* ── Celular: la escena arriba, el texto abajo; de las piezas y los pasos sólo se ve el actual ── */
@media (max-width: 760px) {
  .ub-despiece { height: 660svh; }
  .ub-despiece-pin { align-items: flex-start; padding-top: calc(var(--nav-h) + var(--s2)); }
  .ub-despiece-grid { grid-template-columns: 1fr; gap: var(--s3); }
  .ub-despiece-escena { order: -1; height: 46svh; }
  .ub-despiece-texto h2 { font-size: 26px; max-width: none; }
  .ub-etapas { margin-top: var(--s3); }
  .ub-etapa p { font-size: 15.5px; }
  .ub-partes li:not(.activa), .ub-pasos li:not(.activa) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .ub-partes li > b { font-size: 22px; }
  .ub-ve { width: 30%; }
  /* La frase va arriba del botón de explorar, para no encimarse */
  .ub-dicho { bottom: 52px; font-size: 13.5px; padding: 8px 12px; }
}
/* Teléfonos bajitos: la escena un poco más chica para que el texto y el botón quepan */
@media (max-width: 760px) and (max-height: 700px) {
  .ub-despiece-escena { height: 40svh; }
  .ub-despiece-texto h2 { font-size: 22px; }
  .ub-etapa p, .ub-partes li > span, .ub-pasos li > span { font-size: 14px; }
}

/* ── Corrida: «menos movimiento», sin JavaScript o sin 3D ── */
.ub-despiece.corrida, html:not(.js) .ub-despiece { height: auto; padding: 0; background: #f4f6fa; }
.corrida .ub-despiece-pin, html:not(.js) .ub-despiece-pin { position: static; height: auto; padding: var(--s9) 0; }
.corrida .ub-etapas, html:not(.js) .ub-etapas { gap: var(--s6); }
.corrida .ub-etapa, html:not(.js) .ub-etapa { grid-area: auto; opacity: 1; transform: none; pointer-events: auto; }
.corrida .ub-partes li, .corrida .ub-pasos li, html:not(.js) .ub-partes li, html:not(.js) .ub-pasos li { position: static; width: auto; height: auto; clip: auto; opacity: 1; }
.corrida .ub-pista, html:not(.js) .ub-pista { display: none; }
.corrida .ub-taller, html:not(.js) .ub-taller { display: none; }
.corrida .ub-respaldo-armado, html:not(.js) .ub-respaldo-armado { display: none; }
.corrida .ub-respaldo-despiece, html:not(.js) .ub-respaldo-despiece { display: block; opacity: 1; }
.corrida :is(.ub-lienzo, .ub-guia, .ub-rotulo, .ub-ve, .ub-dicho), html:not(.js) :is(.ub-lienzo, .ub-guia, .ub-rotulo, .ub-ve, .ub-dicho) { display: none; }
@media (max-width: 760px) { .corrida .ub-despiece-escena, html:not(.js) .ub-despiece-escena { height: 70vw; } }
@media (prefers-reduced-motion: reduce) { .ub-pista::after { animation: none; } }

/* ── «Explorar en 3D» ── */
.ub-explorar-abrir { position: absolute; right: 0; bottom: 2%; z-index: 2; display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s5) 0 var(--s4); border: 1px solid rgba(11,31,59,.18); border-radius: 999px; background: rgba(255,255,255,.75); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #0b1f3b; font: inherit; font-size: 14px; cursor: pointer; transition: background .3s, transform .2s var(--ease); }
.ub-explorar-abrir:hover { background: #fff; }
.ub-explorar-abrir:active { transform: scale(.97); }
.ub-explorar-abrir i { width: 18px; height: 18px; border: 1.5px solid currentColor; border-radius: 50%; position: relative; }
.ub-explorar-abrir i::after { content: ""; position: absolute; inset: 3px -4px; border: 1.5px solid currentColor; border-radius: 50%; transform: rotate(-25deg); opacity: .6; }
.corrida .ub-explorar-abrir { display: none; }
html.explorando { overflow: hidden; }
.ub-explorar { position: fixed; inset: 0; z-index: 500; background: #eef2f8; }
.ub-explorar[hidden] { display: none; }
.ub-explorar-escena { position: absolute; inset: 0; }
.ub-explorar-escena .ub-lienzo { opacity: 1; cursor: grab; touch-action: none; }
.ub-explorar-barra { position: absolute; left: var(--gutter); right: var(--gutter); top: max(var(--s4), env(safe-area-inset-top)); display: flex; align-items: center; gap: var(--s3); }
.ub-explorar-titulo { margin: 0 auto 0 0; font-size: 17px; color: #0b1f3b; }
.ub-explorar-titulo small { margin-left: var(--s2); font-size: 12px; color: rgba(11,31,59,.55); }
.ub-explorar-boton { min-height: 44px; padding: 0 var(--s5); border: 1px solid rgba(11,31,59,.18); border-radius: 999px; background: #fff; color: #0b1f3b; font: inherit; font-size: 14px; cursor: pointer; }
.ub-explorar-boton[aria-pressed="true"] { background: #0b1f3b; color: #f4f6fa; }
.ub-explorar-cerrar { background: #0b1f3b; color: #f4f6fa; border-color: #0b1f3b; }
.ub-explorar-pista { position: absolute; left: 50%; bottom: max(var(--s4), env(safe-area-inset-bottom)); margin: 0; width: max-content; max-width: calc(100% - 2 * var(--gutter)); transform: translateX(-50%); font-size: 13px; color: rgba(11,31,59,.6); text-align: center; pointer-events: none; }
.ub-explorar-ficha { position: absolute; left: var(--gutter); bottom: calc(var(--s8) + 8px); display: grid; gap: 4px; width: min(340px, calc(100% - 2 * var(--gutter))); padding: var(--s4) var(--s5); border-radius: 16px; background: #0b1f3b; color: #f4f6fa; box-shadow: 0 20px 40px rgba(11,31,59,.25); opacity: 0; transform: translateY(8px); transition: opacity .4s var(--ease), transform .4s var(--ease); pointer-events: none; }
.ub-explorar-ficha.visible { opacity: 1; transform: none; }
.ub-explorar-ficha b { font-weight: 400; font-size: 19px; }
.ub-explorar-ficha span { font-size: 14px; line-height: 1.45; color: rgba(244,246,250,.82); }
.ub-explorar-ficha small { font-size: 12.5px; color: #8fb2ff; }
@media (max-width: 760px) {
  .ub-explorar-abrir { bottom: 0; font-size: 13px; padding: 0 var(--s4) 0 var(--s3); }
  .ub-explorar-titulo { font-size: 15px; }
  .ub-explorar-titulo small { display: block; margin: 0; }
  .ub-explorar-boton { padding: 0 var(--s4); font-size: 13px; }
  .ub-explorar-ficha { bottom: calc(var(--s7) + 16px); }
}
