/* ===========================
   CONTACTO — ANIMATIONS
   =========================== */

/* ——— Keyframes ——— */

@keyframes ctRevealUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0);    }
}

@keyframes ctRevealLeft {
  from { opacity: 0; transform: translateX(-28px); }
  to   { opacity: 1; transform: translateX(0);     }
}

@keyframes ctRevealRight {
  from { opacity: 0; transform: translateX(28px); }
  to   { opacity: 1; transform: translateX(0);    }
}

@keyframes ctRevealScale {
  from { opacity: 0; transform: scale(0.92) translateY(14px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

@keyframes ctFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes ctHeroLineGrow {
  from { transform: scaleX(0); opacity: 0; }
  to   { transform: scaleX(1); opacity: 1; }
}

@keyframes ctFloatBlob {
  0%,  100% { transform: translate(0,   0)    scale(1);    }
  33%        { transform: translate(26px, -18px) scale(1.05); }
  66%        { transform: translate(-16px, 14px) scale(0.95); }
}

@keyframes ctShimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}

@keyframes ctSuccessPop {
  0%   { opacity: 0; transform: scale(0.8) translateY(12px); }
  60%  { opacity: 1; transform: scale(1.04) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes ctCheckDraw {
  0%   { stroke-dashoffset: 60; opacity: 0; }
  40%  { opacity: 1; }
  100% { stroke-dashoffset: 0;  opacity: 1; }
}

@keyframes ctFieldFocusPulse {
  0%   { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
  50%  { box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.08); }
  100% { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
}

@keyframes ctInfoIconPop {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 1; transform: scale(1);   }
}

/* ===========================
   SCROLL REVEAL — Contact-scoped
   =========================== */

[data-reveal-ct] {
  opacity: 0;
}

[data-reveal-ct="up"]    { transform: translateY(28px); }
[data-reveal-ct="left"]  { transform: translateX(-28px); }
[data-reveal-ct="right"] { transform: translateX(28px); }
[data-reveal-ct="scale"] { transform: scale(0.93) translateY(14px); }

[data-reveal-ct="up"].is-revealed-ct    { animation: ctRevealUp    0.65s cubic-bezier(0.16, 1, 0.3, 1) both; }
[data-reveal-ct="left"].is-revealed-ct  { animation: ctRevealLeft  0.65s cubic-bezier(0.16, 1, 0.3, 1) both; }
[data-reveal-ct="right"].is-revealed-ct { animation: ctRevealRight 0.65s cubic-bezier(0.16, 1, 0.3, 1) both; }
[data-reveal-ct="scale"].is-revealed-ct { animation: ctRevealScale 0.65s cubic-bezier(0.16, 1, 0.3, 1) both; }
[data-reveal-ct="fade"].is-revealed-ct  { animation: ctFadeIn      0.65s cubic-bezier(0.16, 1, 0.3, 1) both; }

[data-reveal-ct].is-revealed-ct {
  animation-delay: var(--delay, 0ms);
}

/* ===========================
   HERO — Page-Load Animations
   =========================== */

.contacto-hero {
  overflow: hidden;
  position: relative;
}

.contacto-hero .section-container {
  position: relative;
  z-index: 1;
}

.contacto-hero-animate .contacto-badge {
  animation: ctRevealUp 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.10s;
}

.contacto-hero-animate .contacto-title {
  animation: ctRevealUp 0.65s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.28s;
}

.contacto-hero-animate .contacto-desc {
  animation: ctRevealUp 0.65s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.44s;
}

/* Accent line grows from center */
.contacto-hero-animate .contacto-hero-line {
  transform-origin: center;
  animation: ctHeroLineGrow 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.60s;
}

/* ===========================
   HERO — Floating Background Blobs
   =========================== */

.contacto-hero-blob {
  animation: ctFloatBlob var(--blob-duration, 15s) ease-in-out infinite;
  animation-delay: var(--blob-delay, 0s);
}

.contacto-hero-blob--1 {
  --blob-duration: 17s;
  --blob-delay: 0s;
}

.contacto-hero-blob--2 {
  --blob-duration: 14s;
  --blob-delay: -5s;
}

/* ===========================
   CONTACT INFO SIDEBAR — Staggered items
   =========================== */

.contacto-info-list li {
  opacity: 0;
  transform: translateX(-20px);
}

.contacto-info.is-revealed-ct .contacto-info-list li {
  animation: ctRevealLeft 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.contacto-info.is-revealed-ct .contacto-info-list li:nth-child(1) { animation-delay: 100ms; }
.contacto-info.is-revealed-ct .contacto-info-list li:nth-child(2) { animation-delay: 200ms; }
.contacto-info.is-revealed-ct .contacto-info-list li:nth-child(3) { animation-delay: 300ms; }

/* Icon pop-in stagger */
.contacto-info-icon {
  opacity: 0;
  transform: scale(0.5);
}

.contacto-info.is-revealed-ct .contacto-info-icon {
  animation: ctInfoIconPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.contacto-info.is-revealed-ct li:nth-child(1) .contacto-info-icon { animation-delay: 150ms; }
.contacto-info.is-revealed-ct li:nth-child(2) .contacto-info-icon { animation-delay: 250ms; }
.contacto-info.is-revealed-ct li:nth-child(3) .contacto-info-icon { animation-delay: 350ms; }

/* ===========================
   FORM CARD — Staggered fields
   =========================== */

.contacto-form-card {
  opacity: 0;
  transform: translateY(30px);
}

.contacto-form-card.is-revealed-ct {
  animation: ctRevealUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.15s;
}

/* Each form field / field-row staggers in */
.contacto-form-card .contacto-field,
.contacto-form-card .contacto-field-row {
  opacity: 0;
  transform: translateY(16px);
}

.contacto-form-card.is-revealed-ct .contacto-field,
.contacto-form-card.is-revealed-ct .contacto-field-row {
  animation: ctRevealUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.contacto-form-card.is-revealed-ct > form > .contacto-field-row:nth-child(2) { animation-delay: 250ms; }
.contacto-form-card.is-revealed-ct > form > .contacto-field-row:nth-child(3) { animation-delay: 360ms; }
.contacto-form-card.is-revealed-ct > form > .contacto-field:nth-child(4) { animation-delay: 470ms; }

/* Submit button entrance */
.contacto-form-card .btn-contacto-submit {
  opacity: 0;
  transform: translateY(12px);
}

.contacto-form-card.is-revealed-ct .btn-contacto-submit {
  animation: ctRevealUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 580ms;
}

/* Field focus glow animation */
.contacto-field input:focus,
.contacto-field select:focus,
.contacto-field textarea:focus {
  animation: ctFieldFocusPulse 2s ease-in-out infinite;
}

/* Submit button CTA shimmer */
.btn-contacto-submit {
  position: relative;
  overflow: hidden;
}

.btn-contacto-submit::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent   35%,
    rgba(255, 255, 255, 0.25) 50%,
    transparent   65%
  );
  background-size: 200% 100%;
  animation: ctShimmer 3.5s linear infinite;
  animation-delay: 1.5s;
  pointer-events: none;
}

.btn-contacto-submit:disabled::after {
  display: none;
}

/* ===========================
   SUCCESS STATE — Animated entrance
   =========================== */

.contacto-success.is-animating {
  animation: ctSuccessPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.contacto-success.is-animating svg circle,
.contacto-success.is-animating svg path {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: ctCheckDraw 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.3s;
}

/* ===========================
   REDUCED MOTION — Accessibility
   =========================== */

@media (prefers-reduced-motion: reduce) {
  [data-reveal-ct],
  .contacto-hero-animate .contacto-badge,
  .contacto-hero-animate .contacto-title,
  .contacto-hero-animate .contacto-desc,
  .contacto-hero-animate .contacto-hero-line,
  .contacto-hero-blob,
  .contacto-info-list li,
  .contacto-info-icon,
  .contacto-form-card,
  .contacto-form-card .contacto-field,
  .contacto-form-card .contacto-field-row,
  .contacto-form-card .btn-contacto-submit,
  .contacto-success.is-animating,
  .btn-contacto-submit::after {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
