/* ============================================================
   withersky — портфолио
   Единая стилистика с проектом Tabula (папка ref/):
   та же палитра (#1a1a24, индиго rgba(120,140,255,.95),
   карточки #23232e, радиусы 8–14px), те же фоновые слои,
   topbar, nav и карточки, что и на лендинге расширения.
   ============================================================ */

:root {
  --bg: #1a1a24;
  --bg-grad-end: #15151e;
  --bg-elev: #23232e;
  --bg-elev-2: #2a2a36;
  --bg-ghcard: #14141c;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #e8e8f0;
  --muted: rgba(232, 232, 240, 0.6);
  --text-faint: rgba(232, 232, 240, 0.4);
  --primary: rgba(120, 140, 255, 0.95);
  --primary-solid: rgba(120, 140, 255, 1);
  --primary-fg: #0f0f1a;
  --primary-soft: rgba(180, 190, 255, 0.95);
  --primary-soft-bg: rgba(120, 140, 255, 0.18);
  --primary-border: rgba(120, 140, 255, 0.32);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
  --topbar-h: 56px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: linear-gradient(180deg, #1a1a24 0%, #15151e 100%);
  background-attachment: fixed;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Верхнее индиго-свечение, как на лендинге Tabula */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(900px 420px at 50% -120px, rgba(120, 140, 255, 0.13), transparent 65%);
}

a {
  color: var(--primary-soft);
  text-decoration: none;
}

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

/* ---------- Фон: заблюренная картинка дня Bing + затемняющий слой ---------- */

.site-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: var(--bg);
  background-image: linear-gradient(180deg, #1a1a24 0%, #15151e 100%);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 800ms ease;
  filter: blur(22px) saturate(1.05);
  transform: scale(1.08);
}

.site-bg.loaded {
  opacity: 1;
}

.site-bg-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(20, 20, 30, 0.72) 0%, rgba(15, 15, 24, 0.86) 100%),
    radial-gradient(900px 420px at 50% -120px, rgba(120, 140, 255, 0.10), transparent 65%);
}

/* Контент поверх фоновых слоёв */
main,
.footer {
  position: relative;
  z-index: 1;
}

.container {
  width: min(1100px, 100% - 40px);
  margin-inline: auto;
}

/* ---------- Верхняя панель (как на лендинге Tabula) ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px var(--border-strong);
  object-fit: cover;
}

.nav {
  display: flex;
  gap: 6px;
}

.nav a {
  color: var(--muted);
  font-size: 13.5px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  transition: color 160ms ease, background 160ms ease;
}

.nav a:hover {
  color: var(--text);
  background: var(--primary-soft-bg);
}

.nav .nav-external {
  color: var(--primary-soft);
}

/* ---------- Кнопки (как на лендинге Tabula) ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  border: 1px solid transparent;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.btn-primary:hover {
  background: var(--primary-solid);
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-ghost:hover {
  background: var(--primary-soft-bg);
  border-color: var(--primary-border);
}

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

.hero {
  padding: 64px 0 56px;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: 48px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 18px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--primary-soft-bg);
  border: 1px solid var(--primary-border);
  color: var(--primary-soft);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.hero h1 {
  font-size: clamp(28px, 4.4vw, 44px);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.hero-subtitle {
  max-width: 480px;
  color: var(--muted);
  font-size: 15.5px;
  margin-bottom: 26px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 40px;
}

.hero-stats {
  display: flex;
  gap: 40px;
}

.stat-value {
  display: block;
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.stat-label {
  color: var(--text-faint);
  font-size: 13px;
}

/* ---------- Карточка графика вклада (в стиле .mock лендинга) ---------- */

.github-card {
  position: relative;
  display: block;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-ghcard);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  transition: border-color 200ms ease, transform 200ms ease;
  animation: githubCardIn 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.github-card:hover {
  border-color: rgba(120, 140, 255, 0.55);
  transform: translateY(-2px);
}

.github-card img {
  border-radius: var(--radius-sm);
}

.github-card-caption {
  display: block;
  margin-top: 12px;
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
}

@keyframes githubCardIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ---------- Секция проектов ---------- */

.projects {
  padding: 60px 0;
  border-top: 1px solid var(--border);
}

.section-head {
  text-align: center;
  margin-bottom: 30px;
}

.section-head h2 {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.section-sub {
  color: var(--muted);
  font-size: 15px;
}

/* Лист-бар в стиле Tabula */
.sheet-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  cursor: grab;
  user-select: none;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-border) transparent;
}

.sheet-bar.is-scrolling {
  cursor: grabbing;
  scroll-behavior: auto;
}

.sheet-bar::-webkit-scrollbar {
  height: 8px;
}

.sheet-bar::-webkit-scrollbar-track {
  background: transparent;
}

.sheet-bar::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.sheet-bar::-webkit-scrollbar-thumb:hover {
  background: var(--primary-border);
  background-clip: padding-box;
}

.sheet-tabs {
  display: flex;
  gap: 6px;
  padding-bottom: 0;
}

.sheet-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.sheet-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-color: var(--border-strong);
}

.sheet-tab[aria-selected="true"] {
  background: var(--primary-soft-bg);
  color: var(--primary-soft);
  border-color: var(--primary-border);
  box-shadow: 0 0 0 1px var(--primary-border);
}

.lang-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sheet-label {
  line-height: 1;
}

.sheet-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.sheet-tab[aria-selected="true"] .sheet-count {
  background: var(--primary);
  color: var(--primary-fg);
}

/* Сетка карточек */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.22);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
  animation: cardIn 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}

.project-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: var(--bg-elev-2);
}

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

.project-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.project-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  overflow-wrap: anywhere;
}

.project-name a {
  color: inherit;
}

.project-name a:hover {
  color: var(--primary-soft);
}

.lang-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.project-desc {
  flex: 1;
  color: var(--muted);
  font-size: 14.5px;
}

.project-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-faint);
  font-size: 12.5px;
}

.project-meta .stars {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.project-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.project-actions a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: background 160ms ease, border-color 160ms ease;
}

.action-repo {
  background: var(--primary-soft-bg);
  border: 1px solid var(--primary-border);
  color: var(--primary-soft);
}

.action-repo:hover {
  background: rgba(120, 140, 255, 0.28);
}

.action-site {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.action-site:hover {
  border-color: var(--border-strong);
}

/* ---------- Секция «Обо мне» ---------- */

.about {
  padding: 60px 0;
  border-top: 1px solid var(--border);
}

.about h2 {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
  margin-bottom: 30px;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.about-card {
  padding: 22px;
  border-radius: var(--radius);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  transition: border-color 160ms ease, transform 160ms ease;
}

.about-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.about-card h3 {
  font-size: 17px;
  margin-bottom: 10px;
  color: var(--primary-soft);
}

.about-card p {
  color: var(--muted);
  font-size: 14.5px;
}

/* ---------- Футер (как на лендинге Tabula) ---------- */

.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  color: var(--muted);
  font-size: 13px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.footer a {
  color: var(--text);
}

.footer a:hover {
  color: var(--primary-soft);
  text-decoration: underline;
}

/* ---------- Адаптивность ---------- */

@media (max-width: 960px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .github-card {
    max-width: 620px;
  }

  .project-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .about-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 0 14px;
  }

  .nav {
    gap: 2px;
  }

  .nav a {
    padding: 6px 8px;
    font-size: 12.5px;
  }

  .hero {
    padding: 48px 0 40px;
  }

  .hero-stats {
    gap: 24px;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .footer {
    flex-direction: column;
    text-align: center;
  }
}

/* ---------- Доступность ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
