/* Keyframes */
@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotate(var(--rot, 0deg));
  }
  50% {
    transform: translateY(-12px) rotate(calc(var(--rot, 0deg) + 5deg));
  }
}

@keyframes scroll-line {
  0% {
    transform: scaleY(0);
    transform-origin: top;
  }
  45% {
    transform: scaleY(1);
    transform-origin: top;
  }
  55% {
    transform: scaleY(1);
    transform-origin: bottom;
  }
  100% {
    transform: scaleY(0);
    transform-origin: bottom;
  }
}

@keyframes hero-in {
  from {
    scale: 1.06;
  }
  to {
    scale: 1;
  }
}

@keyframes shake {
  10%,
  90% {
    translate: -1px 0;
  }
  20%,
  80% {
    translate: 2px 0;
  }
  30%,
  50%,
  70% {
    translate: -5px 0;
  }
  40%,
  60% {
    translate: 5px 0;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes toast-icon {
  from {
    transform: scale(0.4) rotate(-90deg);
  }
  to {
    transform: scale(1) rotate(0deg);
  }
}

/* Scroll-reveal */
:where(.reveal-ready) .reveal {
  translate: 0 28px;
  transition: translate 1s var(--ease) var(--reveal-delay);
}

:where(.reveal-ready) .reveal.is-visible {
  translate: none;
}

.reveal[data-delay="1"] {
  --reveal-delay: 0.08s;
}

.reveal[data-delay="2"] {
  --reveal-delay: 0.16s;
}

.reveal[data-delay="3"] {
  --reveal-delay: 0.24s;
}

/* Portada */
.hero__media {
  animation: hero-in 1.8s var(--ease) both;
}

.scene canvas {
  opacity: 0;
  transition: opacity 1.4s var(--ease);
}

.scene.is-live canvas {
  opacity: 1;
}

.hero__stars {
  transition: opacity 1s var(--ease);
}

.scene.is-live ~ .hero__stars {
  opacity: 0;
}

.hero__star,
.contact__star {
  animation: float 9s ease-in-out infinite;
}

.hero__star--2,
.contact__star--b {
  animation-duration: 7s;
  animation-delay: -2s;
}

.hero__star--3 {
  animation-duration: 11s;
  animation-delay: -4s;
}

.hero__star--4 {
  animation-duration: 10s;
  animation-delay: -6s;
}

.scroll-hint__line::after {
  animation: scroll-line 2.4s var(--ease) infinite;
}

.scroll-hint {
  transition: color 0.3s var(--ease);
}

.scroll-hint:hover {
  color: var(--on-granate);
}

/* Navegación */
.progress__bar {
  transition: transform 0.12s linear;
}

.nav {
  transition: background-color var(--dur) var(--ease);
}

.nav__links a {
  transition: color 0.3s var(--ease);
}

.nav__links a::after {
  transition: transform 0.45s var(--ease);
}

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

.nav__links a:hover::after,
.nav__links a.is-active::after {
  transform: scaleX(1);
  transform-origin: left center;
}

.monogram {
  transition: transform 0.6s var(--ease);
}

.brand:hover .monogram {
  transform: rotate(-6deg) scale(1.06);
}

/* Botones y píldoras */
.btn {
  transition:
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease),
    background-color 0.3s var(--ease);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn--light:hover {
  background: var(--crudo-light);
  box-shadow: var(--glow);
}

.btn.is-loading::after {
  animation: spin 0.7s linear infinite;
}

.pill {
  transition:
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.offer:hover .pill {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift), inset 0 1px 0 var(--on-granate-line);
}

/* Estrellas y sello */
.star {
  transition: rotate 1.2s var(--ease), scale 1.2s var(--ease);
}

.sheet:hover .star--tl,
.sheet:hover .star--r {
  rotate: 6deg;
}

.sheet:hover .star--tr,
.sheet:hover .star--bl {
  rotate: -8deg;
  scale: 1.05;
}

.seal {
  transition:
    transform 0.8s var(--ease),
    box-shadow 0.8s var(--ease);
}

.service__head:hover .seal {
  transform: translateY(-4px) rotate(-3deg);
  box-shadow: var(--shadow-lift);
}

/* Formulario */
.inline-form {
  transition:
    border-color 0.3s var(--ease),
    box-shadow 0.4s var(--ease);
}

.inline-form.is-invalid {
  animation: shake 0.5s var(--ease);
}

/* Contacto y footer */
.contact__mail::after {
  transition: background-color 0.4s var(--ease), transform 0.6s var(--ease);
}

.contact__mail:hover::after {
  background: var(--crudo);
}

.contact__social a,
.contact__copy {
  transition:
    color 0.3s var(--ease),
    border-color 0.3s var(--ease),
    background-color 0.3s var(--ease),
    transform var(--dur) var(--ease);
}

.contact__social a:hover,
.contact__copy:hover {
  color: var(--on-granate);
  border-color: var(--crudo);
  background: var(--on-granate-surface);
  transform: translateY(-2px);
}

/* Aviso */
.toast {
  transition:
    transform 0.6s var(--ease),
    opacity 0.4s var(--ease);
}

.toast.is-visible .toast__icon {
  animation: toast-icon 0.6s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }

  :where(.reveal-ready) .reveal {
    translate: none;
  }
}
