:root {
  --bg: #07061a;
  --white: #fff;
  --muted: rgba(255, 255, 255, .55);
  --line: rgba(255, 255, 255, .14);
  --edge: #04030e;         /* колір затемнення країв на мобільному */
  --accent: #2438ff;       /* синій, як рефлекс на персонажі */
  --accent-light: #7b8cff; /* світліший синій для тексту */
  --pad: clamp(20px, 2.75vw, 56px);
  --side: clamp(160px, 16vw, 320px); /* ширина колонки навігації на внутрішніх сторінках */
  --f-head: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Inter", "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .7, .1, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { background: var(--bg); }
body {
  background: var(--bg);
  color: var(--white);
  font-family: var(--f-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

/* ---------- Фонове відео ---------- */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--bg); }
.bg__video { width: 100%; height: 100%; object-fit: cover; }
.bg__shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(7,6,26,0) 45%, rgba(7,6,26,.55) 100%),
    linear-gradient(90deg, rgba(7,6,26,.35) 0%, rgba(7,6,26,0) 35%);
}

/* Сині відблиски поверх відео — ледь «дихають» */
.bg__glow {
  position: absolute; border-radius: 50%;
  mix-blend-mode: screen; pointer-events: none;
  animation: glow 9s ease-in-out infinite alternate;
}
.bg__glow--1 { /* за персонажем, праворуч */
  width: 46vw; height: 46vw; right: 2vw; top: 22vh;
  background: radial-gradient(closest-side, rgba(36, 60, 255, .42), rgba(36, 60, 255, 0));
}
.bg__glow--2 { /* ліворуч над заголовком */
  width: 30vw; height: 30vw; left: -6vw; top: 40vh;
  background: radial-gradient(closest-side, rgba(40, 90, 255, .22), rgba(40, 90, 255, 0));
  animation-delay: -4s;
}
@keyframes glow { from { opacity: .65; } to { opacity: 1; } }

/* ---------- Фон внутрішніх сторінок ----------
   Великі м'які радіальні плями без filter: blur (дешевше для GPU),
   кожна повільно пливе по своїй траєкторії — кольори змішуються й переливаються. */
.aurora {
  position: absolute; inset: 0; overflow: hidden;
  background: var(--bg);
  opacity: 0; visibility: hidden;
  transition: opacity 1s var(--ease), visibility 1s;
}
body.is-page .aurora { opacity: 1; visibility: visible; }
body.is-page .bg__glow { animation: none; }

.aurora i {
  position: absolute; width: 75vmax; height: 75vmax; border-radius: 50%;
  mix-blend-mode: screen; will-change: transform;
  animation: drift 26s ease-in-out infinite alternate;
  animation-play-state: paused;
}
body.is-page .aurora i { animation-play-state: running; }

.aurora i:nth-child(1) { /* синій */
  left: -20vmax; top: -25vmax;
  background: radial-gradient(closest-side, rgba(36, 56, 255, .75), rgba(36, 56, 255, 0));
  --x: 30vw; --y: 25vh; --s: 1.2;
}
.aurora i:nth-child(2) { /* фіолетовий */
  right: -25vmax; top: -10vmax;
  background: radial-gradient(closest-side, rgba(118, 40, 255, .65), rgba(118, 40, 255, 0));
  --x: -35vw; --y: 30vh; --s: .85;
  animation-duration: 32s; animation-delay: -8s;
}
.aurora i:nth-child(3) { /* блакитний */
  left: 10vw; bottom: -40vmax;
  background: radial-gradient(closest-side, rgba(0, 160, 255, .5), rgba(0, 160, 255, 0));
  --x: 25vw; --y: -30vh; --s: 1.1;
  animation-duration: 22s; animation-delay: -14s;
}
.aurora i:nth-child(4) { /* пурпуровий акцент */
  right: -10vmax; bottom: -35vmax;
  background: radial-gradient(closest-side, rgba(200, 40, 210, .38), rgba(200, 40, 210, 0));
  --x: -30vw; --y: -20vh; --s: 1.25;
  animation-duration: 29s; animation-delay: -4s;
}
.aurora i:nth-child(5) { /* глибокий індиго по центру */
  left: 25vw; top: 20vh; width: 55vmax; height: 55vmax;
  background: radial-gradient(closest-side, rgba(60, 20, 160, .6), rgba(60, 20, 160, 0));
  --x: -20vw; --y: 15vh; --s: 1.3;
  animation-duration: 35s; animation-delay: -20s;
}
@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(calc(var(--x) * .6), calc(var(--y) * -.4)) scale(calc(var(--s) * .9)); }
  100% { transform: translate(var(--x), var(--y)) scale(var(--s)); }
}
/* Затемнення зверху, щоб текст читався */
.aurora::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(120% 90% at 50% 40%, rgba(7, 6, 26, .15), rgba(7, 6, 26, .55)),
    rgba(7, 6, 26, .2);
}

@media (prefers-reduced-motion: reduce) { .bg__glow, .aurora i { animation: none; } }

/* ---------- Постійні елементи ---------- */
.logo {
  position: fixed; z-index: 20;
  top: var(--pad); left: var(--pad);
  display: flex; flex-direction: column;
  font-family: var(--f-head); font-weight: 700;
  font-size: 15px; line-height: 1.5;
}
.logo__small { font-weight: 400; font-size: 13px; }

.lang {
  position: fixed; z-index: 20;
  top: var(--pad); right: var(--pad);
  display: flex; gap: 6px; font-size: 16px;
}
.lang button { color: var(--muted); transition: color .3s; }
.lang button.is-active, .lang button:hover { color: var(--white); }

/* Меню прибите знизу: стоїть над заголовком (його висота = pad + 1.774 × --tfs)
   і тому опускається нижче диму на відео */
.nav {
  position: fixed; z-index: 20;
  left: var(--pad);
  bottom: calc(var(--pad) + var(--tfs) * 1.774 + clamp(40px, 9vh, 110px));
  display: flex; flex-direction: column; gap: clamp(16px, 2.4vh, 26px);
  font-size: 16px; text-transform: uppercase; letter-spacing: .01em;
}
.nav a {
  color: var(--muted);
  text-shadow: 0 0 14px rgba(7, 6, 26, .9), 0 0 3px rgba(7, 6, 26, .6); /* читабельність поверх диму */
  transition: color .3s, transform .3s var(--ease);
}
.nav a:hover { color: var(--white); transform: translateX(4px); }
.nav a.is-active { color: var(--white); }
.nav a.is-active::before { content: "/ "; }

.burger { display: none; }
.edge { display: none; } /* затемнення країв — лише на мобільному, див. адаптив */

/* ---------- Views ---------- */
main { position: relative; z-index: 10; }
.view { min-height: 100vh; min-height: 100svh; }

/* ---------- Головна ---------- */
/* overflow: clip по обох осях — глітч і анімації персонажа не створюють прокрутки */
.view--home { position: relative; display: flex; align-items: flex-end; overflow: clip; }

/* Персонаж: прибитий до низу. Центр фігури — 57.3% ширини картинки (1330×1183),
   ставимо його на 21.5vw від правого краю, як у макеті. */
.hero__figure {
  --fh: 86vh;
  position: absolute; bottom: 0;
  right: calc(21.5vw - var(--fh) * 1.124 * .427);
  height: var(--fh); width: calc(var(--fh) * 1.124);
  pointer-events: none; user-select: none;
  animation: figIn 1.4s var(--ease) both .2s;
}
@keyframes figIn { from { opacity: 0; transform: translateY(24px); } }

/* ---------- Глітч персонажа ----------
   JS час від часу вмикає .is-glitch (варіант a або b) на ~0.3–0.6с. */
.fig { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; }
.fig--g1, .fig--g2 { opacity: 0; mix-blend-mode: screen; }
/* opacity() у фільтрі — загальна сила кольорових копій */
.fig--g1 { filter: brightness(1.7) sepia(1) saturate(8) hue-rotate(185deg) opacity(.5); } /* синій/ціан */
.fig--g2 { filter: brightness(1.7) sepia(1) saturate(8) hue-rotate(275deg) opacity(.4); } /* пурпуровий */

/* Смужки розгортки лише по силуету персонажа */
.hero__figure::after {
  content: ""; position: absolute; inset: 0; opacity: 0;
  background: repeating-linear-gradient(180deg, rgba(120, 140, 255, .22) 0 1px, transparent 1px 4px);
  -webkit-mask: url(../assets/img/character.webp) center / 100% 100% no-repeat;
          mask: url(../assets/img/character.webp) center / 100% 100% no-repeat;
}

.hero__figure.is-glitch::after { animation: gScan .12s steps(2) infinite; }
.hero__figure.is-glitch .fig--base { animation: gBase var(--gd, .4s) steps(1) both; }
.hero__figure.is-glitch .fig--g1 { animation: gRgb1 var(--gd, .4s) steps(1) both; }
.hero__figure.is-glitch .fig--g2 { animation: gRgb2 var(--gd, .4s) steps(1) both; }
.hero__figure.is-glitch.gv-b .fig--base { animation-name: gBaseB; }
.hero__figure.is-glitch.gv-b .fig--g1 { animation-name: gRgb1B; }

@keyframes gScan { 0% { opacity: .9; } 100% { opacity: .4; } }

/* Основне зображення: різкі зсуви смугами (clip-path). Лише вбік/вгору — без прокрутки */
@keyframes gBase {
  0%   { clip-path: inset(0 0 0 0); transform: translate(0); }
  10%  { clip-path: inset(18% 0 58% 0); transform: translate(-14px, 0); }
  20%  { clip-path: inset(62% 0 12% 0); transform: translate(10px, 0); }
  30%  { clip-path: inset(0 0 0 0); transform: translate(3px, -2px) skewX(-4deg); }
  45%  { clip-path: inset(40% 0 38% 0); transform: translate(-20px, 0); }
  55%  { clip-path: inset(0 0 0 0); transform: translate(0); opacity: .75; }
  70%  { clip-path: inset(8% 0 80% 0); transform: translate(16px, 0); opacity: 1; }
  85%  { clip-path: inset(0 0 0 0); transform: translate(-2px, 0); }
  100% { clip-path: inset(0 0 0 0); transform: translate(0); }
}
@keyframes gBaseB {
  0%   { clip-path: inset(0 0 0 0); transform: translate(0); }
  12%  { clip-path: inset(70% 0 5% 0); transform: translate(18px, 0); }
  25%  { clip-path: inset(0 0 0 0); transform: translate(-4px, -1px) skewX(5deg); opacity: .6; }
  40%  { clip-path: inset(25% 0 50% 0); transform: translate(-12px, 0); opacity: 1; }
  60%  { clip-path: inset(0 0 0 0); transform: translate(2px, 0); }
  78%  { clip-path: inset(50% 0 30% 0); transform: translate(22px, 0); }
  100% { clip-path: inset(0 0 0 0); transform: translate(0); }
}

/* Кольорові копії: розшарування RGB + свої смуги */
@keyframes gRgb1 {
  0%   { opacity: .85; transform: translate(-8px, 0); clip-path: inset(0 0 0 0); }
  20%  { transform: translate(-16px, 0); clip-path: inset(30% 0 40% 0); }
  40%  { transform: translate(-6px, 0); clip-path: inset(0 0 0 0); }
  60%  { transform: translate(-22px, 0); clip-path: inset(55% 0 20% 0); }
  80%  { opacity: .6; transform: translate(-4px, 0); clip-path: inset(0 0 0 0); }
  100% { opacity: 0; transform: translate(0); }
}
@keyframes gRgb1B {
  0%   { opacity: .8; transform: translate(10px, -1px); clip-path: inset(10% 0 60% 0); }
  30%  { transform: translate(-12px, 0); clip-path: inset(0 0 0 0); }
  55%  { transform: translate(18px, 0); clip-path: inset(65% 0 10% 0); }
  85%  { opacity: .5; transform: translate(-3px, 0); clip-path: inset(0 0 0 0); }
  100% { opacity: 0; transform: translate(0); }
}
@keyframes gRgb2 {
  0%   { opacity: .7; transform: translate(8px, 0); clip-path: inset(0 0 0 0); }
  25%  { transform: translate(14px, -1px); clip-path: inset(45% 0 35% 0); }
  50%  { transform: translate(5px, 0); clip-path: inset(0 0 0 0); }
  70%  { transform: translate(20px, 0); clip-path: inset(12% 0 70% 0); }
  90%  { opacity: .4; transform: translate(3px, 0); clip-path: inset(0 0 0 0); }
  100% { opacity: 0; transform: translate(0); }
}

/* Вирівнювання по літерах, а не по рядках.
   Для Inter / Inter Tight: висота великої літери = 0.727em, і при line-height = 0.727
   блок тексту точно займає простір від верху великих літер до базової лінії.
   Для звичайного тексту з line-height L відступ до літер = (L/2 − 0.364)em — його прибираємо. */
:root { --tfs: clamp(44px, 7.4vw, 170px); } /* розмір великого заголовка */
.hero {
  position: relative; width: 100%;
  padding: 0 var(--pad) calc(var(--pad) + var(--tfs) * .12);
}
.hero__row { display: flex; align-items: stretch; gap: 2.2vw; }
.hero__row--bottom { justify-content: space-between; align-items: flex-end; margin-top: calc(var(--tfs) * .2); }

.hero__title {
  margin: 0;
  font-family: var(--f-head); font-weight: 900;
  font-size: var(--tfs);
  line-height: .727; letter-spacing: -.02em;
  text-transform: uppercase;
  white-space: nowrap;
}
.hero__title > span { display: block; }
.hero__meta {
  display: flex; flex-direction: column; justify-content: space-between;
  font-size: clamp(14px, 1vw, 20px); line-height: 1.5;
}
.hero__year { display: block; margin-top: -.386em; }
.hero__meta p { margin: 0 0 -.386em; }

/* CTA кнопка */
.cta { display: flex; gap: 4px; flex-shrink: 0; }
.cta__icon, .cta__btn {
  background: var(--white); color: #000;
  height: clamp(64px, 5vw, 100px);
  display: grid; place-items: center;
  border-radius: 3px;
  transition: background .35s var(--ease), color .35s var(--ease), transform .35s var(--ease);
}
.cta__icon { width: clamp(64px, 5vw, 100px); }
.cta__icon svg { transition: transform .35s var(--ease); }
.cta__btn {
  width: clamp(200px, 19.5vw, 390px);
  font-family: var(--f-head); font-weight: 900; font-size: clamp(16px, 1.05vw, 21px);
}
@media (hover: hover) {
  .cta:hover .cta__icon, .cta:hover .cta__btn { background: var(--accent); color: var(--white); }
  .cta:hover .cta__icon svg { transform: rotate(-90deg); }
}
.cta:active .cta__icon, .cta:active .cta__btn { background: var(--accent); color: var(--white); }

/* ---------- Внутрішні сторінки ---------- */
.page {
  padding: calc(var(--pad) + 14vh) var(--pad) calc(var(--pad) * 2) calc(var(--side) + var(--pad));
  max-width: 1800px;
}
.page__head { margin-bottom: 7vh; position: relative; z-index: 1; } /* поверх мотузки персонажа */
.page__tag { display: block; color: var(--muted); margin-bottom: 18px; }
.page__title {
  margin: 0;
  font-family: var(--f-head); font-weight: 900;
  font-size: clamp(40px, 6.4vw, 150px);
  line-height: .92; letter-spacing: -.02em;
  text-transform: uppercase;
}
.page__lead { max-width: 520px; margin: 28px 0 0; font-size: 18px; line-height: 1.5; color: rgba(255,255,255,.8); }

.page__end {
  margin-top: var(--pf-gap); padding-top: var(--in); border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: center;
}
.page__end p { margin: 0; font-family: var(--f-head); font-weight: 700; font-size: clamp(22px, 2.2vw, 40px); }

.link-arrow {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--f-head); font-weight: 900; font-size: 18px; text-transform: uppercase;
  border-bottom: 2px solid var(--white); padding-bottom: 6px;
}
.link-arrow svg { transition: transform .35s var(--ease); }
.link-arrow:hover svg { transform: translate(4px, -4px); }

/* Плейсхолдер під фото */
.ph {
  position: relative; overflow: hidden;
  background:
    radial-gradient(120% 90% at 30% 20%, rgba(36,60,255,.35), transparent 60%),
    radial-gradient(90% 80% at 80% 90%, rgba(56,110,255,.25), transparent 60%),
    rgba(255,255,255,.04);
  border: 1px solid var(--line);
}
.ph > span {
  position: absolute; left: 14px; bottom: 12px;
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.ph img { width: 100%; height: 100%; object-fit: cover; }

/* Портфоліо: перший екран. --pf-gap — однаковий відступ над і під заголовком добірки */
.view--page { --pf-gap: clamp(72px, 14vh, 160px); --in: 40px; } /* --pf-gap — між секціями, --in — від лінії до тексту */
.pf-hero {
  min-height: calc(100svh - var(--pad) * 3 - 14vh);
  display: flex; flex-direction: column; justify-content: flex-end;
  margin-bottom: var(--pf-gap);
}
.pf-hero .page__tag { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 22px; }
.pf-hero__row { display: flex; justify-content: space-between; align-items: flex-end; gap: 4vw; }
.pf-hero__title { font-size: clamp(44px, 7.4vw, 170px); white-space: nowrap; } /* рівно два рядки, як задано <br> */
#about .pf-hero__title, #services .pf-hero__title { line-height: 1.1; } /* крапки «Ї» не налазять на рядок вище */
.pf-hero__lead {
  max-width: 340px; margin: 0 0 .6em; flex-shrink: 0;
  font-size: 15px; line-height: 1.55; color: rgba(255,255,255,.65);
}

/* Заголовок секції: лінія зверху, мітка над заголовком ліворуч, опис праворуч.
   Колонки повторюють сітку контенту під заголовком, тож опис починається рівно там,
   де текст нижче (за замовчуванням — третя колонка послуг з її внутрішнім відступом) */
.sel-head {
  --st: clamp(26px, 2.6vw, 52px); /* розмір заголовка — від нього рахуємо центр першого рядка */
  position: relative;
  display: grid; grid-template-columns: 2fr 1fr; gap: 18px 0; align-items: start;
  margin-bottom: var(--pf-gap);
  padding-top: var(--in); border-top: 1px solid var(--line);
}
.sel-head__tag { grid-column: 1; grid-row: 1; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.sel-head__title {
  grid-column: 1; grid-row: 2;
  margin: 0; font-family: var(--f-head); font-weight: 900; text-transform: uppercase;
  font-size: var(--st); line-height: 1; letter-spacing: -.01em; max-width: 12em;
}
/* Опис праворуч — по центру висоти першого рядка заголовка: центр рядка великих літер — 0.364
   від розміру шрифту під його верхом, центр самого опису — половина його висоти.
   Опис винесено з потоку (у межах своєї комірки), щоб не розтягував ряд і не ламав відступ знизу */
.sel-head > .sel-head__lead {
  position: absolute; grid-column: 2; grid-row: 2; top: 0; left: 0; right: 0;
  translate: 0 calc(var(--st) * .364 - 50%);
  padding-left: 2vw;
}
.sel-head__aside { grid-column: 2; grid-row: 1 / span 2; align-self: end; padding-left: 2vw; }
.sel-head__title { align-self: end; }
/* Обрізаємо рядки тексту рівно по верху великих літер і базовій лінії — відступи в CSS
   дорівнюють видимим (інакше порожнеча над/під літерами різна в дрібного й великого тексту) */
.sel-head__tag, .sel-head__title, .sel-head__lead, .sel-head__count b, .sel-head__count span,
.service__num, .service h4, .service p, .sv-note, .about__cards b, .about__cards span,
.steps span, .steps b, .steps p, .page__end p, .reach__note, .sv-incl__label {
  text-box: trim-both cap alphabetic;
}
/* портфоліо: та сама 12-колонкова сітка, що й у карток — опис над другою карткою першого ряду */
#portfolio .sel-head { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 1.6vw; }
#portfolio .sel-head__tag, #portfolio .sel-head__title { grid-column: 1 / 8; }
#portfolio .sel-head__aside { grid-column: 8 / -1; }
/* «Хто я»: як сітка персонаж / текст */
.sel-head.who__head { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: 4vw; }
/* «Як це працює»: як рядки кроків — опис над описами кроків */
.sel-head--steps { grid-template-columns: 80px minmax(160px, 1fr) 2fr; column-gap: 20px; }
.sel-head--steps .sel-head__tag, .sel-head--steps .sel-head__title { grid-column: 1 / 3; }
.sel-head--steps > .sel-head__lead { grid-column: 3; }
#portfolio .sel-head__aside, .who__head > .sel-head__lead, .sel-head--steps > .sel-head__lead { padding-left: 0; }
.sel-head__title em, .about__big em {
  font-style: normal;
  background: linear-gradient(90deg, #7b8cff, #c08bff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sel-head__aside { display: flex; flex-direction: column; gap: 22px; }
.sel-head__count { display: flex; align-items: flex-end; gap: 14px; margin: 0; }
.sel-head__count b {
  font-family: var(--f-head); font-weight: 900; font-size: clamp(56px, 5.6vw, 110px); line-height: .78;
  background: linear-gradient(90deg, #7b8cff, #c08bff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sel-head__count span { font-size: 12px; line-height: 1.35; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sel-head__lead { margin: 0; font-size: 14px; line-height: 1.55; color: var(--muted); max-width: 380px; }
.block .sel-head, .sv-block .sel-head { margin-bottom: var(--in); } /* далі одразу лінія списку — відступ як над текстом */

/* Портфоліо: сітка — широка + вузька, у наступному ряду навпаки */
.works { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 9vh 1.6vw; align-items: start; }
.work { display: block; position: relative; grid-column: span 7; }
.work:nth-child(4n+2), .work:nth-child(4n+3) { grid-column: span 5; }
.work__img { aspect-ratio: 9 / 5; border-radius: 10px; border: 0; }
.work:nth-child(4n+2) .work__img, .work:nth-child(4n+3) .work__img { aspect-ratio: 8 / 5; }
.work__img::after {
  content: ""; position: absolute; inset: 0;
  background: rgba(7,6,26,.25); transition: opacity .5s var(--ease);
}
.work__img img { transition: transform 1s var(--ease); }
.work:hover .work__img::after { opacity: 0; }
.work:hover .work__img img { transform: scale(1.04); }
.work__img > span:not(.work__go) { left: auto; right: 16px; bottom: auto; top: 14px; }
/* Біла кругла кнопка зі стрілкою в лівому нижньому куті превʼю */
.work__img .work__go {
  position: absolute; z-index: 1; left: 24px; bottom: 24px;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--white); color: var(--bg);
  transition: transform .45s var(--ease), background .3s, color .3s;
}
.work:hover .work__go { transform: scale(1.12) rotate(45deg); background: var(--accent); color: var(--white); }
.work__info {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 18px; align-items: baseline;
  padding-top: 18px;
}
.work__info h3 { margin: 0; font-family: var(--f-head); font-weight: 700; font-size: clamp(18px, 1.5vw, 28px); text-transform: uppercase; letter-spacing: -.01em; }
.work__year { color: var(--muted); font-size: 12px; }
.work__info p { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--muted); }

/* Про мене: «Хто я» — заголовок як у портфоліо, до нього прив'язана мотузка персонажа */
.who__head { margin-bottom: 7vh; position: relative; z-index: 1; } /* поверх мотузки */
.about { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 4vw; align-items: start; }

/* Персонаж на мотузці. Мотузка в картинці — рівно по центру (50% ширини), тож точка
   підвісу — верх .hang по центру. --rope — шматок мотузки над картинкою до заголовка;
   точну довжину й зсув по X під літеру виставляє скрипт (pinRope), тут — запасне значення. Поверх темного троса з картинки малюємо
   світліший, інакше на темному фоні його не видно. */
.about__hang { --rope: calc(7vh + .12em); position: relative; z-index: 0; font-size: clamp(40px, 6.4vw, 150px); }
.hang {
  position: relative; width: clamp(220px, 19vw, 380px); margin-inline: auto;
  margin-top: calc(var(--rope) * -1); padding-top: var(--rope);
  transform-origin: 50% 0;
  animation: swing 4.6s ease-in-out infinite;
}
.hang__rope, .hang__body::before {
  position: absolute; left: calc(50% - 1.5px); width: 3px;
  background: linear-gradient(90deg, #2c3060, #aab3ff 50%, #2c3060);
}
.hang__rope { top: 0; height: var(--rope); }
.hang__body { position: relative; }
.hang__body::before { content: ""; top: 0; height: 14.6%; z-index: 1; } /* до ступень */
.hang__body img { width: 100%; height: auto; }
@keyframes swing {
  0%, 100% { transform: rotate(3.5deg); }
  50%      { transform: rotate(-3.5deg); }
}
@media (prefers-reduced-motion: reduce) { .hang { animation: none; } }
/* по центру висоти персонажа; між усіма елементами однаковий відступ (gap) */
.about__text { font-size: 18px; line-height: 1.6; color: rgba(255,255,255,.8); align-self: center; display: flex; flex-direction: column; gap: 32px; }
.about__text p { margin: 0; max-width: 640px; }
.about__big {
  color: var(--white) !important;
  font-family: var(--f-head); font-weight: 700;
  font-size: clamp(26px, 2.6vw, 48px); line-height: 1.12 !important; letter-spacing: -.01em;
}
/* Факти 2×2 — у стилі послуг: тонкі лінії між пунктами, без плашок */
.about__cards {
  list-style: none; margin: 0; padding: 0; max-width: 680px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}
.about__cards li {
  display: flex; flex-direction: column; gap: 10px;
  padding: 22px 0; border-bottom: 1px solid var(--line);
}
.about__cards li:nth-child(odd) { padding-right: 2vw; border-right: 1px solid var(--line); }
.about__cards li:nth-child(even) { padding-left: 2vw; }
.about__cards b {
  font-family: var(--f-head); font-weight: 900; color: var(--white);
  font-size: clamp(24px, 2vw, 38px); line-height: 1; letter-spacing: -.01em;
}
.about__cards span { font-size: 14px; line-height: 1.4; color: var(--muted); }

/* Послуги: блоки з заголовком секції; 6 доп. функцій — сітка 3×2 з лініями */
.sv-block + .sv-block { margin-top: var(--pf-gap); }
.services--grid .service:nth-child(3n) { border-right: 0; }
.services--grid .service:nth-child(3n + 1) { padding-left: 0; }
.services--grid .service:nth-child(n + 4) { border-top: 1px solid var(--line); }
.services--grid .service h4 { margin-top: 32px; font-size: clamp(20px, 1.7vw, 30px); }
/* «Уже входить» — рядок «пігулок» */
.sv-incl {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px;
  padding: var(--in) 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.sv-incl__label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sv-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.sv-chips li {
  padding: 10px 18px; border-radius: 999px;
  font-size: 14px; color: rgba(255, 255, 255, .88); background: rgba(255, 255, 255, .08);
}
/* чесна примітка під доп. функціями: що не входить */
.sv-note {
  margin: 0; padding: var(--in) calc(100% / 3) var(--in) 0; border-top: 1px solid var(--line); /* лінія на всю ширину, текст — у перших двох колонках */
  font-size: 14px; line-height: 1.6; color: var(--muted);
}
.sv-cta { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin-top: var(--in); }

.block { margin-top: var(--pf-gap); }

.services { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.service { padding: var(--in) 2vw var(--in) 0; border-right: 1px solid var(--line); }
.service + .service { padding-left: 2vw; }
.service:last-child { border-right: 0; }
.service__num { display: block; color: var(--muted); font-size: 14px; } /* блок — щоб обрізка рядка по літерах спрацювала */
.service h4 { margin: 32px 0 20px; font-family: var(--f-head); font-weight: 900; font-size: clamp(24px, 2.3vw, 42px); text-transform: uppercase; }
.service p { margin: 0; color: rgba(255,255,255,.7); line-height: 1.55; max-width: 360px; }

.steps { list-style: none; margin: 0; padding: 0; }
.steps li {
  display: grid; grid-template-columns: 80px minmax(160px, 1fr) 2fr; gap: 20px; align-items: baseline;
  padding: 26px 0; border-top: 1px solid var(--line);
  transition: padding-left .4s var(--ease), background .4s;
}
.steps li:last-child { border-bottom: 1px solid var(--line); }
.steps li:hover { padding-left: 14px; background: rgba(255,255,255,.03); }
.steps span { color: var(--muted); }
.steps b { font-family: var(--f-head); font-weight: 900; font-size: clamp(20px, 1.8vw, 32px); text-transform: uppercase; }
.steps p { margin: 0; color: rgba(255,255,255,.7); }

/* Контакти: заклик і кнопка зліва, канали зв'язку справа; лінія зверху — як у заголовків секцій */
.reach {
  /* список каналів — по центру висоти лівого блоку; зайва висота (min-height) іде під обидва */
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 5vw;
  align-items: center; align-content: start;
  padding-top: 128px; border-top: 1px solid var(--line); /* блок відступає від лінії на 100px більше, ніж заголовки секцій */
  min-height: calc(100svh - 220px); /* після доводки першого екрана блок займає весь екран */
}
.reach__main { display: flex; flex-direction: column; gap: clamp(28px, 5vh, 56px); }
.reach__status {
  display: flex; align-items: center; gap: 10px; margin: 0;
  font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
}
/* зелена точка «онлайн» з м'якою пульсацією */
.reach__status i {
  width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(61, 220, 132, .5); animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse { 70%, 100% { box-shadow: 0 0 0 9px rgba(61, 220, 132, 0); } }
@media (prefers-reduced-motion: reduce) { .reach__status i { animation: none; } }
.reach__title {
  margin: 0; font-family: var(--f-head); font-weight: 900; text-transform: uppercase;
  font-size: clamp(30px, 3.4vw, 68px); line-height: 1; letter-spacing: -.01em; max-width: 11em;
}
.reach__title em {
  font-style: normal;
  background: linear-gradient(90deg, #7b8cff, #c08bff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.reach__actions { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.reach__note { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); }

.reach__list { list-style: none; margin: 0; padding: 0; }
.reach__list li { border-bottom: 1px solid var(--line); }
.reach__list li:first-child { border-top: 1px solid var(--line); }
.reach__list a, .reach__list li > div {
  display: grid; grid-template-columns: 44px minmax(90px, 130px) 1fr 24px; gap: 18px; align-items: center;
  padding: 26px 0;
  transition: padding-left .4s var(--ease), background .4s;
}
.reach__ic {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .06); color: rgba(255, 255, 255, .8);
  transition: background .35s, color .35s;
}
.reach__label { font-size: 14px; color: var(--muted); }
.reach__list b {
  font-family: var(--f-head); font-weight: 700; font-size: clamp(18px, 1.6vw, 30px);
  overflow-wrap: anywhere; transition: color .3s;
}
.reach__go { color: var(--muted); transition: transform .35s var(--ease), color .3s; }
.reach__list a:hover { padding-left: 12px; background: rgba(255, 255, 255, .03); }
.reach__list a:hover b { color: var(--accent-light); }
.reach__list a:hover .reach__ic { background: var(--accent); color: var(--white); }
.reach__list a:hover .reach__go { transform: translate(3px, -3px); color: var(--white); }

/* Попап із формою */
.modal {
  width: min(560px, calc(100vw - 2 * var(--pad))); max-width: none; max-height: none;
  margin: auto; padding: 0; border: 0; background: none; color: inherit; overflow: visible;
  opacity: 0; translate: 0 24px; transition: opacity .3s var(--ease), translate .45s var(--ease);
}
.modal.is-open { opacity: 1; translate: 0 0; }
.modal::backdrop {
  background: rgba(4, 3, 14, .62);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
body.modal-open { overflow: hidden; }
.modal__close {
  position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; color: var(--muted);
  transition: background .3s, color .3s, transform .35s var(--ease);
}
.modal__close:hover { background: rgba(255, 255, 255, .08); color: var(--white); transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .modal { transition: none; } }

.form {
  display: flex; flex-direction: column; gap: 22px;
  padding: clamp(28px, 2.4vw, 44px);
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 3px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .03));
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px rgba(4, 3, 14, .45), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.form__title {
  margin: 0; padding-right: 44px; /* місце під хрестик */
  font-family: var(--f-head); font-weight: 900; font-size: clamp(22px, 1.6vw, 30px); line-height: 1.15;
}
/* Персонаж, що штовхає форму в попапі: кінчики пальців — правий край картинки, тож ставимо його
   впритул до лівого краю форми, ступні — на рівні її низу, зріст — як висота форми.
   Форма раз на цикл піддається на кілька px, персонаж у цей момент тремтить від зусилля.
   Під курсором / при введенні — пауза, щоб форма не їздила. */
.form { position: relative; animation: formPush 3.2s ease-in-out infinite; }
.form__pusher {
  position: absolute; right: calc(100% - 2px); bottom: 0;
  /* не вище за форму й 440px, і так, щоб уміщався ліворуч від попапу (висота/ширина картинки ≈ 1.25) */
  width: auto; height: min(100%, 440px, calc(((100vw - min(560px, 100vw)) / 2 - 24px) * 1.25)); max-width: none;
  pointer-events: none;
  animation: pushStrain 3.2s linear infinite;
}
.form:hover, .form:focus-within, .form:hover .form__pusher, .form:focus-within .form__pusher { animation-play-state: paused; }
@keyframes formPush {
  0%, 40%, 100% { translate: 0 0; }
  70%           { translate: 4px 0; }
}
@keyframes pushStrain {
  0%, 38%, 74%, 100% { transform: none; }
  44% { transform: translate(-.6px, .3px); }
  50% { transform: translate(.6px, -.3px); }
  56% { transform: translate(-.5px, .2px); }
  62% { transform: translate(.5px, -.3px); }
  68% { transform: translate(-.4px, .2px); }
}
@media (prefers-reduced-motion: reduce) { .form, .form__pusher { animation: none; } }
.form label { display: flex; flex-direction: column; gap: 8px; }
.form label > span { color: var(--muted); font-size: 14px; }
/* Поля-прямокутники на склі: темніші за панель, тонка рамка */
.form input, .form textarea {
  font: inherit; font-size: 17px; color: var(--white);
  background: rgba(4, 3, 14, .35);
  border: 1px solid rgba(255, 255, 255, .18); border-radius: 3px;
  padding: 15px 16px; outline: none; resize: vertical;
  transition: border-color .3s, background .3s, box-shadow .3s;
}
.form input:hover, .form textarea:hover { border-color: rgba(255, 255, 255, .35); }
.form input:focus, .form textarea:focus {
  border-color: var(--accent-light); background: rgba(4, 3, 14, .5);
  box-shadow: 0 0 0 3px rgba(123, 140, 255, .18);
}
.form .is-invalid { border-color: #ff6b8a; }
.cta--form { margin-top: 10px; align-self: stretch; }
.cta--form .cta__icon, .cta--form .cta__btn { height: 64px; }
.cta--form .cta__icon { width: 64px; }
.cta--form .cta__btn { flex: 1; width: auto; }
.form__status { margin: 0; min-height: 1.5em; color: var(--accent-light); }
.form__status:empty { display: none; }

.foot {
  position: relative; z-index: 10;
  padding: 0 var(--pad) var(--pad) calc(var(--side) + var(--pad));
  color: var(--muted); font-size: 13px;
}
body.is-home .foot { display: none; }

/* ---------- Анімації появи ---------- */
.reveal { opacity: 0; transform: translateY(28px); }
.reveal.is-in {
  opacity: 1; transform: none;
  transition: opacity .9s var(--ease), transform .9s var(--ease);
  transition-delay: var(--d, 0s);
}
.view.is-leaving { opacity: 0; transition: opacity .35s ease; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Адаптив ---------- */
@media (max-width: 1100px) {
  .hero__row:first-child { flex-direction: column; gap: 20px; }
  .hero__row:first-child .hero__meta { order: -1; }
  .hero__row--bottom { flex-direction: column; align-items: flex-start; gap: 28px; }
  .hero { --tfs: clamp(40px, 10.5vw, 120px); }
  .hero__meta { gap: 18px; margin-bottom: 12px; }

  /* Бургер-меню з планшетів: бокове меню тут налазило б на заголовок */
  :root { --side: 0px; }
  .burger {
    display: grid; place-items: center;
    position: fixed; z-index: 30; top: calc(var(--pad) - 6px); right: calc(var(--pad) - 6px);
    width: 36px; height: 36px;
  }
  /* Шапка: логотип (≈65px заввишки) зліва, мова й бургер — по його вертикальному центру */
  :root { --logo-h: 65px; --hdr-h: calc(var(--pad) * 2 + var(--logo-h) - 8px); }
  .lang, .burger { top: calc(var(--pad) + var(--logo-h) / 2); transform: translateY(-50%); }
  .lang { right: calc(var(--pad) + 44px); line-height: 1; }

  /* Затемнення під шапкою, коли сторінку прогорнули */
  /* Плавний градієнт від темного до прозорого, без межі й розмиття.
     .edge--*-fill — тонка суцільна смужка того ж кольору біля краю екрана:
     iOS Safari бере її колір і зафарбовує ним зону статус-бару / нижньої панелі,
     тож градієнт безшовно «продовжується» під системні елементи. */
  .edge { display: block; position: fixed; z-index: 15; left: 0; right: 0; pointer-events: none; }
  .edge--top {
    top: 0; height: calc(var(--hdr-h) + 50px + env(safe-area-inset-top, 0px));
    background: linear-gradient(180deg,
      var(--edge) 0%,
      var(--edge) 10%,
      rgba(4, 3, 14, .85) 45%,
      rgba(4, 3, 14, .45) 72%,
      rgba(4, 3, 14, .15) 88%,
      rgba(4, 3, 14, 0) 100%);
  }
  .edge--top-fill { top: 0; height: 12px; background-color: var(--edge); }
  .edge--top, .edge--top-fill {
    opacity: 0; visibility: hidden;
    transition: opacity .35s var(--ease), visibility .35s;
  }
  body.is-scrolled .edge--top, body.is-scrolled .edge--top-fill { opacity: 1; visibility: visible; }
  body.nav-open .edge--top, body.nav-open .edge--top-fill { opacity: 0; visibility: hidden; }

  /* Низ — лише на внутрішніх сторінках (на головній там кнопка) */
  .edge--bottom {
    bottom: 0; height: calc(70px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(0deg, var(--edge) 0%, var(--edge) 12%, rgba(4, 3, 14, .6) 45%, rgba(4, 3, 14, 0) 100%);
  }
  .edge--bottom-fill { bottom: 0; height: 8px; background-color: var(--edge); }
  body.is-home .edge--bottom, body.is-home .edge--bottom-fill { display: none; }
  .foot { padding-bottom: calc(var(--pad) + 56px + env(safe-area-inset-bottom, 0px)); }

  .nav {
    top: 0; left: 0; right: 0; bottom: 0;
    padding: 30vh var(--pad) 0;
    background: rgba(7,6,26,.94); backdrop-filter: blur(10px);
    font-size: 30px; font-family: var(--f-head); font-weight: 900; gap: 22px;
    opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s;
  }
  .nav a { text-shadow: none; }
  body.nav-open .nav { opacity: 1; visibility: visible; }
  body.nav-open { overflow: hidden; }
  .page { padding-top: calc(var(--hdr-h) + 48px); }
}

@media (max-width: 860px) {
  /* Заголовок на всю ширину контенту, кнопка — такої ж ширини:
     однакові відступи зліва й справа. --title-k = ширина найдовшого рядка / font-size */
  :root { --title-k: 8.1; }
  html[lang="en"] { --title-k: 9.3; }
  .hero { --tfs: calc((100vw - 2 * var(--pad)) / var(--title-k)); }
  .cta { width: 100%; }
  .cta__btn { flex: 1; width: auto; }

  .view--page { --pf-gap: 64px; --in: 28px; }
  .pf-hero { min-height: 0; }
  .pf-hero__row { flex-direction: column; align-items: flex-start; gap: 24px; }
  .pf-hero__title { font-size: clamp(40px, 13vw, 110px); white-space: normal; }
  /* на телефоні — стовпчиком: мітка, заголовок, опис */
  .sel-head, #portfolio .sel-head, .sel-head.who__head, .sel-head--steps { grid-template-columns: 1fr; gap: 18px; }
  .view .sel-head > *, #portfolio .sel-head > * { grid-column: 1; grid-row: auto; padding-left: 0; }
  .sel-head > .sel-head__lead { position: static; translate: none; }
  .works { grid-template-columns: 1fr; gap: 7vh; }
  .work, .work:nth-child(4n+2), .work:nth-child(4n+3) { grid-column: auto; }
  .work__img, .work:nth-child(4n+2) .work__img, .work:nth-child(4n+3) .work__img { aspect-ratio: 16 / 10; }
  .work__img .work__go { left: 16px; bottom: 16px; width: 38px; height: 38px; }
  .form__pusher { display: none; }
  .form { animation: none; }
  .about, .reach { grid-template-columns: 1fr; }
  .reach { gap: 48px; min-height: 0; padding-top: 28px; }
  /* рядок каналу: іконка | підпис над значенням | стрілка */
  .reach__list a, .reach__list li > div { grid-template-columns: 40px 1fr 20px; gap: 4px 14px; padding: 18px 0; }
  .reach__ic { width: 40px; height: 40px; grid-row: span 2; }
  .reach__label { grid-column: 2; }
  .reach__list b { grid-column: 2; }
  .reach__go { grid-column: 3; grid-row: 1 / span 2; }
  .reach__actions .cta { width: 100%; }
  .reach__actions .cta__btn { flex: 1; width: auto; }
  .hang { width: 205px; }
  .about__cards { grid-template-columns: 1fr; }
  .about__cards li, .about__cards li:nth-child(odd), .about__cards li:nth-child(even) { padding: 18px 0; border-right: 0; }
  .sel-head__aside { gap: 16px; }
  .who__head .sel-head__lead { display: none; } /* мотузка йде крізь нього; той самий сенс — у тексті нижче */
  .services { grid-template-columns: 1fr; }
  .services--grid .service:nth-child(n) { padding: 28px 0; border-top: 0; }
  .sv-note { padding-right: 0; }
  .sv-cta .cta { width: 100%; }
  .sv-cta .cta__btn { flex: 1; width: auto; }
  .service, .service + .service { padding: 28px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .service h4 { margin-top: 18px; }
  .steps li { grid-template-columns: 44px 1fr; }
  .steps p { grid-column: 2; }
  /* На мобільному — по центру, за текстом */
  .hero__figure { --fh: 62vh; right: calc(50vw - var(--fh) * 1.124 * .427); bottom: 18vh; z-index: 1; }
  /* Низ персонажа плавно йде в темний фон (не в прозорість — інакше крізь торс видно дим) */
  .view--home::after {
    content: ""; position: absolute; z-index: 2; left: 0; right: 0; bottom: 0;
    height: 42vh; pointer-events: none;
    background: linear-gradient(180deg,
      rgba(7, 6, 26, 0) 0%,
      rgba(7, 6, 26, .55) 25%,
      rgba(7, 6, 26, .92) 45%,
      var(--bg) 57%);
  }
  .hero { z-index: 3; }
  .bg__glow--1 { width: 110vw; height: 110vw; right: -30vw; top: 24vh; }
  .bg__glow--2 { display: none; }
}

@media (max-width: 480px) {
  .cta--form .cta__btn { flex: 1; width: auto; }
}
