:root {
  --bg: #0b0806;
  --gold: #f2b632;
  --gold-deep: #c98a12;
  --text: #f6ead2;
  --muted: rgba(246, 234, 210, 0.66);
  --line: rgba(242, 182, 50, 0.24);
  --glass: rgba(20, 14, 9, 0.62);
  --gutter: clamp(16px, 5vw, 72px);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Baloo 2', ui-rounded, system-ui, sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Fondo: degradado cálido + panal muy tenue */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 60% 55% at 50% 45%, rgba(74, 46, 16, 0.55) 0%, rgba(18, 12, 7, 0) 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cpath d='M28 0 L56 16 L56 48 L28 64 L0 48 L0 16 Z M28 64 L28 97' fill='none' stroke='%23f2b632' stroke-opacity='0.045' stroke-width='1.2'/%3E%3C/svg%3E"),
    var(--bg);
}

#scene {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.nav,
.story,
.gauge {
  position: relative;
  z-index: 2;
}

/* ---------- Navegación ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) var(--gutter) 14px;
  z-index: 10;
  background: linear-gradient(180deg, rgba(11, 8, 6, 0.85), rgba(11, 8, 6, 0));
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 800;
  color: var(--gold);
  text-decoration: none;
}

.logo__hex {
  width: 18px;
  height: 18px;
  background: var(--gold);
  clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%);
}

.nav__links {
  display: flex;
  gap: clamp(14px, 3vw, 32px);
}

.nav__links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 16px;
}

.nav__links a:hover {
  color: var(--gold);
}

/* ---------- Indicador de "servido" ---------- */
.gauge {
  position: fixed;
  right: var(--gutter);
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  justify-items: center;
  gap: 8px;
  z-index: 5;
}

.gauge__track {
  position: relative;
  width: 4px;
  height: 160px;
  border-radius: 4px;
  background: rgba(242, 182, 50, 0.15);
  overflow: hidden;
}

.gauge__fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  border-radius: 4px;
  background: linear-gradient(0deg, var(--gold-deep), var(--gold));
}

.gauge__label {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- Capítulos ---------- */
.chapter {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 96px var(--gutter);
}

.chapter--right {
  justify-content: flex-end;
  padding-right: calc(var(--gutter) + 56px);
}

.copy {
  position: relative;
  z-index: 1;
  width: min(380px, 32vw);
  opacity: 0;
  translate: 0 40px;
  transition:
    opacity 0.9s ease,
    translate 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.copy.is-visible {
  opacity: 1;
  translate: 0 0;
}

.chapter--hero .copy {
  width: min(520px, 40vw);
}

.eyebrow,
.step {
  display: inline-block;
  margin: 0 0 8px;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 14px;
}

h1,
h2 {
  margin: 0 0 14px;
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(40px, 5.6vw, 84px);
}

h2 {
  font-size: clamp(30px, 3.4vw, 52px);
  color: var(--gold);
}

.lead,
.copy p {
  margin: 0;
  font-size: clamp(17px, 1.4vw, 20px);
  line-height: 1.45;
  color: var(--muted);
}

.doodle {
  display: block;
  width: 180px;
  margin-top: 18px;
  overflow: visible;
}

.doodle path {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2;
  stroke-linecap: round;
}

.doodle--flip {
  margin-left: auto;
  transform: scaleX(-1);
}

/* Hexágonos dorados flotando */
.hex {
  position: absolute;
  display: block;
  background: var(--gold);
  clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%);
  pointer-events: none;
}

.hex--a { width: 46px; height: 42px; top: 22%; right: 26%; }
.hex--b { width: 22px; height: 20px; bottom: 18%; left: 38%; opacity: 0.8; }
.hex--c { width: 34px; height: 31px; top: 30%; right: 30%; }
.hex--d { width: 58px; height: 53px; bottom: 22%; left: 24%; }
.hex--e { width: 18px; height: 16px; top: 26%; left: 40%; opacity: 0.7; }
.hex--f { width: 40px; height: 36px; top: 40%; right: 22%; }

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 6px;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.scroll-hint span {
  width: 2px;
  height: 36px;
  background: linear-gradient(180deg, rgba(242, 182, 50, 0), var(--gold));
  animation: drip 1.6s ease-in-out infinite;
  transform-origin: top;
}

@keyframes drip {
  0% { transform: scaleY(0); opacity: 0; }
  40% { opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* ---------- Final ---------- */
.chapter--final {
  min-height: 120vh;
}

.flavors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 22px;
}

.flavor {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.flavor[aria-checked='true'] {
  border-color: var(--gold);
  background: rgba(242, 182, 50, 0.16);
}

.flavor__swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.35);
}

.cta {
  display: inline-block;
  padding: 14px 26px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  color: #2a1803;
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
}

.footer {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px;
  padding: 48px var(--gutter) max(48px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(11, 8, 6, 0.9);
}

.footer p {
  margin: 8px 0 0;
  color: var(--muted);
}

.footer__links {
  display: grid;
  gap: 8px;
  align-content: start;
}

.footer__links a {
  color: var(--text);
  text-decoration: none;
}

.footer__links a:hover {
  color: var(--gold);
}

/* ---------- Móvil: el helado arriba, el texto abajo ---------- */
@media (max-width: 760px) {
  .nav__links {
    display: none;
  }

  .gauge {
    top: auto;
    bottom: 50%;
    right: 12px;
    transform: none;
  }

  .gauge__track {
    height: 110px;
  }

  .chapter,
  .chapter--right {
    align-items: flex-end;
    justify-content: flex-start;
    padding-right: var(--gutter);
    padding-bottom: 56px;
  }

  .copy,
  .chapter--hero .copy {
    width: 100%;
    padding: 18px;
    border-radius: 20px;
    background: var(--glass);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }

  .chapter--hero .copy {
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0 0 40px;
  }

  .doodle,
  .doodle--flip {
    margin-left: 0;
    width: 130px;
  }

  .scroll-hint {
    bottom: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .copy {
    transition: none;
    translate: none;
    opacity: 1;
  }
  .scroll-hint span {
    animation: none;
  }
}

/* ---------- Etiqueta de la opción (para comparar B y C) ---------- */
.badge {
  margin-right: auto;
  margin-left: 14px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Opción B: video con transparencia ---------- */
.stage-video {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.stage-video video,
.stage-video canvas {
  height: 100vh;
  height: 100svh;
  width: auto;
  aspect-ratio: 3 / 4;
  will-change: transform;
}

.loader {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 6;
  margin: 0;
  padding: 8px 16px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  transition: opacity 0.4s ease;
}

.loader.is-done {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 760px) {
  .badge {
    display: none;
  }

  .stage-video {
    place-items: start center;
  }

  .stage-video video,
  .stage-video canvas {
    width: 100vw;
    height: auto;
    margin-top: 6vh;
  }
}

/* ---------- Sitio principal: siempre cayendo y servido al final ---------- */
.stage-video #fall {
  transition: translate 1.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* En escritorio, al servir el cono se corre a la izquierda para dejar el texto final a la derecha. */
@media (min-width: 761px) {
  body.is-serving .stage-video #fall {
    translate: -14vw 0;
  }
}

/* Al final de la página el cono queda a la vista. */
@media (min-width: 761px) {
  /* Escritorio: capítulo final un poco más bajo que la pantalla y pie transparente
     en una sola fila, para que al llegar abajo se vean el texto y el cono completos. */
  .page-fall .chapter--final {
    min-height: calc(100svh - 150px);
  }

  .page-fall .footer {
    align-items: flex-end;
    background: transparent;
    border-top-color: transparent;
  }

  .page-fall .footer__links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 22px;
    max-width: 640px;
  }
}

@media (max-width: 760px) {
  /* Móvil: el texto final arriba y el cono debajo; el pie va aparte, con fondo. */
  .page-fall .chapter--final {
    align-items: flex-start;
    padding-top: 84px;
  }
}
