/* ═══ DPC POLISH — UI/UX оптимизации 2026-05-23 ═══ */

/* 1) Stagger-анимация карточек: появляются волной */
@keyframes dpc-card-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: no-preference) {
  #full-catalog-grid > *,
  #home-grid > *,
  #dota-grid > *,
  #cs2-grid > *,
  #wot-grid > * {
    animation: dpc-card-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  }
  #full-catalog-grid > *:nth-child(1) { animation-delay: 0.02s; }
  #full-catalog-grid > *:nth-child(2) { animation-delay: 0.06s; }
  #full-catalog-grid > *:nth-child(3) { animation-delay: 0.10s; }
  #full-catalog-grid > *:nth-child(4) { animation-delay: 0.14s; }
  #full-catalog-grid > *:nth-child(5) { animation-delay: 0.18s; }
  #full-catalog-grid > *:nth-child(6) { animation-delay: 0.22s; }
  #full-catalog-grid > *:nth-child(7) { animation-delay: 0.26s; }
  #full-catalog-grid > *:nth-child(8) { animation-delay: 0.30s; }
  #full-catalog-grid > *:nth-child(n+9) { animation-delay: 0.34s; }
  #home-grid > *:nth-child(1) { animation-delay: 0.05s; }
  #home-grid > *:nth-child(2) { animation-delay: 0.10s; }
  #home-grid > *:nth-child(3) { animation-delay: 0.15s; }
  #home-grid > *:nth-child(4) { animation-delay: 0.20s; }
  #home-grid > *:nth-child(5) { animation-delay: 0.25s; }
  #home-grid > *:nth-child(6) { animation-delay: 0.30s; }
  #home-grid > *:nth-child(7) { animation-delay: 0.35s; }
  #home-grid > *:nth-child(8) { animation-delay: 0.40s; }
}

/* 2) 3D-tilt на hover карточек ПК (lite, на CSS) */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  a[href^="/pc/"] {
    transform-style: preserve-3d;
    will-change: transform;
  }
  a[href^="/pc/"]:hover {
    transform: translateY(-6px) perspective(900px) rotateX(2deg) !important;
    box-shadow: 0 20px 60px -20px rgba(34, 211, 238, 0.25), 0 4px 16px rgba(0,0,0,0.4);
  }
}

/* 3) Sticky header — сжатие при скролле (тоньше + более blur) */
header.dpc-scrolled {
  background: rgba(12, 14, 20, 0.92) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  box-shadow: 0 1px 0 rgba(34, 211, 238, 0.15), 0 8px 32px rgba(0,0,0,0.4);
}
header { transition: background 0.3s, backdrop-filter 0.3s, box-shadow 0.3s; }

/* 4) Glow на активном пункте меню */
.nav-link.active {
  text-shadow: 0 0 12px rgba(34, 211, 238, 0.7), 0 0 24px rgba(34, 211, 238, 0.4);
}
.nav-link.active::after {
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.8), 0 0 16px rgba(34, 211, 238, 0.5);
}

/* 5) Кнопка «наверх» */
#dpc-scroll-top {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(34, 211, 238, 0.15);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(34, 211, 238, 0.35);
  color: #22d3ee;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s, background 0.2s;
  z-index: 55;
}
#dpc-scroll-top.show {
  opacity: 1;
  pointer-events: auto;
}
#dpc-scroll-top:hover {
  background: #22d3ee;
  color: #0c0e14;
  transform: translateY(-2px);
}
@media (min-width: 1024px) {
  #dpc-scroll-top { bottom: 24px; }
}

/* 6) Smooth scroll */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* 7) Brand scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.3), rgba(34, 211, 238, 0.5));
  border-radius: 10px;
  border: 2px solid #0c0e14;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.5), rgba(34, 211, 238, 0.7));
}

/* 9) Page progress bar — тонкая cyan-полоска прогресса вверху */
#dpc-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, #22d3ee, #0ea5e9, #c084fc);
  width: 0%;
  z-index: 100;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.6);
}

/* 8) Magnetic CTA — подсветка вокруг главной кнопки CTA */
.dpc-magnetic {
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
}

/* Микро-улучшения: focus-visible для аксессибилити */
a:focus-visible, button:focus-visible {
  outline: 2px solid #22d3ee;
  outline-offset: 3px;
  border-radius: 6px;
}

/* ═══ FADE-UP ON SCROLL (как Apple / Stripe / Linear) ═══ */
@media (prefers-reduced-motion: no-preference) {
  .dpc-reveal-up {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.75s cubic-bezier(0.22, 1, 0.36, 1), transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform;
  }
  .dpc-reveal-up.is-visible {
    opacity: 1;
    transform: translateY(0);
  }
  /* Stagger-задержки для соседних .dpc-reveal-up в одном контейнере */
  .dpc-stagger > .dpc-reveal-up:nth-child(1).is-visible { transition-delay: 0s; }
  .dpc-stagger > .dpc-reveal-up:nth-child(2).is-visible { transition-delay: 0.08s; }
  .dpc-stagger > .dpc-reveal-up:nth-child(3).is-visible { transition-delay: 0.16s; }
  .dpc-stagger > .dpc-reveal-up:nth-child(4).is-visible { transition-delay: 0.24s; }
  .dpc-stagger > .dpc-reveal-up:nth-child(5).is-visible { transition-delay: 0.32s; }
  .dpc-stagger > .dpc-reveal-up:nth-child(n+6).is-visible { transition-delay: 0.40s; }
}

/* === Fallback для статичной карты (если она тоже не доступна) === */
.dpc-map-fallback {
  background: linear-gradient(135deg, #0c0e14 0%, #1a1f2e 50%, #0c0e14 100%);
}
.dpc-map-fallback::before {
  content: Мастерская DPC · Торфяная дорога, 2к1;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #94a3b8;
  font-size: 14px;
  text-align: center;
}

/* ═══ Неоновая обводка карточек команды при hover — цвет совпадает с бейджем ═══ */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  body[data-page="team"] main .reveal,
  body[data-page="team"] main [class*="rounded-[28px]"] {
    transition: box-shadow 0.45s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.35s, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1) !important;
  }
  /* По умолчанию — cyan */
  body[data-page="team"] main .reveal:hover {
    transform: translateY(-6px) !important;
  }
  /* Purple — Дмитрий (Руководитель) */
  body[data-page="team"] main .reveal:has(.text-purple-400):hover {
    border-color: rgba(192,132,252,0.7) !important;
    box-shadow: 0 0 0 2px rgba(192,132,252,0.55), 0 0 24px rgba(192,132,252,0.5), 0 0 56px rgba(192,132,252,0.28), 0 0 96px rgba(192,132,252,0.12), 0 16px 48px rgba(0,0,0,0.55) !important;
  }
  /* Cyan/brand — Денис, Макс */
  body[data-page="team"] main .reveal:has(.text-brand-400):hover {
    border-color: rgba(34,211,238,0.7) !important;
    box-shadow: 0 0 0 2px rgba(34,211,238,0.55), 0 0 24px rgba(34,211,238,0.5), 0 0 56px rgba(34,211,238,0.28), 0 0 96px rgba(34,211,238,0.12), 0 16px 48px rgba(0,0,0,0.55) !important;
  }
  /* Blue — Вадим */
  body[data-page="team"] main .reveal:has(.text-blue-400):hover {
    border-color: rgba(96,165,250,0.7) !important;
    box-shadow: 0 0 0 2px rgba(96,165,250,0.55), 0 0 24px rgba(96,165,250,0.5), 0 0 56px rgba(96,165,250,0.28), 0 0 96px rgba(96,165,250,0.12), 0 16px 48px rgba(0,0,0,0.55) !important;
  }
  /* Green — Максим (Сборщик) */
  body[data-page="team"] main .reveal:has(.text-green-400):hover {
    border-color: rgba(74,222,128,0.7) !important;
    box-shadow: 0 0 0 2px rgba(74,222,128,0.55), 0 0 24px rgba(74,222,128,0.5), 0 0 56px rgba(74,222,128,0.28), 0 0 96px rgba(74,222,128,0.12), 0 16px 48px rgba(0,0,0,0.55) !important;
  }
  /* Yellow — Максим (ИТ-специалист) */
  body[data-page="team"] main .reveal:has(.text-yellow-400):hover {
    border-color: rgba(250,204,21,0.7) !important;
    box-shadow: 0 0 0 2px rgba(250,204,21,0.55), 0 0 24px rgba(250,204,21,0.5), 0 0 56px rgba(250,204,21,0.28), 0 0 96px rgba(250,204,21,0.12), 0 16px 48px rgba(0,0,0,0.55) !important;
  }
}

/* === UX-фикс: уменьшить вертикальный gap у заголовка каталога === */
body[data-page="catalog"] main > div > .text-center.mb-20 { margin-bottom: 2.5rem !important; }
body[data-page="catalog"] main > div > .text-center h1 { font-size: 3rem !important; line-height: 1.1; margin-bottom: 0.5rem !important; }
@media (min-width: 1024px) {
  body[data-page="catalog"] main > div > .text-center h1 { font-size: 4rem !important; }
}

/* === UX-фикс: подсветка primary CTA === */
.bg-brand-400.text-ink-950 {
  box-shadow: 0 4px 18px rgba(34, 211, 238, 0.2);
}
.bg-brand-400.text-ink-950:hover {
  box-shadow: 0 8px 32px rgba(34, 211, 238, 0.45);
}

/* === UX-фикс: миниатюры в lightbox === */
#lightbox-thumbs {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  max-width: 90vw;
  overflow-x: auto;
  padding: 6px;
  background: rgba(0,0,0,0.5);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  z-index: 60;
}
#lightbox-thumbs img {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.2s, transform 0.2s, outline 0.2s;
  outline: 2px solid transparent;
}
#lightbox-thumbs img:hover {
  opacity: 1;
  transform: scale(1.05);
}
#lightbox-thumbs img.active {
  opacity: 1;
  outline-color: #22d3ee;
}
#lightbox-thumbs.hidden { display: none; }
