/* ==========================================================================
   ВНЕДРУМ · style.css — портирован из docs/design под tokens.css и бюджет.
   Порядок: @font-face → reset → компоненты → motion → адаптив → reduced-motion.
   Цвета/шрифты — только через var(--*) из tokens.css. Хардкода нет
   (исключение — «светофор» окна терминала: декоративный chrome, не бренд).
   ========================================================================== */

/* --- Шрифты: self-hosted subset (латиница+кириллица), font-display:swap ----- */
@font-face {
  font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400;
  font-display: swap;
  src: url('../fonts/IBMPlexSans-Regular.subset.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600;
  font-display: swap;
  src: url('../fonts/IBMPlexSans-SemiBold.subset.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 700;
  font-display: swap;
  src: url('../fonts/IBMPlexSans-Bold.subset.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400;
  font-display: swap;
  src: url('../fonts/IBMPlexMono-Regular.subset.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500;
  font-display: swap;
  src: url('../fonts/IBMPlexMono-Medium.subset.woff2') format('woff2');
}

/* --- Reset ---------------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* overflow-x: clip гасит горизонтальный скролл, НЕ создавая scroll-контейнер —
   поэтому sticky-хедер продолжает липнуть к вьюпорту (в отличие от overflow:hidden). */
html { overflow-x: clip; }
body {
  overflow-x: clip;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

::selection { background: var(--ink); color: var(--paper); }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 3px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 32px; }

.mono { font-family: var(--font-mono); }

/* ==========================================================================
   HEADER (sticky)
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 0;
  background: color-mix(in srgb, var(--paper) 80%, transparent);
  backdrop-filter: saturate(1.2) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-left { display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }

/* --- Тумблер темы «бит 0/1» — единственный переключатель темы --------------- */
.bit-toggle {
  appearance: none; -webkit-appearance: none;
  background: none; border: 0; cursor: pointer;
  padding: 9px; margin: -9px 0;            /* тап-таргет ≥44px без сдвига вёрстки */
  display: inline-flex; align-items: center; border-radius: 18px;
  -webkit-tap-highlight-color: transparent;
}
.bit-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.bit-track {
  position: relative; display: block; box-sizing: border-box;
  width: 52px; height: 26px;
  border: 1.5px solid var(--ink); border-radius: 14px;
  transition: border-color 0.3s var(--ease);
}
.bit-knob {
  position: absolute; top: 2px; left: 2px;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--ink);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.4s var(--ease), background 0.3s var(--ease);
}
.bit-knob::after {
  content: '0';
  font-family: var(--font-mono); font-size: 11px; font-weight: 500; line-height: 1;
  color: var(--paper);
}
/* Тёмная тема (система без явного выбора ИЛИ .theme-dark): бит вправо, «1» */
@media (prefers-color-scheme: dark) {
  :root:not(.theme-light) .bit-knob { transform: translateX(26px); }
  :root:not(.theme-light) .bit-knob::after { content: '1'; }
}
:root.theme-dark  .bit-knob { transform: translateX(26px); }
:root.theme-dark  .bit-knob::after { content: '1'; }
:root.theme-light .bit-knob { transform: none; }
:root.theme-light .bit-knob::after { content: '0'; }
.wordmark {
  font-family: var(--font-mono);
  font-weight: 600; font-size: 15px; letter-spacing: 0.34em;
  text-decoration: none; color: var(--ink);
}
.nav-links {
  display: flex; gap: 34px;
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.08em;
}
.nav-links a { text-decoration: none; color: var(--ink); opacity: 0.72; transition: opacity 0.25s var(--ease); }
.nav-links a:hover { opacity: 1; }

/* Кнопки ------------------------------------------------------------------- */
.btn {
  display: inline-block;
  font-family: var(--font-mono); font-size: 13px; font-weight: 500;
  letter-spacing: 0.03em; text-decoration: none; text-align: center;
  border-radius: var(--radius-btn); cursor: pointer;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), opacity 0.3s var(--ease), border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.btn-primary { background: var(--ink); color: var(--paper); border: 1px solid var(--ink); padding: 14px 22px; }
.btn-primary:hover { transform: translateY(-2px); opacity: 0.9; box-shadow: 0 14px 30px -12px color-mix(in srgb, var(--ink) 50%, transparent); }
.btn-secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); padding: 14px 22px; }
.btn-secondary:hover { border-color: var(--ink); background: var(--paper-2); }

.btn-header { font-size: 12.5px; padding: 10px 16px; border-radius: 5px; }
.btn-header:hover { transform: translateY(-1px); opacity: 0.9; }
.cta-short { display: none; }

/* ==========================================================================
   HERO
   ========================================================================== */
.hero { padding: 64px 0 24px; }
.hero-grid {
  display: grid; grid-template-columns: 1.02fr 0.98fr; gap: 52px; align-items: center;
}
.eyebrow {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.24em;
  color: var(--ink); opacity: 0.55; margin-bottom: 26px;
}
.hero h1 {
  margin: 0;
  font-size: clamp(40px, 4.6vw, 62px); line-height: 1.03; letter-spacing: -0.03em;
  font-weight: 700; max-width: 16ch;
}
.hero h1 span { display: block; }
.hero-sub {
  max-width: 52ch; margin: 26px 0 0;
  font-size: 18px; line-height: 1.6; color: var(--ink); opacity: 0.82;
}
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 34px; }

/* --- Терминал (сигнатура героя) — всегда тёмный, вне темы ----------------- */
.terminal {
  position: relative;
  background: var(--term-bg); border-radius: var(--radius-card); overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.25);
  box-shadow: 0 34px 80px -34px rgba(21, 24, 28, 0.55),
              0 10px 28px -14px rgba(21, 24, 28, 0.45);
}
.terminal.is-clickable { cursor: pointer; }

/* Строка-подсказка после печати демо */
.term-hint { margin-top: 6px; color: var(--term-comment); opacity: 0; transition: opacity 0.5s var(--ease); }
.term-hint.is-on { opacity: 0.75; }

/* «Матрица» — канва поверх тела терминала, только по клику */
.term-matrix { position: absolute; display: none; z-index: 3; }
.term-matrix.is-on { display: block; }
.terminal-bar {
  position: relative;
  display: flex; align-items: center; padding: 12px 16px;
  background: var(--term-bar); border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.terminal-dots { display: flex; gap: 8px; }
.terminal-dots span { display: block; width: 12px; height: 12px; border-radius: 50%; }
/* Декоративный «светофор» окна — не бренд-палитра, оставляем как есть */
.dot-red    { background: #FF5F57; }
.dot-yellow { background: #FEBC2E; }
.dot-green  { background: #28C840; }
.terminal-title {
  position: absolute; left: 0; right: 0; text-align: center;
  font-family: var(--font-mono); font-size: 12px; color: var(--term-title);
  pointer-events: none;
}
.terminal-body {
  margin: 0; padding: 22px 22px 26px; min-height: 286px; overflow: hidden;
  font-family: var(--font-mono); font-size: 13.5px; line-height: 1.72;
  color: var(--term-code);
  white-space: pre-wrap; word-break: break-word;
  cursor: text;
}
.terminal-body .cmt   { color: var(--term-comment); }  /* комментарии */
.terminal-body .amber { color: var(--amber); }         /* строка LLM-решения */
.terminal-body .ok    { color: var(--ok); }            /* итоговая ✓-строка */
.terminal-body .err   { color: var(--term-code); opacity: 0.92; }
.terminal-body .prompt { color: var(--ok); }           /* приглашение vnedrum:~$ */
.terminal-cursor { color: var(--amber); }

.term-caption {
  margin: 14px 2px 0;
  font-family: var(--font-mono); font-size: 11.5px; line-height: 1.5;
  color: var(--dim); opacity: 0.85;
}
/* Курсор — статичный псевдоэлемент на активной строке (не перевешиваем на каждый символ) */
.term-line.is-caret::after {
  content: '▋'; color: var(--amber); margin-left: 1px;
  animation: blink 1s step-end infinite;
}

/* ==========================================================================
   ЧТО ДЕЛАЕМ / КЕЙСЫ — карточки
   ========================================================================== */
.section { padding: 56px 0 40px; }
.section--top { border-top: 1px solid var(--line); }
.section-label {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.2em;
  color: var(--ink); opacity: 0.55; margin: 0 0 38px;
}
.section--top .section-label { margin-top: 44px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.card {
  display: flex; flex-direction: column;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-card);
  padding: 34px;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -22px color-mix(in srgb, var(--ink) 35%, transparent); }
.tag {
  align-self: flex-start;
  font-family: var(--font-mono); font-size: 12px;
  color: var(--ink); background: var(--paper); border: 1px solid var(--line);
  padding: 4px 8px; border-radius: 4px; margin-bottom: 18px;
}
.card h3 {
  margin: 0 0 14px; font-weight: 600; font-size: 24px;
  letter-spacing: -0.01em; line-height: 1.15;
}
.card p { margin: 0 0 26px; font-size: 16px; line-height: 1.6; opacity: 0.84; }
.card-result {
  margin-top: auto; padding-top: 20px; border-top: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.5;
  color: var(--ink); opacity: 0.8;
}

.card--case h3 { font-size: 22px; font-weight: 700; }
.card--case p { margin-bottom: 0; font-size: 15.5px; }
.card--case .tag { color: var(--ink); opacity: 0.6; }

.footnote {
  margin: 22px 0 0;
  font-family: var(--font-mono); font-size: 11.5px; line-height: 1.6;
  color: var(--ink); opacity: 0.55;
}

/* ==========================================================================
   ПОДХОД — лёгкие колонки
   ========================================================================== */
.approach { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.approach .col { padding: 0 40px; }
.approach .col:first-child { padding-left: 0; padding-right: 40px; }
.approach .col:last-child { padding-right: 0; padding-left: 40px; }
.approach .col + .col { border-left: 1px solid var(--line); }
.approach .col .tag-plain {
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.04em;
  color: var(--ink); margin-bottom: 16px;
}
.approach .col p { margin: 0; font-size: 16.5px; line-height: 1.55; opacity: 0.86; }

/* ==========================================================================
   КАК МЫ РАБОТАЕМ — сетка шагов
   ========================================================================== */
.steps {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  border: 1px solid var(--line); border-radius: var(--radius-card); overflow: hidden;
}
.step { padding: 30px 26px; background: var(--paper); transition: background 0.3s var(--ease); }
.step + .step { border-left: 1px solid var(--line); }
.step:hover { background: var(--paper-2); }
.step-num {
  font-family: var(--font-mono); font-size: 34px; font-weight: 600;
  color: var(--ink); margin-bottom: 16px;
}
.step h3 { font-weight: 700; font-size: 18px; margin: 0 0 10px; }
.step p { margin: 0; font-size: 14.5px; line-height: 1.55; opacity: 0.82; }

/* Варианты поддержки — под сеткой шагов, «изнанка» шага 04 */
.steps-support { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 22px; }
.steps-support p { margin: 0; font-size: 14.5px; line-height: 1.55; opacity: 0.82; }
.steps-support b { font-weight: 600; opacity: 1; }

/* ==========================================================================
   CTA — контрастная секция (инвертирует цвета темы через токены)
   ========================================================================== */
.cta { padding: 70px 0; border-top: 1px solid var(--line); }
.cta-card { background: var(--ink); color: var(--paper); border-radius: 12px; padding: 52px 48px; }

.proofs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px;
  margin-bottom: 44px; padding-bottom: 40px;
  border-bottom: 1px solid color-mix(in srgb, var(--paper) 16%, transparent);
}
.proof { display: flex; gap: 12px; align-items: flex-start; font-size: 16.5px; line-height: 1.55; }
.proof .check { color: var(--amber); font-weight: 600; flex: none; }
.proof span:last-child { opacity: 0.95; }

.cta-eyebrow {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.2em;
  opacity: 0.55; margin-bottom: 22px;
}
.cta-card h2 {
  margin: 0; font-size: clamp(30px, 4vw, 44px); line-height: 1.05;
  letter-spacing: -0.02em; font-weight: 700;
}
.cta-card > p { max-width: 54ch; margin: 22px 0 30px; font-size: 17px; line-height: 1.6; opacity: 0.82; }

.cta-form { display: flex; flex-direction: column; align-items: stretch; gap: 10px; max-width: 480px; }
.cta-form input {
  min-height: 50px;
  font-family: var(--font-mono); font-size: 15px; padding: 15px 16px;
  border-radius: var(--radius-btn); border: 1.5px solid var(--line);
  background: var(--paper); color: var(--ink); outline: none;
}
.cta-form input::placeholder { color: var(--dim); opacity: 1; }
.cta-form input:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; border-color: var(--paper); }
.cta-form input.is-invalid { border-color: #C0392B; }
.cta-form button {
  min-height: 50px; padding: 0 26px; border-radius: var(--radius-btn); cursor: pointer;
  font-family: var(--font-mono); font-size: 14px; font-weight: 500; letter-spacing: 0.03em;
  background: var(--paper); color: var(--ink); border: 1.5px solid var(--paper);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), opacity 0.3s var(--ease);
}
.cta-form button:hover { transform: translateY(-2px); opacity: 0.88; box-shadow: 0 12px 26px -12px rgba(0, 0, 0, 0.6); }
.cta-form button[disabled] { opacity: 0.6; cursor: default; transform: none; box-shadow: none; }

/* Честные состояния формы (M1 — без обещания письма).
   Монохром: янтарь/зелё-ный — привилегия терминала и пруфов, здесь их нет.
   Успех/ошибка различаются словами и насыщенностью, не цветом. */
.form-status {
  margin-top: 14px; max-width: 520px; min-height: 1.2em;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.5;
  color: var(--paper); opacity: 0.55;
}
.form-status.is-ok  { opacity: 0.95; }
.form-status.is-err { opacity: 0.95; text-decoration: underline; text-underline-offset: 3px; }

.consent {
  margin-top: 14px; max-width: 520px;
  font-family: var(--font-mono); font-size: 11.5px; line-height: 1.5;
  opacity: 0.6;
}
.consent a { color: var(--paper); text-decoration: underline; text-underline-offset: 2px; }

.founder-note {
  margin-top: 34px; padding-top: 26px; max-width: 60ch;
  border-top: 1px solid color-mix(in srgb, var(--paper) 16%, transparent);
  font-size: 16.5px; line-height: 1.62; opacity: 0.86;
}
.founder-sign {
  margin: 12px 0 0; font-family: var(--font-mono);
  font-size: 12.5px; letter-spacing: 0.04em; opacity: 0.6;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  flex-wrap: wrap; padding: 44px 0 60px; border-top: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em;
}
.footer-brand { display: flex; align-items: center; gap: 10px; }
.site-footer .fw { font-weight: 600; letter-spacing: 0.3em; }
.footer-links { display: flex; gap: 28px; opacity: 0.7; }
.footer-links a { text-decoration: none; color: var(--ink); transition: opacity 0.25s var(--ease); }
.footer-links a:hover { opacity: 1; }
.site-footer .copy { opacity: 0.5; }

/* ==========================================================================
   ЗНАК (инлайн-SVG оркестратор) — монохром, currentColor
   ========================================================================== */
.mark {
  width: 26px; height: 26px; flex: none; display: block;
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s var(--ease);
}
.mark:hover { transform: rotate(2deg); }
.mark svg { display: block; width: 100%; height: 100%; }
.mark [data-node] { transition: opacity 0.14s var(--ease); }
.site-footer .mark { width: 22px; height: 22px; }
/* Пасхалка «перегрев»: класс на <html>, дрожь знака ~1.4с */
.mark.is-overheat { animation: mark-shake 0.09s steps(2) 0s 15; }

/* honeypot: убрано из потока и от глаз/скринридеров, но остаётся ботам */
.hp {
  position: absolute !important; left: -9999px !important;
  width: 1px; height: 1px; overflow: hidden;
}

/* Transient моно-строка «перегрева» знака — фикс, без CLS */
.mark-msg {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(8px);
  max-width: min(90vw, 520px); padding: 10px 16px;
  background: var(--term-bg); color: var(--term-code);
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.4;
  border-radius: var(--radius-btn); border: 1px solid var(--line);
  box-shadow: 0 12px 30px -12px rgba(0,0,0,0.5);
  opacity: 0; pointer-events: none; z-index: 60;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
.mark-msg.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==========================================================================
   MOTION
   ========================================================================== */
@keyframes maskup { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes blink  { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
@keyframes mark-shake {
  0%   { transform: translate(0, 0) rotate(0); }
  25%  { transform: translate(0.6px, -0.4px) rotate(-1.2deg); }
  50%  { transform: translate(-0.5px, 0.5px) rotate(1deg); }
  75%  { transform: translate(0.4px, 0.3px) rotate(-0.6deg); }
  100% { transform: translate(0, 0) rotate(0); }
}

.anim-in { animation: maskup 0.7s var(--ease) both; }
.anim-in.anim-done { opacity: 1 !important; transform: none !important; }

.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ==========================================================================
   АДАПТИВ
   ========================================================================== */
@media (max-width: 860px) {
  .nav-links { display: none; }
  .cta-full { display: none; }
  .cta-short { display: inline; }

  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .hero h1 { font-size: clamp(34px, 9vw, 52px); }

  .terminal-body { font-size: 11.5px; padding: 18px; }

  .grid-2 { grid-template-columns: 1fr; }

  .approach { grid-template-columns: 1fr; }
  .approach .col,
  .approach .col:first-child,
  .approach .col:last-child { padding: 24px 0 0; margin-top: 24px; border-left: none; border-top: 1px solid var(--line); }
  .approach .col:first-child { padding-top: 0; margin-top: 0; border-top: none; }

  .steps { grid-template-columns: 1fr 1fr; }
  .step { border-left: none; border-top: 1px solid var(--line); }
  .step:nth-child(-n + 2) { border-top: none; }
  .step:nth-child(odd) { border-right: 1px solid var(--line); }

  .steps-support { grid-template-columns: 1fr; gap: 14px; }

  .proofs { grid-template-columns: 1fr; gap: 22px; }
  .cta-card { padding: 40px 26px; }
}

@media (max-width: 480px) {
  .wrap { padding: 0 20px; }
  .steps { grid-template-columns: 1fr; }
  .step { border-right: none !important; }
  .step:nth-child(-n + 2) { border-top: 1px solid var(--line); }
  .step:first-child { border-top: none; }
}

/* Уважаем настройку пользователя */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .anim-in { opacity: 1; transform: none; }
  /* Курсор терминала мигает всегда — часть фирменной сигнатуры */
  .term-line.is-caret::after { animation: blink 1s step-end infinite !important; }
}
