/* ===== reset / base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  font-family: "GT America Mono", monospace;
  color: #000;
  background: #fff;
  -webkit-font-smoothing: antialiased;
  padding: 0 clamp(20px, 2.78vw, 40px); /* 40px на холсте 1440 */
}
img {
  display: block;
  max-width: 100%;
}
a {
  color: inherit;
  text-decoration: none;
}
ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
h1 {
  margin: 0;
  font-weight: normal;
}

/* единственный источник текста заголовка для скринридеров: видимые нарезки строк — aria-hidden */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== фон с нойзом (см. js/background.js) ===== */
#bg-canvas {
  position: fixed;
  top: -5vh;
  left: -5vw;
  width: 110vw;
  height: 110vh;
  z-index: -1; /* над фоном первого экрана главной (body.page-home::before, -2) */
  pointer-events: none;
  /* без blur: он стирает зерно; мягкий край даёт сам шейдер */
  filter: none;
}

/* ===== кастомный курсор (см. js/cursor.js) ===== */
html.has-custom-cursor,
html.has-custom-cursor * {
  cursor: none !important;
}

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.cursor.is-visible {
  opacity: 1;
}

.cursor-dot {
  position: absolute;
  top: 0;
  left: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-accent, #36a9e2);
  border: 0px solid var(--color-accent, #36a9e2);
  transform: translate(-50%, -50%);
  transition:
    width 0.3s cubic-bezier(0.19, 1, 0.22, 1),
    height 0.3s cubic-bezier(0.19, 1, 0.22, 1),
    background-color 0.3s ease,
    border-width 0.3s ease;
}

.cursor.is-hover .cursor-dot {
  width: 80px;
  height: 80px;
  background: rgba(54, 169, 226, 0.16);
  border: 1px solid var(--color-accent, #36a9e2);
}

@media (hover: none), (pointer: coarse) {
  .cursor {
    display: none;
  }
}

/* ===== экран загрузки =====
   z-index выше курсора (9999) и мобильного меню (10000). */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
}

.loading-screen.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-screen-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 31px;
  margin-top: clamp(-80px, -10vh, 0px);
}

.loading-screen-gif {
  width: clamp(120px, 21vw, 274px);
  aspect-ratio: 1 / 1;
  object-fit: contain;
}

.loading-screen-text {
  margin: 0;
  font-family: "GT America Mono", monospace;
  font-size: 16px;
  text-transform: uppercase;
  color: #000;
  white-space: nowrap;
}

body.is-loading {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .loading-screen {
    transition: none;
  }
}

/* ===== первый экран ===== */
.hero {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 19px;
  /* .hero-nav — absolute от .hero; padding-top вместо его места в потоке (--nav-h меряет js/nav.js) */
  position: relative;
  padding-top: calc(var(--nav-h, 110px) + 19px);

  height: calc(100vh - 40px);
  /* svh — без панелей браузера (в Safari на iPad 100vh больше видимой области); vh — запасной */
  height: calc(100svh - 40px);
}

/* --- хедер ---
   Маска-инверсия (mix-blend-mode) работает, только пока у хедера нет своей группы блендинга:
   - не position:fixed — прилипание делает js/nav.js через top = scrollY;
   - не transform — скрытие через margin-top (transform выносит в GPU-слой);
   - НЕТ z-index (любое значение изолирует блендинг). Чтобы рисоваться поверх
     .skills-canvas/.case-canvas, <header> стоит в самом конце <body>. */
.hero-nav {
  /* absolute от окна — вычитаем боковые отступы body (та же clamp) */
  width: calc(100% - 2 * clamp(20px, 2.78vw, 40px));
  max-width: 1360px;
  margin: 0 auto;
  padding: clamp(20px, 2.6vw, 32px) 0px clamp(14px, 1.8vw, 22px);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  margin-top: 0;
  transition: margin-top 0.4s ease;
}

/* margin-top, а не transform — см. выше */
.hero-nav.nav-hidden {
  margin-top: calc(var(--nav-h, 110px) * -1.3);
}

.logo {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* инверсия только на буквах; звёздочка без неё */
.logo-text-img {
  display: block;
  width: 125px;
  height: 24px;
  mix-blend-mode: difference;
  filter: invert(1);
}

.logo-star-img {
  display: block;
  width: 31px;
  height: 36px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(20px, 3vw, 42px);
}

.nav-links a {
  position: relative;
  display: inline-block;
  font-size: 16px;
  line-height: 12px;
  text-transform: uppercase;
  white-space: nowrap;
  color: #fff;
  mix-blend-mode: difference;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 1px;
  background: #fff;
  mix-blend-mode: difference;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s ease;
}

.nav-links a:hover::after {
  transform: scaleX(1);
}

/* WebKit (Safari, любой браузер на iOS): блендинг ломает WebGL-фон #bg-canvas (свой слой
   композитинга) — запасной вариант без маски, просто чёрный. .is-webkit ставит js/nav.js. */
html.is-webkit .logo-text-img {
  mix-blend-mode: normal;
  filter: none; /* исходный SVG лого чёрный — invert(1) делал его белым для difference */
}

html.is-webkit .nav-links a,
html.is-webkit .nav-links a::after,
html.is-webkit .nav-menu-toggle {
  mix-blend-mode: normal;
}

html.is-webkit .nav-links a,
html.is-webkit .nav-menu-toggle {
  color: #000;
}

html.is-webkit .nav-links a::after {
  background: #000;
}

/* "(меню)" — только ≤480px */
.nav-menu-toggle {
  display: none;
}

/* --- заголовок --- */
/* margin:auto — заголовок по центру свободного места; на невысоких экранах блок сжимается.
   Поэтому строки стоят от центра (56.59%) с шагом --hero-fs, а не в % высоты — не наезжают. */
.hero-headline {
  --hero-fs: clamp(30px, 5.88vw, 80px);
  position: relative;
  width: 100%;
  height: clamp(320px, 44vw, 599px);
  min-height: calc(var(--hero-fs) * 3.6);
  margin: auto 0;
}

.hero-star {
  position: absolute;
  left: 11.8%;
  top: calc(
    56.59% - var(--hero-fs) * 1.1375
  ); /* = 41.4% при высоте 599 и шрифте 80 */
  width: 21px;
  height: 21px;
}

/* видимые нарезки строк (desktop/mobile) — aria-hidden, текст в .sr-only h1 */
.hero-lines--mobile {
  display: none;
}

.hero-line {
  position: absolute;
  display: block;
  font-family: "Panama", serif;
  font-size: var(--hero-fs);
  line-height: 1;
  letter-spacing: -0.0695em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #000;
  transform: translateY(-50%);
}

.hero-line:nth-of-type(1) {
  left: 14.49%;
  right: 17.72%;
  top: calc(56.59% - var(--hero-fs));
}

.hero-line:nth-of-type(2) {
  left: 25.59%;
  right: 14.49%;
  top: 56.59%;
}

.hero-line:nth-of-type(3) {
  left: 18.31%;
  right: 20.37%;
  top: calc(56.59% + var(--hero-fs));
}

.hero-accent {
  position: absolute;
  right: 9.3%;
  top: calc(
    56.59% + var(--hero-fs) * 0.9625
  ); /* = 69.45% при высоте 599 и шрифте 80 */
  transform: translateY(-50%);
  font-family: "GT America Mono", monospace;
  font-size: 16px;
  text-transform: uppercase;
  white-space: nowrap;
  color: #36a9e2;
}

.hero-accent-smiley {
  text-transform: none;
}

/* --- низ первого экрана --- */
.hero-bottom {
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.hero-greeting {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.hero-photo {
  width: 125px;
  height: 142px;
  overflow: hidden;
  flex-shrink: 0;
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-greeting-text {
  margin: 0;
  font-family: "GT America Mono", monospace;
  font-size: 16px;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  color: #000;
}
.hero-greeting-text-comma {
  letter-spacing: -0.0822em;
}

.hero-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  font-family: "GT America Mono", monospace;
  font-size: 16px;
  line-height: 1;
  text-transform: uppercase;
  text-align: right;
  color: #000;
  white-space: nowrap;
}

/* ===== общий ритм секций ===== */
:root {
  --gap-section: clamp(40px, 5.56vw, 80px); /* 80px на холсте 1440 */
  --gap-sub: clamp(
    28px,
    4.17vw,
    60px
  ); /* 60px между типы проектов / обо мне / контакты */
  --color-tag: #2a9fff; /* категория-тег у карточек работ */
  --color-accent: #36a9e2; /* акцентный голубой (hero, фон) */
}

.works,
.bottom-group {
  max-width: 1360px;
  margin: var(--gap-section) auto 0;
}

/* --- переиспользуемый заголовок секции ("работы (1)", "обо мне (2)") --- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 18px 0;
  border-bottom: 1px solid #000;
  text-transform: uppercase;
}

.section-label {
  font-family: "Neue Haas Grotesk Display Pro", sans-serif;
  font-size: 19px;
  line-height: 19px;
}

.section-counter {
  font-family: "GT America Mono", monospace;
  font-size: 19px;
  line-height: 19px;
  letter-spacing: -0.0882em;
}

/* ===== работы ===== */
.works {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.work-divider {
  height: 1px;
  background: #000;
  width: 100%;
}

.work-row {
  display: flex;
  align-items: stretch;
  gap: 20px;
}

.work-info {
  flex: 0 0 39.12%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-transform: uppercase;
}

.work-tag {
  font-family: "GT America Mono", monospace;
  font-size: 12px;
  line-height: 12px;
  color: var(--color-tag);
}

.work-title {
  margin: 0;
  display: flex;
  align-items: flex-end;
  gap: clamp(8px, 1.25vw, 17px);
  font-family: "Panama", serif;
  font-weight: normal;
  font-size: clamp(28px, 4.27vw, 58px);
  letter-spacing: -0.06em;
  line-height: 1;
  color: #000;
}

.work-number {
  font-family: "PP Editorial New", serif;
  font-weight: 200;
  font-size: clamp(24px, 3.82vw, 52px);
  letter-spacing: -0.04em;
}

.work-image {
  flex-shrink: 0;
  overflow: hidden;
}

.work-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.work-image--wide {
  flex-basis: 33.38%;
  aspect-ratio: 454 / 315;
}

.work-image--square {
  flex-basis: 23.16%;
  aspect-ratio: 1 / 1;
}

.work-meta {
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  text-align: right;
  text-transform: uppercase;
  font-family: "GT America Mono", monospace;
  font-size: 12px;
  line-height: 12px;
}

.work-facts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.work-tags {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

/* ===== типы проектов ===== */
.bottom-group {
  display: flex;
  flex-direction: column;
}

.skills-canvas {
  position: relative;
  /* свой stacking context, чтобы z-index шариков не утекал на страницу */
  z-index: 0;
  width: 100%;
  aspect-ratio: 1360 / 682;
  border: 1px solid #000;
  border-radius: 40px;
  overflow: hidden;
}

.skills-hint,
.skills-title {
  position: absolute;
  left: 50%;
  text-align: center;
  white-space: nowrap;
  color: #000;
  text-transform: uppercase;
  z-index: 2;
  pointer-events: none;
}

/* низ подсказки над верхом заголовка (50% − половина его font-size); 3px дают видимый
   зазор ~10px из-за пустоты строки Panama */
.skills-hint {
  top: calc(50% - clamp(26px, 4.27vw, 58px) / 2 - 3px);
  transform: translate(-50%, -100%);
  font-family: "GT America Mono", monospace;
  font-size: 16px;
}

.skills-title {
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  font-family: "Panama", serif;
  font-weight: normal;
  font-size: clamp(26px, 4.27vw, 58px);
  letter-spacing: -0.06em;
  line-height: 1;
}

.skills-balls {
  position: absolute;
  inset: 0;
}

.skills-balls li {
  position: absolute;
  aspect-ratio: 1 / 1;
  width: 11.03%;
  border: 1px solid #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  font-family: "GT America Mono", monospace;
  font-size: 12px;
  line-height: 12px;
  color: #000;
  text-transform: uppercase;
}

.skills-balls li:nth-child(1) {
  left: 77.87%;
  top: 0.51%;
}
.skills-balls li:nth-child(2) {
  left: 59.41%;
  top: 11.14%;
}
.skills-balls li:nth-child(3) {
  left: 43.9%;
  top: 8.8%;
}
.skills-balls li:nth-child(4) {
  left: 15.37%;
  top: 12.9%;
}
.skills-balls li:nth-child(5) {
  left: 30%;
  top: 23.02%;
}
.skills-balls li:nth-child(6) {
  left: 30%;
  top: 48.24%;
}
.skills-balls li:nth-child(7) {
  left: 18.46%;
  top: 48.24%;
}
.skills-balls li:nth-child(8) {
  left: 18.46%;
  top: 77.57%;
}
.skills-balls li:nth-child(9) {
  left: 31.47%;
  top: 77.57%;
}
.skills-balls li:nth-child(10) {
  left: 48.16%;
  top: 77.57%;
}
.skills-balls li:nth-child(11) {
  left: 61.18%;
  top: 77.57%;
}
.skills-balls li:nth-child(12) {
  left: 77.87%;
  top: 77.57%;
}
.skills-balls li:nth-child(13) {
  left: 64.93%;
  top: 48.24%;
}

/* на десктопе js/skills-balls.js заменяет статичный список на физику-канвас */
.skills-balls--hidden {
  display: none;
}

.skills-physics-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  touch-action: none;
}

/* ===== обо мне ===== */
.about {
  margin-top: var(--gap-sub);
  display: flex;
  flex-direction: column;
  gap: 60px;
}

.about-body {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.about-text {
  flex: 0 0 39.1%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: justify;
  text-transform: uppercase;
}

.about-intro {
  margin: 0;
  font-family: "Neue Haas Grotesk Display Pro", sans-serif;
  font-size: 19px;
  line-height: 21px;
}

.about-bio {
  margin: 0;
  font-family: "GT America Mono", monospace;
  font-size: 12px;
  line-height: 16px;
}

.about-programs {
  flex: 0 0 39.1%;
  min-width: 260px;
}

.about-programs h4 {
  margin: 0 0 12px;
  font-family: "Neue Haas Grotesk Display Pro", sans-serif;
  font-weight: normal;
  font-size: 19px;
  text-transform: uppercase;
}

.about-programs-cols {
  display: flex;
  gap: 20px;
}

.about-programs-cols ul {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: "GT America Mono", monospace;
  font-size: 12px;
  line-height: 16px;
  text-transform: uppercase;
}

/* ===== контакты / футер ===== */
.contacts {
  margin-top: var(--gap-sub);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  padding-bottom: var(--gap-section);
}

.contacts-email {
  font-family: "Panama", serif;
  font-size: clamp(28px, 4.27vw, 58px);
  line-height: 1;
  letter-spacing: -0.06em;
  text-transform: uppercase;
  color: #000;
}

.contacts-links {
  flex: 0 0 39.1%;
  min-width: 260px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: "GT America Mono", monospace;
  font-size: 16px;
  text-transform: uppercase;
}

.contacts-link--pending {
  color: #000;
  opacity: 0.35;
  cursor: default;
}

/* отступ снизу как верхний padding хедера */
@media (min-width: 861px) {
  .contacts {
    padding-bottom: clamp(20px, 2.6vw, 32px);
    /* по базовой линии: иначе "@" опускает низ почты и ссылки уезжают ниже букв */
    align-items: baseline;
  }
}

/* ===== адаптация ≤860: общее для телефона и планшета ===== */
@media (max-width: 860px) {
  .hero-nav {
    flex-wrap: wrap;
    row-gap: 16px;
  }
  .nav-links {
    gap: 20px;
  }

  .hero-bottom {
    gap: 24px;
  }

  /* --- обо мне --- */
  .about-body {
    flex-direction: column;
    gap: 32px;
  }
  .about-text,
  .about-programs {
    flex-basis: 100%;
  }
  .about-programs {
    text-align: left;
  }

  /* --- контакты --- */
  .contacts {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    padding-bottom: 24px;
  }
  .contacts-links {
    flex-basis: 100%;
    justify-content: flex-start;
    gap: 20px;
    flex-wrap: wrap;
  }
}

/* ===== только телефон (на планшете — десктопный заголовок и своя раскладка работ) ===== */
@media (max-width: 480px) {
  .hero-headline {
    height: auto;
    padding: 48px 0 24px;
  }
  .hero-star {
    display: none;
  }
  .hero-line {
    position: static;
    display: block;
    transform: none;
    font-size: clamp(28px, 9vw, 40px);
    white-space: normal;
  }
  .hero-accent {
    position: static;
    display: block;
    transform: none;
    text-align: left;
    margin-top: 12px;
  }

  .hero-bottom {
    flex-wrap: wrap;
  }
  .hero-stats {
    align-items: flex-start;
    text-align: left;
  }

  /* --- работы --- */
  .work-row {
    flex-wrap: wrap;
  }
  .work-info {
    flex: 1 1 100%;
    order: 1;
    gap: 12px;
  }
  .work-image {
    order: 2;
    flex: 1 1 100%;
  }
  .work-image--wide,
  .work-image--square {
    flex-basis: 100%;
  }
  .work-meta {
    order: 3;
    flex: 1 1 100%;
    align-items: flex-start;
    text-align: left;
    margin-top: 12px;
  }
  .work-facts,
  .work-tags {
    align-items: flex-start;
  }
}

/* ===== мобильный макет главной (холст 390px, контент 350px) ===== */
@media (max-width: 480px) {
  /* svh — нижний блок не уезжает под адресную строку iPhone; vh — запасной */
  .hero {
    height: 100vh;
    height: 100svh;
    padding-bottom: 20px;
    gap: 0;
  }
  .hero-headline {
    height: auto;
    padding: 0;
    margin: auto 0;
  }

  .hero-lines--desktop {
    display: none;
  }

  .hero-lines--mobile {
    display: block;
    position: relative;
    width: 100%;
    height: 210px;
  }

  .hero-line-m {
    position: absolute;
    display: block;
    white-space: nowrap;
    font-family: "Panama", serif;
    font-weight: normal;
    font-size: 40px;
    line-height: 1;
    letter-spacing: -0.0695em;
    text-transform: uppercase;
    color: #000;
  }
  .hero-line-m:nth-of-type(1) {
    left: 45px;
    top: 0;
  }
  .hero-line-m:nth-of-type(2) {
    left: 0;
    top: 43px;
  }
  .hero-line-m:nth-of-type(3) {
    left: 107px;
    top: 83px;
  }
  .hero-line-m:nth-of-type(4) {
    left: 14px;
    top: 123px;
  }
  .hero-line-m:nth-of-type(5) {
    left: 101px;
    top: 163px;
  }

  .hero-star {
    display: block;
    position: absolute;
    left: 11px;
    top: 9px;
    width: 22px;
    height: 21px;
  }

  .hero-accent {
    display: block;
    position: absolute;
    left: auto;
    right: 10px; /* правый край текста на x=340 из 350 */
    top: 175px;
    transform: none;
    margin-top: 0;
    text-align: right;
    font-size: 12px;
  }

  /* --- знакомство --- */
  .hero-bottom {
    flex-wrap: nowrap;
  }
  .hero-greeting {
    gap: 10px;
  }
  .hero-photo {
    width: 88px;
    height: 100px;
  }
  .hero-greeting-text {
    font-size: 12px;
  }
  /* перекрываем выравнивание влево из блока выше */
  .hero-stats {
    gap: 4px;
    font-size: 12px;
    align-items: flex-end;
    text-align: right;
  }

  /* --- типы проектов: хинт+заголовок центрированы как единый блок, поэтому top в % --- */
  .skills-canvas {
    aspect-ratio: 350 / 650;
    border-radius: 24px;
  }
  .skills-hint {
    top: 46.02%;
    transform: translateX(-50%);
    font-size: 12px;
  }
  .skills-title {
    top: 49.71%;
    transform: translateX(-50%);
    font-size: 40px;
  }

  /* --- хедер: ссылки в .mobile-menu (создаёт js/nav.js) --- */
  .nav-links {
    display: none;
  }
  .nav-menu-toggle {
    display: block;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font-family: "GT America Mono", monospace;
    font-size: 12px;
    text-transform: uppercase;
    color: #fff;
    mix-blend-mode: difference;
  }

  /* --- работы --- */
  .work-tags {
    display: none;
  }
  /* baseline — у Panama и моно разный размер */
  .work-info {
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    gap: 20px;
  }
  .work-info .work-title {
    order: 1;
    font-size: 40px;
  }
  /* пропорция 52:58, как на десктопе */
  .work-info .work-number {
    font-size: 36px;
  }
  .work-info .work-tag {
    order: 2;
    text-align: right;
  }
  .work-meta {
    margin-top: 0;
  } /* иначе +12px к gap .work-row */
  .work-facts {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
  }
  /* Thothex: три факта — дата слева, два справа столбиком */
  .work-facts--split {
    display: grid;
    grid-template-columns: auto auto;
    justify-content: space-between;
    column-gap: 16px;
    row-gap: 4px;
  }
  .work-facts--split > :first-child {
    grid-row: 1 / span 2;
  }
  .work-facts--split > :not(:first-child) {
    grid-column: 2;
    text-align: right;
  }
  /* вместе с gap:20px у .works — 40px */
  .work-row {
    margin-top: 20px;
  }

  /* --- обо мне --- */
  .about {
    gap: 32px;
  }
  .about-body {
    gap: 20px;
  }
  .about-programs-cols {
    gap: 32px;
  } /* 142 + 32 + 176 = 350 — ширина контента */

  /* --- контакты: ссылки над почтой через order --- */
  .contacts {
    gap: 10px;
  }
  .contacts-email {
    order: 2;
    font-size: 32px;
  }
  .contacts-links {
    order: 1;
    /* иначе в колоночном flex с align-items:flex-start space-between нечего распределять */
    align-self: stretch;
    flex-basis: auto;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 0;
    font-size: 12px;
  }
}

/* ===== мобильное меню (создаёт js/nav.js) =====
   Открытие — clip-path: circle() из кнопки; --menu-x/-y/-r ставит скрипт.
   visibility с задержкой — круг успевает схлопнуться. */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  padding: 0 20px 24px;
  background: #fff;
  color: #000;
  clip-path: circle(0px at var(--menu-x, 100%) var(--menu-y, 0%));
  visibility: hidden;
  transition:
    clip-path 0.7s cubic-bezier(0.65, 0, 0.35, 1),
    visibility 0s linear 0.7s;
}

.mobile-menu.is-open {
  clip-path: circle(
    var(--menu-r, 150vmax) at var(--menu-x, 100%) var(--menu-y, 0%)
  );
  visibility: visible;
  transition:
    clip-path 0.7s cubic-bezier(0.65, 0, 0.35, 1),
    visibility 0s;
}

/* верх совпадает с хедером — лого и "(закрыть)" на месте лого и "(меню)" */
.mobile-menu-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: clamp(20px, 2.6vw, 32px);
}

/* фон всегда белый — без инверсии */
.mobile-menu .logo-text-img {
  mix-blend-mode: normal;
  filter: none;
}

.mobile-menu-close {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font-family: "GT America Mono", monospace;
  font-size: 12px;
  text-transform: uppercase;
  color: #000;
}

/* фокус на "(закрыть)" ставит скрипт — рамка только с клавиатуры */
.mobile-menu-close:focus {
  outline: none;
}
.mobile-menu a:focus-visible,
.mobile-menu-close:focus-visible {
  outline: 1px solid #000;
  outline-offset: 4px;
}

.mobile-menu-links {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 36px;
}

.mobile-menu-link {
  font-family: "GT America Mono", monospace;
  font-size: 16px;
  line-height: 1.1;
  text-transform: uppercase;
  color: #000;
}

/* мобильные стили футера уже заданы в ≤480 — убираем только внешние отступы */
.mobile-menu .contacts {
  margin-top: 0;
  padding-bottom: 0;
}
/* явно, чтобы меню не зависело от футера */
.mobile-menu .contacts-links {
  font-size: 12px;
}

/* появление по очереди (--i ставит скрипт); сброс — мгновенно через 0.8s,
   уже после схлопывания круга (0.7s) */
.mobile-menu-link,
.mobile-menu-contacts {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0s linear 0.8s,
    transform 0s linear 0.8s;
}

.mobile-menu.is-open .mobile-menu-link,
.mobile-menu.is-open .mobile-menu-contacts {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.9s cubic-bezier(0.33, 1, 0.68, 1),
    transform 1s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(0.35s + var(--i, 0) * 0.1s);
}

/* Lenis останавливает сам скрипт */
html.mobile-menu-open,
html.mobile-menu-open body {
  overflow: hidden;
}

@media (min-width: 481px) {
  .mobile-menu {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-menu,
  .mobile-menu.is-open {
    clip-path: none;
    transition: none;
  }
  .mobile-menu-link,
  .mobile-menu-contacts,
  .mobile-menu.is-open .mobile-menu-link,
  .mobile-menu.is-open .mobile-menu-contacts {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ===== хедер на тач-устройствах — position:sticky =====
   top=scrollY отстаёт от прокрутки пальцем, а fixed в iOS 26 Safari сдвигается при
   сворачивании панели (WebKit bug 297779). html.touch-nav ставит js/nav.js и переносит
   <header> в начало <body> (иначе sticky не работает). Блендинг тут выключен, поэтому
   можно z-index и скрытие через transform. */
html.touch-nav .hero-nav {
  position: sticky;
  top: 0 !important; /* перебиваем inline top из js */
  left: auto;
  right: auto;
  z-index: 100;
  width: auto;
  /* отрицательный низ — не занимает места в потоке (отступ даёт padding-top с --nav-h) */
  margin: 0 auto calc(var(--nav-h, 110px) * -1);
  transition:
    transform 0.4s ease,
    opacity 0.4s ease,
    visibility 0s linear 0s;
}
/* строка состояния iOS 26 прозрачна — уехавший хедер просвечивал за часами, поэтому ещё
   и гаснет; visibility после анимации — чтобы не ловил нажатия */
html.touch-nav .hero-nav.nav-hidden {
  margin-top: 0;
  transform: translateY(-130%);
  opacity: 0;
  visibility: hidden;
  transition:
    transform 0.4s ease,
    opacity 0.4s ease,
    visibility 0s linear 0.4s;
}

html.touch-nav .logo-text-img {
  mix-blend-mode: normal;
  filter: none; /* исходный SVG лого чёрный — invert(1) делал его белым для difference */
}
html.touch-nav .nav-links a,
html.touch-nav .nav-links a::after,
html.touch-nav .nav-menu-toggle {
  mix-blend-mode: normal;
}
html.touch-nav .nav-links a,
html.touch-nav .nav-menu-toggle {
  color: #000;
}
html.touch-nav .nav-links a::after {
  background: #000;
}

/* ===== планшет и узкий десктоп (481–1439) =====
   Строки масштабируются в vw, подпись 16px — уже 1360px она наезжает на третью строку,
   поэтому переезжает под неё (right — как у .hero-line:nth-of-type(3)). */
@media (min-width: 481px) and (max-width: 1439px) {
  /* 37px = (14.49% − 11.8%) от 1360 */
  .hero-star {
    left: calc(14.49% - 37px);
  }
  .hero-accent {
    right: 20.37%;
    top: calc(56.59% + var(--hero-fs) * 1.9); /* под третьей строкой */
    font-size: clamp(12px, 1.4vw, 16px);
  }
}

@media (min-width: 481px) and (max-width: 860px) {

  /* работы: обложка слева, текст справа */
  .work-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "image info"
      "image meta";
    grid-template-rows: auto 1fr;
    column-gap: 24px;
    row-gap: 24px;
    align-items: start;
  }
  .work-image {
    grid-area: image;
    width: 100%;
  }
  .work-info {
    grid-area: info;
    gap: 12px;
    justify-content: flex-start;
  }
  .work-title {
    font-size: clamp(32px, 5.5vw, 46px);
  }
  .work-number {
    font-size: clamp(28px, 5vw, 42px);
  }
  /* теги прижаты к низу карточки */
  .work-meta {
    grid-area: meta;
    align-self: stretch;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 20px;
    text-align: left;
  }
  .work-meta .work-tags {
    margin-top: auto;
  }

  .about-body {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 40px;
  }
  .about-text,
  .about-programs {
    flex: 1 1 0;
    min-width: 0;
  }
  .work-facts {
    align-items: flex-start;
  }
  .work-tags {
    align-items: flex-start;
  }
}

/* ===== фон первого экрана главной =====
   На body::before — нужна ширина окна, а не колонки .hero. z-index -2 — под #bg-canvas (-1);
   белый фон body рисуется ниже любых отрицательных слоёв. cover: на узких/вертикальных экранах
   рисунок не сжимается, а обрезается по бокам (видна середина). */
body.page-home::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  /* на 5% выше экрана — низ рисунка заходит за край */
  height: 105vh;
  height: 105svh;
  background: url("../assets/bg-desktop.svg") center bottom / cover no-repeat;
  z-index: -2;
  pointer-events: none;
}

/* на планшете и телефоне рисунок виден лишь частично — показываем левый край (фигура с рукой),
   середина там нечитаема */
@media (max-width: 1100px) {
  body.page-home::before {
    background-position: left bottom;
  }
}
