/* =============
   ATOMA OBSCURA 
   ============= */

/* ---------- Variables ---------- */
:root {
  --bg-dark: #0D0D0D;
  --accent-blue: #0A84FF;
  --white: #FFFFFF;
}

/* ---------- Reset base ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--white);
  overflow-x: hidden;
  /* espacio para la barra fija superior */
  padding-top: 64px;
}

/* ---------- Estructura global ---------- */
section {
  position: relative;
  z-index: 1;
  padding: 80px 20px;
  background: var(--bg-dark);
}

h2 {
  text-align: center;
  margin-bottom: 40px;
  font-size: 2rem;
  font-weight: 600;
}

button {
  background: var(--white);
  color: var(--accent-blue);
  border: none;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  transition: transform .3s;
}
button:hover { transform: scale(1.05); }

/* ---------- Hero ---------- */
#hero {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 20px;
}

.hero-content { position: relative; z-index: 2; }

#particles-back,
#particles-front {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#particles-back { z-index: 0; }
#particles-front { z-index: 1; }

/* Hero canvas */
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Títulos en Hero */
.hero-content h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 16px;
}
.hero-content .subtitle {
  color: var(--accent-blue);
  font-size: 1.1rem;
  margin-bottom: 32px;
}

/* Site name */
.hero-content .page-title {
  margin: 0 0 16px;
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--white);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: 'Inter', sans-serif;
  position: relative;
  animation: fadeUp 1.2s ease-out both;
  text-align: center;
  line-height: 1.1;
  z-index: 5;
  transition: all 0.3s ease;
}

.hero-content .page-title::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 110%;
  height: 100%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(10,132,255,0.15) 0%, transparent 70%);
  z-index: -1;
  filter: blur(12px);
  animation: pulseGlow 3s ease-in-out infinite;
}

.hero-content .page-title:hover {
  color: var(--white);
  text-shadow: none;
}

/* Halo estático sobre el título del Hero */
.hero-halo {
  position: absolute;
  top: -280px;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 140px;
  border-radius: 50%;
  box-shadow:
    0 0 30px rgba(10,132,255,0.6),
    inset 0 0 20px rgba(10,132,255,0.3);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}

/* Letra 'A' dentro del halo del Hero */
.hero-halo .halo-letter {
  font-size: 4rem;
  margin-top: 8px;
  color: #fff;
  text-shadow:
    0 0 10px rgba(255,255,255,0.9),
    0 0 20px rgba(10,132,255,0.9),
    0 0 30px rgba(10,132,255,0.6);
}

/* Subtítulo (pequeño) bajo el halo */
.hero-halo .page-title {
  font-size: 0.85rem;
  margin-bottom: 12px;
  top: -14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  background: linear-gradient(90deg, #ffffff, #0A84FF, #ffffff);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shineShift 4s linear infinite;
  text-align: center;
  z-index: 4;
  position: relative;
  pointer-events: none;
}

/* Botón "Explorar Servicios" con glow */
@keyframes exploreGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(10,132,255,0.4); }
  50%      { box-shadow: 0 0 16px rgba(10,132,255,0.8); }
}
#explore-btn {
  background: #1a1a1a;
  color: var(--white);
  border: none;
  border-radius: 4px;
  animation: exploreGlow 2s infinite ease-in-out;
}
#explore-btn:hover { transform: scale(1.05); }

/* ---------- Services ---------- */
#services .cards {
  display: grid;
  /* centrado real de tarjetas: columnas de 240–320px y grid centrado */
  grid-template-columns: repeat(auto-fit, minmax(240px, 320px)); /* ⬅ cambio clave */
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto;
  justify-content: center;  
  justify-items: center;     
}
.card {
  background: #1a1a1a;
  padding: 24px;
  border-radius: 8px;
  text-align: center;
  transition: transform .3s, box-shadow .3s;
  width: 100%;
  max-width: 320px;        
}
.card i {
  font-size: 2rem;
  color: var(--accent-blue);
  margin-bottom: 12px;
}
.card h3 { margin-bottom: 12px; font-weight: 600; }
.card p { font-size: .95rem; line-height: 1.4; }
.card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}
.card .custom-icon {
  width: 78px;
  height: auto;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 4px rgba(10,132,255,0.6));
}

/* ---------- Why Us ---------- */
#why-us {
  text-align: center;
}

#why-us .why-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 40px;
  max-width: 1100px;
  margin: 0 auto;
}

/* Columna izquierda (animación) */
#why-us .animation {
  flex: 1 1 320px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* El SVG es cuadrado: reservar altura desde el primer paint */
.network-svg {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
  height: auto;
  display: block;
}

/* Columna derecha (puntos) */
.points {
  flex: 1 1 360px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: flex-start;
  margin: 0 auto;
}

.point {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 32px;
}

.point i {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  line-height: 24px;
  font-size: 1.5rem;
  color: var(--white);
}

.point p { margin: 0; }

/* Texto descriptivo bajo Why Us */
#why-us .about-text {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 40px;
  line-height: 1.6;
  opacity: 0.8;
}

/* ---------- Integraciones Técnicas ---------- */
#tech .tech-text {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 40px;
  opacity: .8;
}
.integrations {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 160px));
  gap: 30px;
  max-width: 800px;
  margin: 0 auto;
  justify-content: center;  
  justify-items: center;   
  text-align: center;
}
.integration i {
  font-size: 2rem;
  color: var(--accent-blue);
  margin-bottom: 8px;
}
.integration span {
  display: block;
  font-size: .9rem;
}
.integration img {
  display: block;
  width: 2rem;
  height: auto;
  margin: 0 auto 8px;
}
.integration img.integration-icon {
  width: 5.5rem !important;
  height: auto;
  margin: 0 auto 12px !important;
  display: block;
  filter: drop-shadow(0 0 6px rgba(10,132,255,0.6));
  transition: transform 0.3s ease;
}
.integration-icon:hover { transform: scale(1.1); }

/* ---------- Contacto (inmersivo) ---------- */
#contact {
  position: relative;
  background: var(--bg-dark);
  overflow: hidden;
}
#contact-canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  z-index: 1;
  pointer-events: none;
}
#explosion-overlay {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  z-index: 3;
  pointer-events: none;
}
.contact-content {
  position: relative;
  z-index: 2;
  max-width: 600px;
  margin: 0 auto;
  padding: 40px;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(8px);
  border-radius: 16px;
  animation: contactFloat 6s ease-in-out infinite;
  transform-style: preserve-3d;
}
@keyframes contactFloat {
  0%,100% { transform: translateY(0px) rotateX(0deg) rotateY(0deg); }
  50%     { transform: translateY(-8px) rotateX(1deg) rotateY(-1deg); }
}

/* Grupo de inputs con glow en foco */
.input-group { position: relative; margin-bottom: 32px; }
.input-group::before {
  content: '';
  position: absolute;
  top: -4px; left: -4px; right: -4px; bottom: -4px;
  border-radius: 8px;
  box-shadow: 0 0 0 rgba(10,132,255,0.7);
  transition: box-shadow 0.4s;
  pointer-events: none;
  z-index: 0;
}
.input-group.focused::before {
  box-shadow: 0 0 16px rgba(10,132,255,0.7),
              inset 0 0 8px rgba(255,255,255,0.4);
  animation: glowPulse 1s ease-in-out infinite alternate;
}
@keyframes glowPulse {
  from {
    box-shadow: 0 0 12px rgba(10,132,255,0.5),
                inset 0 0 4px rgba(255,255,255,0.3);
  }
  to {
    box-shadow: 0 0 20px rgba(10,132,255,1),
                inset 0 0 10px rgba(255,255,255,0.6);
  }
}

/* Inputs */
.quantum-input {
  position: relative;
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 2px solid rgba(255,255,255,0.5);
  color: var(--white);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s;
  z-index: 1;
  padding: 20px 0 8px;
  line-height: 1.4;
  font-family: inherit;
}
.quantum-input:focus { border-color: var(--accent-blue); }

.input-group label {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  color: var(--accent-blue);
  font-size: 0.85rem;
  font-family: inherit;
}

/* Botón con micro-glow y túnel */
.quantum-btn {
  position: relative;
  z-index: 1;
  overflow: hidden;
  box-shadow: 0 0 8px rgba(10,132,255,0.4);
  transition: box-shadow 0.3s, transform 0.3s;
}
.quantum-btn::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 8px; height: 8px;
  background: var(--white);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0.5;
  transition: transform 0.3s, opacity 0.3s;
}
.quantum-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 16px rgba(10,132,255,0.8),
              inset 0 0 8px rgba(255,255,255,0.2);
}
.quantum-btn:hover::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(10,132,255,0.5) 0%, transparent 70%);
  transform: translate(-50%,-50%) scale(0);
  opacity: 0.5;
  animation: tunnel 0.6s forwards;
  pointer-events: none;
}
@keyframes tunnel {
  to {
    transform: translate(-50%,-50%) scale(1);
    opacity: 0;
  }
}
.quantum-btn:active::after {
  transform: translate(-50%, -50%) scale(20);
  opacity: 0;
  transition: transform 0.5s, opacity 0.5s;
}

/* Mensaje de éxito */
.success-message {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 0;
  color: var(--white);
  font-size: 1.2rem;
}
.success-message .core-light {
  width: 20px; height: 20px;
  background: var(--accent-blue);
  border-radius: 50%;
  box-shadow: 0 0 20px var(--accent-blue), 0 0 40px var(--accent-blue);
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.5); }
}
.success-message.show { display: flex; animation: fadeIn 0.8s ease forwards; }
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

/* Partículas de fondo para Contact */
.contact-particles {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Halo clusters (efecto de estallido) */
.cluster {
  position: fixed;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(10,132,255,0.8), inset 0 0 4px rgba(255,255,255,0.8);
  opacity: 0;
  animation: clusterAnim 2s ease-out forwards;
  pointer-events: none;
  z-index: 1001; /* por encima de otros elementos */
}
@keyframes clusterAnim {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(3); opacity: 0; }
}

/* Anillo de energía al enviar */
.energy-ring {
  position: absolute;
  border: 2px solid rgba(10,132,255,0.7);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  animation: ringWave 1s ease-out forwards;
  z-index: 1000;
}
@keyframes ringWave {
  from { opacity: 0.8; transform: translate(-50%, -50%) scale(0.2); }
  to   { opacity: 0;   transform: translate(-50%, -50%) scale(10); }
}

/* ---------- Footer ---------- */
footer { background: var(--bg-dark); padding: 40px 20px; }
.footer-content {
  max-width: 1000px;
  margin: 0 auto;
  text-align: center;
}
.footer-nav {
  margin: 20px 0;
  display: flex;
  justify-content: center;
  gap: 24px;
}
.footer-nav a {
  color: var(--white);
  text-decoration: none;
  font-size: .95rem;
  transition: color .3s;
}
.footer-nav a:hover { color: var(--accent-blue); }
.tagline {
  margin-top: 16px;
  font-size: .95rem;
  opacity: .8;
}
.footer-content .footer-rights {
  margin-top: 12px;
  font-size: 0.9rem;
  opacity: 0.6;
}

/* ---------- Navegación superior ---------- */
.main-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 16px 0;
  background: var(--bg-dark);
  display: flex;
  justify-content: center;
  gap: 32px;
  z-index: 1000;
}
.main-nav a {
  color: var(--white);
  text-decoration: none;
  font-size: .95rem;
  font-weight: 600;
  transition: color .3s;
}
.main-nav a:hover { color: var(--accent-blue); }

/* ---------- Autofill (Chrome) ---------- */
.quantum-input:-webkit-autofill,
.quantum-input:-webkit-autofill:hover,
.quantum-input:-webkit-autofill:focus,
.quantum-input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-dark) inset !important;
  -webkit-text-fill-color: var(--white) !important;
  background-clip: padding-box;
}
@keyframes onAutoFillStart { from {} to {} }
.quantum-input:-webkit-autofill {
  animation-name: onAutoFillStart;
  animation-duration: 0.01s;
  animation-iteration-count: 1;
}

/* ---------- Animaciones generales ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pulseGlow {
  0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
  50%      { opacity: 1;   transform: translate(-50%, -50%) scale(1.1); }
}
@keyframes shineShift {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

/* --- Anchor offset para secciones con headers fijos --- */
:root { --anchor-offset: 96px; }

section,
[id^="services"],
[id^="why-us"],
[id^="tech"],
[id^="contact"] {
  /* Hace que el scroll nativo pare con margen superior */
  scroll-margin-top: calc(var(--anchor-offset) + 12px);
}

/* ==========
   Responsive
   ========== */

/* <= 1024px */
@media (max-width: 1024px) {
  h2 { font-size: 1.7rem; }
  .hero-content h1 { font-size: 2rem; }

  .hero-halo {
    width: 120px;
    height: 120px;
    top: -180px;
  }
  .hero-halo .halo-letter { font-size: 3.3rem; }
  .hero-halo .page-title { font-size: 0.75rem; top: -14px; }

  .card i { font-size: 1.7rem; }
  .card h3 { font-size: 1.1rem; }
  .card p { font-size: 0.9rem; }
}

/* <= 768px (unificado) */
@media (max-width: 768px) {
  .main-nav {
    flex-wrap: wrap;
    gap: 20px;
    padding: 12px 0;
  }

  .hero-content h1 { font-size: 1.7rem; }
  .hero-content .subtitle { font-size: 1rem; }

  .hero-halo {
    width: 100px;
    height: 100px;
    top: -160px;
  }
  .hero-halo .halo-letter {
    font-size: 2.8rem;
    margin-top: 12px;
  }
  .hero-halo .page-title { font-size: 0.7rem; top: -10px; }

  #services .cards {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    justify-items: center;  
  }
  .card { padding: 20px; max-width: 420px; }

  #why-us .why-container { flex-direction: column; }
  .network-svg { max-width: 220px; }

  .contact-content { padding: 20px; }

  .integrations {
    grid-template-columns: repeat(auto-fit, minmax(100px, 140px));
    justify-content: center;
    justify-items: center;
  }
}

/* <= 480px */
@media (max-width: 480px) {
  .hero-content h1 { font-size: 1.4rem; }
  .hero-content .subtitle { font-size: 0.95rem; }

  button, .quantum-btn {
    font-size: 0.9rem;
    padding: 10px 20px;
  }

  .footer-content { font-size: 0.8rem; }
  .footer-nav { gap: 16px; flex-wrap: wrap; }
  .footer-content .footer-rights { font-size: 0.75rem; }
}
