/* Дизайн-система публичных сайтов Лофт Фитнес.
 *
 * Язык тот же, что в приложении: тёмное полотно, красный акцент, Montserrat
 * на заголовках и Golos Text в тексте. Токены повторяют `apps/web` — если
 * меняется приложение, меняется и сайт.
 *
 * Движение собрано по брифу `docs/design-motion-brief.md`: интерфейсное — под
 * 300 мс, маркетинговое появление — 600 мс, кривая одна и та же.
 */

/* ── Токены ─────────────────────────────────────────────────────────────── */

:root {
  --canvas: #0e0e11;
  --surface: #16161a;
  --raised: #1e1e23;
  --soft: #28282f;
  --brand: #ff1f1f;
  --brand-hover: #e00000;
  --on-brand: #ffffff;
  --ink: #ececef;
  --muted: #9e9ea8;
  --subtle: #6e6e78;
  --line: #33333b;

  --display: Montserrat, Arial, sans-serif;
  --body: 'Golos Text', Arial, sans-serif;

  /* Скругления как в приложении: 12 — рабочая лошадка, 16 — карточка. */
  --radius: 12px;
  --radius-card: 16px;

  --container: 1280px;
  --gutter: 20px;
  --header: 76px;

  /* Кривые: появление и уход — out, движение по экрану — in-out. */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --dur-press: 140ms;
  --dur-hover: 200ms;
  --dur-panel: 300ms;
  --dur-reveal: 600ms;

  color-scheme: dark;
}

/* ── Основа ─────────────────────────────────────────────────────────────── */

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

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

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

/* Резиновая полоса: содержимое занимает весь экран, а поля растут вместе с
   ним — на ноутбуке 20 точек, на большом мониторе под сотню. Жёсткой ширины
   нет, поэтому пустых полей по краям больше не остаётся.
   ⚠️ Читаемость держится не шириной полосы, а ограничениями на сам текст
   (`max-width` в `ch` у абзацев): строка в две тысячи точек нечитаема. */
.container {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 0 clamp(var(--gutter), 3.5vw, 110px);
}

.section { padding: clamp(64px, 9vw, 140px) 0; }
.section--tight { padding: clamp(48px, 6vw, 88px) 0; }

/* ── Типографика ────────────────────────────────────────────────────────── */

.eyebrow {
  margin: 0 0 18px;
  color: var(--brand);
  font-family: var(--body);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.display {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(38px, 6.4vw, 92px);
  font-weight: 900;
  line-height: 0.94;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.display--md { font-size: clamp(30px, 4.4vw, 58px); }

.display .accent { color: var(--brand); }

h2.title {
  margin: 0 0 28px;
  font-family: var(--display);
  font-size: clamp(26px, 3.4vw, 44px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

h3.subtitle {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

/* Ширину строки ограничиваем содержимому: на резиновой полосе это
   единственное, что удерживает текст от превращения в ленту. */
.lead {
  max-width: 68ch;
  max-width: 62ch;
  color: var(--muted);
  font-size: clamp(16px, 1.3vw, 19px);
  line-height: 1.7;
}

.text p { margin: 0 0 20px; color: var(--muted); }
.text p:last-child { margin-bottom: 0; }
.text strong { color: var(--ink); font-weight: 700; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 17px 32px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--brand);
  color: var(--on-brand);
  cursor: pointer;
  font-family: var(--body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  /* На телефоне длинная подпись переносится — пусть обе строки стоят по
     центру, а не прижимаются влево. */
  text-align: center;
  text-transform: uppercase;
  transition: background var(--dur-hover) ease, transform var(--dur-press) var(--ease-out);
}

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn:active { transform: scale(0.98); }

@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--brand-hover); }
  .btn--ghost:hover { border-color: var(--ink); background: rgb(255 255 255 / 6%); }
}

/* ── Полоска приложения над шапкой ──────────────────────────────────────── */

/* На каждой странице, но не приклеена: уходит вверх вместе со страницей,
   шапка остаётся. На телефоне — только значок и «Открыть». */
.appbar {
  display: block;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.appbar__inner {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 40px;
}

.appbar__badge {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.appbar__text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.appbar__more { flex-shrink: 0; margin-left: auto; color: var(--ink); font-weight: 700; white-space: nowrap; }

@media (hover: hover) and (pointer: fine) {
  .appbar:hover .appbar__more { color: var(--brand); }
}

@media (max-width: 560px) {
  .appbar__text { display: none; }
}

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

.header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgb(14 14 17 / 82%);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-panel) var(--ease-out), background var(--dur-panel) var(--ease-out);
}

.header--scrolled {
  border-bottom-color: var(--line);
  background: rgb(14 14 17 / 96%);
}

.header__inner {
  display: flex;
  align-items: center;
  gap: 28px;
  height: var(--header);
}

.header__logo { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.header__logo img { height: 30px; width: auto; }

.header__logo-text {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

/* Переключатель клубов: свой клуб подписан рядом с логотипом, соседние — в
   списке под ним. `<details>` открывается и без скрипта; скрипт только
   закрывает список щелчком мимо и клавишей Esc.
   Черта-разделитель стоит посередине между логотипом и названием клуба: до
   неё — промежуток шапки, после неё — почти такой же внутренний отступ. */
.clubs { position: relative; flex-shrink: 0; }

.clubs__current {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 8px 0 24px;
  border-left: 1px solid var(--line);
  color: var(--brand);
  font-family: var(--display);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.clubs__current::-webkit-details-marker { display: none; }

.clubs__chevron {
  color: var(--muted);
  transition: transform var(--dur-hover) var(--ease-out), color var(--dur-hover) ease;
}

.clubs[open] .clubs__chevron { transform: rotate(180deg); color: var(--ink); }

@media (hover: hover) and (pointer: fine) {
  .clubs__current:hover .clubs__chevron { color: var(--ink); }
  .clubs__item:hover { background: var(--soft); }
}

.clubs__list {
  position: absolute;
  top: calc(100% + 14px);
  left: 6px;
  z-index: 70;
  display: grid;
  gap: 2px;
  width: 360px;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--raised);
  box-shadow: 0 18px 48px rgb(0 0 0 / 50%);
  list-style: none;
}

/* Список выезжает из-под подписи, а не возникает из ниоткуда. */
.clubs[open] .clubs__list { animation: clubs-in var(--dur-hover) var(--ease-out); }

@keyframes clubs-in { from { opacity: 0; transform: translateY(-6px); } }

.clubs__item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: var(--radius);
  transition: background var(--dur-hover) ease;
}

.clubs__item-name {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
}

.clubs__item[aria-current] .clubs__item-name { color: var(--brand); }

.clubs__here {
  color: var(--muted);
  font-family: var(--body);
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
}

.clubs__item-place { color: var(--muted); font-size: 13px; line-height: 1.4; }

/* Адрес переносится целиком: одинокая «9» на второй строке читается плохо. */
.clubs__address { white-space: nowrap; }

/* На телефоне список во всю ширину шапки: под узкой подписью ему тесно. */
@media (max-width: 560px) {
  .header__inner { position: relative; }
  .clubs { position: static; }
  .clubs__list { left: var(--gutter); right: var(--gutter); width: auto; }
}

/* На самых узких экранах логотип, клуб и бургер встают впритык — ужимаем
   промежутки, иначе сжимается бургер и в него трудно попасть пальцем. */
@media (max-width: 400px) {
  .header__inner { gap: 14px; }
  .clubs__current { padding-left: 14px; }
}

/* «Все клубы сети» в подвале: тот же список, но над ссылкой и вверх — там,
   где нажали, а не в шапке. Подпись выглядит обычной ссылкой подвала. */
.clubs--up .clubs__current {
  min-height: 0;
  padding: 0;
  border-left: 0;
  color: inherit;
  font: inherit;
  text-transform: none;
}

.clubs--up .clubs__list { top: auto; bottom: calc(100% + 12px); left: 0; }
.clubs--up[open] .clubs__list { animation: clubs-up-in var(--dur-hover) var(--ease-out); }

@keyframes clubs-up-in { from { opacity: 0; transform: translateY(6px); } }

@media (hover: hover) and (pointer: fine) {
  .clubs--up .clubs__current:hover { color: var(--ink); }
}

@media (max-width: 560px) {
  .footer__bottom { position: relative; }
  .clubs--up { position: static; }
  .clubs--up .clubs__list { left: 0; right: 0; width: auto; }
}

.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }

.nav__link {
  position: relative;
  padding: 10px 14px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color var(--dur-hover) ease;
}

/* Подчёркивание растёт от центра — движение, а не смена цвета. */
.nav__link::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 4px;
  height: 2px;
  background: var(--brand);
  transform: scaleX(0);
  transition: transform var(--dur-hover) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .nav__link:hover::after { transform: scaleX(1); }
}

.nav__link[aria-current='page']::after { transform: scaleX(1); }

.header__phone {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.header__burger {
  display: none;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

/* ── Подвал ─────────────────────────────────────────────────────────────── */

.footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 64px 0 40px;
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 40px;
}

.footer__heading {
  margin: 0 0 16px;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.footer__list { margin: 0; padding: 0; list-style: none; }
.footer__list li { margin-bottom: 10px; }

.footer__list a {
  color: var(--muted);
  font-size: 14px;
  transition: color var(--dur-hover) ease;
}

@media (hover: hover) and (pointer: fine) {
  .footer__list a:hover { color: var(--ink); }
}

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--subtle);
  font-size: 12px;
}

/* «Настройки cookie» в подвале — кнопка, но выглядит соседней ссылкой. */
.footer__cookie {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .footer__cookie:hover { color: var(--ink); }
}

/* ── Плашка о cookie ─────────────────────────────────────────────────────
   Метрика — только после «Принять» (владелец 28.09.2026). Плашка внизу, не
   закрывает страницу: сайтом можно пользоваться и не отвечая. */

.cookie-note {
  position: fixed;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 16px 24px;
  max-width: 820px;
  margin: 0 auto;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--raised);
  box-shadow: 0 18px 48px rgb(0 0 0 / 50%);
}

/* `hidden` у плашки с `display: flex` сам не спрячет — класс его перебивает. */
.cookie-note[hidden] { display: none; }

.cookie-note__text { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.cookie-note__text a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.cookie-note__actions { display: flex; flex-shrink: 0; gap: 10px; }

@media (max-width: 640px) {
  .cookie-note { flex-direction: column; align-items: stretch; padding: 16px; }
  /* Поровну: ни один ответ не должен выглядеть «главнее» по размеру. */
  .cookie-note__actions .btn { flex: 1 1 0; min-width: 0; padding-inline: 12px; }
}

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

.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: min(88vh, 860px);
  padding: 140px 0 clamp(96px, 12vh, 132px);
  overflow: hidden;
}

.hero__media {
  position: absolute;
  inset: 0;
  z-index: -1;
}

.hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgb(14 14 17 / 55%) 0%, rgb(14 14 17 / 72%) 55%, var(--canvas) 100%);
}

.hero__inner { position: relative; }
/* ⚠️ Ширину ограничиваем содержимому, а не самой колонке: иначе `margin: auto`
   контейнера центрирует узкий блок, и весь текст уезжает вправо. */
.hero__inner > * { max-width: 900px; }

/* ── Карточки и сетки ───────────────────────────────────────────────────── */

.grid { display: grid; gap: clamp(16px, 1.6vw, 32px); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  transition: border-color var(--dur-hover) ease, transform var(--dur-hover) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .card:hover { border-color: var(--soft); transform: translateY(-3px); }
}

.card__index {
  display: block;
  margin-bottom: 14px;
  color: var(--brand);
  font-family: var(--display);
  font-size: 13px;
  font-weight: 900;
}

.card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }

/* ── Галерея ────────────────────────────────────────────────────────────── */

.gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }

.gallery__item {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  max-height: 420px;
  border: 0;
  border-radius: var(--radius-card);
  padding: 0;
  background: var(--raised);
  cursor: zoom-in;
}

.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 700ms var(--ease-out);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  /* ⚠️ Сквозь прежние 92% просвечивала страница, и за открытым снимком был
     виден соседний — выглядело как две наложенные фотографии. */
  background: rgb(6 6 8 / 97%);
  backdrop-filter: blur(18px);
  opacity: 0;
  animation: fade-in var(--dur-panel) var(--ease-out) forwards;
}

.lightbox img { max-width: min(1100px, 92vw); max-height: 88vh; border-radius: var(--radius-card); object-fit: contain; }

@keyframes fade-in { to { opacity: 1; } }

/* ── Появление при прокрутке ────────────────────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--dur-reveal) var(--ease-out), transform var(--dur-reveal) var(--ease-out);
}

.reveal.is-visible { opacity: 1; transform: none; }

/* Каскад: соседи входят с задержкой 60 мс, дальше седьмого — не тянем. */
.reveal[data-step='1'] { transition-delay: 60ms; }
.reveal[data-step='2'] { transition-delay: 120ms; }
.reveal[data-step='3'] { transition-delay: 180ms; }
.reveal[data-step='4'] { transition-delay: 240ms; }
.reveal[data-step='5'] { transition-delay: 300ms; }
.reveal[data-step='6'] { transition-delay: 360ms; }

/* ── Телефоны и планшеты ────────────────────────────────────────────────── */

/* Шапка целиком — логотип, клуб, меню, телефон, кнопка — помещается только на
   широком экране: на ноутбуке 1280 меню ломалось в две строки, а кнопка
   уезжала за край. Сначала уходит телефон (он есть на первом экране и в
   подвале), потом меню прячется в бургер — кнопка абонемента остаётся. */
@media (max-width: 1359px) {
  .header__phone { display: none; }
}

@media (max-width: 1179px) {
  .nav { display: none; }
  .header__burger { display: grid; place-items: center; }
  .header__inner > .btn { margin-left: auto; }
}

@media (max-width: 1080px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  .nav { display: none; }
  .header__burger { display: grid; place-items: center; margin-left: auto; }
  .header__phone { display: none; }
  /* Кнопка абонемента в шапке телефона ломалась на две строки и выдавливала
     бургер. Она никуда не девается — живёт первой строкой в меню. */
  .header__inner > .btn { display: none; }
  .grid--2, .grid--3 { grid-template-columns: minmax(0, 1fr); }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { min-height: 78vh; padding-top: 112px; }
}

@media (max-width: 560px) {
  .grid--4 { grid-template-columns: minmax(0, 1fr); }
  .footer__grid { grid-template-columns: 1fr; }
  .btn { width: 100%; }
}

/* ── Меню на телефоне ───────────────────────────────────────────────────── */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--canvas);
  transform: translateY(-100%);
  transition: transform var(--dur-panel) var(--ease-in-out);
}

.drawer.is-open { transform: none; }

.drawer__list { display: grid; align-content: start; gap: 4px; padding: 24px var(--gutter); }

.drawer__list a {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
}

/* ── Уважение к настройкам ──────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
