/* =========================================
   ГЛОБАЛЬНІ НАЛАШТУВАННЯ (МОЖНА СМІЛИВО КРУТИТИ)
   ========================================= */
:root {
  /* ---- РОЗМІРИ / ВІДСТАНІ ---- */

  /* Бокові відступи для ABOUT / CHART */
  --section-padding-x: min(8vw, 140px);

  /* Відстань між лівим і правим блоком (перс / текст, перс / чарт) */
  --section-gap: 80px;

  /* Розмір персонажа */
  --char-max-width: 460px;
  --char-max-height: 70vh;

  /* Розмір заголовку на першому екрані */
  --hero-title-size: clamp(3rem, 6vw, 4.5rem);

  /* Максимальна ширина ABOUT-тексту */
  --about-text-max-width: 520px;

  /* Розміри блоку графіка */
  --chart-width: 700px;
  --chart-height: 420px;

  /* Позиція та розмір корови */
  --cow-top: 22%;      /* вертикальна позиція */
  --cow-width: 230px;  /* розмір корови */

  /* Позиція кота */
  --cat-left: 0px;
  --cat-bottom: 0px;
  --cat-max-width: 220px;

  /* ---- ПОЗИЦІЇ КЛЮЧОВИХ ЕЛЕМЕНТІВ (РУХАЄШ САМ) ---- */

  /* HERO */
  --hero-title-top: 0px;
  --hero-title-left: 0px;

  --hero-button-top: 0px;
  --hero-button-left: 0px;

  /* ABOUT */
  --about-title-top: 0px;
  --about-title-left: 0px;

  --about-text-top: 0px;
  --about-text-left: 0px;

  --about-char-top: 0px;
  --about-char-left: 0px;

  --about-hallu-top: 0px;
  --about-hallu-left: 130px;

  /* CHART */
  --chart-title-top: 0px;
  --chart-title-left: 140px;

  --chart-frame-top: 0px;
  --chart-frame-left: -100px;

  --chart-char-top: 100px;
  --chart-char-left: 0px;

  /* Twitter кнопка на CHART екрані */
  --twitter-top: 18px;
  --twitter-left: 18px;

  /* Позиція "коду" у ABOUT */
  --code-top: 18px;
  --code-left: 18px;
}

/* ===== BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  scroll-behavior: smooth;
}

body {
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: "Irish Grover", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

/* Весь сайт — вертикальний скрол з трьома екранами */
.page-wrapper {
  width: 100%;
  height: 100vh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
}

.section {
  width: 100%;
  height: 100vh;
  position: relative;
  scroll-snap-align: start;
}

/* =========================================
   HERO (ПЕРШИЙ ЕКРАН)
   ========================================= */

.hero-section {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* фон-гіфка */
.hero-bg {
  position: absolute;
  inset: 0;
  background: url("img/hero-tunnel.gif") center center / cover no-repeat;
  filter: contrast(1.15) saturate(1.2);
  z-index: -2;
}

/* затемнення / градієнт */
.hero-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at center,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.55) 55%,
    rgba(0, 0, 0, 0.9) 100%
  );
  z-index: -1;
}

.hero-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 32px;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

/* Назва сайту – положення керується змінними */
.site-title {
  font-size: var(--hero-title-size);
  letter-spacing: 0.06em;
  text-shadow: 0 0 12px rgba(0, 0, 0, 0.85),
    0 0 40px rgba(0, 255, 150, 0.4);
  animation: titleFloat 5s ease-in-out infinite;

  position: relative;
  top: var(--hero-title-top);
  left: var(--hero-title-left);
}

/* легкий плавучий ефект */
@keyframes titleFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* Кнопка "enter the trip" – теж легко посунути */
.play-button {
  position: relative;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  outline: none;

  top: var(--hero-button-top);
  left: var(--hero-button-left);
}

.play-circle {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 5px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.9),
    0 0 40px rgba(0, 255, 150, 0.45);
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.play-triangle {
  width: 0;
  height: 0;
  border-left: 26px solid #ffffff;
  border-top: 16px solid transparent;
  border-bottom: 16px solid transparent;
  margin-left: 4px;
}

.play-label {
  font-size: 1.1rem;
  text-transform: lowercase;
  letter-spacing: 0.06em;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.9);
  opacity: 0.9;
}

.play-button:hover .play-circle {
  transform: scale(1.05);
  box-shadow: 0 0 24px rgba(0, 255, 150, 0.5),
    0 0 70px rgba(0, 255, 150, 0.9);
}

.play-button:active .play-circle {
  transform: scale(0.97);
}

/* =========================================
   ABOUT (ДРУГИЙ ЕКРАН)
   ========================================= */

.about-section {
  background: #000;
  overflow: hidden;
}

/* Мигаючий "код" у лівому верхньому куті */
.code-corner {
  position: absolute;
  top: var(--code-top);   /* ← міняєш тут */
  left: var(--code-left);/* ← і тут */
  font-size: 0.9rem;
  line-height: 1.2;
  color: #67ff9e;
  text-shadow: 0 0 8px rgba(0, 255, 150, 0.5);
  background: rgba(0, 0, 0, 0.7);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(0, 255, 150, 0.5);
  opacity: 0;
  animation: codeFlicker 8s infinite;
}

.code-corner pre {
  font-family: "Irish Grover", cursive;
}

@keyframes codeFlicker {
  0%,
  12%,
  22%,
  40%,
  100% {
    opacity: 0;
  }
  15%,
  18%,
  30%,
  36%,
  60%,
  70%,
  80% {
    opacity: 1;
  }
}

/* Кіт в кутку – базова позиція з змінних */
.corner-cat {
  position: absolute;
  left: var(--cat-left);
  bottom: var(--cat-bottom);
  max-width: var(--cat-max-width);
  pointer-events: none;
}

/* Тріп-кот: мерехтить, появляється/зникає */
.trippy-cat {
  animation: catTrip 12s infinite ease-in-out;
}

@keyframes catTrip {
  0% {
    opacity: 0;
    transform: translateY(0) scale(1);
    filter: hue-rotate(0deg) contrast(100%);
  }
  10% {
    opacity: 1;
    transform: translateY(-4px) scale(1.02);
    filter: hue-rotate(20deg) contrast(120%);
  }
  20% {
    opacity: 0.4;
    transform: translateY(-2px) scale(1);
  }
  30% {
    opacity: 1;
    transform: translateY(-6px) scale(1.05) rotate(-1deg);
  }
  40% {
    opacity: 0;
    transform: translateY(4px) scale(0.97);
  }
  60% {
    opacity: 1;
    transform: translateY(-3px) scale(1.03);
    filter: hue-rotate(-20deg) contrast(130%);
  }
  80% {
    opacity: 0.3;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(8px) scale(0.95);
  }
}

/* Летюча корова */
.flying-cow {
  position: absolute;
  top: var(--cow-top);
  left: -20%;
  width: var(--cow-width);
  pointer-events: none;
  filter: drop-shadow(0 0 18px rgba(255, 255, 255, 0.7));
  animation: cowTravel 18s linear infinite, cowFlip 18s linear infinite,
    cowBob 1.4s ease-in-out infinite alternate;
}

/* рух корови по горизонталі */
@keyframes cowTravel {
  0% {
    left: -20%;
  }
  45% {
    left: 110%;
  }
  50% {
    left: 110%;
  }
  95% {
    left: -20%;
  }
  100% {
    left: -20%;
  }
}

/* розворот за напрямком польоту */
@keyframes cowFlip {
  0%,
  45% {
    transform: scaleX(1);
  }
  50%,
  95% {
    transform: scaleX(-1);
  }
  100% {
    transform: scaleX(1);
  }
}

/* легке "плавання" корови */
@keyframes cowBob {
  from {
    top: var(--cow-top);
  }
  to {
    top: calc(var(--cow-top) - 4%);
  }
}

/* Лейаут ABOUT */
.about-layout {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--section-gap);
  padding-inline: var(--section-padding-x);
}

.about-left,
.about-right {
  flex: 1;
  position: relative;
}

/* Галюцинації над персонажем – позиція через змінні */
.hallu-wrapper {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 24px;
}

.hallu-gif {
  width: 260px;
  max-width: 80%;
  border-radius: 8px;
  box-shadow: 0 0 18px rgba(0, 255, 188, 0.6),
    0 0 50px rgba(163, 0, 255, 0.7);
  animation: halluPulse 4.5s ease-in-out infinite;

  position: relative;
  top: var(--about-hallu-top);
  left: var(--about-hallu-left);
}

@keyframes halluPulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 18px rgba(0, 255, 188, 0.6),
      0 0 50px rgba(163, 0, 255, 0.7);
  }
  50% {
    transform: scale(1.03) rotate(0.8deg);
    box-shadow: 0 0 26px rgba(0, 255, 188, 0.9),
      0 0 70px rgba(163, 0, 255, 0.9);
  }
}

/* Персонаж ABOUT – теж через змінні */
.hero-char-wrapper {
  display: flex;
  justify-content: center;
}

#about .hero-char {
  max-width: var(--char-max-width);
  max-height: var(--char-max-height);
  filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.7));

  position: relative;
  top: var(--about-char-top);
  left: var(--about-char-left);
}

/* Заголовок ABOUT */
#about .block-title {
  font-size: clamp(3rem, 5vw, 3.6rem);
  margin-bottom: 16px;
  letter-spacing: 0.1em;

  position: relative;
  top: var(--about-title-top);
  left: var(--about-title-left);
}

/* Текст ABOUT */
.about-text {
  font-size: 1.25rem;
  max-width: var(--about-text-max-width);
  line-height: 1.5;

  position: relative;
  top: var(--about-text-top);
  left: var(--about-text-left);
}

/* =========================================
   CHART (ТРЕТІЙ ЕКРАН)
   ========================================= */

.chart-section {
  background: #000;
  overflow: hidden;
}

/* Twitter-кнопка – легко рухається змінними */
.twitter-btn {
  position: absolute;
  top: var(--twitter-top);
  left: var(--twitter-left);
  padding: 8px 18px;
  border-radius: 999px;
  border: 2px solid #ffffff;
  color: #000;
  background: #ffffff;
  text-decoration: none;
  text-transform: lowercase;
  letter-spacing: 0.08em;
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.8);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease,
    box-shadow 0.2s ease;
}

.twitter-btn:hover {
  background: #00acee;
  color: #000;
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(0, 172, 238, 0.9);
}

/* Лейаут CHART */
.chart-layout {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--section-gap);
  padding-inline: var(--section-padding-x);
}

.chart-left,
.chart-right {
  flex: 1;
  position: relative;
}

/* Персонаж на CHART */
.chart-char {
  max-width: var(--char-max-width);
  max-height: var(--char-max-height);
  filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.7));

  position: relative;
  top: var(--chart-char-top);
  left: var(--chart-char-left);
}

/* Заголовок CHART */
#chart .block-title {
  font-size: clamp(3rem, 5vw, 3.6rem);
  margin-bottom: 16px;
  letter-spacing: 0.1em;

  position: relative;
  top: var(--chart-title-top);
  left: var(--chart-title-left);
}

/* Блок графіка */
.chart-frame {
  margin-top: 16px;
  width: min(var(--chart-width), 100%);
  height: min(var(--chart-height), 60vh);
  background: #111;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.4),
    0 0 60px rgba(0, 255, 150, 0.5);

  position: relative;
  top: var(--chart-frame-top);
  left: var(--chart-frame-left);
}

.chart-frame iframe {
  width: 100%;
  height: 100%;
}

/* =========================================
   ADAPTIVE (МОЖЕШ НЕ ЧІПАТИ, АЛЕ МОЖНА)
   ========================================= */

@media (max-width: 900px) {
  .about-layout,
  .chart-layout {
    flex-direction: column;
    gap: 40px;
    padding-inline: 20px;
    padding-top: 80px;
  }

  .hero-char,
  .chart-char {
    max-height: 45vh;
  }

  .corner-cat {
    max-width: 150px;
  }

  .code-corner {
    font-size: 0.75rem;
  }
}
