/* ============ NUTREVO — Scrollytelling ============ */
:root {
  --bg: #ffffff;
  --ink: #1a1611;                 /* JS lo interpola: oscuro (arriba) -> claro (café) */
  --ink-dim: rgba(26, 22, 17, 0.6);
  --scrim: 255,255,255;           /* JS lo lleva de BLANCO -> CAFÉ al scrollear */
  --accent: #2f7d43;              /* verde de marca */
  --accent-hi: #4aa85c;
  --choco: #2a1710;               /* café oscuro (fondo de la escena del alfajor) */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* Focus visible para navegación por teclado (accesibilidad) */
a:focus-visible,
.cta__button:focus-visible,
.header__cta:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Barra de progreso de scroll */
.progress {
  position: fixed; top: 0; left: 0;
  height: 3px; width: 0;
  background: var(--accent);
  z-index: 60;
}

/* Respeta usuarios que prefieren menos movimiento */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .marquee__track,
  .hero__scroll-hint { animation: none !important; }
  [data-anim] .section__inner > *,
  [data-anim] .stats__grid > *,
  [data-anim] .cta__inner > * {
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- Loader ---- */
.loader {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; flex-direction: column; gap: 2rem;
  align-items: center; justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.loader.done { opacity: 0; visibility: hidden; }
.loader__brand {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 900; letter-spacing: 0.35em;
}
.loader__bar {
  width: min(280px, 60vw); height: 2px;
  background: rgba(26,22,17,0.12); overflow: hidden;
}
.loader__fill {
  width: 0%; height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}

/* ---- Header ---- */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.4rem clamp(1.2rem, 4vw, 3rem);
  background: transparent;
  transition: background 0.35s ease, backdrop-filter 0.35s ease, border-color 0.35s ease;
}
/* Al scrollear: franja translúcida que acompaña el tema (blanco -> café) */
.header.scrolled {
  background: rgba(var(--scrim), 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(var(--scrim), 0.001);
}
.header.scrolled .header__logo,
.header.scrolled .header__nav a { color: var(--ink); text-shadow: none; }
.header.scrolled .header__cta { border-color: var(--ink); }
.header__logo { font-weight: 900; letter-spacing: 0.3em; font-size: 1rem; }
.header__nav { display: flex; gap: 1.8rem; align-items: center; }
.header__nav a {
  color: var(--ink); text-decoration: none;
  font-size: 0.82rem; font-weight: 500; letter-spacing: 0.08em;
  text-transform: uppercase;
}
.header__cta {
  border: 1px solid var(--ink);
  padding: 0.6rem 1.2rem; border-radius: 999px;
  min-height: 44px; display: inline-flex; align-items: center;  /* tap target táctil */
}

/* ---- Hero ---- */
.hero {
  min-height: 100vh;
  min-height: 100svh;   /* móvil: nunca más alto que el viewport visible (barra URL) */
  display: flex; flex-direction: column;
  justify-content: center;
  padding: 0 clamp(1.2rem, 5vw, 4rem);
  position: relative; z-index: 5;
  /* Velo inicial BLANCO (coincide con heroP=0 del JS): aclara el video para leer texto oscuro */
  background:
    radial-gradient(120% 95% at 22% 46%, rgba(255,255,255,0.82) 0%, rgba(255,255,255,0) 60%),
    linear-gradient(180deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.84) 52%, rgba(255,255,255,0.9) 100%);
}
.hero__label {
  font-size: 0.85rem; letter-spacing: 0.35em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin-bottom: 1.5rem;
}
.hero__heading {
  font-size: clamp(3rem, 13vw, 13rem);
  font-weight: 900; line-height: 0.86; letter-spacing: -0.055em;
  overflow-wrap: break-word;   /* evita recorte en pantallas muy angostas */
  text-shadow: 0 2px 24px rgba(255,255,255,0.75);
}
.hero__sub {
  margin-top: 2rem; font-size: clamp(1rem, 1.6vw, 1.25rem);
  color: var(--ink-dim); max-width: 34ch;
  text-shadow: 0 1px 16px rgba(255,255,255,0.8);
}
.hero__scroll-hint {
  position: absolute; bottom: 2.5rem; left: 50%;
  transform: translateX(-50%);
  font-size: 1.4rem; color: var(--ink-dim);
  animation: bob 1.8s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translate(-50%, 10px); } }

/* ---- Canvas fijo ---- */
#frameCanvas {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  height: 100dvh;   /* cubre el viewport dinámico en móvil */
  z-index: 1;
}
/* Scrim constante sobre el canvas: garantiza lectura del texto de las secciones */
.canvas-scrim {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg,
    rgba(var(--scrim),0.70) 0%, rgba(var(--scrim),0.48) 42%, rgba(var(--scrim),0.70) 100%);
}
.dark-overlay {
  position: fixed; inset: 0; z-index: 2;
  background: rgba(var(--scrim), 0.84);
  opacity: 0; pointer-events: none;
  transition: opacity 0.6s ease;
}

/* ---- Reveals de secciones (IntersectionObserver → .in) ---- */
[data-anim] .section__inner > *,
[data-anim] .stats__grid > *,
[data-anim] .cta__inner > * {
  opacity: 0;
  transform: translateY(42px);
  transition: opacity 0.9s cubic-bezier(.16,1,.3,1), transform 0.9s cubic-bezier(.16,1,.3,1);
}
[data-anim].in .section__inner > *,
[data-anim].in .stats__grid > *,
[data-anim].in .cta__inner > * {
  opacity: 1;
  transform: none;
}
[data-anim].in .section__inner > *:nth-child(2) { transition-delay: 0.08s; }
[data-anim].in .section__inner > *:nth-child(3) { transition-delay: 0.16s; }
[data-anim].in .stats__grid > *:nth-child(2) { transition-delay: 0.10s; }
[data-anim].in .stats__grid > *:nth-child(3) { transition-delay: 0.20s; }
[data-anim].in .stats__grid > *:nth-child(4) { transition-delay: 0.30s; }
[data-anim].in .cta__inner > *:nth-child(2) { transition-delay: 0.10s; }
[data-anim].in .cta__inner > *:nth-child(3) { transition-delay: 0.20s; }

/* ---- Secciones ---- */
.scroll-content { position: relative; z-index: 3; }
.section {
  min-height: 160vh;
  display: flex; align-items: center;
}
.section--left  { justify-content: flex-start; }
.section--right { justify-content: flex-end; }
.section__inner {
  width: min(40vw, 560px);
  padding: 0 clamp(1.2rem, 4vw, 4rem);
}
.section__label {
  font-size: 0.8rem; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin-bottom: 1.1rem;
}
.section__heading {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 900; line-height: 1.02; letter-spacing: -0.015em;
  margin-bottom: 1.4rem;
  text-shadow: 0 2px 24px rgba(0,0,0,0.55);
}
.section__body {
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  line-height: 1.65; color: var(--ink-dim);
  text-shadow: 0 1px 16px rgba(0,0,0,0.6);
}

/* ---- Marquee VERTICAL (pegado a un costado, no tapa el producto) ---- */
.marquee {
  overflow: hidden;
  position: relative; z-index: 3;
  height: 78vh;
  display: flex; align-items: center;
  justify-content: flex-end;              /* por defecto: a la derecha */
  padding: 0 clamp(0.8rem, 2.5vw, 2rem);
  pointer-events: none;
}
.marquee--reverse { justify-content: flex-start; } /* el segundo: a la izquierda */
.marquee__track {
  writing-mode: vertical-rl;              /* texto en vertical */
  display: inline-block; white-space: nowrap;
  font-size: clamp(1.2rem, 2.8vw, 2.2rem);
  font-weight: 900; letter-spacing: 0.02em;
  color: transparent;
  -webkit-text-stroke: 1.1px rgba(26,22,17,0.38);
  will-change: transform;
  animation: marquee-y 34s linear infinite;
}
.marquee--reverse .marquee__track { animation-direction: reverse; }
@keyframes marquee-y { from { transform: translateY(0); } to { transform: translateY(-50%); } }

/* Variante HORIZONTAL (tira fina) */
.marquee--h {
  height: auto; display: block;
  padding: 1.4rem 0;
}
.marquee--h .marquee__track {
  writing-mode: horizontal-tb;
  animation-name: marquee-x;
}
@keyframes marquee-x { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---- Stats ---- */
.section--stats {
  min-height: 140vh;
  justify-content: center;
}
.stats__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(1.6rem, 4vw, 4.5rem);
  text-align: center;
  padding: 0 clamp(1.2rem, 4vw, 4rem);
}
.stat__value {
  font-size: clamp(3.5rem, 9vw, 8rem);
  font-weight: 900; color: var(--accent);
  line-height: 1;
  text-shadow: 0 3px 20px rgba(0,0,0,0.6);   /* nitidez sobre el café */
}
.stat__label {
  margin-top: 0.6rem;
  font-size: clamp(0.9rem, 1.3vw, 1.05rem);
  color: var(--ink);                          /* más claro, se lee mejor */
  font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.stat__detail {
  margin: 0.45rem auto 0;
  max-width: 20ch;
  font-size: clamp(0.74rem, 1vw, 0.85rem);
  line-height: 1.45; letter-spacing: 0.01em;
  color: var(--ink-dim);
}

/* ---- CTA ---- */
.section--cta {
  min-height: 120vh;
  justify-content: flex-start;
  align-items: flex-end;
  padding-bottom: 14vh;
}
.cta__inner { padding: 0 clamp(1.2rem, 5vw, 4rem); }
.cta__heading {
  font-size: clamp(2.5rem, 10vw, 9rem);
  font-weight: 900; line-height: 0.95; letter-spacing: -0.02em;
  margin-bottom: 2.4rem;
  text-shadow: 0 2px 24px rgba(0,0,0,0.55);
  overflow-wrap: break-word;   /* "Actívate." no se corta en ≤380px */
}
.cta__button {
  display: inline-block;
  background: var(--accent); color: #ffffff;
  text-decoration: none; font-weight: 700;
  font-size: clamp(1rem, 1.6vw, 1.3rem);
  padding: 1.1rem 2.6rem; border-radius: 999px;
  letter-spacing: 0.04em;
  transition: transform 0.25s ease, background 0.25s ease;
}
.cta__button:hover { transform: translateY(-3px) scale(1.02); background: var(--accent-hi); }
.cta__note {
  margin-top: 1.6rem; font-size: 0.85rem;
  color: var(--ink-dim); letter-spacing: 0.12em; text-transform: uppercase;
}

/* ---- Tablet (puente entre desktop y móvil) ---- */
@media (max-width: 1024px) {
  .section { min-height: 150vh; }
  .section__inner { width: min(56vw, 560px); }
  .stats__grid { gap: clamp(1.4rem, 3vw, 3rem); }
}

/* ---- Mobile ---- */
@media (max-width: 820px) {
  .header__nav a:not(.header__cta) { display: none; }
  /* Legibilidad garantizada: scrim que acompaña el tema */
  .header {
    background: linear-gradient(180deg, rgba(var(--scrim),0.85) 0%, rgba(var(--scrim),0) 100%);
  }
  .section__inner { width: min(86vw, 560px); }
  .section { min-height: 130vh; }
  .stats__grid { grid-template-columns: repeat(2, 1fr); gap: 2.4rem; }
  /* Móvil: oculta el texto narrativo del brownie para no tapar la etiqueta del producto (viene en el video) */
  .section--left .section__inner,
  .section--right .section__inner { display: none; }
}

/* ============ ALFAJOR — segundo producto (video reel) ============ */

/* Divisor: reutiliza el marquee horizontal, en barra verde */
.alf-divider {
  position: relative; z-index: 4;
  background: var(--accent);
  padding: 1rem 0;
}
.alf-divider .marquee__track {
  color: #08130b;
  -webkit-text-stroke: 0;
  font-size: clamp(1rem, 2.2vw, 1.7rem);
  font-weight: 900; letter-spacing: 0.04em;
  animation-duration: 26s;
}

/* Sección: OPACA para tapar el canvas fijo del brownie */
.alfajor {
  position: relative; z-index: 4;
  padding: clamp(4rem, 10vw, 8rem) clamp(1.2rem, 5vw, 5rem) clamp(5rem, 12vw, 9rem);
  background:
    radial-gradient(80% 60% at 78% 30%, rgba(74,168,92,0.10) 0%, rgba(74,168,92,0) 60%),
    linear-gradient(180deg, var(--choco) 0%, var(--bg) 55%, #080504 100%);
  overflow: hidden;
}
.alfajor__glow {
  position: absolute; top: 12%; right: 6%;
  width: min(560px, 70vw); aspect-ratio: 1;
  background: radial-gradient(circle, rgba(99,200,119,0.22) 0%, rgba(99,200,119,0) 70%);
  filter: blur(20px); pointer-events: none; z-index: 0;
}
.alfajor__inner {
  position: relative; z-index: 1;
  max-width: 1200px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr minmax(280px, 380px);
  gap: clamp(2rem, 6vw, 6rem); align-items: center;
}

/* Columna de copy */
.alfajor__label {
  font-size: 0.8rem; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--accent-hi); font-weight: 700; margin-bottom: 1.1rem;
}
.alfajor__heading {
  font-size: clamp(2.6rem, 6.5vw, 5rem);
  font-weight: 900; line-height: 0.9; letter-spacing: -0.03em;
  margin-bottom: 1.4rem;
}
.alfajor__body {
  font-size: clamp(1rem, 1.4vw, 1.18rem);
  line-height: 1.65; color: var(--ink-dim); max-width: 42ch;
}
.alfajor__feats {
  list-style: none; display: flex; flex-wrap: wrap; gap: 0.6rem;
  margin: 1.6rem 0 2rem;
}
.alfajor__feats li {
  font-size: 0.82rem; font-weight: 600; letter-spacing: 0.02em;
  color: var(--ink);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(245,239,233,0.12);
  padding: 0.5rem 0.95rem; border-radius: 999px;
}
.alfajor__cta {
  display: inline-flex; align-items: center; min-height: 48px;
  background: var(--accent); color: #08130b;
  text-decoration: none; font-weight: 800;
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  padding: 0.9rem 2.2rem; border-radius: 999px; letter-spacing: 0.02em;
  transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 12px 34px rgba(74,168,92,0.35);
}
.alfajor__cta:hover {
  transform: translateY(-3px) scale(1.02);
  background: var(--accent-hi);
  box-shadow: 0 18px 44px rgba(99,200,119,0.45);
}
.alfajor__note {
  margin-top: 1.4rem; font-size: 0.78rem;
  color: var(--ink-dim); letter-spacing: 0.1em; text-transform: uppercase;
}

/* Reel vertical (9:16) enmarcado */
.alfajor__stage { display: flex; justify-content: center; }
.alfajor__reel {
  position: relative;
  width: min(340px, 80vw); aspect-ratio: 9 / 16;
  border-radius: 26px; overflow: hidden;
  border: 1px solid rgba(245,239,233,0.14);
  box-shadow: 0 40px 90px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.03) inset;
  background: #000;
}
.alfajor__video {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.alfajor__badge {
  position: absolute; top: 14px; left: 14px;
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink); background: rgba(13,8,6,0.55);
  padding: 0.32rem 0.7rem; border-radius: 999px;
  backdrop-filter: blur(6px);
}

/* Reveals por scroll (usa el IntersectionObserver existente: .in) */
.alfajor .alfajor__copy > *,
.alfajor .alfajor__reel {
  opacity: 0; transform: translateY(44px);
  transition: opacity 0.9s cubic-bezier(.16,1,.3,1), transform 0.9s cubic-bezier(.16,1,.3,1);
}
.alfajor .alfajor__reel { transform: translateY(44px) scale(0.94); }
.alfajor.in .alfajor__copy > *,
.alfajor.in .alfajor__reel { opacity: 1; transform: none; }
.alfajor.in .alfajor__copy > *:nth-child(2) { transition-delay: 0.08s; }
.alfajor.in .alfajor__copy > *:nth-child(3) { transition-delay: 0.16s; }
.alfajor.in .alfajor__copy > *:nth-child(4) { transition-delay: 0.24s; }
.alfajor.in .alfajor__copy > *:nth-child(5) { transition-delay: 0.32s; }
.alfajor.in .alfajor__reel { transition-delay: 0.12s; }

/* Responsive: apilar, video primero */
@media (max-width: 820px) {
  .alfajor__inner { grid-template-columns: 1fr; gap: 2.6rem; }
  .alfajor__stage { order: -1; }
  .alfajor__heading { font-size: clamp(2.4rem, 11vw, 4rem); }
}

@media (prefers-reduced-motion: reduce) {
  .alf-divider .marquee__track { animation: none !important; }
  .alfajor .alfajor__copy > *,
  .alfajor .alfajor__reel {
    opacity: 1 !important; transform: none !important; transition: none !important;
  }
}

/* ---- ALFAJOR: escena frame-sequence (canvas sticky + captions pinneadas) ---- */
.alf2 {
  position: relative; z-index: 4;
  height: 360vh;                 /* largo de scroll para reproducir los frames */
  background: #0d0806;           /* opaco: tapa el canvas fijo del brownie */
}
.alf2__stage {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(70% 55% at 50% 42%, rgba(120,70,40,0.16) 0%, rgba(120,70,40,0) 68%),
    linear-gradient(180deg, var(--choco) 0%, #080504 100%);
}
.alf2__stage canvas {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%; display: block;
}
.alf2__veil {
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: linear-gradient(180deg,
    rgba(8,4,3,0.34) 0%, rgba(8,4,3,0) 26%, rgba(8,4,3,0) 60%, rgba(8,4,3,0.55) 100%);
}
/* Captions PINNEADAS en una franja segura: nunca chocan con el header */
.alf2__cap {
  position: absolute; z-index: 2;
  top: 50%; left: 0;
  width: min(48vw, 560px);
  padding: 0 clamp(1.2rem, 4vw, 4rem);
  transform: translateY(-50%) translateY(28px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.55s ease, transform 0.7s cubic-bezier(.16,1,.3,1);
}
.alf2__cap.is-active {
  opacity: 1; pointer-events: auto;
  transform: translateY(-50%);
}
.alf2__cap .section__heading { margin-bottom: 1.2rem; }
.alf2__eye {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-dim); margin-bottom: 1rem;
}
.alf2__menu {
  list-style: none; margin: 0 0 1.2rem;
  display: flex; flex-direction: column; gap: 0.4rem;
}
.alf2__menu li {
  font-size: clamp(1rem, 1.5vw, 1.2rem); font-weight: 600; color: var(--ink);
}
.alf2__menu li::before {
  content: "—"; color: var(--ink-dim); margin-right: 0.6rem;
}
.alf2__cap .cta__button { margin-top: 0.6rem; }

/* Desktop: la caption se alinea a la columna IZQUIERDA del contenido centrado (junto al producto) */
@media (min-width: 821px) {
  .alf2__cap {
    left: max(4vw, calc(50% - 590px));
    width: min(46vw, 520px);
    padding: 0;
  }
}

@media (max-width: 820px) {
  .alf2 { height: 320vh; }
  .alf2__cap {
    top: auto; bottom: 6vh; width: 100%;
    padding: 0 6vw;
    transform: translateY(28px);
  }
  .alf2__cap.is-active { transform: none; }
  .alf2__menu { display: none; }            /* móvil: el video muestra los sabores */
  .alf2__eye { margin-bottom: 0.5rem; }
  .alf2__cap .section__heading { font-size: clamp(2rem, 8vw, 2.8rem); margin-bottom: 0.7rem; }
  .alf2__cap .section__body { font-size: 0.95rem; }
  .alf2__cap .cta__button { margin-top: 1rem; }
  /* Scrim inferior fuerte: el texto se lee sin tapar el producto (arriba queda limpio) */
  .alf2__veil {
    background: linear-gradient(180deg,
      rgba(8,4,3,0.22) 0%, rgba(8,4,3,0) 18%, rgba(8,4,3,0) 40%,
      rgba(8,4,3,0.82) 72%, rgba(8,4,3,0.96) 100%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .alf2__cap { transition: none; }
}
