/* ==========================================================================
   Главный экран и интро: «лист 01».
   Три цвета, сплошной фон. Анимируем только transform, opacity, clip-path.
   Состояние «до входа» (.hero-hold на <html>) ставит короткий скрипт в начале
   <body>, снимает js/hero.js; без JS и при reduced-motion оно не включается,
   всё видно сразу.
   ========================================================================== */

:root { --hero-ease: cubic-bezier(.22, 1, .36, 1); }

/* ---------- Интро: один лист, тихий подъём ---------- */
.intro { display: none; }
.js .intro {
  display: block; position: fixed; inset: 0; z-index: 900;
  pointer-events: none;
}
.no-intro .intro, .intro-done .intro { display: none; }

.intro-sheet {
  position: absolute; inset: 0;
  background: var(--white); color: var(--gray);
  clip-path: inset(0 0 0 0);
}
.intro-inner {
  position: absolute; inset: 0;
  width: 100%; max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto;
  padding: 0 var(--gutter);
}
/* инициалы: там же, где потом встанет подпись шапки */
.intro-ini {
  height: var(--header-h); display: flex; align-items: center;
  font-size: .75rem; font-weight: 500; letter-spacing: .34em; text-transform: uppercase;
  line-height: 1;
}
.intro-m { display: block; opacity: 0; }
.intro-run .intro-m { animation: hero-fade .5s ease both; }
.intro-lift .intro-sheet { animation: hero-lift .6s var(--hero-ease) forwards; }

@keyframes hero-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes hero-lift { from { clip-path: inset(0 0 0 0); } to { clip-path: inset(0 0 100% 0); } }

/* ---------- Главный экран ---------- */
.hero {
  --hero-ph: clamp(150px, calc((100svh - 330px) * .72), 480px);   /* ширина портрета 4:5 по высоте экрана */
  position: relative; overflow-x: clip;
  flex-direction: column; align-items: stretch; justify-content: space-between;
  padding: calc(var(--header-h) + clamp(16px, 4vh, 48px)) 0 0;
}
.hero .wrap {
  max-width: calc(var(--max) + 2 * var(--gutter));
  padding-inline: var(--gutter);
}
/* .rv оставлен ради общего контракта, но вход экрана ведёт этот модуль */
.js .hero .rv, .js .hero .rv.in { opacity: 1; transform: none; transition: none; }

.hero-grid {
  flex: 1 1 auto;
  display: grid; align-content: center;
  grid-template-columns: minmax(0, 1fr) min(var(--hero-ph), 40vw);
  grid-template-rows: auto auto;
  grid-template-areas: "h1 pic" "act pic";
  column-gap: clamp(32px, 5vw, 80px);
  row-gap: clamp(22px, 4vh, 44px);
  padding-bottom: clamp(18px, 3vh, 32px);
}
.hero-text { display: contents; }

/* --- заголовок: шкала от подписи до плаката --- */
.hero-h1 {
  grid-area: h1;
  display: flex; flex-direction: column;
  container-type: inline-size;
  font-family: var(--font-display); font-weight: 500;
  color: var(--white);
}
.hl { display: block; overflow: hidden; }
.hl-in { display: block; transition: transform .6s var(--hero-ease) var(--hero-d, 0s), opacity .6s ease var(--hero-d, 0s); }

/* «Адвокат»: подпись капсом и линия-линейка до края колонки */
.hl--role {
  --hero-d: 0s;
  display: flex; align-items: center; gap: clamp(14px, 1.6vw, 24px);
  padding: .3em 0; margin: -.3em 0;
  font-family: var(--font); font-weight: 500; font-size: clamp(.72rem, .5vw + .56rem, .9rem);
  letter-spacing: .36em; text-transform: uppercase; line-height: 1;
  color: var(--mist);
}
.hl--role::after {
  content: ""; flex: 1 1 auto; height: 1px; background: currentColor;
  transform-origin: 0 50%;
  transition: transform .8s var(--hero-ease) .1s;
}

/* фамилия: во всю колонку (размер подобран по ширине слова) */
.hl--sur {
  --hero-d: .05s;
  margin-top: auto;
  font-size: min(20.4cqi, 27svh); line-height: .86; letter-spacing: -.028em;
  padding: .09em .03em .12em; margin-left: -.03em; margin-bottom: -.12em;
  white-space: nowrap;
}
/* имя и отчество: курсив вполовину меньше, смещены к правому краю */
.hl--name {
  --hero-d: .1s;
  font-style: italic; font-weight: 400;
  font-size: min(9.6cqi, 12.8svh); line-height: 1;
  letter-spacing: -.005em; text-align: right;
  padding: .1em .03em .16em; margin-bottom: -.1em;
  white-space: nowrap;
}

.hero-actions {
  grid-area: act; align-self: end;
  display: flex; flex-wrap: wrap; gap: 12px;
  clip-path: inset(-24px -24px -24px -24px);
  transition: clip-path .6s var(--hero-ease) .15s;
}

/* --- портрет 4:5: мягкая шторка --- */
.portrait {
  grid-area: pic; position: relative;
  width: 100%; justify-self: end; align-self: center;
  aspect-ratio: 4 / 5;
}
.portrait-clip {
  position: absolute; inset: 0; overflow: hidden; background: var(--mist);
  clip-path: inset(0 0 0 0);
  transition: clip-path .6s var(--hero-ease) .05s;
}
.portrait-zoom { position: absolute; inset: 0; }
.portrait-zoom img {
  width: 100%; height: 100%; object-fit: cover;
  
}
/* стопка листов под портретом: сверху «лист 01», ниже ещё пять контурами (в деле шесть листов) */
.portrait-sheets { position: absolute; inset: 0; pointer-events: none; }
.portrait-sheets i {
  --n: 1;
  position: absolute; inset: 0;
  border: 1px solid var(--mist);
  transform: translate3d(calc(var(--n) * var(--hero-step, 7px) * -1), calc(var(--n) * var(--hero-step, 7px)), 0);
  clip-path: inset(0 0 0 0);
  transition: clip-path .6s var(--hero-ease) calc(.15s + var(--n) * .05s);
}
.portrait-sheets i:nth-child(2) { --n: 2; }
.portrait-sheets i:nth-child(3) { --n: 3; }
.portrait-sheets i:nth-child(4) { --n: 4; }
.portrait-sheets i:nth-child(5) { --n: 5; }

/* --- низ экрана: подсказка и бегущая строка --- */
.hero-foot { position: relative; }
.hero-cue {
  width: 100%; max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto;
  padding: 0 var(--gutter) clamp(14px, 2.4vh, 24px);
  display: flex; align-items: center; gap: 16px;
  font-size: .75rem; font-weight: 500; letter-spacing: .3em; text-transform: uppercase; line-height: 1;
  color: var(--mist);
}
.hero-cue-t { display: block; overflow: hidden; padding: .35em 0; margin: -.35em 0; }
.hero-cue-t > span { display: block; transition: opacity .6s ease .3s; }
.hero-cue-l {
  display: block; width: clamp(48px, 7vw, 96px); height: 1px; background: currentColor;
  transform-origin: 0 50%;
}
/* линия рисуется один раз */
.hero-cue-l { animation: hero-cue .9s var(--hero-ease) .45s both; }
.hero-hold .hero-cue-l { animation: none; transform: scaleX(0); }
@keyframes hero-cue { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.hero-marquee {
  position: relative; overflow: hidden;
  padding: clamp(14px, 2.4vh, 22px) 0 clamp(16px, 2.8vh, 26px);
}
.hero-marquee::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--mist);
  transform-origin: 0 50%;
  transition: transform .8s var(--hero-ease) .2s;
}
.hero-marq-track { transition: opacity .6s ease .3s; }
.hero-marq-list {
  display: flex; flex-wrap: wrap; row-gap: .2em;
  padding-inline: var(--gutter);
  font-family: var(--font-display); font-style: italic; font-weight: 400;
  font-size: clamp(1.25rem, 1.1vw + .95rem, 1.9rem); line-height: 1.3;
  color: var(--mist);
}
.hero-marq-list li { white-space: normal; }
.hero-marq-list li:last-child::after { content: none; }   /* в статичном виде после последнего названия знак не нужен */
.hero-marq-list li::after {      /* § — знак раздела в канцелярском духе */
  content: "§"; margin: 0 1.1em; font-style: normal; font-size: .72em; vertical-align: .12em;
}


/* --- состояние «до входа» --- */
.hero-hold .hl-in { transform: translateY(12px); opacity: 0; }
.hero-hold .hl--role::after { transform: scaleX(0); }
.hero-hold .hero-actions { clip-path: inset(-24px 100% -24px 0); }
.hero-hold .portrait-clip { clip-path: inset(100% 0 0 0); will-change: clip-path; }
.hero-hold .portrait-sheets i { clip-path: inset(100% 0 0 0); }
.hero-hold .hero-cue-t > span { opacity: 0; }
.hero-hold .hero-marquee::before { transform: scaleX(0); }
.hero-hold .hero-marq-track { opacity: 0; }

/* ---------- Планшет и телефон ---------- */
@media (max-width: 860px) and (orientation: portrait) {
  .hero { --hero-ph: clamp(150px, 54vw, 360px); }
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) var(--hero-ph);
    grid-template-rows: auto auto;
    grid-template-areas: "h1 h1" "act pic";
    column-gap: 22px; row-gap: clamp(22px, 5vw, 40px);
    align-content: center;
  }
  .hero-h1 { gap: clamp(8px, 2vw, 16px); }
  .hl--sur { margin-top: clamp(4px, 2vw, 18px); }
  .hero-actions { flex-direction: column; flex-wrap: nowrap; align-self: end; }
  .hero-actions .btn { width: 100%; max-width: 200px; padding: 0 12px; }
  .portrait { --hero-step: 4px; }
  .portrait-sheets i:nth-child(n + 4) { display: none; }
}

/* ---------- Reduced motion: всё на месте, без движения ---------- */
@media (prefers-reduced-motion: reduce) {
  .intro { display: none !important; }
  .hl-in, .hl--role::after, .hero-actions, .portrait-clip, .portrait-sheets i,
  .hero-cue-t > span, .hero-marquee::before, .hero-marq-track { transition: none; }
  .hero-cue-l { animation: none !important; }
}

/* Фото Ивана: лицо в верхней трети кадра */
.portrait-zoom img { object-position: 50% 18%; }
