/* =========================================
   1. НАСТРОЙКИ И ПЕРЕМЕННЫЕ (ROOT)
   ========================================= */
:root {
  /* Цветовая палитра */
  --primary-color: #2b5876; /* Глубокий синий (Статус) */
  --secondary-color: #4e4376; /* Фиолетовый (Творчество) */
  --accent-color: #ff6b6b; /* Яркий коралл/Оранжевый (Энергия/DOMS) */
  --text-dark: #2d3436;
  --text-light: #636e72;
  --white: #ffffff;

  /* Градиент фона (Живой и яркий) */
  --bg-gradient: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);

  /* Эффект стекла (Glassmorphism) */
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: 1px solid rgba(255, 255, 255, 0.8);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
  --blur: blur(12px);

  /* Отступы */
  --container-width: 1200px;
  --header-height: 80px;
}

/* Сброс стилей */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
}
html {
  scroll-behavior: smooth;
}

body {
  font-family: "Open Sans", sans-serif;
  color: --text-dark;
  background: linear-gradient(120deg, #e0c3fc 0%, #8ec5fc 100%);
  background-attachment: fixed;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #f8faff;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
  font-family: "Montserrat", sans-serif;
  color: var(--primary-color);
  font-weight: 700;
}

a {
  text-decoration: none;
  color: inherit;
  transition: 0.3s ease;
}

ul {
  list-style: none;
}

/* Контейнер для центровки контента */
.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Утилита для стекла (применяем ко всем карточкам) */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: var(--glass-border);
  border-radius: 20px;
  box-shadow: var(--glass-shadow);
  padding: 30px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
  transform: translateY(-10px); /* Легкий взлет при наведении */
  box-shadow: 0 15px 40px rgba(31, 38, 135, 0.15);
}

/* =========================================
       2. ПЛАВАЮЩИЙ ФОН (PARALLAX)
       ========================================= */

.parallax-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.floating-wrapper {
  position: absolute;
  width: 120px;
  will-change: transform;
}

.floating-item {
  width: 100%;
  height: auto;
  opacity: 0.9;
  filter: drop-shadow(0 15px 15px rgba(0, 0, 0, 0.1));
  animation: floatBob 6s ease-in-out infinite;
}

@keyframes floatBob {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-30px) rotate(22deg);
  }
}

.floating-wrapper:nth-child(1) .floating-item {
  animation-delay: 0s;
}

.floating-wrapper:nth-child(2) .floating-item {
  animation-delay: -1s;
  width: 160px;
}

.floating-wrapper:nth-child(3) .floating-item {
  animation-delay: -3s;
  transform: rotate(-15deg);
}

.floating-wrapper:nth-child(4) .floating-item {
  width: 90px;
  animation-duration: 8s;
}

.layer-deep {
  z-index: -2;
}

.layer-deep .floating-item {
  width: 50px;
  opacity: 0.4;
  filter: blur(4px);
  animation-duration: 4s;
  box-shadow: none;
}
/* =========================================
       3. ШАПКА (HEADER)
       ========================================= */
.main-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 80px; /* Фиксированная высота для стабильности */
  z-index: 1000;
  display: flex;
  align-items: center;
  transition: 0.3s ease;
}

.glass-effect {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(15px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.header-wrapper {
  position: relative; /* Важно для абсолютного позиционирования детей */
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: center; /* Центрирует nav-menu по середине */
  align-items: center;
  height: 100%;
}

/* --- ЛОГОТИП (ЖЕСТКО СЛЕВА) --- */
.logo {
  position: absolute;
  left: 20px;
  display: flex;
  align-items: center;
}

.logo img {
  height: 45px;
  width: auto;
}

/* --- ЦЕНТРАЛЬНОЕ МЕНЮ (МАТЕМАТИЧЕСКИЙ ЦЕНТР) --- */
.nav-menu-center {
  display: flex;
  align-items: center;
  gap: 30px;
}

.nav-list {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 15px;
  margin: 0;
  padding: 0;
}

/* ССЫЛКИ И АКТИВНОЕ СОСТОЯНИЕ */
.nav-link {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  color: #2c3e50;
  text-decoration: none;
  padding: 8px 16px;
  border: 2px solid transparent;
  border-radius: 50px;
  transition: 0.3s all ease;
  white-space: nowrap;
  position: relative;
}

/* Активная страница (Kataloq и др.) */
.nav-link.active {
  color: #ff6b6b !important;
  border-color: #ff6b6b !important;
  background: rgba(255, 107, 107, 0.05);
}

.nav-link::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -5px;
  left: 0;
  background-color: var(--accent-color);
  transition: 0.3s;
}

/* Линия работает только если у ссылки НЕТ класса .active */
.nav-link:not(.active):hover::after {
  width: 100%;
}

/* МАРКЕТПЛЕЙС (ФИОЛЕТОВЫЙ) */
.btn-marketplace {
  color: #9c21a6 !important;
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  border: 2px solid #9c21a6;
  padding: 8px 18px;
  border-radius: 50px;
  text-decoration: none;
  transition: 0.3s;
}

.btn-marketplace:hover {
  background: #9c21a6;
  color: white !important;
}

/* --- АВТОРИЗАЦИЯ (ЖЕСТКО СПРАВА) --- */
.nav-auth-right {
  position: absolute;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.auth-link {
  font-weight: 700;
  font-size: 13px;
  color: #2c3e50;
  text-decoration: none;
  text-transform: uppercase;
}

.btn-reg {
  background-color: #2c3e50;
  color: white !important;
  padding: 10px 22px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  transition: 0.3s;
}

.btn-reg:hover {
  background-color: #3e5871;
  transform: translateY(-2px);
}

/* МОБИЛКА (СКРЫВАЕМ БУРГЕР) */
.burger-menu {
  display: none;
}

#preloader {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: transparent;
  min-height: 60vh;
  padding: 40px 0;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  z-index: 10;
}

/* Анимация пишущего карандаша */
.writing-pencil {
  position: relative;
  font-size: 4rem;
  color: #2c3e50;
  display: inline-block;
  animation: pencilMove 2.5s infinite ease-in-out;
}
/* From Uiverse.io by gustavofusco */
.pencil {
  display: block;
  width: 3em;
  height: 3em;
}

.pencil__body1,
.pencil__body2,
.pencil__body3,
.pencil__eraser,
.pencil__eraser-skew,
.pencil__point,
.pencil__rotate,
.pencil__stroke {
  animation-duration: 3s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.pencil__body1,
.pencil__body2,
.pencil__body3 {
  transform: rotate(-90deg);
}

.pencil__body1 {
  animation-name: pencilBody1;
}

.pencil__body2 {
  animation-name: pencilBody2;
}

.pencil__body3 {
  animation-name: pencilBody3;
}

.pencil__eraser {
  animation-name: pencilEraser;
  transform: rotate(-90deg) translate(49px, 0);
}

.pencil__eraser-skew {
  animation-name: pencilEraserSkew;
  animation-timing-function: ease-in-out;
}

.pencil__point {
  animation-name: pencilPoint;
  transform: rotate(-90deg) translate(49px, -30px);
}

.pencil__rotate {
  animation-name: pencilRotate;
}

.pencil__stroke {
  animation-name: pencilStroke;
  transform: translate(100px, 100px) rotate(-113deg);
}

/* Animations */
@keyframes pencilBody1 {
  from,
  to {
    stroke-dashoffset: 351.86;
    transform: rotate(-90deg);
  }

  50% {
    stroke-dashoffset: 150.8;
    /* 3/8 of diameter */
    transform: rotate(-225deg);
  }
}

@keyframes pencilBody2 {
  from,
  to {
    stroke-dashoffset: 406.84;
    transform: rotate(-90deg);
  }

  50% {
    stroke-dashoffset: 174.36;
    transform: rotate(-225deg);
  }
}

@keyframes pencilBody3 {
  from,
  to {
    stroke-dashoffset: 296.88;
    transform: rotate(-90deg);
  }

  50% {
    stroke-dashoffset: 127.23;
    transform: rotate(-225deg);
  }
}

@keyframes pencilEraser {
  from,
  to {
    transform: rotate(-45deg) translate(49px, 0);
  }

  50% {
    transform: rotate(0deg) translate(49px, 0);
  }
}

@keyframes pencilEraserSkew {
  from,
  32.5%,
  67.5%,
  to {
    transform: skewX(0);
  }

  35%,
  65% {
    transform: skewX(-4deg);
  }

  37.5%,
  62.5% {
    transform: skewX(8deg);
  }

  40%,
  45%,
  50%,
  55%,
  60% {
    transform: skewX(-15deg);
  }

  42.5%,
  47.5%,
  52.5%,
  57.5% {
    transform: skewX(15deg);
  }
}

@keyframes pencilPoint {
  from,
  to {
    transform: rotate(-90deg) translate(49px, -30px);
  }

  50% {
    transform: rotate(-225deg) translate(49px, -30px);
  }
}

@keyframes pencilRotate {
  from {
    transform: translate(100px, 100px) rotate(0);
  }

  to {
    transform: translate(100px, 100px) rotate(720deg);
  }
}

@keyframes pencilStroke {
  from {
    stroke-dashoffset: 439.82;
    transform: translate(100px, 100px) rotate(-113deg);
  }

  50% {
    stroke-dashoffset: 164.93;
    transform: translate(100px, 100px) rotate(-113deg);
  }

  75%,
  to {
    stroke-dashoffset: 439.82;
    transform: translate(100px, 100px) rotate(112deg);
  }
}

.loader-text-wrapper {
  margin-top: 20px;
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.loader-text {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 8px; /* Сильный межбуквенный интервал для стиля */
  text-transform: uppercase;
  color: #2c3e50;
  margin: 0;
  position: relative;
}

/* Анимация точек (...) */
.dots::after {
  content: "";
  font-size: 1.5rem;
  color: #2c3e50;
  animation: dotAlpha 1.5s infinite steps(4);
}

@keyframes dotAlpha {
  0% {
    content: "";
  }
  25% {
    content: ".";
  }
  50% {
    content: "..";
  }
  75% {
    content: "...";
  }
}

/* =========================================
     FOOTER И РАБОЧАЯ РАКЕТА (ИСПРАВЛЕНО)
     ========================================= */

.main-footer {
  background: #ffffff;
  padding: 30px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  margin-top: auto;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-info p {
  font-size: 0.9rem;
  color: #666;
  margin: 5px 0;
}
.developer-link a {
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.3s;
}
.developer-link a:hover {
  color: var(--accent-color);
}

/* --- КНОПКА (БАЗА) --- */
.scroll-top-btn {
  background: var(--primary-color);
  color: #fff;
  border: none;
  padding: 12px 25px;
  border-radius: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: visible !important;
  position: relative;
  z-index: 1000;
}

.pencil-wrapper {
  position: relative;
  width: 20px;
  height: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pencil-icon {
  display: inline-block;
  font-size: 1.2rem;
  transform: rotate(135deg);
  will-change: transform, opacity;
}

.rocket-smoke {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  background: linear-gradient(to bottom, #ff4757, #ffa502, transparent);
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

.scroll-top-btn:hover .pencil-icon {
  transform: rotate(135deg);
  animation: rumble 0.1s infinite;
}

@keyframes rumble {
  0% {
    transform: rotate(135deg) translate(0, 0);
  }
  50% {
    transform: rotate(135deg) translate(1px, 1px);
  }
  100% {
    transform: rotate(135deg) translate(0, 0);
  }
}
