/* =========================================================================
   landing.css  ·  Cinemático Documental (dark mode)
   Optimizado para 120fps: transform + opacity únicamente, GPU compositing,
   crossfades con curva filmica, sin reflow ni layout thrash.
   ========================================================================= */

:root {
  --fondo: #0E1210;
  --texto: #E8E4DA;
  --verde: #8FA386;
  --oro: #C6A664;
  --letter: 40px;

  /* Curvas cinemáticas — film-grade easing */
  --ease-dissolve: cubic-bezier(0.33, 0, 0.67, 1);   /* crossfade balanceado */
  --ease-rise:     cubic-bezier(0.22, 1, 0.36, 1);   /* aparición suave */
  --ease-kenburns: cubic-bezier(0.45, 0, 0.55, 1);   /* movimiento continuo */

  /* Duraciones */
  --dur-crossfade: 2200ms;
  --dur-rise:      1600ms;
  --dur-scene:     8000ms;
}

* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

html, body {
  background: var(--fondo);
  color: var(--texto);
  font-family: 'Jost', system-ui, -apple-system, sans-serif;
  font-weight: 300;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

.cinema {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: var(--fondo);
  /* compositor-layer para todo el stage */
  transform: translateZ(0);
  will-change: transform;
}

/* ------------------------------------------------------------------
   Letterboxing (barras cinema) — estáticas, sin wind-up
   ------------------------------------------------------------------ */
.letter {
  position: fixed;
  left: 0;
  right: 0;
  height: var(--letter);
  background: #000;
  z-index: 80;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
}
.letter--top    { top: 0; }
.letter--bottom { bottom: 0; }

/* ------------------------------------------------------------------
   Grano cinemático (subtil, GPU-layer independiente)
   ------------------------------------------------------------------ */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 70;
  opacity: .045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  transform: translateZ(0);
  will-change: transform;
}

/* ------------------------------------------------------------------
   Logo tenue + controles persistentes
   ------------------------------------------------------------------ */
.top-logo {
  position: fixed;
  top: calc(var(--letter) + 16px);
  left: 22px;
  z-index: 90;
  opacity: .55;
  transition: opacity .4s var(--ease-rise);
  transform: translateZ(0);
}
.top-logo img { height: 24px; width: auto; display: block; }
.top-logo:hover,
.top-logo:focus-visible { opacity: 1; }

.skip-btn {
  position: fixed;
  top: calc(var(--letter) + 14px);
  right: 22px;
  z-index: 90;
  color: var(--texto);
  font-family: 'Jost', sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .2em;
  text-transform: uppercase;
  padding: 10px 14px;
  border: 1px solid rgba(232, 228, 218, .25);
  border-radius: 2px;
  background: rgba(14, 18, 16, .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  transform: translateZ(0);
  transition: background .3s var(--ease-rise),
              border-color .3s var(--ease-rise),
              color .3s var(--ease-rise);
}
.skip-btn:hover,
.skip-btn:focus-visible {
  background: rgba(198, 166, 100, .14);
  border-color: var(--oro);
  color: var(--oro);
  outline: none;
}

/* Progress bar — transform scaleX (no reflow) */
.progress {
  position: fixed;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: rgba(255, 255, 255, .06);
  z-index: 85;
  transform: translateZ(0);
}
.progress__fill {
  height: 100%;
  width: 100%;                      /* full width fijo */
  transform: scaleX(0);             /* animamos scaleX */
  transform-origin: left center;
  background: var(--oro);
  opacity: .65;
  will-change: transform;
}

/* ------------------------------------------------------------------
   Capas de capítulo (scenes) — GPU layer, crossfade filmico
   ------------------------------------------------------------------ */
.scene {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
  transform: translateZ(0);
  will-change: opacity;
  transition: opacity var(--dur-crossfade) var(--ease-dissolve);
}
.scene.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 11;                      /* incoming por encima del saliente */
}

.scene__img,
.scene__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02) translate3d(0, 0, 0);
  will-change: transform;
  /* tono cinemático: el movimiento lo aporta el video */
  filter: contrast(1.035) brightness(.965) saturate(1.02);
  pointer-events: none;
}
/* sutil drift + escala para reforzar profundidad mientras el video corre */
.scene.active .scene__video,
.scene.active .scene__img {
  animation: scene-breath 9s var(--ease-kenburns) forwards;
}
@keyframes scene-breath {
  from { transform: scale(1.02) translate3d(0, 0, 0); }
  to   { transform: scale(1.06) translate3d(-0.6%, -0.4%, 0); }
}

.scene__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(14, 18, 16, 0)    0%,
    rgba(14, 18, 16, 0)    32%,
    rgba(14, 18, 16, .35) 62%,
    rgba(14, 18, 16, .92) 100%
  );
  z-index: 2;
  transform: translateZ(0);
}

/* Caption bottom-left estilo subtítulo de película */
.scene__caption {
  position: absolute;
  bottom: calc(var(--letter) + 64px);
  left: 48px;
  right: 48px;
  max-width: 760px;
  z-index: 3;
  font-family: 'Spectral', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(28px, 4.6vw, 46px);
  line-height: 1.18;
  color: var(--texto);
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  will-change: transform, opacity;
  text-shadow: 0 2px 30px rgba(0, 0, 0, .35);
}
.scene.active .scene__caption {
  animation: rise var(--dur-rise) var(--ease-rise) .65s forwards;
}
@keyframes rise {
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.scene__coords {
  position: absolute;
  top: calc(var(--letter) + 18px);
  right: 160px;
  font-family: 'Jost', sans-serif;
  font-size: 12px;
  letter-spacing: .14em;
  color: rgba(232, 228, 218, .6);
  z-index: 3;
  opacity: 0;
  transform: translate3d(0, 6px, 0);
  will-change: transform, opacity;
}
.scene.active .scene__coords {
  animation: rise 1400ms var(--ease-rise) .9s forwards;
}

/* subrayado manuscrito oro */
.underline-svg {
  display: block;
  margin-top: 14px;
  width: 240px;
  max-width: 70%;
  height: 14px;
  stroke: var(--oro);
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  filter: drop-shadow(0 1px 8px rgba(198, 166, 100, .25));
}
.scene.active .underline-svg {
  animation: ink 1.6s var(--ease-rise) 1.4s forwards;
}
@keyframes ink {
  to { stroke-dashoffset: 0; }
}

/* ------------------------------------------------------------------
   Apertura (texto sobre negro) — fade inicial limpio
   ------------------------------------------------------------------ */
.opening {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 20;
  background: var(--fondo);
  text-align: center;
  padding: 0 24px;
  opacity: 0;
  transform: translateZ(0);
  will-change: opacity;
  transition: opacity 1800ms var(--ease-dissolve);
}
.opening.active { opacity: 1; z-index: 21; }

.opening__title {
  font-family: 'Spectral', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(36px, 7vw, 68px);
  color: var(--texto);
  line-height: 1.1;
  margin: 0;
  opacity: 0;
  transform: translate3d(0, 12px, 0);
}
.opening.active .opening__title {
  animation: rise 1400ms var(--ease-rise) 250ms forwards;
}
.opening__eyebrow {
  margin-top: 22px;
  font-family: 'Jost', sans-serif;
  font-size: 11px;
  letter-spacing: .34em;
  color: rgba(232, 228, 218, .55);
  text-transform: uppercase;
  opacity: 0;
}
.opening.active .opening__eyebrow {
  animation: fadein 1200ms var(--ease-rise) 700ms forwards;
}

/* ------------------------------------------------------------------
   Cierre — por encima del stack
   ------------------------------------------------------------------ */
.closing {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 30;
  background: radial-gradient(
    ellipse at center,
    rgba(14, 18, 16, .82) 0%,
    rgba(14, 18, 16, .98) 70%
  );
  opacity: 0;
  pointer-events: none;
  text-align: center;
  padding: 0 24px;
  transform: translateZ(0);
  will-change: opacity;
  transition: opacity 1800ms var(--ease-dissolve);
}
.closing.active {
  opacity: 1;
  pointer-events: auto;
}

.closing__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: .35;
  z-index: -1;
  filter: blur(2px) brightness(.75);
  transform: scale(1.06) translateZ(0);
}

.closing__logo {
  width: 110px;
  height: auto;
  margin-bottom: 18px;
  opacity: 0;
  transform: translate3d(0, 8px, 0);
}
.closing.active .closing__logo {
  animation: rise 1200ms var(--ease-rise) 300ms forwards;
}

.closing__title {
  font-family: 'Spectral', Georgia, serif;
  font-size: clamp(22px, 3.2vw, 30px);
  font-weight: 500;
  letter-spacing: .02em;
  opacity: 0;
  margin: 0;
  transform: translate3d(0, 8px, 0);
}
.closing.active .closing__title {
  animation: rise 1200ms var(--ease-rise) 600ms forwards;
}

.closing__sub {
  margin-top: 8px;
  font-family: 'Jost', sans-serif;
  font-size: 11px;
  letter-spacing: .3em;
  color: rgba(232, 228, 218, .65);
  opacity: 0;
  text-transform: uppercase;
}
.closing.active .closing__sub {
  animation: fadein 1000ms var(--ease-rise) 900ms forwards;
}

.closing__cta {
  margin-top: 36px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 18px 34px;
  font-family: 'Jost', sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--oro);
  border: 1.5px solid var(--oro);
  border-radius: 2px;
  background: transparent;
  text-decoration: none;
  cursor: pointer;
  opacity: 0;
  transform: translate3d(0, 10px, 0);
  min-height: 44px;
  will-change: transform, background, color;
  transition: background .45s var(--ease-rise),
              color .45s var(--ease-rise),
              transform .45s var(--ease-rise);
}
.closing.active .closing__cta {
  animation: rise 1200ms var(--ease-rise) 1300ms forwards;
}
.closing__cta:hover,
.closing__cta:focus-visible {
  background: var(--oro);
  color: #0E1210;
  transform: translate3d(0, -2px, 0);
  outline: none;
}
.closing__cta .arrow {
  font-size: 1.2em;
  transition: transform .3s var(--ease-rise);
  display: inline-block;
}
.closing__cta:hover .arrow,
.closing__cta:focus-visible .arrow {
  transform: translate3d(3px, -3px, 0);
}

@keyframes fadein { to { opacity: 1; } }

/* Skip link (accesibilidad) */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px; height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  left: 20px; top: 20px;
  width: auto; height: auto;
  background: var(--oro); color: #0E1210;
  padding: 10px 14px; z-index: 100;
  border-radius: 2px;
  font-family: 'Jost', sans-serif; font-size: 13px;
}

/* ------------------------------------------------------------------
   Reduced motion — salto directo, sin movimiento
   ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .scene,
  .opening,
  .closing { transition: none; }

  .scene.active .scene__img,
  .scene.active .scene__video,
  .scene.active .scene__caption,
  .scene.active .scene__coords,
  .scene.active .underline-svg,
  .opening.active .opening__title,
  .opening.active .opening__eyebrow,
  .closing.active .closing__logo,
  .closing.active .closing__title,
  .closing.active .closing__sub,
  .closing.active .closing__cta { animation: none; }

  .scene.active .scene__img,
  .scene.active .scene__video { transform: scale(1.04); }
  .scene.active .scene__caption,
  .scene.active .scene__coords,
  .opening.active .opening__title,
  .opening.active .opening__eyebrow,
  .closing.active .closing__logo,
  .closing.active .closing__title,
  .closing.active .closing__sub,
  .closing.active .closing__cta {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
  .scene.active .underline-svg { stroke-dashoffset: 0; }
  .progress__fill { display: none; }
}

/* ------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------ */
@media (max-width: 768px) {
  :root { --letter: 28px; }
  .scene__caption {
    font-size: clamp(22px, 6.4vw, 32px);
    left: 24px; right: 24px;
    bottom: calc(var(--letter) + 44px);
  }
  .scene__coords { right: 110px; font-size: 10px; }
  .skip-btn { font-size: 10px; padding: 8px 10px; letter-spacing: .15em; }
  .top-logo img { height: 20px; }
  .closing__cta { padding: 14px 22px; font-size: 12px; letter-spacing: .18em; }
}

@media (max-width: 480px) {
  .scene__coords { display: none; }
}
