/* Animaciones y efectos — respeta prefers-reduced-motion al final */

/* —— Tema oscuro —— */
html[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #0b1018;
  --color-surface: #121a26;
  --color-text: #e8edf4;
  --color-muted: #94a3b8;
  --color-border: #243044;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .field__input {
  background: #0f172a;
  color: var(--color-text);
  border-color: var(--color-border);
}

html[data-theme="dark"] .promo {
  background: var(--color-bg);
  border-color: var(--color-border);
}

html[data-theme="dark"] .section--alt {
  background: var(--color-surface);
}

html[data-theme="dark"] .card {
  background: rgba(18, 26, 38, 0.85);
}

html[data-theme="dark"] .site-footer {
  background: linear-gradient(180deg, #060a10 0%, #0f2744 100%);
}

/* —— Glassmorphism —— */
.site-header {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

html[data-theme="dark"] .site-header {
  background: rgba(15, 23, 35, 0.72);
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.feature--glass {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 8px 32px rgba(15, 39, 68, 0.08);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

html[data-theme="dark"] .feature--glass {
  background: rgba(30, 41, 59, 0.55);
  border-color: rgba(255, 255, 255, 0.08);
}

.feature--glass:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(15, 39, 68, 0.12);
}

.contact__form--glass {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

html[data-theme="dark"] .contact__form--glass {
  background: rgba(18, 26, 38, 0.82);
  border-color: rgba(255, 255, 255, 0.08);
}

/* —— Hero: gradiente animado + grano + spotlight cursor —— */
.hero {
  --mx: 50%;
  --my: 40%;
}

.hero__copy {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.hero__mesh {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 100% 80% at 15% 20%, rgba(232, 93, 4, 0.35), transparent 50%),
    radial-gradient(ellipse 70% 60% at 85% 75%, rgba(56, 189, 248, 0.18), transparent 45%),
    radial-gradient(ellipse 60% 50% at var(--mx) var(--my), rgba(251, 191, 36, 0.12), transparent 42%);
  animation: meshShift 14s ease-in-out infinite alternate;
}

.hero__grain {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%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");
  mix-blend-mode: overlay;
}

.hero__content {
  position: relative;
  z-index: 1;
}

@keyframes meshShift {
  0% {
    filter: hue-rotate(0deg);
    transform: scale(1);
  }
  100% {
    filter: hue-rotate(12deg);
    transform: scale(1.03);
  }
}

/* Tipografía cinética (hero) */
.hero__title--kinetic {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25em 0.35em;
  perspective: 800px;
}

.hero__word {
  display: inline-block;
  opacity: 0;
  transform: translate3d(0, 0.45em, 0) rotateX(-14deg);
  transform-origin: 50% 100%;
}

.hero__word--accent {
  background: linear-gradient(105deg, #fff 0%, #fdba74 45%, #e85d04 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

body.is-ready .hero__word {
  animation: kineticIn 0.95s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

body.is-ready .hero__word:nth-child(1) {
  animation-delay: 0.06s;
}

body.is-ready .hero__word:nth-child(2) {
  animation-delay: 0.2s;
}

@keyframes kineticIn {
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotateX(0);
  }
}

/* Parallax suave en foto hero */
.hero__visual {
  overflow: hidden;
}

.hero__photo {
  will-change: transform;
  transition: transform 0.15s ease-out;
}

/* —— Microinteracciones: botones —— */
.btn {
  position: relative;
  overflow: hidden;
  transform: translateY(0);
  box-shadow: 0 4px 14px rgba(15, 39, 68, 0.12);
  transition:
    transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.25s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 28px rgba(232, 93, 4, 0.28);
}

.btn:active {
  transform: translateY(-1px) scale(0.99);
  box-shadow: 0 4px 12px rgba(15, 39, 68, 0.15);
}

.btn .btn__ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transform: scale(0);
  animation: rippleGo 0.65s ease-out forwards;
  pointer-events: none;
}

@keyframes rippleGo {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

html[data-theme="dark"] .btn--ghost:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* —— Navegación: subrayado animado —— */
.nav__list a {
  position: relative;
  padding-bottom: 2px;
}

.nav__list a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s ease;
}

.nav__list a:hover::after,
.nav__list a:focus-visible::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* —— Sectores: micro rebote —— */
.sectors__link {
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sectors__link:hover {
  transform: translateY(-3px);
}

/* —— Tarjetas promo y tiendas —— */
.promo-card {
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  transform-style: preserve-3d;
}

.promo-card:hover {
  box-shadow: 0 24px 50px rgba(15, 39, 68, 0.18);
}

.card--media {
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.card--media:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 48px rgba(15, 39, 68, 0.14);
}

.store--lift {
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.store--lift:hover {
  transform: translateY(-5px);
  box-shadow: 0 22px 55px rgba(15, 39, 68, 0.16);
}

/* —— Formulario: check verde —— */
.field__control {
  position: relative;
  display: block;
}

.field__check {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
  pointer-events: none;
}

.field--validable .field__input--area ~ .field__check {
  top: 1rem;
  transform: scale(0);
}

.field--validable.is-valid .field__check {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.field--validable.is-valid .field__input--area ~ .field__check {
  transform: scale(1);
  top: 0.85rem;
}

.field__input:focus:valid:not(:placeholder-shown) {
  border-color: rgba(34, 197, 94, 0.55);
}

.field--validable.is-valid .field__input {
  border-color: rgba(34, 197, 94, 0.65);
  padding-right: 2.5rem;
}

.field--validable .field__input--area.is-valid-padding {
  padding-right: 2.5rem;
}

/* —— Toggle tema —— */
.theme-toggle {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.theme-toggle:hover {
  transform: rotate(12deg) scale(1.05);
  border-color: var(--color-accent);
}

.theme-toggle__icon {
  position: absolute;
  transition: opacity 0.3s ease, transform 0.35s ease;
}

.theme-toggle__icon--moon {
  opacity: 0;
  transform: rotate(-45deg) scale(0.5);
}

html[data-theme="dark"] .theme-toggle__icon--sun {
  opacity: 0;
  transform: rotate(45deg) scale(0.5);
}

html[data-theme="dark"] .theme-toggle__icon--moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

html[data-theme="dark"] .theme-toggle {
  background: rgba(30, 41, 59, 0.6);
  color: #fdba74;
}

/* —— View Transitions (tema) —— */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.4s;
}

/* —— Reduced motion —— */
@media (prefers-reduced-motion: reduce) {
  .hero__mesh {
    animation: none;
  }

  .hero__word {
    opacity: 1;
    transform: none;
  }

  body.is-ready .hero__word {
    animation: none;
  }

  .btn:hover,
  .sectors__link:hover,
  .promo-card:hover,
  .card--media:hover,
  .store--lift:hover {
    transform: none;
  }

  .feature--glass:hover {
    transform: none;
  }

  .theme-toggle:hover {
    transform: none;
  }
}
