/* ============================================================
   styles.css — design system + layout
   Dark theme by default, light theme via [data-theme="light"].
   ============================================================ */

/* ---------- 1. Design tokens ---------- */

:root {
  /* palette — dark (default) */
  --bg: #0a0e14;
  --bg-elevated: #0e141d;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e6edf6;
  --text-muted: #94a3b8;
  --text-faint: #64748b;

  --indigo: #6366f1;
  --indigo-bright: #818cf8;
  --teal: #2dd4bf;
  --teal-bright: #5eead4;
  --accent-grad: linear-gradient(120deg, var(--indigo-bright), var(--teal));

  --glow-indigo: rgba(99, 102, 241, 0.25);
  --glow-teal: rgba(45, 212, 191, 0.18);

  --danger: #f87171;
  --success: #34d399;

  /* type */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --fs-hero: clamp(1.7rem, 0.7rem + 5vw, 4.5rem);
  --fs-h2: clamp(1.9rem, 1.2rem + 2.4vw, 3rem);
  --fs-h3: clamp(1.2rem, 1rem + 0.8vw, 1.5rem);
  --fs-body: 1rem;
  --fs-small: 0.875rem;
  --fs-tiny: 0.75rem;

  /* spacing / radii */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;
  --space-6: 4rem;
  --space-7: 6.5rem;
  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 22px;
  --radius-pill: 999px;

  --container: 1120px;
  --header-h: 68px;
  --hint-band: 104px;

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 18px 44px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--border-strong), 0 0 42px var(--glow-indigo);
  --shadow-modal: 0 32px 80px rgba(0, 0, 0, 0.6);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: dark;
}

[data-theme='light'] {
  --bg: #f6f8fb;
  --bg-elevated: #ffffff;
  --surface: rgba(15, 23, 42, 0.03);
  --surface-hover: rgba(15, 23, 42, 0.06);
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.18);
  --text: #0f172a;
  --text-muted: #47566b;
  --text-faint: #64748b;

  --indigo-bright: #4f46e5;
  --teal: #0d9488;
  --teal-bright: #0f766e;
  --accent-grad: linear-gradient(120deg, #4f46e5, #0d9488);

  --glow-indigo: rgba(79, 70, 229, 0.14);
  --glow-teal: rgba(13, 148, 136, 0.12);

  --shadow-card: 0 4px 20px rgba(15, 23, 42, 0.07);
  --shadow-lift: 0 16px 40px rgba(15, 23, 42, 0.13), 0 0 0 1px var(--border-strong);
  --shadow-modal: 0 32px 80px rgba(15, 23, 42, 0.25);

  color-scheme: light;
}

/* ---------- 2. Reset & base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.35s ease, color 0.35s ease;
  overflow-x: hidden;
}

body.no-scroll {
  overflow: hidden;
}

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

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

a:hover {
  color: var(--teal-bright);
}

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

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

::selection {
  background: var(--indigo);
  color: #fff;
}

/* skip link */
.skip-link {
  position: absolute;
  top: -48px;
  left: 16px;
  z-index: 200;
  padding: 10px 18px;
  background: var(--indigo);
  color: #fff;
  border-radius: var(--radius-s);
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 12px;
  color: #fff;
}

/* ---------- 3. Layout helpers ---------- */

.container {
  width: min(var(--container), 100% - 2.5rem);
  margin-inline: auto;
}

.section {
  padding-block: var(--space-7);
  position: relative;
}

.section-head {
  max-width: 640px;
  margin-bottom: var(--space-5);
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: var(--space-2);
}

.section-label::before {
  content: '';
  width: 22px;
  height: 1px;
  background: var(--teal);
  opacity: 0.7;
}

.section-title {
  font-size: var(--fs-h2);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.12;
}

.section-subtitle {
  margin-top: var(--space-3);
  color: var(--text-muted);
  font-size: 1.06rem;
}

/* ---------- 4. Background decor ---------- */

.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

/* Nebula ambience — two large radial gradients + SVG noise overlay */
.nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.55;
  will-change: transform;
  pointer-events: none;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.nebula-warm {
  width: 720px;
  height: 720px;
  top: -240px;
  right: -180px;
  background: radial-gradient(circle, rgba(244, 114, 182, 0.45), rgba(139, 92, 246, 0.18) 40%, transparent 70%);
  animation: nebula-drift-warm 32s ease-in-out infinite alternate;
}

.nebula-cool {
  width: 640px;
  height: 640px;
  bottom: -200px;
  left: -200px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.38), rgba(45, 212, 191, 0.18) 45%, transparent 70%);
  animation: nebula-drift-cool 40s ease-in-out infinite alternate;
  animation-delay: -12s;
}

@keyframes nebula-drift-warm {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(-90px, 70px, 0) scale(1.12); }
  100% { transform: translate3d(60px, -80px, 0) scale(0.92); }
}

@keyframes nebula-drift-cool {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(80px, -60px, 0) scale(1.15); }
  100% { transform: translate3d(-50px, 50px, 0) scale(0.94); }
}

.nebula-noise {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.5;
  mix-blend-mode: overlay;
  pointer-events: none;
}

@media (max-width: 640px) {
  .nebula { animation: none; opacity: 0.4; filter: blur(70px); }
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 10%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 10%, transparent 70%);
  opacity: 0.5;
}

/* scroll progress bar */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 120;
  width: 100%;
  height: 2px;
  background: var(--accent-grad);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* при открытом мобильном меню полоса прогресса не должна лежать поверх оверлея */
body.no-scroll .scroll-progress { opacity: 0; }

/* ---------- 5. Header ---------- */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}

/* ВАЖНО: размытый фон шапки живёт на псевдоэлементе, а не на самой .header.
   backdrop-filter (как filter и transform) делает элемент containing block
   для position:fixed потомков. Если поставить его на .header, то после скролла
   мобильное меню (.nav, position:fixed inset:0) начнёт позиционироваться
   относительно шапки и схлопнется в её 68px вместо всего экрана. */
.header::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.header.scrolled::before { opacity: 1; }

.header.scrolled {
  border-bottom-color: var(--border);
}

.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.logo {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  white-space: nowrap;
}

.logo:hover { color: var(--text); }

.logo .logo-accent {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav {
  margin-left: auto;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  padding: 0;
}

.nav-link {
  display: block;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: var(--fs-small);
  font-weight: 500;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.nav-link.active {
  color: var(--text);
  background: var(--surface-hover);
  box-shadow: inset 0 0 0 1px var(--border);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface);
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, transform 0.2s var(--ease);
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.lang-btn {
  width: auto;
  padding-inline: 12px;
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  font-weight: 600;
  letter-spacing: 0.08em;
}

/* theme icons: show one at a time */
.icon-btn .icon-sun { display: none; }
.icon-btn .icon-moon { display: block; }
[data-theme='light'] .icon-btn .icon-sun { display: block; }
[data-theme='light'] .icon-btn .icon-moon { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: var(--fs-small);
  line-height: 1.4;
  transition: transform 0.2s var(--ease), box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  position: relative;
  overflow: hidden;
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 6px 22px var(--glow-indigo);
}

/* ShinyText-style sweep */
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -70%;
  width: 45%;
  height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  transition: left 0.55s ease;
  pointer-events: none;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px var(--glow-indigo);
  color: #fff;
}

.btn-primary:hover::after { left: 130%; }

.btn-ghost {
  border: 1px solid var(--border-strong);
  color: var(--text);
  background: var(--surface);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  border-color: var(--text-faint);
  transform: translateY(-2px);
  color: var(--text);
}

.btn-lg {
  padding: 13px 28px;
  font-size: var(--fs-body);
}

/* burger */
.burger {
  display: none;
  position: relative;
  z-index: 120;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface);
}

.burger span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.2s ease;
}

.burger[aria-expanded='true'] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger[aria-expanded='true'] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded='true'] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- 6. Hero ---------- */

/* hero + scroll-hint together fill exactly one viewport */
.hero {
  min-height: calc(100svh - var(--hint-band));
  display: flex;
  align-items: center;
  padding-block: calc(var(--header-h) + var(--space-6)) var(--space-5);
  position: relative;
}

.hero-inner {
  max-width: 780px;
}

.hero-hello {
  font-family: var(--font-mono);
  color: var(--teal);
  font-size: var(--fs-small);
  margin-bottom: var(--space-3);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.hero-hello::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.15);
}

.hero-title {
  font-size: var(--fs-hero);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  text-wrap: balance;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: none;
}

.hero-title .grad {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* SplitText — per-char blur-in entrance for the hero name */
.split-text .ch {
  display: inline-block;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0;
  filter: blur(10px);
  animation: ch-in 0.75s var(--ease) forwards;
  animation-delay: var(--ch-delay, 0ms);
}

@keyframes ch-in {
  to { opacity: 1; filter: blur(0); }
}

.hero-nick {
  font-family: var(--font-mono);
  font-size: clamp(0.9rem, 0.8rem + 0.5vw, 1.1rem);
  font-weight: 400;
  color: var(--text-faint);
  margin-left: 6px;
  letter-spacing: 0;
}

.hero-typing {
  margin-top: var(--space-3);
  font-family: var(--font-mono);
  font-size: clamp(1.05rem, 0.9rem + 1vw, 1.5rem);
  font-weight: 500;
  color: var(--text-muted);
  min-height: 1.6em;
}

.hero-typing .typed {
  color: var(--indigo-bright);
}

.hero-typing .caret {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  margin-left: 3px;
  background: var(--teal);
  vertical-align: text-bottom;
  animation: blink 1s steps(2) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.hero-tagline {
  margin-top: var(--space-4);
  max-width: 560px;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.hero-cta {
  margin-top: var(--space-5);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.hero-socials {
  display: flex;
  gap: var(--space-2);
  margin-left: var(--space-2);
}

.hero-stats {
  margin-top: var(--space-5);
  display: flex;
  flex-wrap: nowrap;          /* все четыре в одну строку */
  align-items: flex-start;
  gap: clamp(1.25rem, 2.6vw, 2.75rem);
}

.stat {
  min-width: 0;
}

.stat-num {
  font-family: var(--font-mono);
  font-size: clamp(1.8rem, 1.4rem + 1.6vw, 2.6rem);
  font-weight: 700;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.1;
}

/* одна строка на подпись => все четыре блока одной высоты, ничего не выпирает */
.stat-label {
  margin-top: 4px;
  font-size: var(--fs-small);
  color: var(--text-faint);
  white-space: nowrap;
}

.scroll-hint {
  height: var(--hint-band, 104px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-faint);
  font-size: var(--fs-tiny);
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.scroll-hint:hover { color: var(--text-muted); }

.scroll-hint svg {
  animation: bob 2s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ---------- 7. Projects ---------- */

.projects-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.filter-btn {
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--fs-small);
  font-weight: 500;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.filter-btn[aria-pressed='true'] {
  background: var(--accent-grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 18px var(--glow-indigo);
}

.search-wrap {
  position: relative;
  margin-left: auto;
  flex: 0 1 300px;
  min-width: 210px;
}

.search-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 42px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-small);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input::placeholder { color: var(--text-faint); }

.search-input:focus {
  outline: none;
  border-color: var(--indigo-bright);
  box-shadow: 0 0 0 3px var(--glow-indigo);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: var(--space-4);
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  background: var(--surface);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.35s var(--ease), box-shadow 0.35s ease, border-color 0.3s ease;
  cursor: pointer;
  padding: 0;
}

/* SpotlightCard — pointer-tracked glow overlay */
.project-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(129, 140, 248, 0.14), transparent 55%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.project-card:hover::before { opacity: 1; }

.project-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lift);
}

.card-cover {
  aspect-ratio: 16 / 9;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-cover .cover-icon {
  width: 58px;
  height: 58px;
  color: rgba(255, 255, 255, 0.92);
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.35));
  transition: transform 0.35s var(--ease);
}

.project-card:hover .cover-icon {
  transform: scale(1.12) rotate(-3deg);
}

.card-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.22), transparent 42%),
    linear-gradient(to top, rgba(4, 8, 14, 0.35), transparent 55%);
}

/* cover gradient themes */
.cover-indigo { background: linear-gradient(135deg, #4338ca, #6366f1 55%, #2dd4bf); }
.cover-teal   { background: linear-gradient(135deg, #0f766e, #14b8a6 55%, #818cf8); }
.cover-cyan   { background: linear-gradient(135deg, #0284c7, #06b6d4 55%, #34d399); }
.cover-violet { background: linear-gradient(135deg, #6d28d9, #8b5cf6 55%, #ec4899); }
.cover-amber  { background: linear-gradient(135deg, #b45309, #f59e0b 55%, #f43f5e); }
.cover-rose   { background: linear-gradient(135deg, #be123c, #fb7185 55%, #a78bfa); }
.cover-green  { background: linear-gradient(135deg, #15803d, #22c55e 55%, #2dd4bf); }
.cover-blue   { background: linear-gradient(135deg, #1e3a8a, #3b82f6 55%, #22d3ee); }

.card-category {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 1;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: rgba(6, 10, 16, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  letter-spacing: 0.06em;
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--space-2);
  padding: var(--space-4);
}

.card-title {
  font-size: var(--fs-h3);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-desc {
  color: var(--text-muted);
  font-size: var(--fs-small);
  flex: 1;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--space-2);
}

.tag {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
}

.card-more {
  margin-top: var(--space-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--teal);
  font-size: var(--fs-small);
  font-weight: 600;
}

.card-more svg {
  transition: transform 0.25s var(--ease);
}

.project-card:hover .card-more svg {
  transform: translateX(4px);
}

.projects-empty {
  display: none;
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-l);
}

.projects-empty.visible { display: block; }

.projects-empty .btn { margin-top: var(--space-3); }

/* ---------- 8. Modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(12px, 4vh, 48px) 16px;
  overflow-y: auto;
}

.modal.open { display: flex; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 12, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  animation: modal-in 0.35s var(--ease);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.modal-cover {
  aspect-ratio: 21 / 9;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-cover .cover-icon {
  width: 72px;
  height: 72px;
  color: rgba(255, 255, 255, 0.92);
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.35));
}

.modal-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 15%, rgba(255, 255, 255, 0.2), transparent 45%),
    linear-gradient(to top, rgba(4, 8, 14, 0.5), transparent 60%);
}

.modal-topbar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: rgba(6, 10, 16, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: var(--fs-small);
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.modal-btn:hover { background: rgba(6, 10, 16, 0.8); color: #fff; }

.modal-body {
  padding: var(--space-5);
}

.modal-category {
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal);
}

.modal-title {
  margin-top: 6px;
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.modal-tagline {
  color: var(--text-muted);
  margin-top: 4px;
}

.modal-section {
  margin-top: var(--space-4);
}

.modal-section h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: var(--space-2);
}

.modal-section h3::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.modal-section p { color: var(--text-muted); }

.feature-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 10px;
}

.feature-list li {
  position: relative;
  padding-left: 26px;
  color: var(--text-muted);
}

.feature-list li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.52em;
  width: 12px;
  height: 7px;
  border-left: 2px solid var(--teal);
  border-bottom: 2px solid var(--teal);
  transform: rotate(-45deg);
}

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

.modal-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.link-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: var(--fs-small);
  font-weight: 600;
  transition: all 0.2s ease;
}

.link-chip:hover {
  border-color: var(--teal);
  color: var(--teal-bright);
  transform: translateY(-2px);
}

.link-chip.disabled {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

.link-chip .soon {
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  color: var(--text-faint);
}

.screens-placeholder {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-m);
  padding: var(--space-4);
  text-align: center;
  color: var(--text-faint);
  font-size: var(--fs-small);
  font-family: var(--font-mono);
}

/* ---------- 9. About ---------- */

.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 880px;
}

.about-text {
  max-width: 760px;
}

.about-text p {
  color: var(--text-muted);
  margin-bottom: var(--space-3);
  font-size: 1.05rem;
}

.about-text p strong { color: var(--text); font-weight: 600; }

/* четыре факта => сетка 2×2, чтобы не оставалось одинокой карточки в ряду */
.about-facts {
  margin-top: var(--space-4);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-3);
}

.fact-card {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface);
  transition: transform 0.3s var(--ease), border-color 0.3s ease;
}

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

.fact-card h3 {
  font-size: var(--fs-body);
  font-weight: 700;
  margin-bottom: 4px;
}

.fact-card p {
  font-size: var(--fs-small);
  color: var(--text-muted);
  margin: 0;
}

/* ---------- 9b. Timeline ---------- */

.timeline {
  position: relative;
  margin: var(--space-4) 0;
  padding: var(--space-2) 0 0 var(--space-5);
  max-width: 760px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    var(--border-strong) 4%,
    var(--border-strong) 96%,
    transparent 100%
  );
}

.timeline-item {
  position: relative;
  padding: 0 0 var(--space-4) 0;
  transition: opacity .35s var(--ease), transform .35s var(--ease);
  opacity: .55;
}

.timeline-item.is-active {
  opacity: 1;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent-c, var(--accent));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-c, var(--accent)) 22%, transparent);
  transition: transform .25s var(--ease), box-shadow .25s ease;
}

.timeline-item.is-active::before {
  transform: scale(1.18);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-c, var(--accent)) 30%, transparent);
}

.timeline-date {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--accent-c, var(--accent));
  background: color-mix(in srgb, var(--accent-c, var(--accent)) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-c, var(--accent)) 30%, transparent);
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 8px;
  letter-spacing: .03em;
}

.timeline-item h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--text);
}

.timeline-item p {
  color: var(--text-muted);
  font-size: var(--fs-small);
  line-height: 1.55;
  margin: 0;
  max-width: 56ch;
}

.timeline-item .timeline-type {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-left: 8px;
  opacity: .7;
}

.timeline-item.is-active .timeline-type { opacity: 1; }

@media (max-width: 720px) {
  .timeline {
    padding-left: var(--space-4);
  }
  .timeline::before { left: 8px; }
  .timeline-item::before { left: -18px; width: 12px; height: 12px; }
  .timeline-item p { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .timeline-item { transition: none; opacity: 1; }
}

/* ---------- 9c. GitHub Feed ---------- */

.gh-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  max-width: 760px;
}

.gh-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: transform .25s var(--ease), border-color .25s ease, background .25s ease;
}

.gh-row:hover {
  transform: translateX(4px);
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--surface) 80%, var(--accent) 4%);
}

.gh-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 10px/1 var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 5px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}

.gh-type[data-t="commit"]  { background: rgba(74,222,128,.12); color: #4ade80; }
.gh-type[data-t="PR"]      { background: rgba(167,139,250,.14); color: #a78bfa; }
.gh-type[data-t="create"]  { background: rgba(34,211,238,.14); color: #22d3ee; }
.gh-type[data-t="wiki"]    { background: rgba(251,191,36,.14); color: #fbbf24; }
.gh-type[data-t="star"]    { background: rgba(244,114,182,.14); color: #f472b6; }
.gh-type[data-t="issue"]   { background: rgba(248,113,113,.14); color: #f87171; }
.gh-type[data-t="release"] { background: rgba(96,165,250,.14); color: #60a5fa; }
.gh-type[data-t="fork"]    { background: rgba(45,212,191,.14); color: #2dd4bf; }

.gh-body { min-width: 0; }

.gh-msg {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gh-msg.is-empty::before {
  content: "—";
  color: var(--text-muted);
}

.gh-repo {
  font: 500 11px/1.3 var(--font-mono);
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.gh-repo strong { color: var(--text); font-weight: 600; }

.gh-date {
  font: 500 11px/1 var(--font-mono);
  color: var(--text-muted);
  white-space: nowrap;
}

.gh-foot {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 760px;
}

.gh-profile {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: 600 13px/1 var(--font-sans);
  transition: transform .2s var(--ease), border-color .2s ease;
}

.gh-profile:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  color: var(--accent);
}

.gh-meta {
  font: 500 11px/1.4 var(--font-mono);
  color: var(--text-muted);
}

.gh-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--fs-small);
  border: 1px dashed var(--border);
  border-radius: 12px;
}

@media (max-width: 720px) {
  .gh-row { grid-template-columns: auto 1fr; gap: 10px; padding: 9px 12px; }
  .gh-date { grid-column: 1 / -1; padding-left: 4px; }
  .gh-msg { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .gh-row { transition: none; }
  .gh-row:hover { transform: none; }
  .gh-profile:hover { transform: none; }
}

/* ---------- Custom cursor (hover: hover only) ---------- */

.cursor-ring,
.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity .25s ease, width .25s ease, height .25s ease, border-color .25s ease, background .25s ease;
  will-change: transform;
}

.cursor-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent, #6366f1);
  transform: translate3d(-100px, -100px, 0);
}

.cursor-ring {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--accent, #6366f1) 60%, transparent);
  background: transparent;
  transform: translate3d(-100px, -100px, 0);
}

.cursor-ring--md { width: 14px; height: 14px; border-width: 1px; opacity: 0; transition-delay: .04s; }
.cursor-ring--sm { width: 6px;  height: 6px;  border-width: 1px; opacity: 0; transition-delay: .08s; }

/* visible on devices with mouse */
@media (hover: hover) and (pointer: fine) {
  body.has-custom-cursor,
  body.has-custom-cursor * { cursor: none !important; }

  body.has-custom-cursor .cursor-ring,
  body.has-custom-cursor .cursor-dot {
    opacity: 1;
  }

  body.has-custom-cursor .cursor-ring--lg.is-hover {
    width: 56px;
    height: 56px;
    border-color: var(--accent, #6366f1);
    background: color-mix(in srgb, var(--accent, #6366f1) 8%, transparent);
  }

  body.has-custom-cursor .cursor-ring--md.is-hover { opacity: .6; }
  body.has-custom-cursor .cursor-ring--sm.is-hover { opacity: .4; }
  body.has-custom-cursor .cursor-dot.is-hover {
    transform: translate3d(-100px, -100px, 0) scale(2.4);
    background: var(--accent, #6366f1);
  }

  body.has-custom-cursor .cursor-ring.is-text {
    width: 4px;
    height: 26px;
    border-radius: 4px;
    border-color: var(--accent, #6366f1);
  }
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .cursor-ring,
  .cursor-dot {
    transition: opacity .15s ease;
  }
}
/* ---------- 10. Skills ---------- */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-4);
}

.skill-group {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  background: var(--surface);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: transform 0.3s var(--ease), border-color 0.3s ease, box-shadow 0.3s ease;
}

.skill-group:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card);
}

.skill-group h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-body);
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.skill-group h3 svg {
  width: 20px;
  height: 20px;
  color: var(--teal);
  flex-shrink: 0;
}

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

.skill-tags .tag {
  font-size: var(--fs-small);
  padding: 5px 13px;
  color: var(--text-muted);
}

.java-card {
  margin-top: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-l);
  border: 1px solid transparent;
  background:
    linear-gradient(var(--bg-elevated), var(--bg-elevated)) padding-box,
    var(--accent-grad) border-box;
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}

.java-card .java-icon {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-m);
  background: var(--accent-grad);
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.03em;
}

.java-card h3 {
  font-size: var(--fs-h3);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.java-badge {
  padding: 3px 12px;
  border-radius: var(--radius-pill);
  background: var(--glow-teal);
  border: 1px solid var(--teal);
  color: var(--teal-bright);
  font-family: var(--font-mono);
  font-size: var(--fs-tiny);
  letter-spacing: 0.06em;
}

.java-card p {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: var(--fs-small);
}

/* ---------- 11. Contacts ---------- */

.contacts-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--space-5);
  align-items: start;
}

.contact-form {
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  background: var(--surface);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: grid;
  gap: var(--space-3);
}

.form-field {
  display: grid;
  gap: 6px;
}

.form-field label {
  font-size: var(--fs-small);
  font-weight: 600;
}

.form-field input,
.form-field textarea {
  padding: 11px 14px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-small);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  resize: vertical;
}

.form-field input::placeholder,
.form-field textarea::placeholder { color: var(--text-faint); }

.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--indigo-bright);
  box-shadow: 0 0 0 3px var(--glow-indigo);
}

.form-field.invalid input,
.form-field.invalid textarea {
  border-color: var(--danger);
}

.field-error {
  display: none;
  color: var(--danger);
  font-size: var(--fs-tiny);
}

.form-field.invalid .field-error { display: block; }

.form-hint {
  font-size: var(--fs-tiny);
  color: var(--text-faint);
}

.contact-cards {
  display: grid;
  gap: var(--space-3);
}

.contact-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface);
  color: var(--text);
  transition: transform 0.25s var(--ease), border-color 0.25s ease, box-shadow 0.25s ease;
}

a.contact-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card);
  color: var(--text);
}

.contact-card .cc-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-s);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--teal);
}

.contact-card .cc-text {
  min-width: 0;
}

.contact-card .cc-label {
  font-size: var(--fs-tiny);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
}

.contact-card .cc-value {
  font-weight: 600;
  font-size: var(--fs-small);
  overflow-wrap: anywhere;
}

.contact-card .cc-sub {
  font-size: var(--fs-tiny);
  color: var(--text-faint);
}

.copy-btn {
  margin-left: auto;
  flex-shrink: 0;
  position: relative;
}

.copy-btn.copied {
  color: var(--success);
  border-color: var(--success);
}

/* ---------- 12. Footer ---------- */

.footer {
  border-top: 1px solid var(--border);
  padding-block: var(--space-4);
  margin-top: var(--space-6);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-faint);
  font-size: var(--fs-small);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-inline: auto;
  list-style: none;
  padding: 0;
}

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

.footer-heart { color: var(--danger); }

/* ---------- 13. Back to top ---------- */

.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--bg-elevated) 85%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--text-muted);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s var(--ease), visibility 0.3s, color 0.2s ease, border-color 0.2s ease;
}

.to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.to-top:hover {
  color: var(--text);
  border-color: var(--indigo-bright);
}

/* ---------- 14. Reveal animations ---------- */

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s ease, transform 0.7s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal.in {
  opacity: 1;
  transform: none;
  transition-delay: 0ms;
}

/* BlurText — section titles sharpen into place */
.reveal-blur {
  opacity: 0;
  filter: blur(10px);
  transform: translateY(14px);
  transition: opacity 0.8s ease, filter 0.8s ease, transform 0.8s var(--ease);
}

.reveal-blur.in {
  opacity: 1;
  filter: blur(0);
  transform: none;
}

/* ---------- 15. Responsive ---------- */

@media (max-width: 900px) {
  .about-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .nav {
    position: fixed;
    inset: 0;
    z-index: 110;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
    margin-left: 0;
  }

  .nav.open {
    opacity: 1;
    visibility: visible;
  }

  .nav-list {
    flex-direction: column;
    gap: var(--space-3);
  }

  .nav-link {
    font-size: 1.35rem;
    font-weight: 600;
    padding: 10px 26px;
  }

  .burger { display: flex; }

  .header-actions { margin-left: auto; }
  .header-actions .btn { display: none; }

  .search-wrap {
    margin-left: 0;
    flex: 1 1 100%;
  }

  /* на узких экранах статистика перестраивается в 2×2, подписи остаются в одну строку */
  .hero-stats {
    display: grid;
    grid-template-columns: repeat(2, auto);
    justify-content: start;
    gap: var(--space-3) var(--space-5);
  }

  .java-card { flex-direction: column; }

  .modal-body { padding: var(--space-4); }

  .section { padding-block: var(--space-6); }
}

@media (max-width: 420px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }

  .hero-cta .btn { width: 100%; }

  .hero-socials { margin-left: 0; }
}

/* ---------- 16. Reduced motion ---------- */

/* ---------- 13. Hero stage (live projects + telemetry + mini terminal) ---------- */

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  max-width: 1180px;
}

.hero-copy { max-width: 640px; }

/* Если .hero-grid встречается без правой колонки (например в узком DOM) */
.hero:has(.hero-stage) {
  padding-block: calc(var(--header-h) + var(--space-5)) var(--space-5);
}

.hero-stage {
  position: relative;
  perspective: 1200px;
  height: clamp(360px, 42vw, 480px);
  display: block;
}

/* Капсула «24/7 ...» */
.stage-telemetry {
  position: absolute;
  top: -10px;
  right: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid color-mix(in srgb, var(--teal) 30%, transparent);
  font: 500 12px/1 var(--font-mono);
  color: var(--text);
  box-shadow: 0 10px 25px -18px rgba(45, 212, 191, .55);
}

.stage-telemetry .pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success, #22c55e);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, .6);
  animation: stage-pulse 1.6s ease-out infinite;
}
@keyframes stage-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(34, 197, 94, .55); }
  100% { box-shadow: 0 0 0 14px rgba(34, 197, 94, 0); }
}

/* 3D-стопка карточек */
.stage-cards {
  position: absolute;
  inset: 40px 0 60px;
  transform-style: preserve-3d;
}

.stage-card {
  position: absolute;
  width: clamp(200px, 24vw, 240px);
  padding: 12px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-elevated) 90%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
  box-shadow: 0 28px 60px -30px rgba(0, 0, 0, .55);
  transform-origin: center;
  animation: stage-float 11s ease-in-out infinite;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
}

.stage-card .stage-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed color-mix(in srgb, var(--text) 12%, transparent);
}

.stage-card .stage-card-head .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #4b5563;
}
.stage-card .stage-card-head .dot.r { background: #ef4444; }
.stage-card .stage-card-head .dot.y { background: #f59e0b; }
.stage-card .stage-card-head .dot.g { background: #22c55e; }
.stage-card .stage-card-head .title {
  margin-left: 6px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}
.stage-card .stage-card-head .badge-mini {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(34,197,94,.16);
  color: #4ade80;
  transition: background .25s ease, color .25s ease;
}
.stage-card .stage-card-head .badge-mini.off {
  background: rgba(148,163,184,.15);
  color: #94a3b8;
}
.stage-card .stage-card-head .badge-mini.degraded {
  background: rgba(251,191,36,.18);
  color: #fbbf24;
}
.stage-card .stage-card-head .badge-mini.offline {
  background: rgba(248,113,113,.18);
  color: #f87171;
}
.stage-card .stage-card-head .badge-mini.unknown {
  background: rgba(148,163,184,.15);
  color: #94a3b8;
}

/* live.json tooltip cursor */
.stage-card[data-live-status]:hover::before {
  content: attr(data-live-status);
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  font: 600 9px/1 var(--font-mono);
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: .05em;
  pointer-events: none;
  white-space: nowrap;
}

.stage-card .stage-card-body .line {
  display: flex; justify-content: space-between;
  padding: 3px 0;
  color: var(--text-faint);
}
.stage-card .stage-card-body .line b { color: var(--text); font-weight: 500; }
.stage-card .stage-card-body .line .ok { color: #4ade80; }

/* три карточки разнесены по 3D-перспективе */
.stage-card:nth-child(1) { top: 0;   left: 0;  transform: rotateY(-9deg) rotateX(6deg);  animation-delay:  -0.5s; }
.stage-card:nth-child(2) { top: 96px; left: 90px; transform: rotateY(-2deg) rotateX(2deg); animation-delay: -3.5s; }
.stage-card:nth-child(3) { top: 192px; left: 30px; transform: rotateY(-13deg) rotateX(-3deg); animation-delay: -6.5s; }

@keyframes stage-float {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -8px; }
}

/* Мини-терминал */
.stage-term {
  position: absolute;
  left: 8px;
  bottom: -8px;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, #0a0f17 88%, transparent);
  color: #d1fae5;
  border: 1px solid color-mix(in srgb, var(--teal) 30%, transparent);
  box-shadow: 0 24px 48px -28px rgba(45, 212, 191, .55);
  max-width: 86%;
}
.stage-term .prompt { color: var(--indigo-bright, #818cf8); margin-right: 6px; }
.stage-term .ok     { color: #4ade80; }
.stage-term .cmd    { color: #e2e8f0; }
.stage-term .dim    { color: #94a3b8; }

/* Адаптив: на узких — сцена уходит вниз и перестраивается в вертикальный стек */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-stage {
    height: auto;
    min-height: 0;
    perspective: none;
    order: 2;
  }
  .stage-cards {
    position: static;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 8px 0 16px;
    width: 100%;
    transform: none !important;
  }
  .stage-card {
    position: relative;
    width: 100%;
    max-width: 380px;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    animation: none !important;
    margin: 0 auto;
  }
  .stage-card:nth-child(1),
  .stage-card:nth-child(2),
  .stage-card:nth-child(3) {
    left: auto !important;
    top: auto !important;
    transform: none !important;
    animation: none !important;
  }
  .stage-term {
    position: relative;
    right: auto;
    left: auto;
    bottom: auto;
    margin: 0 auto;
    max-width: 380px;
    width: 100%;
    transform: none !important;
    animation: none !important;
  }
}

@media (max-width: 480px) {
  .hero-stage { height: auto; }
  .stage-cards { gap: 12px; padding: 4px 0 12px; }
  .stage-card { max-width: 100%; }
  .stage-term { max-width: 100%; }
  /* На самых узких экранах hero title помещаем в 2 строки и уменьшаем шрифт */
  .hero-typing .typed { font-size: clamp(1.05rem, 0.85rem + 1vw, 1.6rem); }
  .hero-title { font-size: clamp(1.45rem, 1.2rem + 1.2vw, 2rem); line-height: 1.1; }
  .hero-title .ch { white-space: normal; }
}

/* ---------- 14. Project card: thumbnail + live badges + metrics ---------- */

.card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  display: block;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 65%, var(--bg));
}

.card-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s var(--ease), opacity .25s ease;
  background: var(--surface);
}

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

.card-badges {
  position: absolute;
  inset: 10px 10px auto auto;
  display: flex;
  gap: 6px;
  z-index: 2;
}

.card-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 65%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid color-mix(in srgb, var(--text) 15%, transparent);
  color: var(--text-muted);
  letter-spacing: .03em;
}
.card-badge.live   { color: #4ade80; border-color: rgba(74,222,128,.35); background: rgba(20,83,45,.55); }
.card-badge.degraded { color: #fbbf24; border-color: rgba(251,191,36,.40); background: rgba(120,53,15,.55); }
.card-badge.beta   { color: #fbbf24; border-color: rgba(251,191,36,.35); background: rgba(120,53,15,.55); }
.card-badge.offline,
.card-badge.archived { color: #f87171; border-color: rgba(248,113,113,.40); background: rgba(127,29,29,.45); }
.card-badge.unknown  { color: #94a3b8; border-color: rgba(148,163,184,.35); background: rgba(51,65,85,.55); }

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}
.card-meta b { color: var(--text); font-weight: 500; }

/* ---------- 15. Skills: ring charts (CSS conic) ---------- */

.skill-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.ring-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--space-3);
}

.ring {
  position: relative;
  display: grid;
  place-items: center;
  padding: 12px 10px;
  border-radius: var(--radius-l);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform .3s var(--ease), border-color .25s ease;
}
.ring:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
}
.ring .ring-svg {
  width: 88px;
  height: 88px;
  transform: rotate(-90deg);
}
.ring .ring-svg .track {
  fill: none;
  stroke: color-mix(in srgb, var(--text) 8%, transparent);
  stroke-width: 8;
}
.ring .ring-svg .bar {
  fill: none;
  stroke: var(--ring-c1, var(--teal));
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 245;          /* 2π·39 ≈ 245 */
  stroke-dashoffset: 245;          /* animated to --p */
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--ring-c1, var(--teal)) 70%, transparent));
  transition: stroke-dashoffset 1.4s var(--ease) .1s;
}
.ring.is-in .ring-svg .bar {
  stroke-dashoffset: calc(245 - (245 * var(--p, 0)) / 100);
}
.ring .ring-label {
  margin-top: 6px;
  text-align: center;
  font: 500 12px/1.1 var(--font-sans);
  color: var(--text-muted);
}
.ring .ring-label b {
  display: block;
  font: 700 15px/1.2 var(--font-mono);
  color: var(--text);
  margin-top: 1px;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* цветовые темы колец */
.ring[data-color='indigo']  { --ring-c1: #818cf8; --ring-c2: #6366f1; }
.ring[data-color='teal']    { --ring-c1: #2dd4bf; --ring-c2: #14b8a6; }
.ring[data-color='cyan']    { --ring-c1: #22d3ee; --ring-c2: #06b6d4; }
.ring[data-color='violet']  { --ring-c1: #a78bfa; --ring-c2: #7c3aed; }
.ring[data-color='rose']    { --ring-c1: #fb7185; --ring-c2: #e11d48; }
.ring[data-color='green']   { --ring-c1: #4ade80; --ring-c2: #16a34a; }
.ring[data-color='amber']   { --ring-c1: #fbbf24; --ring-c2: #d97706; }
.ring[data-color='blue']    { --ring-c1: #60a5fa; --ring-c2: #2563eb; }

/* duplicate для .timeline-item, чтобы таймлайн использовал ту же палитру */
.timeline-item[data-color='indigo'] { --ring-c1: #818cf8; --ring-c2: #6366f1; }
.timeline-item[data-color='teal']   { --ring-c1: #2dd4bf; --ring-c2: #14b8a6; }
.timeline-item[data-color='cyan']   { --ring-c1: #22d3ee; --ring-c2: #06b6d4; }
.timeline-item[data-color='violet'] { --ring-c1: #a78bfa; --ring-c2: #7c3aed; }
.timeline-item[data-color='rose']   { --ring-c1: #fb7185; --ring-c2: #e11d48; }
.timeline-item[data-color='green']  { --ring-c1: #4ade80; --ring-c2: #16a34a; }
.timeline-item[data-color='amber']  { --ring-c1: #fbbf24; --ring-c2: #d97706; }
.timeline-item[data-color='blue']   { --ring-c1: #60a5fa; --ring-c2: #2563eb; }

/* ---------- 16. Contacts: terminal-style form ---------- */

.term-form {
  position: relative;
  padding: 18px 18px 20px;
  border-radius: var(--radius-l);
  background: color-mix(in srgb, #0a0f17 92%, transparent);
  border: 1px solid color-mix(in srgb, var(--teal) 22%, transparent);
  box-shadow: 0 30px 60px -40px rgba(45, 212, 191, .5);
  font-family: var(--font-mono);
  font-size: 13px;
  color: #d1fae5;
  overflow: hidden;
}

.term-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 1px dashed color-mix(in srgb, var(--teal) 28%, transparent);
}
.term-head .dot { width: 11px; height: 11px; border-radius: 50%; }
.term-head .dot.r { background: #ef4444; }
.term-head .dot.y { background: #f59e0b; }
.term-head .dot.g { background: #22c55e; }
.term-head .term-file {
  margin-left: 8px;
  color: #94a3b8;
  font-size: 12px;
}

.term-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0;
  color: #cbd5e1;
}
.term-line.block { display: block; }
.term-line .prompt {
  color: #818cf8;
  font-weight: 600;
  user-select: none;
}
.term-line input,
.term-line textarea {
  flex: 1 1 220px;
  min-width: 0;
  background: transparent;
  border: none;
  color: #e2e8f0;
  font: inherit;
  outline: none;
  padding: 2px 4px;
  border-bottom: 1px dashed color-mix(in srgb, var(--teal) 22%, transparent);
  transition: border-color .2s ease, background .2s ease;
}
.term-line textarea {
  width: 100%;
  margin-top: 6px;
  display: block;
  resize: vertical;
  min-height: 96px;
}
.term-line input:focus,
.term-line textarea:focus {
  border-bottom-color: var(--teal);
  background: color-mix(in srgb, var(--teal) 8%, transparent);
}
.term-line input::placeholder,
.term-line textarea::placeholder {
  color: #64748b;
  font-style: italic;
}
.term-line.invalid input,
.term-line.invalid textarea {
  border-bottom-color: #f87171;
  background: color-mix(in srgb, #ef4444 10%, transparent);
}

.caret-blink {
  display: inline-block;
  width: 8px;
  height: 14px;
  margin-left: 4px;
  background: var(--teal);
  animation: blink 1.05s steps(2) infinite;
  vertical-align: -2px;
}

.term-output {
  margin-top: 8px;
  padding: 8px 10px;
  min-height: 18px;
  border-radius: 8px;
  background: color-mix(in srgb, #000 40%, transparent);
  color: #94a3b8;
  font-size: 12px;
}
.term-output.ok    { color: #4ade80; }

.term-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-family: var(--font-sans);
}
.term-actions .btn .caret { color: var(--teal); margin-right: 6px; }

.form-hint {
  margin-top: 8px;
  font-family: var(--font-sans);
  font-size: var(--fs-tiny);
  color: var(--text-faint);
}

/* prettier mailto fallback */
.term-actions a.btn-ghost { font-family: var(--font-mono); font-size: 13px; }

@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;
  }

  .reveal,
  .reveal-blur {
    opacity: 1;
    transform: none;
    filter: none;
  }

  .split-text .ch {
    opacity: 1;
    filter: none;
    animation: none;
  }

  .aurora { animation: none; }

  .hero-typing .caret { animation: none; }

  /* hero-stage тоже должен «успокоиться» */
  .stage-card,
  .stage-telemetry .pulse,
  .stage-telemetry .pulse,
  .stage-term { animation: none !important; }
  .ring .ring-svg .bar { transition: none; stroke-dashoffset: calc(245 - (245 * var(--p, 0)) / 100); }
  .caret-blink { animation: none; opacity: 1; }
}
