/* ============================================================
   crypto-signal-bot — лендинг. Палитра: та же ordinal-blue шкала,
   что в tariff-matrix.html (валидирована dataviz-процедурой).
   Тема: авто по prefers-color-scheme; ручной override —
   html[data-theme="light"|"dark"] (переключатель в main.ts).
   ============================================================ */

:root {
  --surface-1:      #fcfcfb;
  --page:           #f9f9f7;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --grid:           #e1e0d9;
  --border:         rgba(11,11,11,0.10);
  --good:           #0ca30c;
  --neg:            #c14953;   /* тёплый полюс дивергентной пары (минусовые бары) */

  --tier-default:   #86b6ef;
  --tier-basic:     #5598e7;
  --tier-pro:       #2a78d6;
  --tier-vip:       #184f95;

  --accent:         #2a78d6;
  --accent-soft:    rgba(42,120,214,0.10);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface-1:      #1a1a19;
    --page:           #0d0d0d;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --grid:           #2c2c2a;
    --border:         rgba(255,255,255,0.10);
    --good:           #2fbf2f;
    --neg:            #d4636d;

    --tier-default:   #3987e5;
    --tier-basic:     #2a78d6;
    --tier-pro:       #1c5cab;
    --tier-vip:       #104281;

    --accent:         #3987e5;
    --accent-soft:    rgba(57,135,229,0.14);
  }
}
:root[data-theme="dark"] {
  --surface-1:      #1a1a19;
  --page:           #0d0d0d;
  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted:     #898781;
  --grid:           #2c2c2a;
  --border:         rgba(255,255,255,0.10);
  --good:           #2fbf2f;
  --neg:            #d4636d;

  --tier-default:   #3987e5;
  --tier-basic:     #2a78d6;
  --tier-pro:       #1c5cab;
  --tier-vip:       #104281;

  --accent:         #3987e5;
  --accent-soft:    rgba(57,135,229,0.14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.55;
  font-size: 16px;
}

.wrap { max-width: 960px; margin: 0 auto; padding: 0 20px; }

h1 { font-size: clamp(26px, 4.5vw, 38px); line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 14px; }
h2 { font-size: clamp(21px, 3vw, 27px); letter-spacing: -0.01em; margin: 0 0 6px; }
h3 { font-size: 17px; margin: 0 0 6px; }
p  { margin: 0 0 12px; }
section { padding: 56px 0; border-top: 1px solid var(--grid); }
.section-sub { color: var(--text-secondary); max-width: 640px; margin-bottom: 26px; }

.num, td.num, .stat-value { font-variant-numeric: tabular-nums; }
.pos { color: var(--good); }
.negv { color: var(--neg); }
.muted { color: var(--text-muted); }
small, .fine { font-size: 12.5px; color: var(--text-muted); }

/* ---------- шапка ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  /* только вертикаль — горизонтальный отступ приходит от .wrap, обнулять нельзя */
  padding-top: 14px; padding-bottom: 14px;
  /* Прилипающий хедер: чистый CSS sticky — браузер сам плавно "ведёт" его при
     скролле, без JS и без рывков. Фон обязателен и совпадает с фоном body
     (--page), иначе контент секций будет просвечивать под хедером во время
     скролла. z-index — чтобы хедер оставался поверх графиков/таблиц ниже. */
  position: sticky; top: 0; z-index: 50;
  background: var(--page);
  border-bottom: 1px solid var(--border);
}
/* Логотип TrendPulse: знак (пульс в бейдже) + слово. Масштаб — через одну
   переменную --logo, её переопределяем на мобилке. */
.brand {
  --logo: 30px;
  display: inline-flex; align-items: center; gap: 9px;
  text-decoration: none; color: var(--text-primary); white-space: nowrap;
}
.brand-mark { width: var(--logo); height: var(--logo); display: block; flex: none; }
.brand-name {
  font-weight: 700; letter-spacing: -0.015em;
  font-size: calc(var(--logo) * 0.6);
}
.brand-accent { color: var(--accent); }
.brand:hover .brand-name { opacity: 0.85; }
#theme-toggle {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  background: var(--surface-1); border: 1px solid var(--border); color: var(--text-secondary);
  border-radius: 8px; padding: 7px 12px; font-size: 13px; cursor: pointer;
  min-height: 44px;
}
#theme-toggle:hover { color: var(--text-primary); }
.tt-icon { display: block; flex: none; }

/* ---------- hero ---------- */
.hero { padding-top: 40px; padding-bottom: 52px; border-top: none; }
.hero-sub { font-size: 17px; color: var(--text-secondary); max-width: 620px; }
.hero-stats {
  display: flex; gap: 36px; flex-wrap: wrap; margin: 30px 0 26px;
}
.stat .stat-value {
  font-size: clamp(26px, 4vw, 34px); font-weight: 800; letter-spacing: -0.01em;
  display: block;
}
.stat .stat-label { font-size: 13px; color: var(--text-secondary); display: block; margin-top: 2px; max-width: 190px; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 10px 22px; border-radius: 10px;
  font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: transparent; color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { background: var(--accent-soft); }
.disclaimer-line { font-size: 12.5px; color: var(--text-muted); }

/* ---------- конвейер ---------- */
.pipeline {
  list-style: none; counter-reset: step; padding: 0; margin: 26px 0 30px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px;
}
.pipeline li {
  counter-increment: step;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px 12px 14px; font-size: 14px; position: relative;
}
.pipeline li::before {
  content: counter(step);
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 999px; margin-right: 8px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 700;
}
.pipeline .step-tip { display: block; margin-top: 6px; font-size: 12.5px; color: var(--text-muted); }

.card {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 20px; margin: 18px 0;
}
.card.accent { border-left: 3px solid var(--accent); }

/* ---------- таблицы ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-1); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; min-width: 560px; }
thead th {
  text-align: left; padding: 12px 14px; font-weight: 700; font-size: 12.5px;
  color: var(--text-secondary); border-bottom: 1px solid var(--grid);
  white-space: nowrap;
}
tbody th { text-align: left; padding: 11px 14px; font-weight: 600; white-space: nowrap; }
tbody td { padding: 11px 14px; }
tbody tr { border-top: 1px solid var(--grid); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.hl { background: var(--accent-soft); }
.table-scroll tbody th:first-child, .table-scroll thead th:first-child {
  position: sticky; left: 0; background: var(--surface-1); z-index: 1;
}
tr.hl th:first-child { background: color-mix(in srgb, var(--surface-1) 88%, var(--accent)); }

/* ---------- графики ---------- */
figure.chart { margin: 22px 0; }
figure.chart figcaption { font-size: 13px; color: var(--text-secondary); margin-top: 8px; }
.chart-box {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; position: relative;
}
.chart-box svg { display: block; width: 100%; height: auto; }
.chart-note { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }

.tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.tabs button {
  border: 1px solid var(--border); background: transparent; color: var(--text-secondary);
  padding: 7px 14px; border-radius: 8px; font-size: 13px; cursor: pointer; min-height: 40px;
}
.tabs button[aria-selected="true"] {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600;
}

.chart-tooltip {
  position: absolute; top: 10px; left: 14px; pointer-events: none;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; font-size: 12.5px; display: none; box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  font-variant-numeric: tabular-nums; z-index: 2; white-space: nowrap;
}

details.data-table { margin-top: 10px; }
details.data-table summary { cursor: pointer; font-size: 13px; color: var(--text-secondary); min-height: 32px; }
details.data-table summary:hover { color: var(--text-primary); }

/* ---------- глоссарий ---------- */
.term {
  background: none; border: none; padding: 0; font: inherit; color: inherit;
  border-bottom: 1px dashed var(--text-muted); cursor: help; position: relative;
}
.term:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
#glossary-tip {
  position: absolute; z-index: 10; max-width: 280px;
  background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px;
  font-size: 13px; box-shadow: 0 4px 16px rgba(0,0,0,0.15); display: none;
}

/* ---------- тарифы ---------- */
/* Таблица тарифов крупнее и заметнее общих таблиц (методология/пары) — это
   главный конверсионный узел страницы, поэтому даём ей отдельный масштаб. */
.table-scroll-tariff {
  box-shadow: 0 10px 30px rgba(20,30,50,0.10); border-radius: 16px;
}
table.tariff-table { font-size: 15px; min-width: 660px; }
.tariff-table thead th {
  color: #fff; text-align: center; padding: 24px 18px 20px; white-space: normal;
  font-size: 19px; font-weight: 800; letter-spacing: -0.01em;
  cursor: pointer; user-select: none; transition: filter 0.15s ease;
}
/* Последняя ячейка шапки лежит ровно в скруглённом углу .table-scroll-tariff
   (radius 16px) — сама ячейка при этом прямоугольная, поэтому внутренний
   inset box-shadow (рамка выбора) рисовал острый угол, который контейнер
   обрезал по кривой мимо своей же рамки — угол «срезало». Скругляем сам
   угол ячейки тем же радиусом, что и у контейнера — inset-тень его наследует. */
.tariff-table thead th:last-child { border-top-right-radius: 16px; }
/* Тот же приём для нижнего правого угла — последняя ячейка последней строки
   лежит в нижнем скруглённом углу контейнера, и рамка выбранной колонки там
   резалась точно так же, как раньше вверху. */
.tariff-table tbody tr:last-child td:last-child { border-bottom-right-radius: 16px; }
.tariff-table thead th:hover { filter: brightness(1.06); }
.tariff-table thead th:first-child { color: var(--text-secondary); background: var(--surface-1); cursor: default; font-size: 15px; font-weight: 700; }
.tariff-table thead th:first-child:hover { filter: none; }
.tariff-table thead th .tier-sub { display: block; font-size: 13.5px; font-weight: 600; opacity: 0.95; margin-top: 5px; letter-spacing: 0; }
.tariff-table th[data-tier="default"] { background: var(--tier-default); }
.tariff-table th[data-tier="basic"]   { background: var(--tier-basic); }
.tariff-table th[data-tier="pro"]     { background: var(--tier-pro); }
.tariff-table th[data-tier="vip"]     { background: var(--tier-vip); }
/* Рамка выбранного тарифа раньше замыкалась в прямоугольник только вокруг
   заголовка (inset со всех 4 сторон) — снизу получалась белая линия, ни с
   чем не соединённая: подсвеченная колонка ниже (.col-selected) идёт без
   рамки, и белый «колпак» читался как оторванный от таблицы артефакт.
   Теперь рамка вокруг заголовка открыта снизу (только левая/верхняя/правая
   стороны) и продолжается вниз по бокам всей колонки уже акцентным цветом,
   с закрытием понизу на последней строке — получается один цельный «жёлоб». */
.tariff-table thead th[data-tier].is-selected {
  box-shadow:
    inset 3px 0 0 0 rgba(255,255,255,0.9),
    inset -3px 0 0 0 rgba(255,255,255,0.9),
    inset 0 3px 0 0 rgba(255,255,255,0.9);
}
.tariff-table tbody .col-selected {
  box-shadow: inset 3px 0 0 0 var(--accent), inset -3px 0 0 0 var(--accent);
}
.tariff-table tbody tr:last-child .col-selected {
  box-shadow:
    inset 3px 0 0 0 var(--accent),
    inset -3px 0 0 0 var(--accent),
    inset 0 -3px 0 0 var(--accent);
}
.tariff-table thead th[data-tier]:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }
.tariff-table tbody th { font-size: 14.5px; padding-top: 15px; padding-bottom: 15px; }
.tariff-table tbody td { text-align: center; padding-top: 15px; padding-bottom: 15px; font-size: 14.5px; }
.tariff-table td.on { color: var(--good); font-weight: 700; font-size: 19px; }
.tariff-table td.off { color: var(--text-muted); font-size: 16px; }
.badge {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; background: var(--accent-soft); color: var(--accent);
}
.badge.dim { background: rgba(137,135,129,0.14); color: var(--text-secondary); }
.badge.excl { background: var(--tier-vip); color: #fff; }
.price { font-size: 17px; font-weight: 800; }
.price small { display: block; font-size: 10.5px; font-weight: 500; color: var(--text-muted); }
.tariff-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
/* Кнопки-переключатели: не ссылки, а переключают подсветку колонки — сбрасываем
   нативные стили <button> до вида .btn и добавляем видимое «выбрано» состояние. */
.tariff-cta .btn { font-family: inherit; appearance: none; -webkit-appearance: none; }
/* Все три кнопки теперь одного вида (.btn-secondary) — тариф не выделяется
   цветом кнопки, выделяется только состояние «выбрано». */
.tariff-cta .btn.is-selected { box-shadow: 0 0 0 3px var(--accent); border-color: var(--accent); }
.tariff-cta .btn.is-selected::before { content: "✓ "; font-weight: 800; }
.col-hover { background: var(--accent-soft); }
.col-selected { background: color-mix(in srgb, var(--accent) 15%, var(--surface-1)); }

/* ---------- track record ---------- */
#track-fallback { border-left: 3px solid var(--text-muted); }
#track-live { display: none; }
#track-live .aggregates { display: flex; gap: 30px; flex-wrap: wrap; margin: 12px 0 18px; }

/* ---------- FAQ ---------- */
.faq details {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px;
  padding: 4px 18px; margin-bottom: 10px;
}
.faq summary { cursor: pointer; font-weight: 600; font-size: 15px; padding: 12px 0; min-height: 44px; }
.faq details[open] summary { border-bottom: 1px solid var(--grid); margin-bottom: 10px; }
.faq details p { color: var(--text-secondary); font-size: 14.5px; }

/* ---------- футер ---------- */
footer { border-top: 1px solid var(--grid); padding: 40px 0 60px; }
footer .fine { line-height: 1.6; display: block; margin-top: 14px; }

/* ---------- адаптив ---------- */
@media (max-width: 640px) {
  body { font-size: 15px; }
  .wrap { padding: 0 18px; }
  section { padding: 36px 0; }

  /* топбар: логотип чуть меньше, переключатель — компактная SVG-иконка без текста */
  .topbar { padding-top: 12px; padding-bottom: 12px; gap: 12px; }
  .brand { --logo: 26px; gap: 8px; }
  #theme-toggle {
    width: 44px; height: 44px; min-height: 44px; padding: 0; gap: 0;
    justify-content: center;
  }
  .tt-label { display: none; }

  /* заголовок: без принудительного переноса, «—» не висит отдельной строкой */
  .hero-br { display: none; }
  h1 { font-size: 27px; line-height: 1.22; margin-bottom: 12px; }
  h2 { font-size: 21px; }

  /* hero */
  .hero { padding-top: 20px; padding-bottom: 36px; }
  .hero-sub { font-size: 15.5px; }
  .hero-stats { gap: 20px 26px; margin: 24px 0 22px; }
  .stat .stat-value { font-size: 24px; }
  .stat .stat-label { max-width: none; }
  .cta-row { gap: 10px; }
  .cta-row .btn { width: 100%; }

  /* контент: чуть плотнее отступы под узкий экран */
  .section-sub { margin-bottom: 20px; }
  .card { padding: 15px 16px; margin: 14px 0; }
  .pipeline { grid-template-columns: 1fr; gap: 8px; margin: 20px 0 24px; }
  thead th, tbody th, tbody td { padding: 10px 12px; }
  table.tariff-table { font-size: 13.5px; min-width: 600px; }
  .tariff-table thead th { padding: 16px 12px 14px; font-size: 16px; }
  .tariff-table thead th .tier-sub { font-size: 12px; }
  .tariff-table tbody th, .tariff-table tbody td { padding-top: 12px; padding-bottom: 12px; }
  /* Первая (sticky) колонка с названиями строк на мобилке съедала до 80%
     ширины экрана из-за white-space:nowrap на длинных подписях типа «Снятие
     сигнала / разворот» — тарифным колонкам физически не оставалось места.
     Разрешаем перенос и жёстко ограничиваем ширину. */
  .tariff-table tbody th, .tariff-table thead th:first-child {
    white-space: normal; max-width: 132px; line-height: 1.28;
  }
  figure.chart { margin: 18px 0; }
  .chart-box { padding: 10px; }
  #track-live .aggregates { gap: 16px 24px; }
  .faq details { padding: 2px 15px; }
  footer { padding: 32px 0 48px; }

  /* графики — во всю ширину экрана (гасим горизонтальные поля .wrap),
     чтобы SVG рисовался крупнее; подписи/табы держим с отступом 18px */
  figure.chart .chart-box {
    margin-left: -18px; margin-right: -18px;
    border-radius: 0; border-left: none; border-right: none;
    padding: 10px 8px;
  }
  figure.chart figcaption, figure.chart .chart-note { padding: 0 2px; }
  figure.chart .tabs { margin-left: 0; }
}
