/* ═══════════════════════════════════════════════════════════
   ПЕРЕМЕННЫЕ
═══════════════════════════════════════════════════════════ */
:root {
  --c-bg:      #f8f8f8;
  --c-surface: rgba(6, 8, 20, 0.66);
  --c-text:    #000000;
  --c-muted:   rgba(232, 228, 218, 0.48);
  --c-accent:  #000000;
  --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(2.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); }
}

/* ═══════════════════════════════════════════════════════════
   АДАПТИВНОСТЬ
═══════════════════════════════════════════════════════════ */
@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%;
  }
}

/* ═══════════════════════════════════════════════════════════
   СЕКЦИЯ ПОСЛЕ 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);
}

.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;
}

/* Обычный контент страницы после WebGL-блока:
   поднимаем над фиксированным канвасом и возвращаем белый фон */
#page-content {
  position: relative;
  z-index: 1;
  background: #ffffff;
}

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