/* Almighty — лендинг. Все токены через CSS-переменные. Mobile-first. */

/* ---------- Токены ---------- */
:root {
  --bg: #07080C;
  --surface: #0D0E14;
  --surface-hover: #111318;
  --border: #1A1C26;
  --text: #E5E7EB;
  --text-secondary: #9CA3AF;
  --text-muted: #6B7280;
  --accent-violet: #A78BFA;
  --accent-cyan: #67E8F9;
  --error: #EF4444;
  --success: #10B981;

  --container: 1200px;
  --pad-x: 24px;
  --section-gap: 80px;
  --radius-card: 12px;

  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

@media (min-width: 768px) {
  :root {
    --pad-x: 48px;
    --section-gap: 120px;
  }
}

/* ---------- Шрифты (self-hosted Inter 400/500/600) ---------- */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/inter-cyrillic-400.woff2') format('woff2');
  unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/inter-latin-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+2000-206F, U+2190-21FF, U+20AC;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/inter-cyrillic-500.woff2') format('woff2');
  unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/inter-latin-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+2000-206F, U+2190-21FF, U+20AC;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/inter-cyrillic-600.woff2') format('woff2');
  unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/inter-latin-600.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+2000-206F, U+2190-21FF, U+20AC;
}

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p { margin: 0; }

h1 {
  font-weight: 600;
  font-size: clamp(30px, 7vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
h2 {
  font-weight: 600;
  font-size: clamp(24px, 5vw, 32px);
  line-height: 1.2;
}
h3 {
  font-weight: 600;
  font-size: 20px;
  line-height: 1.3;
}

.caption {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

a { color: inherit; text-decoration: none; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--pad-x);
  padding-right: var(--pad-x);
}

.section { padding-top: var(--section-gap); }
.section:first-of-type { padding-top: 0; }

.section-title { margin-bottom: 48px; }

/* ---------- Декоративный фон ---------- */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}
.bg-diamond {
  position: absolute;
  width: 480px;
  height: 480px;
  border: 1px solid var(--text);
  opacity: 0.03;
  transform: rotate(45deg);
}
.bg-diamond--1 {
  top: -120px;
  right: -140px;
  animation: drift1 36s ease-in-out infinite alternate;
}
.bg-diamond--2 {
  bottom: -160px;
  left: -180px;
  width: 380px;
  height: 380px;
  animation: drift2 42s ease-in-out infinite alternate;
}
@keyframes drift1 {
  from { transform: rotate(45deg) translate(0, 0); }
  to   { transform: rotate(45deg) translate(28px, 22px); }
}
@keyframes drift2 {
  from { transform: rotate(45deg) translate(0, 0); }
  to   { transform: rotate(45deg) translate(-24px, -28px); }
}

.noise-defs { position: absolute; }
.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.02;
  filter: url(#noiseFilter);
  background: var(--text);
}

/* ---------- Логотип (реальный рендер из ДС) ---------- */
.logo-img {
  display: block; /* webp с альфа-каналом: чёрный фон вырезан, свечение сохранено */
}
.logo-img--hero {
  animation: logoPulse 4s ease-in-out infinite alternate;
}
@keyframes logoPulse {
  from { opacity: 0.92; transform: scale(0.98); }
  to   { opacity: 1;    transform: scale(1); }
}

/* ---------- Шапка ---------- */
.header {
  padding: 20px 0;
}
.header__logo {
  display: flex;
  justify-content: center;
  width: fit-content;
  margin: 0 auto;
}

/* ---------- Пульсация узла логотипа ---------- */
.logo-node {
  transform-origin: 32px 32px;
  animation: nodePulse 4s ease-in-out infinite alternate;
}
@keyframes nodePulse {
  from { opacity: 0.95; transform: scale(0.97); }
  to   { opacity: 1;    transform: scale(1); }
}

/* ---------- Hero ---------- */
.hero {
  min-height: 72vh;
  display: flex;
  align-items: center;
  padding-top: 40px;
}
.hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.hero__logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 48px;
}
.hero__wordmark {
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.18em;
  color: var(--text);
  text-transform: uppercase;
}
.hero__supertitle {
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--text-muted);
}
.hero__title {
  max-width: 760px;
  margin-bottom: 24px;
}
.hero__subtitle {
  max-width: 620px;
  color: var(--text-secondary);
  margin-bottom: 40px;
}
.hero__caption { margin-top: 16px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-weight: 500;
  font-size: 15px;
  line-height: 1.4;
  cursor: pointer;
  transition: background 220ms ease-out, border-color 220ms ease-out, transform 120ms ease-out;
}
.btn:hover {
  background: rgba(167, 139, 250, 0.1);
  border-color: var(--accent-violet);
}
.btn:active { transform: scale(0.98); }

.btn--primary {
  border-color: rgba(167, 139, 250, 0.35);
  background: rgba(167, 139, 250, 0.06);
}

/* Пульсирующая обводка primary-кнопок: светящаяся точка бежит по периметру */
@property --border-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@supports ((-webkit-mask-composite: xor) or (mask-composite: exclude)) {
  .btn--primary { position: relative; }
  .btn--primary::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: conic-gradient(from var(--border-angle),
      transparent 0deg,
      transparent 265deg,
      rgba(167, 139, 250, 0.25) 300deg,
      rgba(167, 139, 250, 1) 340deg,
      rgba(196, 181, 253, 1) 355deg,
      transparent 360deg);
    animation: borderPulse 3s linear infinite;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    pointer-events: none;
  }
  .btn--primary:hover::before { animation-duration: 1.5s; }
}
@keyframes borderPulse {
  to { --border-angle: 360deg; }
}
.btn--large {
  padding: 16px 32px;
  font-size: 16px;
}
.btn--ghost { color: var(--text-secondary); }
.btn--ghost:hover { color: var(--text); }

/* ---------- Цифры ---------- */
.stats__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
}
.stat__value {
  font-weight: 600;
  font-size: clamp(34px, 7vw, 48px);
  line-height: 1.1;
  color: var(--accent-cyan);
  font-variant-numeric: tabular-nums;
  margin-bottom: 12px;
  white-space: nowrap;
}
.stat__label {
  color: var(--text-secondary);
  max-width: 320px;
}
@media (min-width: 900px) {
  .stats__grid { grid-template-columns: repeat(3, 1fr); gap: 32px; }
}

/* ---------- Как это работает ---------- */
.steps__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
.steps__connector { display: none; }
.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 32px;
  transition: background 250ms ease-out, transform 250ms ease-out;
}
.step-card:hover {
  background: var(--surface-hover);
  transform: translateY(-4px);
}
.step-card__num {
  color: var(--accent-violet);
  margin-bottom: 20px;
  letter-spacing: 0.06em;
}
.step-card__icon { margin-bottom: 16px; display: block; }
.step-card__title { margin-bottom: 12px; }
.step-card__text { color: var(--text-secondary); }

@media (min-width: 900px) {
  .steps__grid {
    grid-template-columns: 1fr 1px 1fr 1px 1fr;
    align-items: stretch;
    gap: 0 32px;
  }
  .steps__connector {
    display: block;
    width: 1px;
    background: var(--border);
    margin: 32px 0;
  }
}

/* ---------- Демо ---------- */
.demo__layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "text"
    "chat"
    "cta";
  gap: 40px;
}
.demo__text-col { grid-area: text; }
.demo__chat { grid-area: chat; }
.demo__cta-col { grid-area: cta; }
.demo__text {
  color: var(--text-secondary);
  max-width: 520px;
  margin-bottom: 24px;
}
.demo__note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px 24px;
  max-width: 520px;
}
.demo__note p { color: var(--text-secondary); font-size: 15px; }
.demo__cta-col .btn { width: 100%; }
.demo__caption { margin-top: 16px; }

@media (min-width: 900px) {
  .demo__layout {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "text chat"
      "cta  chat";
    gap: 32px 64px;
    align-items: start;
  }
  .demo__cta-col .btn { width: auto; }
}

/* Чат-макет */
.chat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  max-width: 420px;
  margin-left: auto;
}
.chat__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.chat__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(167, 139, 250, 0.5);
  background:
    radial-gradient(circle at 50% 50%, rgba(103, 232, 249, 0.25), transparent 60%),
    var(--bg);
  flex-shrink: 0;
}
.chat__name { font-weight: 500; font-size: 14px; }
.chat__status { font-size: 12px; color: var(--text-muted); }
.chat__body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 240px;
}
/* Сообщения чата появляются по очереди при попадании в viewport */
.chat__msg, .chat__typing {
  opacity: 0;
  transform: translateY(10px);
}
.chat.is-live .chat__msg,
.chat.is-live .chat__typing {
  animation: msgIn 500ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.chat.is-live .chat__msg:nth-child(1) { animation-delay: 0ms; }
.chat.is-live .chat__msg:nth-child(2) { animation-delay: 550ms; }
.chat.is-live .chat__msg:nth-child(3) { animation-delay: 1200ms; }
.chat.is-live .chat__typing { animation-delay: 1850ms; }
@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat__msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
}
.chat__msg--in {
  align-self: flex-start;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.chat__msg--out {
  align-self: flex-end;
  background: rgba(167, 139, 250, 0.08);
  border: 1px solid rgba(167, 139, 250, 0.25);
  color: var(--text);
  border-bottom-right-radius: 4px;
}
.chat__typing {
  align-self: flex-start;
  display: flex;
  gap: 5px;
  padding: 12px 16px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}
.chat__typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing 1.2s ease-in-out infinite;
}
.chat__typing span:nth-child(2) { animation-delay: 0.2s; }
.chat__typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* ---------- Пилот ---------- */
.pilot__text {
  color: var(--text-secondary);
  max-width: 640px;
  margin-bottom: 20px;
}
.pilot .btn { margin-top: 16px; }
.pilot__caption { margin-top: 16px; }

/* ---------- Блок «Почему мы» ---------- */
.why__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 700px) {
  .why__grid { grid-template-columns: 1fr 1fr; gap: 24px; }
}
.why-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 32px;
  transition: background 250ms ease-out, transform 250ms ease-out;
}
.why-card:hover {
  background: var(--surface-hover);
  transform: translateY(-4px);
}
.why-card__title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}
.why-card__text {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
}
.why__grid .reveal { transition-duration: 500ms; }
.why__grid .reveal:nth-child(2) { transition-delay: 150ms; }
.why__grid .reveal:nth-child(3) { transition-delay: 300ms; }
.why__grid .reveal:nth-child(4) { transition-delay: 450ms; }

/* ---------- Блок «Поддержка» ---------- */
.support__text {
  color: var(--text-secondary);
  max-width: 640px;
  margin-bottom: 0;
}

/* ---------- Контакты ---------- */
.contacts__text {
  color: var(--text-secondary);
  margin-bottom: 32px;
}
.contacts__links {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 320px;
}
@media (min-width: 768px) {
  .contacts__links { flex-direction: row; max-width: none; }
  .contacts__links .btn { min-width: 160px; }
}

/* ---------- Футер ---------- */
.footer {
  margin-top: var(--section-gap);
  padding: 40px 0 48px;
  border-top: 1px solid var(--border);
}
.footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.footer__tagline { color: var(--text-muted); }
.footer__privacy {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 200ms ease;
}
.footer__privacy:hover { color: var(--text); }

/* ---------- Появление секций (только hero и stats) ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 400ms ease-out, transform 400ms ease-out;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal:nth-child(2) { transition-delay: 100ms; }
.reveal:nth-child(3) { transition-delay: 200ms; }
/* Каскад появления карточек шагов */
.steps__grid .reveal { transition-duration: 500ms; }
.steps__grid .reveal:nth-child(3) { transition-delay: 150ms; }
.steps__grid .reveal:nth-child(5) { transition-delay: 300ms; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
