:root {
  --brand-light: #fcfbf9;
  --brand-primary: #1a3c2e;
  --text-main: #1f2937;
}

* {
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-padding-top: 80px;
  overscroll-behavior-y: none;
}

@media (max-width: 768px) {
  html {
    scroll-padding-top: 70px;
  }
}

body {
  background-color: var(--brand-light);
  color: var(--text-main);
  margin: 0;
  font-family: 'Manrope', sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

.hero-placeholder {
  background-color: #0f172a;
  min-height: 100vh;
}

.text-shadow-sm {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.safe-area-top {
  padding-top: env(safe-area-inset-top);
}

.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}

.touch-target {
  min-height: 44px;
  min-width: 44px;
}

/* Animations */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-in-right {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.animate-fade-in-up {
  animation: fade-in-up 0.8s ease-out forwards;
  will-change: transform, opacity;
}

.animate-slide-in-right {
  animation: slide-in-right 0.3s ease-out forwards;
  will-change: transform;
}

.animate-fade-in {
  animation: fade-in 0.3s ease-out forwards;
  will-change: opacity;
}

.reveal {
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1), transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* WhatsApp pulsing glow effect */
@keyframes whatsapp-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.4);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(37, 211, 102, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
  }
}

.whatsapp-pulse {
  animation: whatsapp-pulse 2s infinite;
}

/* --- HERO STAGGERED ENTRANCE --- */
@keyframes hero-enter {
  from {
    opacity: 0;
    transform: translateY(28px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

.hero-stagger-1,
.hero-stagger-2,
.hero-stagger-3,
.hero-stagger-4 {
  opacity: 0;
  animation: hero-enter 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero-stagger-1 { animation-delay: 0.2s; }
.hero-stagger-2 { animation-delay: 0.45s; }
.hero-stagger-3 { animation-delay: 0.65s; }
.hero-stagger-4 { animation-delay: 0.85s; }

/* Subtle shimmer on the badge */
@keyframes badge-shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.badge-shimmer {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(181, 146, 76, 0.08) 45%,
    rgba(181, 146, 76, 0.15) 50%,
    rgba(181, 146, 76, 0.08) 55%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: badge-shimmer 4s ease-in-out infinite;
  animation-delay: 2s;
}

/* --- SERVICE CARD GOLDEN ACCENT LINE --- */
.service-card {
  position: relative;
  border-radius: 2px !important;
}

.service-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2.5px;
  background: linear-gradient(90deg, #b5924c, #d4b06a, #b5924c);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1), left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 5;
}

.service-card:hover::after {
  width: 100%;
  left: 0;
}

/* --- FORM INPUT MICRO-INTERACTIONS --- */
.form-input-enhanced {
  position: relative;
  transition: all 0.3s ease;
}

.form-input-enhanced:focus {
  border-color: #1a3c2e !important;
  box-shadow: 0 0 0 3px rgba(26, 60, 46, 0.1), 0 2px 8px rgba(26, 60, 46, 0.06) !important;
  transform: translateY(-1px);
}

/* Submit button glow when enabled */
@keyframes btn-glow-pulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(181, 146, 76, 0.25); }
  50% { box-shadow: 0 4px 20px rgba(181, 146, 76, 0.4); }
}

.btn-glow-enabled {
  animation: btn-glow-pulse 2.5s ease-in-out infinite;
}

/* --- WHATSAPP DELAYED ENTRANCE --- */
@keyframes whatsapp-enter {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.whatsapp-delayed {
  opacity: 0;
  animation: whatsapp-enter 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: 1.5s;
}

/* --- SCROLL ARROW DELAYED FADE --- */
@keyframes arrow-fade-bounce {
  0%, 100% {
    opacity: 0.5;
    transform: translate(-50%, 0);
  }
  50% {
    opacity: 0.5;
    transform: translate(-50%, 8px);
  }
}

.scroll-arrow-delayed {
  opacity: 0;
  animation: hero-enter 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: 1.3s;
}

.scroll-arrow-delayed.animate-complete {
  animation: arrow-fade-bounce 2s ease-in-out infinite;
}

/* --- STAT COUNTER HIGHLIGHT --- */
.stat-counter {
  transition: all 0.4s ease;
}

.stat-counter.counted {
  text-shadow: 0 0 20px rgba(181, 146, 76, 0.15);
}

/* --- FOOTER LINK HOVER EFFECTS --- */
.footer-link {
  transition: color 0.3s ease, padding-left 0.3s ease;
}

.footer-link:hover {
  padding-left: 4px;
}

/* --- PROJECT CHIP / BADGE --- */
.project-chip {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  line-height: 1.6;
}

/* --- PREMIUM INTERACTIVE EFFECTS --- */

/* Floating Capsule Header Styling */
.capsule-header {
  position: fixed;
  top: 1.25rem;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 50;
  pointer-events: none; /* Permite clicks a través del contenedor del header */
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), top 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.capsule-header.header-scrolled {
  top: 0.75rem;
}

.capsule-nav-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: auto;
  margin: 0 auto;
  pointer-events: auto; /* Habilita clicks en el menú en sí */
}

#desktop-nav {
  display: flex;
  align-items: center;
  gap: 2.25rem;
  padding: 0.75rem 0.75rem 0.75rem 2.25rem; /* Asymmetric right padding concentric with button */
  border-radius: 9999px;
  background-color: rgba(17, 24, 39, 0.35); /* Cristal esmerilado oscuro inicial mejorado */
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.25);
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Estado Scrolled del Menú */
.header-scrolled #desktop-nav {
  background-color: rgba(255, 255, 255, 0.85); /* Cristal esmerilado claro */
  border-color: rgba(26, 60, 46, 0.08);
  box-shadow: 0 10px 25px -5px rgba(26, 60, 46, 0.08), 0 0 1px 0 rgba(26, 60, 46, 0.1);
  padding: 0.55rem 0.55rem 0.55rem 2.25rem; /* Asymmetric right padding concentric with button in scrolled state */
}

/* Enlaces de escritorio dentro del Menú */
.nav-link-desktop {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.85);
  position: relative;
  transition: color 0.3s ease, text-shadow 0.3s ease;
  padding: 0.25rem 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); /* Sombra suave para contraste sobre fondos claros/nubes */
}

.nav-link-desktop:hover {
  color: #ffffff !important; /* Blanco puro en hover para legibilidad óptima */
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.header-scrolled .nav-link-desktop {
  color: var(--brand-dark, #111827) !important;
  text-shadow: none; /* Sin sombra en el menú claro scrolled */
}

.header-scrolled .nav-link-desktop:hover {
  color: var(--brand-primary, #1a3c2e) !important; /* Verde corporativo en hover al hacer scroll */
}

/* Animación de línea inferior que se expande desde el centro */
.nav-link-desktop::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 0;
  height: 2px;
  background-color: var(--brand-accent, #b5924c);
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-link-desktop:hover::after {
  width: 100%;
  left: 0;
}

/* Línea inferior en estado Scrolled */
.header-scrolled .nav-link-desktop::after {
  background-color: var(--brand-primary, #1a3c2e);
}

/* Botón CTA dentro de la Cápsula */
#header-cta {
  border-radius: 9999px !important; /* Forzar forma de píldora */
  padding: 0.5rem 1.25rem !important;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  transition: all 0.3s ease !important;
}

.capsule-cta-initial {
  background-color: transparent !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

.capsule-cta-initial:hover {
  background-color: #ffffff !important;
  color: var(--brand-primary, #1a3c2e) !important;
  border-color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15) !important;
}

.capsule-cta-scrolled {
  background-color: var(--brand-primary, #1a3c2e) !important;
  color: #ffffff !important;
  border: 1px solid var(--brand-primary, #1a3c2e) !important;
}

.capsule-cta-scrolled:hover {
  background-color: var(--brand-secondary, #2d6a4f) !important;
  border-color: var(--brand-secondary, #2d6a4f) !important;
  box-shadow: 0 4px 12px rgba(26, 60, 46, 0.2) !important;
}

/* Spotlight Card (Brillo sutil interactivo que sigue al cursor) */
.spotlight-card {
  position: relative;
  overflow: hidden;
}

.spotlight-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    350px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(181, 146, 76, 0.08), /* Dorado ultra sutil (8%) */
    transparent 50%
  );
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
  z-index: 1;
}

.spotlight-card:hover::before {
  opacity: 1;
}

/* Asegurar que el contenido de la tarjeta esté sobre el brillo */
.spotlight-card > * {
  position: relative;
  z-index: 2;
}

/* Hero Background Wrapper for Gapless and Ghosting-free Parallax */
#hero-bg-wrapper {
  position: absolute;
  top: -10%;
  left: 0;
  width: 100%;
  height: 120%;
  z-index: 0;
  background-size: cover;
  background-position: center;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

/* Eased Image Masking for natural photo-to-background fusion */
.blend-masked-image {
  opacity: 0.93;
  filter: saturate(0.8) brightness(0.97) contrast(1.02);
  /* Mobile default: top is opaque, bottom is transparent */
  mask-image: linear-gradient(
    to bottom,
    #000 0%,
    rgba(0, 0, 0, 0.98) 12%,
    rgba(0, 0, 0, 0.95) 25%,
    rgba(0, 0, 0, 0.88) 38%,
    rgba(0, 0, 0, 0.75) 50%,
    rgba(0, 0, 0, 0.58) 62%,
    rgba(0, 0, 0, 0.38) 75%,
    rgba(0, 0, 0, 0.2) 85%,
    rgba(0, 0, 0, 0.05) 93%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    #000 0%,
    rgba(0, 0, 0, 0.98) 12%,
    rgba(0, 0, 0, 0.95) 25%,
    rgba(0, 0, 0, 0.88) 38%,
    rgba(0, 0, 0, 0.75) 50%,
    rgba(0, 0, 0, 0.58) 62%,
    rgba(0, 0, 0, 0.38) 75%,
    rgba(0, 0, 0, 0.2) 85%,
    rgba(0, 0, 0, 0.05) 93%,
    transparent 100%
  );
}

/* Desktop: left is transparent, right is opaque */
@media (min-width: 1024px) {
  .blend-masked-image {
    mask-image: linear-gradient(
      to right,
      transparent 0%,
      rgba(0, 0, 0, 0.02) 8%,
      rgba(0, 0, 0, 0.08) 16%,
      rgba(0, 0, 0, 0.18) 25%,
      rgba(0, 0, 0, 0.32) 35%,
      rgba(0, 0, 0, 0.5) 46%,
      rgba(0, 0, 0, 0.68) 58%,
      rgba(0, 0, 0, 0.83) 70%,
      rgba(0, 0, 0, 0.93) 81%,
      rgba(0, 0, 0, 0.98) 91%,
      #000 100%
    );
    -webkit-mask-image: linear-gradient(
      to right,
      transparent 0%,
      rgba(0, 0, 0, 0.02) 8%,
      rgba(0, 0, 0, 0.08) 16%,
      rgba(0, 0, 0, 0.18) 25%,
      rgba(0, 0, 0, 0.32) 35%,
      rgba(0, 0, 0, 0.5) 46%,
      rgba(0, 0, 0, 0.68) 58%,
      rgba(0, 0, 0, 0.83) 70%,
      rgba(0, 0, 0, 0.93) 81%,
      rgba(0, 0, 0, 0.98) 91%,
      #000 100%
    );
  }
}

/* Eased Color Overlay to match lighting and prevent muddy highlights */
.blend-gradient-overlay {
  /* Mobile default: bottom is solid dark green, top is transparent */
  background: linear-gradient(
    to top,
    var(--brand-primary) 0%,
    rgba(26, 60, 46, 0.98) 10%,
    rgba(26, 60, 46, 0.93) 22%,
    rgba(26, 60, 46, 0.85) 34%,
    rgba(26, 60, 46, 0.72) 46%,
    rgba(26, 60, 46, 0.55) 58%,
    rgba(26, 60, 46, 0.38) 70%,
    rgba(26, 60, 46, 0.22) 80%,
    rgba(26, 60, 46, 0.08) 90%,
    transparent 100%
  );
}

@media (min-width: 1024px) {
  /* Desktop: left is solid dark green, right is transparent */
  .blend-gradient-overlay {
    background: linear-gradient(
      to right,
      var(--brand-primary) 0%,
      rgba(26, 60, 46, 0.98) 8%,
      rgba(26, 60, 46, 0.94) 17%,
      rgba(26, 60, 46, 0.86) 27%,
      rgba(26, 60, 46, 0.74) 38%,
      rgba(26, 60, 46, 0.58) 50%,
      rgba(26, 60, 46, 0.4) 62%,
      rgba(26, 60, 46, 0.24) 73%,
      rgba(26, 60, 46, 0.12) 84%,
      rgba(26, 60, 46, 0.04) 93%,
      transparent 100%
    );
  }
}


/* ============================================
   MOBILE-FIRST OPTIMIZATIONS
   ============================================ */

/* 2. Mobile Nav — Staggered entrance animation */
@keyframes nav-link-enter {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

.nav-stagger { opacity: 0; }

.mobile-menu-animating .nav-stagger {
  animation: nav-link-enter 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.mobile-menu-animating .nav-stagger:nth-child(1) { animation-delay: 0.05s; }
.mobile-menu-animating .nav-stagger:nth-child(2) { animation-delay: 0.10s; }
.mobile-menu-animating .nav-stagger:nth-child(3) { animation-delay: 0.15s; }
.mobile-menu-animating .nav-stagger:nth-child(4) { animation-delay: 0.20s; }
.mobile-menu-animating .nav-stagger:nth-child(5) { animation-delay: 0.25s; }
.mobile-menu-animating .nav-stagger:nth-child(6) { animation-delay: 0.30s; }
.mobile-menu-animating .nav-stagger:nth-child(7) { animation-delay: 0.35s; }

/* Mobile hamburger — frosted glass when scrolled */
.mobile-btn-scrolled {
  background-color: rgba(255, 255, 255, 0.82) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* 3. Service cards — Horizontal compact on mobile */
@media (max-width: 639px) {
  #servicios .service-card {
    flex-direction: row !important;
  }
  #servicios .service-card > div:first-child {
    width: 135px;
    min-width: 135px;
    max-width: 135px;
    aspect-ratio: unset !important;
    border-radius: 2px 0 0 2px !important;
    overflow: hidden;
  }
  #servicios .service-card > div:last-child {
    padding: 0.75rem 1rem !important;
    justify-content: center;
  }
  #servicios .service-card > div:last-child > span:first-child {
    display: none;
  }
  #servicios .service-card > div:last-child > h3 {
    font-size: 1.05rem;
    margin-bottom: 0.25rem !important;
    line-height: 1.3;
  }
  #servicios .service-card > div:last-child > p {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
    font-size: 0.8125rem;
    line-height: 1.45;
    margin-bottom: 0 !important;
  }
  #servicios .service-card::after {
    display: none;
  }
  #servicios .service-card,
  #servicios .service-card:hover {
    transform: none !important;
  }
}

/* 4. Profile — Limit image height on mobile */
@media (max-width: 1023px) {
  #perfil .rounded-sm.overflow-hidden {
    max-height: 420px;
  }
  #perfil .rounded-sm.overflow-hidden > img {
    object-position: top center;
  }
}

/* 6. Projects — Swipeable carousel on mobile */
@media (max-width: 767px) {
  .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  /* Disable hover effects on mobile */
  .spotlight-card::before,
  .spotlight-card:hover::before {
    display: none !important;
    opacity: 0 !important;
  }

  .service-card,
  .service-card:hover {
    transform: none !important;
    border-color: transparent !important;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.03), 0 4px 12px rgba(26, 60, 46, 0.05) !important;
  }

  .service-card::after,
  .service-card:hover::after {
    display: none !important;
  }

  .group:hover img,
  .service-card:hover img {
    transform: none !important;
  }

  .projects-grid {
    display: flex !important;
    overflow-x: auto;
    overflow-y: hidden;
    touch-action: pan-x pan-y;
    scroll-snap-type: x mandatory;
    gap: 1rem !important;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
  }
  .projects-grid::-webkit-scrollbar {
    display: none;
  }
  .projects-grid > * {
    scroll-snap-align: center;
    min-width: 100%;
    max-width: 100%;
    width: 100%;
    flex-shrink: 0;
  }
  .projects-grid .flex-grow {
    min-width: 0;
    width: 100%;
  }
}

/* Prevent image container stretching due to image height in flex layouts */
.aspect-16-10,
.projects-grid .aspect-\[16\/10\] {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  flex-shrink: 0;
}
.aspect-16-10 > img,
.projects-grid .aspect-\[16\/10\] > img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* Carousel dot indicators */
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 0 0;
}
.carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #d1d5db;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s ease;
}
.carousel-dot.active {
  background-color: var(--brand-primary);
  transform: scale(1.4);
}
@media (min-width: 768px) {
  .carousel-dots { display: none; }
}

/* 9. WhatsApp — Lift above cookie banner */
.whatsapp-lifted {
  transform: translateY(-3.5rem);
}
@media (min-width: 640px) {
  .whatsapp-lifted {
    transform: translateY(-3rem);
  }
}

/* 10. Touch active feedback */
@media (hover: none) and (pointer: coarse) {
  .service-card:active,
  .spotlight-card:active {
    transform: scale(0.97) !important;
    transition: transform 0.1s ease !important;
  }
}




