html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
}

h2, h3 {
  line-height: 1.35;
  letter-spacing: -0.01em;
}

/* =====================
   ANIMATIONS
   ===================== */

@keyframes fade-up {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes scale-pop {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}

/* Hero: anima al cargar */
.ha {
  animation: fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.ha-1 { animation-delay: 0.05s; }
.ha-2 { animation-delay: 0.16s; }
.ha-3 { animation-delay: 0.27s; }
.ha-4 { animation-delay: 0.37s; }
.ha-5 { animation-delay: 0.47s; }
.ha-6 { animation-delay: 0.57s; }

/* Scroll: fade-up al entrar en viewport */
.sa {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.sa.visible { opacity: 1; transform: translateY(0); }
.sa.d1 { transition-delay: 0.08s; }
.sa.d2 { transition-delay: 0.16s; }
.sa.d3 { transition-delay: 0.24s; }
.sa.d4 { transition-delay: 0.32s; }

/* Stats: scale-pop */
.spa {
  opacity: 0;
  transform: scale(0.88);
  transition: opacity 0.55s ease,
              transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.spa.visible { opacity: 1; transform: scale(1); }
.spa.d1 { transition-delay: 0.06s; }
.spa.d2 { transition-delay: 0.14s; }
.spa.d3 { transition-delay: 0.22s; }
.spa.d4 { transition-delay: 0.30s; }

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .ha  { animation: none; opacity: 1; transform: none; }
  .sa  { transition: none; opacity: 1; transform: none; }
  .spa { transition: none; opacity: 1; transform: none; }
}

/* HERO */
.hero-section {
  min-height: 78vh;
  display: flex;
  align-items: center;
  background-image: url('https://images.unsplash.com/photo-1558618666-fcd25c85cd64?w=1400&q=80');
  background-size: cover;
  background-position: center right;
}

.hero-overlay {
  background: linear-gradient(
    135deg,
    rgba(10, 26, 14, 0.97) 0%,
    rgba(21, 128, 61, 0.88) 55%,
    rgba(22, 101, 52, 0.75) 100%
  );
}

.hero-dots {
  opacity: 0.05;
  background-image: radial-gradient(circle, #ffffff 1px, transparent 1px);
  background-size: 28px 28px;
}

.hero-badge {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #bbf7d0;
}

.hero-badge-dot {
  animation: pulse-glow 2.2s infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* Urgency top bar dot */
.urgency-dot {
  animation: pulse-glow 1.8s infinite;
  display: inline-block;
}

/* Process steps connector */
@media (min-width: 768px) {
  .process-grid::before {
    content: '';
    position: absolute;
    top: 1.75rem;
    left: 25%;
    right: 25%;
    height: 2px;
    background: linear-gradient(to right, #16a34a 0%, #16a34a 100%);
    opacity: 0.15;
    z-index: 0;
  }
}

/* iOS zoom fix */
input, select, textarea, button {
  font-size: max(16px, 1em);
}

@media (min-width: 640px) {
  input, select, textarea {
    font-size: inherit;
  }
}

/* Mobile CTA bar */
.mobile-cta-bar {
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.1);
}

@media (max-width: 1023px) {
  body {
    padding-bottom: calc(4.25rem + env(safe-area-inset-bottom, 0));
  }
}

/* Hero WA labels */
.btn-hero-wa .wa-label-long { display: none; }

@media (min-width: 640px) {
  .btn-hero-wa .wa-label-short { display: none; }
  .btn-hero-wa .wa-label-long { display: inline; }
}

/* Contact */
.contact-line { flex-wrap: wrap; row-gap: 0.25rem; }

.break-anywhere {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* FAQ */
@media (max-width: 639px) {
  .faq-trigger {
    font-size: 0.9375rem;
    line-height: 1.35;
    padding-top: 0.875rem;
    padding-bottom: 0.875rem;
  }
}

/* Reviews */
.review-card { min-height: 10rem; }

@media (max-width: 639px) {
  .review-card { min-height: auto; }
}

/* Urgency button */
.btn-urgencias {
  max-width: 10.75rem;
  text-decoration: none;
}

.btn-urgencias--block { max-width: 100%; }

.btn-urgencias__stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  line-height: 1.15;
  min-width: 0;
  max-width: 100%;
}

.btn-urgencias__label {
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
}

.btn-urgencias__phone {
  font-size: 0.6875rem;
  font-weight: 600;
  opacity: 0.92;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-urgencias--block .btn-urgencias__phone { max-width: 14rem; }

@media (min-width: 768px) {
  .btn-urgencias { max-width: 11.5rem; }
  .btn-urgencias__phone { max-width: 10.5rem; }
}

/* Gallery */
.gallery-track {
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #16a34a #e5e7eb;
  max-width: 100%;
}

.gallery-slide {
  scroll-snap-align: start;
  flex: 0 0 min(88vw, 20rem);
}

@media (min-width: 640px) {
  .gallery-slide { flex: 0 0 70%; }
}

@media (min-width: 768px) {
  .gallery-slide { flex: 0 0 46%; }
}

/* FAQ accordion */
.faq-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.faq-panel.is-open { max-height: 24rem; }

.faq-trigger[aria-expanded='true'] .faq-chevron { transform: rotate(180deg); }

.faq-chevron { transition: transform 0.25s ease; }

/* WhatsApp button */
.btn-whatsapp { background-color: #25d366; }
.btn-whatsapp:hover { background-color: #1ebe57; }
.btn-whatsapp:focus-visible { outline: 2px solid #166534; outline-offset: 2px; }

/* Mobile nav */
.nav-mobile-panel {
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.nav-mobile-panel.is-open { transform: translateX(0); }

/* Floating WhatsApp button (desktop) */
.floating-wa-btn {
  animation: float-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 1.2s both;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.floating-wa-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 20px 40px rgba(37, 211, 102, 0.35);
}

@keyframes float-in {
  from { transform: translateY(24px) scale(0.9); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Privacy modal */
.modal-backdrop {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
}
