/* ==========================================================================
   HERO — Portada, canvas de partículas y barra de indicadores
   ========================================================================== */

#bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 11rem 1.5rem 5rem;
  text-align: center;
  isolation: isolate;
}
.hero .container { position: relative; z-index: 2; }

/* Halos de color */
.hero::before,
.hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
.hero::before {
  top: -45%; right: -18%;
  width: 780px; height: 780px;
  background: radial-gradient(circle, var(--tint-strong) 0%, transparent 68%);
}
.hero::after {
  bottom: -28%; left: -14%;
  width: 560px; height: 560px;
  background: radial-gradient(circle, var(--tint) 0%, transparent 70%);
}

/* Retícula técnica de fondo */
.hero__grid {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    linear-gradient(to right, currentColor 1px, transparent 1px),
    linear-gradient(to bottom, currentColor 1px, transparent 1px);
  background-size: 74px 74px;
  color: var(--text);
  opacity: 0.038;
  mask-image: radial-gradient(ellipse 80% 62% at 50% 38%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 80% 62% at 50% 38%, #000 30%, transparent 78%);
}
:root.dark .hero__grid { opacity: 0.06; }

/* ── Píldora superior ─────────────────────────────────── */
.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 1.05rem 0.45rem 0.8rem;
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  color: var(--text-soft);
  border-radius: var(--r-full);
  font-size: 0.82rem;
  font-weight: 550;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}
.hero__badge::before {
  content: '';
  width: 8px; height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22);
  animation: pulse-dot 2.4s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22); }
  50%      { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0.05); }
}

/* ── Titular ──────────────────────────────────────────── */
/* El <br> del marcado ya define el corte: sin balance automático, que
   parte "Transformamos ideas / en" y deja la segunda línea coja. */
.hero h1 {
  max-width: 24ch;
  margin-inline: auto;
  margin-bottom: 1.4rem;
  text-wrap: normal;
}

.hero__lead {
  font-size: clamp(1.02rem, 1.6vw, 1.18rem);
  color: var(--text-muted);
  max-width: 62ch;
  margin: 0 auto 2.4rem;
  line-height: 1.7;
}
.hero__lead strong { color: var(--text-soft); font-weight: 600; }

.hero__buttons {
  display: flex;
  gap: 0.9rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 4rem;
}

/* ── Barra de indicadores ─────────────────────────────── */
.hero__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 780px;
  margin: 0 auto;
  padding: 1.6rem 1rem;
  background: var(--glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  perspective: 700px;
}
:root.dark .hero__stats { box-shadow: none; }

.stat {
  position: relative;
  text-align: center;
  padding: 0 0.6rem;
}
.stat + .stat::before {
  content: '';
  position: absolute;
  left: 0; top: 12%;
  height: 76%;
  width: 1px;
  background: var(--border);
}

.stat__number {
  font-family: var(--font-mono);
  font-size: clamp(1.4rem, 2.6vw, 1.95rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.stat__label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 600;
  line-height: 1.4;
  padding-top: 0.35rem;
}

/* ── Indicador de scroll ──────────────────────────────── */
.hero__scroll {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 3.5rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.2s;
}
.hero__scroll:hover { color: var(--primary); }
.hero__scroll span {
  display: block;
  width: 1px; height: 34px;
  background: linear-gradient(to bottom, var(--border-strong), transparent);
  position: relative;
  overflow: hidden;
}
.hero__scroll span::after {
  content: '';
  position: absolute;
  left: 0; top: -34px;
  width: 1px; height: 34px;
  background: linear-gradient(to bottom, transparent, var(--primary));
  animation: scroll-cue 2.2s ease-in-out infinite;
}
@keyframes scroll-cue {
  0%   { transform: translateY(0); opacity: 0; }
  35%  { opacity: 1; }
  100% { transform: translateY(68px); opacity: 0; }
}

/* ── Máquina de escribir ──────────────────────────────── */
.typewriter-container {
  display: inline-block;
  min-height: 1.1em;
}
.typewriter-text {
  background: linear-gradient(115deg, var(--primary) 0%, var(--accent) 55%, var(--primary-lite) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.typewriter-cursor {
  display: inline-block;
  width: 3px;
  height: 0.86em;
  background: var(--primary);
  border-radius: 2px;
  margin-left: 3px;
  vertical-align: baseline;
  animation: blink 1.05s step-end infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* ── Responsivo ───────────────────────────────────────── */
@media (max-width: 820px) {
  .hero { padding: 9rem 1.25rem 4rem; }
  .hero__stats { grid-template-columns: repeat(2, 1fr); gap: 1.5rem 0; max-width: 460px; }
  .stat:nth-child(3)::before,
  .stat:nth-child(odd)::before { display: none; }
  .stat:nth-child(even)::before { display: block; }
}

@media (max-width: 640px) {
  .hero { padding: 8rem 1.1rem 3.5rem; }
  .hero h1 { max-width: 100%; }
  .hero__lead { font-size: 0.98rem; margin-bottom: 2rem; }
  .hero__buttons { flex-direction: column; align-items: stretch; margin-bottom: 3rem; }
  .hero__buttons .btn { width: 100%; }
  .hero__stats { padding: 1.25rem 0.5rem; }
  .hero__scroll { display: none; }
}
