/* ============================================================
   PREVIA — CINEMA SCROLL LAYER
   Sticky-pinned scene model with GSAP-scrubbed timelines.
   Loads AFTER styles-immersive.css to override the slideshow layout.
   ============================================================ */

/* Kill the old slideshow geometry. The cinema model puts every scene
   inline in document flow (no virtual scroller, no fixed stage).
   IMPORTANT: do NOT use overflow-x: hidden on html/body — it creates a
   scroll container and breaks `position: sticky` on every descendant. Use
   `overflow-x: clip` instead (modern equivalent that clips without
   establishing scroll context). */
html, body {
  overflow-x: clip;
  overflow-y: visible;
}
html { scroll-behavior: auto; }            /* Lenis handles smooth */
body { background: var(--c-deep, #2B3534); }

/* Old fixed stage is gone; if the SPA renders it we hide it. */
.imv-stage { display: none !important; }
.imv-loop-overlay { display: none !important; }
#imv-scroller { display: none !important; }

/* The persistent video stash is positioned BEHIND everything as a
   fallback hero bg only; cine sections render their own video layer. */
.card-video-stash { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.card-video-stash video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 600ms ease-out; }
.card-video-stash video.active { opacity: 1; }
.card-video-stash::before { display: none; }

/* ── Cinema main container ───────────────────────────────────── */
#imv-cinema {
  position: relative;
  z-index: 2;
}

/* ── Scene container — gives the scroll its height ─────────── */
.cine {
  position: relative;
  width: 100%;
  height: 250vh;                            /* 2.5 viewports of scroll */
}
.cine--cta { height: 200vh; }               /* CTA is shorter (ends) */

/* ── Pinned viewport inside each scene ─────────────────────── */
.cine-pin {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  isolation: isolate;
}

/* ── Background video per scene ────────────────────────────── */
.cine-bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  will-change: transform;
}
/* Subtle dark overlay always available on dark scenes */
.cine--hero .cine-pin::before,
.cine--scanner .cine-pin::before,
.cine--cta .cine-pin::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.18), rgba(0,0,0,0.42));
  z-index: 1;
  pointer-events: none;
}
.cine--steps .cine-pin::before {
  content: '';
  position: absolute; inset: 0;
  background: rgba(246, 241, 231, 0.22);   /* warm wash over manuscript */
  z-index: 1;
  pointer-events: none;
}

/* Extra parallax bg layers (decorative, e.g. manuscript glyphs) */
.cine-bg-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  will-change: transform, opacity;
}
.cine-bg-layer--glyphs {
  opacity: 0.18;
  mix-blend-mode: multiply;
  background-image: url("assets/manuscript-glyphs.svg");
  background-repeat: repeat;
  background-size: 480px;
}

/* ── Overlay (where text + cards + photo live) ─────────────── */
.cine-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 96px clamp(20px, 6vw, 96px);
  pointer-events: none;
  color: #fff;
}
.cine-overlay > * { pointer-events: auto; }

.cine--steps .cine-overlay { color: #111513; }

.cine-inner {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.cine-inner--center {
  align-items: center;
  text-align: center;
}

/* ── Typography (reuse Inria Serif from existing styles) ─── */
.cine-eyebrow {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.7;
  margin: 0;
}
.cine--steps .cine-eyebrow { color: rgba(17,21,19,0.55); opacity: 1; }

.cine-h1 {
  font-family: 'Inria Serif', serif;
  font-weight: 400;
  letter-spacing: -0.07em;
  line-height: 1.02;
  font-size: clamp(44px, 7.4vw, 112px);
  margin: 0;
  max-width: 18ch;
  color: inherit;
}
.cine-h2 {
  font-family: 'Inria Serif', serif;
  font-weight: 400;
  letter-spacing: -0.07em;
  line-height: 1.04;
  font-size: clamp(34px, 5.4vw, 80px);
  margin: 0;
  max-width: 16ch;
  color: inherit;
}
.cine-em {
  font-style: italic;
  font-weight: 300;
  color: var(--c-accent, #C4D6C5);
}
.cine--steps .cine-em { color: var(--c-deep, #2B3534); }

.cine-lead {
  font-family: 'Inria Serif', serif;
  font-weight: 300;
  font-size: clamp(17px, 1.4vw, 22px);
  line-height: 1.55;
  max-width: 42ch;
  color: rgba(255,255,255,0.86);
  margin: 0;
}
.cine--steps .cine-lead { color: #5b6663; }

.cine-sub {
  font-size: clamp(15px, 1.2vw, 18px);
  line-height: 1.55;
  max-width: 56ch;
  color: rgba(255,255,255,0.78);
  margin: 0;
  text-align: center;
}

/* ── Hero badge / live dot row ─────────────────────────────── */
.cine-eyebrow-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.18);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.9);
}
.cine-live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #84cc16;
  box-shadow: 0 0 0 0 rgba(132,204,22,0.7);
  animation: cine-pulse 1.8s cubic-bezier(.2,.7,.2,1) infinite;
}
@keyframes cine-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(132,204,22,0.7); }
  70%  { box-shadow: 0 0 0 12px rgba(132,204,22,0); }
  100% { box-shadow: 0 0 0 0 rgba(132,204,22,0); }
}

/* ── Steps grid (4 cards) ──────────────────────────────────── */
/* The Steps scene needs the 4 cards visible WITHIN the pinned viewport.
   We anchor the overlay to the top (flex-start) instead of center so the
   cards never overflow below the pin's overflow:hidden boundary. */
.cine--steps .cine-overlay {
  align-items: flex-start;
  padding-top: 12vh;
  padding-bottom: 6vh;
}
.cine--steps .cine-h2 {
  font-size: clamp(28px, 4.2vw, 60px);
  max-width: 18ch;
}
.cine--steps .cine-lead {
  font-size: clamp(15px, 1.2vw, 18px);
  max-width: 56ch;
}
.cine-steps-grid {
  display: grid;
  /* Mobile: 2x2 grid so the 4 cards fit inside the 100vh pin without
     overflowing. A single-column stack on mobile pushes cards 3+4 below
     the pin's overflow:hidden boundary and they never appear. */
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 4px;
  width: 100%;
}
@media (min-width: 700px) {
  .cine-steps-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}
@media (min-width: 1024px) {
  .cine-steps-grid { grid-template-columns: repeat(4, 1fr); gap: 18px; }
}
.cine-step {
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(14px);
  border-radius: 16px;
  padding: 20px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  color: #111513;
  border: 1px solid rgba(17,21,19,0.06);
  box-shadow: 0 20px 40px -24px rgba(0,0,0,0.35);
  will-change: transform, opacity;
}
.cine-step-num {
  font-family: 'Inria Serif', serif;
  font-weight: 300;
  font-size: 34px;
  color: var(--c-deep, #2B3534);
  letter-spacing: -0.07em;
  line-height: 1;
}
.cine-step h3 {
  font-family: 'Inria Serif', serif;
  font-weight: 400;
  font-size: 18px;
  letter-spacing: -0.04em;
  margin: 0;
  color: #111513;
  line-height: 1.15;
}
.cine-step p {
  font-size: 12.5px;
  line-height: 1.5;
  color: #5b6663;
  margin: 0;
}
.cine-step-time {
  margin-top: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(17,21,19,0.5);
  display: flex; align-items: center; gap: 8px;
}
.cine-step-time::before {
  content: ''; width: 20px; height: 1px;
  background: var(--c-deep, #2B3534);
}

/* ── Scanner scene (face + scan-line + vital pills) ───────── */
.cine--scanner .cine-overlay {
  align-items: center;
  justify-content: flex-start;
  padding-left: clamp(20px, 6vw, 96px);
}
.cine-scanner-stack {
  align-items: flex-start;
  text-align: left;
  max-width: 560px;
}
/* Face POV restored to match the previous slideshow layout: anchored to
   the right edge, full-viewport-tall, soft left-edge mask fading into bg.
   Vertical centering uses `margin-top: calc()` instead of `transform:
   translateY(-50%)` so GSAP can animate `xPercent` for entrance without
   colliding with the centering transform. */
.cine-scanner-face {
  position: absolute;
  right: -3%;
  top: 50%;
  margin-top: calc(0px - min(86vh, 880px) / 2);
  height: min(86vh, 880px);
  width: auto;
  z-index: 2;
  pointer-events: none;
  opacity: 0.94;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,0.30) 18%, #000 48%);
          mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,0.30) 18%, #000 48%);
  filter: saturate(1.06) contrast(1.04);
  will-change: transform, opacity;
}
.cine-scanner-stack {
  align-items: flex-start;
  text-align: left;
  max-width: 560px;
  position: relative;
  z-index: 4;
}

@media (max-width: 1024px) {
  .cine-scanner-face {
    height: min(70vh, 720px);
    margin-top: calc(0px - min(70vh, 720px) / 2);
    right: -8%;
    opacity: 0.78;
  }
  .cine-scanner-stack { max-width: 460px; }
}

@media (max-width: 768px) {
  .cine--scanner .cine-overlay { justify-content: center; }
  .cine-scanner-face {
    height: 58vh;
    top: auto;
    bottom: 4%;
    margin-top: 0;
    right: -14%;
    opacity: 0.38;
    -webkit-mask-image: radial-gradient(ellipse at 70% 50%, #000 22%, transparent 72%);
            mask-image: radial-gradient(ellipse at 70% 50%, #000 22%, transparent 72%);
  }
  .cine-scanner-stack {
    align-items: center;
    text-align: center;
    margin: 0 auto;
    max-width: 100%;
  }
}

/* Scan-line sweep cyan */
.cine-scanner-scanline {
  position: absolute;
  left: 38vw;
  right: -4vw;
  top: 0;
  height: 6vh;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(132,204,250,0.18) 30%,
    rgba(132,204,250,0.85) 50%,
    rgba(132,204,250,0.18) 70%,
    transparent 100%);
  opacity: 0;
  transform: translateY(-20vh);
  will-change: transform, opacity;
  mix-blend-mode: screen;
}
@media (max-width: 900px) {
  .cine-scanner-scanline { left: 0; right: 0; }
}

/* Floating vital pills */
.cine-vitals {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}
.cine-vital {
  position: absolute;
  pointer-events: none;
  background: rgba(15,22,21,0.78);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 999px;
  padding: 9px 16px;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
  opacity: 0;
  will-change: transform, opacity;
}
.cine-vital strong {
  font-family: 'Inria Serif', serif;
  font-weight: 400;
  font-size: 18px;
  color: var(--c-accent, #C4D6C5);
}
.cine-vital[data-vital="hr"]   { top: 22vh; right: 18vw; }
.cine-vital[data-vital="hrv"]  { top: 42vh; right: 8vw;  }
.cine-vital[data-vital="spo2"] { top: 62vh; right: 22vw; }
.cine-vital[data-vital="temp"] { top: 78vh; right: 12vw; }
@media (max-width: 900px) {
  .cine-vital[data-vital="hr"]   { top: 18vh; right: 4vw;  }
  .cine-vital[data-vital="hrv"]  { top: 28vh; right: 24vw; }
  .cine-vital[data-vital="spo2"] { top: 72vh; right: 6vw;  }
  .cine-vital[data-vital="temp"] { top: 82vh; right: 32vw; }
}

/* ── CTA scene ─────────────────────────────────────────────── */
.cine--cta .cine-overlay { padding-bottom: 14vh; }
.cine-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 18px 30px;
  border-radius: 999px;
  background: var(--c-accent, #C4D6C5);
  color: var(--c-deep, #2B3534);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.02em;
  text-decoration: none;
  position: relative;
  isolation: isolate;
  will-change: transform, opacity;
  transition: transform .2s ease-out;
}
.cine-cta-btn::after {
  content: '';
  position: absolute; inset: -8px;
  border-radius: inherit;
  background: radial-gradient(closest-side, rgba(196,214,197,0.6), transparent 70%);
  z-index: -1;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity .4s ease-out, transform .6s ease-out;
}
.cine-cta-btn:hover { transform: translateY(-2px); }
.cine-cta-btn:hover::after { opacity: 1; transform: scale(1.15); }

.cine-cta-link {
  font-family: 'Inria Serif', serif;
  font-style: italic;
  font-size: 15px;
  color: rgba(255,255,255,0.78);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.3);
  padding-bottom: 2px;
  will-change: opacity;
}
.cine-cta-link:hover { color: #fff; }

.cine-trust {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  will-change: opacity;
}

.cine-cta-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-top: 12px;
}

/* ── Footer ────────────────────────────────────────────────── */
.cine-footer {
  background: var(--c-deep-2, #1f2827);
  color: rgba(255,255,255,0.78);
  padding: 80px clamp(20px, 6vw, 96px) 40px;
  position: relative;
  z-index: 2;
}
.cine-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 48px;
}
@media (max-width: 900px) {
  .cine-footer-inner { grid-template-columns: 1fr 1fr; gap: 36px; }
}
.cine-footer-brand {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cine-footer-tagline {
  font-family: 'Inria Serif', serif;
  font-style: italic;
  font-size: 17px;
  line-height: 1.45;
  color: rgba(255,255,255,0.7);
  max-width: 28ch;
}
.cine-footer-col h4 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  margin: 0 0 18px;
  font-weight: 600;
}
.cine-footer-col a {
  display: block;
  font-size: 14.5px;
  color: rgba(255,255,255,0.78);
  text-decoration: none;
  padding: 6px 0;
  transition: color .2s;
}
.cine-footer-col a:hover { color: #fff; }
.cine-footer-bottom {
  max-width: 1280px;
  margin: 64px auto 0;
  padding-top: 28px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
}
.cine-footer-copyright {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.04em;
}
.cine-footer-social {
  display: flex;
  gap: 14px;
}
.cine-footer-social a {
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  transition: background .2s, color .2s;
}
.cine-footer-social a:hover { background: rgba(255,255,255,0.14); color: #fff; }

/* Hide the dev scroll-velocity meter — only show with ?debug=1 query */
.vfx-velocity { display: none; }
body[data-debug] .vfx-velocity { display: block; }

/* ── Progress dots (reuse imv-progress from existing CSS) ── */
/* No new styles needed — existing imv-progress works because the Nav
   component still renders identical markup. activeIndex now comes from
   ScrollTrigger callbacks instead of Math.round(progress*3). */

/* ── Mobile light-pin reductions ───────────────────────────── */
@media (pointer: coarse) {
  /* Soften filter usage on the world canvas — already neutralized in
     scroll-vfx but disable any residual filters from the cinema layer */
  .cine-bg-video { will-change: auto; }
  /* Hide decorative parallax layers on touch (perf) */
  .cine-bg-layer--glyphs { display: none; }
  /* Pin scrub on iOS: reduce scene height slightly so total page is shorter */
  .cine { height: 220vh; }
  .cine--cta { height: 180vh; }
}

/* ── Mobile layout tweaks for Steps (≤700px viewport width) ───
   The previous distribution felt crowded on phones because lead text +
   stacked full-width cards exceeded the pin height. Hide the lead and
   tighten card typography so all 4 cards breathe inside a 2×2 grid. */
@media (max-width: 700px) {
  .cine--steps .cine-overlay {
    padding-top: 10vh;
    padding-bottom: 4vh;
  }
  .cine--steps .cine-h2 {
    font-size: 26px;
    line-height: 1.1;
    max-width: 14ch;
  }
  .cine--steps .cine-lead {
    display: none;
  }
  .cine-step {
    padding: 14px 12px 12px;
    min-height: 0;
    gap: 6px;
    border-radius: 14px;
  }
  .cine-step-num { font-size: 24px; }
  .cine-step h3 { font-size: 14.5px; line-height: 1.2; }
  .cine-step p { font-size: 11.5px; line-height: 1.45; }
  .cine-step-time { font-size: 9px; letter-spacing: 0.18em; }
  .cine-step-time::before { width: 12px; }
}

/* ── Reduced motion ────────────────────────────────────────── */
/* NOTE: do NOT skip the cinema layer on prefers-reduced-motion (Windows
   default trap, lesson 2026-05-18). Only soften parallax bg movement. */
@media (prefers-reduced-motion: reduce) {
  .cine-bg-layer--glyphs { display: none; }
}

/* ── Scroll hint at hero ───────────────────────────────────── */
.cine-scroll-hint {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  pointer-events: none;
  transition: opacity .4s ease-out;
}
.cine-scroll-hint--hidden { opacity: 0; }
.cine-scroll-hint-arrow {
  width: 1px; height: 28px;
  background: rgba(255,255,255,0.6);
  position: relative;
  animation: cine-scroll-arrow 1.8s ease-in-out infinite;
}
.cine-scroll-hint-arrow::after {
  content: '';
  position: absolute;
  bottom: 0; left: -3px;
  width: 7px; height: 7px;
  border-right: 1px solid rgba(255,255,255,0.6);
  border-bottom: 1px solid rgba(255,255,255,0.6);
  transform: rotate(45deg) translate(-1px, -1px);
}
@keyframes cine-scroll-arrow {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50%      { transform: translateY(8px); opacity: 1; }
}

/* ── Legal mini-footer ────────────────────────────────────────────────────
   Compulsory under LFPDPPP Art 17 + Lineamientos INAI Cap III §39 (Aviso de
   Privacidad disponible permanentemente) + LFPC Art 76 Bis I/III. One-line,
   subtle, ends the cinematic scroll. Wraps to multi-line on mobile. */
.legal-mini-footer {
  position: relative;
  padding: 28px 24px 36px;
  background: var(--cine-bg-soft, #0a0c0e);
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 2;
}
.legal-mini-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
  font-family: 'Inter', system-ui, sans-serif;
}
.legal-mini-footer a {
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  transition: color 0.18s ease;
}
.legal-mini-footer a:hover,
.legal-mini-footer a:focus {
  color: rgba(255, 255, 255, 0.95);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.legal-mini-sep {
  color: rgba(255, 255, 255, 0.25);
  user-select: none;
}
.legal-mini-copy {
  color: rgba(255, 255, 255, 0.55);
}
.legal-mini-ig {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.legal-mini-ig svg {
  opacity: 0.8;
  transition: opacity 0.18s ease;
}
.legal-mini-ig:hover svg {
  opacity: 1;
}

@media (max-width: 640px) {
  .legal-mini-footer { padding: 22px 18px 28px; font-size: 11.5px; }
  .legal-mini-inner { gap: 4px 8px; }
}
