/* Основные CSS-переменные для новой темной темы */
:root {
  --bg-color: #1a1a2e;
  --primary-color: #0f3460;
  --secondary-color: #533483;
  --accent-color: #e94560;
  --text-color: #e0e0e0;
  --card-bg-color: #16213e;
  --header-bg: rgba(22, 33, 62, 0.85);
  --font-main: 'Montserrat', sans-serif;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-main);
  overflow-x: hidden;
  transition: background 0.5s, color 0.5s;
}

/* Preloader */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.spinner {
  width: 60px;
  height: 60px;
  border: 5px solid var(--primary-color);
  border-top: 5px solid var(--accent-color);
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Фиксированное меню */
header {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  padding: 15px 0;
  transition: top 0.3s;
}
nav ul {
  list-style: none;
  display: flex;
  justify-content: center;
  margin: 0;
  padding: 0;
}
nav ul li {
  margin: 0 20px;
  position: relative;
}
nav ul li a {
  text-decoration: none;
  color: #fff;
  font-weight: bold;
  transition: color 0.3s;
}
nav ul li a:hover, nav ul li a.active {
  color: var(--accent-color);
}
nav ul li a::after {
  content: "";
  display: block;
  width: 0;
  height: 2px;
  background: var(--accent-color);
  transition: width 0.4s ease;
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
}
nav ul li a:hover::after, nav ul li a.active::after {
  width: 100%;
}

/* Hero Section */
#hero {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  background: linear-gradient(45deg, var(--primary-color), var(--bg-color), var(--secondary-color));
  background-size: 400% 400%;
  animation: gradientAnimation 15s ease infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}
@keyframes gradientAnimation {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
#particle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}
.hero-content {
  position: relative;
  text-align: center;
  z-index: 2;
  padding: 20px;
  animation: fadeIn 2s ease-in-out;
}
.hero-content h1 {
  font-size: 4em;
  font-weight: 700;
  margin-bottom: 10px;
  color: #fff;
}
.hero-content p {
  font-size: 1.5em;
  margin-bottom: 30px;
}
.hero-content a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: bold;
}

/* Общие стили для секций */
section {
  padding: 80px 20px;
  text-align: center;
}
section h2 {
  font-size: 2.8em;
  margin-bottom: 50px;
  position: relative;
  display: inline-block;
}
section h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--accent-color);
    margin: 10px auto 0;
}

/* Секция «Проекты» (бывшие фишки) */
#projects {
  background: var(--bg-color);
}
.features-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 30px;
}
.feature-card {
  background: var(--card-bg-color);
  width: 300px;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  opacity: 0;
  transform: translateY(50px);
  transition: transform 0.5s ease, box-shadow 0.5s ease;
}
.feature-card.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.feature-card:hover {
  transform: translateY(-15px) scale(1.05);
  box-shadow: 0 12px 30px rgba(233, 69, 96, 0.4);
}
.feature-card h3 {
  margin-top: 0;
  color: var(--accent-color);
  font-size: 1.5em;
}

/* Секция «Обо мне» (бывшие сервисы) */
#about {
  background: var(--primary-color);
}
.services-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 30px;
}
.service-card {
  background: var(--card-bg-color);
  width: 300px;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateX(-50px);
  transition: transform 0.5s ease, box-shadow 0.5s ease;
}
.service-card.visible {
  animation: fadeInLeft 0.8s ease-out forwards;
}
@keyframes fadeInLeft {
  to { opacity: 1; transform: translateX(0); }
}
.service-card:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 30px rgba(0,0,0,0.5);
}
.service-card h3 {
  margin-top: 0;
  font-size: 1.5em;
}

/* Секция «Галерея» */
#gallery {
  background: var(--bg-color);
}
.gallery-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.gallery-item {
  overflow: hidden;
  border-radius: 15px;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.8);
  transition: transform 0.4s ease, box-shadow 0.4s ease, opacity 0.4s ease;
}
.gallery-item.visible {
  animation: zoomIn 0.7s ease-out forwards;
}
@keyframes zoomIn {
  to { transform: scale(1); opacity: 1; }
}
.gallery-item img {
  width: 100%;
  display: block;
  transition: transform 0.4s ease;
}
.gallery-item:hover {
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}
.gallery-item:hover img {
  transform: scale(1.1);
}

/* Секция «Контакты» */
#contacts {
  background: var(--primary-color);
  padding: 60px 20px;
}
.contact-info {
    font-size: 1.5em;
    line-height: 1.8;
}

/* Кнопка возврата наверх */
#scrollToTop {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background-color: var(--accent-color);
  color: #fff;
  border: none;
  padding: 15px 20px;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.4s, transform 0.4s;
  z-index: 1500;
}
#scrollToTop.active {
  opacity: 1;
  transform: translateY(0);
}
#scrollToTop:hover {
    transform: scale(1.1) translateY(-5px);
}

/* Footer */
footer {
  text-align: center;
  padding: 30px;
  background: #000;
  color: #aaa;
}

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