/* ==========================================================================
   NIVA Tech - Tecnología en Limpieza Industrial | Mérida, Yucatán
   Diseño inspirado en SumiServices + Identidad Oficial NIVA Tech
   Con Movimiento Fluido y Efectos Visuales Discretos (Micro-interacciones)
   ========================================================================== */

:root {
  --niva-navy: #0F172A;
  --niva-indigo: #1E2563;
  --niva-cyan: #00AEEF;
  --niva-cyan-dark: #0284C7;
  --niva-orange: #F37F1B;
  --niva-amber: #FFC400;
  --niva-amber-hover: #E98C00;
  --niva-light: #F8FAFC;
  --niva-cream: #FEF9E1;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  font-family: 'Open Sans', system-ui, -apple-system, sans-serif;
  color: #0F172A;
  background-color: #F8FAFC;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
}

::selection {
  background-color: var(--niva-amber);
  color: #000000;
}

/* Barra superior de progreso de lectura */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #00AEEF 0%, #FFC400 55%, #F37F1B 100%);
  z-index: 9999;
  transition: width 0.1s ease-out;
  box-shadow: 0 0 10px rgba(0, 174, 239, 0.6);
}

/* Custom Brand Wordmark */
.niva-brand-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  letter-spacing: 0.04em;
}

/* ==========================================================================
   1. ANIMACIONES AMBIENTALES, RESPLANDOR TRASERO (BACKLIGHT) Y MICRO-MOVIMIENTO
   ========================================================================== */

@keyframes floatSlow {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-9px); }
}

@keyframes floatDelayed {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(8px); }
}

@keyframes shieldBreath {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow:
      0 0 35px rgba(0, 174, 239, 0.75),
      0 0 80px rgba(0, 174, 239, 0.45),
      0 0 120px rgba(255, 196, 0, 0.35),
      0 12px 28px rgba(15, 23, 42, 0.55);
  }
  50% {
    transform: translate(-50%, -54%) scale(1.05);
    box-shadow:
      0 0 50px rgba(0, 174, 239, 0.95),
      0 0 105px rgba(243, 127, 27, 0.65),
      0 0 150px rgba(255, 196, 0, 0.5),
      0 18px 36px rgba(15, 23, 42, 0.65);
  }
}

@keyframes backlightPulse {
  0%, 100% {
    opacity: 0.78;
    transform: scale(0.98);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

@keyframes airflowWave {
  0% { stroke-dashoffset: 400; opacity: 0.2; }
  50% { opacity: 0.55; }
  100% { stroke-dashoffset: 0; opacity: 0.2; }
}

@keyframes auroraShift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(28px, -20px) scale(1.1); }
  66% { transform: translate(-20px, 16px) scale(0.94); }
}

.animate-float-slow {
  animation: floatSlow 6.5s ease-in-out infinite;
}

.animate-float-delayed {
  animation: floatDelayed 7.5s ease-in-out infinite;
}

.animate-shield-breath {
  animation: shieldBreath 5s ease-in-out infinite;
}

.animate-aurora {
  animation: auroraShift 14s ease-in-out infinite;
}

.animate-backlight-pulse {
  animation: backlightPulse 5.5s ease-in-out infinite;
}

.airflow-path {
  stroke-dasharray: 200;
  animation: airflowWave 9s linear infinite;
}

/* Efecto de Resplandor / Luz Trasera (Backlight Halo) para Imágenes y Tarjetas */
.glow-card-cyan {
  position: relative;
  box-shadow:
    0 0 28px -2px rgba(0, 174, 239, 0.55),
    0 0 70px -10px rgba(0, 174, 239, 0.42),
    0 20px 45px -10px rgba(2, 6, 23, 0.8);
  transition: box-shadow 0.4s ease, transform 0.4s ease, border-color 0.4s ease;
}

.glow-card-cyan:hover {
  box-shadow:
    0 0 38px 2px rgba(0, 174, 239, 0.75),
    0 0 95px -5px rgba(0, 174, 239, 0.58),
    0 24px 50px -10px rgba(2, 6, 23, 0.85);
}

.glow-card-amber {
  position: relative;
  box-shadow:
    0 0 28px -2px rgba(243, 127, 27, 0.58),
    0 0 75px -10px rgba(255, 196, 0, 0.42),
    0 20px 45px -10px rgba(2, 6, 23, 0.8);
  transition: box-shadow 0.4s ease, transform 0.4s ease, border-color 0.4s ease;
}

.glow-card-amber:hover {
  box-shadow:
    0 0 40px 2px rgba(255, 196, 0, 0.78),
    0 0 100px -5px rgba(243, 127, 27, 0.62),
    0 24px 50px -10px rgba(2, 6, 23, 0.85);
}

/* Resplandor trasero especial para la tarjeta de Seguridad Operativa y Patrimonial */
.backlight-card-wrapper {
  position: relative;
  z-index: 1;
}

.backlight-card-wrapper::before {
  content: '';
  position: absolute;
  inset: -18px;
  border-radius: 1.75rem;
  background: radial-gradient(
    circle at 35% 35%,
    rgba(255, 196, 0, 0.55) 0%,
    rgba(243, 127, 27, 0.48) 38%,
    rgba(0, 174, 239, 0.35) 70%,
    transparent 100%
  );
  filter: blur(28px);
  z-index: -1;
  animation: backlightPulse 5.5s ease-in-out infinite;
  pointer-events: none;
  transition: filter 0.4s ease, transform 0.4s ease, opacity 0.4s ease;
}

.backlight-card-wrapper::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 1.35rem;
  background: linear-gradient(135deg, rgba(255, 196, 0, 0.45), rgba(243, 127, 27, 0.35), rgba(0, 174, 239, 0.4));
  filter: blur(12px);
  z-index: -1;
  opacity: 0.75;
  pointer-events: none;
}

.backlight-card-wrapper:hover::before {
  filter: blur(34px);
  transform: scale(1.06);
  opacity: 1;
}

.glow-card-gold {
  box-shadow:
    0 0 32px rgba(255, 196, 0, 0.42),
    0 0 80px rgba(243, 127, 27, 0.35),
    0 20px 50px rgba(2, 6, 23, 0.85);
  transition: box-shadow 0.4s ease, transform 0.4s ease;
}

.glow-card-gold:hover {
  box-shadow:
    0 0 45px rgba(255, 196, 0, 0.65),
    0 0 105px rgba(243, 127, 27, 0.5),
    0 25px 55px rgba(2, 6, 23, 0.9);
}

/* Luz interactiva que sigue suavemente el cursor en el Hero */
.hero-cursor-light {
  pointer-events: none;
  position: absolute;
  width: 620px;
  height: 620px;
  border-radius: 9999px;
  background: radial-gradient(
    circle,
    rgba(0, 174, 239, 0.22) 0%,
    rgba(255, 196, 0, 0.12) 42%,
    transparent 70%
  );
  transform: translate(-50%, -50%);
  filter: blur(30px);
  transition: opacity 0.4s ease;
  z-index: 0;
}

/* ==========================================================================
   2. BOTONES CON EFECTO DESTELLO (SHIMMER) DISCRETO
   ========================================================================== */

.btn-industrial-primary {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #FFC400 0%, #F37F1B 100%);
  color: #0F172A;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 9999px;
  transition: all 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 8px 20px -4px rgba(243, 127, 27, 0.45);
}

.btn-industrial-primary::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 45%;
  height: 200%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.45) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(25deg);
  transition: left 0.65s ease;
  pointer-events: none;
}

.btn-industrial-primary:hover::after {
  left: 130%;
}

.btn-industrial-primary:hover,
.btn-industrial-primary:focus-visible {
  background: linear-gradient(135deg, #FFD03B 0%, #E98C00 100%);
  transform: translateY(-2.5px);
  box-shadow: 0 14px 28px -4px rgba(243, 127, 27, 0.65);
  color: #0F172A;
}

/* ==========================================================================
   3. HEADER CON SCROLLSPY E INDICADOR ACTIVO SUAVE
   ========================================================================== */

.site-header {
  transition: background-color 0.35s ease, box-shadow 0.35s ease;
}

.site-header.scrolled {
  background-color: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 32px -10px rgba(2, 6, 23, 0.65);
}

.nav-link-item {
  position: relative;
}

.nav-link-item::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #00AEEF, #FFC400);
  border-radius: 99px;
  transition: width 0.28s ease, left 0.28s ease;
}

.nav-link-item:hover::after,
.nav-link-item.active-nav::after {
  width: 65%;
  left: 17.5%;
}

.nav-link-item.active-nav {
  color: #FFC400 !important;
}

/* Dropdown Menu Animation */
.services-dropdown-menu {
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.24s ease, transform 0.24s ease, visibility 0.24s ease;
}

.services-dropdown-group:hover .services-dropdown-menu,
.services-dropdown-group:focus-within .services-dropdown-menu,
.services-dropdown-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ==========================================================================
   4. TARJETAS DE SERVICIO CON LUZ TRASERA (BACKLIGHT) Y VIDEO EN LOOP
   ========================================================================== */

.service-backlight-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

.service-backlight-wrap::before {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 2rem;
  filter: blur(26px);
  z-index: -1;
  opacity: 0.85;
  animation: backlightPulse 5.5s ease-in-out infinite;
  pointer-events: none;
  transition: filter 0.45s ease, transform 0.45s ease, opacity 0.45s ease;
}

.service-backlight-wrap:hover::before {
  filter: blur(34px);
  transform: scale(1.04);
  opacity: 1;
}

/* Servicio 01: Resplandor Cian / Azul Aire */
.service-backlight-cyan::before {
  background: radial-gradient(
    circle at 50% 28%,
    rgba(0, 174, 239, 0.62) 0%,
    rgba(2, 132, 199, 0.42) 45%,
    rgba(255, 196, 0, 0.22) 78%,
    transparent 100%
  );
}

/* Servicio 02: Resplandor Ámbar / Naranja Fuego */
.service-backlight-amber::before {
  background: radial-gradient(
    circle at 50% 28%,
    rgba(255, 196, 0, 0.65) 0%,
    rgba(243, 127, 27, 0.52) 45%,
    rgba(0, 174, 239, 0.24) 78%,
    transparent 100%
  );
  animation-delay: -1.8s;
}

/* Servicio 03: Resplandor Esmeralda / Cian Industrial */
.service-backlight-emerald::before {
  background: radial-gradient(
    circle at 50% 28%,
    rgba(16, 185, 129, 0.58) 0%,
    rgba(0, 174, 239, 0.45) 48%,
    rgba(255, 196, 0, 0.22) 78%,
    transparent 100%
  );
  animation-delay: -3.4s;
}

.service-card {
  position: relative;
  overflow: hidden;
  height: 100%;
  transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.42s cubic-bezier(0.22, 1, 0.36, 1),
              border-color 0.35s ease;
}

.service-card-cyan {
  box-shadow:
    0 0 26px -2px rgba(0, 174, 239, 0.42),
    0 18px 40px -12px rgba(15, 23, 42, 0.22);
}

.service-card-cyan:hover {
  transform: translateY(-8px);
  border-color: rgba(0, 174, 239, 0.85);
  box-shadow:
    0 0 38px 2px rgba(0, 174, 239, 0.65),
    0 24px 48px -12px rgba(15, 23, 42, 0.32);
}

.service-card-amber {
  box-shadow:
    0 0 26px -2px rgba(243, 127, 27, 0.45),
    0 18px 40px -12px rgba(15, 23, 42, 0.22);
}

.service-card-amber:hover {
  transform: translateY(-8px);
  border-color: rgba(243, 127, 27, 0.85);
  box-shadow:
    0 0 38px 2px rgba(255, 196, 0, 0.68),
    0 24px 48px -12px rgba(15, 23, 42, 0.32);
}

.service-card-emerald {
  box-shadow:
    0 0 26px -2px rgba(16, 185, 129, 0.42),
    0 18px 40px -12px rgba(15, 23, 42, 0.22);
}

.service-card-emerald:hover {
  transform: translateY(-8px);
  border-color: rgba(16, 185, 129, 0.85);
  box-shadow:
    0 0 38px 2px rgba(16, 185, 129, 0.62),
    0 24px 48px -12px rgba(15, 23, 42, 0.32);
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #00AEEF, #FFC400, #F37F1B);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 20;
}

.service-card:hover {
  transform: translateY(-8px);
}

.service-card:hover::before {
  transform: scaleX(1);
}

.service-card .card-img-zoom {
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.service-card:hover .card-img-zoom {
  transform: scale(1.06);
}

/* Sector Cards Overlay & Glint */
.sector-card {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.sector-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 38px -12px rgba(15, 23, 42, 0.32);
}

.sector-card img {
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.sector-card:hover img {
  transform: scale(1.09);
}

/* Hover sutil para tarjetas internas y beneficios */
.hover-lift-subtle {
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.32s cubic-bezier(0.22, 1, 0.36, 1),
              border-color 0.32s ease;
}

.hover-lift-subtle:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px -10px rgba(15, 23, 42, 0.14);
}

/* Diagonal Background Accent */
.diagonal-bg-blue {
  background: linear-gradient(135deg, #E0F2FE 0%, #BAE6FD 55%, #F1F5F9 100%);
}

.diagonal-bg-amber {
  background: linear-gradient(135deg, #FEF9E1 0%, #FDE68A 50%, #FFFBEB 100%);
}

/* Highlight animation when navigating to a specific service via dropdown */
@keyframes pulseHighlight {
  0% { box-shadow: 0 0 0 0 rgba(0, 174, 239, 0.7); }
  70% { box-shadow: 0 0 0 18px rgba(0, 174, 239, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 174, 239, 0); }
}

.service-detail-highlight {
  animation: pulseHighlight 1.6s ease-out;
}

/* ==========================================================================
   5. REVELADO PROGRESIVO AL HACER SCROLL (REVEAL VARIATIONS)
   ========================================================================== */

.reveal-up,
.reveal-left,
.reveal-right,
.reveal-scale {
  opacity: 0;
  will-change: opacity, transform;
  transition: opacity 0.72s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.72s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-up {
  transform: translateY(28px);
}

.reveal-left {
  transform: translateX(-28px);
}

.reveal-right {
  transform: translateX(28px);
}

.reveal-scale {
  transform: scale(0.95) translateY(16px);
}

.reveal-up.is-visible,
.reveal-left.is-visible,
.reveal-right.is-visible,
.reveal-scale.is-visible {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}

/* Escalado de retardos en cascada (Stagger) */
.delay-75 { transition-delay: 75ms; }
.delay-150 { transition-delay: 150ms; }
.delay-225 { transition-delay: 225ms; }
.delay-300 { transition-delay: 300ms; }
.delay-375 { transition-delay: 375ms; }

/* ==========================================================================
   6. CARRUSEL / MARQUEE CONTINUO DISCRETO (ESTILO SUMISERVICES)
   ========================================================================== */

@keyframes marqueeScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: marqueeScroll 34s linear infinite;
}

.marquee-track:hover {
  animation-play-state: paused;
}

/* Modern CSS Form Validation (:user-valid / :user-invalid) */
.form-input:user-invalid {
  border-color: #EF4444;
  background-color: #FEF2F2;
}

.form-input:user-valid {
  border-color: #10B981;
}

/* Performance Optimization for Below-the-Fold Sections */
.cv-auto {
  content-visibility: auto;
  contain-intrinsic-size: 1px 900px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .reveal-up,
  .reveal-left,
  .reveal-right,
  .reveal-scale,
  .animate-float-slow,
  .animate-float-delayed,
  .animate-shield-breath,
  .animate-aurora,
  .marquee-track {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
  }
}
