/* ===========================================================================
   Сетка, ритм, шапка, подвал
   =========================================================================== */

.wrap {
  width: 100%;
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--pad);
  min-width: 0;
}
/* Элементы сетки по умолчанию не сжимаются меньше содержимого. Без этого
   одна широкая таблица растягивает всю колонку и уводит страницу вбок. */
.cols > * { min-width: 0; }
.wrap--narrow { max-width: var(--page-narrow); }

/* Ритм неравномерный: между разделами больше, внутри раздела меньше.
   Одинаковый отступ у девяти секций подряд — метроном; поэтому паузу
   задаёт не сама секция, а её соседство. */
.section        { padding-block: var(--gap-wide); }
.section--tight { padding-block: var(--gap-tight); }
.section--flush { padding-block: 0; }
.section--band  { background: var(--bg-2); padding-block: calc(var(--gap-wide) * 1.22) var(--gap-wide); }
.section--dark  { padding-block: calc(var(--gap-wide) * 1.12); }

/* Две секции на одном фоне подряд — это один раздел, пауза между ними короче.
   Величина паузы зависит от того, что было до неё: смена фона уже работает
   разделителем, поэтому после полосы и после тёмного блока воздуха нужно меньше.

   Все правила соседства ниже намеренно одной специфичности (0,2,0): условия
   спрятаны в :where(), который ничего не добавляет, поэтому спор решает
   порядок, а не количество :not(). До 09.09.2026 первое правило несло три
   :not() и весило 0,5,0 — оно перебивало все остальные, и каждая секция после
   секции получала один и тот же отступ. Ровно тот метроном, против которого
   этот блок и написан; браузерный аудит ловил его как metronome. */
.section + .section:where(:not(.section--band, .section--dark, .section--flush)) {
  padding-top: calc(var(--gap-wide) * 0.68);
}
.section--band + .section:where(:not(.section--band, .section--dark, .section--flush)) {
  padding-top: calc(var(--gap-wide) * 0.86);
}
.section--dark + .section:where(:not(.section--band, .section--dark, .section--flush)) {
  padding-top: calc(var(--gap-wide) * 0.94);
}
/* После полосы во всю ширину воздух сверху не нужен: картинка уже отделила. */
.section--flush + .section:where(:not(.section--band, .section--dark)),
.strip + .section:where(:not(.section--band, .section--dark)) {
  padding-top: calc(var(--gap-wide) * 0.78);
}
/* Тесная секция — продолжение предыдущей мысли, а не новый раздел. */
.section + .section--tight:where(:not(.section--band, .section--dark)) {
  padding-top: calc(var(--gap-tight) * 0.9);
}
.section--tight + .section--tight { padding-top: calc(var(--gap-tight) * 0.7); }
.pagehead + .section--tight { padding-top: calc(var(--gap-tight) * 0.7); }
.pagehead + .section--flush + .section { padding-top: calc(var(--gap-wide) * 0.62); }
/* Тёмная шапка страницы уже отделила себя сменой фона — воздуха после неё
   нужно столько же, сколько после тёмной секции, а не полный интервал. */
.pagehead--media + .section:where(:not(.section--band, .section--dark, .section--flush)) {
  padding-top: calc(var(--gap-wide) * 0.9);
}
.pagehead--media + .toc + .section:where(:not(.section--band, .section--dark, .section--flush)) {
  padding-top: calc(var(--gap-wide) * 0.72);
}
.pagehead--media + .toc + .section--tight { padding-top: calc(var(--gap-tight) * 0.8); }

/* Ручные паузы там, где меняется тема разговора, и там, где не меняется.
   Ставятся в разметке осознанно, а не формулой, и потому идут последними. */
.section--air   { padding-top: calc(var(--gap-wide) * 1.34) !important; }
.section--close { padding-top: calc(var(--gap-wide) * 0.44) !important; }
/* Тёмные поверхности переопределяют нейтрали целиком, а не по одному правилу.
   Иначе любой унаследованный компонент приносит светлый --fg-2 на чёрный фон
   и проваливает контраст. Все значения ниже проверены: минимум 5.9:1. */
.section--dark,
.cta-band,
.strip,
.hero,
.pagehead--media,
.footer {
  --bg:        var(--dark);
  --bg-2:      var(--dark-2);
  --bg-3:      var(--dark-2);
  --bg-sunk:   var(--dark-3);
  --fg:        var(--on-dark);
  --fg-2:      var(--on-dark-fg-2);
  --fg-3:      var(--on-dark-fg-3);
  --line:      var(--line-dark);
  --line-2:    var(--on-dark-line-2);
  --accent-ink: var(--on-dark-accent);
  --brand:     var(--on-dark);
  --brand-2:   var(--white);
  --on-brand:  var(--dark);
  color: var(--on-dark);
}
.section--dark { background: var(--dark); }
.section--dark h1, .section--dark h2, .section--dark h3,
.cta-band h2, .strip h2 { color: var(--on-dark); }

.section--dark a, .cta-band a, .strip a { text-decoration-color: var(--line-2); }

/* --- колонки: намеренно неравные ---------------------------------------- */
.cols        { display: grid; gap: var(--s-6); }
.cols--62-38 { grid-template-columns: 1fr; }
.cols--38-62 { grid-template-columns: 1fr; }
.cols--50    { grid-template-columns: 1fr; }

@media (min-width: 53.75em) {
  .cols        { gap: clamp(2rem, 4vw, 4rem); }
  .cols--62-38 { grid-template-columns: 62fr 38fr; }
  .cols--38-62 { grid-template-columns: 38fr 62fr; }
  .cols--50    { grid-template-columns: 1fr 1fr; }
}
.cols--center { align-items: center; }
.cols--end    { align-items: end; }

/* Ячейка задаёт размер, содержимое подчиняется.
   У <img> есть width/height из исходника, и без этого правила картинка
   вставала по своей ширине (480 px в ячейке 567) — справа оставалось
   87 px мёртвого поля, и правый край блока рвался. */
.cols > div > picture,
.cols > div > picture > img,
.cols > picture,
.cols > picture > img { width: 100%; }

/* --- шапка --------------------------------------------------------------- */
.header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color var(--d-3) var(--e-move),
              background var(--d-3) var(--e-move);
}
.header.is-stuck {
  border-bottom-color: var(--line);
  background: rgb(var(--bg-rgb) / .92);
  backdrop-filter: blur(10px);
}
@supports not (backdrop-filter: blur(4px)) {
  .header.is-stuck { background: var(--bg); }
}

.header__inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: var(--s-5);
}

/* Система намеренно плоская: ни одной тени в состоянии покоя.
   Глубину задают кромки, смена фона и наложения, а не размытие.
   Тень остаётся только там, где она несёт состояние: фокус на поле ввода
   и пульс отметки «идёт сейчас». */
/* Логотип клуба как в группе ВК: шлем, перо, надписи — без изменений рисунка.
   Шапка светлая, поэтому в logo-light.svg надписи тёмные, а шлем светло-серый;
   в подвале (тёмном) — logo-dark.svg в цветах оригинала. Подложки нет.
   Высота задаётся шапкой: 52 px при шапке 68, 64 px при 84. Ниже ~50 px
   надпись «FIGHT CLUB» перестаёт читаться. */
.brand {
  display: inline-flex; align-items: center;
  flex: 0 0 auto;
  text-decoration: none; color: var(--fg);
  height: 52px;
  transition: opacity var(--d-2) var(--e-move);
}
.brand__logo { height: 100%; width: auto; display: block; }
.brand:hover { opacity: .8; }
.footer__logo { width: 150px; height: auto; }
@media (min-width: 56.25em) {
  .brand { height: 64px; }
}

.nav { margin-left: auto; }
.nav__list {
  display: flex; align-items: center; gap: clamp(0.75rem, 1.6vw, 1.5rem);
  list-style: none; margin: 0; padding: 0;
}
.nav__link {
  white-space: nowrap;
  font-size: var(--t-sm);
  font-weight: 500;
  text-decoration: none;
  padding: 6px 2px;
  display: inline-block;
  position: relative;
  color: var(--fg-2);
  transition: color var(--d-2) var(--e-move);
}
.nav__link::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px; background: var(--fg);
  transform: scaleX(0); transform-origin: left;
  transition: transform var(--d-3) var(--e-in);
}
.nav__link:hover { color: var(--fg); }
.nav__link:hover::after { transform: scaleX(1); }
.nav__link[aria-current='page'] { color: var(--fg); font-weight: 600; }
.nav__link[aria-current='page']::after { transform: scaleX(1); background: var(--accent); }

.header__actions { display: flex; align-items: center; gap: var(--s-4); }
.header__phone {
  font-family: var(--mono); font-size: var(--t-sm); font-weight: 500;
  text-decoration: none; white-space: nowrap;
  letter-spacing: -0.02em;
  display: inline-flex; align-items: center;
  min-height: 24px; padding-block: 4px;
}
.header__phone:hover { text-decoration: underline; }

@media (max-width: 68.6875em) {
  .nav { display: none; }
  .header__phone { display: none; }
  /* Меню скрыто — его margin-left:auto больше не толкает кнопку вправо,
     и она прилипала к логотипу. Кнопка уходит к бургеру. */
  .header__actions { margin-left: auto; }
}
/* Кнопка записи остаётся на всех ширинах: путь до целевого действия
   не должен зависеть ни от выдвижного меню, ни от работающего скрипта.
   На узком экране она просто становится компактнее. */
@media (max-width: 30em) {
  .btn--compact { min-height: 40px; padding-inline: var(--s-4); font-size: var(--t-xs); }
  .header__inner { gap: var(--s-3); }
  .brand { height: 50px; }
}
/* 320px — iPhone SE первого поколения. Строка шапки там не сходится,
   поэтому знак ужимается, а кнопка остаётся. */
@media (max-width: 22.5em) {
  .header__inner { gap: var(--s-2); }
  .brand { height: 46px; }
  .btn--compact { padding-inline: var(--s-3); }
  .header .burger { flex: 0 0 36px; width: 36px; padding-inline: 6px; }
}

/* --- навигация по длинной странице ---------------------------------------
   Не подпись над контентом, а указание положения: страницы здесь по
   6–15 тысяч пикселей, и человеку нужно понимать, что дальше. */
.toc {
  position: sticky; top: var(--header-h); z-index: 90;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
/* Лента больше не прокручивается вбок. Боковая прокрутка внутри липкой полосы
   не читается как прокрутка: последний пункт обрывался на кромке экрана, и
   человек просто не узнавал, что справа есть ещё. Пунктов теперь столько,
   что они помещаются в строку, а если не помещаются — переносятся. */
.toc ul {
  list-style: none; margin: 0;
  padding-block: 10px;
  display: flex; flex-wrap: wrap; gap: var(--s-3);
}
.toc li { flex: 0 1 auto; min-width: 0; }
/* Пункты — фишки, а не строчки текста.
   До 09.09.2026 это была лента слов без рамки и фона: подчёркивание
   появлялось только у текущего раздела, и человек не понимал, что на эти
   слова вообще можно нажать. Кромка, фон и заливка активного решают это
   без единой лишней подписи. */
.toc a {
  display: inline-flex; align-items: center;
  min-height: 40px;
  padding-inline: var(--s-5);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-3);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--fg-2);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--d-2) var(--e-move),
              background var(--d-2) var(--e-move),
              border-color var(--d-2) var(--e-move);
}
.toc a { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.toc--tall { position: static; }
.toc a:hover { color: var(--fg); background: var(--white); border-color: var(--fg-3); }
.toc a:active { transform: translateY(1px); }
.toc a.is-current {
  color: var(--on-brand); background: var(--brand); border-color: var(--brand);
}
@media (max-width: 30em) { .toc { display: none; } }

/* --- мобильное меню ------------------------------------------------------ */
.burger {
  margin-left: auto;
  display: inline-flex; flex-direction: column; justify-content: center;
  gap: 5px;
  flex: 0 0 44px;
  width: 44px; height: 44px;
  padding: 0 9px;
  background: none; border: 0; cursor: pointer;
}
.burger span {
  display: block; height: 2px; background: var(--fg); border-radius: 2px;
  transition: transform var(--d-3) var(--e-move), opacity var(--d-2) linear;
}
.burger[aria-expanded='true'] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger[aria-expanded='true'] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded='true'] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
@media (min-width: 68.75em) { .burger { display: none; } }

.drawer {
  position: fixed; inset: var(--header-h) 0 0 0;
  z-index: 99;
  background: var(--bg);
  padding: var(--s-6) var(--pad) var(--s-8);
  overflow-y: auto;
  transform: translateY(-8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--d-3) var(--e-in), transform var(--d-3) var(--e-in),
              visibility 0s linear var(--d-3);
}
.drawer.is-open {
  opacity: 1; transform: none; visibility: visible;
  transition-delay: 0s;
}
.drawer__list { list-style: none; margin: 0 0 var(--s-6); padding: 0; }
.drawer__list li + li { border-top: 1px solid var(--line); }
.drawer__link {
  display: block; padding: var(--s-4) 0;
  font-family: var(--display); font-size: var(--t-lg);
  text-transform: uppercase; letter-spacing: -0.01em;
  text-decoration: none;
}
.drawer__link[aria-current='page'] { color: var(--accent-ink); }

/* --- подвал -------------------------------------------------------------- */
.footer {
  background: var(--dark); color: var(--on-dark);
  padding-block: var(--s-9) var(--s-6);
  margin-top: var(--gap-wide);
}
/* Тёмная врезка и подвал — одна плоскость: светлой полосы между ними быть не должно.
   Подвал — сосед <main>, а не последней секции, поэтому признак ставит сборка. */
.main--flush + .footer { margin-top: 0; }
.footer a { color: var(--on-dark); }
.footer__grid {
  display: grid; gap: var(--s-7);
  grid-template-columns: 1fr;
}
@media (min-width: 47.5em)  { .footer__grid { grid-template-columns: 1.4fr 1fr 1fr; } }
@media (min-width: 68.75em) { .footer__grid { grid-template-columns: 1.6fr 1fr 1fr 1.2fr; } }

.footer__title {
  font-size: var(--t-xs); font-weight: 600;
  color: var(--on-dark-2); margin-bottom: var(--s-4);
}
.footer__list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.footer__list a { text-decoration: none; color: var(--on-dark-2); font-size: var(--t-sm); }
.footer__list a:hover { color: var(--on-dark); text-decoration: underline; }

.footer__legal {
  margin-top: var(--s-8); padding-top: var(--s-5);
  border-top: 1px solid var(--line-dark);
  color: var(--on-dark-2); font-size: var(--t-xs); line-height: 1.6;
  display: grid; gap: var(--s-3);
}
@media (min-width: 56.25em) {
  .footer__legal { grid-template-columns: 1fr auto; align-items: end; }
}
