/* ═══════════════════════════════════════════════════════════
   ПЕРЕМЕННЫЕ
═══════════════════════════════════════════════════════════ */
:root {
  --c-bg:      #000000;
  --c-surface: rgba(6, 8, 20, 0.66);
  --c-text:    #ffffff;
  --c-muted:   rgba(232, 228, 218, 0.48);
  --c-accent:  #ffffff;
  --c-border:  rgba(125, 212, 200, 0.22);

  --f-display: "Prosto One", sans-serif;
  --f-mono:    "Montserrat", sans-serif;

  --gap-xs: clamp(0.5rem,  1vw,   0.75rem);
  --gap-sm: clamp(1rem,    2vw,   1.5rem);
  --gap-md: clamp(1.75rem, 2vw, 2.75rem);
  --gap-lg: clamp(3rem,    3vw,   5.5rem);
  --gap-xl: clamp(4rem,    4vw,   8rem);

  --fs-label: clamp(0.58rem, 1.1vw, 0.7rem);
  --fs-body:  clamp(0.78rem, 1.4vw, 0.9rem);
  --fs-title: clamp(1.8rem,  4vw,   5.8rem);
}

/* ═══════════════════════════════════════════════════════════
   СБРОС
═══════════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background-color: var(--c-bg);
}

body {
  background: transparent;
  color: var(--c-text);
  font-family: var(--f-mono);
  font-size: var(--fs-body);
  line-height: 1.85;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar       { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 2px; }

/* ═══════════════════════════════════════════════════════════
   WEBGL-КАНВАС
═══════════════════════════════════════════════════════════ */
#webgl {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  z-index: -1;
  display: block;
}

/* ═══════════════════════════════════════════════════════════
   ЗАГРУЗОЧНЫЙ ОВЕРЛЕЙ
═══════════════════════════════════════════════════════════ */
#loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--gap-sm);
  background: var(--c-bg);
  transition: opacity 0.9s ease, visibility 0.9s ease;
}

#loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader__ring {
  width: 36px;
  height: 36px;
  border: 1px solid var(--c-border);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: spin 1.1s linear infinite;
}

.loader__text {
  font-size: var(--fs-label);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--c-muted);
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════
   КОНТЕНТНЫЙ СЛОЙ
═══════════════════════════════════════════════════════════ */
#content {
  position: relative;
  z-index: 1;
}

/* ═══════════════════════════════════════════════════════════
   СЕКЦИИ
═══════════════════════════════════════════════════════════ */
.section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: var(--gap-xl) clamp(1.25rem, 6vw, 5rem);
}

.section--hero {
  align-items: flex-end;
  padding-bottom: var(--gap-lg);
}

.section--right {
  justify-content: flex-end;
}

.section--left {
  justify-content: flex-start;
}

.section--center {
  justify-content: center;
}

/* ═══════════════════════════════════════════════════════════
   КАРТОЧКА КОНТЕНТА
═══════════════════════════════════════════════════════════ */
.section__card {
  max-width: 40vw;
  width: 100%;
  padding: var(--gap-md) clamp(1.25rem, 4vw, 2.25rem);
  position: relative;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.85s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}

@supports not (backdrop-filter: blur(1px)) {
  .section__card { background: rgba(6, 8, 20, 0.92); }
}

.section__card.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════
   ТИПОГРАФИКА
═══════════════════════════════════════════════════════════ */
.section__label {
  display: block;
  font-size: var(--fs-label);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--c-accent);
  margin-bottom: var(--gap-sm);
  opacity: 0.85;
}

.section__title {
  font-family: var(--f-display);
  font-size: var(--fs-title);
  font-weight: 300;
  line-height: 1.0;
  letter-spacing: -0.025em;
  color:var(--c-text);
  margin-bottom: var(--gap-sm);
}

.section__title em {
  font-style: normal;
  color: var(--c-accent);
  display: block;
}

.section__body {
  font-size: var(--fs-body);
  color: var(--c-muted);
  max-width: 42ch;
  line-height: 1.95;
}

.section__cta {
  display: inline-block;
  margin-top: var(--gap-md);
  font-size: var(--fs-label);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--c-accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  transition: opacity 0.25s, letter-spacing 0.3s;
}

.section__cta:hover {
  opacity: 0.55;
  letter-spacing: 0.3em;
}

.scroll-hint {
  display: block;
  margin-top: var(--gap-md);
  font-size: var(--fs-label);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--c-muted);
  animation: nudge 2.8s ease-in-out infinite;
}

@keyframes nudge {
  0%, 100% { opacity: 0.35; transform: translateY(0); }
  55%       { opacity: 1;    transform: translateY(5px); }
}

/* ═══════════════════════════════════════════════════════════
   SLIDER — полноэкранный слайдер
═══════════════════════════════════════════════════════════ */
.slider {
  position: relative;
  /* height задаётся через JS: 100vh + n×50vh */
}

.slider__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100lvh;
  overflow: hidden;
}

/* Фоновый текст WORKS — поверх слайдов, не реагирует на курсор */
.slider__bg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-display);
  font-size: 27vw;
  font-weight: 400;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 1);
  letter-spacing: -0.04em;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  z-index: 10;
}

.slider__slides {
  position: relative;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1s ease;
}

.slider__slides.is-active {
  opacity: 1;
}

.slider__slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  padding: clamp(24px, 3vw, 50px);
  opacity: 0;
  pointer-events: none;
}

.slider__slide:first-child {
  opacity: 1;
}

.slider__image {
  width: clamp(220px, 44vw, 647px);
  height: clamp(220px, 44vw, 647px);
  flex-shrink: 0;
  align-self: flex-end;
  overflow: hidden;
  will-change: transform;
}

.slider__image img,
.slider__image video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.slider__content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  flex: 1;
  padding-left: clamp(24px, 4vw, 80px);
}

.slider__title {
  font-family: var(--f-display);
  font-size: clamp(1.8rem, 4.5vw, 4.375rem);
  font-weight: 400;
  line-height: 1;
  color: var(--c-text);
  max-width: 14ch;
  will-change: transform;
}

.slider__counter {
  font-family: var(--f-display);
  font-size: clamp(1.1rem, 2.2vw, 1.875rem);
  line-height: 0.96;
  color: var(--c-text);
  will-change: transform;
}

.slider__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 18px 24px;
  border: 1px solid rgba(224, 228, 232, 0.7);
  border-radius: 50px;
  color: var(--c-text);
  text-decoration: none;
  font-size: 12px;
  line-height: 1.1;
  letter-spacing: 0.06em;
  white-space: nowrap;
  will-change: transform;
  transition: opacity 0.25s;
}

.slider__cta:hover { opacity: 0.55; }

/* ═══════════════════════════════════════════════════════════
   STAGE — горизонтальный скролл-блок с карточками
═══════════════════════════════════════════════════════════ */
.stage {
  position: relative;
  overflow-x: clip; /* не создаёт scroll container → не ломает sticky */
}

.stage__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100lvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  isolation: isolate; /* iOS Safari: не даёт will-change детям вытекать из overflow:hidden */
}

.stage__inner {
  display: flex;
  align-items: center;
  gap: clamp(40px, 6vw, 124px);
  padding: clamp(60px, 8vw, 150px) clamp(20px, 3vw, 50px) clamp(30px, 4vw, 50px);
  flex: none;
  width: 100%;
  will-change: transform;
}

.stage__info {
  flex: 0 0 clamp(200px, 28vw, 424px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: clamp(340px, 45vw, 598px);
}

.stage__info-text {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stage__title {
  font-family: var(--f-display);
  font-size: clamp(2rem, 5vw, 4.375rem);
  font-weight: 400;
  line-height: 1;
  color: var(--c-text);
}

.stage__desc {
  font-size: clamp(0.78rem, 1.4vw, 1rem);
  line-height: 1.36;
  color: var(--c-text);
  max-width: 36ch;
}

.stage__count {
  font-family: var(--f-display);
  font-size: clamp(1.2rem, 2.5vw, 1.875rem);
  font-weight: 400;
  line-height: 0.96;
  color: var(--c-text);
}

.stage__track {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.stage__card {
  flex-shrink: 0;
  width: clamp(240px, 25vw, 357px);
  height: clamp(400px, 44vw, 616px);
  border-radius: 30px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: var(--card-bg, rgba(22, 18, 14, 0.4));
  padding: clamp(24px, 3vw, 50px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  will-change: transform;
  transform-origin: center 85%;
}

.stage__card-num {
  font-size: clamp(0.78rem, 1.4vw, 1rem);
  line-height: 1.36;
  color: var(--c-text);
  white-space: nowrap;
}

.stage__card-title {
  font-family: var(--f-display);
  font-size: clamp(1.1rem, 2.2vw, 1.875rem);
  font-weight: 400;
  line-height: 0.96;
  color: var(--c-text);
}

.stage__card-body {
  font-size: clamp(0.78rem, 1.4vw, 1rem);
  line-height: 1.36;
  color: var(--c-text);
}

/* ═══════════════════════════════════════════════════════════
   FADE-TOP: исчезновение при входе в верхнюю треть экрана
═══════════════════════════════════════════════════════════ */
.fade-top {
  transition: opacity 0.55s cubic-bezier(0.4, 0, 0.2, 1),
              filter  0.55s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, filter;
}

.fade-top--out {
  opacity: 0 !important;
  filter: blur(30px) !important;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════
   АДАПТИВНОСТЬ
═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .section--left,
  .section--center {
    justify-content: flex-start;
    align-items: flex-start;
  }
  .section--right {
    justify-content: flex-start;
    align-items: flex-end;
  }
}

@media (max-width: 480px) {
  .section {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .section__card {
    max-width: 100%;
  }

  .slider__slide{
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-around;
  }
  .slider__content{
    padding-left: 0;
    padding-top: 20vh;
    padding-bottom: 40px;
  }
  .slider__image{
    align-self: unset;
    width: 100%;
    height: 40%;
  }
}

/* ═══════════════════════════════════════════════════════════
   СЕКЦИЯ ПОСЛЕ WEBGL
═══════════════════════════════════════════════════════════ */
#after-webgl {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: var(--gap-xl) clamp(1.25rem, 6vw, 5rem);
  background: var(--c-bg);
}

.after-webgl__inner {
  max-width: 680px;
}

.after-webgl__label {
  display: block;
  font-size: var(--fs-label);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--c-accent);
  margin-bottom: var(--gap-sm);
  opacity: 0.85;
}

.after-webgl__title {
  font-family: var(--f-display);
  font-size: var(--fs-title);
  font-weight: 300;
  line-height: 1.0;
  letter-spacing: -0.025em;
  color: #f2ede3;
  margin-bottom: var(--gap-sm);
}

.after-webgl__body {
  font-size: var(--fs-body);
  color: var(--c-muted);
  max-width: 52ch;
  line-height: 1.95;
}

.placeholder{
  background: url('page_placeholder.jpg');
  background-size: contain;
}

/* ═══════════════════════════════════════════════════════════
   АДАПТИВНОСТЬ
═══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .section__card {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .scroll-hint,
  .loader__ring {
    animation: none;
  }
}
