/* ============================================================
   Токены
   ============================================================ */
:root {
  color-scheme: light;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --font-text: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --bg: #FFFFFF;
  --bg-alt: #F5F5F7;
  --surface: #FFFFFF;
  --card: #FFFFFF;
  --card-hover: #FAFAFC;
  --ink: #1D1D1F;
  --ink-2: #6E6E73;
  --ink-3: #6B6B70;
  --ink-dim: #8E8E93;
  --nav-ink: #424245;
  --line: #D2D2D7;
  --line-soft: #E8E8ED;
  --chip: #E8E8ED;
  --chip-ink: #1D1D1F;
  --blue: #0071E3;
  --blue-ink: #0066CC;
  --blue-soft: rgba(0, 113, 227, .11);
  --btn: #0071E3;
  --btn-hover: #0062C4;
  --green: #1A9C47;
  --green-text: #12783A;
  --green-soft: rgba(26, 156, 71, .11);
  --red: #E5383B;
  --red-sign: #FF5A5F;
  --navy: #141833;
  --navy-2: #0C0F24;
  --header: rgba(255, 255, 255, .86);
  --header-line: rgba(0, 0, 0, .08);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 28px rgba(0, 0, 0, .05);
  --shadow-key: 0 1px 0 rgba(0, 0, 0, .06), 0 4px 10px rgba(0, 0, 0, .08);
  --sel: rgba(0, 113, 227, .22);
  --demo-bg: #F5F5F7;
  --kbd-bg: #FFFFFF;
  --kbd-line: #D2D2D7;
  --silver-1: #E3E4E8;
  --silver-2: #C4C6CC;
  --base-1: #F1F2F4; --base-2: #D5D7DC; --base-3: #A9ACB3;
  --mac-shadow: rgba(0, 0, 0, .16);

  --r-card: 22px;
  --r-big: 32px;
  --wrap: 1120px;
  --gutter: 24px;

  --ease: cubic-bezier(.25, .1, .25, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --pop: cubic-bezier(.2, .9, .25, 1);
  --spring: cubic-bezier(.3, 1.3, .5, 1);
  --spring-l: var(--spring);
}
@supports (transition-timing-function: linear(0, 1)) {
  :root {
    /* затухающая пружина, перелёт 2.5 % */
    --spring-l: linear(0, .0348 3.6%, .12 7.1%, .2324 10.7%, .3552 14.3%, .4768 17.9%, .5897 21.4%, .6897 25%, .7747 28.6%, .8446 32.1%, .9 35.7%, .9425 39.3%, .9738 42.9%, .9959 46.4%, 1.0105 50%, 1.0193 53.6%, 1.0237 57.1%, 1.0251 60.7%, 1.0243 64.3%, 1.0223 67.9%, 1.0195 71.4%, 1.0164 75%, 1.0134 78.6%, 1.0105 82.1%, 1.008 85.7%, 1.0058 89.3%, 1.004 92.9%, 1.0026 96.4%, 1);
  }
}

/* Тёмная тема — графит, как у эталона (не чёрная) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #161618; --bg-alt: #1C1C1F; --surface: #1F1F22; --card: #232327; --card-hover: #2C2C31;
    --ink: #F5F5F7; --ink-2: rgba(235, 235, 245, .62); --ink-3: rgba(235, 235, 245, .56); --ink-dim: rgba(235, 235, 245, .38);
    --nav-ink: rgba(245, 245, 247, .86);
    --line: rgba(255, 255, 255, .12); --line-soft: rgba(255, 255, 255, .08); --chip: #2C2C31; --chip-ink: #F5F5F7;
    --blue: #0A84FF; --blue-ink: #4AA3FF; --blue-soft: rgba(10, 132, 255, .18);
    --green: #30D158; --green-text: #30D158; --green-soft: rgba(48, 209, 88, .14);
    --header: rgba(22, 22, 24, .84); --header-line: rgba(255, 255, 255, .08);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, .3); --shadow-key: 0 1px 0 rgba(0, 0, 0, .5), 0 4px 10px rgba(0, 0, 0, .35);
    --sel: rgba(10, 132, 255, .35); --demo-bg: #2C2C31; --kbd-bg: #36363C; --kbd-line: #48484F;
    --silver-1: #4A4B50; --silver-2: #2E2F33;
    --base-1: #6B6D73; --base-2: #45474C; --base-3: #2A2B2F;
    --mac-shadow: rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161618; --bg-alt: #1C1C1F; --surface: #1F1F22; --card: #232327; --card-hover: #2C2C31;
  --ink: #F5F5F7; --ink-2: rgba(235, 235, 245, .62); --ink-3: rgba(235, 235, 245, .56); --ink-dim: rgba(235, 235, 245, .38);
  --nav-ink: rgba(245, 245, 247, .86);
  --line: rgba(255, 255, 255, .12); --line-soft: rgba(255, 255, 255, .08); --chip: #2C2C31; --chip-ink: #F5F5F7;
  --blue: #0A84FF; --blue-ink: #4AA3FF; --blue-soft: rgba(10, 132, 255, .18);
  --green: #30D158; --green-text: #30D158; --green-soft: rgba(48, 209, 88, .14);
  --header: rgba(22, 22, 24, .84); --header-line: rgba(255, 255, 255, .08);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .3); --shadow-key: 0 1px 0 rgba(0, 0, 0, .5), 0 4px 10px rgba(0, 0, 0, .35);
  --sel: rgba(10, 132, 255, .35); --demo-bg: #2C2C31; --kbd-bg: #36363C; --kbd-line: #48484F;
  --silver-1: #4A4B50; --silver-2: #2E2F33;
  --base-1: #6B6D73; --base-2: #45474C; --base-3: #2A2B2F;
  --mac-shadow: rgba(0, 0, 0, .5);
}

/* ============================================================
   База
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; background: var(--bg); }
/* «Остановить анимацию» гасит и нативную плавную прокрутку (ревью M-3) */
@media (prefers-reduced-motion: no-preference) { html:not(.lenis):not(.static-motion) { scroll-behavior: smooth; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.5 var(--font-text); letter-spacing: -.022em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
img, svg { display: block; }
button { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: var(--blue-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 6px; }
main:focus, [tabindex="-1"]:focus { outline: none; }
.vh { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* Прелоадер скрыт, даже если css/preloader.css не загрузился (там его показывает .pl-on .pl). */
.pl { display: none; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 100; background: var(--btn); color: #fff; padding: 10px 16px; border-radius: 999px; }
.skip:focus { top: 12px; text-decoration: none; }
.wrap { max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }

h1, h2, h3 { font-family: var(--font-display); margin: 0; color: var(--ink); text-wrap: balance; }
.h2 { font-size: clamp(40px, 3vw + 18px, 62px); font-weight: 700; line-height: 1.1; letter-spacing: -.042em; }
.lead { font-size: clamp(19px, .5vw + 15px, 21px); line-height: 1.43; color: var(--ink-2); letter-spacing: -.02em; margin: 0; text-wrap: pretty; }
/* маски строк SplitText: запас под выносные элементы */
.line-mask { padding-bottom: .08em; margin-bottom: -.08em; }

kbd, .kbd {
  display: inline-flex; align-items: center; justify-content: center; gap: .2em;
  min-width: 1.75em; height: 1.55em; padding: 0 .4em; vertical-align: .08em;
  font: 600 .74em/1 var(--font-text); letter-spacing: 0; color: var(--ink);
  background: var(--kbd-bg); border: 1px solid var(--kbd-line); border-bottom-width: 2px; border-radius: .42em;
  transition: transform .14s var(--ease), background-color .14s, border-color .14s, color .14s;
}
.kbd.down, kbd.down { transform: translateY(1px); background: var(--btn); border-color: var(--btn); color: #fff; }

/* Кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 48px; padding: 0 24px; border-radius: 999px; border: 0; cursor: pointer;
  font: 400 17px/1 var(--font-text); letter-spacing: -.022em; white-space: nowrap;
  transition: background-color .2s var(--ease), transform .3s var(--spring);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--btn); color: #fff; }
.btn-primary:hover { background: var(--btn-hover); }
.btn-gray { background: var(--chip); color: var(--chip-ink); }
.btn-gray:hover { background: color-mix(in srgb, var(--chip) 85%, var(--ink)); }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn .soon { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: #00479C; color: #fff; letter-spacing: 0; }
.btn[aria-disabled="true"] { cursor: default; }
.btn .short { display: none; }
.micro { margin: 18px 0 0; font-size: 14px; color: var(--ink-3); letter-spacing: -.01em; }
.micro span + span::before { content: "·"; margin: 0 10px; }

/* Подсказка «скоро» у кнопок «Следить» */
.watch-tip {
  position: fixed; z-index: 120; left: 0; top: 0; max-width: 260px; padding: 10px 14px; border-radius: 14px;
  background: #1D1D1F; color: #fff; font-size: 14px; line-height: 1.4; box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
  opacity: 0; transform: translateY(4px) scale(.97); transition: opacity .2s var(--ease), transform .4s var(--spring-l); pointer-events: none;
}
.watch-tip.on { opacity: 1; transform: none; }

/* ============================================================
   Шапка
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 50; height: 58px;
  background: var(--header); border-bottom: 1px solid var(--header-line);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.site-header .bar { height: 100%; display: flex; align-items: center; gap: 22px; padding: 0 var(--gutter); max-width: 1488px; margin: 0 auto; }
.brand { display: inline-flex; align-items: baseline; gap: 7px; color: var(--ink); font: 600 17px/1 var(--font-display); letter-spacing: -.02em; padding: 6px 0; }
.brand:hover { text-decoration: none; }
/* Знак «Точка» (рисунок под 32 px): волна — цветом текста, точка — синяя. Стоит на базовой линии слова:
   нижний край волны = базовая линия, точка уходит под неё на 0,2 из 13,7 (оптический перелёт). */
.logo { --logo-h: 15px; flex: none; width: calc(var(--logo-h) * 28.8 / 13.7); height: var(--logo-h); color: inherit; fill: var(--blue); overflow: visible; position: relative; top: calc(var(--logo-h) * .2 / 13.7); }
.site-header nav { margin-left: auto; }
.nav { display: flex; gap: 26px; list-style: none; padding: 0; margin: 0; }
.nav a { display: inline-block; padding: 8px 0; color: var(--nav-ink); font-size: 15px; transition: color .2s; }
.nav a:hover { color: var(--ink); text-decoration: none; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 999px; cursor: pointer; color: var(--nav-ink); flex: none; }
.icon-btn:hover { background: var(--chip); color: var(--ink); }
.icon-btn svg { width: 19px; height: 19px; }
.theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .sun { display: none; }
  :root:not([data-theme="light"]) .theme-btn .moon { display: block; }
}
.motion-btn .play { display: none; }
.motion-btn[aria-pressed="true"] .pause { display: none; }
.motion-btn[aria-pressed="true"] .play { display: block; }
.motion-btn svg { width: 15px; height: 15px; }
.site-header .btn { min-height: 36px; padding: 0 16px; font-size: 15px; margin-left: 6px; }
.site-header .tools { display: flex; align-items: center; gap: 4px; }
@media (max-width: 860px) {
  .site-header nav { display: none; }
  .site-header .tools { margin-left: auto; }
}
@media (pointer: coarse) { .icon-btn { width: 44px; height: 44px; } .site-header .btn { min-height: 44px; } }

/* ============================================================
   Смена темы — круговое раскрытие (View Transitions)
   ============================================================ */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 9999; }

/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* Пока скрипт не расставил начальные кадры — вступление hero прячем (страховка: boot.js ставит motion-fail через 4 с).
   Только opacity: всё остаётся в дереве доступности; блок с фокусом виден сразу.
   intro-failsafe — на случай, если сломался и сам boot.js: в 4,4 с hero проявляется вместе с уходом
   прелоадера (pl-failsafe в preloader.css). Как только правило перестаёт действовать, анимация снимается. */
.js:not(.motion-ready):not(.motion-fail):not(.static-motion) [data-intro]:not(:focus-within) {
  opacity: 0; animation: intro-failsafe 1ms linear 4.4s forwards;
}
@keyframes intro-failsafe { to { opacity: 1; } }

/* Без JS эти контролы ничего не делают — не показываем их (ревью M-6) */
html:not(.js) .modes, html:not(.js) .try, html:not(.js) .try-note,
html:not(.js) [data-watch], html:not(.js) .theme-btn { display: none !important; }

/* ============================================================
   Меньше движения: системная настройка или кнопка «Остановить анимацию».
   JS ставит .static-motion на <html> в обоих случаях; медиазапрос — запас без JS.
   ============================================================ */
.static-motion *, .static-motion *::before, .static-motion *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important;
  transition-duration: .001ms !important; transition-delay: 0ms !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important; transition-duration: .001ms !important; transition-delay: 0ms !important; }
}
@media (forced-colors: active) {
  .btn, .mode, .tab, .seg button, .hold-btn { border: 1px solid ButtonText; }
  /* выбранное состояние отличается не только цветом */
  .tab[aria-selected="true"], .mode[aria-pressed="true"], .seg button[aria-pressed="true"], .motion-btn[aria-pressed="true"] {
    outline: 2px solid Highlight; outline-offset: 2px; font-weight: 700;
  }
  /* фокус на выбранной кнопке должен отличаться от «выбрано» (WCAG 2.4.7) */
  .tab[aria-selected="true"]:focus-visible, .mode[aria-pressed="true"]:focus-visible,
  .seg button[aria-pressed="true"]:focus-visible, .motion-btn[aria-pressed="true"]:focus-visible {
    outline: 3px solid CanvasText; outline-offset: 5px;
  }
  .caret, .mw-caret { background: CanvasText; }
  /* Знак в шапке: одним системным цветом (как mark-mono), чтобы не пропал на любом фоне. Подвал и .seg — в sections.css */
  .logo { color: CanvasText; fill: CanvasText; }
}
@media print {
  .pl,
  .site-header, .wall, .modes, .try, .try-note, .ticks { display: none !important; }
  [data-intro] { opacity: 1 !important; }
}
