/* ==============================================================
   HERO · 3D-бюст Цезаря, scroll-driven хореография
   Секция высокая (скролл-трек), внутри — sticky-сцена на 100vh.
   Слои (снизу вверх): фон → частицы → кольцо (CSS) → WebGL-канвас →
   скрим для читаемости → текстовые главы → HUD.
   ============================================================== */

#hero.hx {
  --font-head: 'Unbounded', var(--font-display);
  --hx-pad: max(32px, calc((100vw - 1440px) / 2 + 32px));
  position: relative;
  display: block;
  padding: 0;
  min-height: 0;
  height: 340vh;
  margin-top: -68px;           /* сцена заходит под стеклянную шапку */
  overflow: visible;           /* иначе sticky не работает */
  background: transparent;
  isolation: isolate;
}
#hero.hx.is-static { height: auto; }

.hx-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  width: 100%;
  overflow: hidden;
  background: transparent;
}
#hero.hx.is-static .hx-stage { position: relative; min-height: 720px; }

/* --- Фон: глубокий чёрный + тонкие «музейные» вертикали + виньетка --- */
.hx-bg {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 50% 60% at 72% 42%, rgba(47,224,168,0.16), transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 50%, transparent 50%, rgba(0,0,0,0.8) 100%),
    rgba(2,3,4,0.55);
}
/* цветные «пятна света» в хиро */
.hx-bg::before {
  content: ''; position: absolute; inset: -20%;
  background:
    radial-gradient(closest-side at 18% 78%, rgba(155,123,255,0.30), transparent),
    radial-gradient(closest-side at 88% 12%, rgba(111,231,255,0.20), transparent),
    radial-gradient(closest-side at 45% 20%, rgba(47,224,168,0.14), transparent);
  filter: blur(40px);
  animation: hxAurora 22s ease-in-out infinite alternate;
}
@keyframes hxAurora {
  0%   { transform: translate3d(0,0,0) rotate(0deg) scale(1); }
  50%  { transform: translate3d(4%,-3%,0) rotate(8deg) scale(1.08); }
  100% { transform: translate3d(-3%,4%,0) rotate(-6deg) scale(1.02); }
}
.hx-bg::after {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: calc(100% / 8) 100%;
  mask-image: linear-gradient(180deg, transparent, #000 20%, #000 80%, transparent);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 20%, #000 80%, transparent);
}
#hero.hx #hero-canvas { z-index: 1; opacity: 0.4; }

/* --- Кольцо: контровой свет, CSS-свечение --- */
.hx-ring-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.hx-glow,
.hx-ring {
  position: absolute; left: 0; top: 0;
  border-radius: 50%;
  will-change: transform, opacity;
}
.hx-glow {
  width: 100px; height: 100px;
  background: radial-gradient(circle, rgba(47,224,168,0.30) 0%, rgba(47,224,168,0.10) 38%, transparent 68%);
  filter: blur(10px);
}
.hx-ring {
  width: 100px; height: 100px;
  border: 2px solid rgba(225, 255, 246, 0.96);
  box-shadow:
    0 0 6px rgba(225,255,246,0.9),
    0 0 18px #2FE0A8,
    0 0 48px rgba(47,224,168,0.75),
    0 0 110px rgba(47,224,168,0.38),
    inset 0 0 8px rgba(225,255,246,0.7),
    inset 0 0 26px rgba(47,224,168,0.6),
    inset 0 0 70px rgba(47,224,168,0.22);
}
.hx-ring-layer.is-intro .hx-ring,
.hx-ring-layer.is-intro .hx-glow { opacity: 0 !important; }

/* --- WebGL --- */
#hxCanvas {
  position: absolute; inset: 0; z-index: 3;
  width: 100%; height: 100%;
  display: block;
  touch-action: pan-y;
  cursor: grab;
}
#hxCanvas.is-drag { cursor: grabbing; }

.hx-fallback {
  position: absolute; z-index: 3; display: none;
  right: 12%; top: 50%; width: min(48vh, 40vw); aspect-ratio: 1;
  transform: translateY(-50%);
  border-radius: 50%;
  background: url('img/hero-caesar-poster.jpg') center 30% / cover no-repeat;
  box-shadow: inset 0 0 60px rgba(0,0,0,.8);
}
#hero.hx.no-webgl .hx-fallback { display: block; }
#hero.hx.no-webgl #hxCanvas { display: none; }

/* --- Скрим под текст --- */
.hx-shade {
  position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(2,3,4,0.92) 0%, rgba(2,3,4,0.6) 30%, transparent 55%),
    linear-gradient(0deg, rgba(2,3,4,0.85) 0%, transparent 28%);
}

/* --- Текстовые главы --- */
.hx-text {
  position: absolute; z-index: 5;
  left: var(--hx-pad);
  top: 68px; bottom: 0;
  width: min(1000px, 52vw);
  will-change: transform;
  pointer-events: none;
}
.hx-ch {
  position: absolute; left: 0; right: 0; bottom: 11vh;
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(32px);
  transition: opacity .32s ease-out, transform .42s ease-out, visibility 0s linear .42s;
}
.hx-ch.is-before { transform: translateY(-32px); }
.hx-ch.is-in {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: none;
  transition: opacity .5s ease-out .34s, transform .6s cubic-bezier(.2,.7,.2,1) .34s, visibility 0s linear .34s;
}
#hero.hx.is-static .hx-ch { transition-duration: .01s; transition-delay: 0s; }

/* вертикальный wipe строк заголовков */
.hx-line { display: block; overflow: hidden; padding-bottom: .06em; margin-bottom: -.06em; }
.hx-line > span { display: inline-block; transform: translateY(108%); transition: transform .3s ease-in; }
.hx-ch.is-in .hx-line > span { transform: none; transition: transform .8s cubic-bezier(.16,.8,.2,1); }
.hx-ch.is-in .hx-line:nth-child(1) > span { transition-delay: .36s; }
.hx-ch.is-in .hx-line:nth-child(2) > span { transition-delay: .44s; }
.hx-ch.is-in .hx-line:nth-child(3) > span { transition-delay: .52s; }
.hx-ch.is-in .hx-line:nth-child(4) > span { transition-delay: .60s; }

.hx-kicker {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 15px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-2);
  margin: 0 0 26px;
}
.hx-kicker b { color: var(--accent); font-weight: 600; letter-spacing: .1em; }
.hx-kicker::before {
  content: ''; width: 28px; height: 1px; background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

#hero.hx h1,
.hx-h2 {
  font-family: var(--font-head);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.0;
  color: var(--text);
  margin: 0 0 30px;
  text-wrap: balance;
}
#hero.hx h1 { font-size: clamp(40px, 4.7vw, 92px); }
.hx-h2 { font-size: clamp(38px, 4.3vw, 84px); }
#hero.hx h1 .accent, .hx-h2 .accent {
  font-weight: 900;
  background: linear-gradient(100deg, #2FE0A8 0%, #7CF5FF 45%, #B98CFF 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#hero.hx h1 .hx-thin, .hx-h2 .hx-thin { font-weight: 300; letter-spacing: -0.03em; }

.hx-lead {
  font-size: 20.5px; line-height: 1.6; color: var(--text-2);
  max-width: 640px; margin: 0 0 28px;
}
.hx-lead strong { color: var(--text); font-weight: 600; }
.hx-lead a { color: var(--accent); border-bottom: 1px solid rgba(47,224,168,.35); }

.hx-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.hx-cta a {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 56px; padding: 0 28px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  font-size: 17.5px; font-weight: 500; color: var(--text);
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: border-color .2s, background .2s, color .2s, box-shadow .2s;
}
.hx-cta a:hover { border-color: var(--accent); color: var(--accent); }
.hx-cta a.is-primary {
  background: var(--accent); border-color: var(--accent); color: #031a12; font-weight: 600;
  box-shadow: 0 0 0 1px rgba(47,224,168,.4), 0 10px 40px -8px rgba(47,224,168,.55);
}
.hx-cta a.is-primary:hover { background: #5cf0c1; color: #031a12; }

/* глава 2 — лидер */
.hx-score {
  display: flex; align-items: flex-end; gap: 22px; margin: 0 0 22px;
}
.hx-score__num {
  font-family: var(--font-head); font-weight: 200;
  font-size: clamp(100px, 11vw, 210px); line-height: .8; letter-spacing: -0.06em;
  color: var(--text);
  text-shadow: 0 0 60px rgba(47,224,168,.25);
}
.hx-score__num sub {
  font-size: .16em; letter-spacing: 0; color: var(--text-3); font-weight: 300;
  vertical-align: baseline; margin-left: 6px;
}
.hx-score__name { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; }
.hx-score__name strong { font-family: var(--font-head); font-size: 30px; text-transform: uppercase; font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.hx-score__name a { font-size: 17px; color: var(--text-3); }
.hx-score__name a:hover { color: var(--accent); }

.hx-podium {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  max-width: 660px; margin: 0 0 30px;
  border-top: 1px solid var(--line-strong);
}
.hx-podium li {
  display: flex; align-items: baseline; gap: 12px;
  padding: 14px 0 0;
  font-size: 18px; color: var(--text-2);
}
.hx-podium li + li { padding-left: 20px; border-left: 1px solid var(--line); }
.hx-podium b { font-family: var(--font-head); font-weight: 500; font-size: 34px; color: var(--text); letter-spacing: -.02em; }
.hx-podium i { font-style: normal; font-size: 14px; color: var(--accent); letter-spacing: .1em; }

/* глава 3 — методика */
.hx-facts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px 28px;
  max-width: 700px; margin: 0 0 34px;
}
.hx-facts li {
  position: relative; padding-left: 18px;
  font-size: 17.5px; line-height: 1.5; color: var(--text-2);
}
.hx-facts li::before {
  content: ''; position: absolute; left: 0; top: 7px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent-glow);
}

/* сброс глобальных стилей section ul/li для списков героя */
#hero.hx ul.hx-podium, #hero.hx ul.hx-facts { display: grid !important; padding: 0 !important; background: none !important; box-shadow: none !important; }
#hero.hx .hx-podium > li { background: none !important; border-radius: 0 !important; border-top: 0 !important; border-right: 0 !important; border-bottom: 0 !important; margin: 0 !important; }
#hero.hx .hx-podium > li::before { content: none !important; display: none !important; }
#hero.hx .hx-facts > li { background: none !important; border: 0 !important; margin: 0 !important; padding: 0 0 0 18px !important; }

/* --- Навигация по главам --- */
.hx-rail {
  position: absolute; z-index: 6;
  right: var(--hx-pad); top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 4px;
}
.hx-rail button {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  min-height: 44px; padding: 0 0 0 12px;
  font-size: 13.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-3);
  transition: color .3s;
}
.hx-rail button span { opacity: 0; transform: translateX(6px); transition: opacity .3s, transform .3s; }
.hx-rail button:hover span,
.hx-rail button.is-active span { opacity: 1; transform: none; }
.hx-rail button.is-active { color: var(--text); }
.hx-rail button::after {
  content: ''; width: 2px; height: 28px; border-radius: 2px;
  background: linear-gradient(180deg, var(--accent) var(--f, 0%), rgba(255,255,255,.14) var(--f, 0%));
  box-shadow: 0 0 10px rgba(47,224,168, calc(var(--g, 0) * .6));
}

/* --- HUD --- */
.hx-live {
  position: absolute; z-index: 6;
  top: 92px; right: var(--hx-pad);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 10px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(47,224,168,.35); border-radius: 999px;
  background: rgba(2,6,6,.5); backdrop-filter: blur(6px);
}
.hx-live::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}
.hx-meta {
  position: absolute; z-index: 6;
  right: var(--hx-pad); bottom: 28px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  font-size: 11px; color: var(--text-3); text-align: right;
}
.hx-meta__rot { font-variant-numeric: tabular-nums; letter-spacing: .14em; text-transform: uppercase; color: var(--text-2); }
.hx-meta__rot b { color: var(--accent); font-weight: 600; }
.hx-credit a { color: var(--text-2); border-bottom: 1px solid rgba(255,255,255,.18); }
.hx-credit a:hover { color: var(--accent); border-color: var(--accent); }

.hx-hint {
  position: absolute; z-index: 6; left: 50%; bottom: 28px;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--text-3);
  transition: opacity .4s;
  pointer-events: none;
}
.hx-hint::after {
  content: ''; width: 1px; height: 36px;
  background: linear-gradient(180deg, var(--accent), transparent);
  animation: hxHint 1.8s ease-in-out infinite;
  transform-origin: top;
}
@keyframes hxHint { 0% { transform: scaleY(0); opacity: 1; } 70% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }
.hx-hint.is-hidden { opacity: 0; }

.hx-loader {
  position: absolute; z-index: 6; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--text-3);
  font-variant-numeric: tabular-nums;
  transition: opacity .5s;
  pointer-events: none;
}
.hx-loader.is-done { opacity: 0; }

/* ==============================================================
   Планшет
   ============================================================== */
@media (max-width: 1100px) {
  .hx-text { width: min(560px, 52vw); }
  .hx-facts { grid-template-columns: 1fr; gap: 10px; }
}

/* ==============================================================
   Мобила: бюст в верхней части кадра, текст — снизу на скриме
   ============================================================== */
@media (max-width: 767px), (max-aspect-ratio: 9/10) {
  #hero.hx { --hx-pad: 20px; height: 300vh; height: 300svh; margin-top: -60px; }
  .hx-live { display: none; }
  .hx-bg::after { background-size: 25% 100%; }

  .hx-shade {
    background:
      linear-gradient(0deg, #020304 0%, rgba(2,3,4,0.96) 34%, rgba(2,3,4,0.55) 50%, transparent 64%),
      linear-gradient(180deg, rgba(2,3,4,0.6) 0%, transparent 18%);
  }
  .hx-text { left: 20px; right: 20px; width: auto; top: 0; }
  .hx-ch { bottom: 24px; }

  #hero.hx h1 { font-size: clamp(28px, 8.6vw, 40px); margin-bottom: 20px; }
  .hx-h2 { font-size: clamp(28px, 8.4vw, 38px); margin-bottom: 18px; }
  .hx-kicker { margin-bottom: 14px; font-size: 12.5px; }
  .hx-lead { display: none; }
  .hx-cta { gap: 8px; }
  .hx-cta a { flex: 1 1 auto; justify-content: center; min-height: 52px; padding: 0 18px; font-size: 16px; }
  .hx-cta a.is-extra { display: none; }

  .hx-score { gap: 14px; margin-bottom: 16px; }
  .hx-score { flex-wrap: wrap; row-gap: 6px; }
  .hx-score__num { font-size: 92px; }
  .hx-score__name strong { font-size: 22px; }
  .hx-score__name a { font-size: 14px; }
  .hx-podium { margin-bottom: 18px; }
  .hx-podium li { font-size: 15px; gap: 8px; flex-wrap: wrap; }
  .hx-podium li + li { padding-left: 14px; }
  .hx-podium b { font-size: 28px; }

  .hx-facts { grid-template-columns: 1fr 1fr; gap: 10px 16px; margin-bottom: 20px; }
  .hx-facts li { font-size: 15px; padding-left: 14px; }
  .hx-facts li::before { top: 6px; width: 5px; height: 5px; }

  /* главы — горизонтальные сегменты под шапкой */
  .hx-rail {
    top: 80px; left: 20px; right: 20px; transform: none;
    flex-direction: row; gap: 6px;
  }
  .hx-rail button {
    flex: 1; flex-direction: column-reverse; align-items: flex-start; justify-content: flex-start;
    gap: 8px; padding: 0; min-height: 44px;
    font-size: 11.5px; letter-spacing: .12em;
  }
  .hx-rail button span { opacity: 1; transform: none; }
  .hx-rail button::after {
    width: 100%; height: 2px;
    background: linear-gradient(90deg, var(--accent) var(--f, 0%), rgba(255,255,255,.14) var(--f, 0%));
  }
  .hx-live { top: 136px; right: 20px; font-size: 9.5px; padding: 5px 10px 5px 8px; }
  .hx-meta { display: none; }
  .hx-hint { display: none; }
  .hx-credit-m {
    display: block !important;
    margin-top: 14px; font-size: 10.5px; color: var(--text-3);
  }
  .hx-credit-m a { color: var(--text-2); border-bottom: 1px solid rgba(255,255,255,.18); }
  .hx-fallback { left: 50%; right: auto; top: 30%; width: 70vw; transform: translate(-50%, -50%); }
}
.hx-credit-m { display: none; }

@media (min-width: 560px) and (max-aspect-ratio: 9/10) {
  .hx-text { left: 40px; right: 40px; }
  .hx-ch { bottom: 48px; }
  #hero.hx h1 { font-size: 64px; }
  .hx-h2 { font-size: 60px; }
  .hx-lead { display: block; }
  .hx-rail { left: 40px; right: 40px; top: 92px; }
}
@media (max-width: 767px) and (max-height: 700px) {
  #hero.hx h1 { font-size: 34px; }
  .hx-score__num { font-size: 76px; }
  .hx-facts li:nth-child(n+3) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hx-line > span { transform: none !important; transition: none !important; }
  .hx-hint::after { animation: none; }
}
