/* ===================================
   CSS файл для главной страницы портфолио
   ===================================
*/

/* Сброс стилей */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  color: #5D6466;
  min-height: 100vh;
  /* Градиент зафиксирован по высоте экрана, остальное залито темным цветом */
  background: linear-gradient(180deg, #5D6466 0%, #06151E 40%, #06151E 100%);
  background-repeat: no-repeat;
  background-size: 100% 270vh; /* Градиент только на первый экран */
  background-color: #06151E;    /* Цвет, который будет ниже градиента */
  overflow-x: hidden;
}

/* Анимация перехода с белого фона */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #5D6466;
  z-index: -1;
  animation: fadeOutWhite 1.5s ease-in-out forwards;
}

@keyframes fadeOutWhite {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* Навигация «висящая» сверху */
.nav-menu {
  position: fixed;
  top: 20px;
  left: 0;
  z-index: 1000;
  background: transparent;
  box-shadow: none;
  width: 100%;
  padding: 15px 0;
  pointer-events: auto;
  transition: opacity 0.4s ease, transform 0.4s ease;
  opacity: 1;
  transform: translateY(0);
}

.nav-menu.init-anim {
  opacity: 0;
  transform: translateY(-10px);
  /* Ускорьте начальную анимацию здесь */
  animation: fadeInNav 0.4s ease-out forwards;
  animation-delay: 0.2s;
}

body.scrolled .nav-menu {
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
  animation: none;
}

.nav-menu ul {
  list-style: none;
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 900px;
  margin: 0 auto;
}

.nav-menu li {
  font-size: 1.3em;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.3s ease, transform 0.3s ease;
  opacity: 0;
  transform: translateX(-20px);
  animation: slideInNavItem 0.5s ease-out forwards;
}

.nav-menu li:nth-child(1) { animation-delay: 2.2s; }
.nav-menu li:nth-child(2) { animation-delay: 2.35s; }
.nav-menu li:nth-child(3) { animation-delay: 2.5s; }
.nav-menu li:nth-child(4) { animation-delay: 2.65s; }
.nav-menu li:nth-child(5) { animation-delay: 2.8s; }
.nav-menu li:nth-child(6) { animation-delay: 2.95s; }

.nav-menu li a {
  color: #CDCBC6;
  text-decoration: none;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  display: inline-block;
  transition: color 0.2s ease, transform 0.2s ease;
}

.nav-menu li:hover a,
.nav-menu li a.active {
  color: #F1E9E1;
}

.nav-menu li:hover a {
  transform: translateY(3px);
}

.language-switcher {
  position: fixed;
  top: 26px;
  right: 24px;
  z-index: 1100;
  display: flex;
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  background: rgba(6, 20, 30, 0.72);
  backdrop-filter: blur(10px);
}

.language-switcher__option {
  border: 0;
  border-radius: 999px;
  padding: 7px 10px;
  color: #CDCBC6;
  background: transparent;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.language-switcher__option:hover,
.language-switcher__option.is-active {
  color: #06151E;
  background: #F1E9E1;
}

/* Плавное появление заголовка и подзаголовка */
.intro {
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* Боковая навигация справа */
.side-nav {
  position: fixed;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  z-index: 1000;
  background: rgba(6, 20, 30, 0.82);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

body.scrolled .side-nav {
  opacity: 1;
  pointer-events: auto;
}

.side-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.side-nav li {
  font-size: 1rem;
}

.side-nav a {
  color: #B8C1C7;
  text-decoration: none;
  transition: color 0.2s ease, font-weight 0.2s ease;
}

.side-nav a.active {
  color: #F1E9E1;
  font-weight: 700;
}

.side-nav a:hover {
  color: #FFFFFF;
}

/* Анимация появления меню */
@keyframes fadeInNav {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInNavItem {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Главный экран */
.main-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
}

.intro { text-align: center; }
.intro h1 { font-size: 3.5em; color: #F1E9E1; margin-bottom: 15px; }
.intro p { font-size: 1.5em; color: #CDCBC6; }

/* Разделитель */
.divider {
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, transparent 0%, #ccc 50%, transparent 100%);
  margin: 40px 0;
}

/* Секции */
section {
  max-width: 1200px;
  margin: 60px auto;
  padding: 40px 20px;
}

.about-section {
  max-width: 980px;
  margin: 80px auto;
  padding: 48px 36px;
}

section h2 {
  font-size: 2.5em;
  text-align: center;
  margin-bottom: 24px;
  color: #F1E9E1;
}

.about-section p {
  font-size: 1.05em;
  line-height: 1.8;
  margin-bottom: 20px;
  color: #D7D2CA;
}

.about-section h3 {
  margin: 28px 0 14px;
  color: #F1E9E1;
  font-size: 1.35em;
}

.about-section ul {
  list-style: none;
  display: grid;
  gap: 14px;
  padding: 0;
  margin-top: 10px;
}

.about-section li {
  padding: 8px 0 8px 12px;
  border-left: 3px solid #8DA0A8;
  line-height: 1.7;
  color: #E9E5DF;
}

.about-section strong {
  color: #F1E9E1;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1024px) {
  .skills-grid, .projects-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .nav-menu ul { flex-direction: column; gap: 10px; }
  .language-switcher { top: 12px; right: 12px; }
  .side-nav { display: none; }
  .skills-grid, .projects-grid { grid-template-columns: 1fr; }
  .intro h1 { font-size: 1.8em; }
}

html {
  background: #06151E;
}

body {
  position: relative;
  isolation: isolate;
  background:
    linear-gradient(120deg, rgba(141, 160, 168, 0.32) 0%, transparent 28%, rgba(6, 21, 30, 0.2) 56%, transparent 78%),
    linear-gradient(180deg, #5D6466 0%, #132A36 26%, #06151E 58%, #06151E 100%);
  background-attachment: fixed;
  background-size: 180% 180%, 100% 100%;
  animation: pageAtmosphere 24s ease-in-out infinite alternate;
}

body::before {
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(115deg, transparent 0 18%, rgba(241, 233, 225, 0.09) 23%, transparent 32% 100%),
    linear-gradient(245deg, transparent 0 54%, rgba(141, 160, 168, 0.13) 61%, transparent 72% 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 82px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 82px);
  background-size: 170% 170%, 190% 190%, 82px 82px, 82px 82px;
  opacity: 0.72;
  animation: backgroundDrift 32s ease-in-out infinite alternate;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, rgba(241, 233, 225, 0.018) 15px, transparent 16px 42px),
    linear-gradient(180deg, rgba(6, 21, 30, 0) 0%, rgba(6, 21, 30, 0.42) 48%, rgba(6, 21, 30, 0.9) 100%);
  opacity: 0.62;
  animation: textureFloat 18s linear infinite;
}

body > * {
  position: relative;
  z-index: 1;
}

.main-screen {
  position: relative;
  overflow: hidden;
}

.main-screen::before {
  content: "";
  position: absolute;
  inset: 10% -20% auto;
  height: 44%;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(100deg, transparent 0%, rgba(241, 233, 225, 0.11) 34%, rgba(141, 160, 168, 0.08) 50%, transparent 72%),
    linear-gradient(175deg, transparent 0%, rgba(205, 203, 198, 0.08) 46%, transparent 74%);
  transform: rotate(-8deg);
  filter: blur(2px);
  animation: heroLightSweep 16s ease-in-out infinite alternate;
}

.main-screen::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 10%;
  width: min(760px, 86vw);
  height: 1px;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(241, 233, 225, 0.55), transparent);
  box-shadow: 0 0 38px rgba(241, 233, 225, 0.22);
  transform: translateX(-50%);
  animation: horizonPulse 6s ease-in-out infinite;
}

.intro {
  position: relative;
  z-index: 1;
}

@keyframes pageAtmosphere {
  from { background-position: 0% 18%, center; }
  to { background-position: 100% 72%, center; }
}

@keyframes backgroundDrift {
  from { background-position: 0% 20%, 100% 50%, 0 0, 0 0; }
  to { background-position: 90% 72%, 12% 16%, 24px 18px, -18px 24px; }
}

@keyframes textureFloat {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-42px, 42px, 0); }
}

@keyframes heroLightSweep {
  from { transform: translateX(-5%) rotate(-8deg); opacity: 0.56; }
  to { transform: translateX(7%) rotate(-8deg); opacity: 0.88; }
}

@keyframes horizonPulse {
  0%, 100% { opacity: 0.36; transform: translateX(-50%) scaleX(0.82); }
  50% { opacity: 0.82; transform: translateX(-50%) scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
  body,
  body::before,
  body::after,
  .main-screen::before,
  .main-screen::after {
    animation: none;
  }
}

/* Enhanced portfolio atmosphere */
.nav-menu.init-anim {
  animation-delay: 0.05s;
}

.nav-menu li:nth-child(1) { animation-delay: 0.45s; }
.nav-menu li:nth-child(2) { animation-delay: 0.55s; }
.nav-menu li:nth-child(3) { animation-delay: 0.65s; }
.nav-menu li:nth-child(4) { animation-delay: 0.75s; }
.nav-menu li:nth-child(5) { animation-delay: 0.85s; }
.nav-menu li:nth-child(6) { animation-delay: 0.95s; }

body {
  background:
    linear-gradient(105deg, rgba(241, 233, 225, 0.16) 0%, transparent 18%, rgba(141, 160, 168, 0.18) 36%, transparent 58%),
    linear-gradient(215deg, transparent 0%, rgba(205, 203, 198, 0.12) 28%, transparent 44%, rgba(6, 21, 30, 0.42) 74%),
    linear-gradient(180deg, #5D6466 0%, #263D45 17%, #102633 42%, #06151E 72%, #06151E 100%);
  background-attachment: fixed;
  background-size: 220% 220%, 180% 180%, 100% 100%;
  animation: pageAtmosphere 18s ease-in-out infinite alternate;
}

body::before {
  background:
    linear-gradient(108deg, transparent 0 12%, rgba(241, 233, 225, 0.12) 18%, transparent 27% 100%),
    linear-gradient(246deg, transparent 0 45%, rgba(141, 160, 168, 0.16) 56%, transparent 68% 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 78px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.024) 0 1px, transparent 1px 78px);
  background-size: 210% 210%, 190% 190%, 78px 78px, 78px 78px;
  mix-blend-mode: screen;
  opacity: 0.68;
  animation: backgroundDrift 22s ease-in-out infinite alternate;
}

body::after {
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, rgba(241, 233, 225, 0.02) 15px, transparent 16px 42px),
    repeating-linear-gradient(25deg, transparent 0 90px, rgba(141, 160, 168, 0.035) 92px, transparent 96px 150px),
    linear-gradient(180deg, rgba(6, 21, 30, 0) 0%, rgba(6, 21, 30, 0.32) 48%, rgba(6, 21, 30, 0.92) 100%);
  opacity: 0.74;
  animation: textureFloat 14s linear infinite;
}

.ambient-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.ambient-scene__beam,
.ambient-scene__line,
.ambient-scene__mesh {
  position: absolute;
  display: block;
  pointer-events: none;
}

.ambient-scene__beam {
  width: 150vw;
  height: 32vh;
  left: -25vw;
  border-radius: 50%;
  filter: blur(34px);
  opacity: 0.34;
  mix-blend-mode: screen;
}

.ambient-scene__beam--one {
  top: 12vh;
  background: linear-gradient(90deg, transparent, rgba(241, 233, 225, 0.24), rgba(141, 160, 168, 0.14), transparent);
  transform: rotate(-12deg);
  animation: beamTravelOne 17s ease-in-out infinite alternate;
}

.ambient-scene__beam--two {
  top: 56vh;
  background: linear-gradient(90deg, transparent, rgba(93, 100, 102, 0.28), rgba(241, 233, 225, 0.12), transparent);
  transform: rotate(10deg);
  animation: beamTravelTwo 21s ease-in-out infinite alternate;
}

.ambient-scene__line {
  width: 62vw;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(241, 233, 225, 0.5), transparent);
  box-shadow: 0 0 28px rgba(241, 233, 225, 0.2);
  opacity: 0.42;
}

.ambient-scene__line--one {
  top: 29vh;
  right: -18vw;
  transform: rotate(-18deg);
  animation: lineGlideOne 12s ease-in-out infinite;
}

.ambient-scene__line--two {
  top: 76vh;
  left: -20vw;
  transform: rotate(14deg);
  animation: lineGlideTwo 15s ease-in-out infinite;
}

.ambient-scene__mesh {
  inset: -20%;
  background:
    linear-gradient(90deg, transparent 0 49.8%, rgba(241, 233, 225, 0.04) 50%, transparent 50.2% 100%),
    linear-gradient(0deg, transparent 0 49.8%, rgba(141, 160, 168, 0.035) 50%, transparent 50.2% 100%);
  background-size: 120px 120px;
  mask-image: radial-gradient(ellipse at 50% 22%, black 0%, transparent 66%);
  opacity: 0.44;
  transform: perspective(900px) rotateX(62deg) translateY(-18%);
  animation: meshBreath 18s ease-in-out infinite alternate;
}

.main-screen::before {
  height: 54%;
  background:
    linear-gradient(98deg, transparent 0%, rgba(241, 233, 225, 0.16) 32%, rgba(141, 160, 168, 0.11) 50%, transparent 74%),
    linear-gradient(172deg, transparent 0%, rgba(205, 203, 198, 0.1) 46%, transparent 76%);
  animation: heroLightSweep 10s ease-in-out infinite alternate;
}

.main-screen::after {
  width: min(940px, 88vw);
  box-shadow: 0 0 52px rgba(241, 233, 225, 0.28), 0 0 120px rgba(141, 160, 168, 0.12);
  animation: horizonPulse 4.8s ease-in-out infinite;
}

.intro h1 {
  text-shadow: 0 0 26px rgba(241, 233, 225, 0.16), 0 18px 48px rgba(0, 0, 0, 0.25);
}

.intro p {
  text-shadow: 0 0 20px rgba(205, 203, 198, 0.14);
}

.language-switcher__option {
  text-decoration: none;
}

@keyframes beamTravelOne {
  from { transform: translate3d(-7%, -4%, 0) rotate(-12deg); opacity: 0.18; }
  50% { opacity: 0.42; }
  to { transform: translate3d(9%, 7%, 0) rotate(-8deg); opacity: 0.3; }
}

@keyframes beamTravelTwo {
  from { transform: translate3d(8%, 5%, 0) rotate(10deg); opacity: 0.16; }
  50% { opacity: 0.38; }
  to { transform: translate3d(-10%, -4%, 0) rotate(14deg); opacity: 0.28; }
}

@keyframes lineGlideOne {
  0%, 100% { transform: translateX(0) rotate(-18deg); opacity: 0.16; }
  45% { transform: translateX(-24vw) rotate(-18deg); opacity: 0.52; }
  70% { opacity: 0.22; }
}

@keyframes lineGlideTwo {
  0%, 100% { transform: translateX(0) rotate(14deg); opacity: 0.14; }
  52% { transform: translateX(28vw) rotate(14deg); opacity: 0.48; }
  78% { opacity: 0.2; }
}

@keyframes meshBreath {
  from {
    background-position: 0 0;
    opacity: 0.24;
    transform: perspective(900px) rotateX(62deg) translateY(-18%) scale(1);
  }
  to {
    background-position: 44px 72px;
    opacity: 0.48;
    transform: perspective(900px) rotateX(62deg) translateY(-15%) scale(1.06);
  }
}

@media (max-width: 600px) {
  .nav-menu li:nth-child(1) { animation-delay: 0.28s; }
  .nav-menu li:nth-child(2) { animation-delay: 0.34s; }
  .nav-menu li:nth-child(3) { animation-delay: 0.40s; }
  .nav-menu li:nth-child(4) { animation-delay: 0.46s; }
  .nav-menu li:nth-child(5) { animation-delay: 0.52s; }
  .nav-menu li:nth-child(6) { animation-delay: 0.58s; }

  .ambient-scene__beam {
    width: 190vw;
    left: -45vw;
  }

  .ambient-scene__mesh {
    background-size: 86px 86px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ambient-scene__beam,
  .ambient-scene__line,
  .ambient-scene__mesh {
    animation: none;
  }
}
