/* Yttri Forge — лендинг. Тёмная «кузница»: графит, раскалённый оранжевый. */

/* Шрифты лежат на сайте (SIL OFL 1.1, fonts/OFL.txt): вариативные файлы Google Fonts,
   латиница и кириллица, у Onest ещё math для → и ≈. Основные файлы грузятся через
   preload в index.html; optional: не успел к первой отрисовке — страница остаётся
   на запасном шрифте без скачка вёрстки, а со следующего визита шрифт из кэша. */
@font-face {
  font-family: 'Unbounded';
  font-weight: 500 700;
  font-display: optional;
  src: url('fonts/unbounded-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Unbounded';
  font-weight: 500 700;
  font-display: optional;
  src: url('fonts/unbounded-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Onest';
  font-weight: 400 700;
  font-display: optional;
  src: url('fonts/onest-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Onest';
  font-weight: 400 700;
  font-display: optional;
  src: url('fonts/onest-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Onest';
  font-weight: 400 700;
  font-display: optional;
  src: url('fonts/onest-math.woff2') format('woff2');
  unicode-range: U+0302-0303, U+0305, U+0307-0308, U+0310, U+0312, U+0315, U+031A, U+0326-0327, U+032C, U+032F-0330, U+0332-0333, U+0338, U+033A, U+0346, U+034D, U+0391-03A1, U+03A3-03A9, U+03B1-03C9, U+03D1, U+03D5-03D6, U+03F0-03F1, U+03F4-03F5, U+2016-2017, U+2034-2038, U+203C, U+2040, U+2043, U+2047, U+2050, U+2057, U+205F, U+2070-2071, U+2074-208E, U+2090-209C, U+20D0-20DC, U+20E1, U+20E5-20EF, U+2100-2112, U+2114-2115, U+2117-2121, U+2123-214F, U+2190, U+2192, U+2194-21AE, U+21B0-21E5, U+21F1-21F2, U+21F4-2211, U+2213-2214, U+2216-22FF, U+2308-230B, U+2310, U+2319, U+231C-2321, U+2336-237A, U+237C, U+2395, U+239B-23B7, U+23D0, U+23DC-23E1, U+2474-2475, U+25AF, U+25B3, U+25B7, U+25BD, U+25C1, U+25CA, U+25CC, U+25FB, U+266D-266F, U+27C0-27FF, U+2900-2AFF, U+2B0E-2B11, U+2B30-2B4C, U+2BFE, U+3030, U+FF5B, U+FF5D, U+1D400-1D7FF, U+1EE00-1EEFF;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-weight: 400 700;
  font-display: optional;
  src: url('fonts/jetbrains-mono-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-weight: 400 700;
  font-display: optional;
  src: url('fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;

  --bg: #121110;
  --bg-2: #161513;
  --bg-3: #0f0e0d;
  --panel: #1a1917;
  --code: #0d0c0b;
  --tint: #1f1712;

  --line: #2a2825;
  --line-2: #26231f;
  --line-3: #242220;
  --line-4: #2e2b27;
  --line-5: #34312d;
  --line-strong: #3a3733;
  --grid: #292724;
  --axis: #3d3a35;

  --text: #f3efe7;
  --text-2: #b8b1a6;
  --text-3: #8c867c;
  --text-soft: #cfc8bd;
  --text-code: #e9e3d9;

  --accent: #ec5d1f;
  --accent-hover: #f3743d;
  --accent-text: #f5874f;
  --accent-soft: #f7a77e;
  --accent-deep: #3a1d0f;
  --accent-pale: #ffb48f;
  --accent-line: #4a3426;
  --steel: #4470ad;

  --display: 'Unbounded', 'Arial Black', Verdana, sans-serif;
  --body: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;

  --pad: 48px;
  --section-y: 112px;
}

/* ── База ─────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, figure, dl, dd, ol, ul, pre { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent-text); }
a:hover { color: #ffae84; }
button { font: inherit; color: inherit; }
code, pre { font-family: var(--mono); }
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 10;
  padding: 10px 16px; border-radius: 8px;
  background: var(--accent); color: var(--bg); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; color: var(--bg); }

.wrap { max-width: 1296px; margin: 0 auto; padding: 0 var(--pad); }
.icon { width: 16px; height: 16px; flex-shrink: 0; }
.icon--sm { width: 14px; height: 14px; }

/* ── Типографика секций ───────────────────────────────── */

.section { border-bottom: 1px solid var(--line-2); }
.section-inner {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  display: flex; flex-direction: column; gap: 48px;
}
.section-head { display: flex; flex-direction: column; gap: 20px; max-width: 880px; }
.eyebrow {
  display: flex; align-items: center; gap: 10px;
  font: 500 13px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent-text);
}
.eyebrow::before { content: ""; width: 8px; height: 8px; background: var(--accent); flex-shrink: 0; }
.h2 {
  font: 600 40px/1.14 var(--display); letter-spacing: -0.015em;
  color: var(--text); text-wrap: balance;
}
.lead { font-size: 19px; line-height: 1.6; color: var(--text-2); text-wrap: pretty; }
.h3-display { font: 600 22px/1.3 var(--display); color: var(--text); }
.note { font-size: 14px; line-height: 1.6; color: var(--text-3); }

/* ── Кнопки ───────────────────────────────────────────── */

.btn, .btn-ghost, .btn-dark, .btn-outline-dark {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; white-space: nowrap;
}
.btn {
  height: 44px; padding: 0 20px; border-radius: 8px;
  background: var(--accent); color: var(--bg); font-size: 15px; font-weight: 600;
}
.btn:hover { background: var(--accent-hover); color: var(--bg); }
.btn-ghost {
  gap: 8px; height: 44px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 8px;
  color: var(--text); font-size: 15px; font-weight: 500;
}
.btn-ghost:hover { border-color: #6a645c; color: #fff; }
.btn--lg { height: 52px; padding: 0 24px; border-radius: 10px; font-size: 16px; }
.btn-ghost.btn--lg { padding: 0 22px; }
.btn-dark {
  height: 56px; padding: 0 26px; border-radius: 10px;
  background: var(--bg); color: var(--text); font-size: 16px; font-weight: 600;
}
.btn-dark:hover { background: #2b2723; color: var(--text); }
.btn-outline-dark {
  gap: 8px; height: 56px; padding: 0 24px; border: 1.5px solid var(--bg); border-radius: 10px;
  color: var(--bg); font-size: 16px; font-weight: 600;
}
.btn-outline-dark:hover { background: rgba(18, 17, 16, 0.1); color: var(--bg); }

/* ── Шапка ────────────────────────────────────────────── */

.site-header { border-bottom: 1px solid var(--line-2); background: var(--bg); }
.header-row { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 32px; }
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.brand-name { font: 600 15px/1 var(--display); letter-spacing: 0.06em; white-space: nowrap; }
.nav { display: flex; align-items: center; gap: 32px; font-size: 15px; font-weight: 500; }
.nav a { color: var(--text-2); text-decoration: none; }
.nav a:hover { color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.burger {
  display: none; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--line-strong); border-radius: 8px; background: transparent; cursor: pointer;
}
.burger:hover { border-color: #6a645c; }
.burger .i-close, .burger[aria-expanded="true"] .i-open { display: none; }
.burger[aria-expanded="true"] .i-close { display: block; }
.mobile-nav { border-top: 1px solid var(--line-2); background: var(--bg); }
.mobile-nav .wrap { display: flex; flex-direction: column; padding-top: 4px; padding-bottom: 24px; }
.mobile-nav a:not(.btn) {
  display: flex; align-items: center; min-height: 52px; border-bottom: 1px solid var(--line-2);
  color: var(--text); text-decoration: none; font-size: 17px; font-weight: 500;
}
.mobile-nav a:not(.btn):hover { color: #fff; }
.mobile-nav .btn { margin-top: 20px; justify-content: center; height: 52px; border-radius: 10px; font-size: 16px; }

/* ── Первый экран ─────────────────────────────────────── */

.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line-2); }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(#1d1b18 1px, transparent 1px), linear-gradient(90deg, #1d1b18 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 80% 75% at 25% 0%, #000 35%, transparent 80%);
  mask-image: radial-gradient(ellipse 80% 75% at 25% 0%, #000 35%, transparent 80%);
}
.hero::after {
  content: ""; position: absolute; top: -300px; right: -180px; width: 780px; height: 780px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(236, 93, 31, 0.15), rgba(236, 93, 31, 0));
}
.hero-inner { position: relative; z-index: 1; padding-top: 104px; padding-bottom: 112px; display: flex; flex-direction: column; gap: 56px; }
.hero-head { display: flex; flex-direction: column; gap: 28px; }
.hero-title { font: 700 72px/1.05 var(--display); letter-spacing: -0.025em; color: var(--text); }
.hl { color: var(--accent); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 64px; align-items: start; }
.hero-copy { display: flex; flex-direction: column; gap: 32px; padding-top: 6px; }
.hero-lede { font-size: 20px; line-height: 1.6; color: var(--text-soft); text-wrap: pretty; }
.kbd {
  font-size: 0.88em; padding: 2px 7px; border-radius: 6px;
  background: #1f1d1a; border: 1px solid var(--line-4); color: var(--text);
}
.hero-ctas { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px;
  border: 1px solid var(--line-4); border-radius: 999px; background: var(--bg-2);
  font-size: 14px; color: var(--text-2); white-space: nowrap;
}
.stats-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.stat { background: var(--panel); padding: 28px 28px 30px; display: flex; flex-direction: column; gap: 14px; }
.stat::before { content: ""; width: 28px; height: 3px; border-radius: 2px; background: var(--accent); }
.stat-num { font-size: 56px; font-weight: 600; line-height: 1; letter-spacing: -0.03em; color: var(--text); white-space: nowrap; }
.stat-cap { font-size: 15px; line-height: 1.5; color: var(--text-2); }
.stats-foot { padding: 16px 28px; border-top: 1px solid var(--line); font: 12.5px/1.5 var(--mono); color: var(--text-3); }

/* ── Замеры: переключатели ────────────────────────────── */

#bench .section-inner { gap: 40px; }
.bench-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.seg button {
  display: flex; align-items: center; min-height: 52px; padding: 0 20px;
  border: 0; border-radius: 8px; background: transparent; cursor: pointer;
  color: var(--text-2); font-size: 14px; font-weight: 600;
}
.seg button[aria-pressed="false"]:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.seg--bench button { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding: 6px 16px; text-align: left; }
.seg-label { font-size: 14px; line-height: 1.3; font-weight: 600; white-space: nowrap; }
.seg-sub { font: 12px/1.3 var(--mono); color: var(--text-3); white-space: nowrap; }
.seg button[aria-pressed="true"] .seg-sub { color: #5b554d; }
.seg--os { align-self: flex-start; }
.seg--os button { min-height: 44px; padding: 0 22px; font-size: 15px; }

/* ── Замеры: карточки графиков ────────────────────────── */

.panel { display: flex; flex-direction: column; gap: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.fig {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px; display: flex; flex-direction: column; gap: 24px; min-width: 0;
}
.fig--tight { gap: 20px; }
.fig-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.fig-head > div { display: flex; flex-direction: column; gap: 4px; }
.fig-title { font-size: 19px; line-height: 1.3; font-weight: 600; color: var(--text); }
.fig-sub { font-size: 14px; line-height: 1.5; color: var(--text-3); }
.fig-note { font-size: 14px; line-height: 1.6; color: var(--text-3); }
.legend { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; font-size: 13px; line-height: 1.3; color: var(--text-2); }
.legend li { display: flex; align-items: center; gap: 8px; }
.sw { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.sw--ours { background: var(--accent); }
.sw--theirs { background: var(--steel); }
.sw--gain { background: var(--accent-soft); }
.sw--dot { border-radius: 50%; }

/* Ось и подписи делений: позиция в --x */
.axis { position: relative; height: 28px; }
.axis span {
  position: absolute; top: 9px; left: var(--x); transform: translateX(-50%);
  font: 12px/1 var(--mono); color: var(--text-3); white-space: nowrap;
}
.axis .t0 { transform: none; }
.axis .t1 { transform: translateX(-100%); }

/* Горизонтальные столбцы: ширина в --w, сетка в --x */
.hbars { position: relative; --lab: 56px; --dlt: 64px; }
.hbars-grid { position: absolute; top: 0; bottom: 28px; left: var(--lab); right: var(--dlt); }
.hbars-grid i { position: absolute; top: 0; bottom: 0; left: var(--x, 0); width: 1px; background: var(--grid); }
.hbars-grid i.base { background: var(--axis); }
.hbars-rows { position: relative; display: flex; flex-direction: column; }
.hbars-row { display: flex; align-items: center; min-height: 62px; }
.hbars-label { width: var(--lab); flex-shrink: 0; font: 500 13px var(--mono); color: var(--text-2); }
.hbars-track { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hbars-delta { width: var(--dlt); flex-shrink: 0; text-align: right; font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; }
.hbars .axis { margin: 0 var(--dlt) 0 var(--lab); }
.hbar { display: flex; align-items: center; }
.bar { display: block; width: var(--w); height: 18px; flex-shrink: 0; border-radius: 0 4px 4px 0; }
.bar--sm { height: 16px; }
.bar--ours { background: var(--accent); }
.bar--theirs { background: var(--steel); }
.bar--seg { border-radius: 0; }
.bar--gain { background: var(--accent-soft); margin-left: 2px; }
.bar-val { margin-left: 8px; font: 13px/1 var(--mono); color: var(--text); white-space: nowrap; }
.bar-val--muted { color: var(--text-2); }

/* Задержка и память */
.low { display: flex; flex-direction: column; }
.low-row {
  display: grid; grid-template-columns: 168px minmax(0, 1fr) 80px; align-items: center; gap: 16px;
  padding: 18px 0; border-top: 1px solid var(--line);
}
.low-t { display: flex; flex-direction: column; gap: 2px; }
.low-title { font-size: 15px; line-height: 1.35; font-weight: 600; color: var(--text); }
.low-sub { font-size: 12.5px; line-height: 1.4; color: var(--text-3); }
.low-bars { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.low-delta { text-align: right; font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; }

/* Четыре клиента: высота столбца в --h */
.batch { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.batch-cell { border: 1px solid var(--line); border-radius: 12px; padding: 16px 16px 12px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.batch-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.batch-name { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; }
.batch-wall { font: 12px var(--mono); color: var(--text-2); white-space: nowrap; }
.batch-plot { height: 104px; display: flex; align-items: flex-end; gap: 8px; padding: 0 8px; border-bottom: 1px solid var(--axis); }
.batch-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.batch-val { font: 11.5px/1 var(--mono); color: var(--text-code); }
.batch-val--muted { color: var(--text-2); }
.batch-bar { display: block; width: 22px; height: var(--h); border-radius: 4px 4px 0 0; }
.batch-bar--ours { background: var(--accent); }
.batch-bar--theirs { background: var(--steel); }
.batch-labels { display: flex; gap: 8px; padding: 0 8px; font: 11px/1 var(--mono); color: var(--text-3); }
.batch-labels span { flex: 1; text-align: center; }

/* Точечный график пар: позиция в --x, длина связки в --w */
.dots { position: relative; --lab: 76px; }
.dots-grid { position: absolute; top: 0; bottom: 28px; left: var(--lab); right: 12px; }
.dots-grid i { position: absolute; top: 0; bottom: 0; left: var(--x); width: 1px; background: var(--grid); }
.dots-rows { position: relative; display: flex; flex-direction: column; }
.dots-row { display: flex; align-items: center; height: 38px; }
.dots-row--avg { height: 44px; border-top: 1px solid var(--line); }
.dots-label { width: var(--lab); flex-shrink: 0; font: 12px var(--mono); color: var(--text-3); }
.dots-row--avg .dots-label { font-weight: 700; color: var(--text); }
.dots-track { position: relative; flex-grow: 1; height: 100%; margin-right: 12px; }
.dot-link { position: absolute; top: 50%; left: var(--x); width: var(--w); height: 2px; margin-top: -1px; background: #4a4640; }
.dots-row--avg .dot-link { background: #6a645c; }
.dot { position: absolute; top: 50%; left: var(--x); width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; box-shadow: 0 0 0 2px var(--panel); }
.dots-row--avg .dot { width: 14px; height: 14px; margin: -7px 0 0 -7px; }
.dot--ours { background: var(--accent); }
.dot--theirs { background: var(--steel); }
.dots .axis { margin: 0 12px 0 var(--lab); }

/* Окно 128K: четыре показателя */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.card-head { padding: 28px 28px 0; display: flex; flex-direction: column; gap: 4px; }
.kpis {
  margin-top: 24px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px;
  background: var(--line); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.kpi { background: var(--panel); padding: 24px 28px; display: flex; flex-direction: column; gap: 10px; }
.kpi-num { font-size: 40px; font-weight: 600; line-height: 1; letter-spacing: -0.02em; color: var(--text); white-space: nowrap; }
.kpi-cap { font-size: 14px; line-height: 1.5; color: var(--text-2); }
.card-foot { padding: 18px 28px 22px; font-size: 14px; line-height: 1.6; color: var(--text-3); }

/* Таблицы сверки */
.table-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table caption {
  caption-side: top; text-align: left; padding: 24px 28px 16px;
  font-size: 19px; line-height: 1.3; font-weight: 600; color: var(--text);
}
.data-table thead th {
  padding: 12px 28px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  text-align: right; white-space: nowrap;
  font: 500 12px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3);
}
.data-table thead th:first-child { text-align: left; }
.data-table tbody th {
  padding: 12px 28px; border-bottom: 1px solid var(--line-3);
  text-align: left; font-size: 15px; font-weight: 500; color: var(--text-code);
}
.data-table td {
  padding: 12px 28px; border-bottom: 1px solid var(--line-3);
  text-align: right; white-space: nowrap;
  font: 14px var(--mono); font-variant-numeric: tabular-nums; color: var(--text-2);
}
.data-table td:nth-of-type(2) { color: var(--text); font-weight: 700; }
.data-table td:nth-of-type(3) { color: var(--accent-text); font-weight: 600; }
.data-table td.is-worse { color: var(--text-2); }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.table-foot { padding: 18px 28px 22px; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.6; color: var(--text-3); }

/* Как мы меряем */
.method { display: flex; flex-direction: column; gap: 20px; }
.method-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
}
.method-cell { background: var(--bg-2); padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.method-cell h4 { font-size: 16px; line-height: 1.35; font-weight: 600; color: var(--text); }
.method-cell p { font-size: 14.5px; line-height: 1.6; color: var(--text-2); }
.repro { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--text-3); }
.repro code {
  font-size: 13px; line-height: 1.4; color: var(--text);
  background: var(--code); border: 1px solid var(--line); border-radius: 8px; padding: 9px 14px;
}

/* ── Почему быстрее ───────────────────────────────────── */

.why { display: flex; flex-direction: column; gap: 20px; }
.why-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.why-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 24px; display: flex; flex-direction: column; gap: 14px; min-width: 0;
}
.why-num { font: 500 12px var(--mono); letter-spacing: 0.06em; color: var(--text-3); }
.why-card h3 { font-size: 18px; line-height: 1.3; font-weight: 600; color: var(--text); }
.why-text { font-size: 15px; line-height: 1.55; color: var(--text-2); flex-grow: 1; }
.why-metric { padding-top: 14px; border-top: 1px solid var(--line); font: 13px/1.4 var(--mono); color: var(--accent-text); }

/* ── Почему Rust ──────────────────────────────────────── */

#rust .section-inner { gap: 64px; }
.rust-grid, .api-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 64px; align-items: start; }
.rust-copy { display: flex; flex-direction: column; gap: 40px; }
.points { display: flex; flex-direction: column; gap: 24px; }
.point { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 16px; }
.point-icon {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line-5); background: var(--panel);
  display: flex; align-items: center; justify-content: center; color: var(--accent-text);
}
.point-icon svg { width: 20px; height: 20px; }
.point h3 { padding-top: 2px; font-size: 17px; line-height: 1.4; font-weight: 600; color: var(--text); }
.point p { margin-top: 4px; font-size: 15px; line-height: 1.6; color: var(--text-2); }

.arch { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; }
.arch-label { margin-bottom: 12px; font: 500 12px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.chips--sm li { height: 30px; font-size: 13px; color: var(--text-soft); background: transparent; border-color: var(--line-5); }
.arch-conn { position: relative; display: flex; align-items: center; height: 52px; padding-left: 40px; font: 12px var(--mono); color: var(--text-3); }
.arch-conn::before { content: ""; position: absolute; left: 24px; top: 0; bottom: 0; width: 2px; background: var(--line-strong); }
.arch-box { border: 1px solid var(--line-strong); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.arch-box--main { border-color: var(--accent); background: var(--tint); }
.arch-box-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; column-gap: 12px; row-gap: 4px; }
.arch-name { font: 600 17px var(--display); color: var(--text); white-space: nowrap; }
.arch-tag { font: 12px var(--mono); color: var(--accent-text); }
.arch-tag--muted { color: var(--text-3); }
.arch-note { font-size: 14px; line-height: 1.5; color: var(--text-2); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills li {
  display: inline-flex; align-items: center; height: 28px; padding: 0 10px;
  border: 1px solid var(--line-5); border-radius: 6px; font-size: 13px; color: var(--text-soft); white-space: nowrap;
}
.pills--code li { border-color: var(--accent-line); font: 12.5px var(--mono); color: var(--text); }
.hw-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hw-grid li { border: 1px solid var(--line-4); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; background: var(--bg-2); }
.hw-grid b { font-size: 14px; font-weight: 600; color: var(--text); }
.hw-grid span { font-size: 13px; line-height: 1.4; color: var(--text-3); }

.api-grid { padding-top: 64px; border-top: 1px solid var(--line-2); }
.api-copy { display: flex; flex-direction: column; gap: 20px; }
.h3-api { font: 600 26px/1.25 var(--display); color: var(--text); }
.api-copy > p { font-size: 16px; line-height: 1.6; color: var(--text-2); }
.endpoints li { display: flex; flex-direction: column; gap: 4px; padding: 16px 0; border-top: 1px solid var(--line); }
.endpoints li:last-child { border-bottom: 1px solid var(--line); }
.ep-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; column-gap: 12px; row-gap: 2px; }
.ep-head code { font-size: 14px; color: var(--text); white-space: nowrap; }
.ep-head span { font-size: 13px; color: var(--text-3); white-space: nowrap; }
.endpoints p { font-size: 14px; line-height: 1.5; color: var(--text-2); }
.api-code { display: flex; flex-direction: column; gap: 12px; }
.code-label { font: 500 12px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }

/* Блоки кода: переносятся на узких экранах */
.code {
  background: var(--code); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px;
  font: 13px/1.7 var(--mono); color: var(--text-code);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.code--lg { border-radius: 12px; padding: 20px 22px; font-size: 13.5px; line-height: 1.75; }
.code--sm { padding: 14px 16px; font-size: 12.5px; }
.code .c { color: var(--text-3); }

/* ── Модели ───────────────────────────────────────────── */

.models-table { width: 100%; border-collapse: collapse; }
.models-table thead th {
  padding: 14px 24px; border-bottom: 1px solid var(--line); text-align: left;
  font: 500 12px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3);
}
.models-table thead th:nth-child(1) { width: 21%; }
.models-table thead th:nth-child(2) { width: 16%; }
.models-table thead th:nth-child(3) { width: 22%; }
.models-table thead th:nth-child(4) { width: 16%; }
.models-table tbody th, .models-table td {
  padding: 20px 24px; border-bottom: 1px solid var(--line-3);
  vertical-align: top; text-align: left; font-size: 14.5px; font-weight: 400; line-height: 1.5; color: var(--text-2);
}
.models-table tbody tr:last-child > * { border-bottom: 0; }
.model { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.model-name { font-size: 16px; line-height: 1.35; font-weight: 600; color: var(--text); }
.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px;
  background: var(--accent-deep); font: 11.5px var(--mono); color: var(--accent-pale); white-space: nowrap;
}
.quants { display: flex; flex-wrap: wrap; gap: 6px; }
.quants span {
  display: inline-flex; align-items: center; height: 24px; padding: 0 8px;
  border: 1px solid var(--line-5); border-radius: 6px; font: 12.5px var(--mono); color: var(--text-code); white-space: nowrap;
}

/* ── Установка ────────────────────────────────────────── */

.install-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 48px; align-items: start; }
.install-main { display: flex; flex-direction: column; gap: 32px; min-width: 0; }
.steps { display: flex; flex-direction: column; gap: 32px; counter-reset: step; }
.step { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 16px; counter-increment: step; }
.step::before {
  content: counter(step); width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line-strong);
  display: flex; align-items: center; justify-content: center; font: 700 14px var(--mono); color: var(--accent-text);
}
.step-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.step-body h3 { padding-top: 7px; font-size: 18px; line-height: 1.4; font-weight: 600; color: var(--text); }
.step-body > p { font-size: 15px; line-height: 1.6; color: var(--text-2); }
.callout {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px;
  border: 1px solid var(--accent-line); border-radius: 10px; background: var(--tint);
}
.callout svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; color: var(--accent-text); }
.callout p { font-size: 14px; line-height: 1.6; color: var(--text-soft); }

.install-aside { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.aside-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.aside-card h3 { font-size: 17px; line-height: 1.4; font-weight: 600; color: var(--text); }
.req { display: grid; grid-template-columns: 72px minmax(0, 1fr); }
.req dt, .req dd { padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.5; }
.req dt { color: var(--text-3); }
.req dd { color: var(--text-code); }
.terminal { background: var(--code); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.terminal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; border-bottom: 1px solid var(--line); font: 12px var(--mono); color: var(--text-3);
}
.terminal-head b { display: flex; align-items: center; gap: 6px; font-weight: 400; color: var(--text-2); }
.terminal-head b::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.terminal pre { padding: 16px 18px; font: 12px/1.75 var(--mono); color: var(--text-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.terminal .c { color: var(--text-3); }
.terminal .ok { color: var(--accent-text); }

/* ── Призыв и подвал ──────────────────────────────────── */

.cta { background: var(--accent); color: var(--bg); }
.cta-grid { padding-top: 96px; padding-bottom: 96px; display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 48px; align-items: end; }
.cta-copy { display: flex; flex-direction: column; gap: 20px; }
.cta h2 { font: 700 48px/1.08 var(--display); letter-spacing: -0.02em; color: var(--bg); text-wrap: balance; }
.cta p { font-size: 19px; line-height: 1.6; color: var(--bg); text-wrap: pretty; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }

.site-footer { background: var(--bg-3); }
.footer-grid {
  padding-top: 56px; padding-bottom: 64px;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 4fr) minmax(0, 3fr); gap: 48px; align-items: start;
}
.footer-brand { display: flex; flex-direction: column; gap: 16px; }
.footer-brand p { max-width: 380px; font-size: 14px; line-height: 1.6; color: var(--text-3); }
.footer-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.footer-nav div { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.footer-nav a { text-decoration: none; }
.footer-h { font: 12px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.footer-meta { font-size: 13px; line-height: 1.6; color: var(--text-3); }

/* Поддержать проект: адрес выделяется целиком одним кликом, кнопка копирует */
.footer-donate { padding-top: 56px; }
.footer-donate + .footer-grid { padding-top: 40px; }
.donate {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 32px; align-items: center;
  padding: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
}
.donate-title { font: 600 22px/1.3 var(--display); color: var(--text); }
.donate-text { margin-top: 8px; font-size: 15px; line-height: 1.6; color: var(--text-2); }
.donate-pay { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.donate-label { font: 500 12px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.donate-addr {
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px;
  background: var(--code); border: 1px solid var(--line); border-radius: 10px;
}
.donate-addr code { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.5; color: var(--text); overflow-wrap: anywhere; user-select: all; }
.donate-btn {
  flex-shrink: 0; height: 44px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: transparent; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text);
}
.donate-btn:hover { border-color: #6a645c; }
.donate-warn { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.5; color: var(--text-soft); }
.donate-warn svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: var(--accent-text); }

/* ── Адаптив ──────────────────────────────────────────── */

@media (min-width: 1181px) {
  .mobile-nav { display: none !important; }
}

@media (max-width: 1180px) {
  .nav, .header-actions .btn-ghost { display: none; }
  .burger { display: inline-flex; }
  .low-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 10px; }
  .low-t { grid-column: 1 / -1; }
}

@media (max-width: 1100px) {
  :root { --pad: 40px; --section-y: 96px; }
  .hero-inner { padding-top: 88px; padding-bottom: 96px; }
  .hero-title { font-size: 60px; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .why-grid, .batch, .kpis, .method-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rust-grid, .api-grid, .install-grid { grid-template-columns: minmax(0, 1fr); gap: 48px; }
  .cta-grid { padding-top: 80px; padding-bottom: 80px; }
  .footer-grid { padding-top: 48px; padding-bottom: 56px; }
}

@media (max-width: 820px) {
  :root { --pad: 32px; --section-y: 80px; }
  .hero-inner { padding-top: 72px; padding-bottom: 80px; }
  .hero-title { font-size: 48px; }
  .h2 { font-size: 32px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .cta-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; padding-top: 72px; padding-bottom: 72px; }
  .cta-actions { justify-content: flex-start; }
  .cta h2 { font-size: 38px; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .donate { grid-template-columns: minmax(0, 1fr); gap: 20px; }

  /* Таблица моделей превращается в карточки */
  .models-table thead { display: none; }
  .models-table, .models-table tbody { display: block; }
  .models-table tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px;
    padding: 20px 24px; border-bottom: 1px solid var(--line-3);
  }
  .models-table tr:last-child { border-bottom: 0; }
  .models-table tbody th, .models-table td { padding: 0; border: 0; }
  .models-table tbody th { grid-column: 1 / -1; }
  .models-table td::before {
    content: attr(data-label); display: block; margin-bottom: 4px;
    font: 11px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3);
  }
}

@media (max-width: 560px) {
  :root { --pad: 20px; --section-y: 64px; }
  .header-row { height: 64px; }
  .header-actions .btn { display: none; }
  .hero-inner { padding-top: 48px; padding-bottom: 64px; gap: 40px; }
  .hero-title { font-size: 34px; line-height: 1.1; }
  .hero-lede { font-size: 17px; }
  .hero-ctas a, .cta-actions a { flex: 1 1 auto; justify-content: center; }
  .stat { padding: 20px 18px 22px; }
  .stat-num { font-size: 32px; }
  .stat-cap { font-size: 13.5px; }
  .stats-foot { padding: 14px 18px; }
  .h2 { font-size: 26px; }
  .lead { font-size: 16.5px; }

  .seg--bench { display: flex; width: 100%; }
  .seg--bench button { flex: 1 1 0; min-width: 0; }
  .seg--bench .seg-label, .seg--bench .seg-sub { white-space: normal; }
  .fig { padding: 20px; }
  .fig-head { flex-direction: column; gap: 12px; }
  .legend { flex-direction: row; flex-wrap: wrap; column-gap: 16px; }
  .hbars { --lab: 44px; --dlt: 52px; }
  .hbars-delta { font-size: 14px; }
  .batch-cell { padding: 12px 10px 10px; }
  .batch-head { flex-direction: column; align-items: flex-start; gap: 2px; }
  .batch-plot, .batch-labels { padding: 0 2px; gap: 4px; }
  .batch-bar { width: 14px; }
  .batch-val { font-size: 10.5px; }
  .dots { --lab: 56px; }
  .card-head { padding: 20px 20px 0; }
  .card-foot, .table-foot { padding: 16px 20px 18px; }
  .kpi { padding: 18px 16px; }
  .kpi-num { font-size: 28px; }
  .why-grid, .method-grid, .hw-grid { grid-template-columns: minmax(0, 1fr); }
  .arch { padding: 20px; }

  /* Таблицы сверки превращаются в карточки «llama.cpp / yforge / Разница» */
  .data-table thead { display: none; }
  .data-table, .data-table tbody { display: block; }
  .data-table caption { display: block; padding: 20px 20px 12px; font-size: 17px; }
  .data-table tr {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 10px;
    padding: 14px 20px; border-bottom: 1px solid var(--line-3);
  }
  .data-table tbody tr:last-child { border-bottom: 0; }
  .data-table tbody th { grid-column: 1 / -1; padding: 0 0 4px; border: 0; font-size: 14.5px; }
  .data-table td { padding: 0; border: 0; text-align: left; font-size: 13px; white-space: normal; }
  .data-table td::before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    font: 500 11px var(--body); color: var(--text-3);
  }
  .models-table tr { padding: 18px 20px; }

  .step { grid-template-columns: 32px minmax(0, 1fr); gap: 12px; }
  .step::before { width: 32px; height: 32px; font-size: 13px; }
  .step-body h3 { padding-top: 3px; font-size: 17px; }
  .code { padding: 12px 14px; font-size: 12px; }
  .cta-grid { padding-top: 56px; padding-bottom: 56px; }
  .cta h2 { font-size: 28px; }
  .footer-grid { padding-top: 40px; padding-bottom: 48px; }
  .footer-donate { padding-top: 40px; }
  .footer-donate + .footer-grid { padding-top: 32px; }
  .donate { padding: 20px; }
  .donate-addr { flex-direction: column; align-items: stretch; padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
