/* ===== ПЕРЕМЕННЫЕ И БАЗА ===== */
:root {
  --bg: #0a0a0d;
  --bg-2: #111114;
  --card: #16161b;
  --border: #26262e;
  --text: #ffffff;
  --text-dim: #a8a8b3;
  --text-muted: #6b6b78;
  --accent: #9966ff;
  --accent-2: #b794ff;
  --accent-soft: rgba(153, 102, 255, 0.15);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

/* ===== ВЕРХНЕЕ МЕНЮ ===== */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 60px;
  background: rgba(10, 10, 13, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.logo-text {
  font-family: 'Dancing Script', cursive;
  font-size: 32px;
  color: var(--accent-2);
  cursor: pointer; user-select: none;
  transition: transform .2s ease;
}
.logo-text:hover { transform: scale(1.04); }
.nav-links { display: flex; gap: 36px; list-style: none; }
.nav-links a {
  color: var(--text); text-decoration: none;
  font-weight: 500; font-size: 15px; cursor: pointer;
  transition: color .2s ease;
}
.nav-links a:hover { color: var(--accent-2); }
.nav-links a.active { color: var(--accent); }

/* ===== СТРАНИЦЫ ===== */
.page { display: none; padding-top: 90px; min-height: 100vh; position: relative; }
.page.active { display: block; }

/* ===== HOME ===== */
#home {
  display: none;
  align-items: center; justify-content: center; text-align: center;
  min-height: 100vh; padding: 90px 24px 60px; position: relative;
}
#home.active { display: flex; flex-direction: column; }
.badge {
  display: inline-block; padding: 10px 22px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  font-size: 14px; font-weight: 500;
  margin-bottom: 36px;
}
.hero-title {
  font-size: clamp(48px, 7vw, 88px);
  font-weight: 800; line-height: 1.05;
  margin-bottom: 18px; letter-spacing: -0.02em;
}
.hero-title .accent { color: var(--accent); }
.hero-sub {
  font-size: clamp(24px, 3vw, 38px);
  font-weight: 700; margin-bottom: 28px;
}
.hero-desc {
  max-width: 620px; font-size: 17px; line-height: 1.6;
  color: var(--text-dim); margin: 0 auto 44px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 16px 44px; border-radius: 999px;
  font-size: 16px; font-weight: 600; cursor: pointer;
  border: none; text-decoration: none; font-family: inherit;
  transition: transform .15s ease, box-shadow .25s ease, background .2s ease;
}
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 8px 30px rgba(153, 102, 255, 0.35);
}
.btn-primary:hover {
  background: var(--accent-2); transform: translateY(-2px);
  box-shadow: 0 12px 38px rgba(153, 102, 255, 0.5);
}
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--accent);
}
.btn-outline:hover {
  background: var(--accent-soft);
  transform: translateY(-2px);
}

/* пара кнопок на главной */
.hero-buttons {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

/* искорки на главной */
.sparkle {
  position: absolute; color: var(--accent);
  opacity: 0.4; pointer-events: none;
  animation: float 6s ease-in-out infinite;
}
.sparkle:nth-child(1){ top: 18%; left: 10%; font-size: 24px; }
.sparkle:nth-child(2){ top: 30%; right: 12%; font-size: 18px; animation-delay: 1s; }
.sparkle:nth-child(3){ bottom: 25%; left: 14%; font-size: 22px; animation-delay: 2s; }
.sparkle:nth-child(4){ bottom: 18%; right: 16%; font-size: 28px; animation-delay: 3s; }
@keyframes float {
  0%,100% { transform: translateY(0) rotate(0deg); }
  50%     { transform: translateY(-14px) rotate(8deg); }
}

/* ===== ЗВЁЗДОЧКИ НА ФОНЕ PROJECTS / RESOURCES =====
   position: fixed — звёздочки привязаны к окну браузера,
   а не к высоте страницы. Поэтому они видны всегда,
   и не «прыгают» когда поиск фильтрует карточки. */
.stars-bg {
  position: fixed; inset: 0;
  overflow: hidden; pointer-events: none; z-index: 0;
}
.stars-bg .star {
  position: absolute; color: var(--accent);
  opacity: 0; user-select: none;
  animation: starFloat linear infinite;
}
@keyframes starFloat {
  0%   { transform: translateY(0)      rotate(0deg)   scale(1);   opacity: 0; }
  10%  { opacity: var(--star-opacity, 0.5); }
  90%  { opacity: var(--star-opacity, 0.5); }
  100% { transform: translateY(-120vh) rotate(360deg) scale(1.1); opacity: 0; }
}
#projects .container,
#resources .container { position: relative; z-index: 1; }

/* контент Home должен быть над звёздочками */
#home .badge,
#home .hero-title,
#home .hero-sub,
#home .hero-desc,
#home .hero-buttons { position: relative; z-index: 1; }

/* ===== ОБЁРТКА И ЗАГОЛОВКИ ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 40px; }
.section-head { text-align: center; margin: 50px 0; }
.section-head h1 {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 800; margin-bottom: 16px; letter-spacing: -0.02em;
}
.section-head p {
  color: var(--text-dim); font-size: 17px;
  max-width: 620px; margin: 0 auto; line-height: 1.6;
}
.version-badge {
  display: inline-block;
  background: var(--accent-soft); color: var(--accent-2);
  padding: 4px 14px; border-radius: 999px;
  font-size: 14px; font-weight: 600;
  margin-left: 10px; vertical-align: middle;
}
h2.block-title { font-size: 32px; font-weight: 800; margin: 60px 0 26px; }

/* ===== КАРТОЧКИ ПРОЕКТОВ ===== */
.projects-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 24px; margin-bottom: 80px;
}
@media (max-width: 980px) { .projects-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .projects-grid { grid-template-columns: 1fr; } }

.project-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px; overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.project-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: 0 16px 40px rgba(153, 102, 255, 0.18);
}
.project-image {
  width: 100%; height: 180px; position: relative; overflow: hidden;
  background: linear-gradient(180deg, #2a1f4a 0%, #3d2670 50%, #1a0f2e 100%);
}
.project-image::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(183, 148, 255, 0.4) 0%, transparent 8%),
    radial-gradient(circle at 75% 25%, rgba(255,255,255,0.5) 0%, transparent 2%),
    radial-gradient(circle at 60% 60%, rgba(183, 148, 255, 0.3) 0%, transparent 12%),
    radial-gradient(circle at 30% 70%, rgba(153, 102, 255, 0.5) 0%, transparent 10%);
}
.project-image svg { position: absolute; bottom: 0; width: 100%; height: 70%; }
.project-image .card-cover {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
  transition: transform .3s ease;
}
.project-image:hover .card-cover { transform: scale(1.05); }
.project-body { padding: 20px 22px 22px; flex: 1; display: flex; flex-direction: column; }
.project-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.project-desc { color: var(--text-dim); font-size: 14px; line-height: 1.55; margin-bottom: 8px; flex: 1; }

/* свёрнутое длинное описание — обрезано до 3 строк */
.project-desc.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.project-desc.clamp.expanded {
  -webkit-line-clamp: unset;
  display: block;
}

/* кнопка-стрелочка раскрытия описания */
.desc-toggle {
  align-self: flex-start;
  background: transparent;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 2px 6px;
  margin: 0 0 12px -6px;
  font-size: 16px;
  line-height: 1;
  font-family: inherit;
  transition: color .2s ease, transform .25s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.desc-toggle:hover { color: var(--accent-2); }
.desc-toggle .chev {
  display: inline-block;
  transition: transform .25s ease;
}
.desc-toggle.expanded .chev { transform: rotate(180deg); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tag {
  padding: 4px 12px; border: 1px solid var(--border);
  border-radius: 999px; font-size: 12px;
  color: var(--text-dim); background: var(--bg-2);
}
/* красный тег-предупреждение */
.tag.tag-danger {
  color: #ff8a8a;
  background: rgba(220, 70, 70, 0.12);
  border-color: rgba(220, 70, 70, 0.45);
}
.btn-card {
  display: inline-block;
  background: var(--accent); color: #fff;
  padding: 9px 20px; border-radius: 999px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
  text-decoration: none;
  transition: background .2s ease;
}
.btn-card:hover { background: var(--accent-2); text-decoration: none; }
.btn-card:visited, .btn-card:active, .btn-card:focus { text-decoration: none; color: #fff; }

/* вторая кнопка на карточке — с обводкой, без заливки */
.btn-card-outline {
  display: inline-block;
  background: transparent; color: var(--accent-2);
  padding: 9px 20px; border-radius: 999px;
  border: 1.5px solid var(--accent);
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
  text-decoration: none;
  transition: background .2s ease, color .2s ease;
}
.btn-card-outline:hover {
  background: var(--accent-soft);
  color: var(--accent-2);
  text-decoration: none;
}
.btn-card-outline:visited,
.btn-card-outline:active,
.btn-card-outline:focus { text-decoration: none; color: var(--accent-2); }

/* ряд кнопок под карточкой */
.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== СЧЁТЧИК РЕСУРС-ПАКОВ В УГЛУ ===== */
.resources-counter {
  position: absolute;
  top: 110px;
  right: 40px;
  z-index: 2;
  padding: 8px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent-2);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
@media (max-width: 640px) {
  .resources-counter { top: 100px; right: 16px; font-size: 12px; padding: 6px 12px; }
}

/* ===== ПОИСК НА RESOURCE PACKS ===== */
.search-wrap {
  display: flex;
  justify-content: center;
  margin: 0 auto 40px;
  max-width: 560px;
  position: relative;
}
.search-input {
  width: 100%;
  padding: 14px 22px 14px 50px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s ease, background .2s ease;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8a8b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
  background-repeat: no-repeat;
  background-position: 18px center;
  background-size: 18px 18px;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  border-color: var(--accent);
  background-color: var(--bg-2);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.empty-msg {
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
  margin: 20px 0 80px;
}

/* упрощённая карточка (без тегов и описания) */
.simple-grid .project-body { padding: 18px 22px 22px; }
.simple-grid .project-title { margin-bottom: 16px; }

/* ===== ABOUT ===== */
.about-grid {
  display: grid; grid-template-columns: 1.2fr 1fr;
  gap: 60px; align-items: center;
  margin-top: 30px; margin-bottom: 70px;
}
@media (max-width: 880px) { .about-grid { grid-template-columns: 1fr; gap: 40px; } }
.about-text h1 { font-size: clamp(36px, 5vw, 56px); font-weight: 800; margin-bottom: 26px; }
.about-text p { color: var(--text-dim); font-size: 16px; line-height: 1.75; margin-bottom: 18px; }
.about-logo { display: flex; justify-content: center; align-items: center; }
.about-logo svg { width: 300px; height: 300px; }

/* ===== КОНТАКТЫ ===== */
.contacts-block {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; padding: 40px;
  margin-bottom: 60px; text-align: center;
}
.contacts-block h2 { font-size: 32px; font-weight: 800; margin-bottom: 12px; }
.contacts-block p { color: var(--text-dim); margin-bottom: 26px; }
.contact-links { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.contact-link {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 22px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text); text-decoration: none;
  font-size: 14px; font-weight: 500;
  transition: all .2s ease;
}
.contact-link:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-2);
}

/* ===== LIGHTBOX (просмотр картинки) ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 13, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: zoom-out;
  padding: 40px;
}
.lightbox.open {
  display: flex;
  animation: lbFade .25s ease;
}
@keyframes lbFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 20px;
  border: 1px solid rgba(153, 102, 255, 0.5);
  box-shadow: 0 20px 80px rgba(153, 102, 255, 0.35), 0 0 0 1px rgba(255,255,255,0.04);
  animation: lbZoom .3s ease;
  cursor: zoom-out;
}
@keyframes lbZoom {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
.lightbox-close {
  position: absolute;
  top: 24px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: all .2s ease;
}
.lightbox-close:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-2);
  transform: scale(1.05);
}

/* ===== ПОДВАЛ ===== */
footer {
  text-align: center; padding: 30px 20px;
  border-top: 1px solid var(--border);
  color: var(--text-muted); font-size: 14px;
}

/* ===== АДАПТИВ ===== */
@media (max-width: 720px) {
  .nav { padding: 16px 24px; }
  .nav-links { gap: 18px; }
  .nav-links a { font-size: 14px; }
  .logo-text { font-size: 26px; }
  .container { padding: 0 20px; }
}
