/* =========================================================================
   Рафаэль — веб-разработчик
   Один лист: бумага, тушь, линейки, одна шкала. Только чёрное, белое и серые линии.
   ========================================================================= */

/* ---------- 1. Токены ---------------------------------------------------- */
:root {
  --paper: #FDFDFC;
  --ink: #0F0F0D;
  --ink-lead: #1A1A1A;
  --ink-2: #55554E;
  --ink-3: #6E6E65;
  --rule: #DAD9D2;
  --stage: #0F0F0D;
  --stage-ink: #F5F4EF;
  --stage-rule: rgba(245, 244, 239, 0.22);
  --stage-dim: rgba(245, 244, 239, 0.62);
  --nav-h: 52px;
  --nav-top: calc(var(--nav-h) + env(safe-area-inset-top, 0px));

  --serif: 'Literata', Georgia, 'Times New Roman', serif;
  --sans: 'Golos Text', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --gutter: clamp(20px, 4.6vw, 56px);
  --shell: 1400px;
  /* внутренний отступ колонок титульного блока; к нему же привязана кнопка */
  --tb-inset: 24px;

  --t-hero: clamp(3.6rem, 21vw, 18rem);
  --t-h2: clamp(1.9rem, 1.1rem + 3.4vw, 3.4rem);
  --t-h3: clamp(1.25rem, 1.02rem + 1vw, 1.7rem);
  --t-lead: clamp(1.0625rem, 0.62rem + 0.95vw, 1.35rem);
  --t-body: clamp(0.975rem, 0.94rem + 0.2vw, 1.0625rem);
  --t-small: 0.9375rem;
  --t-label: 0.875rem;

  --sp-section: clamp(60px, 8vw, 120px);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- 2. База ------------------------------------------------------ */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-top) + 12px);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.025em;
  font-optical-sizing: auto;
}

p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
::selection { background: var(--ink); color: var(--paper); }

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

/* на светлой бумаге кольцо фокуса должно быть тёмным, даже внутри чёрной
   или голубой кнопки */
.btn:focus-visible,
.tg:focus-visible,
.skip:focus-visible { outline-color: var(--ink); }

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.nw { white-space: nowrap; }

/* заглушки: заметные, но не выпадающие из макета */
.ph {
  color: var(--ink-3);
  text-decoration: underline dashed rgba(110, 110, 101, 0.6);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.skip {
  position: absolute;
  top: 12px;
  left: 16px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  font-size: var(--t-small);
  transform: translateY(-180%);
  transition: transform 0.2s var(--ease);
}
.skip:focus-visible { transform: none; }

/* ---------- 2a. Навигация ------------------------------------------------ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(253, 253, 252, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease),
    border-color 0.3s var(--ease);
}

/* над чёрной сценой шапка становится тёмной (класс ставит main.js) */
.nav--dark {
  background: rgba(15, 15, 13, 0.92);
  border-bottom-color: var(--stage-rule);
  color: var(--stage-ink);
}

.nav-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: var(--nav-h);
}

.nav-brand {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  /* значок стоит по левому краю полей страницы, хотя зона нажатия шире.
     −11 px = −9 px зоны нажатия и ещё 2 px, на которые рамка SVG отступает
     внутрь: так её штрих встаёт на ту же линию, что «П» и абзац. */
  margin-left: -11px;
}

.nav-mark { width: 26px; height: 26px; }

/* центр знака — квадрат-«метка»: при наведении поворачивается в ромб */
.nav-mark-dot {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  transition: transform 0.5s var(--ease);
}

.nav-brand:hover .nav-mark-dot,
.nav-brand:focus-visible .nav-mark-dot { transform: rotate(45deg); }

.nav-links {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.875rem;
  font-weight: 500;
}

.nav-links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.nav-links a:not(.nav-cta)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 9px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease);
}

.nav-links a:not(.nav-cta):hover::after,
.nav-links a:not(.nav-cta):focus-visible::after { transform: scaleX(1); }

.nav-cta {
  min-height: 0 !important;
  padding: 8px 14px;
  border: 1px solid currentColor;
  border-radius: 1px;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.nav-cta:hover,
.nav-cta:focus-visible { background: var(--ink); color: var(--paper); }
.nav-cta:active { transform: translateY(1px); }
.nav--dark .nav-cta:hover,
.nav--dark .nav-cta:focus-visible { background: var(--stage-ink); color: var(--stage); }

.nav :focus-visible { outline-color: currentColor; outline-offset: 3px; }

@media (min-width: 560px) {
  .nav-brand { display: flex; }
  .nav-links { flex: none; justify-content: flex-end; gap: clamp(20px, 3vw, 40px); }
}

/* 320–359 px: ссылки шире полосы на несколько пикселей и «Обо мне»
   переносилось на две строки. Убираем перенос и чуть поджимаем зазоры. */
@media (max-width: 359px) {
  .nav-links { gap: 8px; }
  .nav-links a { white-space: nowrap; }
  .nav-cta { padding: 8px 10px; }
}

/* ---------- 3. Измерительная шкала -------------------------------------- */
/* Шкала — не декор: по ней видно, где мы на странице. Поэтому у неё есть
   ось, мелкие и крупные деления, а голова шкалы — точка с полем-ореолом. */
.ruler {
  display: none;
  position: fixed;
  left: clamp(8px, 1.2vw, 20px);
  top: 50%;
  width: 14px;
  height: min(46vh, 380px);
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 5;
  /* тонкая ось на всю высоту */
  background: linear-gradient(
    to right,
    transparent 0 1px,
    rgba(15, 15, 13, 0.18) 1px 2px,
    transparent 2px 100%
  );
}

/* мелкое деление каждые 21 px */
.ruler::before,
.ruler::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 3px;
}

.ruler::before {
  width: 6px;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(15, 15, 13, 0.34) 0 1px,
    transparent 1px 21px
  );
}

/* каждое пятое — длиннее и темнее: шкалу можно считать */
.ruler::after {
  width: 11px;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(15, 15, 13, 0.58) 0 1px,
    transparent 1px 105px
  );
}

.ruler-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 100%;
  background: var(--ink);
  transform: scaleY(0);
  transform-origin: top;
}

.ruler-dot {
  position: absolute;
  top: -3px;
  left: -2.5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 3px var(--paper);
}

@media (min-width: 1024px) {
  html.js-anim .ruler { display: block; }
}

/* на чёрной сцене шкала переворачивается в светлую — без анимации цвета */
.ruler--on-dark {
  background: linear-gradient(
    to right,
    transparent 0 1px,
    rgba(245, 244, 239, 0.3) 1px 2px,
    transparent 2px 100%
  );
}

.ruler--on-dark::before {
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(245, 244, 239, 0.46) 0 1px,
    transparent 1px 21px
  );
}

.ruler--on-dark::after {
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(245, 244, 239, 0.72) 0 1px,
    transparent 1px 105px
  );
}

.ruler--on-dark .ruler-line { background: var(--stage-ink); }
.ruler--on-dark .ruler-dot {
  background: var(--stage-ink);
  box-shadow: 0 0 0 3px var(--stage);
}

/* ---------- 4. Hero ------------------------------------------------------ */
.hero {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
}

.hero-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(40px, 8vh, 96px);
  padding-top: clamp(64px, 12vh, 132px);
  padding-bottom: clamp(28px, 5vh, 56px);
}

/* Маска для появления заголовка. Окно маски должно быть выше строки:
   у антиквы «ф», «у», «д», «р» уходят ниже базовой линии, и при плотном
   line-height их срезало по прямой линии. Поэтому снизу добавлен запас
   (--mask-bleed), а отрицательный отступ возвращает прежнее расстояние
   между блоками: вёрстка сдвигается ровно на ноль. */
.mask {
  display: block;
  overflow: hidden;
  --mask-bleed: 0.25em;
  padding-bottom: var(--mask-bleed);
  margin-bottom: calc(-1 * var(--mask-bleed));
}

.mask-in { display: block; }

.hero-name {
  display: flow-root;
  font-size: var(--t-hero);
  line-height: 1;
  letter-spacing: -0.05em;
  /* Оптическая компенсация: у «П» слева есть полуапрош. Сдвигаем заголовок
     на его величину, чтобы вертикальный штрих встал на одну линию
     с логотипом в шапке и текстом абзаца. */
  margin-left: -0.05em;
}

/* Настоящий текст, который печатается: без JS виден целиком */
.hero-type {
  display: inline-block;
  white-space: nowrap;
}

/* Курсор печатной машинки: стоит на базовой линии, высотой с прописную */
.hero-caret {
  display: inline-block;
  width: clamp(3px, 0.05em, 5px);
  height: 0.85em;
  margin-left: 0.01em;
  background: currentColor;
  vertical-align: baseline;
  pointer-events: none;
}

.hero-foot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(20px, 3vh, 32px);
}

.hero-lead {
  max-width: 560px;
  font-size: var(--t-lead);
  line-height: 1.55;
  color: var(--ink-lead);
  text-wrap: pretty;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 30px;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 1px;
  font-size: var(--t-small);
  font-weight: 500;
  letter-spacing: 0.005em;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease,
    transform 0.25s ease;
}

/* инверсия: чёрное поле становится бумагой, текст — тушью */
.btn:hover,
.btn:focus-visible {
  background: var(--paper);
  color: var(--ink);
  transform: translateY(-2px);
}

.btn:active { transform: translateY(0); }

/* титульный блок — как на чертеже */
.titleblock {
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-top: 1px solid var(--rule);
}

.titleblock-shell { display: grid; grid-template-columns: 1fr; }

/* На телефоне блок читается строкой спецификации: подпись в узкой
   колонке, значение — в широкой. Так 24 px воздуха сверху и снизу
   помещаются на экран 375 × 667 без обрезки. */
.tb-field {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: baseline;
  column-gap: 12px;
  padding-block: 24px;
  border-bottom: 1px solid var(--rule);
}

.tb-field:last-child { border-bottom: 0; }

.tb-label { font-size: var(--t-label); color: var(--ink-3); }
.tb-value { font-size: var(--t-small); color: var(--ink); }

.tb-link {
  display: inline-flex;
  align-items: baseline;
  gap: 0.18em;
  width: fit-content;
}

/* подчёркивание — на самом тексте, а не на всей ссылке: иначе линия
   тянется через зазор к стрелке и выглядит обрывком */
.tb-link-text {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--rule);
  text-underline-offset: 4px;
  transition: text-decoration-color 0.25s ease;
}

.tb-link::after {
  content: "↗";
  font-size: 0.95em;
  line-height: 1;
  color: var(--ink-3);
  opacity: 0;
  transform: translate(-3px, 3px);
  transition: opacity 0.25s ease, transform 0.25s ease, color 0.25s ease;
}

.tb-link:hover .tb-link-text,
.tb-link:focus-visible .tb-link-text { text-decoration-color: currentColor; }

.tb-link:hover::after,
.tb-link:focus-visible::after {
  opacity: 1;
  transform: none;
  color: var(--ink);
}

@media (min-width: 720px) {
  /* Одна сетка на всю первую экранную полосу: три равные колонки.
     Абзац занимает первые две, кнопка встаёт в третью — ровно над
     колонкой Telegram. */
  .hero-foot {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
    gap: 0;
  }
  .hero-lead { grid-column: 1 / span 2; }
  .hero-foot .btn {
    grid-column: 3;
    justify-self: start;
    margin-left: var(--tb-inset);
  }

  .titleblock-shell { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tb-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 26px var(--tb-inset);
    border-bottom: 0;
    /* линия — тенью, а не border: она не съедает пиксель у padding,
       поэтому текст Telegram и кнопка стоят на одной вертикали */
    box-shadow: inset 1px 0 0 var(--rule);
  }
  .tb-field:first-child { padding-left: 0; box-shadow: none; }
}

/* На телефоне первая экранная полоса должна вмещать титульный блок
   целиком: 375 × 667 — это контрольный размер. */
@media (max-width: 719px) {
  .hero-shell {
    padding-top: 60px;
    padding-bottom: 20px;
  }
}

/* ---------- 5. Сцена: закреплённый макет -------------------------------- */
.stage {
  --stage-pad: clamp(24px, 6vh, 64px);
  position: relative;
  /* Чёрный фон занимает полную высоту экрана (lvh): когда на телефоне
     сворачивается адресная строка, снизу не остаётся светлой полосы. */
  height: 100vh;
  height: 100lvh;
  background: var(--stage);
  color: var(--stage-ink);
  overflow: hidden;
}

/* А содержимое сцены считается от малой высоты (svh), поэтому подписи
   внизу не прячутся под адресной строкой, пока она на месте. */
.stage-inner {
  position: relative;
  height: 100vh;
  height: 100svh;
}

.stage::before,
.stage-inner::after {
  content: "";
  position: absolute;
  background: rgba(245, 244, 239, 0.09);
  pointer-events: none;
}

.stage::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.stage-inner::after {
  top: calc(var(--nav-top) + (100% - var(--nav-top) - var(--stage-pad)) / 2);
  left: 0;
  right: 0;
  height: 1px;
}

.stage-head {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: calc(var(--nav-top) + clamp(12px, 2.4vh, 24px));
  font-size: var(--t-label);
  color: var(--stage-dim);
  z-index: 2;
}

.stage-scale {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.stage-scale-value { color: var(--stage-ink); }

.stage-phone {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  /* телефон центруется между шапкой и шкалой внизу */
  padding-top: var(--nav-top);
  padding-bottom: var(--stage-pad);
  z-index: 1;
}

.phone {
  position: relative;
  height: min(56vh, 560px);
  height: min(56svh, 560px);
  aspect-ratio: 9 / 19.2;
  padding: clamp(4px, 0.7vw, 7px);
  background: #F1F0E9;
  border-radius: clamp(16px, 2.6vw, 26px);
  box-shadow: 0 0 0 1px rgba(245, 244, 239, 0.16);
}

.phone-screen {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  border-radius: calc(clamp(16px, 2.6vw, 26px) - clamp(4px, 0.7vw, 7px));
  container-type: inline-size;
}

.phone-notch {
  position: absolute;
  top: calc(clamp(4px, 0.7vw, 7px) + 7px);
  left: 50%;
  width: 24%;
  height: 5px;
  border-radius: 99px;
  background: var(--ink);
  opacity: 0.9;
  transform: translateX(-50%);
}

/* мини-сайт внутри экрана: всё в cqw, поэтому масштабируется вместе с рамкой.
   Первые значения — запасные для браузеров без container queries. */
.mini {
  display: flex;
  flex-direction: column;
  gap: 9px;
  gap: 3.4cqw;
  height: 100%;
  padding: 22px 12px 12px;
  padding: 8.5cqw 4.4cqw 4.6cqw;
  font-size: 9px;
  font-size: 3.75cqw;
  line-height: 1.4;
  color: var(--ink);
}

.mini-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74em;
  color: var(--ink-2);
}

.mini-menu { color: var(--ink-3); }

.mini-hero { margin-top: 1.2cqw; }

.mini-kicker {
  font-size: 0.68em;
  color: var(--ink-3);
  margin-bottom: 1.4cqw;
}

.mini-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 2.45em;
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.mini-shot {
  position: relative;
  flex: 1;
  min-height: 24cqw;
  display: grid;
  place-items: center;
  border: 1px solid rgba(15, 15, 13, 0.12);
  background-color: #F0EFE8;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(15, 15, 13, 0.09) 0 1px,
    transparent 1px 7px
  );
}

.mini-shot-label {
  font-size: 0.62em;
  color: var(--ink-3);
  background: var(--paper);
  padding: 0.2em 0.5em;
}

.mini-rows { display: flex; flex-direction: column; gap: 1.5cqw; }
.mini-rows span {
  display: block;
  height: 1.6cqw;
  background: rgba(15, 15, 13, 0.16);
}
.mini-rows span:nth-child(1) { width: 100%; }
.mini-rows span:nth-child(2) { width: 86%; }
.mini-rows span:nth-child(3) { width: 58%; }

.mini-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 2.6cqw;
  border-top: 1px solid var(--rule);
  font-size: 0.72em;
  color: var(--ink-2);
}

.mini-mark {
  width: 1.4em;
  height: 1.4em;
  border: 1px solid var(--ink);
  border-radius: 50%;
}

.stage-foot {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: calc(clamp(20px, 4vh, 40px) + env(safe-area-inset-bottom, 0px));
  z-index: 2;
}

.scale-track {
  position: relative;
  width: min(360px, 82%);
  height: 26px;
  border-top: 1px solid var(--stage-rule);
}

.scale-mark {
  position: absolute;
  top: -3.5px;
  left: 0;
  width: 7px;
  height: 7px;
  background: var(--stage-ink);
}

.scale-track-label {
  position: absolute;
  top: 9px;
  left: 0;
  font-size: 0.75rem;
  color: var(--stage-dim);
  font-variant-numeric: tabular-nums;
}

.scale-track-label--end { left: auto; right: 0; }

/* нижняя строка: подсказка в начале, дальше её место занимают подписи */
.stage-line { display: grid; }

.stage-hint,
.stage-captions { grid-area: 1 / 1; }

.stage-hint {
  font-size: var(--t-label);
  color: rgba(245, 244, 239, 0.62);
  transition: opacity 0.3s var(--ease);
}

.stage-captions { display: grid; }

.stage-cap {
  grid-area: 1 / 1;
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.25;
  color: var(--stage-ink);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
}

.stage-cap-num {
  font-family: var(--sans);
  font-size: var(--t-label);
  font-weight: 400;
  letter-spacing: 0;
  color: var(--stage-dim);
  font-variant-numeric: tabular-nums;
}

.stage[data-step]:not([data-step="0"]) .stage-hint { opacity: 0; }

.stage[data-step="1"] .stage-cap:nth-child(1),
.stage[data-step="2"] .stage-cap:nth-child(2),
.stage[data-step="3"] .stage-cap:nth-child(3) {
  opacity: 1;
  transform: none;
}

html:not(.js-anim) .scale-mark,
html:not(.js-anim) .scale-track,
html:not(.js-anim) .stage-line { display: none; }

@media (min-width: 720px) {
  .stage-foot { align-items: center; }
  .stage-hint { text-align: center; }
  .stage-cap { justify-content: center; }
}

/* Широкий экран: телефон растёт почти на всю высоту, а подписи и шкала
   уходят влево, на пустую часть сцены. */
@media (min-width: 900px) and (min-aspect-ratio: 11/10) {
  .stage { --stage-pad: 0px; }

  .phone {
    height: min(60vh, 600px);
    height: min(60svh, 600px);
  }

  .stage-foot {
    top: 0;
    align-items: flex-start;
    justify-content: flex-end;
  }

  .stage-hint { text-align: left; }

  .stage-captions {
    position: absolute;
    left: max(var(--gutter), env(safe-area-inset-left, 0px));
    top: 50%;
    width: max-content;
    max-width: min(16em, calc(45vw - 22vh - 13px - max(0px, (100vw - 1400px) / 2)));
    transform: translateY(-50%);
    font-size: clamp(1.25rem, 1.9vw, 2.1rem);
  }

  .stage-cap {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    font-size: inherit;
    line-height: 1.15;
  }
}

/* ---------- 6. Секции ---------------------------------------------------- */
.section { padding-block: var(--sp-section); }
.section + .section { border-top: 1px solid var(--rule); }

.section-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }

.section-margin {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.section-label { font-size: var(--t-label); color: var(--ink-2); }
.section-meta { font-size: var(--t-label); color: var(--ink-3); }

.section-title {
  display: flow-root;
  font-size: var(--t-h2);
  line-height: 1.06;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

@media (min-width: 960px) {
  .section-grid {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: clamp(32px, 4vw, 64px);
  }
  .section-margin {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    position: sticky;
    top: 96px;
    align-self: start;
  }
}

/* ---------- 7. Услуги ---------------------------------------------------- */
.services {
  margin-top: clamp(26px, 4vw, 44px);
  border-top: 1px solid var(--rule);
}

.service {
  display: grid;
  gap: 6px;
  padding-block: clamp(18px, 2.4vw, 28px);
  border-bottom: 1px solid var(--rule);
}

.service-name { font-size: var(--t-h3); line-height: 1.15; }

.service-text {
  color: var(--ink-2);
  font-size: var(--t-body);
  max-width: 46ch;
}

@media (min-width: 720px) {
  .service {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 32px;
  }
}

/* ---------- 8. Кейсы ----------------------------------------------------- */
.cases {
  margin-top: clamp(26px, 4vw, 44px);
  border-top: 1px solid var(--rule);
}

.case {
  display: grid;
  gap: clamp(16px, 2vw, 24px);
  padding-block: clamp(24px, 3vw, 40px);
  border-bottom: 1px solid var(--rule);
}

.case-name {
  font-size: clamp(1.4rem, 2.5vw, 2.1rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.case-name.ph { text-decoration: none; }

.case-kind {
  margin-top: 8px;
  font-size: var(--t-small);
  color: var(--ink-2);
}

.case-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px 24px;
  margin: 0;
}

.case-item dt {
  margin-bottom: 4px;
  font-size: var(--t-label);
  color: var(--ink-3);
}

.case-item dd {
  margin: 0;
  font-size: var(--t-small);
  line-height: 1.55;
  max-width: 34ch;
}

@media (min-width: 560px) {
  .case-meta { grid-template-columns: 1fr 1fr; }
  .case-item--year { grid-column: span 2; }
}

@media (min-width: 900px) {
  .case { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px; }
  .case-meta { grid-template-columns: 1fr 1fr auto; }
  .case-item--year { grid-column: auto; }
}

/* ---------- 9. Обо мне и этапы ------------------------------------------ */
.about { display: grid; gap: clamp(36px, 5vw, 72px); }

.about-lead {
  margin-top: clamp(20px, 3vw, 32px);
  font-size: var(--t-lead);
  line-height: 1.4;
  max-width: 32ch;
}

.about-ph {
  margin-top: 18px;
  font-size: var(--t-small);
  line-height: 1.55;
  max-width: 54ch;
}

.about-text {
  margin-top: 18px;
  color: var(--ink-2);
  max-width: 52ch;
}

.process-title {
  margin-bottom: 16px;
  font-family: var(--sans);
  font-size: var(--t-label);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-2);
}

.steps { border-top: 1px solid var(--rule); }

.step {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: 12px;
  padding-block: 15px;
  border-bottom: 1px solid var(--rule);
}

.step-num {
  padding-top: 3px;
  font-size: var(--t-label);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.step-name {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.3;
}

.step-text {
  margin-top: 3px;
  font-size: var(--t-small);
  color: var(--ink-2);
  max-width: 42ch;
}

@media (min-width: 1024px) {
  .about {
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
    gap: clamp(40px, 5vw, 88px);
  }
  /* выравниваем подпись процесса по верхнему краю заголовка-антиквы */
  .process { margin-top: 11px; }
}

/* ---------- 10. Контакты ------------------------------------------------- */
.contact-title {
  font-size: clamp(2.3rem, 6.6vw, 4.6rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.contact-text {
  margin-top: clamp(16px, 2vw, 22px);
  max-width: 42ch;
  color: var(--ink-2);
}

.tg {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 18px;
  min-height: 60px;
  margin-top: clamp(26px, 4vw, 44px);
  padding: 14px 24px 14px 28px;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 1px;
  font-size: clamp(1rem, 0.95rem + 0.12vw, 1.0625rem);
  font-weight: 500;
  letter-spacing: -0.005em;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.35s var(--ease), color 0.3s var(--ease) 0.06s;
  -webkit-tap-highlight-color: transparent;
}

/* при наведении чёрная кнопка «проявляется» в белую с чёрной линией */
.tg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--paper);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease);
}

.tg:hover,
.tg:focus-visible {
  color: var(--ink);
  transform: translateY(-2px);
}

.tg:hover::before,
.tg:focus-visible::before { transform: scaleX(1); }

.tg-label { position: relative; }

.tg-icon {
  position: relative;
  flex: none;
  width: 26px;
  height: 26px;
}

/* svg обрезает всё, что выходит за его рамку, поэтому самолётик
   «вылетает» из значка и возвращается с другой стороны */
.tg-icon svg { width: 100%; height: 100%; }
.tg-plane { fill: currentColor; }

.tg:hover .tg-plane,
.tg:focus-visible .tg-plane { animation: tg-fly 1.1s linear 1; }

@keyframes tg-fly {
  0%    { transform: translate(0, 0); opacity: 1; animation-timing-function: cubic-bezier(0.55, 0, 0.9, 0.5); }
  44%   { transform: translate(22px, -22px); opacity: 1; }
  44.1% { transform: translate(22px, -22px); opacity: 0; }
  45%   { transform: translate(-22px, 22px); opacity: 0; }
  45.1% { transform: translate(-22px, 22px); opacity: 1; animation-timing-function: cubic-bezier(0.2, 0.7, 0.25, 1); }
  100%  { transform: translate(0, 0); opacity: 1; }
}

.contact-note {
  margin-top: 16px;
  font-size: var(--t-small);
  color: var(--ink-2);
}

.contact-mail {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--rule);
  transition: text-decoration-color 0.3s var(--ease);
}

.contact-mail:hover,
.contact-mail:focus-visible { text-decoration-color: currentColor; }

/* ---------- 11. Подвал --------------------------------------------------- */
.footer {
  padding-block: 20px calc(30px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--rule);
}

.footer-shell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  justify-content: space-between;
  font-size: var(--t-label);
  color: var(--ink-3);
}

/* ---------- 12. Стартовые состояния анимаций ---------------------------- */
/* Заголовок первого экрана не выезжает из-под маски: его печатает main.js.
   До начала печати он обрезан справа, курсор скрыт — на странице нет
   «прыжка» целого слова перед анимацией. */
.js-anim .hero-type { clip-path: inset(-0.3em 100% -0.3em 0); }
.js-anim .hero-caret { opacity: 0; }

.js-anim .hero-name.is-typing .hero-caret,
.js-anim .hero-name.is-typed .hero-caret { opacity: 1; }

.hero-name.is-typed .hero-type { clip-path: none; }

/* После печати курсор не исчезает, а дышит на месте: пауза в начале
   и в конце цикла, чтобы мигание читалось как спокойное, а не нервное. */
.js-anim .hero-name.is-typed .hero-caret {
  animation: caret-blink 1.05s var(--ease) 0.4s infinite;
}

@keyframes caret-blink {
  0%, 40% { opacity: 1; }
  50%, 90% { opacity: 0; }
  100% { opacity: 1; }
}

.js-anim .js-intro {
  opacity: 0;
  transform: translateY(16px);
}

/* ---------- 13. Reduced motion и печать --------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .js-anim .hero-name.is-typed .hero-caret { animation: none; }
  .js-anim .js-intro { opacity: 1; transform: none; }
}

@media print {
  .ruler, .nav, .stage-line, .scale-track { display: none !important; }
  .stage, .stage-inner { height: auto; }
  .stage { padding-block: 40px; }
  body { background: #fff; }
}
