/* ═══════════════════════════════════════════════════════
   Токены
   ═══════════════════════════════════════════════════════ */
:root {
  --ground:   #0B0E0A;
  --surface:  #151A12;
  --surface-2:#1D241A;
  --line:     #2A3325;
  --ink:      #E9EFE2;
  --muted:    #7E8C77;
  --accent:   #C3F03F;
  --accent-ink:#0B0E0A;
  --moss:     #3A5A2E;

  /* Обе гарнитуры выбраны за полное покрытие кириллицы, включая украинские
     і, ї, є, ґ. Bricolage Grotesque и Instrument Sans кириллицы не содержат —
     на них русский текст молча падал в системный шрифт. */
  --display: "Unbounded", "Trebuchet MS", sans-serif;
  --body:    "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;

  --pad: clamp(20px, 5vw, 72px);
  --radius: 4px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

/* ═══════════════════════════════════════════════════════
   База
   ═══════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .35s var(--ease), color .35s var(--ease);
}

/* Мягкое зерно поверх фона — убирает «плоскость» тёмной заливки */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

main, .topbar, .foot { position: relative; z-index: 1; }

a { color: inherit; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.02;
  text-wrap: balance;
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: var(--pad);
  top: 12px;
  z-index: 10;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 14px;
  border-radius: var(--radius);
  text-decoration: none;
}

.section-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

/* Заголовок раздела, который должен цеплять взгляд, а не просто маркировать */
.section-label--lead {
  font-size: clamp(13px, 1.3vw, 16px);
  letter-spacing: .2em;
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════
   Шапка
   ═══════════════════════════════════════════════════════ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px var(--pad);
  background: color-mix(in srgb, var(--ground) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar__id {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap; /* иначе на 360px имя ломается на две строки */
  min-width: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -.01em;
}

/* Ромб раз в цикл делает оборот. Фигура симметрична к повороту на 90°,
   поэтому возврат к началу цикла не читается как рывок. */
.mark {
  width: 12px;
  height: 12px;
  flex: none;
  background: var(--accent);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  animation: mark-turn 9s var(--ease) infinite;
}
@keyframes mark-turn {
  0%, 55%   { transform: rotate(0deg)   scale(1); }
  72%       { transform: rotate(90deg)  scale(1.2); }
  88%, 100% { transform: rotate(180deg) scale(1); }
}

.topbar__nav {
  display: flex;
  gap: 26px;
  font-size: 14px;
}
.topbar__nav a {
  position: relative;
  text-decoration: none;
  color: var(--muted);
  transition: color .2s var(--ease);
}
.topbar__nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s var(--ease);
}
.topbar__nav a:hover,
.topbar__nav a.is-active { color: var(--ink); }
.topbar__nav a:hover::after,
.topbar__nav a.is-active::after { transform: scaleX(1); }

.topbar__tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang {
  display: flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 100px;
}
.lang__btn {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 100px;
  padding: 5px 10px;
  cursor: pointer;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.lang__btn:hover { color: var(--ink); }
.lang__btn.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

/* ═══════════════════════════════════════════════════════
   Хиро
   ═══════════════════════════════════════════════════════ */
.hero {
  position: relative;
  padding: clamp(48px, 9vw, 110px) var(--pad) 0;
  overflow: hidden;
}

/* Гора рисуется на canvas — см. mountain.js */
.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* Низ смыкается с фоном страницы, слева — скрим под текстовую колонку,
   иначе склон лезет под лид и мешает читать. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(to right, var(--ground) 6%, color-mix(in srgb, var(--ground) 55%, transparent) 34%, transparent 58%),
    linear-gradient(to bottom, transparent 82%, var(--ground) 99%);
}

.hero__grid, .hero .stats { position: relative; z-index: 1; }

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, .85fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: end;
}
.hero__text, .portrait { min-width: 0; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 26px;
}
/* Кружок статуса пульсирует расходящимся кольцом — знак «на связи».
   Кольцо на псевдоэлементе: анимируются transform и opacity, а не тень. */
.dot {
  position: relative;
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accent);
  animation: dot-pulse 2.6s var(--ease) infinite;
}
@keyframes dot-pulse {
  0%        { transform: scale(1);   opacity: .5; }
  70%, 100% { transform: scale(3.4); opacity: 0; }
}

.hero__title {
  /* Легче и мельче общего правила h1: заголовок лежит на горе,
     жирный кегль забивал фон и спорил с ним за внимание. */
  font-weight: 500;
  font-size: clamp(32px, 5vw, 70px);
  letter-spacing: -.015em;
  line-height: 1.08;
  margin-bottom: 28px;
  overflow-wrap: break-word;
}
.hero__title em {
  font-style: normal;
  color: var(--accent);
}

.hero__lede {
  max-width: 46ch;
  font-size: clamp(16px, 1.5vw, 19px);
  color: var(--muted);
  margin: 0 0 34px;
}

.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-block;
  padding: 13px 24px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn--solid { background: var(--accent); color: var(--accent-ink); }
.btn--ghost { border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

/* Портрет */
.portrait { margin: 0; }
.portrait__cap {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 12px;
  line-height: 1.5;
}

/* ── Пустые слоты под фото ── */
.slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  /* Пустой слот полупрозрачный: сквозь него виден фон, и хиро не распадается
     на «текст и коробка». С реальным фото слот становится плотным сам собой. */
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(3px);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  overflow: hidden;
}
/* Ступенчатый контур — отсылка к пиксельной разметке поверх ландшафта */
.slot::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .16;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72'%3E%3Cpath d='M0 54h18v-18h18v-18h18V0h18' fill='none' stroke='%23808080' stroke-width='1'/%3E%3C/svg%3E");
  background-size: 72px 72px;
  pointer-events: none;
}
.slot__label {
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .04em;
}
.slot__size {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .06em;
}
.slot--portrait { aspect-ratio: 4 / 5; }

/* ── Портрет ──────────────────────────────────────────────────
   Фон снимка не вырезан: толстовка и фон там одного цвета
   (35,33,36 против 30,30,32), по цвету их не разделить. Вместо
   вырезания растушёвываем края в прозрачность — фон снимка почти
   совпадает с фоном страницы, и рамка перестаёт читаться. */
.portrait .slot:has(img) {
  border: 0;
  background: transparent;
  backdrop-filter: none;
  overflow: visible;
  animation: portrait-float 7s ease-in-out infinite;
}
.portrait .slot img {
  /* Фон снимка вырезан моделью сегментации, прозрачность уже в самом
     файле — поэтому кадрирование не нужно, картинка вписывается целиком.
     Маска оставлена только снизу: там фигура обрезана краем кадра, и без
     растушёвки виден ровный срез. */
  object-fit: contain;
  /* Две маски перемножаются: снизу гасим срез кадра, по бокам — поднятые
     руки. Слева рука иначе перекрывает склон горы, справа кадр обрывался
     резко. Пороги 26% и 76% подобраны по снимку: за ними начинаются
     волосы и плечо, их трогать нельзя. */
  --fade-bottom: linear-gradient(to bottom, #000 72%, rgba(0,0,0,.6) 88%, transparent 100%);
  --fade-sides: linear-gradient(to right,
    transparent 2%, rgba(0,0,0,.5) 14%, #000 26%,
    #000 76%, rgba(0,0,0,.5) 88%, transparent 99%);
  mask-image: var(--fade-bottom), var(--fade-sides);
  mask-composite: intersect;
  -webkit-mask-image: var(--fade-bottom), var(--fade-sides);
  -webkit-mask-composite: source-in;
  transition: transform .6s var(--ease), filter .6s var(--ease);
}

.portrait:hover .slot img {
  transform: scale(1.02);
  filter: brightness(1.06);
}
@keyframes portrait-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

.slot img {
  width: 100%;
  height: 100%;
  /* cover не даёт скриншотам растянуться; привязка к верху важна,
     потому что у интерфейсов узнаваемая часть — шапка, а пропорции
     исходников разные (от 2.08 до 0.85). */
  object-fit: cover;
  object-position: top center;
  display: block;
}

/* Скриншот кейса открывается в просмотрщике */
.case .slot img[data-zoom] {
  cursor: zoom-in;
  transition: transform .5s var(--ease);
}
.case:hover .slot img[data-zoom] { transform: scale(1.03); }
/* Отклик на нажатие: картинка чуть подаётся внутрь */
.case .slot img[data-zoom]:active {
  transform: scale(.985);
  transition-duration: .12s;
}
.slot:has(img) {
  border-style: solid;
  background: var(--surface);
  backdrop-filter: none;
}
.slot:has(img)::after,
.slot:has(img) .slot__label,
.slot:has(img) .slot__size { display: none; }

/* Полоса показателей */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  list-style: none;
  margin: clamp(44px, 7vw, 90px) 0 0;
  padding: 0;
  background: var(--line);
  border-block: 1px solid var(--line);
}
.stats li {
  /* полупрозрачно, чтобы низ горы читался под цифрами */
  background: color-mix(in srgb, var(--ground) 74%, transparent);
  backdrop-filter: blur(7px);
  padding: 22px 4px 24px 16px;
}
.stats b {
  display: block;
  font-family: var(--display);
  font-size: clamp(28px, 3.4vw, 44px);
  font-weight: 800;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stats span {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-top: 9px;
}

/* ═══════════════════════════════════════════════════════
   Метафора
   ═══════════════════════════════════════════════════════ */
.thesis {
  padding: clamp(56px, 9vw, 110px) var(--pad) 0;
  display: grid;
  gap: 26px;
}
.thesis__quote {
  margin: 0;
  max-width: 26ch;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(21px, 3.5vw, 44px);
  line-height: 1.16;
  letter-spacing: -.025em;
  text-wrap: balance;
}
.thesis__quote em { font-style: normal; color: var(--accent); }

/* ═══════════════════════════════════════════════════════
   О себе
   ═══════════════════════════════════════════════════════ */
.about { padding: clamp(64px, 10vw, 130px) var(--pad); }

.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
  gap: clamp(28px, 5vw, 80px);
  margin-top: 28px;
}

.about__body p {
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.5;
  letter-spacing: -.01em;
  margin: 0 0 20px;
  max-width: 34ch;
}
.about__body p:last-child { margin-bottom: 0; }
.about__body p + p {
  font-size: 16px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 52ch;
}

.skills {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.skills li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  font-size: 15px;
}
.skills li:last-child { border-bottom: 1px solid var(--line); }
.skills li { transition: padding-left .25s var(--ease), color .25s var(--ease); }
.skills li:hover { padding-left: 10px; }
.skills li:hover em { color: var(--accent); }
.skills em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════
   Кейсы — горизонтальная лента
   ═══════════════════════════════════════════════════════ */
.cases { padding: 0 0 clamp(64px, 10vw, 120px); }

.cases__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 var(--pad) 20px;
}

.cases__nav { display: flex; align-items: center; gap: 10px; }

.counter {
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  margin-right: 6px;
}
.counter__sep { margin: 0 4px; opacity: .5; }

.arrow {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.arrow:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.arrow:disabled { opacity: .3; cursor: default; }

.rail {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  /* Без scroll-snap: любая привязка перехватывает промежуточные значения
     scrollLeft и отбрасывает ленту к карточке — колесо и ползунок мертвеют.
     Выравнивание делают стрелки и отпускание перетаскивания, через scrollTo. */
  scroll-padding-left: var(--pad);
  padding: 4px var(--pad) 28px;
  scrollbar-width: none;
  cursor: grab;
}
.rail::-webkit-scrollbar { display: none; }
.rail.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto;
  user-select: none;
}
.rail.is-dragging .case { pointer-events: none; }
.rail.is-seeking { scroll-behavior: auto; }

.case {
  flex: 0 0 min(560px, 84vw);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: border-color .3s var(--ease), transform .3s var(--ease);
}
.case:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  transform: translateY(-5px);
}
.case:hover .case__result b { color: var(--accent); }

.case .slot { aspect-ratio: 3 / 2; }

.case__body { padding: 0 8px; display: flex; flex-direction: column; gap: 14px; }

.case__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.case__meta span {
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 4px 10px;
}

.case h3 {
  font-size: clamp(21px, 2.4vw, 28px);
  font-weight: 600;
}

.case__task {
  font-size: 15px;
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}

.case__result {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.case__result div { display: flex; flex-direction: column; gap: 3px; }
.case__result b {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.case__result span {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Полоса под лентой — не украшение, а рабочий ползунок:
   по ней можно кликнуть и тянуть. Хит-зона расширена через ::after. */
.progress {
  position: relative;
  height: 3px;
  margin: 0 var(--pad);
  background: var(--line);
  border-radius: 3px;
  cursor: pointer;
  touch-action: none;
}
.progress::after {
  content: "";
  position: absolute;
  inset: -13px 0;
}
.progress__bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 20%;
  background: var(--accent);
  border-radius: 3px;
  transition: transform .25s var(--ease);
}
.progress.is-dragging { cursor: grabbing; }
.progress.is-dragging .progress__bar { transition: none; }
.progress:hover .progress__bar,
.progress.is-dragging .progress__bar {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent);
}

/* ═══════════════════════════════════════════════════════
   Процесс
   ═══════════════════════════════════════════════════════ */
.process {
  padding: clamp(64px, 10vw, 120px) var(--pad);
  border-top: 1px solid var(--line);
}

.steps {
  list-style: none;
  counter-reset: step;
  margin: 32px 0 0;
  padding: 0;
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.steps li {
  counter-increment: step;
  background: var(--ground);
  display: grid;
  grid-template-columns: 64px minmax(0, 260px) minmax(0, 1fr);
  gap: clamp(14px, 3vw, 40px);
  align-items: start;
  padding: 26px 22px;
  transition: background .25s var(--ease);
}
.steps li:hover { background: var(--surface); }
.steps li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  padding-top: 4px;
  transition: transform .3s var(--ease);
}
.steps li:hover::before { transform: translateX(4px); }
.steps h3 { font-size: 19px; font-weight: 600; }
.steps p { margin: 0; color: var(--muted); font-size: 15px; }

/* ═══════════════════════════════════════════════════════
   Контакты
   ═══════════════════════════════════════════════════════ */
.contact {
  padding: clamp(72px, 12vw, 150px) var(--pad);
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.contact__title {
  font-size: clamp(34px, 6vw, 82px);
  font-stretch: 92%;
  max-width: 16ch;
}
.contact__text {
  max-width: 46ch;
  color: var(--muted);
  margin: 22px 0 40px;
  font-size: 17px;
}

.links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px;
  background: var(--line);
  border-block: 1px solid var(--line);
}
.links a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  padding: 22px 20px 24px 0;
  text-decoration: none;
  transition: background .25s var(--ease), padding-left .25s var(--ease);
}
.links a:hover { background: var(--surface-2); padding-left: 14px; }
.links em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.links b {
  font-family: var(--display);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -.01em;
}

/* ═══════════════════════════════════════════════════════
   Подвал
   ═══════════════════════════════════════════════════════ */
.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px var(--pad) max(30px, env(safe-area-inset-bottom));
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--muted);
}
.foot__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}

.to-top {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  border: 1px solid var(--line);
  border-radius: 100px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  transition: border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease);
}
.to-top:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.to-top__arrow { transition: transform .25s var(--ease); }
.to-top:hover .to-top__arrow { transform: translateY(-3px); }

/* ═══════════════════════════════════════════════════════
   Появление при скролле
   ═══════════════════════════════════════════════════════ */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity .65s var(--ease) calc(var(--i, 0) * 70ms),
    transform .65s var(--ease) calc(var(--i, 0) * 70ms);
}
.reveal.is-in { opacity: 1; transform: none; }

/* Заголовки выезжают по словам из-под маски. Сам блок при этом не гасим,
   иначе анимация играет дважды и слова моргают. */
.words.reveal { opacity: 1; transform: none; }

.word {
  display: inline-block;
  overflow: hidden;
  /* запас под выносные элементы: без него у «р» и «у» срезаются хвосты */
  padding-bottom: .16em;
  margin-bottom: -.16em;
}
.word__in {
  display: inline-block;
  transform: translateY(115%);
  transition: transform .8s var(--ease) calc(var(--w, 0) * 42ms);
}
.words.is-in .word__in { transform: none; }

/* Раздел, к которому идёт переход по меню: пока едем — слегка утоплен,
   на месте возвращается вместе со своим появлением */
section[id] { scroll-margin-top: 76px; }
.is-target {
  transform: scale(.994);
  transition: transform .45s var(--ease);
}

/* Список появляется целиком, задержку несёт каждый элемент */
.stagger > * {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity .6s var(--ease) calc(var(--i, 0) * 70ms),
    transform .6s var(--ease) calc(var(--i, 0) * 70ms);
}
.stagger.is-in > * { opacity: 1; transform: none; }

/* Изображение проявляется отдельно от карточки: карточка поднимается,
   а скриншот внутри чуть позже оседает из увеличения. */
.rail .case .slot img {
  opacity: 0;
  transform: scale(1.06);
  transition:
    opacity .7s var(--ease) calc(var(--i, 0) * 70ms + 140ms),
    transform .9s var(--ease) calc(var(--i, 0) * 70ms + 140ms);
}
.rail.is-in .case .slot img { opacity: 1; transform: none; }

/* Подмена языка: текст уходит и возвращается, а не щёлкает мгновенно */
main {
  transition: opacity .19s var(--ease), transform .19s var(--ease);
}
main.is-swapping {
  opacity: 0;
  transform: translateY(8px);
}

/* ═══════════════════════════════════════════════════════
   Просмотр скриншота
   ═══════════════════════════════════════════════════════ */
.lightbox {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: clamp(16px, 4vw, 56px);
  border: 0;
  background: transparent;
  overflow: hidden;
}
.lightbox::backdrop {
  background: color-mix(in srgb, #050704 88%, transparent);
  backdrop-filter: blur(6px);
}
.lightbox[open]::backdrop { animation: backdrop-in .3s var(--ease); }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
.lightbox[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  /* contain: в просмотрщике важна читаемость интерфейса, а не заполнение */
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  /* Появление задаёт JS: картинка вылетает из своей карточки и возвращается
     в неё при закрытии. Ключевые кадры здесь только помешали бы перелёту. */
}
.lightbox__close {
  position: fixed;
  top: clamp(12px, 3vw, 28px);
  right: clamp(12px, 3vw, 28px);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--ground);
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.lightbox__close:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* ═══════════════════════════════════════════════════════
   Адаптив
   ═══════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .hero__grid,
  .about__grid { grid-template-columns: 1fr; }
  .hero__title { font-size: clamp(30px, 8vw, 52px); }
  /* В одну колонку текст не соседствует с горой — боковой скрим только мешает */
  .hero::after { background: linear-gradient(to bottom, transparent 84%, var(--ground) 99%); }
  .portrait { max-width: 340px; }
  .steps li { grid-template-columns: 40px 1fr; }
  .steps li p { grid-column: 2; }
}

/* Навигация держится дольше макета: на планшете 768 для неё ещё есть место */
@media (max-width: 860px) {
  .topbar { gap: 14px; }
  .topbar__nav { gap: 16px; font-size: 13px; }
}
@media (max-width: 720px) {
  .topbar__nav { display: none; }
}

/* На телефоне подпись темы не помещается в строку с языками — оставляем значок */
@media (max-width: 540px) {
  .topbar { padding-inline: 16px; gap: 10px; }
  .topbar__id { font-size: 14px; }
  .lang__btn { padding: 9px 10px; }
}

/* Пальцем в 24-пиксельную кнопку не попасть */
@media (pointer: coarse) {
  .lang__btn { padding: 11px 14px; }
  .arrow { width: 46px; height: 46px; }
  .to-top { padding: 14px 22px; }
  .topbar__nav a { padding: 6px 0; }
}

/* Системная настройка «уменьшить движение» убирает ДВИЖЕНИЕ — сдвиги,
   выезды, плавную прокрутку. Плавное проявление остаётся: глушить заодно
   и его значит оставить сайт полностью статичным, чего настройка не просит. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .reveal { transform: none; transition: opacity .45s var(--ease) calc(var(--i, 0) * 50ms); }
  .stagger > * { transform: none; transition: opacity .45s var(--ease) calc(var(--i, 0) * 50ms); }

  /* Слова не выезжают, а проявляются на месте */
  .word { overflow: visible; }
  .word__in {
    transform: none;
    opacity: 0;
    transition: opacity .5s var(--ease) calc(var(--w, 0) * 22ms);
  }
  .words.is-in .word__in { opacity: 1; }

  .rail .case .slot img { transform: none; transition: opacity .45s var(--ease); }
  .case:hover .slot img[data-zoom] { transform: none; }
  .lightbox__img { animation: none; }
  main.is-swapping { opacity: 1; transform: none; }
  .case .slot img[data-zoom]:active { transform: none; }
  .portrait .slot:has(img) { animation: none; }
  .portrait:hover .slot img { transform: none; }
  .mark, .dot::after { animation: none; }
  .dot::after { opacity: 0; }
  .is-target { transform: none; }
  .case:hover { transform: none; }
  .to-top:hover .to-top__arrow { transform: none; }
  .steps li:hover::before { transform: none; }
  .btn:hover { transform: none; }
}
