/* Relavra — первый экран и сцена эстафеты.
   Раскладка: статуя справа, огромное слово слева, его точка — шар на ладони.
   Позиции статуи, слова и шара считает js/main.js и кладёт в CSS-переменные. */
:root {
  --ink: #15282A;
  --patina: #2C7364;
  --verdigris: #8FC3B1;
  --lime: #F0F2EC;
  --gold: #E9A93A;
  --stone: #5B6966;
  --night: #000;                 /* фон видео облёта, сцена уходит в него */
  --lime-70: rgba(240, 242, 236, .7);
  --lime-25: rgba(240, 242, 236, .25);
  --lime-12: rgba(240, 242, 236, .12);

  --sans: "Geologica", "Onest", "Segoe UI", system-ui, sans-serif;
  --serif: "Literata", "PT Serif", Georgia, serif;
  --pad: clamp(20px, 4.5vw, 72px);
  --nav-h: 76px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--night); }
body {
  margin: 0;
  background: var(--night);
  color: var(--lime);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img, canvas, video, svg { display: block; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 26px; border-radius: 999px;
  font-weight: 500; font-size: 16px; letter-spacing: -.005em; white-space: nowrap;
  transition: background-color .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease), transform .25s var(--ease);
}
.btn-sm { min-height: 40px; padding: 0 18px; font-size: 14px; }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover { background: #F2BC5C; }
.btn-line { border: 1px solid var(--lime-25); color: var(--lime); }
.btn-line:hover { border-color: var(--lime); }
.btn:active { transform: scale(.98); }

/* ---------- Шапка ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 50;
  padding: 10px var(--pad) 0;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
.nav-rule { height: 4px; border-top: 1px solid var(--lime-25); border-bottom: 1px solid var(--lime-12); }
.nav-row {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: calc(var(--nav-h) - 24px); gap: 24px;
}
.nav-brand { display: flex; align-items: center; gap: 14px; justify-self: start; }
.nav-brand svg { width: 30px; height: 30px; border-radius: 7px; }
.nav-desc { font-size: 12.5px; line-height: 1.25; color: var(--lime-70); }
.nav-links { display: flex; gap: 34px; font-size: 14.5px; }
.nav-links a { color: var(--lime-70); transition: color .2s; }
.nav-links a:hover { color: var(--lime); }
/* золотая кнопка внутри меню нужна только на телефоне, на компьютере она стоит справа */
.nav-links .nav-cta { display: none; }
.nav-side { display: flex; align-items: center; gap: 22px; justify-self: end; }
.burger { display: none; width: 44px; height: 44px; border: 1px solid var(--lime-25); border-radius: 50%; background: transparent; cursor: pointer; place-items: center; align-content: center; gap: 6px; padding: 0; }
.burger i { display: block; width: 16px; height: 1.5px; background: var(--lime); }
.nav.is-light { background: rgba(240, 242, 236, .9); backdrop-filter: blur(10px); color: var(--ink); }
.nav.is-light .nav-rule { border-color: rgba(21, 40, 42, .2); }
.nav.is-light .nav-links a, .nav.is-light .nav-desc { color: var(--stone); }

/* ---------- Сцена ---------- */
.hero { position: relative; }
.stage {
  position: relative; height: 100vh; height: 100svh; overflow: hidden;
  background: var(--night);
}
/* ScrollTrigger закрепляет сцену и пишет ей в style размер окна. Пока окно тянут, этот размер
   устаревает до пересчёта и по краям видна пустота, поэтому сцена всегда равна окну */
.stage { width: 100% !important; height: 100vh !important; height: 100svh !important; max-width: none !important; max-height: none !important; }
.bg, .bg > * { position: absolute; inset: 0; }
.prague { width: 100%; height: 100%; object-fit: cover; object-position: 62% 50%; transform-origin: 70% 45%; }
.bg-shade {
  background:
    linear-gradient(180deg, rgba(10, 22, 22, .78) 0%, rgba(10, 22, 22, 0) 24%),
    linear-gradient(90deg, rgba(10, 22, 22, .72) 0%, rgba(10, 22, 22, .35) 42%, rgba(10, 22, 22, 0) 62%),
    linear-gradient(0deg, rgba(10, 22, 22, .7) 0%, rgba(10, 22, 22, 0) 38%),
    rgba(21, 40, 42, .22);
}
/* Ночь сцены эстафеты: глубокая патина вместо чёрного, снизу слева холодный отсвет */
.bg-night {
  opacity: 0;
  background:
    radial-gradient(70% 60% at 12% 92%, rgba(44, 115, 100, .34) 0%, rgba(44, 115, 100, 0) 70%),
    radial-gradient(80% 70% at 50% 0%, rgba(143, 195, 177, .08) 0%, rgba(143, 195, 177, 0) 70%),
    radial-gradient(110% 95% at 68% 42%, #13302F 0%, #0C1D1F 52%, #060F10 100%);
}
/* Тёплый свет шара на фоне. Идёт за шаром, растёт, когда камера подлетает ближе */
.bg > .bg-glow {
  inset: auto; left: var(--orb-x); top: var(--orb-y);
  width: 64vmax; height: 64vmax; margin: -32vmax 0 0 -32vmax;
  background: radial-gradient(circle, rgba(240, 186, 90, .26) 0%, rgba(233, 169, 58, .12) 26%, rgba(233, 169, 58, .04) 50%, rgba(233, 169, 58, 0) 70%);
  opacity: 0; will-change: transform, opacity;
}
.bg > .orbit-par { pointer-events: none; }
/* плёночное зерно поверх всей сцены */
.stage::after {
  content: ""; position: absolute; inset: 0; z-index: 7; pointer-events: none; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Огромное слово. Его точка совпадает с шаром на ладони */
.wm-wrap, .fg { position: absolute; inset: 0; pointer-events: none; }
.wordmark {
  position: absolute; left: var(--wm-left); top: var(--wm-top); width: var(--wm-w); height: auto;
  color: var(--lime); overflow: visible;
  --wm-sh: .35;
  filter: drop-shadow(0 6px 40px rgba(0, 0, 0, var(--wm-sh)));
}
/* когда буквы разлетаются, тень гаснет: размытие на 40px каждый кадр слишком дорогое */
.wordmark.no-shadow { filter: none; }
.wm-dot { fill: var(--gold); transform-box: fill-box; transform-origin: center; }

/* Сетка построения и маршрут */
.rays, .route { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.rays { will-change: transform, opacity; }
.rays * { fill: none; stroke: rgba(240, 242, 236, .15); stroke-width: 1; vector-effect: non-scaling-stroke; }
.rays .ray-strong { stroke: rgba(233, 169, 58, .3); }
.route .route-line { fill: none; stroke: rgba(240, 242, 236, .5); stroke-width: 1.5; stroke-linecap: round; }
/* пройденная часть пути и хвост огонька */
.route .route-lit { fill: none; stroke: rgba(233, 169, 58, .6); stroke-width: 1.5; stroke-linecap: round; opacity: 0; }
.route .route-tail { fill: none; stroke-width: 2.5; stroke-linecap: round; opacity: 0; }
.route .stop { fill: var(--ink); stroke: var(--lime); stroke-width: 1.5; transition: fill .45s var(--ease), stroke .45s var(--ease); }
.route .stop-label { fill: var(--lime-70); font: 500 12px/1 var(--sans); letter-spacing: .02em; transition: fill .45s var(--ease); }
.route .stop-glow { opacity: 0; transition: opacity .6s var(--ease); }
.route .stop-ping { fill: none; stroke: #FFE3A6; stroke-width: 1; opacity: 0; }
/* остановка, через которую прошёл огонёк, загорается золотом */
.route .is-lit .stop { fill: var(--gold); stroke: #FFE3A6; }
.route .is-lit .stop-label { fill: #F7D99B; }
.route .is-lit .stop-glow { opacity: 1; }
.route .runner-core { fill: #FFF6E0; }

/* Статуя и кадры облёта живут в одной «сцене» 1080×1920, как видео */
.figure, .orbit-layer { position: absolute; left: var(--st-left); top: var(--st-top); width: var(--st-w); height: var(--st-h); will-change: transform, opacity; }
.figure { transform-origin: 50% 30%; }
.statue { position: absolute; left: calc(120 / 1080 * 100%); top: calc(196 / 1920 * 100%); width: calc(1024 / 1080 * 100%); height: auto; }
.orbit {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0;
  /* статуя в кадрах уже вырезана из фона. Маска смягчает только места, где кадр
     обрезает статую: правый край и низ */
  -webkit-mask-image: linear-gradient(90deg, #000 84%, transparent 100%), linear-gradient(180deg, #000 88%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, #000 84%, transparent 100%), linear-gradient(180deg, #000 88%, transparent 100%);
  mask-composite: intersect;
}

/* Шар: ядро и ореол. Живёт в коде, поэтому может пульсировать и улетать.
   .orb двигает прокрутка (шар идёт за ладонью в облёте), .orb-body — вспышки и появление */
.orb { position: absolute; left: var(--orb-x); top: var(--orb-y); width: 0; height: 0; will-change: transform, opacity; }
.orb-body { position: absolute; left: 0; top: 0; }
.orb i { position: absolute; border-radius: 50%; transform: translate(-50%, -50%); }
.orb-core {
  width: calc(var(--orb-r) * 2); height: calc(var(--orb-r) * 2);
  background: radial-gradient(circle at 46% 42%, #FFFDF4 0%, #FFF1CC 28%, #F7CF7A 52%, #E9A93A 70%, rgba(233, 169, 58, 0) 74%);
  box-shadow: 0 0 calc(var(--orb-r) * .8) rgba(255, 220, 150, .9), 0 0 calc(var(--orb-r) * 2.2) rgba(233, 169, 58, .55);
  animation: orb-breathe 3.6s ease-in-out infinite;
}
.orb-halo {
  width: calc(var(--orb-r) * 14); height: calc(var(--orb-r) * 14);
  background: radial-gradient(circle, rgba(233, 169, 58, .34) 0%, rgba(233, 169, 58, .12) 30%, rgba(233, 169, 58, 0) 62%);
  animation: halo-breathe 3.6s ease-in-out infinite;
}
/* дышим только трансформом: он считается на видеокарте, без перерисовки */
@keyframes orb-breathe { 50% { transform: translate(-50%, -50%) scale(1.06); } }
@keyframes halo-breathe { 50% { transform: translate(-50%, -50%) scale(1.12); } }
.dust { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Текст первого экрана */
.hero-copy {
  position: absolute; left: var(--pad); bottom: calc(var(--pad) + 46px);
  width: min(720px, var(--copy-w, 720px)); z-index: 5;
}
.hero-copy h1 {
  margin: 0 0 18px; font-weight: 600;
  font-size: clamp(34px, min(4.1vw, 7.4vh), 66px); line-height: 1.02; letter-spacing: -.038em;
  text-wrap: balance;
}
.lead { margin: 0 0 30px; max-width: 46ch; color: var(--lime-70); font-size: clamp(15px, min(1.15vw, 2.3vh), 18px); line-height: 1.55; }
.ctas { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-meta {
  position: absolute; left: var(--pad); bottom: 22px; z-index: 5;
  display: flex; gap: 28px; font-size: 12.5px; color: var(--lime-70);
}
.scroll-cue {
  position: absolute; left: 0; right: 0; bottom: 22px; z-index: 5;
  display: flex; justify-content: center; align-items: center; gap: 12px; font-size: 12.5px; color: var(--lime-70);
  pointer-events: none;
}
.scroll-cue i { position: relative; width: 56px; height: 1px; background: var(--lime-25); overflow: hidden; }
.scroll-cue i::after {
  content: ""; position: absolute; top: -2px; left: -6px; width: 5px; height: 5px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 8px var(--gold); animation: cue 2.4s var(--ease) infinite;
}
@keyframes cue { 0% { transform: translateX(0); opacity: 0; } 20% { opacity: 1; } 80% { opacity: 1; } 100% { transform: translateX(64px); opacity: 0; } }

/* Плашки сцены эстафеты */
.plate {
  position: absolute; left: var(--pad); top: 50%; z-index: 6;
  width: min(440px, 38vw); padding: 30px 32px 32px;
  background: var(--patina); color: var(--lime);
  opacity: 0; visibility: hidden;
}
.plate p { margin: 0; font-size: 16.5px; line-height: 1.55; color: rgba(240, 242, 236, .88); }
.plate .plate-title {
  margin: 0 0 14px; font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(24px, 2.2vw, 32px); line-height: 1.18; letter-spacing: -.01em; color: var(--lime);
}
.punch {
  position: absolute; left: 0; right: 0; bottom: 9vh; z-index: 6; width: min(980px, 90vw); margin: 0 auto;
  text-align: center;
  font-family: var(--serif); font-style: italic; font-size: clamp(28px, 3.6vw, 56px); line-height: 1.12; letter-spacing: -.015em;
  text-wrap: balance; opacity: 0; visibility: hidden;
  text-shadow: 0 4px 40px rgba(0, 0, 0, .6);
}
.timeline { position: absolute; right: calc(var(--pad) * .5); top: 50%; z-index: 6; width: 1px; height: 26vh; transform: translateY(-50%); background: var(--lime-12); opacity: 0; }
.timeline i { position: absolute; left: -3px; top: calc(var(--p, 0) * 100%); width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); transform: translateY(-50%); }

/* ---------- Следующая сцена (заглушка) ---------- */
.next { position: relative; z-index: 2; background: var(--lime); color: var(--ink); padding: 18vh var(--pad) 22vh; }
.next-inner { max-width: 1100px; }
.next-kicker { margin: 0 0 18px; color: var(--stone); font-size: 14px; }
.next h2 { margin: 0 0 22px; font-weight: 600; font-size: clamp(44px, 7vw, 112px); line-height: .98; letter-spacing: -.045em; }
.next p { max-width: 56ch; margin: 0 0 56px; color: var(--stone); font-size: 18px; }
.next-route { width: 100%; height: 60px; overflow: visible; }
.next-route path { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.next-route circle { fill: var(--lime); stroke: var(--ink); stroke-width: 3; vector-effect: non-scaling-stroke; }
.next-route .end { fill: var(--gold); stroke: none; }

/* ---------- Загрузка ---------- */
.loader { position: fixed; inset: 0; z-index: 40; background: var(--night); }
.loader-grid { position: absolute; inset: 0; width: 100%; height: 100%; }
.loader-grid * { fill: none; stroke: var(--lime-12); stroke-width: 1; vector-effect: non-scaling-stroke; }
.loader-count {
  position: absolute; right: var(--pad); bottom: calc(var(--pad) * .6);
  font-weight: 300; font-size: clamp(48px, 8vw, 120px); line-height: 1; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums; color: var(--lime-25);
}
body.is-loading { overflow: hidden; }
body.is-loading .wm-wrap { z-index: 45; position: fixed; }
body.is-loading .nav, body.is-loading .hero-copy, body.is-loading .hero-meta, body.is-loading .scroll-cue { opacity: 0; }

/* На узком компьютере строка внизу слева доходит до середины, поэтому «Листайте» уходит вправо */
@media (max-width: 1100px) {
  .scroll-cue { justify-content: flex-end; padding-right: var(--pad); }
}

/* ---------- Телефон ---------- */
@media (max-width: 760px) {
  :root { --nav-h: 64px; }
  .nav-links, .nav-side .btn { display: none; }
  .burger { display: grid; }
  .nav-row { grid-template-columns: 1fr auto; }
  .hero-copy { bottom: calc(env(safe-area-inset-bottom, 0px) + 58px); width: calc(100vw - var(--pad) * 2); }
  .hero-copy h1 { font-size: clamp(30px, 8.6vw, 40px); margin-bottom: 12px; }
  .lead { font-size: 15px; margin-bottom: 20px; }
  .btn { min-height: 48px; padding: 0 20px; font-size: 15px; }
  .ctas .btn-line { display: none; }
  .hero-meta { display: none; }
  .scroll-cue { justify-content: flex-start; padding-left: var(--pad); bottom: calc(env(safe-area-inset-bottom, 0px) + 22px); }
  .nav.is-open .nav-links {
    display: flex; flex-direction: column; gap: 0; position: absolute; left: var(--pad); right: var(--pad); top: 100%;
    background: var(--ink); border: 1px solid var(--lime-12); padding: 8px 20px;
  }
  .nav.is-open .nav-links a { padding: 14px 0; font-size: 17px; color: var(--lime); border-bottom: 1px solid var(--lime-12); }
  .nav.is-open .nav-links a:last-child { border-bottom: 0; }
  .nav.is-open .nav-links .nav-cta { display: flex; margin: 16px 0 12px; padding: 0 20px; font-size: 15px; color: var(--ink); }
  .plate { left: var(--pad); right: var(--pad); width: auto; top: auto; bottom: 12vh; padding: 22px 22px 24px; }
  .timeline { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .orb-core, .orb-halo, .scroll-cue i::after { animation: none; }
}
