/* Движение лендинга одним файлом (Семён 09.11: «как будто не хватает анимации
 * или красивости»; 17.11 по разбору движения выбрал «1A 2 3 4 5 6»).
 * Правило плаката: постоянное печатается и чертится один раз и без отскока
 * (строки по углам, заголовки из-под своей линии, линии таблиц), живое ведёт
 * себя как прибор (табло перелистывает цифры, точка NOTAM расходится кольцом,
 * по карте за телефоном идёт пинг в такт касанию в телефоне). Крупные слова
 * первого экрана при открытии стоят: на телефоне FREE это LCP (замер
 * 17.11.2026), двигаются они только от прокрутки.
 * Само движется только под prefers-reduced-motion: no-preference или по
 * классам из site/landing-motion.js, который при «уменьшить движение» ничего
 * не делает. Привязка к прокрутке только там, где есть animation-timeline
 * (Chrome 115, Safari 26, Firefox 159); без неё плакат просто стоит.
 * Хексов нет (сторож tests/unit/landing.test.js), цвета токенами landing.css.
 * Порядок файлов: landing.css, landing-sections.css, этот. */

:root { --ease: cubic-bezier(0.2, 0.8, 0.2, 1); --ease-print: cubic-bezier(0.3, 0, 0.2, 1); --ping-size: min(84vmin, 860px); }
@media (max-width: 1023px) { :root { --ping-size: 96vw; } }

/* ---------- Сценарий приложения в телефоне (перенесено из landing.css) ---------- */
/* Сценарий приложения в телефоне (Семён 09.11: «не хватает анимации»): ответ
 * для точки, лист уезжает, видна карта, касание точки, булавка, лист с
 * ответом выезжает снова; круг 8 с. Слои поверх кадра ответа: верх и низ
 * кадра карты, лист (тот же кадр ответа, вырезан по листу) и круг касания.
 * Геометрия на фигуре: --sheet-top и --sheet-side (край листа, проценты
 * кадра; сверяет scripts/landing-media.py), --tap-x/--tap-y (точка касания
 * на кадре карты), --fly (перелёт карты к точке: приложение iPhone
 * приближает её в 3,3 раза, у Android камера не двигается).
 * Запускает и останавливает landing-motion.js: после загрузки, только на
 * экране и без «уменьшить движение»; до запуска виден один кадр ответа. */
.demo { position: absolute; inset: 9px; z-index: 1; display: none; overflow: hidden; border-radius: 31px; pointer-events: none; }
.demo.is-playing { display: block; }
.demo.is-paused, .demo.is-paused * { animation-play-state: paused; }
.demo img { position: absolute; inset: 0; width: 100%; height: 100%; }
.demo-map--top {
  clip-path: inset(0 0 calc(100% - var(--sheet-top)) 0); transform-origin: var(--tap-x) var(--tap-y);
  animation: demo-map-top 8s -2s infinite;
}
.demo-map--bottom { clip-path: inset(var(--sheet-top) 0 0 0); animation: demo-map-bottom 8s -2s infinite; }
.demo-sheet { clip-path: inset(var(--sheet-top) var(--sheet-side) 0 var(--sheet-side) round 10px 10px 0 0); animation: demo-sheet 8s -2s infinite; }
.demo-tap {
  position: absolute; left: var(--tap-x); top: var(--tap-y); width: 15%; aspect-ratio: 1;
  border: 2px solid var(--tap-edge); border-radius: 50%; background: var(--tap-fill);
  transform: translate(-50%, -50%) scale(0.4); opacity: 0; animation: demo-tap 8s -2s infinite;
}
@keyframes demo-map-top {
  0%, 45% { opacity: 0; transform: var(--fly); animation-timing-function: cubic-bezier(0.3, 0, 0.2, 1); }
  51.25%, 72.5% { opacity: 1; transform: none; animation-timing-function: cubic-bezier(0.5, 0, 0.7, 0.4); }
  78.75%, 100% { opacity: 0; transform: var(--fly); }
}
@keyframes demo-map-bottom {
  0%, 44.9% { opacity: 0; }
  45%, 81.2% { opacity: 1; }
  81.25%, 100% { opacity: 0; }
}
@keyframes demo-sheet {
  0%, 45% { transform: none; animation-timing-function: cubic-bezier(0.5, 0, 0.75, 0); }
  50.5%, 73.75% { transform: translateY(calc(100% - var(--sheet-top))); animation-timing-function: cubic-bezier(0.2, 0.85, 0.25, 1); }
  81.25%, 100% { transform: none; }
}
/* iPhone: карта приближается к точке, поэтому лист и перелёт идут по очереди
 * (Семён 09.11, кадр с разрывом; сторож в landing-motion.spec.js). */
.phone[data-device="iphone"] .demo-map--top { animation-name: demo-zoom-top; }
.phone[data-device="iphone"] .demo-map--bottom { animation-name: demo-zoom-bottom; }
.phone[data-device="iphone"] .demo-sheet { animation-name: demo-zoom-sheet; }
@keyframes demo-zoom-top {
  0%, 45% { opacity: 0; transform: var(--fly); animation-timing-function: cubic-bezier(0.3, 0, 0.2, 1); }
  51.25%, 77% { opacity: 1; transform: none; animation-timing-function: cubic-bezier(0.5, 0, 0.7, 0.4); }
  83.25%, 100% { opacity: 0; transform: var(--fly); }
}
@keyframes demo-zoom-bottom {
  0%, 51.2% { opacity: 0; }
  51.25%, 83.2% { opacity: 1; }
  83.25%, 100% { opacity: 0; }
}
@keyframes demo-zoom-sheet {
  0%, 51.25% { transform: none; animation-timing-function: cubic-bezier(0.5, 0, 0.75, 0); }
  56.75%, 70% { transform: translateY(calc(100% - var(--sheet-top))); animation-timing-function: cubic-bezier(0.2, 0.85, 0.25, 1); }
  77%, 100% { transform: none; }
}
@keyframes demo-tap {
  0%, 67.5% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  70% { opacity: 1; transform: translate(-50%, -50%) scale(0.75); }
  76%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); }
}
/* Смена платформы: телефон и кадры галереи въезжают, а не подменяются. */
.phone.is-entering, .screen-item.is-entering { animation: device-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes device-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } }

/* ---------- Открытие первого экрана (1A) ---------- */
/* Один раз, около секунды: карта чуть отъезжает, телефон поднимается и
 * доворачивается с 12° до 7°, строки по углам печатаются от краёв к телефону,
 * ряд памяток слева направо. Крупные слова стоят. Только transform и
 * clip-path: ничто на первом экране не прячется прозрачностью (LCP, CLS 0).
 * Доворот на самом телефоне: поворот .hero-shot крутил бы его вокруг чужой
 * точки (в его transform сдвиг). После смены платформы не повторяется:
 * is-settled ставит landing-motion.js. */
@media (prefers-reduced-motion: no-preference) {
  .hero-map { animation: hero-map-settle 1.6s var(--ease) backwards; }
  .hero-shot { animation: hero-rise 1s var(--ease) both; }
  .hero-shot:not(.is-settled) .phone:not(.is-entering) { animation: phone-settle 1.2s var(--ease) backwards; }
  .hero-title, .hero-lead, .hero-note > span, .hero-ticker { animation: print-ltr 0.55s var(--ease-print) backwards; }
  .hero-tr > span, .hero-br > span { animation: print-rtl 0.55s var(--ease-print) backwards; }
  .hero-title { animation-delay: 0.2s; }
  .hero-lead { animation-delay: 0.28s; }
  .hero-tr > span:nth-child(1) { animation-delay: 0.3s; }
  .hero-tr > span:nth-child(2) { animation-delay: 0.38s; }
  .hero-tr > span:nth-child(3) { animation-delay: 0.46s; }
  .hero-note > span:nth-child(1) { animation-delay: 0.4s; }
  .hero-note > span:nth-child(2) { animation-delay: 0.48s; }
  .hero-note > span:nth-child(3) { animation-delay: 0.56s; }
  .hero-br > span:nth-child(1) { animation-delay: 0.5s; }
  .hero-br > span:nth-child(2) { animation-delay: 0.58s; }
  .hero-br > span:nth-child(3) { animation-delay: 0.66s; }
  .hero-ticker { animation-duration: 0.9s; animation-delay: 0.6s; }
}
@keyframes hero-map-settle { from { scale: 1.06; } }
@keyframes hero-rise { from { translate: 0 28px; } }
@keyframes phone-settle { from { rotate: -5deg; } }
@keyframes print-ltr { from { clip-path: inset(-6px 100% -6px -6px); } to { clip-path: inset(-6px); } }
@keyframes print-rtl { from { clip-path: inset(-6px -6px -6px 100%); } to { clip-path: inset(-6px); } }

/* ---------- Живые данные (2) ---------- */
/* Табло: цифры даты снимка и времени NOTAM перелистываются (ячейки .flip-ch
 * ставит landing-motion.js на время табло). Точка NOTAM загорается, когда
 * пришло время, после табло трижды расходится кольцом и затихает. */
.flip-ch { display: inline-block; }
@media (prefers-reduced-motion: no-preference) {
  .hero-fresh.is-live::before { animation: dot-on 0.45s var(--ease) 0.2s backwards; }
  .hero-fresh.is-live.is-pinging::before { animation: dot-on 0.45s var(--ease) 0.2s backwards, dot-ping 1.8s ease-out 3; }
  #src-date-notam { --halo: 5px; }
  #src-date-notam.is-pinging::before { animation: dot-ping 1.8s ease-out 3; }
}
@keyframes dot-on { from { scale: 0; } }
@keyframes dot-ping {
  from { box-shadow: 0 0 0 var(--halo, 4px) var(--dot-halo), 0 0 0 0 color-mix(in srgb, var(--dot) 60%, transparent); }
  to { box-shadow: 0 0 0 var(--halo, 4px) var(--dot-halo), 0 0 0 16px transparent; }
}

/* ---------- Ниже первого экрана (3) ---------- */
/* Классы ставит landing-motion.js только тому, что ниже первого экрана:
 * reveal подъём (кадры галереи, кнопки), reveal--lines заголовок по строкам
 * из-под своей линии, reveal--label подпись раздела с прочерчиваемой линией,
 * reveal--wipe строки таблиц и блоки между линиями печатаются слева направо,
 * reveal--step шаг сверху вниз вместе с линией слева, номер из-под своей
 * линии. Раскрывашки открываются плавно (Chrome 131+). */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(28px); }
  .reveal.is-revealed {
    opacity: 1; transform: none;
    transition: opacity 0.7s ease, transform 0.8s var(--ease);
    transition-delay: var(--reveal-delay, 0s);
  }
  .screens-track .screen-item { transition: transform 0.35s ease; }
  .screens-track .screen-frame { transition: opacity 0.35s ease; }
  .reveal--lines, .reveal--label { transform: none; }
  .reveal--lines.is-revealed { transition: none; }
  .reveal--lines .line { display: block; animation: line-rise 0.85s var(--ease) backwards; animation-delay: calc(var(--reveal-delay, 0s) + var(--line, 0) * 0.09s); }
  .reveal--label.is-revealed { transition: opacity 0.45s ease var(--reveal-delay, 0s); }
  .reveal--label.is-revealed::after { transform-origin: 0 50%; animation: rule-draw 1.1s var(--ease) backwards; animation-delay: calc(var(--reveal-delay, 0s) + 0.1s); }
  .reveal--wipe, .reveal--step { opacity: 1; transform: none; clip-path: inset(0 100% 0 0); }
  .reveal--step { clip-path: inset(0 0 100% 0); }
  .reveal--wipe.is-revealed, .reveal--step.is-revealed { clip-path: none; transition: none; animation: wipe-x 0.9s var(--ease-print) var(--reveal-delay, 0s) backwards; }
  .reveal--step.is-revealed { animation-name: wipe-y; animation-duration: 1s; }
  .reveal--step.is-revealed .step-num { animation: line-rise 0.9s var(--ease) backwards; animation-delay: calc(var(--reveal-delay, 0s) + 0.12s); }
  /* Плюс в раскрывашках поворотом становится минусом. */
  .faq-item summary::after, .glossary summary::after, .sources-more summary::after, .notice-more summary::after {
    transition: transform 0.4s var(--ease), background-size 0.3s ease;
  }
  @supports (interpolate-size: allow-keywords) {
    :root { interpolate-size: allow-keywords; }
    .notice-more::details-content, .faq-item::details-content, .sources-more::details-content, .glossary::details-content {
      height: 0; overflow: clip; transition: height 0.35s ease, content-visibility 0.35s allow-discrete;
    }
    .notice-more[open]::details-content, .faq-item[open]::details-content,
    .sources-more[open]::details-content, .glossary[open]::details-content { height: auto; }
  }
}
.faq-item[open] summary::after, .glossary[open] summary::after,
.sources-more[open] summary::after, .notice-more[open] summary::after { transform: rotate(180deg); }
/* Строка выходит из-под линии под собой: сдвиг и обрезка снизу меняются
 * вместе, нижний край окна стоит на месте (0.3em ниже строки, место под
 * хвосты Д, Щ и Q). После выхода обрезки нет. */
@keyframes line-rise {
  from { translate: 0 calc(100% + 0.5em); clip-path: inset(-0.4em -0.2em calc(100% + 0.2em) -0.2em); }
  to { translate: 0 0; clip-path: inset(-0.4em -0.2em -0.3em -0.2em); }
}
@keyframes rule-draw { from { scale: 0 1; } }
@keyframes wipe-x { from { clip-path: inset(-8px 100% -8px -8px); } to { clip-path: inset(-8px); } }
@keyframes wipe-y { from { clip-path: inset(-8px -8px 100% -8px); } to { clip-path: inset(-8px); } }

/* ---------- Уход с первого экрана, от прокрутки (4) ---------- */
/* Пока плакат уходит вверх (диапазон exit его временной шкалы): карта и пинг
 * едут медленнее страницы, телефон быстрее и выпрямляется, FREE и APP
 * расходятся в стороны. В самом верху страницы всё как без этого блока.
 * Шкала названа на .hero: у вложенных view() была бы своя, ведь .hero с
 * overflow: hidden сам контейнер прокрутки. Доворот при открытии и
 * выпрямление складываются (animation-composition: add). */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .hero { view-timeline: --hero block; }
    .hero-map { animation: hero-map-settle 1.6s var(--ease) backwards, hero-drift linear both; animation-timeline: auto, --hero; animation-range: normal, exit; }
    .hero-pings { animation: hero-drift linear both; animation-timeline: --hero; animation-range: exit; }
    .hero-shot {
      animation: hero-rise 1s var(--ease) both, hero-lift linear both;
      animation-timeline: auto, --hero; animation-range: normal, exit; animation-composition: replace, add;
    }
    .hero-shot .phone { animation: phone-straighten linear both; animation-timeline: --hero; animation-range: exit; }
    .hero-shot:not(.is-settled) .phone:not(.is-entering) {
      animation: phone-settle 1.2s var(--ease) backwards, phone-straighten linear both;
      animation-timeline: auto, --hero; animation-range: normal, exit; animation-composition: replace, add;
    }
    .hero-shot .phone.is-entering { animation: device-in 0.45s var(--ease) both; animation-timeline: auto; animation-range: normal; animation-composition: replace; }
    .hero-words .w1 { animation: word-left linear both; animation-timeline: --hero; animation-range: exit; }
    .hero-words .w2 { animation: word-right linear both; animation-timeline: --hero; animation-range: exit; }
  }
}
@keyframes hero-drift { to { translate: 0 30%; } }
@keyframes hero-lift { to { translate: 0 -22%; } }
@keyframes phone-straighten { to { rotate: 7deg; } }
@keyframes word-left { to { translate: -18vw 0; } }
@keyframes word-right { to { translate: 18vw 0; } }

/* ---------- Пинг по карте (5) ---------- */
/* В момент касания в телефоне от точки касания по карте расходится тонкое
 * кольцо и следом второе. Слой ставит landing-motion.js за крупными словами
 * и над картой; те же 8 с и тот же старт, что у круга касания (.demo-tap),
 * пауза вместе со сценарием. Центр (--ping-x, --ping-y) считается по кругу
 * касания, когда плакат вверху страницы. */
.hero-pings { position: absolute; inset: 0; z-index: 0; display: none; pointer-events: none; }
.hero-pings.is-playing { display: block; }
.hero-pings.is-paused .hero-ping { animation-play-state: paused; }
/* Кольцо растёт масштабом (на видеокарте), поэтому линия толще итоговой:
 * при масштабе 0.5, когда кольцо выходит из-за телефона, она около 1.3 px. */
.hero-ping {
  position: absolute; left: var(--ping-x, 50%); top: var(--ping-y, 50%); width: var(--ping-size); aspect-ratio: 1;
  translate: -50% -50%; border: 2.6px solid var(--dot); border-radius: 50%; opacity: 0; scale: 0.04;
  animation: hero-ping 8s -2s infinite linear;
}
.hero-ping + .hero-ping { border-width: 1.8px; animation-delay: -1.7s; }
@keyframes hero-ping {
  0%, 69.9% { opacity: 0; scale: 0.04; }
  70% { opacity: 0.9; scale: 0.04; animation-timing-function: cubic-bezier(0.15, 0.5, 0.35, 1); }
  85% { opacity: 0.7; }
  97%, 100% { opacity: 0; scale: 1; }
}

/* ---------- Наведение (6) ---------- */
/* Строка памятки заливается тёмно-синим слева направо (заливка шире строки на
 * 16 px с каждой стороны, без сдвига раскладки), буквы цвета бетона, стрелка
 * уезжает (её сдвиг в landing-sections.css). С клавиатуры то же по фокусу.
 * Стрелка бордовой кнопки сдвигается. */
#guides .docs-grid a { position: relative; isolation: isolate; }
#guides .docs-grid a::before {
  content: ""; position: absolute; z-index: -1; inset: 0 -16px; background: var(--fg);
  scale: 0 1; transform-origin: 0 50%;
}
#guides .docs-grid a:focus-visible { color: var(--bg); text-decoration: none; }
#guides .docs-grid a:focus-visible::before { scale: 1; }
@media (hover: hover) {
  #guides .docs-grid a:hover { color: var(--bg); text-decoration: none; }
  #guides .docs-grid a:hover::before { scale: 1; }
}
@media (prefers-reduced-motion: no-preference) {
  #guides .docs-grid a { transition: color 0.3s ease; }
  #guides .docs-grid a::before { transition: scale 0.5s var(--ease); }
  .cta-btn svg { transition: translate 0.25s var(--ease); }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .cta-btn:hover svg { translate: 5px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .demo.is-playing { display: none; }
  .phone.is-entering, .screen-item.is-entering { animation: none; }
  .cta-btn, .ghost-btn { transition: none; }
}
