/* ==========================================================================
   1. VARIABLES CSS & DESIGN TOKENS
   ========================================================================== */
@property --glow-color {
  syntax: '<color>';
  inherits: true;
  initial-value: rgba(184, 101, 42, 0.75);
}

:root {
  /* Paleta cromática oficial */
  --bg-900: #1E0E07;
  /* Fondo base, marrón chocolate muy oscuro */
  --bg-700: #2A1408;
  /* Marrón intermedio / contrastes */
  --copper: #B8652A;
  /* Luz cálida */
  --amber: #E08A3C;
  /* Resplandor / acento */
  --cream: #F5E9D7;
  /* Tipografía y botones principales */
  --cream-soft: rgba(245, 233, 215, 0.7);
  /* Tipografía secundaria */
  --radius-card: 22px;
  /* Radio de curvatura de tarjetas de sabor */

  /* Tipografías oficiales */
  --font-serif: "Newsreader", Garamond, Georgia, serif;
  --font-sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Estado dinámico de iluminación según sabor activo */
  --glow-color: rgba(184, 101, 42, 0.75);

  /* ============================================================
     ESCALA DEL HERO (Lienzo 1376 x 768)
     ============================================================ */
  --s: min(calc(100vw / 1376), calc(100vh / 768));

  /* PANEL DE AJUSTE (unidades del lienzo 1376x768) */
  --title-top: 188;
  /* posición vertical del título CHOCOLATE */
  --title-size: 205;
  /* tamaño del título (ocupa ~92% del ancho) */
  --product-top: 194;
  /* borde superior de la imagen barra+montículo */
  --product-width: 637;
  /* ancho de la imagen barra+montículo */
  --glow-center-y: 429;
  /* centro vertical de la luz, detrás de la barra */

  --glow-size-x: calc(820 * var(--s));
  --glow-size-y: calc(640 * var(--s));
}

/* Reset moderno */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

html,
body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-900);
  color: var(--cream);
  font-family: var(--font-sans);
  overflow-x: hidden;
  overflow-y: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* ==========================================================================
   2. CONTENEDOR HERO Y CAPAS DE FONDO (ATMÓSFERA Y GRANO)
   ========================================================================== */
.hero {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 520px;
  background-color: var(--bg-900);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

/* Luz radial principal detrás del producto */
.hero-glow {
  position: absolute;
  top: calc(50% + (var(--glow-center-y) - 384) * var(--s));
  left: 50%;
  width: var(--glow-size-x);
  height: var(--glow-size-y);
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center,
      var(--glow-color) 0%,
      rgba(184, 101, 42, 0.35) 32%,
      transparent 55%);
  pointer-events: none;
  z-index: 0;
  transition: --glow-color 0.7s ease, transform 0.6s ease;
  filter: blur(12px);
}

/* Viñeta oscura en esquinas y bordes */
.hero-vignette {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at center,
      transparent 35%,
      rgba(12, 5, 2, 0.28) 70%,
      rgba(0, 0, 0, 0.58) 100%);
  pointer-events: none;
  z-index: 0;
}

/* Textura de grano sutil con SVG feTurbulence (opacidad .07, overlay) */
.hero-grain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-repeat: repeat;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* ==========================================================================
   3. BARRA SUPERIOR (HEADER) - z-index: 20
   position: fixed para mantenerse visible sobre Hero y Explore (§3.3)
   ========================================================================== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 96px;
  padding: 0 52px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  z-index: 20;
  background: transparent;
  pointer-events: auto;
  transition: background 0.35s ease, backdrop-filter 0.35s ease, border-color 0.35s ease;
}

.header.is-scrolled {
  background: rgba(26, 12, 6, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(245, 233, 215, 0.08);
}

/* Logo Izquierda: serif minúsculas crema con icono artesanal */
.header-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 400;
  color: var(--cream);
  letter-spacing: -0.015em;
  justify-self: start;
  line-height: 1;
  text-decoration: none;
  transition: opacity 0.25s ease;
}

.header-logo:hover {
  opacity: 0.88;
}

.header-logo-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
}

/* Menú Central: 7 enlaces, sans, crema */
.header-nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.8vw, 26px);
  justify-self: center;
}

.header-nav a {
  font-family: var(--font-sans);
  font-size: clamp(14px, 1.05vw, 16.5px);
  font-weight: 400;
  color: var(--cream);
  position: relative;
  padding: 6px 2px;
  white-space: nowrap;
  transition: color 0.25s ease;
}

/* Subrayado fino animado de izquierda a derecha */
.header-nav a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1.5px;
  background-color: var(--cream);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  opacity: 0.85;
}

.header-nav a:hover::after,
.header-nav a:focus-visible::after,
.header-nav a.active::after {
  transform: scaleX(1);
}

/* Acciones Derecha: Sign in + Botón píldora Shop now */
.header-actions {
  display: flex;
  align-items: center;
  gap: 28px;
  justify-self: end;
}

.header-signin {
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 400;
  color: var(--cream);
  transition: opacity 0.25s ease;
}

.header-signin:hover {
  opacity: 0.75;
}

.btn-shop-now {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  color: #2A1408;
  background-color: var(--cream);
  padding: 12px 26px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.4, 1), box-shadow 0.25s ease, filter 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.btn-shop-now:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(245, 233, 215, 0.22);
  filter: brightness(1.03);
}

.btn-shop-now:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Botón Hamburguesa (Móvil) */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  cursor: pointer;
  z-index: 25;
}

.hamburger-btn span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--cream);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Menú Móvil Desplegable */
.mobile-menu-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 290px;
  height: 100%;
  background: rgba(30, 14, 7, 0.98);
  backdrop-filter: blur(20px);
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.55);
  padding: 100px 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 22;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-menu-drawer.open {
  transform: translateX(0);
}

.mobile-menu-drawer a {
  font-size: 20px;
  font-weight: 500;
  color: var(--cream);
  border-bottom: 1px solid rgba(245, 233, 215, 0.1);
  padding-bottom: 14px;
}

/* ==========================================================================
   4. TEXTOS DEL HERO (z-index: 1)
   ========================================================================== */
.scene {
  position: absolute;
  left: calc(50% - 688 * var(--s));
  top: calc(50% - 384 * var(--s));
  width: calc(1376 * var(--s));
  height: calc(768 * var(--s));
}

.hero-overline {
  position: absolute;
  top: calc(118 * var(--s));
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-sans);
  font-size: clamp(12px, calc(18 * var(--s)), 32px);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.35em;
  color: var(--cream);
  opacity: 0.85;
  white-space: nowrap;
  z-index: 1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Título: "CHOCOLATE" */
.hero-title {
  position: absolute;
  top: calc(var(--title-top) * var(--s));
  left: 0;
  width: 100%;
  text-align: center;
  font-family: var(--font-serif);
  font-size: calc(var(--title-size) * var(--s));
  font-weight: 400;
  line-height: 0.85;
  letter-spacing: -0.02em;
  color: var(--cream);
  text-transform: uppercase;
  white-space: nowrap;
  z-index: 1;
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

/* Texto esquina izquierda: "HANDCRAFTED / SINCE 2015" */
.hero-corner-left {
  position: absolute;
  top: calc(370 * var(--s));
  left: calc(52 * var(--s));
  font-family: var(--font-sans);
  font-size: clamp(12px, calc(17 * var(--s)), 30px);
  font-weight: 500;
  line-height: 1.45;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--cream);
  text-align: left;
  z-index: 1;
  opacity: 0.95;
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

/* Texto esquina derecha: "SMALL-BATCH / BEAN TO BAR" */
.hero-corner-right {
  position: absolute;
  top: calc(370 * var(--s));
  right: calc(52 * var(--s));
  font-family: var(--font-sans);
  font-size: clamp(12px, calc(17 * var(--s)), 30px);
  font-weight: 500;
  line-height: 1.45;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--cream);
  text-align: right;
  z-index: 1;
  opacity: 0.95;
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

/* Texto unificado para vista móvil */
.hero-corner-mobile {
  display: none;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cream);
  opacity: 0.85;
  margin-top: 8px;
  z-index: 1;
}

/* ==========================================================================
   5. ESCENARIO CENTRAL (.stage)
   ========================================================================== */
.stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* PRODUCTO HÉROE + MONTÍCULO UNIFICADOS (z-index: 3) */
.hero-product-showcase {
  position: absolute;
  left: 50%;
  top: calc(var(--product-top) * var(--s));
  transform: translateX(-50%);
  width: calc(var(--product-width) * var(--s));
  aspect-ratio: 1536 / 1024;
  z-index: 3;
  pointer-events: none;
  isolation: isolate;
  filter: drop-shadow(0 25px 45px rgba(0, 0, 0, 0.65));
  -webkit-mask-image: linear-gradient(to bottom, black 82%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 82%, transparent 100%);
  animation: heroSlightFloat 8s ease-in-out infinite;
}

.hero-product-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  z-index: 1;
  transform-origin: 50% 85%;
  will-change: opacity, transform, filter;
  backface-visibility: hidden;
}

.hero-product-img.is-front {
  opacity: 1;
  z-index: 2;
}

/* ==========================================================================
   6. ELEMENTOS BOTÁNICOS FLOTANTES REALES POR SABOR
   ========================================================================== */
.floaters-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.floaters-layer.is-bg {
  z-index: 2;
  isolation: isolate;
}

.floaters-layer.is-fg {
  z-index: 5;
}

.flavor-floaters {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.flavor-floaters.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.5s;
}

.floaters-layer.is-bg .flavor-floaters {
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.floaters-layer.is-bg .flavor-floaters.is-active {
  transition: opacity 0.42s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.42s;
}

.floater {
  position: absolute;
  pointer-events: none;
  user-select: none;
  object-fit: contain;
  will-change: transform;
}

.floater.is-bg {
  z-index: 2;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.45));
  backface-visibility: hidden;
  transform: translateZ(0);
}

.floater.is-fg {
  filter: drop-shadow(0 14px 24px rgba(18, 8, 4, 0.55));
}

.floater.is-blur {
  z-index: 6;
  filter: blur(3.5px) drop-shadow(0 20px 32px rgba(0, 0, 0, 0.65));
}

@keyframes floatingMotion {

  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(var(--base-rot, 0deg));
  }

  50% {
    transform: translate3d(0, calc(-8 * var(--s)), 0) rotate(calc(var(--base-rot, 0deg) + var(--drift-rot, 5deg)));
  }
}

@keyframes floatingMotionAlt {

  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(var(--base-rot, 0deg));
  }

  50% {
    transform: translate3d(0, calc(8 * var(--s)), 0) rotate(calc(var(--base-rot, 0deg) - var(--drift-rot, 5deg)));
  }
}

.anim-float-1 {
  animation: floatingMotion 7s ease-in-out infinite;
}

.anim-float-2 {
  animation: floatingMotionAlt 8.2s ease-in-out infinite;
  animation-delay: 0.8s;
}

.anim-float-3 {
  animation: floatingMotion 6.5s ease-in-out infinite;
  animation-delay: 1.4s;
}

.anim-float-4 {
  animation: floatingMotionAlt 7.6s ease-in-out infinite;
  animation-delay: 2.1s;
}

/* ==========================================================================
   7. SELECTOR DE SABORES (FILA INFERIOR) - z-index: 10
   ========================================================================== */
.flavor-dock-container {
  position: absolute;
  bottom: calc(34 * var(--s));
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
}

.flavor-dock {
  display: flex;
  align-items: center;
  gap: calc(24 * var(--s));
  pointer-events: auto;
  padding: 6px 12px;
  list-style: none;
}

.flavor-card {
  position: relative;
  width: clamp(96px, calc(138 * var(--s)), 280px);
  height: clamp(92px, calc(130 * var(--s)), 264px);
  background: #FBF5EA;
  border-radius: var(--radius-card);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 8px;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.25, 1),
    box-shadow 0.35s ease,
    background 0.35s ease,
    border-color 0.35s ease;
  outline: none;
  cursor: pointer;
  --pop-scale: 1.55;
  --pop-y: -10%;
  --pop-x: 0%;
}

.flavor-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.4);
}

.flavor-card:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

.flavor-card.active {
  transform: scale(1.04);
  background: linear-gradient(135deg, #FFF6EA 0%, #F3D9BF 100%);
  border: 1px solid rgba(224, 138, 60, 0.6);
  box-shadow: 0 0 40px rgba(224, 138, 60, 0.55), 0 12px 30px rgba(0, 0, 0, 0.35);
  z-index: 3;
}

.flavor-card.active:hover {
  transform: translateY(-6px) scale(1.04);
  box-shadow: 0 0 45px rgba(224, 138, 60, 0.65), 0 20px 40px rgba(0, 0, 0, 0.45);
}

.flavor-thumb-box {
  position: relative;
  width: clamp(44px, calc(64 * var(--s)), 130px);
  height: clamp(44px, calc(64 * var(--s)), 130px);
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  padding: 0;
}

.flavor-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: 50% 100%;
  transition: transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1),
    filter 0.4s ease;
  will-change: transform;
}

.flavor-card:hover .flavor-thumb-img {
  transform: scale(1.1);
}

.flavor-card.active .flavor-thumb-box {
  background: transparent;
  border: none;
}

.flavor-card.active .flavor-thumb-img {
  transform: translate(var(--pop-x), var(--pop-y)) scale(var(--pop-scale));
  filter: drop-shadow(0 14px 12px rgba(42, 20, 8, 0.38)) drop-shadow(0 0 18px rgba(224, 138, 60, 0.35));
}

.flavor-card.active:hover .flavor-thumb-img {
  transform: translate(var(--pop-x), calc(var(--pop-y) - 3%)) scale(calc(var(--pop-scale) + 0.06));
}

.flavor-name {
  font-family: var(--font-sans);
  font-size: clamp(13px, calc(16 * var(--s)), 30px);
  font-weight: 500;
  color: #2A1408;
  letter-spacing: -0.015em;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  max-width: 100%;
  transform: translateY(0);
  transition: transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1),
    color 0.35s ease,
    font-weight 0.25s ease;
}

.flavor-card.active .flavor-name {
  transform: translateY(-7px);
  font-weight: 600;
  color: #1E0E07;
}

.flavor-card.active:hover .flavor-name {
  transform: translateY(-10px);
}

/* ==========================================================================
   8. RESPONSIVE DESIGN (BREAKPOINTS)
   Aquí solo queda el HEADER. El layout del HERO para móvil y tablet
   (<= 1199px) vive en css/responsive.css, sección "1b. HERO".
   ========================================================================== */
@media (min-width: 768px) and (max-width: 1199px) {
  .header {
    padding: 0 36px;
  }
}

@media (max-width: 767px) {

  html,
  body {
    overflow-y: auto;
    scroll-snap-type: none;
  }

  .header {
    height: 80px;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
  }

  .header-logo {
    font-size: 24px;
    gap: 9px;
  }

  .header-logo-icon {
    width: 28px;
    height: 28px;
  }

  .header-nav,
  .header-signin {
    display: none;
  }

  .hamburger-btn {
    display: flex;
  }

  .btn-shop-now {
    padding: 10px 18px;
    font-size: 14px;
  }
}

/* ==========================================================================
   9. ACCESIBILIDAD (PREFERS-REDUCED-MOTION)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero-glow {
    filter: none;
  }
}