:root {
  color-scheme: dark;
  --emerald-glow: rgba(16, 185, 129, 0.15);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

html, body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Focus */
:focus-visible {
  outline: 2px solid rgba(16, 185, 129, 0.55);
  outline-offset: 2px;
}

/* Summary marker */
details > summary::-webkit-details-marker { display: none; }
details > summary::marker { display: none; content: ""; }

/* Scroll-based header shrink */
header.scrolled {
  border-bottom-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

/* Reveal-on-scroll animation */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.reveal-stagger > .reveal:nth-child(1) { transition-delay: 0s; }
.reveal-stagger > .reveal:nth-child(2) { transition-delay: 0.08s; }
.reveal-stagger > .reveal:nth-child(3) { transition-delay: 0.16s; }
.reveal-stagger > .reveal:nth-child(4) { transition-delay: 0.24s; }
.reveal-stagger > .reveal:nth-child(5) { transition-delay: 0.32s; }
.reveal-stagger > .reveal:nth-child(6) { transition-delay: 0.4s; }
.reveal-stagger > .reveal:nth-child(7) { transition-delay: 0.48s; }
.reveal-stagger > .reveal:nth-child(8) { transition-delay: 0.56s; }
.reveal-stagger > .reveal:nth-child(9) { transition-delay: 0.64s; }
.reveal-stagger > .reveal:nth-child(10) { transition-delay: 0.72s; }

/* Gradient text helper — see animated version below */

/* Glow card hover */
.glow-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.glow-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(16, 185, 129, 0.06), transparent 40%);
  pointer-events: none;
}
.glow-card:hover::before { opacity: 1; }
.glow-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

/* Floating WhatsApp button */
.whatsapp-float {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #25d366;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: float-pulse 2s ease-in-out infinite;
}
.whatsapp-float:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(37, 211, 102, 0.55);
}
@keyframes float-pulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Mobile menu slide */
#mobileMenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  opacity: 0;
}
#mobileMenu.open {
  max-height: 500px;
  opacity: 1;
}

/* Counter animation */
.counter-number {
  font-variant-numeric: tabular-nums;
}

/* Plan card popular ribbon */
.popular-badge {
  position: absolute;
  top: -1px;
  right: 1.25rem;
  background: linear-gradient(135deg, #34d399, #06b6d4);
  color: #0f172a;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.35rem 0.85rem;
  border-radius: 0 0 0.75rem 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Pricing toggle */
.pricing-toggle {
  position: relative;
  display: inline-flex;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 3px;
}
.pricing-toggle button {
  position: relative;
  z-index: 1;
  padding: 0.4rem 1.2rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  transition: color 0.25s ease;
  background: none;
  border: none;
  cursor: pointer;
}
.pricing-toggle button.active { color: #0f172a; }
.pricing-toggle .toggle-bg {
  position: absolute;
  top: 3px;
  height: calc(100% - 6px);
  border-radius: 9999px;
  background: linear-gradient(135deg, #34d399, #06b6d4);
  transition: left 0.3s ease, width 0.3s ease;
}

/* Section divider */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(16, 185, 129, 0.3), transparent);
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #0f172a; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); }

/* Service card icon container */
.service-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  flex-shrink: 0;
}
.service-icon svg {
  width: 20px;
  height: 20px;
  stroke: #34d399;
}

/* Hero background mesh */
.hero-mesh {
  background-image:
    radial-gradient(at 27% 37%, rgba(16, 185, 129, 0.15) 0px, transparent 50%),
    radial-gradient(at 97% 21%, rgba(6, 182, 212, 0.1) 0px, transparent 50%),
    radial-gradient(at 52% 99%, rgba(16, 185, 129, 0.08) 0px, transparent 50%);
}

/* Checkmark icon for lists */
.check-list li {
  position: relative;
  padding-left: 1.5rem;
}
.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  border: 1.5px solid #34d399;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2334d399' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  background-size: 9px;
  background-repeat: no-repeat;
  background-position: center;
}

/* ===== Marquee animation ===== */
@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.marquee-track {
  animation: marquee 30s linear infinite;
  will-change: transform;
}
.marquee-track:hover {
  animation-play-state: paused;
}

/* Animated gradient border on featured cards */
@keyframes gradient-rotate {
  0% { --angle: 0deg; }
  100% { --angle: 360deg; }
}

/* Subtle grain texture overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.015;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* Smooth section transitions */
section {
  position: relative;
}

/* Animated underline on nav links */
nav a {
  position: relative;
}
nav a::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #34d399, #06b6d4);
  border-radius: 2px;
  transition: width 0.3s ease, left 0.3s ease;
}
nav a:hover::after,
nav a.text-white::after {
  width: 60%;
  left: 20%;
}

/* Glow pulse on CTA buttons */
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.2); }
  50% { box-shadow: 0 0 30px rgba(16, 185, 129, 0.4); }
}
a[id^="whatsapp"]:not(.whatsapp-float) {
  animation: glow-pulse 3s ease-in-out infinite;
}
a[id^="whatsapp"]:hover {
  animation: none;
}

/* Hero text shimmer effect */
@keyframes text-shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
.text-gradient {
  background: linear-gradient(90deg, #34d399 0%, #06b6d4 25%, #34d399 50%, #06b6d4 75%, #34d399 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: text-shimmer 6s linear infinite;
}

/* Card shine sweep on hover */
.glow-card::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 40%,
    rgba(16, 185, 129, 0.03) 45%,
    rgba(16, 185, 129, 0.05) 50%,
    rgba(16, 185, 129, 0.03) 55%,
    transparent 60%
  );
  transform: translateX(-100%);
  transition: transform 0.8s ease;
  pointer-events: none;
}
.glow-card:hover::after {
  transform: translateX(100%);
}

/* ===== Mobile optimizations ===== */
@media (max-width: 767px) {
  /* Better tap targets */
  #mobileMenu a {
    padding: 0.75rem 1rem;
    font-size: 0.938rem;
    border-radius: 0.75rem;
  }

  /* Reduce hero text for small screens */
  section#inicio h1 {
    font-size: 1.875rem;
    line-height: 1.15;
  }
  section#inicio p {
    font-size: 0.875rem;
  }

  /* Full-width buttons on mobile */
  section#inicio .flex.flex-col a,
  section#inicio .flex.flex-col button {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  /* Stack counter stats better */
  section#inicio dl {
    gap: 0.5rem;
  }

  /* Cards: reduce padding on mobile */
  .glow-card {
    padding: 1.25rem;
  }
  article.glow-card {
    padding: 1.25rem;
  }

  /* Section headings smaller on mobile */
  section h2 {
    font-size: 1.5rem;
  }

  /* WhatsApp float: slightly smaller on mobile */
  .whatsapp-float {
    width: 50px;
    height: 50px;
    bottom: 1rem;
    right: 1rem;
  }
  .whatsapp-float svg {
    width: 24px;
    height: 24px;
  }

  /* Fix plan cards overflow */
  .popular-badge {
    font-size: 0.6rem;
    padding: 0.25rem 0.6rem;
    right: 0.75rem;
  }

  /* Contact section: stack nicely */
  #contacto form {
    padding: 1.25rem;
  }

  /* Footer: single column already via grid, tighten spacing */
  footer .grid {
    gap: 1.5rem;
  }

  /* Service details cards */
  details.glow-card {
    padding: 1rem;
  }

  /* Better spacing for FAQ section */
  details summary .flex {
    gap: 0.75rem;
  }

  /* Facturación Ilimitada featured card: stack vertically */
  .reveal.mb-5 .flex.flex-col {
    gap: 1.5rem;
  }
}
