/* ============================================================
   Стили портфолио.
   Главная настройка — акцентный цвет: поменяйте --primary
   (и оттенки рядом), остальное подстроится само.
   ============================================================ */

:root {
  --bg: #ffffff;
  --fg: #09090b;
  --card: #ffffff;
  --muted-fg: #71717a;
  --border: #e4e4e7;
  --border-soft: rgba(228, 228, 231, 0.6);
  --secondary: #f4f4f5;
  --footer-bg: #fafafa;
  --header-bg: rgba(255, 255, 255, 0.8);
  --dot: rgba(9, 9, 11, 0.07);

  --primary: #7c3aed;
  --primary-fg: #ffffff;
  --primary-border: rgba(124, 58, 237, 0.45);
  --primary-soft: rgba(124, 58, 237, 0.14);
  --primary-shadow: rgba(124, 58, 237, 0.35);

  --radius: 16px;
  --header-h: 64px;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.dark {
  --bg: #09090b;
  --fg: #fafafa;
  --card: #101013;
  --muted-fg: #a1a1aa;
  --border: #232329;
  --border-soft: rgba(35, 35, 41, 0.6);
  --secondary: #1b1b20;
  --footer-bg: #0c0c0f;
  --header-bg: rgba(9, 9, 11, 0.8);
  --dot: rgba(250, 250, 250, 0.07);

  --primary: #a78bfa;
  --primary-fg: #1c1033;
  --primary-border: rgba(167, 139, 250, 0.45);
  --primary-soft: rgba(167, 139, 250, 0.16);
  --primary-shadow: rgba(167, 139, 250, 0.25);
}

/* ---------- База ---------- */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

.mono {
  font-family: var(--font-mono);
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

h1,
h2,
h3 {
  letter-spacing: -0.02em;
  line-height: 1.15;
}

/* ---------- Шапка ---------- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #8b5cf6, #d946ef);
  color: #fff;
  box-shadow: 0 4px 12px -4px var(--primary-shadow);
}

.brand-logo svg {
  width: 16px;
  height: 16px;
}

.brand-name {
  font-size: 14px;
  font-weight: 600;
}

.brand-name .accent {
  color: var(--primary);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-nav > a {
  padding: 6px 10px;
  font-size: 14px;
  color: var(--muted-fg);
  border-radius: 8px;
  transition: color 0.2s;
}

.site-nav > a:hover {
  color: var(--fg);
}

.theme-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: 6px;
  border-radius: 999px;
  color: var(--muted-fg);
  transition: color 0.2s;
}

.theme-toggle:hover {
  color: var(--fg);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
}

.theme-toggle .icon-moon {
  display: none;
}

.dark .theme-toggle .icon-sun {
  display: none;
}

.dark .theme-toggle .icon-moon {
  display: block;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: calc(var(--header-h) + 5rem) 0 5rem;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 50% at 50% -10%, var(--primary-soft), transparent 70%),
    radial-gradient(circle at 1px 1px, var(--dot) 1px, transparent 0);
  background-size: auto, 28px 28px;
  -webkit-mask-image: radial-gradient(70% 60% at 50% 0%, black, transparent);
  mask-image: radial-gradient(70% 60% at 50% 0%, black, transparent);
}

.hero .container {
  max-width: 768px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.25rem;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--muted-fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
}

.dot-wrap {
  position: relative;
  width: 8px;
  height: 8px;
  flex-shrink: 0;
}

.dot {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--primary);
}

.dot-pulse {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--primary);
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  80%,
  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

.hero h1 {
  font-size: clamp(2.25rem, 6vw, 3.75rem);
  font-weight: 700;
}

.grad {
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.grad-1 {
  background-image: linear-gradient(90deg, #8b5cf6, #d946ef);
}

.grad-2 {
  background-image: linear-gradient(90deg, #d946ef, #fb923c);
}

.hero-lead {
  max-width: 42rem;
  margin-top: 1.5rem;
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--muted-fg);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 12px;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
  box-shadow: 0 12px 28px -12px var(--primary-shadow);
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-ghost {
  border: 1px solid var(--border);
  background: var(--card);
}

.btn-ghost:hover {
  background: var(--secondary);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.stat {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-icon {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
}

.stat-icon svg {
  width: 20px;
  height: 20px;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-label {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted-fg);
}

/* ---------- Секции ---------- */

.section {
  padding: 5rem 0;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 2rem;
}

.kicker {
  font-size: 14px;
  color: var(--primary);
}

.section h2 {
  margin-top: 4px;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
}

/* ---------- Фильтры ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 7px 16px;
  font-size: 14px;
  color: var(--muted-fg);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.chip:hover {
  border-color: var(--primary-border);
  color: var(--fg);
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-fg);
  box-shadow: 0 8px 20px -8px var(--primary-shadow);
}

/* ---------- Карточки проектов ---------- */

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
  animation: fadeUp 0.5s ease backwards;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--primary-border);
  box-shadow: 0 24px 48px -24px var(--primary-shadow);
}

.card-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--secondary);
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.card:hover .card-thumb img {
  transform: scale(1.05);
}

.card-cat {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
  background: var(--header-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.card-gh {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--header-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
}

.card:hover .card-gh,
.card-gh:focus-visible {
  opacity: 1;
}

.card-gh svg {
  width: 15px;
  height: 15px;
}

.card-body {
  flex: 1;
  padding: 20px;
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-title-row h3 {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.35;
}

.card-title-row svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 3px;
  color: var(--muted-fg);
  transition: transform 0.3s, color 0.3s;
}

.card:hover .card-title-row svg {
  transform: translate(2px, -2px);
  color: var(--primary);
}

.stretched::after {
  content: "";
  position: absolute;
  inset: 0;
}

.card-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted-fg);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

.card-tags span {
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--secondary);
}

/* ---------- Пустой результат фильтра ---------- */

.empty {
  padding: 5rem 1rem;
  text-align: center;
  color: var(--muted-fg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ---------- Контакты ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--footer-bg);
  scroll-margin-top: calc(var(--header-h) + 8px);
}

.site-footer h2 {
  margin-top: 4px;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
}

.footer-lead {
  max-width: 36rem;
  margin-top: 12px;
  color: var(--muted-fg);
}

.contacts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 2.5rem;
}

@media (min-width: 640px) {
  .contacts {
    grid-template-columns: repeat(3, 1fr);
  }
}

.contact {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.contact:hover {
  border-color: var(--primary-border);
  box-shadow: 0 20px 40px -24px var(--primary-shadow);
}

.contact-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  color: var(--primary);
  background: var(--secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: background 0.2s, color 0.2s;
}

.contact:hover .contact-icon {
  background: var(--primary);
  color: var(--primary-fg);
}

.contact-icon svg {
  width: 20px;
  height: 20px;
}

.contact-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
}

.contact-value {
  display: block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  color: var(--muted-fg);
}

.bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--muted-fg);
}

.bottom .mono {
  font-size: 12px;
}

@media (min-width: 640px) {
  .bottom {
    flex-direction: row;
  }
  .stat-icon {
    display: flex;
  }
}

/* ---------- Доступность: без анимаций, если запрещены ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
