/* ==========================================================================
   EL PALO — SISTEMA DE MOVIMIENTO
   Curvas, revelados al hacer scroll, texto por palabras, parallax, brillos.
   Los colores corporativos no se tocan: solo oro (#f4c20d / #ffd24a),
   espresso (#2b1a12), tinta (#16100c) y transparencias neutras.
   ========================================================================== */

:root {
  /* Curvas de aceleracion */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-back: cubic-bezier(0.34, 1.4, 0.64, 1);
  --ease-in-out-soft: cubic-bezier(0.65, 0, 0.35, 1);

  /* Duraciones */
  --dur-xs: 140ms;
  --dur-sm: 220ms;
  --dur-md: 380ms;
  --dur-lg: 680ms;
  --dur-xl: 1000ms;

  /* Elevacion por capas (sombra doble = mas realista que una sola) */
  --elev-1: 0 1px 2px rgba(22, 16, 12, 0.05), 0 3px 10px rgba(22, 16, 12, 0.05);
  --elev-2: 0 2px 5px rgba(22, 16, 12, 0.05), 0 10px 26px rgba(22, 16, 12, 0.08);
  --elev-3: 0 4px 10px rgba(22, 16, 12, 0.06), 0 20px 48px rgba(22, 16, 12, 0.12);
  --elev-4: 0 10px 22px rgba(22, 16, 12, 0.08), 0 40px 90px rgba(22, 16, 12, 0.18);
  --elev-dark-2: 0 4px 12px rgba(0, 0, 0, 0.3), 0 18px 44px rgba(0, 0, 0, 0.32);
  --elev-dark-3: 0 10px 24px rgba(0, 0, 0, 0.34), 0 36px 84px rgba(0, 0, 0, 0.42);

  /* Halos de marca */
  --ring-gold: 0 0 0 1px rgba(244, 194, 13, 0.5);
  --glow-gold-sm: 0 6px 18px rgba(244, 194, 13, 0.28);
  --glow-gold-md: 0 10px 34px rgba(244, 194, 13, 0.34);
  --glow-gold-lg: 0 18px 60px rgba(244, 194, 13, 0.4);

  /* Textura de grano (SVG en data: — permitido por la CSP) */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ==========================================================================
   1. REVELADO AL HACER SCROLL
   Solo se oculta si el JS ha arrancado (html.js-motion). Sin JS, todo visible.
   ========================================================================== */

.js-motion [data-reveal] {
  opacity: 0;
  transform: translate3d(var(--reveal-x, 0), var(--reveal-y, 26px), 0) scale(var(--reveal-scale, 1));
  transition:
    opacity var(--dur-lg) var(--ease-out-expo) var(--reveal-delay, 0ms),
    transform var(--dur-lg) var(--ease-out-expo) var(--reveal-delay, 0ms),
    filter var(--dur-lg) var(--ease-out-expo) var(--reveal-delay, 0ms),
    clip-path var(--dur-xl) var(--ease-out-expo) var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

.js-motion [data-reveal="left"] {
  --reveal-x: -32px;
  --reveal-y: 0;
}

.js-motion [data-reveal="right"] {
  --reveal-x: 32px;
  --reveal-y: 0;
}

.js-motion [data-reveal="zoom"] {
  --reveal-y: 16px;
  --reveal-scale: 0.94;
}

.js-motion [data-reveal="blur"] {
  filter: blur(14px);
}

/* Cortina: la pieza se descubre de abajo hacia arriba */
.js-motion [data-reveal="curtain"] {
  --reveal-y: 34px;
  clip-path: inset(0 0 100% 0 round var(--radius-lg, 20px));
}

.js-motion [data-reveal].is-in {
  opacity: 1;
  transform: none;
  filter: none;
  clip-path: inset(0 0 0 0 round var(--radius-lg, 20px));
}

/* La imagen interior arranca ampliada y se asienta: da sensacion de camara */
.js-motion [data-reveal-media] {
  overflow: hidden;
}

.js-motion [data-reveal-media] > img,
.js-motion [data-reveal-media] > video {
  transform: scale(1.14);
  transition: transform 1400ms var(--ease-out-expo) var(--reveal-delay, 0ms);
}

.js-motion [data-reveal-media].is-in > img,
.js-motion [data-reveal-media].is-in > video {
  transform: scale(1);
}

/* ==========================================================================
   2. TEXTO POR PALABRAS (mascara vertical)
   ========================================================================== */

.split-word {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
}

.split-word__i {
  display: inline-block;
  transform: translate3d(0, 115%, 0) rotate(2deg);
  opacity: 0;
  will-change: transform;
}

.is-in .split-word__i {
  animation: wordRise 900ms var(--ease-out-expo) var(--word-delay, 0ms) both;
}

@keyframes wordRise {
  from {
    opacity: 0;
    transform: translate3d(0, 115%, 0) rotate(2deg);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0);
  }
}

/* ==========================================================================
   3. BARRA DE PROGRESO DE LECTURA
   ========================================================================== */

.scroll-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 5000;
  height: 3px;
  pointer-events: none;
  background: transparent;
}

.scroll-progress__bar {
  height: 100%;
  width: 0;
  transform-origin: 0 50%;
  background: linear-gradient(90deg, #f4c20d, #ffd24a 60%, #fff0bd);
  box-shadow: 0 0 14px rgba(244, 194, 13, 0.7);
  transition: width 90ms linear;
}

/* ==========================================================================
   4. CABECERA REACTIVA
   ========================================================================== */

.topbar {
  transition:
    background var(--dur-md) ease,
    box-shadow var(--dur-md) ease,
    transform var(--dur-md) var(--ease-out-expo),
    backdrop-filter var(--dur-md) ease;
}

.topbar::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(244, 194, 13, 0.55), transparent);
  opacity: 0;
  transition: opacity var(--dur-md) ease;
}

.is-scrolled .topbar {
  background: rgba(16, 11, 8, 0.9);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(22px) saturate(150%);
}

.is-scrolled .topbar::after {
  opacity: 1;
}

/* Se esconde al bajar, vuelve al subir */
.is-nav-hidden .topbar {
  transform: translate3d(0, -104%, 0);
}

/* Subrayado dorado que crece desde el centro */
.nav__link:not(.nav__link--cta):not(.cart-btn) {
  position: relative;
}

.nav__link:not(.nav__link--cta):not(.cart-btn)::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 7px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand, #f4c20d);
  transform: scaleX(0);
  transform-origin: 50% 50%;
  transition: transform var(--dur-md) var(--ease-out-expo);
}

.nav__link:not(.nav__link--cta):not(.cart-btn):hover::after,
.nav__link--active::after {
  transform: scaleX(1);
}

/* ==========================================================================
   5. BOTONES: destello, presion e iman
   ========================================================================== */

.btn,
.btnPrimary,
.btnSecondary,
.btn--primary,
.btn--ghost,
.btn-primary,
.nav__link--cta,
.shop-banner__cta {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transform: translate3d(var(--magnet-x, 0), var(--magnet-y, 0), 0);
  transition:
    transform var(--dur-md) var(--ease-out-expo),
    background var(--dur-sm) ease,
    color var(--dur-sm) ease,
    border-color var(--dur-sm) ease,
    box-shadow var(--dur-sm) ease;
}

.btn::before,
.btnPrimary::before,
.btn--primary::before,
.btn-primary::before,
.nav__link--cta::before,
.shop-banner__cta::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 36%, rgba(255, 255, 255, 0.62) 50%, transparent 64%);
  transform: translateX(-120%);
  transition: transform 720ms var(--ease-out-expo);
}

.btn:hover::before,
.btnPrimary:hover::before,
.btn--primary:hover::before,
.btn-primary:hover::before,
.nav__link--cta:hover::before,
.shop-banner__cta:hover::before {
  transform: translateX(120%);
}

.btn:active,
.btnPrimary:active,
.btnSecondary:active,
.btn--primary:active,
.btn--ghost:active,
.btn-primary:active,
.nav__link--cta:active {
  transform: translate3d(var(--magnet-x, 0), var(--magnet-y, 0), 0) scale(0.975);
  transition-duration: 90ms;
}

/* Confirmacion al anadir al carrito */
.btn.is-done,
.btn--primary.is-done {
  animation: popConfirm 520ms var(--ease-out-back);
}

@keyframes popConfirm {
  0% { transform: scale(1); }
  38% { transform: scale(1.07); }
  100% { transform: scale(1); }
}

/* ==========================================================================
   6. TARJETAS: inclinacion 3D y halo que sigue al cursor
   ========================================================================== */

.tilt {
  transform-style: preserve-3d;
  transition: transform var(--dur-lg) var(--ease-out-expo);
}

.tilt.is-tilting {
  transition: transform 90ms linear;
}

.spotlight {
  position: relative;
  isolation: isolate;
}

.spotlight::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  border-radius: inherit;
  opacity: 0;
  background: radial-gradient(
    440px circle at var(--mx, 50%) var(--my, 50%),
    rgba(244, 194, 13, 0.16),
    transparent 62%
  );
  transition: opacity var(--dur-md) ease;
}

.spotlight:hover::after {
  opacity: 1;
}

/* ==========================================================================
   7. CINTA INFINITA (marquee)
   ========================================================================== */

.marquee {
  display: flex;
  overflow: hidden;
  gap: 0;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.marquee__track {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: clamp(20px, 5vw, 70px);
  padding-right: clamp(20px, 5vw, 70px);
  animation: marqueeSlide var(--marquee-duration, 34s) linear infinite;
}

.marquee:hover .marquee__track {
  animation-play-state: paused;
}

@keyframes marqueeSlide {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-100%, 0, 0); }
}

/* ==========================================================================
   8. BIBLIOTECA DE ANIMACIONES
   ========================================================================== */

@keyframes floatSoft {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -14px, 0); }
}

@keyframes floatTilt {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(var(--float-rot, 0deg)); }
  50% { transform: translate3d(0, -12px, 0) rotate(calc(var(--float-rot, 0deg) + 1deg)); }
}

@keyframes goldPulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.06); }
}

@keyframes auroraDrift {
  0% { transform: translate3d(-6%, -4%, 0) scale(1); }
  50% { transform: translate3d(6%, 4%, 0) scale(1.12); }
  100% { transform: translate3d(-6%, -4%, 0) scale(1); }
}

@keyframes shimmerSweep {
  from { transform: translateX(-140%); }
  to { transform: translateX(140%); }
}

@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47, 109, 69, 0.45); }
  70% { box-shadow: 0 0 0 9px rgba(47, 109, 69, 0); }
}

@keyframes ringSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes heroDrift {
  from { transform: scale(1.02) translate3d(0, 0, 0); }
  to { transform: scale(1.1) translate3d(-1.4%, -1.2%, 0); }
}

@keyframes bounceDown {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50% { transform: translateY(7px); opacity: 1; }
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 22px) scale(0.94); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

@keyframes drawerIn {
  from { transform: translate3d(100%, 0, 0); }
  to { transform: translate3d(0, 0, 0); }
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalIn {
  from { opacity: 0; transform: translate3d(0, 26px, 0) scale(0.96); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes itemIn {
  from { opacity: 0; transform: translate3d(0, 14px, 0); }
  to { opacity: 1; transform: none; }
}

@keyframes cardIn {
  from { opacity: 0; transform: translate3d(0, 26px, 0) scale(0.97); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   9. UTILIDADES
   ========================================================================== */

.u-float { animation: floatSoft 7s var(--ease-in-out-soft) infinite; }
.u-grain::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.05;
  background-image: var(--grain);
  mix-blend-mode: overlay;
}

/* ==========================================================================
   10. RESPETO POR "REDUCIR MOVIMIENTO"
   Nada de animaciones, pero el contenido SIEMPRE visible.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .js-motion [data-reveal],
  .js-motion [data-reveal].is-in {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    clip-path: none !important;
  }

  .js-motion [data-reveal-media] > img,
  .js-motion [data-reveal-media] > video {
    transform: none !important;
  }

  .split-word__i,
  .is-in .split-word__i {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  /* Sin desplazamiento, la cinta se queda como una fila centrada
     y la copia duplicada sobra. */
  .marquee__track {
    animation: none !important;
  }

  .marquee {
    justify-content: center;
  }

  .marquee__track[aria-hidden="true"] {
    display: none;
  }

  .is-nav-hidden .topbar {
    transform: none !important;
  }
}
