/* ============================================================
   RAW SPACE · shared base — токены, типографика, секции
   Тёмная тема по умолчанию; body.light — светлая (paper).
   ============================================================ */

:root {
  --bg: #0d0c0b;
  --ink: #f4f1ec;
  --ink-dim: rgba(244, 241, 236, 0.72);
  --paper: #efece6;
  --dark-ink: #171512;
  --accent: #e6392e;
  --nav-h: 64px;
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.light { background: var(--paper); color: var(--dark-ink); }
img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: #fff; }

/* ---------- типографика ---------- */
.display {
  font-family: "Inter Tight", "Inter", sans-serif;
  font-weight: 900; text-transform: uppercase;
  letter-spacing: -0.025em; line-height: 0.88;
}
.display--hero { font-size: clamp(64px, 15vw, 220px); margin-left: -0.04em; }
.display--lg   { font-size: clamp(48px, 9.5vw, 140px); }
.display--md   { font-size: clamp(38px, 7vw, 104px); }
.display--sm   { font-size: clamp(26px, 4vw, 56px); }

.kicker {
  font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--accent); margin-bottom: 18px;
}
.kicker--light { color: var(--ink-dim); }
.section-sub {
  max-width: 46ch; margin-top: 22px;
  font-size: clamp(15px, 1.4vw, 19px);
  color: var(--ink-dim);
}
body.light .section-sub { color: rgba(23, 21, 18, 0.66); }

/* ---------- глобальный прогресс ---------- */
#pageProgress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: var(--accent); z-index: 300; pointer-events: none;
}

/* ---------- загрузчик ---------- */
.loader {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: flex; flex-direction: column; gap: 26px;
  align-items: center; justify-content: center;
  transition: opacity 0.6s var(--ease), visibility 0.6s;
}
body.light .loader { background: var(--paper); }
.loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader__mark {
  font-family: "Inter Tight", sans-serif;
  font-weight: 800; font-size: 22px; letter-spacing: 0.28em;
}
.loader__mark span { color: var(--accent); }
.loader__bar { width: min(280px, 60vw); height: 2px; background: rgba(127,127,127,0.25); overflow: hidden; }
.loader__bar i { display: block; height: 100%; width: 0%; background: var(--accent); transition: width 0.3s ease; }

/* ---------- навигация ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(16px, 3vw, 40px);
  transition: background 0.4s, backdrop-filter 0.4s;
}
.nav.scrolled { background: rgba(13,12,11,0.55); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
body.light .nav.scrolled { background: rgba(239,236,230,0.65); }
.nav__logo {
  font-family: "Inter Tight", sans-serif;
  font-weight: 800; font-size: 15px; letter-spacing: 0.18em;
  display: flex; align-items: center; gap: 8px;
}
.nav__plus { color: var(--accent); font-size: 22px; font-weight: 700; line-height: 1; }
.nav__pills {
  display: flex; gap: 4px;
  background: rgba(20,18,16,0.55);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(127,127,127,0.22);
  border-radius: 999px; padding: 5px;
}
body.light .nav__pills { background: rgba(239,236,230,0.6); }
.nav__pills a {
  font-size: 13px; font-weight: 500;
  padding: 7px 15px; border-radius: 999px;
  opacity: 0.75; transition: opacity 0.25s, background 0.25s;
}
.nav__pills a:hover { opacity: 1; background: rgba(127,127,127,0.15); }
.nav__cta {
  font-size: 13px; font-weight: 600;
  padding: 10px 18px; border-radius: 999px;
  background: var(--ink); color: var(--dark-ink);
  transition: transform 0.25s var(--ease); white-space: nowrap;
}
body.light .nav__cta { background: var(--dark-ink); color: var(--paper); }
.nav__cta:hover { transform: translateY(-2px); }

/* ---------- шторка + финал ---------- */
.curtain {
  position: relative; z-index: 2;
  background: var(--bg);
  margin-bottom: var(--finale-h, 100vh);
  box-shadow: 0 60px 120px rgba(0,0,0,0.55);
}
body.light .curtain { background: var(--paper); }
.finale {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1;
  background: var(--paper); color: var(--dark-ink);
}
.finale__inner {
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(80px, 12vh, 140px) clamp(16px, 4vw, 56px) 40px;
}
.finale .kicker { color: var(--accent); }
.finale__sub { margin-top: 24px; max-width: 44ch; color: rgba(23,21,18,0.66); font-size: clamp(15px, 1.4vw, 18px); }
.finale__grid {
  margin-top: clamp(48px, 8vh, 90px);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 36px;
  border-top: 1px solid rgba(23,21,18,0.18); padding-top: 42px;
}
.finale__grid h4 {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.14em; color: rgba(23,21,18,0.5); margin-bottom: 14px;
}
.finale__grid p { color: rgba(23,21,18,0.8); font-size: 15px; }
.finale__big {
  display: block; font-family: "Inter Tight", sans-serif;
  font-weight: 700; font-size: clamp(18px, 2vw, 24px);
  letter-spacing: -0.01em; margin-bottom: 6px; transition: color 0.25s;
}
.finale__big:hover { color: var(--accent); }
.finale__social a {
  display: inline-block; margin-right: 16px; font-weight: 500;
  border-bottom: 1px solid rgba(23,21,18,0.3);
  transition: color 0.25s, border-color 0.25s;
}
.finale__social a:hover { color: var(--accent); border-color: var(--accent); }
.finale__copy { margin-top: clamp(40px, 8vh, 80px); font-size: 13px; color: rgba(23,21,18,0.45); }

/* ---------- hero (reveal или статичный) ---------- */
.hero { position: relative; height: 100vh; height: 100svh; overflow: hidden; }
.hero[data-reveal-hero] { cursor: crosshair; }
.hero__layer {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; user-select: none; pointer-events: none;
}
.hero__layer--front { will-change: -webkit-mask-image, mask-image; }
.hero__shade {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(13,12,11,0.55) 0%, transparent 30%, transparent 55%, rgba(13,12,11,0.82) 100%);
}
.hero__content {
  position: absolute; left: clamp(16px, 4vw, 56px); bottom: clamp(72px, 12vh, 120px);
  max-width: 900px; pointer-events: none; color: var(--ink);
}
.hero__sub { margin-top: 26px; max-width: 48ch; font-size: clamp(15px, 1.5vw, 19px); color: var(--ink-dim); }
.hero__hint {
  margin-top: 20px; font-size: 13px; font-weight: 500; color: var(--ink-dim);
  display: flex; align-items: center; gap: 10px;
  transition: opacity 0.6s;
}
.hero__hint.hidden { opacity: 0; }
.hero__hint-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.8s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.6); opacity: 0.5; } }
.scrollcue {
  position: absolute; right: clamp(16px, 4vw, 56px); bottom: 28px;
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim);
  display: flex; align-items: center; gap: 10px;
}
.scrollcue span {
  width: 1px; height: 34px; display: block;
  background: linear-gradient(var(--ink), transparent);
  animation: drip 1.6s infinite var(--ease);
}
@keyframes drip {
  0% { transform: scaleY(0); transform-origin: top; }
  55% { transform: scaleY(1); transform-origin: top; }
  56% { transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ---------- scrub-секция ---------- */
[data-scrub] { position: relative; background: #000; }
.scrub-sticky {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: hidden;
}
.scrub-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; /* вариант: contain + фон #000 */
  opacity: 1; transition: opacity 0.3s linear;
}
.scrub-video.off { opacity: 0; }

/* канвас-кадры: основной рендер скраба */
.scrub-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  will-change: transform;
  transition: transform 0.9s var(--ease);
}
.seq { display: none; }

/* «дыхание» кадра на остановке */
.scrub-sticky.idle .scrub-canvas {
  animation: ambientDrift 18s ease-in-out infinite alternate;
}
@keyframes ambientDrift {
  from { transform: scale(1) translateY(0); }
  to   { transform: scale(1.045) translateY(-0.6%); }
}
@media (prefers-reduced-motion: reduce) {
  .scrub-sticky.idle .scrub-canvas { animation: none; }
}

/* hero-оверлей: живёт поверх кадра 0, тает при первом же скролле */
[data-hero-overlay] {
  position: absolute; inset: 0; z-index: 6;
  will-change: opacity;
}
[data-hero-overlay].hero { height: 100%; }

/* точки-главы */
.chapdots {
  position: fixed; right: 18px; top: 50%; transform: translateY(-50%);
  z-index: 120; display: flex; flex-direction: column; gap: 10px;
}
.chapdots i {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(160,155,148,0.45);
  cursor: pointer;
  transition: transform 0.3s var(--ease), background 0.3s;
}
.chapdots i:hover { background: rgba(160,155,148,0.8); }
.chapdots i.on { background: var(--accent); transform: scale(1.5); }
@media (max-width: 700px) { .chapdots { display: none; } }
.scrub-shade {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,0.35), transparent 38%, transparent 60%, rgba(0,0,0,0.62));
}
.cap {
  position: absolute; left: clamp(16px, 4vw, 56px); bottom: 10vh;
  max-width: min(860px, 88vw); color: var(--ink);
  opacity: 0; visibility: hidden; will-change: opacity, transform;
  pointer-events: none;
}
.cap--center {
  left: 50%; right: auto; top: 50%; bottom: auto;
  transform: translate(-50%, -50%); text-align: center;
  width: max-content; max-width: 92vw;
}
.cap--right { left: auto; right: clamp(16px, 4vw, 56px); text-align: right; }
.cap .kicker { margin-bottom: 12px; }
.cap p { margin-top: 14px; max-width: min(46ch, 80vw); color: var(--ink-dim); font-size: clamp(14px, 1.3vw, 18px); }
/* заголовки в caps ограничиваем и высотой экрана, чтобы всегда влезали */
.cap .display--lg { font-size: clamp(32px, min(8vw, 12vh), 124px); }
.cap .display--md { font-size: clamp(26px, min(6.5vw, 9.5vh), 96px); }
.cap .display--hero { font-size: clamp(48px, min(13vw, 17vh), 190px); }
.cap--right p { margin-left: auto; }
.scrub-progress {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: rgba(244,241,236,0.16);
}
.scrub-progress i { display: block; height: 100%; width: 0%; background: var(--accent); }

/* ---------- контентные секции ---------- */
.block { padding: clamp(90px, 14vh, 160px) clamp(16px, 4vw, 56px); }
.block--paper { background: var(--paper); color: var(--dark-ink); }
.block--paper .section-sub { color: rgba(23,21,18,0.66); }

.services-list { list-style: none; margin-top: clamp(48px, 8vh, 90px); border-top: 1px solid rgba(127,127,127,0.3); }
.services-list li {
  display: grid; grid-template-columns: 90px 1fr; gap: 24px;
  padding: 30px 8px; border-bottom: 1px solid rgba(127,127,127,0.3);
  align-items: baseline;
}
.services-list .num { font-family: "Inter Tight", sans-serif; font-weight: 700; font-size: 15px; color: var(--accent); }
.services-list h3 {
  font-family: "Inter Tight", sans-serif; font-weight: 800;
  font-size: clamp(20px, 2.6vw, 30px); text-transform: uppercase; letter-spacing: -0.01em;
}
.services-list p { margin-top: 8px; max-width: 62ch; opacity: 0.7; font-size: 15px; }

.stats { list-style: none; margin-top: clamp(60px, 10vh, 110px); display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 32px; }
.stats b {
  display: block; font-family: "Inter Tight", sans-serif;
  font-weight: 900; font-size: clamp(44px, 6vw, 84px);
  letter-spacing: -0.03em; line-height: 1;
}
.stats span { display: block; margin-top: 10px; font-size: 14px; opacity: 0.6; max-width: 22ch; }

/* портфолио-сетка (реальные фото) */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-top: clamp(40px, 6vh, 70px); }
.gallery figure { position: relative; overflow: hidden; border-radius: 10px; aspect-ratio: 4/3; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s var(--ease); }
.gallery figure:hover img { transform: scale(1.05); }
.gallery figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 14px 16px; font-size: 13px; font-weight: 600; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,0.65));
}

/* ---------- появления ---------- */
.fx { opacity: 0; transform: translateY(26px); }
.fx.inview { opacity: 1; transform: none; transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }

/* ---------- адаптив ---------- */
@media (max-width: 900px) {
  .nav__pills { display: none; }
  .services-list li { grid-template-columns: 48px 1fr; gap: 14px; }
}
@media (max-width: 600px) {
  :root { --nav-h: 56px; }
  .display--hero { font-size: clamp(52px, 18vw, 96px); }
  .display--lg { font-size: clamp(38px, 12vw, 72px); }
  .display--md { font-size: clamp(30px, 9.5vw, 56px); }

  .nav__cta { font-size: 12px; padding: 8px 13px; }
  .nav__logo { font-size: 13px; }

  .hero__content { left: 18px; right: 18px; bottom: clamp(64px, 11vh, 100px); }
  .hero__sub { font-size: 14px; margin-top: 18px; }
  .hero__hint { font-size: 12px; }
  .scrollcue { display: none; }

  /* подписи глав: во всю ширину, клампы и по высоте портретного экрана */
  .cap { left: 18px; right: 18px; bottom: 13vh; max-width: none; }
  .cap--right { left: 18px; right: 18px; }
  .cap--center { left: 18px; right: 18px; top: auto; bottom: 13vh; transform: none; width: auto; max-width: none; }
  .cap p { font-size: 14px; max-width: none; }
  .cap .display--lg { font-size: clamp(30px, min(12vw, 9vh), 72px); }
  .cap .display--md { font-size: clamp(24px, min(9.5vw, 7.5vh), 56px); }
  .cap .display--hero { font-size: clamp(40px, min(15vw, 12vh), 96px); }

  .block { padding: 70px 18px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 24px; }
  .stats b { font-size: clamp(36px, 11vw, 56px); }
  .gallery { grid-template-columns: 1fr 1fr; gap: 8px; }
  .services-list h3 { font-size: 18px; }
  .finale__inner { padding: 90px 18px 32px; }
  .finale__grid { gap: 26px; padding-top: 32px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scrollcue span, .hero__hint-dot { animation: none; }
  .fx { opacity: 1; transform: none; }
}
