/* ===== BASE ===== */
html {
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
}

/* ===== HERO GRID ===== */
.hero-grid {
  background-size: 56px 56px;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  mask-image: radial-gradient(ellipse 85% 70% at 50% 0%, black 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 85% 70% at 50% 0%, black 20%, transparent 75%);
}

/* ===== STATS SHIMMER ===== */
@keyframes stats-shimmer-move {
  0% { transform: translateX(-100%) skewX(-12deg); }
  100% { transform: translateX(200%) skewX(-12deg); }
}

.stats-shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255, 255, 255, 0.12) 50%,
    transparent 70%
  );
  animation: stats-shimmer-move 7s ease-in-out infinite;
}

/* ===== STEP CONNECTOR ===== */
.step-connector-glow {
  box-shadow: 0 0 24px 1px rgba(34, 211, 238, 0.25);
}

/* ===== NAVBAR SHADOW ON SCROLL ===== */
#navbar.scrolled {
  box-shadow:
    0 1px 0 0 rgba(255, 255, 255, 0.06),
    0 16px 48px -16px rgba(0, 0, 0, 0.65);
}

/* ===== FADE-IN ANIMATION (Intersection Observer) ===== */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children when they share a parent grid */
.fade-in:nth-child(2) { transition-delay: 0.08s; }
.fade-in:nth-child(3) { transition-delay: 0.16s; }
.fade-in:nth-child(4) { transition-delay: 0.24s; }
.fade-in:nth-child(5) { transition-delay: 0.30s; }
.fade-in:nth-child(6) { transition-delay: 0.36s; }
.fade-in:nth-child(7) { transition-delay: 0.40s; }
.fade-in:nth-child(8) { transition-delay: 0.44s; }
.fade-in:nth-child(9) { transition-delay: 0.48s; }
.fade-in:nth-child(10) { transition-delay: 0.52s; }

/* ===== MOBILE MENU ANIMATION ===== */
#mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

#mobile-menu.open {
  max-height: 400px;
}

/* Override the "hidden" when transitioning */
#mobile-menu.transitioning {
  display: block !important;
}

/* ===== HERO GRADIENT PULSE ===== */
@keyframes gradient-shift {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.06); }
}

.hero-glow {
  animation: gradient-shift 8s ease-in-out infinite;
}

/* ===== FORM FOCUS GLOW ===== */
#demo-form input:focus,
#demo-form select:focus {
  box-shadow: 0 0 0 3px rgba(34,211,238, 0.2);
}

#demo-form select option {
  background-color: #18181b;
  color: #f4f4f5;
}

/* ===== FORM SUCCESS STATE ===== */
#demo-form.submitted {
  position: relative;
}

#demo-form .success-message {
  display: none;
}

#demo-form.submitted .success-message {
  display: flex;
}

#demo-form.submitted .form-fields {
  display: none;
}

/* ===== SMOOTH SCROLL OFFSET FOR FIXED NAVBAR ===== */
:target {
  scroll-margin-top: 80px;
}

[id] {
  scroll-margin-top: 80px;
}

/* ===== BUTTON PRESS EFFECT ===== */
button:active,
a[href="#contacto"]:active {
  transform: scale(0.98) !important;
}

/* ===== SELECTION COLOR ===== */
::selection {
  background-color: rgba(34, 211, 238, 0.28);
  color: #f8fafc;
}

/* ===== CUSTOM SCROLLBAR (webkit) ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #27272a;
}

::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

@media (prefers-reduced-motion: reduce) {
  .hero-glow,
  .stats-shimmer::after {
    animation: none;
  }
  .stats-shimmer::after {
    opacity: 0;
  }
}
