/* ============================================================
   ТРИМЕТРИЯ — 3D: полёт по скроллу
   Тот же дизайн-язык, что и 2D-версия: Jost/Inter, тёмный фон,
   лаймовый акцент, зерно + виньетка
   ============================================================ */

:root {
  --bg: #0a0c0e;
  --bg-2: #101317;
  --ink: #f1f4f2;
  --muted: #97a09c;
  --faint: #5c6462;
  --line: rgba(235, 240, 236, 0.14);
  --line-soft: rgba(235, 240, 236, 0.07);
  --accent: #c8f542;
  --accent-dim: rgba(200, 245, 66, 0.14);
  --font-disp: "Jost", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-cine: cubic-bezier(0.16, 1, 0.3, 1); /* easeOutExpo — длинное киношное торможение */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: auto; scroll-snap-type: y proximity; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: #0a0c0e; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img, video { display: block; max-width: 100%; }

mark { background: none; color: var(--accent); font-style: normal; }

/* ---------- Канвас ---------- */
#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* ---------- Кинематографичные оверлеи ---------- */
.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(6, 7, 9, .5) 100%);
}
.grain {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: 2;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainShift 1.2s steps(4) infinite;
}
@keyframes grainShift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-1.5%, 1%); }
  50%  { transform: translate(1%, -1.5%); }
  75%  { transform: translate(-1%, -1%); }
  100% { transform: translate(1.5%, 1.5%); }
}

/* ---------- Прогресс полёта ---------- */
.progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px; width: 100%;
  z-index: 30;
  background: transparent;
}
.progress i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width .12s linear;
}

/* ---------- HUD ---------- */
.hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 28px;
  pointer-events: none;
  z-index: 20;
}
.hud-brand { display: flex; align-items: center; gap: 12px; }
.hud-brand img { height: 24px; display: block; opacity: .95; }
.hud-brand .hud-sub {
  font-family: var(--font-disp);
  font-size: 10px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--muted);
  border-left: 1px solid var(--line);
  padding-left: 12px;
}
.hud-right { display: flex; align-items: center; gap: 12px; }
.hud-zone {
  font-family: var(--font-disp);
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(10, 12, 14, .55);
  border: 1px solid var(--line);
  padding: 8px 14px;
  backdrop-filter: blur(6px);
  white-space: nowrap;
}
.hud-zone b { color: var(--accent); font-weight: 500; margin-right: 10px; }
.hud-back {
  pointer-events: auto;
  font-family: var(--font-disp);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(10, 12, 14, .55);
  border: 1px solid var(--line);
  padding: 8px 14px;
  backdrop-filter: blur(6px);
  transition: color .3s, border-color .3s;
}
.hud-back:hover { color: var(--ink); border-color: rgba(235,240,236,.35); }

/* ---------- Подсказка и % ---------- */
.fly-hint {
  position: fixed;
  bottom: 26px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: var(--font-disp);
  font-size: 10px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--muted);
  z-index: 20;
  pointer-events: none;
  transition: opacity .7s ease;
}
.fly-hint svg { animation: hintBob 1.6s ease-in-out infinite; color: var(--accent); }
.fly-hint.hide { opacity: 0; }
@keyframes hintBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}
.pct {
  position: fixed;
  right: 28px; bottom: 22px;
  font-family: var(--font-disp);
  font-size: 11px;
  letter-spacing: .22em;
  color: var(--muted);
  z-index: 20;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

/* ================= КОНТЕНТ ================= */
#world { position: relative; z-index: 1; }

.st {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  padding: 7vh 6vw;
  padding: 7svh 6vw;
}

/* ---------- Появление контента: маска-проявление ----------
   Блок спрятан «под маской»; при прилёте на магнитную точку маска
   плавно раскрывается снизу вверх по кинематографичной кривой.
   Уход — быстрый. Тот же эффект дублирует WAAPI-скрипт в 3d.html:
   он не глушится prefers-reduced-motion и работает без WebGL. */
.st-copy, .st-center, .sr-stage {
  clip-path: inset(101% 0% 0% 0%);
  opacity: 0;
  transform: translateY(16px);
  transition: clip-path .3s ease, opacity .3s ease, transform .3s ease;
}
.st.active .st-copy,
.st.active .st-center,
.st.active .sr-stage {
  clip-path: inset(0% 0% 0% 0%);
  opacity: 1;
  transform: none;
  transition: clip-path 1.25s var(--ease-cine), opacity .9s ease, transform 1.25s var(--ease-cine);
}

/* Блок текста */
.st-copy { width: 52%; max-width: 580px; }
.st-copy.side-r { margin-left: auto; }
.st-copy.side-l { margin-right: auto; }

.st-num {
  display: block;
  font-family: var(--font-disp);
  font-size: 12px;
  letter-spacing: .32em;
  color: var(--accent);
  margin-bottom: 18px;
}

.st-client {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.st-logo { height: 24px; width: auto; max-width: 150px; opacity: .9; }
.st-logo-text {
  font-family: var(--font-disp);
  font-size: 18px;
  letter-spacing: .12em;
  border: 1px solid var(--line);
  padding: 2px 10px;
}
.st-client span {
  font-family: var(--font-disp);
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}

.st-title {
  font-family: var(--font-disp);
  font-weight: 200;
  font-size: clamp(34px, 4.6vw, 60px);
  line-height: 1.02;
  letter-spacing: .01em;
  margin-bottom: 16px;
}
.st-title em { font-style: italic; font-weight: 300; }

.st-desc { margin-bottom: 10px; max-width: 46ch; }
.st-desc b { font-weight: 400; font-size: 15px; color: var(--ink); }
.st-tags {
  font-family: var(--font-disp);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 24px;
}

/* Медиа */
.st-media {
  position: relative;
  border: 1px solid var(--line);
  background: var(--bg-2);
  overflow: hidden;
}
.st-media video {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #000;
}
.st-dur {
  position: absolute;
  right: 10px; bottom: 10px;
  font-family: var(--font-disp);
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--ink);
  background: rgba(10, 12, 14, .72);
  border: 1px solid var(--line);
  padding: 4px 10px;
  font-variant-numeric: tabular-nums;
}
/* ---------- HERO ---------- */
.st-hero { min-height: 100vh; min-height: 100svh; }
.st-center { width: 100%; max-width: 880px; margin: 0 auto; text-align: center; }
.overline {
  font-family: var(--font-disp);
  font-size: 11px;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 30px;
}
.hero-title {
  font-family: var(--font-disp);
  font-weight: 200;
  font-size: clamp(48px, 9.5vw, 122px);
  line-height: .98;
  letter-spacing: .01em;
  margin-bottom: 28px;
}
.hero-title em { font-style: italic; font-weight: 300; color: var(--accent); }
.hero-sub {
  color: var(--muted);
  font-size: clamp(14px, 1.4vw, 17px);
  line-height: 1.7;
}
.hero-scroll {
  position: absolute;
  bottom: 34px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: var(--font-disp);
  font-size: 10px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--muted);
  pointer-events: none;
}
.hero-scroll svg { color: var(--accent); animation: hintBob 1.6s ease-in-out infinite; }

/* ---------- ШОУ-РИЛ ---------- */
.st-showreel { flex-direction: column; gap: 3.5vh; gap: 3.5svh; }
.sr-title {
  font-family: var(--font-disp);
  font-weight: 200;
  font-size: clamp(42px, 6.5vw, 84px);
  line-height: 1;
  margin-bottom: 14px;
}
.sr-sub { color: var(--muted); font-size: 15px; }
.sr-stage {
  position: relative;
  width: min(78vw, 860px);
  border: 1px solid var(--line);
  background: #000;
}
.sr-stage video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; }
.sr-dur {
  position: absolute;
  right: 10px; bottom: 10px;
  font-family: var(--font-disp);
  font-size: 10px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(10, 12, 14, .72);
  border: 1px solid var(--line);
  padding: 4px 10px;
}

/* ---------- О СТУДИИ ---------- */
/* Текст — ровно по центру, на фоне центрального торуса */
.st-about .st-copy { width: min(620px, 92%); margin: 0 auto; }
.about-statement {
  font-family: var(--font-disp);
  font-weight: 300;
  font-size: clamp(20px, 2.4vw, 30px);
  line-height: 1.35;
  margin-bottom: 14px;
}
.about-text { color: var(--muted); font-size: 14px; max-width: 52ch; margin-bottom: 18px; }
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
}
.stat { background: rgba(10, 12, 14, .6); padding: 13px 16px; backdrop-filter: blur(4px); }
.stat b {
  display: block;
  font-family: var(--font-disp);
  font-weight: 300;
  font-size: 23px;
  letter-spacing: .04em;
  margin-bottom: 3px;
}
.stat span { font-size: 11px; color: var(--muted); line-height: 1.5; display: block; }

/* ---------- УСЛУГИ ---------- */
.svc { list-style: none; margin-top: 6px; }
.svc li {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
}
.svc li:first-child { border-top: 1px solid var(--line-soft); }
.svc-num {
  font-family: var(--font-disp);
  font-size: 11px;
  letter-spacing: .2em;
  color: var(--accent);
  padding-top: 4px;
  flex: none;
}
.svc b { display: block; font-weight: 400; font-size: 15px; margin-bottom: 2px; }
.svc span { font-size: 13px; color: var(--muted); }

/* ---------- CTA ---------- */
.cta-title {
  font-family: var(--font-disp);
  font-weight: 200;
  font-size: clamp(36px, 6vw, 78px);
  line-height: 1.06;
  margin-bottom: 36px;
}
.cta-title span { font-style: italic; color: var(--muted); font-weight: 300; }
.cta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.cta-site {
  font-family: var(--font-disp);
  font-size: 14px;
  letter-spacing: .22em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  padding: 16px 30px;
  transition: background .35s var(--ease-out), color .35s, border-color .35s;
}
.cta-site:hover { background: var(--accent); color: #0a0c0e; border-color: var(--accent); }
.qr-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  padding: 8px 16px 8px 8px;
}
.qr-chip img { width: 56px; height: 56px; }
.qr-chip span {
  font-family: var(--font-disp);
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}
.cta-note { color: var(--faint); font-size: 13px; }

/* ---------- ПОДВАЛ ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8vh 6vw 7vh;
  border-top: 1px solid var(--line-soft);
  background: linear-gradient(180deg, transparent, rgba(10, 12, 14, .85) 40%);
}
.site-footer img { height: 26px; margin-bottom: 8px; }
.footer-row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-row span, .footer-row a {
  font-family: var(--font-disp);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--faint);
}
.footer-row a:hover { color: var(--ink); }

/* ---------- Ошибка запуска ---------- */
.gl-error {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  display: none;
  justify-content: center;
  padding: 14px 24px;
  background: rgba(16, 19, 23, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.gl-error.show { display: flex; }
.gl-error p {
  font-size: 13.5px;
  color: var(--muted);
  max-width: 70ch;
  text-align: center;
}
.gl-error b { color: var(--ink); font-weight: 500; margin-right: 8px; }

/* ---------- Без 3D ---------- */
body.no3d #gl { display: none; }
body.no3d .fly-hint { display: none; }
body.no3d .st { min-height: auto; padding: 16vh 6vw; padding: 16svh 6vw; }
body.no3d .st-hero { min-height: 88vh; min-height: 88svh; }

/* ---------- Адаптив ---------- */
@media (max-width: 900px) {
  .hud { padding: 14px 16px; }
  .hud-brand .hud-sub { display: none; }
  .pct { display: none; }

  .st { padding: 10vh 5.5vw; padding: 10svh 5.5vw; min-height: 100vh; min-height: 100svh; }
  .st-hero { min-height: 100vh; min-height: 100svh; }
  .st-copy { width: 92%; max-width: none; }
  .st-copy.side-l, .st-copy.side-r { margin: 0; }

  .st-project { min-height: 128vh; min-height: 128svh; }
  .st-showreel { min-height: 120vh; min-height: 120svh; }
  .st-about { min-height: 135vh; min-height: 135svh; }
  .st-services { min-height: 145vh; min-height: 145svh; }
  .st-cta { min-height: 115vh; min-height: 115svh; }
  .st-media video, .sr-stage video { aspect-ratio: 16 / 10; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat b { font-size: 21px; }
  .qr-chip { padding: 6px 12px 6px 6px; }
  .qr-chip img { width: 46px; height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  .fly-hint svg, .hero-scroll svg { animation: none; }
  .st-copy, .st-center, .sr-stage {
    transition-duration: .01s !important;
    transition-delay: 0s !important;
  }
}
