:root {
  --bg: #05040a;
  --bg-2: #0a0814;
  --text: #f0eef6;
  --text-dim: #9d97b3;
  --accent-purple: #a855f7;
  --accent-blue: #38bdf8;
  --accent-magenta: #e879f9;
  --accent-cyan: #22d3ee;
  --glow-purple: rgba(168, 85, 247, 0.55);
  --glow-blue: rgba(56, 189, 248, 0.5);
  --glow-cyan: rgba(34, 211, 238, 0.45);
  --radius: 24px;
  --radius-sm: 14px;
  --max-width: 1200px;

  /* Настройки сегментов проектов */
  --segment-angle: 28px;
  --segment-gap: 0;
}

/* lg-bg — canvas с анимированным градиентным фоном для LiquidGlass.
   data-dynamic заставляет LiquidGlass переснимать canvas каждый кадр. */
.lg-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

#header-root .lg-bg {
  border-radius: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

.mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  mix-blend-mode: screen;
  animation: drift 18s ease-in-out infinite;
}

.blob-1 {
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, var(--glow-purple) 0%, transparent 70%);
  top: -15%;
  left: -15%;
  animation-duration: 22s;
}

.blob-2 {
  width: 55vw;
  height: 55vw;
  background: radial-gradient(circle, var(--glow-blue) 0%, transparent 70%);
  bottom: -10%;
  right: -20%;
  animation-duration: 26s;
  animation-delay: -8s;
}

.blob-3 {
  width: 35vw;
  height: 35vw;
  background: radial-gradient(circle, var(--glow-cyan) 0%, transparent 70%);
  top: 40%;
  left: 35%;
  animation-duration: 20s;
  animation-delay: -4s;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(8vw, -6vh) scale(1.08); }
  50% { transform: translate(-6vw, 8vh) scale(0.95); }
  75% { transform: translate(4vw, 6vh) scale(1.04); }
}

.noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.035;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  /* Анимация отключена: на главной странице .noise полностью перекрыт
     непрозрачным plasma-canvas (z-index: -1, идёт позже в DOM) —
     анимация срабатывала вхолостую, нагружая композитор 8 раз/сек.
     На страницах без плазмы статичный noise даёт тот же grain-эффект. */
}

/* ── LiquidGlass integration ──
   Стеклянные элементы (.glass, .glass-card) — это чистые контейнеры.
   LiquidGlass вставит <canvas> как firstChild и будет рендерить
   WebGL-эффект преломления/бликов/тени.
   НЕ задаём здесь backdrop-filter, isolation, overflow:hidden —
   они мешают WebGL-композитингу.
*/
.glass,
.glass-card {
  position: relative;
  z-index: 1;
  border-radius: var(--radius);
}

.glass-card {
  padding: clamp(28px, 5vw, 56px);
}

.glass-card > *,
.glass > *:not(.lg-bg) {
  position: relative;
  z-index: 1;
}

/* CSS-fallback: применяется только если LiquidGlass не смог инициализироваться.
   Класс .liquid-glass-fallback добавляется JS-кодом при ошибке init. */
.liquid-glass-fallback .glass,
.liquid-glass-fallback .glass-card,
.no-liquid-glass .glass,
.no-liquid-glass .glass-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}

.liquid-glass-fallback .site-header-glass,
.no-liquid-glass .site-header-glass {
  background: rgba(5, 4, 10, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}

/* Liquid Glass integration */
.lg-root {
  position: relative;
  border-radius: var(--radius);
  overflow: visible;
}


/* projects-bg — отдельный класс для секции проектов (не стекло) */
.projects-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(168, 85, 247, 0.09) 0%, transparent 45%),
    radial-gradient(ellipse at 70% 100%, rgba(56, 189, 248, 0.06) 0%, transparent 45%),
    var(--bg);
}

.container {
  width: min(92%, var(--max-width));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: transparent;
}

#header-root {
  position: relative;
  min-height: 74px;
}

#header-root .lg-bg {
  border-radius: 0;
}

.site-header-glass {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 0;
}

.header-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  height: 100%;
}

.logo {
  display: block;
  text-decoration: none;
}

.logo img {
  height: 42px;
  width: auto;
  filter: drop-shadow(0 0 8px var(--glow-purple));
  transition: filter 0.3s ease;
}

.logo:hover img {
  filter: drop-shadow(0 0 18px var(--glow-purple)) drop-shadow(0 0 8px var(--glow-blue));
}

.main-nav {
  display: flex;
  gap: 28px;
}

.main-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: color 0.25s ease;
  position: relative;
}

.main-nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue));
  transition: width 0.3s ease;
}

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

.main-nav a:hover::after {
  width: 100%;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.menu-toggle span {
  display: block;
  width: 26px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

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

.plasma-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.hero {
  min-height: calc(100vh - 80px);
  display: grid;
  place-items: center;
  position: relative;
  padding: 48px 0;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(168, 85, 247, 0.12) 0%, transparent 55%),
    radial-gradient(ellipse at 30% 70%, rgba(56, 189, 248, 0.08) 0%, transparent 45%);
  pointer-events: none;
}

.hero-inner {
  text-align: center;
  position: relative;
  z-index: 1;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}

/* === Неоновый заголовок <iostream> ===
   Лампа (белая, минимальное размытие) + свечение (градиент
   FF00F8 -> 00D1FF, вращение). Свечение = заливка + контур
   тем же градиентом. */
@property --neon-angle {
  syntax: '<angle>';
  initial-value: 135deg;
  inherits: false;
}

.hero-title {
  font-size: clamp(4rem, 15vw, 12rem);
  font-weight: 400;
  margin: 0;
  line-height: 1;
  letter-spacing: 0;
  font-family: 'Mr Dafoe', cursive;
  position: relative;
  isolation: isolate;
  /* Слой 1 — лампа: белый, минимальное размытие, без свечения. */
  color: #ffffff;
  filter: blur(1px);
}

/* Слой 2 — свечение, заливка: размытый градиент с вращением. */
.hero-title::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(var(--neon-angle), #00D1FF, #FF00F8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: blur(20px);
  animation: neonRotate 6s linear infinite;
}

/* Слой 2 — свечение, контур: тот же градиент, увеличенный и
   менее размытый, чтобы читался как обводка вокруг заливки. */
.hero-title::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  z-index: -2;
  background: linear-gradient(var(--neon-angle), #00D1FF, #FF00F8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  transform: scale(1.00);
  transform-origin: center;
  filter: blur(5px);
  animation: neonRotate 6s linear infinite;
}

@keyframes neonRotate {
  to { --neon-angle: 495deg; }
}

.hero-tagline {
  font-size: clamp(1.15rem, 2.5vw, 1.6rem);
  color: var(--text-dim);
  margin-top: 28px;
  font-weight: 400;
}

.hero-description {
  max-width: 560px;
  margin: 20px auto 0;
  color: var(--text-dim);
  font-size: 1.02rem;
}

.hero-actions {
  margin-top: 44px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.98rem;
  transition: transform 0.2s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.25), rgba(56, 189, 248, 0.25));
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow:
    0 0 18px rgba(168, 85, 247, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 28px rgba(168, 85, 247, 0.45),
    0 0 48px rgba(56, 189, 248, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.25);
}

.projects-section,
.about-section,
.contacts-section {
  padding: 100px 0;
}

.section-header {
  margin-bottom: 56px;
}

.section-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 16px;
  font-weight: 700;
}

.section-lead {
  color: var(--text-dim);
  max-width: 560px;
  font-size: 1.05rem;
  margin: 0;
}





.projects-root {
  position: relative;
  width: 100vw;
  left: 50%;
  transform: translateX(-50%);
  overflow: hidden;
  padding: 0;
}

.projects-root .projects-bg {
  background:
    radial-gradient(ellipse at 30% 0%, rgba(168, 85, 247, 0.09) 0%, transparent 45%),
    radial-gradient(ellipse at 70% 100%, rgba(56, 189, 248, 0.06) 0%, transparent 45%),
    var(--bg);
}

.projects-list {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: var(--segment-gap);
}

.segment {
  position: relative;
  display: block;
  width: 100%;
  min-height: 220px;
  padding: clamp(44px, 6vw, 88px) clamp(24px, 4vw, 48px);
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  isolation: isolate;
  clip-path: polygon(
    0 var(--segment-angle),
    100% 0,
    100% calc(100% - var(--segment-angle)),
    0 100%
  );
  background:
    radial-gradient(ellipse at 25% 0%, rgba(168, 85, 247, 0.09) 0%, transparent 42%),
    radial-gradient(ellipse at 75% 100%, rgba(56, 189, 248, 0.06) 0%, transparent 42%),
    var(--bg);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

.segment + .segment {
  margin-top: calc(-1 * var(--segment-angle));
}

.segment-inner {
  position: relative;
  z-index: 2;
  width: min(92%, var(--max-width));
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(14px, 2.5vw, 28px);
}

.segment::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.10) 0%,
      transparent 12%,
      transparent 88%,
      rgba(255, 255, 255, 0.10) 100%
    );
  opacity: 0.5;
  mix-blend-mode: screen;
}

.segment::after {
  content: '';
  position: absolute;
  inset: -12%;
  z-index: -2;
  background: var(--glow, radial-gradient(circle, rgba(168, 85, 247, 0.22), transparent 60%));
  filter: blur(55px);
  opacity: 0.35;
  animation: segmentGas 9s ease-in-out infinite;
}

@keyframes segmentGas {
  0%, 100% { transform: scale(1) translate(0, 0); opacity: 0.35; }
  50% { transform: scale(1.10) translate(1%, -1%); opacity: 0.50; }
}

.segment-icon {
  font-size: clamp(2rem, 4vw, 3.4rem);
  color: var(--segment-accent, var(--accent-purple));
  text-shadow: 0 0 24px currentColor;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
}

.segment-icon img {
  width: 5em;
  height: 5em;
  object-fit: contain;
  filter: drop-shadow(0 0 16px var(--segment-accent, var(--accent-purple)));
}

.segment-icon:has(img) {
  text-shadow: none;
}

.segment-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.segment-body h3 {
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  margin: 0;
  font-weight: 700;
}

.segment-body .subtitle {
  font-size: clamp(0.95rem, 1.4vw, 1.2rem);
  color: var(--text-dim);
  margin: 0;
}

.segment-body .summary {
  font-size: clamp(0.95rem, 1.2vw, 1.08rem);
  color: var(--text-dim);
  margin: 0;
  max-width: 680px;
  line-height: 1.6;
}

.segment-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}

.segment-arrow {
  font-size: 1.7rem;
  color: var(--text-dim);
  transition: transform 0.35s ease, color 0.3s ease;
}

.segment:hover {
  transform: translateX(8px) scale(1.003);
  border-color: rgba(255, 255, 255, 0.10);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.45),
    inset 0 0 60px rgba(168, 85, 247, 0.05);
}

.segment:hover .segment-arrow {
  transform: translateX(10px);
  color: var(--text);
}

.about-card p,
.contacts-card p {
  color: var(--text-dim);
  max-width: 760px;
  font-size: 1.05rem;
}

.contacts-list {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.contact-item {
  margin: 0;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.contact-link:hover {
  background: rgba(255, 255, 255, 0.04);
}

.contact-link.is-disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.contact-link.is-disabled:hover {
  background: transparent;
}

.contact-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--accent-purple);
}

.contact-link:hover .contact-icon {
  color: rgba(66, 100, 255);
}

.contact-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.contact-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.contact-sub {
  font-size: 0.9rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 42px;
}

.pillar {
  padding: 24px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.pillar:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.pillar-icon {
  display: block;
  font-size: 1.6rem;
  margin-bottom: 12px;
  color: var(--accent-cyan);
  text-shadow: 0 0 12px currentColor;
}

.pillar h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.pillar p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-dim);
}

.site-footer {
  padding: 40px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 40px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--text-dim);
}

.footer-inner p {
  margin: 0;
}

@media (max-width: 720px) {
  .main-nav {
    position: fixed;
    inset: 74px 16px auto;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    background: rgba(5, 4, 10, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(20px);
    transform-origin: top;
    transform: scaleY(0);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
  }

  .main-nav.open {
    transform: scaleY(1);
    opacity: 1;
    pointer-events: auto;
  }

  .menu-toggle {
    display: flex;
  }

  .projects-section,
  .about-section,
  .contacts-section {
    padding: 64px 0;
  }

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

@media (max-width: 720px) {
  .segment-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .segment-meta {
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
  }

  .segment-body .summary {
    max-width: 100%;
  }
}

@media (max-width: 420px) {
  :root {
    --segment-angle: 6%;
  }
}

/* Project page */
.project-page .ambient .blob {
  opacity: 0.35;
}

.project-hero {
  padding: 120px 0 64px;
  position: relative;
  overflow: hidden;
}

.project-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--project-gradient, radial-gradient(circle at 50% 50%, rgba(168, 85, 247, 0.15), transparent 60%));
  opacity: 0.7;
  pointer-events: none;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.92rem;
  margin-bottom: 28px;
  transition: color 0.25s ease;
}

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

.project-icon {
  font-size: 3.2rem;
  display: block;
  margin-bottom: 16px;
  color: var(--project-accent, var(--accent-purple));
  text-shadow: 0 0 24px currentColor;
}

.project-icon img {
  width: 5em;
  height: 5em;
  object-fit: contain;
  filter: drop-shadow(0 0 16px var(--project-accent, var(--accent-purple)));
}

.project-icon:has(img) {
  text-shadow: none;
}

.project-title {
  font-size: clamp(2.4rem, 7vw, 4.4rem);
  margin: 0 0 12px;
  font-weight: 700;
  line-height: 1.05;
}

.project-subtitle {
  font-size: clamp(1.1rem, 2.2vw, 1.5rem);
  color: var(--text-dim);
  margin: 0 0 24px;
  max-width: 640px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.project-hero .tags .tag {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.project-body {
  margin-bottom: 80px;
}

.project-body p {
  font-size: 1.1rem;
  color: var(--text-dim);
  max-width: 760px;
  line-height: 1.7;
}

.project-summary-card {
  margin-top: 40px;
  padding: 28px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
}

.project-summary-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 10% 10%, rgba(168, 85, 247, 0.1), transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(56, 189, 248, 0.08), transparent 40%);
  pointer-events: none;
}

.project-summary-card h3 {
  margin: 0 0 12px;
  font-size: 1.15rem;
}

.project-summary-card p {
  margin: 0;
  color: var(--text);
}
