/* =========================================================================
   Алина Хоняк — дизайн-система сайта
   Белые страницы, один гротеск (Onest; подключается <link> в <head> страниц —
   не @import, чтобы браузер начинал грузить шрифт сразу). Палитра и шкала — в :root.
   ========================================================================= */

:root {
  --bg: #FFFFFF;
  --ink: #111111;
  --ink-soft: #6B6B6B;
  --rule: #E6E6E6;
  --hover: #F6F3EE;

  --font: 'Onest', 'Helvetica Neue', Arial, sans-serif;

  --container: 1280px;
  --gutter: clamp(1rem, 4vw, 1.75rem);
  --header-h: 64px;

  --step-small: 0.8125rem;
  --step-body: 1rem;
  --step-lead: clamp(1.05rem, 0.95rem + 0.5vw, 1.3rem);
  --step-h3: clamp(1.1rem, 1rem + 0.5vw, 1.35rem);
  --step-h2: clamp(1.4rem, 1.1rem + 1.4vw, 2.1rem);
  --step-h1: clamp(1.8rem, 1.2rem + 2.6vw, 3.2rem);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- сброс ------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  padding-top: var(--header-h);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-weight: 400;
  line-height: 1.15;
  margin: 0 0 0.6em;
  letter-spacing: -0.01em;
}
h1 { font-size: var(--step-h1); }
h2 { font-size: var(--step-h2); }
h3 { font-size: var(--step-h3); }

p { margin: 0 0 1.1em; }
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.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;
}

/* --- служебная типографика ------------------------------------------- */

.eyebrow {
  font-size: var(--step-small);
  color: var(--ink-soft);
  margin: 0 0 1em;
}

.lead {
  font-size: var(--step-lead);
  max-width: 52ch;
}

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

.link {
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}
.link:hover, .link:focus-visible { border-bottom-color: currentColor; }

/* --- контейнеры и секции -------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: clamp(2.5rem, 6vw, 5rem); }

.page-head { padding-block: clamp(2rem, 5vw, 4rem) clamp(1.25rem, 3vw, 2rem); }
.page-head .lead { margin-top: 1rem; }
.back-link { margin-bottom: 1.25rem; font-size: var(--step-small); }

.state {
  min-height: 46vh;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 1rem;
}

/* --- проза ------------------------------------------------------------ */

.prose { max-width: 62ch; }
.prose p { font-size: 1.05rem; }

/* Инфо: раскрывающийся список; чёрные линии — как в меню. */
.info-list { max-width: 72ch; border-top: 1px solid var(--ink); }
.info-item {
  border-bottom: 1px solid var(--ink);
  scroll-margin-top: calc(var(--header-h) + 1rem);
}
.info-item > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0;
  cursor: pointer;
  list-style: none;
}
.info-item > summary::-webkit-details-marker { display: none; }
.info-item > summary::after {
  content: '+';
  flex: none;
  font-size: 1.6rem;
  line-height: 1;
  transition: transform 0.25s ease;
}
.info-item[open] > summary::after { transform: rotate(45deg); }
.info-title { margin: 0; font-size: var(--step-h3); }
.info-body { padding-bottom: 2rem; overflow-wrap: anywhere; }
.info-body h3 { font-size: 1.05rem; font-weight: 500; margin: 1.8em 0 0.6em; }
.info-body h4 { font-size: 1rem; font-weight: 500; margin: 1.3em 0 0.4em; }
.info-body ul { margin: 0 0 1.1em; padding-left: 1.2em; }
.info-body li { margin-bottom: 0.3em; }
.info-note { color: var(--ink-soft); font-size: var(--step-small); margin-top: 0; }
.info-document { max-width: 72ch; }
.info-document .info-body h2 { font-size: var(--step-h3); margin: 1.8em 0 0.6em; }

/* --- сетки изображений ------------------------------------------------ */

/* Сетка фотографий: кнопки data-zoom с <img> внутри. */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.75rem, 2vw, 1.25rem);
  align-items: start;
}
.photo-grid button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.photo-grid img { width: 100%; }

.teaching-group {
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}
.teaching-group h2 { max-width: 65ch; font-size: var(--step-h3); margin: 1rem 0 0; }
.teaching-portrait-and-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.teaching-portrait-and-stack > :first-child { grid-row: span 2; }

/* Фото проекта колонками: каждая картинка сразу под предыдущей — без пустот,
   которые оставляет сетка рядами, когда рядом стоят вертикальные и горизонтальные. */
.project-photos { display: block; columns: 3; column-gap: clamp(0.75rem, 2vw, 1.25rem); }
.project-photos > button { break-inside: avoid; margin-bottom: clamp(0.75rem, 2vw, 1.25rem); }

/* Серии: лента картин одной высоты с подписями; листается стрелками
   и пальцем, ленты серий идут друг под другом. */
.strip { scroll-margin-top: calc(var(--header-h) + 1rem); } /* series.html#slug — заголовок не под шапкой */
.strip + .strip { margin-top: clamp(3rem, 7vw, 5rem); }
.strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: clamp(1rem, 2.5vw, 1.5rem);
}
.strip-head h2 { margin: 0; }
.strip-nav { display: flex; gap: 0.5rem; flex: none; }
.strip-nav[hidden] { display: none; }
.strip-arrow {
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, opacity 0.2s;
}
.strip-arrow:hover:not(:disabled) { background: var(--ink); color: var(--bg); }
.strip-arrow:disabled { opacity: 0.25; cursor: default; }
.strip-track {
  --strip-h: clamp(240px, 26vw, 360px);
  display: flex;
  gap: clamp(1rem, 2vw, 1.5rem);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  padding-bottom: 0.75rem;
  scrollbar-width: thin;
}
/* min-content: подпись переносится по ширине картины, а не раздвигает её */
.strip-item { flex: none; width: min-content; margin: 0; scroll-snap-align: start; }
.strip-item button { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; }
.strip-item img {
  display: block;
  height: var(--strip-h);
  width: auto;
  max-width: calc(100vw - 2 * var(--gutter));
  object-fit: contain;
  object-position: left bottom;
}
.strip-item figcaption { display: grid; gap: 0.15rem; margin-top: 0.75rem; line-height: 1.35; }
.strip-title { font-weight: 500; }
.strip-meta { color: var(--ink-soft); font-size: var(--step-small); }

/* --- главная ---------------------------------------------------------- */

.hero { padding-top: clamp(1rem, 3vw, 2rem); }
.hero-figure {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.hero-figure picture { display: block; }
.hero-figure img { width: 100%; max-height: calc(100vh - var(--header-h) - 2rem); object-fit: contain; }
.hero-text { margin-top: clamp(1.25rem, 3vw, 2rem); }
.home-text { margin-top: clamp(2rem, 5vw, 3.5rem); }
/* два фрагмента «Чувашской свадьбы» — рядом, в два столбца */
.home-photos { grid-template-columns: repeat(2, 1fr); }

/* Проект: главная картинка под заголовком, ниже текст и фото. */
.project-hero .hero-figure { width: fit-content; margin-inline: auto; }
.project-hero .hero-figure img { width: auto; }
.project-text { margin-bottom: clamp(2rem, 4vw, 3rem); }

/* Проекты: карточки друг под другом — обложка, название, короткое описание.
   На телефоне текст под обложкой, шире — справа от неё (иначе обложка 4:5
   во всю ширину выше экрана). */
.cards { display: grid; gap: clamp(3rem, 6vw, 5rem); }
.card { display: grid; gap: 0.5rem; align-content: start; text-decoration: none; }
.card-cover { display: block; overflow: hidden; aspect-ratio: 4 / 5; background: var(--hover); }
.card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s var(--ease); }
.card-cover:hover img { transform: scale(1.03); }
.card-title { font-size: var(--step-h3); margin-top: 0.4rem; }
.card-summary { color: var(--ink-soft); max-width: 44ch; }
@media (min-width: 601px) {
  .card {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    grid-template-rows: auto 1fr;
    column-gap: clamp(1.5rem, 4vw, 3rem);
  }
  .card-cover { grid-row: 1 / span 2; }
}

/* --- об авторе ------------------------------------------------- */

.about {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: start;
}
.about-portrait { margin: 0; }
.about-portrait figcaption { margin-top: 0.5rem; font-size: var(--step-small); color: var(--ink-soft); }
.about-portrait img { display: block; width: 100%; height: auto; }
.about-statement h2 { margin-top: 0; }
.about-cv { margin-top: clamp(3rem, 7vw, 5rem); max-width: 62rem; }
.about-cv-title { margin: 0 0 clamp(1.5rem, 3vw, 2.25rem); }
.about-cv .cv-section h2 { font-size: var(--step-h3); }

/* --- контакты и мастерская (по образцу jkim.ru/contact) ------------- */
/* Контакты: блок связи с формой — в общей колонке сайта (.container), как
   содержимое других страниц, на компьютере в левую половину. Мастерская: фото 2:3 от левого края на
   половину ширины и текст справа, он «прилипает» при прокрутке; на телефоне
   фото во всю ширину, текст под ним. Заголовки чёрные, описания серые. */

.contacts-intro,
.visit-text { font-size: 17px; line-height: 1.3; }
.contacts-intro { width: 50%; padding: clamp(2rem, 5vw, 4rem) 0 28px; }
.contacts-intro p { margin: 0; }
.contacts-heading, .visit-heading { margin: 0; font-size: inherit; line-height: inherit; }
.contacts-muted, .visit-muted { color: var(--ink-soft); }
.contacts-muted p { margin: 0; }
.contacts-muted p + p { margin-top: 1em; }
.contacts-muted a { color: inherit; text-decoration: none; box-shadow: inset 0 -1px 0 currentColor; }

/* Форма обратной связи — в блоке связи, под фразой с почтой. */
.contacts-intro .contacts-form-intro { margin-top: 32px; }
.contacts-form { margin-top: 20px; text-align: left; }
.form { display: grid; gap: 1.25rem; max-width: 34rem; }
.form-sent { margin: 0; padding: 0.9rem 1rem; background: var(--hover); }
.field { display: grid; gap: 0.4rem; }
.field label { font-size: var(--step-small); color: var(--ink-soft); }
.field input, .field textarea {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--rule);
  padding: 0.75em 0.85em;
  width: 100%;
}
.field textarea { min-height: 8rem; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--ink); }
.consent { display: flex; gap: 0.6rem; align-items: flex-start; font-size: var(--step-small); }
.consent input { margin-top: 0.2em; }

.studio-visit { display: flex; align-items: flex-start; }
.visit-photo { width: 50%; margin: 0; }
.visit-photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: #EDEDED;
}
.visit-text {
  position: sticky;
  top: var(--header-h);
  width: 50%;
  padding: 108px 28px 40px;
}
.visit-heading { margin-bottom: 16px; }
.visit-muted { margin: 0 0 32px; }
.studio-more { margin-top: clamp(2.5rem, 6vw, 4.5rem); }
/* Фото процесса без пустых ячеек: ширина каждого пропорциональна его сторонам
   (--r = ширина / высота, ставит studio.js), поэтому в ряду фото одной высоты;
   не помещаются при высоте ~260px — переносятся (на телефоне одно под другим). */
.studio-photos { display: flex; flex-wrap: wrap; gap: clamp(0.75rem, 2vw, 1.25rem); }
.studio-photos + .studio-photos { margin-top: clamp(0.75rem, 2vw, 1.25rem); }
.studio-photos button {
  --r: 1;
  /* рост ×10: сумма в строке не меньше 1, иначе одно фото не растянется */
  flex: calc(var(--r) * 10) 1 calc(var(--r) * 260px);
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.studio-photos img { display: block; width: 100%; height: auto; }
.visit-book { display: block; width: 100%; padding: 11px 13px; text-align: center; text-decoration: none; }

@media (max-width: 739px) {
  .contacts-intro,
  .visit-text { font-size: 15px; }
  .contacts-intro { width: auto; padding: 32px 0; text-align: center; }
  .contacts-intro .contacts-heading { margin-bottom: 4px; }
  .contacts-form { margin: 24px auto 0; }
  .studio-visit { display: block; }
  .visit-photo { width: auto; }
  .visit-text { position: static; width: auto; padding: 24px 24px 28px; }
  .visit-heading { margin-bottom: 12px; }
  .visit-muted { margin-bottom: 20px; }
}

.btn {
  padding: 0.8em 1.6em;
  border: 1px solid var(--ink);
  background: var(--bg);
  cursor: pointer;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}
.btn:hover, .btn:focus-visible { background: var(--ink); color: var(--bg); }

/* --- CV --------------------------------------------------------- */

.cv-section { margin-bottom: clamp(2rem, 4vw, 3rem); }
.cv-list { display: grid; gap: 0.8rem; }
.cv-row {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 1.25rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--rule);
}
.cv-row .period { color: var(--ink-soft); font-size: var(--step-small); padding-top: 0.2em; }

/* --- шапка -------------------------------------------------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: 28px;
  background: var(--bg);
  transition: background-color 0.45s ease;
}
.menu-open .site-header { background: transparent; }

.wordmark {
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}

.header-tools { display: flex; align-items: center; gap: 22px; }

.lang-switch { display: flex; gap: 8px; font-size: var(--step-small); }
.lang-switch button {
  background: none; border: 0; padding: 2px 0; cursor: pointer;
  color: var(--ink-soft);
}
.lang-switch button[aria-pressed="true"] { color: var(--ink); }

/* Бургер: три полоски по 2px с шагом 8px; открыто — крестик. */
.menu-toggle {
  position: relative;
  width: 32px; height: 24px;
  padding: 0; border: 0; background: none; cursor: pointer;
}
.menu-toggle span {
  position: absolute; left: 0; right: 0;
  height: 2px;
  background: var(--ink);
  transition: transform 0.35s ease, opacity 0.25s ease, top 0.35s ease;
}
.menu-toggle span:nth-child(1) { top: 3px; }
.menu-toggle span:nth-child(2) { top: 11px; }
.menu-toggle span:nth-child(3) { top: 19px; }
.menu-open .menu-toggle span:nth-child(1) { top: 11px; transform: rotate(45deg); }
.menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
.menu-open .menu-toggle span:nth-child(3) { top: 11px; transform: rotate(-45deg); }

/* --- меню-сетка ------------------------------------------- */

body.menu-open { overflow: hidden; }

/* Белый слой; сетка стоит сразу под шапкой, по центру. Слой — контейнер
   размеров: 100cqw/100cqh в сетке — его ширина и высота без отступов. */
.menu-layer {
  --menu-pad-b: 24px;
  position: fixed;
  inset: 0;
  z-index: 20;
  container-type: size;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--header-h) 0 var(--menu-pad-b);
  background: var(--bg);
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.45s ease;
}
/* display: flex выше перебивает атрибут hidden — без этого закрытое
   прозрачное меню лежит поверх страницы и перехватывает клики */
.menu-layer[hidden] { display: none; }
.menu-open .menu-layer { opacity: 1; }

/* 2 × 4 прямоугольника 1,3 : 1 (как в образце liars.co), чёрные линии 1px.
   Сетка во всю ширину экрана, а если так не помещается по высоте — во всю
   высоту, по центру, с рамкой вокруг. Во всю ширину сетка на 2px шире
   экрана, и боковые линии рамки уходят за его края — как на телефоне в образце.
   Высота 4 рядов = ширина сетки / 0,65. */
.menu-grid {
  --grid-w: min(calc(100cqw + 2px), calc(100cqh * 0.65));
  flex: none;
  width: var(--grid-w);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid var(--ink);
  border-bottom: 0;
}

.menu-cell {
  aspect-ratio: 1.3 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  overflow: hidden;
  text-align: center;
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  transition: background-color 0.25s;
}
.menu-cell:nth-child(odd) { border-right: 1px solid var(--ink); }
.menu-cell:not(.is-disabled):hover { background-color: var(--hover); }
.menu-cell.is-disabled { cursor: default; }
.menu-cell:focus-visible { outline-offset: -5px; }

/* Названия проявляются по очереди; линии сетки стоят на месте. */
.menu-title {
  font-size: clamp(11px, calc(var(--grid-w) * 0.0425), 24px);
  line-height: 1.2;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.menu-cell[data-id="home"] .menu-title { text-transform: uppercase; letter-spacing: 0.06em; }
.menu-open .menu-title { opacity: 1; transform: none; }
.menu-open .menu-cell:nth-child(1) .menu-title { transition-delay: 0.05s; }
.menu-open .menu-cell:nth-child(2) .menu-title { transition-delay: 0.10s; }
.menu-open .menu-cell:nth-child(3) .menu-title { transition-delay: 0.15s; }
.menu-open .menu-cell:nth-child(4) .menu-title { transition-delay: 0.20s; }
.menu-open .menu-cell:nth-child(5) .menu-title { transition-delay: 0.25s; }
.menu-open .menu-cell:nth-child(6) .menu-title { transition-delay: 0.30s; }
.menu-open .menu-cell:nth-child(7) .menu-title { transition-delay: 0.35s; }
.menu-open .menu-cell:nth-child(8) .menu-title { transition-delay: 0.40s; }
/* меню, открытое заново после смены языка (chrome.js), — сразу, без анимации */
.menu-instant .site-header,
.menu-instant .menu-toggle span,
.menu-instant .menu-layer,
.menu-instant .menu-title { transition: none; }

/* Компьютер (шире 1024 px): разделы строкой в шапке, как у valentino.com, —
   прописными, размером с RU/EN; значка меню и слоя с сеткой нет. Уже — как
   на телефоне. Граница та же, что DESKTOP в js/util.js. */
.header-nav { display: none; }
@media (min-width: 1025px) {
  .header-nav {
    display: flex;
    align-items: center;
    gap: clamp(18px, 2vw, 32px);
    margin: 0 32px 0 auto;
  }
  .header-link {
    font-size: var(--step-small);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    text-decoration: none;
    color: var(--ink);
    padding-block: 2px;
  }
  a.header-link:hover,
  .header-link[aria-current="page"] { box-shadow: inset 0 -1px 0 currentColor; }
  .header-link.is-disabled { color: var(--ink-soft); cursor: default; }
  .menu-toggle,
  .menu-layer { display: none; }
  /* меню открыли в узком окне и расширили его: chrome.js закроет меню,
     а до того страница уже прокручивается и шапка белая */
  body.menu-open { overflow: visible; }
  .menu-open .site-header { background: var(--bg); }
}

/* --- подвал ------------------------------------------------- */

/* Столбиком: © год, соцсети, документы и строка про авторское право. */
/* Подвал (chrome.js) появляется раньше содержимого страницы: до её готовности
   (page.js ставит body.is-ready) он скрыт — иначе мелькает под шапкой. */
.site-footer { visibility: hidden; }
.is-ready .site-footer { visibility: visible; }
.site-footer {
  display: grid;
  justify-items: start;
  gap: 1rem;
  margin-top: clamp(3rem, 8vw, 6rem);
  padding: 1.5rem 28px 2rem;
  border-top: 1px solid var(--rule);
  font-size: var(--step-small);
  color: var(--ink-soft);
}
.footer-copy, .footer-rights { margin: 0; }
.footer-rights { max-width: 62ch; }
.footer-info { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; color: var(--ink); }
.footer-info a { text-underline-offset: 0.2em; }
.footer-info a[href="info.html"] { text-transform: uppercase; }
@media (max-width: 1024px) {
  .footer-info a[href="info.html"] { flex-basis: 100%; }
}
.footer-social { display: flex; gap: 10px; margin: 0; padding: 0; list-style: none; }
.social-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  transition: background-color 0.25s, color 0.25s;
}
.social-icon svg { width: 18px; height: 18px; fill: currentColor; }
.social-icon:hover, .social-icon:focus-visible { background: var(--ink); color: var(--bg); }

/* --- просмотрщик ------------------------------------------- */

body.viewer-open { overflow: hidden; }

.viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
}
.viewer-stage {
  position: absolute;
  inset: 56px 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
  cursor: zoom-in;
}
.viewer-stage.is-zoomed { cursor: grab; }
.viewer-img {
  flex: none;
  max-width: 100%;
  max-height: calc(100% - var(--viewer-cap, 0px));
  width: auto;
  height: auto;
  transform-origin: center;
  user-select: none;
  will-change: transform;
}
/* подпись под изображением — те же строки, что в ленте серии */
.viewer-caption {
  flex: none;
  display: grid;
  gap: 0.15rem;
  max-width: 40rem;
  margin-top: 0.75rem;
  line-height: 1.35;
  text-align: center;
}
.viewer-caption[hidden] { display: none; }
.viewer-stage.is-zoomed .viewer-caption { visibility: hidden; }
.viewer-btn {
  position: absolute;
  width: 44px; height: 44px;
  border: 0; background: none; cursor: pointer;
  font-size: 22px; line-height: 1;
}
.viewer-close { top: 10px; right: 14px; }
.viewer-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.viewer-next { right: 10px; top: 50%; transform: translateY(-50%); }

@media (max-width: 600px) {
  .viewer-stage { inset: 56px var(--gutter); }
  .viewer-prev, .viewer-next { top: auto; bottom: 6px; transform: none; }
}

/* --- reveal ------------------------------------------------- */

/* Контент виден по умолчанию; анимация включается только когда JS
   добавил .js-reveal на <html> — иначе ничего не прячется. */
.reveal { opacity: 1; transform: none; }
.js-reveal .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.js-reveal .reveal.is-visible { opacity: 1; transform: none; }

/* --- адаптив ---------------------------------------------- */

@media (max-width: 900px) {
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .project-photos { columns: 2; }
  .about { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .teaching-portrait-and-stack { grid-template-columns: 1fr; }
  .teaching-portrait-and-stack > :first-child { grid-row: auto; }
}

@media (max-width: 800px) {
  .site-header { padding-inline: 16px; }
  /* на телефоне сетка доходит до низа экрана — так она остаётся во всю ширину */
  .menu-layer { --menu-pad-b: 0px; }
  .site-footer { padding-inline: 16px; }
}

@media (max-width: 560px) {
  .cv-row { grid-template-columns: 1fr; gap: 0.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
  .js-reveal .reveal, .reveal { opacity: 1 !important; transform: none !important; }
}
