/*
 * sections.css — стили конкретных секций v2.
 * Phase 2: hero (typewriter + gradient + noise + parallax + AI-demo + stats).
 */

/* ========== HERO ==========
 * Gradient с parallax (--gx/--gy), subtle noise, стеклянные карточки.
 * Старый hero в inline-style перекрыт тем что ниже: свежие классы .hero__*,
 * .tw-slot, .tw-caret, .hero__stats и т.д. выигрывают по specificity. */

.hero {
  --gx: 50%;
  --gy: 30%;
  position: relative;
  isolation: isolate;       /* локализуем z-index stacking */
  overflow: hidden;
  padding: 140px 0 80px;
  text-align: left;
  background: var(--bg);
}

/* Conic-gradient сердцевина (subtle, opacity 0.35 общая) —
   точка радиусом ~40vw с мягким feather, смещается за курсором. */
.hero::before {
  content: '';
  position: absolute;
  inset: -10%;
  z-index: -2;
  background:
    radial-gradient(
      40vw 40vw at var(--gx) var(--gy),
      rgba(108, 92, 231, 0.35) 0%,
      rgba(74, 63, 184, 0.22) 30%,
      transparent 70%
    );
  transition: background-position 0.6s var(--ease-quart);
  pointer-events: none;
}
/* Слабый лайт «рампа» сверху для глубины */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    180deg,
    rgba(10, 10, 10, 0) 0%,
    rgba(10, 10, 10, 0.45) 100%
  );
  pointer-events: none;
}

/* SVG noise — opacity 0.06, §12 §2.2 playbook */
.hero__noise {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  opacity: 0.06;
  mix-blend-mode: overlay;
  pointer-events: none;
}

.hero .hero-content {
  max-width: 900px;
  position: relative;
  z-index: 1;
}

/* ---- Badge ---- */
.hero__badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  color: var(--accent-light);
  font-size: 0.78rem;
  font-weight: 500;
  margin-bottom: 20px;
  letter-spacing: 0.02em;
}

/* ---- H1 typewriter ---- */
.hero__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
  /* Anti-CLS: резервируем место под самую высокую ротацию. 2 строки на
     desktop, 3 строки на mobile (где текст переносится чаще). */
  min-height: calc(1.08em * 2);
  color: var(--ink);
}
@media (max-width: 640px) {
  .hero__title {
    min-height: calc(1.08em * 3);
  }
}
.hero__title .tw-slot {
  display: inline;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.hero__title .tw-caret {
  display: inline-block;
  width: 0.06em;
  color: var(--accent);
  -webkit-text-fill-color: var(--accent);
  animation: tw-blink 1s steps(2, start) infinite;
  margin-left: 0.05em;
}
@keyframes tw-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .hero__title .tw-caret { display: none; }
  .hero__title { min-height: 0; }
}

/* ---- Lead ---- */
.hero__lead {
  font-size: clamp(0.95rem, 1.4vw, 1.05rem);
  color: var(--ink-muted);
  max-width: 560px;
  margin: 0 0 32px;
  line-height: 1.55;
}

/* ---- Live-counter strip ---- */
.hero__stats {
  display: flex;
  gap: clamp(20px, 4vw, 48px);
  flex-wrap: wrap;
  margin: 0 0 12px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.hero__stat { display: flex; flex-direction: column; gap: 2px; }
.hero__stat strong {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.4vw, 1.8rem);
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.hero__stat span {
  font-size: 0.78rem;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}

/* «Последняя выдача» строка (статика, обновляется вручную через JSON) */
.hero__latest {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--ink-dim);
  margin: 0 0 28px;
}
.hero__latest-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18);
}
@media (prefers-reduced-motion: no-preference) {
  .hero__latest-dot { animation: latest-pulse 2s ease-in-out infinite; }
}
@keyframes latest-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18); }
  50%      { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0.06); }
}

/* ---- AI-demo placeholder ---- */
.hero__ai-demo {
  margin: 0 0 28px;
  max-width: 560px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  backdrop-filter: blur(8px);
}
.hero__ai-demo .ai-demo__label {
  display: block;
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-bottom: 10px;
  letter-spacing: 0.01em;
}
.ai-demo__field {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.ai-demo__field input {
  flex: 1;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}
.ai-demo__field input::placeholder { color: var(--ink-dim); }
.ai-demo__field input[disabled] { cursor: not-allowed; opacity: 0.65; }
.ai-demo__field button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  padding: 11px 18px;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: 0.9rem;
  font-family: inherit;
}
.ai-demo__hint {
  display: block;
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--ink-dim);
  letter-spacing: 0.02em;
}

/* ---- CTA-пара ---- */
.hero__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.hero__actions .cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: var(--r-md);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
}
.hero__actions .cta--primary {
  background: var(--accent);
  color: var(--on-accent);
}
.hero__actions .cta--primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-cta);
}
.hero__actions .cta--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--border);
}
.hero__actions .cta--ghost:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .hero { padding: 110px 0 60px; }
  .hero__stats { gap: 18px; padding: 16px 0; }
  .hero__stats .hero__stat strong { font-size: 1.3rem; }
  .hero__ai-demo { padding: 14px; }
}
