/* =========================
   ROOT: НАСТРОЙКИ ПОЗИЦИЙ/РАЗМЕРОВ
========================= */

:root {
  /* Размер сцены под макет 1920x1080 */
  --scene-width: 1920px;
  --scene-height: 1080px;

  /* Фоны трёх экранов */
  --bg-main-image: url("bg_snowgoom_main.png");
  --bg-about-image: url("bg_snowgoom_about.png");
  --bg-chart-image: url("bg_snowgoom_chart.png");

  /* ---------- SCREEN 1 ---------- */

  /* Навигация */
  --nav-top: 380px;
  --nav-gap: 60px;
  --nav-font-size: 30px;

  /* ---------- SCREEN 2 (ABOUT) ---------- */

  /* Картинка ABOUT */
  --about-title-top: 40px;
  --about-title-width: 500px;

  /* Текст ABOUT */
  --about-text-top: 230px;
  --about-text-width: 1180px;
  --about-text-font-size: 20px;
  --about-text-line-height: 1.5;

  /* Галерея из 3 картинок */
  --about-gallery-top: 570px;
  --about-gallery-gap: 40px;
  --about-panel-width: 500px;

  /* Стрелка вниз */
  --arrow-down-bottom: 70px;
  --arrow-down-size: 120px;

  /* Снег */
  --snowflake-size: 22px;
  --snowflake-count: 40; /* логическое значение, меняется в JS */

  /* ---------- SCREEN 3 (CHART) ---------- */

  /* Заголовок CHART */
  --chart-title-top: 70px;
  --chart-title-width: 400px;

  /* Рамка графика */
  --chart-frame-top: 220px;
  --chart-frame-width: 900px;
  --chart-frame-height: 480px;

  /* Окно под iframe внутри рамки */
  --chart-window-inset: 24px;

  /* Стрелка вверх */
  --arrow-up-bottom: 120px;
  --arrow-up-size: 120px;

  /* Анимации */
  --nav-hover-scale: 1.08;
  --fade-duration: 0.7s;
}

/* =========================
   БАЗА
========================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  background: #ffffff;
  color: #000000;
}

body {
  display: flex;
  justify-content: center;
  font-family: "Comic Neue", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page-wrapper {
  width: var(--scene-width);
}

.screen {
  position: relative;
  width: var(--scene-width);
  height: var(--scene-height);
  overflow: hidden;
}

.screen-bg {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  z-index: 0;
}

.bg-main {
  background-image: var(--bg-main-image);
}

.bg-about {
  background-image: var(--bg-about-image);
}

.bg-chart {
  background-image: var(--bg-chart-image);
}

/* =========================
   SCREEN 1: NAV
========================= */

.main-nav {
  position: absolute;
  top: var(--nav-top);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--nav-gap);
  z-index: 2;
}

.nav-btn {
  background: transparent;
  border: none;
  padding: 4px 0;
  font-family: "Comic Neue", sans-serif;
  font-size: var(--nav-font-size);
  letter-spacing: 2px;
  color: #000000;
  cursor: pointer;
  position: relative;
  text-transform: uppercase;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.7);
  transition:
    transform 0.15s ease-out,
    text-shadow 0.15s ease-out,
    opacity 0.15s ease-out;
}

.nav-btn::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: #1a9fe8;
  transform: translateX(-50%);
  transition: width 0.15s ease-out;
}

.nav-btn:hover {
  transform: scale(var(--nav-hover-scale));
  text-shadow: 0 0 10px rgba(255, 255, 255, 1);
}

.nav-btn:hover::after {
  width: 100%;
}

.nav-btn:active {
  transform: scale(0.96);
  opacity: 0.8;
}

.nav-btn-accent {
  font-weight: 700;
}

/* =========================
   SCREEN 2: ABOUT
========================= */

.about-title-img {
  position: absolute;
  top: var(--about-title-top);
  left: 50%;
  transform: translateX(-50%);
  width: var(--about-title-width);
  max-width: 80%;
  z-index: 2;
  opacity: 0;
  transform-origin: center;
  animation: aboutTitleIn var(--fade-duration) ease-out forwards;
  animation-delay: 0.1s;
}

@keyframes aboutTitleIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-15px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

.about-text {
  position: absolute;
  top: var(--about-text-top);
  left: 50%;
  transform: translateX(-50%);
  width: var(--about-text-width);
  max-width: 90%;
  text-align: center;
  font-family: "Comic Neue", sans-serif;
  font-size: var(--about-text-font-size);
  line-height: var(--about-text-line-height);
  color: #000000;
  z-index: 2;
}

.about-text p {
  margin: 0 0 14px;
  opacity: 0;
  transform: translateY(10px);
}

/* поочерёдное появление абзацев */
.about-text p.visible {
  animation: paragraphIn var(--fade-duration) ease-out forwards;
}

.about-text p.visible:nth-child(2) {
  animation-delay: 0.25s;
}

.about-text p.visible:nth-child(3) {
  animation-delay: 0.5s;
}

.about-text p.visible:nth-child(4) {
  animation-delay: 0.75s;
}

@keyframes paragraphIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.about-gallery {
  position: absolute;
  top: var(--about-gallery-top);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--about-gallery-gap);
  z-index: 2;
}

.about-panel {
  width: var(--about-panel-width);
  max-width: 32vw;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(20px);
}

.about-panel.visible {
  animation: panelIn var(--fade-duration) ease-out forwards;
}

.about-panel-2.visible {
  animation-delay: 0.25s;
}

.about-panel-3.visible {
  animation-delay: 0.5s;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================
   ARROWS
========================= */

.arrow-btn {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 3;
  padding: 0;
}

.arrow-btn img {
  display: block;
  width: 100%;
  height: auto;
}

.arrow-down {
  bottom: var(--arrow-down-bottom);
  width: var(--arrow-down-size);
  animation: arrowBounce 1.3s ease-in-out infinite;
}

.arrow-up {
  bottom: var(--arrow-up-bottom);
  width: var(--arrow-up-size);
  animation: arrowBounceUp 1.3s ease-in-out infinite;
}

.arrow-btn:hover {
  transform: translateX(-50%) scale(1.05);
}

.arrow-btn:active {
  transform: translateX(-50%) scale(0.96);
}

@keyframes arrowBounce {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(10px);
  }
}

@keyframes arrowBounceUp {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-10px);
  }
}

/* =========================
   СНЕГ
========================= */

.snow-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
}

.snowflake {
  position: absolute;
  top: -40px;
  width: var(--snowflake-size);
  height: var(--snowflake-size);
  background-image: url("snowflake.png");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.85;
  animation: snowFall linear infinite;
}

@keyframes snowFall {
  from {
    transform: translate3d(var(--x-offset, 0), 0, 0);
  }
  to {
    transform: translate3d(var(--x-offset, 0), 110vh, 0);
  }
}

/* =========================
   SCREEN 3: CHART
========================= */

.chart-title-img {
  position: absolute;
  top: var(--chart-title-top);
  left: 50%;
  transform: translateX(-50%);
  width: var(--chart-title-width);
  max-width: 60%;
  z-index: 2;
  opacity: 0;
  transform-origin: center;
  animation: chartTitleIn var(--fade-duration) ease-out forwards;
  animation-delay: 0.1s;
}

@keyframes chartTitleIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-15px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

.chart-frame {
  position: absolute;
  top: var(--chart-frame-top);
  left: 50%;
  transform: translateX(-50%);
  width: var(--chart-frame-width);
  height: var(--chart-frame-height);
  z-index: 2;
}

.chart-frame-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
}

.chart-window {
  position: absolute;
  top: var(--chart-window-inset);
  left: var(--chart-window-inset);
  right: var(--chart-window-inset);
  bottom: var(--chart-window-inset);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.chart-window iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* =========================
   МОБИЛЬНЫЙ АДАПТИВ
========================= */

@media (max-width: 1024px) {
  body {
    display: block;
    overflow-x: hidden;
  }

  .page-wrapper {
    width: 1920px;
    transform: scale(calc(100vw / 1920));
    transform-origin: top left;
  }
}
