/* ─────────────────────────────────────────────────────────────────
   IMMAC — "DE LA MEZCLA A LA VÍA": animación de fotogramas al hacer scroll
   Inicio, entre el hero y "Tres capas, una vía".
   Versión "cine": a pantalla completa, con bordes apenas oscurecidos y una
   línea fina de avance abajo.
   Fotogramas: frames-obra/d (1280×720) y frames-obra/m (576×720, vertical).
   Lógica: js/obra-scroll.js
───────────────────────────────────────────────────────────────── */
.ob-scroll {
  --ob-feather: 240px;
  position: relative;
  z-index: 14;
  height: 560vh;
  margin-top: calc(-1 * var(--ob-feather));
  background: transparent;
}
.ob-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  height: 100lvh;   /* pantalla completa también cuando se esconde la barra del navegador */
  overflow: hidden;
  background: #E3DED3;
}
.ob-card { position: absolute; inset: 0; overflow: hidden; background: #E3DED3; }
.ob-poster, .ob-poster img, .ob-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ob-poster img { object-fit: cover; }
.ob-canvas { opacity: 0; transition: opacity 0.6s ease; }
.ob-scroll.is-ready .ob-canvas { opacity: 1; }

/* Velo de entrada: mientras la sección se funde con la anterior solo se ve el fondo limpio;
   la muestra o capas aparecen cuando la sección ya cubre la pantalla (idéntico a mezclas-scroll) */
.ob-cover {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: #E3DED3;
  opacity: 0;
  will-change: opacity;
  z-index: 16;
}
.ob-scroll--dark .ob-cover {
  background: #16120E;
}

/* Velo cinematográfico: bordes y base apenas oscurecidos */
.ob-card::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, rgba(20, 16, 10, 0) 58%, rgba(20, 16, 10, 0.28) 100%),
    linear-gradient(180deg, rgba(20, 16, 10, 0.18) 0%, rgba(20, 16, 10, 0) 16%, rgba(20, 16, 10, 0) 78%, rgba(20, 16, 10, 0.32) 100%);
}

/* Línea fina de avance */
.ob-bar {
  position: absolute;
  left: 50%;
  bottom: calc(clamp(26px, 4.5vh, 44px) + var(--tb, 0px));
  width: 120px;
  height: 2px;
  margin-left: -60px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
}
.ob-bar i { position: absolute; inset: 0; background: #fff; transform: scaleX(0); transform-origin: left center; }

/* Celular: el fotograma ocupa el ancho y el fondo se extiende arriba y abajo (lo pinta el lienzo) */
@media (max-aspect-ratio: 4/5) {
  .ob-poster img { object-fit: contain; }
}
@media (prefers-reduced-motion: reduce) {
  .ob-canvas { transition: none; }
}

/* Sección oscura ("Capas MDC-19"): fondo del estudio y línea de avance clara */
.ob-scroll--dark .ob-sticky, .ob-scroll--dark .ob-card { background: #16120E; }

/* ═══════════════════════════════════════════════════════════════
   HOTSPOTS DE PRODUCTO (CAJITAS DE CRISTAL + LÍNEA CONECTORA)
   Efecto cinemático de producto de alta gama (Apple / Porsche):
   Entran desenfocadas, se enfocan en su punto álgido y se van.
═══════════════════════════════════════════════════════════════ */
.ob-hotspots-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
  overflow: hidden;
}

.ob-hotspots-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 21;
}

.ob-hotspot-line {
  fill: none;
  stroke: rgba(63, 180, 230, 0.75);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 5px rgba(63, 180, 230, 0.65));
  opacity: 0;
  will-change: opacity, filter;
  transition: opacity 0.25s ease;
}

.ob-hotspot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  will-change: opacity, filter;
  transition: opacity 0.25s ease;
}

/* Punto de anclaje (Pin) sobre el objeto */
.ob-hotspot__pin {
  position: absolute;
  left: var(--pin-x, 50%);
  top: var(--pin-y, 50%);
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%);
  z-index: 23;
  pointer-events: none;
  will-change: transform;
}

.ob-hotspot__dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 0 10px 2px #3FB4E6, 0 0 20px #3FB4E6;
  transform: translate(-50%, -50%);
}

.ob-hotspot__pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid rgba(63, 180, 230, 0.85);
  transform: translate(-50%, -50%);
  animation: obHotspotPulse 2.4s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

@keyframes obHotspotPulse {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2.2); opacity: 0; }
}

/* Cajita de cristal (Glass Card) */
.ob-hotspot__card {
  position: absolute;
  pointer-events: auto;
  z-index: 24;
  width: clamp(240px, 22vw, 310px);
  padding: clamp(14px, 1.6vh, 18px) clamp(16px, 1.8vw, 20px);
  border-radius: 16px;
  background: rgba(12, 18, 25, 0.76);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-top: 1px solid rgba(255, 255, 255, 0.45);
  border-left: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow:
    0 24px 50px -12px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(0, 0, 0, 0.25),
    inset 0 1px 1px rgba(255, 255, 255, 0.35);
  color: #FFFFFF;
  will-change: transform;
  transform-origin: center center;
}

/* Posicionamiento en cuadrantes */
.ob-hotspot__card--tl {
  top: clamp(80px, 14vh, 120px);
  left: clamp(24px, 4.5vw, 64px);
}
.ob-hotspot__card--tr {
  top: clamp(90px, 15vh, 130px);
  right: clamp(24px, 4.5vw, 64px);
}
.ob-hotspot__card--bl {
  bottom: calc(clamp(60px, 10vh, 90px) + var(--tb, 0px));
  left: clamp(24px, 4.5vw, 64px);
}
.ob-hotspot__card--br {
  bottom: calc(clamp(60px, 10vh, 90px) + var(--tb, 0px));
  right: clamp(24px, 4.5vw, 64px);
}

/* Tipografía de la cajita de cristal */
.ob-hotspot__tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #6CC6EE;
  margin-bottom: 7px;
  line-height: 1;
}

.ob-hotspot__tag::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #B6CD20;
  box-shadow: 0 0 8px #B6CD20;
}

.ob-hotspot__title {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: clamp(14px, 1.2vw, 16px);
  font-weight: 700;
  color: #FFFFFF;
  margin: 0 0 6px 0;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.ob-hotspot__desc {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: clamp(11.5px, 0.95vw, 12.5px);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.82);
  margin: 0;
  line-height: 1.48;
}

/* Adaptación responsive en móvil y tablets */
@media (max-width: 768px) {
  .ob-hotspot__card {
    width: calc(100vw - 44px);
    max-width: 360px;
    padding: 12px 15px;
    left: 22px !important;
    right: 22px !important;
    margin: 0 auto;
  }
  .ob-hotspot__card--tl,
  .ob-hotspot__card--tr {
    top: clamp(70px, 10vh, 90px);
    bottom: auto;
  }
  .ob-hotspot__card--bl,
  .ob-hotspot__card--br {
    bottom: calc(clamp(55px, 8.5vh, 75px) + var(--tb, 0px));
    top: auto;
  }
  .ob-hotspot-line {
    stroke-width: 1.2;
    opacity: 0.6;
  }
}

/* "De la mezcla a la vía": solo la muestra MDC-19 y el ligante (113 fotogramas) → recorrido más corto */
#obra-scroll { height: 320vh; }

/* Alto de la barra del navegador en el celular (0 en computador) */
.ob-scroll { --tb: 0px; }
@supports (height: 100lvh) {
  .ob-scroll { --tb: calc(100lvh - 100svh); }
}

/* ═══════════════════════════════════════════════════════════════
   CAPAS DEL PAVIMENTO (#capas-scroll, exploded view)
   Etiquetas editoriales sin caja: anillo fino sobre la capa, línea
   blanca de 1 px con codo a 45° y nombre a la derecha del bloque.
   Posiciones y aparición: js/obra-scroll.js (placeLayers / updateLayers).
   En vertical: número sobre cada capa y leyenda bajo la imagen.
═══════════════════════════════════════════════════════════════ */
.ob-layers {
  position: absolute;
  inset: 0;
  z-index: 22;
  pointer-events: none;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
/* Velo lateral muy suave para leer el texto sin cajas (solo cuando hay etiquetas) */
.ob-layers::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 55%, rgba(8, 10, 13, 0.5) 82%, rgba(8, 10, 13, 0.66));
  opacity: var(--veil, 0);
}
.ob-layers__svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ob-layers__svg polyline {
  fill: none;
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 1;
  stroke-linejoin: round;
}
.ob-layer { position: absolute; inset: 0; opacity: 0; visibility: hidden; }

.ob-layer__pin {
  position: absolute;
  width: 11px;
  height: 11px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  font-size: 0;
  color: transparent;
}
.ob-layer__pin::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #FFFFFF;
}

.ob-layer__label {
  position: absolute;
  transform: translateY(-50%);
  padding-left: 16px;
  color: #FFFFFF;
  will-change: transform;
}
.ob-layer__label::before {
  content: '';
  position: absolute;
  left: 0;
  top: 2px;
  bottom: 2px;
  width: 1px;
  background: rgba(255, 255, 255, 0.35);
}
.ob-layer__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.58);
}
.ob-layer__meta b { font-weight: 500; letter-spacing: 0.08em; color: #B6CD20; }
.ob-layer__name {
  display: block;
  font-size: clamp(16px, 1.45vw, 20px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

/* Vertical (celular): número sobre la capa + leyenda compacta bajo la imagen */
.ob-layers.is-legend::before { display: none; }
.ob-layers.is-legend .ob-layer__pin {
  width: 22px;
  height: 22px;
  border-color: rgba(255, 255, 255, 0.9);
  background: rgba(10, 12, 15, 0.55);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 9.5px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  letter-spacing: 0.04em;
  color: #FFFFFF;
}
.ob-layers.is-legend .ob-layer__pin::after { display: none; }
.ob-layers.is-legend .ob-layer__label {
  transform: none;
  padding-left: 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.ob-layers.is-legend .ob-layer__label::before { display: none; }
.ob-layers.is-legend .ob-layer__meta { margin: 0; flex: none; }
.ob-layers.is-legend .ob-layer__meta span { display: none; }
.ob-layers.is-legend .ob-layer__name { font-size: 15px; font-weight: 600; }

/* Etiquetas del lado izquierdo: texto alineado a la derecha, filete del lado del bloque */
.ob-layer.is-left .ob-layer__label { padding-left: 0; padding-right: 16px; text-align: right; }
.ob-layer.is-left .ob-layer__label::before { left: auto; right: 0; }
.ob-layer.is-left .ob-layer__meta { justify-content: flex-end; }
/* Velo a ambos lados cuando hay etiquetas a la izquierda y a la derecha */
.ob-layers::before {
  background: linear-gradient(90deg, rgba(8, 10, 13, 0.62), rgba(8, 10, 13, 0.42) 18%, transparent 42%, transparent 58%, rgba(8, 10, 13, 0.42) 82%, rgba(8, 10, 13, 0.62));
}
.ob-layers.is-legend .ob-layer.is-left .ob-layer__label { padding-right: 0; text-align: left; }
.ob-layers.is-legend .ob-layer.is-left .ob-layer__meta { justify-content: flex-start; }
