/* Общий слой сайта: токены, шапка, подвал, кнопки, типографика.
   Подключается всеми страницами. Специфика длинных документов — в legal.css,
   специфика лендинга — в landing.css.

   Токены совпадают с дизайн-системой приложения
   (app/lib/design_system/tokens/): сайт и приложение обязаны выглядеть одним
   продуктом, а не двумя похожими. */

:root {
  color-scheme: light dark;

  --bg: #fbfaff;
  --bg-soft: #f3f0fa;
  --surface: #fff;
  --fg: #16121f;
  --muted: #5c5472;
  --faint: #8f87a6;
  --rule: #e5e0f0;
  --brand: #6c3ce9;
  --brand-2: #c13be0;
  --brand-3: #ff3d8d;
  --on-brand: #fff;
  --shadow: 0 18px 40px -24px rgb(22 18 31 / 35%);

  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --step-1: clamp(1.125rem, 1.05rem + 0.35vw, 1.25rem);
  --step-2: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
  --step-3: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);
  --step-4: clamp(2.25rem, 1.6rem + 3vw, 4rem);

  --gap: clamp(1rem, 0.7rem + 1.5vw, 2rem);
  --section: clamp(3.5rem, 2rem + 7vw, 7rem);
  --radius: 20px;
  --wrap: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0b16;
    --bg-soft: #171122;
    --surface: #1c1728;
    --fg: #f4f1fa;
    --muted: #b9b0cc;
    --faint: #8f87a6;
    --rule: #2a2338;
    --brand: #8b5cff;
    --brand-2: #c763f0;
    --brand-3: #ff5c9e;
    --shadow: 0 18px 40px -24px rgb(0 0 0 / 70%);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 var(--step-0) / 1.65 -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-wrap: break-word;
}

a {
  color: var(--brand);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
}

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gap);
}

/* Ссылка для клавиатуры и скринридера: первый таб на странице. */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 12px 18px;
  background: var(--surface);
  border-radius: 0 0 12px;
  z-index: 10;
}

.skip:focus {
  left: 0;
}

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

.site-head {
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: saturate(1.6) blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--rule);
}

.site-head__inner {
  display: flex;
  align-items: center;
  gap: var(--gap);
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: var(--step-1);
  letter-spacing: -0.02em;
  color: var(--fg);
  text-decoration: none;
  margin-inline-end: auto;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

/* На узком экране бейдж магазина из шапки убирается: вместе с подписью он
   переносится на вторую строку и растягивает шапку. Ниже, в первом экране,
   он всё равно стоит. */
@media (max-width: 720px) {
  .site-head .stores {
    display: none;
  }
}

/* ── Кнопки магазинов ────────────────────────────────────────────────── */

.stores {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

/* Официальный бейдж Apple. Артворка не перекрашивается, не обводится и не
   приглушается — правила Apple запрещают менять бейдж, поэтому вся работа
   стилей здесь сводится к высоте: пропорции задаёт сам файл. Чёрный вариант
   на светлой теме, белый на тёмной — файл выбирает stores.js. */
.store-badge {
  display: inline-flex;
  text-decoration: none;
}

.store-badge img {
  display: block;
  height: 48px;
  width: auto;
}

/* Пока приложение не опубликовано, бейдж не ссылка, а картинка. О состоянии
   говорит подпись рядом (`.stores__note`), а не серый цвет: приглушить бейдж
   значит его изменить. */
.store-badge--soon {
  cursor: default;
}

.stores__note {
  font-size: 0.875rem;
  color: var(--muted);
}

/* В шапке бейдж меньше: 48 px спорят по весу с логотипом. 40 px — нижняя
   граница, которую Apple разрешает для экрана. */
.site-head .store-badge img {
  height: 40px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 26px;
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(
    120deg,
    var(--brand),
    var(--brand-2) 55%,
    var(--brand-3)
  );
  color: var(--on-brand);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

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

.site-foot {
  margin-top: var(--section);
  border-top: 1px solid var(--rule);
  background: var(--bg-soft);
  padding-block: clamp(2rem, 1rem + 4vw, 3.5rem);
  color: var(--muted);
  font-size: 0.9375rem;
}

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

.site-foot h2 {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  margin: 0 0 10px;
}

.site-foot ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-foot li + li {
  margin-top: 8px;
}

.site-foot__bottom {
  margin-top: clamp(1.5rem, 1rem + 2vw, 2.5rem);
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  align-items: center;
  justify-content: space-between;
  color: var(--faint);
}
