/* ============================ База ============================ */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--c-black);
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-text);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.5;
  color: var(--fg);
  background: var(--c-black);          /* под «шторкой» main — чёрный подвал */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img, svg, video, canvas { display: block; max-width: 100%; }
img, video { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p, ul, ol, figure, blockquote, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
::selection { background: var(--c-lime); color: var(--c-black); }

/* main — «шторка» над фиксированным подвалом */
.main {
  position: relative;
  z-index: 1;
  background: var(--bg);
  color: var(--fg);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  overflow: clip;              /* clip, а не hidden: не ломает position: sticky */
}

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

.section {
  position: relative;
  padding-block: var(--section-y);
}

/* 12 колонок */
.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--col-gap);
}

/* ------------------------- Типографика ------------------------- */
.h1, .h2, .h3, .display {
  font-family: var(--font-display);
  font-weight: 800;
  font-variation-settings: normal;
}
.h2 {
  font-size: var(--fs-h2);
  line-height: var(--lh-h2);
  letter-spacing: var(--tr-h2);
  font-weight: 750;
  text-wrap: balance;
}
.h3 {
  font-family: var(--font-text);
  font-size: var(--fs-h3);
  line-height: var(--lh-h3);
  letter-spacing: -0.015em;
  font-weight: 600;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .9em;
  font-family: var(--font-text);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: var(--tr-eyebrow);
  text-transform: uppercase;
  line-height: 1.2;
}
.eyebrow::before {                  /* капля бренда перед надзаголовком */
  content: "";
  flex: none;
  width: .72em;
  height: .72em;
  border-radius: 50% 50% 50% 12%;
  background: var(--grad-brand);
  transform: rotate(-45deg);
}
.lead {
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--muted);
  max-width: 34em;
}
.small { font-size: var(--fs-small); line-height: 1.45; }

/* SplitText: строки выезжают из-под маски */
.split-line { padding-bottom: .06em; margin-bottom: -.06em; }

/* ------------------------- Утилиты ------------------------- */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.nowrap { white-space: nowrap; }

/* Фокус с клавиатуры: тёмная обводка + градиентное «гало» (градиент бренда светлый — одного его мало для контраста) */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgb(166 255 150 / .75), 0 0 0 9px rgb(112 230 191 / .6);
  border-radius: 6px;
}

/* Плёночное зерно поверх всего сайта */
.grain {
  position: fixed;
  inset: -50%;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: .045;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1.6 -.3'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-3%, 2%); }
  40%  { transform: translate(2%, -3%); }
  60%  { transform: translate(-2%, -1%); }
  80%  { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

/* Кастомный скроллбар — тонкий */
@supports (scrollbar-color: auto) {
  html { scrollbar-color: #555 #0A0A0A; scrollbar-width: thin; }
}

/* Пока шрифты/скрипты не готовы — не показываем элементы, которые будут анимироваться */
.js [data-reveal], .js [data-split] { visibility: hidden; }
.js .is-ready [data-reveal], .js .is-ready [data-split], .no-motion [data-reveal], .no-motion [data-split] { visibility: visible; }

@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  *, *::before, *::after { scroll-behavior: auto !important; }
}

/* Заголовки не растягивают свою колонку по ширине длинного слова (подгонку делает utils.fitHeadings) */
.h2, .sec-head__main { min-width: 0; }
