/* ============================================================
   THM — Hero Component
   Sección principal con escena 3D WebGL y contenido centrado.
   ============================================================ */

/* ----------------------------------------------------------
   HERO BASE
   ---------------------------------------------------------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding-top: 0; /* Override .section — el padding lo gestiona hero-layout */
}

/* Fondo oscuro con sutil gradiente radial */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 60% 40%, rgba(79, 70, 229, 0.12) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 20% 80%, rgba(6, 182, 212, 0.08) 0%, transparent 60%),
    var(--color-bg);
  z-index: 0;
}

/* ----------------------------------------------------------
   CANVAS 3D — Three.js
   ---------------------------------------------------------- */
.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  opacity: 0;
  transition: opacity 1s ease;
}

.hero__canvas.is-loaded {
  opacity: 1;
}

/* ----------------------------------------------------------
   CONTENIDO — sobre el canvas
   ---------------------------------------------------------- */
.hero .container {
  position: relative;
  z-index: 2;
}

.hero__content {
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* Badge */
.hero__content .badge {
  align-self: flex-start;
  font-size: var(--text-sm);
}

/* Título */
.hero__title {
  font-size: clamp(var(--text-4xl), 6vw, var(--text-7xl));
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

/* Subtítulo */
.hero__subtitle {
  font-size: clamp(var(--text-base), 2vw, var(--text-xl));
  color: var(--color-text-muted);
  line-height: var(--leading-relaxed);
  max-width: 500px;
}

/* CTAs */
.hero__actions {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: var(--space-2);
}

.hero__actions .btn-primary {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
}

.hero__actions .btn-ghost {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-base);
}

/* ----------------------------------------------------------
   WORKFLOW n8n-style (desktop)
   ---------------------------------------------------------- */
.hero__workflow {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 620px;
  perspective: 1400px;
  perspective-origin: 50% 50%;
}

.wf-stage {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateY(calc(var(--wf-ry, 0) * 1deg)) rotateX(calc(var(--wf-rx, 0) * 1deg));
  transition: transform 0.15s ease-out;
  animation: wfFloat 6s ease-in-out infinite;
}

@keyframes wfFloat {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -6px; }
}

/* SVG de conexiones */
.wf-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.wf-link {
  fill: none;
  stroke: url(#wf-grad);
  stroke-width: 0.35;
  stroke-linecap: round;
  stroke-dasharray: 1.5 3;
  animation: wfFlow 1.8s linear infinite;
  filter: drop-shadow(0 0 2px rgba(6, 182, 212, 0.6));
  opacity: 0.9;
}

@keyframes wfFlow {
  to { stroke-dashoffset: -18; }
}

/* Nodos */
.wf-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 14px;
  min-width: 96px;
  background: linear-gradient(180deg, rgba(22, 26, 50, 0.92), rgba(10, 12, 28, 0.94));
  border: 1.5px solid color-mix(in srgb, var(--brand) 60%, transparent);
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 8px 24px rgba(0, 0, 0, 0.45),
    0 0 20px color-mix(in srgb, var(--brand) 25%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #e0e7ff;
  font-family: var(--font-sans, 'Outfit', system-ui, sans-serif);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.wf-node::before {
  content: '';
  position: absolute;
  top: 6px;
  right: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: wfBlink 1.4s ease-in-out infinite;
}

@keyframes wfBlink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

.wf-node img,
.wf-node > svg {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--brand) 60%, transparent));
}

.wf-node span {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
}

.wf-node em {
  font-size: 10px;
  font-style: normal;
  color: var(--color-text-muted, #9ca3af);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Nodo grande central */
.wf-node--lg {
  padding: 16px 20px;
  min-width: 128px;
  border-width: 2px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 12px 32px rgba(0, 0, 0, 0.5),
    0 0 36px color-mix(in srgb, var(--brand) 45%, transparent);
}

.wf-node--lg img,
.wf-node--lg > svg {
  width: 38px;
  height: 38px;
}

.wf-node--lg span {
  font-size: 14px;
}

/* ----------------------------------------------------------
   SCROLL INDICATOR
   ---------------------------------------------------------- */
.hero__scroll {
  position: absolute;
  bottom: var(--space-8);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-disabled);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  animation: float 2s ease-in-out infinite;
}

.hero__scroll-arrow {
  width: 20px;
  height: 20px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg);
}

/* ----------------------------------------------------------
   REVEAL — animaciones de entrada del hero
   ---------------------------------------------------------- */
.hero__content .badge,
.hero__title,
.hero__subtitle,
.hero__actions {
  opacity: 0;
  transform: translateY(24px);
}

.hero.is-ready .badge      { animation: fadeInUp 0.6s ease 0.1s both; }
.hero.is-ready .hero__title { animation: fadeInUp 0.6s ease 0.25s both; }
.hero.is-ready .hero__subtitle { animation: fadeInUp 0.6s ease 0.4s both; }
.hero.is-ready .hero__actions { animation: fadeInUp 0.6s ease 0.55s both; }

/* ----------------------------------------------------------
   RESPONSIVE
   ---------------------------------------------------------- */
@media (max-width: 1024px) {
  .hero {
    min-height: auto;
    padding: calc(var(--navbar-height) + var(--space-16)) 0 var(--space-16);
  }

  .hero__content {
    max-width: 100%;
    text-align: center;
  }

  .hero__content .badge {
    align-self: center;
  }

  .hero__subtitle {
    max-width: 100%;
  }

  .hero__actions {
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .hero {
    padding: calc(var(--navbar-height) + var(--space-12)) 0 var(--space-12);
  }

  .hero__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero__actions .btn {
    text-align: center;
    justify-content: center;
  }
}
