/**
 * Стили маркетингового сайта Keendex.
 *
 * Токены скопированы из кабинета (frontend/src/styles/globals.css) один к одному, чтобы сайт и
 * продукт не выглядели разными сервисами. Семантика цветов та же и такая же нетривиальная:
 * оранжевый — И действие, И минус; синий — категории и иконки; янтарных два.
 *
 * Никаких сборщиков и внешних библиотек: один файл стилей, один шрифтовой стек, встроенные SVG.
 * Страница обязана открываться быстро на телефоне в плохой сети — это витрина, а не приложение.
 */

:root {
  --bg-primary: #f8f8f8;
  --bg-card: #ffffff;
  --bg-subtle: #f8f8f8;
  --bg-border: #e9e9e9;

  --accent-action: #fd5c05;
  --accent-action-hover: #e34f00;
  --accent-brand: #0044ff;
  --accent-positive: #00a63d;
  --accent-neutral: #d58600;

  --navy-from: #040837;
  --navy-via: #0b179d;
  --navy-to: #3e3fce;

  --text-primary: #000000;
  --text-secondary: rgba(0, 0, 0, 0.7);
  --text-muted: rgba(0, 0, 0, 0.5);
  --on-dark: #ffffff;
  --on-dark-dim: rgba(255, 255, 255, 0.72);

  --r-card: 16px;
  --r-tile: 20px;
  --r-pill: 999px;
  --shadow-card: 5px 5px 30px rgba(0, 0, 0, 0.05);

  /* SF Pro из макета — системным стеком. Inter обязан стоять РАНЬШЕ Segoe UI:
     иначе на Windows подставляется Segoe и вся типографика уезжает. */
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', Roboto,
    Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }
a { color: var(--accent-action); text-decoration: none; }
a:hover { color: var(--accent-action-hover); }

.wrap { width: 100%; max-width: 1090px; margin: 0 auto; padding: 0 20px; }

/* ── Шапка ─────────────────────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 50;
  background: rgba(248, 248, 248, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--bg-border);
}
.top__row { display: flex; align-items: center; gap: 20px; height: 68px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px;
  letter-spacing: -0.02em; color: var(--text-primary); }
.logo__mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(140deg, var(--navy-from), var(--navy-via) 60%, var(--navy-to));
  display: grid; place-items: center; color: #fff; font-size: 15px; font-weight: 700;
}
.top__nav { display: flex; gap: 22px; margin-left: auto; }
.top__nav a { color: var(--text-secondary); font-size: 14px; font-weight: 500; }
.top__nav a:hover { color: var(--text-primary); }
.top__side { display: flex; align-items: center; gap: 10px; }

.lang {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid var(--bg-border); background: var(--bg-card);
  color: var(--text-secondary); font-size: 13px; font-weight: 600;
}
.lang:hover { color: var(--text-primary); border-color: rgba(0, 0, 0, 0.2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 22px; border: 0; border-radius: var(--r-pill);
  font: 600 15px/1 var(--font); cursor: pointer; white-space: nowrap;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.btn--primary { background: var(--accent-action); color: #fff; }
.btn--primary:hover { background: var(--accent-action-hover); color: #fff; transform: translateY(-1px); }
.btn--ghost { background: var(--bg-card); color: var(--text-primary); box-shadow: var(--shadow-card); }
.btn--ghost:hover { color: var(--text-primary); transform: translateY(-1px); }
.btn--onDark { background: rgba(255, 255, 255, 0.14); color: #fff; }
.btn--onDark:hover { background: rgba(255, 255, 255, 0.22); color: #fff; }
.btn--sm { height: 38px; padding: 0 16px; font-size: 14px; }

/* ── Первый экран ──────────────────────────────────────────────────────── */
.hero {
  background: radial-gradient(120% 140% at 15% 0%, var(--navy-to) 0%, var(--navy-via) 42%, var(--navy-from) 100%);
  color: var(--on-dark);
  padding: 76px 0 88px;
}
.hero__badge {
  display: inline-block; padding: 7px 14px; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.12); color: var(--on-dark);
  font-size: 13px; font-weight: 600; letter-spacing: 0.01em; margin-bottom: 22px;
}
.hero h1 {
  margin: 0 0 18px; font-size: clamp(30px, 5.2vw, 52px); line-height: 1.12;
  letter-spacing: -0.03em; font-weight: 700; max-width: 20ch;
}
.hero__lead { margin: 0 0 30px; font-size: clamp(16px, 2.1vw, 19px); color: var(--on-dark-dim);
  max-width: 62ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero__note { margin: 18px 0 0; font-size: 13px; color: rgba(255, 255, 255, 0.6); }

/* Первый экран: текст и визуальный блок рядом. На узком — текст сверху, картинка под ним. */
.hero__grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 44px; align-items: center; }
.hero__art { position: relative; }
.hero__photo {
  width: 100%; height: auto; display: block; border-radius: var(--r-tile);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
}

/* Карточка сигнала — вёрстка, а не картинка: остаётся резкой и переводится вместе со страницей. */
/* ★ Карточка стоит ПОД фотографией с небольшим наложением на нижний край, а не поверх кадра.
   Проверено снимками: при наложении сверху она закрывала то надпись «Keendex», то лицо —
   на разной ширине экрана по-разному. Снизу она не может закрыть ничего ни при каком размере. */
.mock {
  position: relative; z-index: 2;
  margin: -30px 26px 0; padding: 14px 16px;
  background: var(--bg-card); color: var(--text-primary);
  border-radius: var(--r-card);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}
.mock__head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.mock__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-positive); flex: none; }
.mock__title { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.mock__side { margin-left: auto; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--accent-positive);
  background: rgba(0, 166, 61, .1); padding: 3px 8px; border-radius: var(--r-pill); }
.mock__row { display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; padding: 5px 0; border-bottom: 1px solid var(--bg-border); }
.mock__row:last-of-type { border-bottom: 0; }
.mock__row span { color: var(--text-muted); }
.mock__row b { font-variant-numeric: tabular-nums; font-size: 14px; }
.mock__row .is-entry { color: var(--accent-brand); }
.mock__row .is-stop { color: var(--accent-negative); }
.mock__row .is-target { color: var(--accent-positive); }
/* Подпись «пример разметки» обязательна: без неё числа в карточке читаются как настоящая сделка. */
.mock__note { margin-top: 10px; font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em; }

/* ── Секции ────────────────────────────────────────────────────────────── */
.sec { padding: 72px 0; }
.sec--tint { background: var(--bg-card); }
.sec__head { max-width: 62ch; margin-bottom: 34px; }
.sec h2 { margin: 0 0 12px; font-size: clamp(24px, 3.4vw, 34px); line-height: 1.18;
  letter-spacing: -0.02em; font-weight: 700; }
.sec__lead { margin: 0; color: var(--text-secondary); font-size: 17px; }

.grid { display: grid; gap: 18px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  background: var(--bg-card); border-radius: var(--r-card); padding: 24px;
  box-shadow: var(--shadow-card);
}
.sec--tint .card { background: var(--bg-subtle); box-shadow: none; border: 1px solid var(--bg-border); }
.card h3 { margin: 0 0 8px; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.card p { margin: 0; color: var(--text-secondary); font-size: 15px; }

.card__icon {
  width: 42px; height: 42px; border-radius: 12px; margin-bottom: 16px;
  display: grid; place-items: center;
  background: rgba(0, 68, 255, 0.08); color: var(--accent-brand);
}
.card__icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* Плитки рынков — плоские, r20, как в кабинете */
.tile {
  background: var(--bg-subtle); border: 1px solid var(--bg-border);
  border-radius: var(--r-tile); padding: 22px;
}
.sec--tint .tile { background: var(--bg-primary); }
/* Иконки активов: настоящие файлы из кабинета. Слегка находят друг на друга — так строка
   читается как «набор инструментов», а не как случайный ряд картинок. */
.tile__icons { display: flex; align-items: center; margin-bottom: 14px; }
.tile__icons img { width: 26px; height: 26px; border-radius: 50%; background: var(--bg-card);
  box-shadow: 0 0 0 2px var(--bg-subtle); }
.tile__icons img + img { margin-left: -7px; }
.sec--tint .tile__icons img { box-shadow: 0 0 0 2px var(--bg-primary); }
.tile h3 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.tile p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* Шаги */
.step { display: flex; gap: 18px; align-items: flex-start; }
.step__num {
  flex: none; width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--accent-action); color: #fff; font-weight: 700; font-size: 15px;
}
.step h3 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.step p { margin: 0; color: var(--text-secondary); font-size: 15px; }

/* Шаги и схема рядом: текст объясняет порядок, схема показывает результат */
.howgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 34px;
  align-items: center; }
.howgrid__steps { display: grid; gap: 22px; }

.fig { margin: 0; }
.fig__svg { width: 100%; height: auto; display: block;
  background: var(--bg-card); border-radius: var(--r-card); box-shadow: var(--shadow-card);
  padding: 10px; }
.sec--tint .fig__svg { background: var(--bg-subtle); box-shadow: none; border: 1px solid var(--bg-border); }
.fig figcaption { margin-top: 12px; color: var(--text-muted); font-size: 13.5px; text-align: center; }

/* ── Примеры экранов кабинета ───────────────────────────────────────────
   Собраны из тех же токенов, что продукт: белая карточка r16, серые поля,
   оранжевый = стоп, синий = вход, зелёный = цели. */
.scrgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
/* Обзор рынка занимает всю ширину: там текст, а не числа в столбик */
.scrgrid > .scr:last-child { grid-column: 1 / -1; }

.scr { margin: 0; background: var(--bg-card); border-radius: var(--r-card);
  box-shadow: var(--shadow-card); overflow: hidden; }
.sec--tint .scr { background: var(--bg-subtle); box-shadow: none; border: 1px solid var(--bg-border); }
.scr__bar { display: flex; align-items: baseline; gap: 10px; padding: 14px 18px;
  border-bottom: 1px solid var(--bg-border); }
.scr__name { font-size: 14px; font-weight: 600; }
.scr__sub { font-size: 12.5px; color: var(--text-muted); margin-left: auto;
  font-variant-numeric: tabular-nums; }
.scr__body { padding: 16px 18px 18px; }

.scr__row { display: flex; gap: 8px; margin-bottom: 12px; }
.scr__badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 4px 9px; border-radius: var(--r-pill); }
.scr__badge.is-long { color: var(--accent-positive); background: rgba(0, 166, 61, .1); }
.scr__badge.is-open { color: var(--accent-neutral); background: rgba(213, 134, 0, .12); }

.scr__chart { width: 100%; height: auto; display: block; margin: 4px 0 14px;
  color: var(--text-muted); }

.scr__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.scr__field { background: var(--bg-subtle); border-radius: 10px; padding: 9px 11px;
  display: flex; flex-direction: column; gap: 2px; }
.sec--tint .scr__field { background: var(--bg-primary); }
.scr__field span { font-size: 11.5px; color: var(--text-muted); }
.scr__field b { font-size: 15px; font-variant-numeric: tabular-nums; }
.is-entry { color: var(--accent-brand); }
.is-stop { color: var(--accent-negative); }
.is-target { color: var(--accent-positive); }
.is-dim { color: var(--text-muted); }

/* Полоса — янтарная, как в продукте (второй янтарный токен) */
.scr__meter { margin-top: 14px; font-size: 12px; color: var(--text-muted); }
.scr__meter i { display: block; height: 6px; border-radius: var(--r-pill);
  background: var(--bg-border); margin-top: 6px; overflow: hidden; }
.scr__meter i b { display: block; height: 100%; background: #f3ba2f; }

.scr__why { margin: 12px 0 0; font-size: 13px; color: var(--text-secondary); line-height: 1.45; }

.scr__list { display: grid; gap: 10px; }
.scr__item { display: grid; grid-template-columns: 132px 1fr; gap: 12px; align-items: baseline;
  padding-bottom: 10px; border-bottom: 1px solid var(--bg-border); }
.scr__item:last-child { border-bottom: 0; padding-bottom: 0; }
.scr__item b { font-size: 14px; }
.scr__item span { font-size: 13.5px; color: var(--text-secondary); }
.scr__callout { margin-top: 14px; background: var(--bg-subtle); border-radius: 10px; padding: 12px 14px;
  display: grid; gap: 3px; }
.sec--tint .scr__callout { background: var(--bg-primary); }
.scr__callout b { font-size: 12.5px; color: var(--accent-brand); }
.scr__callout span { font-size: 13.5px; color: var(--text-secondary); }

.scr__table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.scr__table th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em; padding-bottom: 8px; }
.scr__table th:last-child, .scr__table td:last-child { text-align: right; }
.scr__table td { padding: 8px 0; border-top: 1px solid var(--bg-border);
  font-variant-numeric: tabular-nums; }
.scr__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.scr__stats > div { background: var(--bg-subtle); border-radius: 10px; padding: 9px 11px;
  display: grid; gap: 2px; }
.sec--tint .scr__stats > div { background: var(--bg-primary); }
.scr__stats span { font-size: 11px; color: var(--text-muted); line-height: 1.25; }
.scr__stats b { font-size: 15px; font-variant-numeric: tabular-nums; }

/* Результат расчёта выделен цветом действия: это то, ради чего открывают калькулятор */
.scr__out { margin-top: 12px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px; }
.scr__out > div { border-radius: 10px; padding: 10px 11px; display: grid; gap: 2px;
  background: rgba(253, 92, 5, .07); }
.scr__out span { font-size: 11px; color: var(--text-muted); line-height: 1.25; }
.scr__out b { font-size: 15px; color: var(--accent-action); font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  .scrgrid { grid-template-columns: 1fr; }
  .scr__item { grid-template-columns: 1fr; gap: 2px; }
}

/* Видео обзора кабинета */
.videobox {
  border-radius: var(--r-card); overflow: hidden; background: #000;
  box-shadow: var(--shadow-card); aspect-ratio: 16 / 9;
}
.videobox iframe { width: 100%; height: 100%; display: block; border: 0; }

/* Вопросы */
details.faq {
  background: var(--bg-card); border-radius: var(--r-card); box-shadow: var(--shadow-card);
  padding: 18px 22px; margin-bottom: 12px;
}
details.faq + details.faq { margin-top: 0; }
details.faq summary {
  cursor: pointer; font-weight: 600; font-size: 16px; list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after {
  content: ''; flex: none; width: 10px; height: 10px; margin-right: 4px;
  border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg); transition: transform .18s ease;
}
details.faq[open] summary::after { transform: rotate(-135deg); }
details.faq p { margin: 12px 0 0; color: var(--text-secondary); font-size: 15px; }

/* Призыв */
.cta {
  background: radial-gradient(120% 160% at 85% 0%, var(--navy-to) 0%, var(--navy-via) 45%, var(--navy-from) 100%);
  color: var(--on-dark); border-radius: var(--r-tile); padding: 46px;
  text-align: center;
}
.cta h2 { margin: 0 0 10px; color: var(--on-dark); }
.cta p { margin: 0 auto 26px; color: var(--on-dark-dim); max-width: 54ch; font-size: 17px; }
.cta__actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* Подвал */
.foot { background: var(--bg-card); border-top: 1px solid var(--bg-border); padding: 44px 0 30px; }
.foot__grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 28px; }
.foot h4 { margin: 0 0 10px; font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); }
.foot ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.foot a { color: var(--text-secondary); font-size: 14px; }
.foot a:hover { color: var(--text-primary); }
.foot__tagline { margin: 10px 0 0; color: var(--text-secondary); font-size: 14px; max-width: 46ch; }
/* Предупреждение — обычной серой строкой внизу: оно обязано быть точным, но его место
   подвал, а не середина витрины. */
.foot__legal { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--bg-border);
  color: var(--text-muted); font-size: 12.5px; display: grid; gap: 8px; }
.foot__legal p { margin: 0; max-width: 92ch; line-height: 1.5; }

/* ── Узкие экраны ──────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foot__grid { grid-template-columns: 1fr 1fr; }
  .top__nav { display: none; }
  .hero__grid { grid-template-columns: 1fr; gap: 40px; }
  .howgrid { grid-template-columns: 1fr; }
  /* Картинка на планшете не должна занимать весь экран в высоту */
  .hero__art { max-width: 460px; }
}
@media (max-width: 640px) {
  .mock { margin: -22px 14px 0; }
  .hero__art { max-width: none; }
  .sec { padding: 52px 0; }
  .hero { padding: 56px 0 62px; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .foot__grid { grid-template-columns: 1fr; }
  .cta { padding: 32px 22px; }
  .hero__actions .btn, .cta__actions .btn { width: 100%; }
  .logo { font-size: 17px; }
}

/* Тёмная тема системы: витрина светлая по макету, но глаза щадим —
   меняем только фон страницы и текст, фирменные цвета остаются. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #070b1f;
    --bg-card: #0d1330;
    --bg-subtle: #111838;
    --bg-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.72);
    --text-muted: rgba(255, 255, 255, 0.52);
    --shadow-card: 5px 5px 30px rgba(0, 0, 0, 0.35);
  }
  .top { background: rgba(7, 11, 31, 0.88); }
  .card__icon { background: rgba(62, 63, 206, 0.22); color: #8ea2ff; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
