/* ============================================================
   Base, typography, layout primitives
   ============================================================ */

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

html {
  font-family: var(--font);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
/* Lenis owns scrolling when it is active; native smooth would fight it. */
html.lenis, html.lenis body { height: auto; }
html.lenis { scroll-behavior: auto; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }

body {
  background: var(--canvas);
  color: var(--ink);
  font-size: var(--text-body);
  line-height: var(--lh-body);
  /* clip, не hidden: hidden превращает body в скролл-контейнер и ломает
     и sticky-шапку, и программный скролл. clip обрезает без побочек. */
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--primary); color: var(--on-primary); }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -100px;
  z-index: var(--z-toast);
  padding: 12px 20px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--surface);
  font-weight: 600;
  transition: top var(--t-micro) var(--ease-out);
}
.skip-link:focus-visible { top: var(--s-4); }

/* ============================================================
   Typography
   ============================================================ */

h1, .t-display {
  font-size: var(--text-display);
  line-height: var(--lh-display);
  letter-spacing: var(--ls-display);
  font-weight: var(--fw-display);
  color: var(--ink);
  text-wrap: balance;
}

h2, .t-h2 {
  font-size: var(--text-h2);
  line-height: 1.06;
  letter-spacing: var(--ls-display);
  font-weight: var(--fw-display);
  color: var(--ink);
  text-wrap: balance;
}

h3, .t-h3 {
  font-size: var(--text-h3);
  line-height: var(--lh-h3);
  letter-spacing: var(--ls-h3);
  font-weight: var(--fw-h3);
  color: var(--ink);
  text-wrap: balance;
}

h4, .t-h4 {
  font-size: var(--text-h4);
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-weight: 600;
  color: var(--ink);
}

.t-lead {
  font-size: var(--text-lead);
  line-height: 1.55;
  color: var(--ink-muted);
  max-width: var(--measure);
  text-wrap: pretty;
}

.t-body { font-size: var(--text-body); color: var(--ink-muted); text-wrap: pretty; }
.t-sm   { font-size: var(--text-sm);   line-height: 1.5; color: var(--ink-muted); }
.t-xs   { font-size: var(--text-xs);   line-height: 1.45; color: var(--ink-muted); }

/* Одно цветное слово в заголовке. Сплошной цвет, никогда не градиент. */
.t-accent { color: var(--primary-ink); }

/* Светлый текст на тёмном читается легче — интерлиньяж чуть больше. */
.theme-inverse { line-height: 1.68; }
.theme-inverse .t-lead { line-height: 1.62; }

/* ============================================================
   Layout
   ============================================================ */

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container-narrow { max-width: calc(50rem + var(--gutter) * 2); }

.section { padding-block: var(--section-y); position: relative; }
/* Низ поджат сильнее верха: блок из четырёх коротких колонок не держит
   столько воздуха под собой, сколько над собой. */
.section-tight { padding-block: calc(var(--section-y) * 0.6) calc(var(--section-y) * 0.3); }

/* Заголовок секции. Слева по умолчанию — центр только там, где он заслужен. */
.section-head { margin-bottom: var(--header-gap); max-width: 46rem; }
.section-head > * + * { margin-top: var(--s-4); }
.section-head-center { margin-inline: auto; text-align: center; }
.section-head-center .t-lead { margin-inline: auto; }

/* Фиче-ряд: текстовая колонка не растягивается на всю половину. */
.split {
  display: grid;
  gap: clamp(var(--s-6), 5vw, var(--s-9));
  align-items: center;
}
@media (min-width: 900px) {
  .split { grid-template-columns: 7fr 5fr; }
  .split-reverse { grid-template-columns: 5fr 7fr; }
  .split-reverse > :first-child { order: 2; }
}

.stack { display: flex; flex-direction: column; gap: var(--stack-gap); }
.row   { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }

.auto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--stack-gap);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

@media (max-width: 899px) { .desktop-only { display: none !important; } }
@media (min-width: 900px) { .mobile-only  { display: none !important; } }
