/* ============================================================
   Сергей Власов — Personal Portfolio
   Премиум-минимализм · 3D-частицы · RU/EN
   ============================================================ */

:root {
  --bg: #07070a;
  --bg-soft: #0d0d12;
  --fg: #f4f4f6;
  --fg-dim: #9a9aa6;
  --fg-mute: #5a5a68;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #7c5cff;
  --accent-glow: rgba(124, 92, 255, 0.55);
  --accent-2: #34e2c0;
  --glass: rgba(18, 18, 26, 0.55);
  --radius: 18px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-sans: "Inter", "Helvetica Neue", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", ui-monospace, Menlo, monospace;
  --font-display: "Inter", "Helvetica Neue", system-ui, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.5;
  overflow-x: hidden;
  cursor: default;
}
::selection { background: var(--accent); color: #fff; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ---------- 3D canvas ---------- */
#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}
#scene canvas { display: block; width: 100% !important; height: 100% !important; }

/* виньетка: левая половина (текст) затемнена, правая (сетка) открыта.
   Сетка физически в правой половине + гаснет градиентом → не перекрывает текст. */
.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    /* жёсткое затемнение слева под текст, плавный переход к центру */
    linear-gradient(
      to right,
      rgba(7,7,10,0.94) 0%,
      rgba(7,7,10,0.86) 28%,
      rgba(7,7,10,0.45) 46%,
      rgba(7,7,10,0.12) 60%,
      rgba(7,7,10,0.35) 100%
    ),
    /* лёгкое затемнение снизу/сверху */
    linear-gradient(
      to bottom,
      rgba(7,7,10,0.4) 0%,
      transparent 25%,
      transparent 75%,
      rgba(7,7,10,0.5) 100%
    );
}
@media (max-width: 768px) {
  /* на мобильном: верхняя половина (текст) тёмная, нижняя (сетка) видна */
  .vignette {
    background:
      linear-gradient(
        to bottom,
        rgba(7,7,10,0.96) 0%,
        rgba(7,7,10,0.9) 45%,
        rgba(7,7,10,0.35) 62%,
        rgba(7,7,10,0.2) 100%
      );
  }
}

/* ---------- Layout ---------- */
.shell {
  position: relative;
  z-index: 2;
  max-width: 1280px;
  margin: 0 auto;
  /* Минимум 24px по бокам даже на самом узком экране, дальше растёт с шириной */
  padding: 0 max(24px, 6vw);
}
/* На десктопе контент держим в левой части экрана, чтобы он не
   пересекался с волновой сеткой в правой половине. */
@media (min-width: 1024px) {
  .shell {
    max-width: 940px;
    margin: 0;
    margin-left: max(6vw, calc((100vw - 1400px) / 2));
    padding-right: 8vw;
    padding-left: max(24px, 6vw);
  }
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  padding: 22px max(24px, 6vw);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: backdrop-filter 0.4s, background 0.4s, border-color 0.4s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(7, 7, 10, 0.6);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.nav__brand {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav__brand .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}
.nav__links {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 13px;
  color: var(--fg-dim);
}
.nav__links a {
  position: relative;
  transition: color 0.3s;
}
.nav__links a:hover { color: var(--fg); }
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -6px;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 0.3s var(--ease);
}
.nav__links a:hover::after { width: 100%; }
.lang {
  display: flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  overflow: hidden;
}
.lang button {
  padding: 6px 12px;
  color: var(--fg-mute);
  transition: all 0.25s;
  font-size: 12px;
}
.lang button.active {
  background: var(--fg);
  color: var(--bg);
}
@media (max-width: 720px) {
  .nav__links { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  padding: 120px 0 80px;
}
.hero__tag {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.hero__tag::before {
  content: "";
  width: 32px; height: 1px;
  background: var(--accent-2);
}
.hero__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(48px, 9vw, 132px);
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin-bottom: 24px;
}
.hero__title .line { display: block; overflow: hidden; }
.hero__title .line span {
  display: inline-block;
  transform: translateY(110%);
  animation: rise 1.1s var(--ease) forwards;
}
.hero__title .line:nth-child(2) span { animation-delay: 0.12s; }
.hero__title .accent {
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
@keyframes rise { to { transform: translateY(0); } }
.hero__sub {
  max-width: 620px;
  font-size: clamp(16px, 1.5vw, 19px);
  color: var(--fg-dim);
  margin-bottom: 48px;
  opacity: 0;
  animation: fade 1s 0.5s var(--ease) forwards;
}
@keyframes fade { to { opacity: 1; } }
.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  opacity: 0;
  animation: fade 1s 0.7s var(--ease) forwards;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-dim);
  background: var(--glass);
  backdrop-filter: blur(8px);
}
.chip .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent-2);
}
.hero__scroll {
  position: absolute;
  bottom: 36px; left: max(24px, 6vw);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-mute);
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero__scroll .bar {
  width: 1px; height: 40px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  animation: scrollBar 2s var(--ease) infinite;
}
@keyframes scrollBar {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  51% { transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ---------- Sections ---------- */
.section {
  padding: 140px 0;
  position: relative;
}
.section__head {
  display: flex;
  align-items: baseline;
  gap: 24px;
  margin-bottom: 72px;
}
.section__num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}
.section__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(32px, 5vw, 64px);
  letter-spacing: -0.03em;
  line-height: 1.05;
}
/* На мобильном: номер и заголовок по центру, компактнее. */
@media (max-width: 768px) {
  .section { padding: 96px 0; }
  .section__head {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 48px;
    text-align: center;
  }
  .section__title {
    font-size: clamp(28px, 8vw, 38px);
    line-height: 1.1;
  }
}
.section__title .accent {
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}
.reveal.in { opacity: 1; transform: translateY(0); }

/* ---------- About ---------- */
.about__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}
.about__lead {
  font-size: clamp(20px, 2.2vw, 30px);
  line-height: 1.35;
  letter-spacing: -0.01em;
  font-weight: 500;
}
.about__lead .dim { color: var(--fg-dim); }
.about__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}
.stat__num {
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}
.stat__label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-dim);
  margin-top: 10px;
  letter-spacing: 0.04em;
}
@media (max-width: 820px) {
  .about__grid { grid-template-columns: 1fr; gap: 48px; }
}
@media (max-width: 768px) {
  .about__grid { gap: 40px; text-align: center; }
  .about__lead { font-size: clamp(18px, 4.5vw, 24px); }
  .about__stats { gap: 24px 32px; justify-items: center; }
  .stat__label { text-align: center; }
}

/* ---------- Now / Current activity ---------- */
.now {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.now__card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(24px, 4vw, 40px);
  background: linear-gradient(160deg, rgba(124, 92, 255, 0.10) 0%, rgba(13, 13, 18, 0.88) 55%);
  backdrop-filter: blur(14px);
  transition: transform 0.5s var(--ease), border-color 0.5s, box-shadow 0.5s;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.now__card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-2), transparent);
  opacity: 0.7;
}
.now__card:hover {
  transform: translateY(-6px);
  border-color: var(--line-strong);
  box-shadow: 0 20px 50px rgba(124, 92, 255, 0.18);
}
.now__head {
  display: flex;
  align-items: center;
  margin-bottom: 22px;
}
.now__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(52, 226, 192, 0.08);
  border: 1px solid rgba(52, 226, 192, 0.25);
}
.now__badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent-2);
  animation: pulse 1.8s infinite;
}
.now__title {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  /* длинные домены вроде наставникит.рф не должны ломать макет */
  overflow-wrap: anywhere;
  word-break: break-word;
}
.now__subtitle {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 16px;
}
.now__desc {
  color: var(--fg-dim);
  font-size: 15px;
  line-height: 1.65;
  margin-bottom: 28px;
  flex: 1;
}
.now__link {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  color: var(--bg);
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 100%);
  transition: transform 0.3s var(--ease), box-shadow 0.3s;
  box-shadow: 0 8px 24px rgba(124, 92, 255, 0.25);
}
.now__link:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 32px rgba(124, 92, 255, 0.4);
}
.now__link svg { transition: transform 0.3s var(--ease); }
.now__link:hover svg { transform: translate(2px, -2px); }
@media (max-width: 820px) {
  .now { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .now__card { text-align: center; align-items: center; }
  .now__head { justify-content: center; }
  .now__link { align-self: center; }
}
@media (max-width: 480px) {
  /* компактные карточки на узких экранах */
  .now { gap: 16px; }
  .now__card { padding: 22px; border-radius: 14px; }
  .now__head { margin-bottom: 16px; }
  .now__title { font-size: 21px; }
  .now__desc { font-size: 14px; margin-bottom: 22px; }
  /* кнопка во всю ширину — удобно для тача */
  .now__link {
    align-self: stretch;
    justify-content: center;
    padding: 14px 20px;
  }
}
/* на тач-устройствах убираем hover-«залипание» трансформа */
@media (hover: none) {
  .now__card:hover { transform: none; }
  .now__link:hover { transform: none; }
  .now__link:hover svg { transform: none; }
}
}

/* ---------- Experience timeline ---------- */
.timeline {
  display: flex;
  flex-direction: column;
}
.exp {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 48px;
  padding: 40px 0;
  border-top: 1px solid var(--line);
  transition: background 0.4s;
}
.exp:last-child { border-bottom: 1px solid var(--line); }
.exp:hover { background: rgba(124, 92, 255, 0.03); }
.exp__period {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-dim);
  padding-top: 4px;
}
.exp__period .now {
  color: var(--accent-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.exp__period .now::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent-2);
  animation: pulse 1.8s infinite;
}
.exp__role {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.exp__company {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 16px;
}
.exp__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.exp__list li {
  position: relative;
  padding-left: 20px;
  color: var(--fg-dim);
  font-size: 15px;
  line-height: 1.55;
}
.exp__list li::before {
  content: "";
  position: absolute;
  left: 0; top: 10px;
  width: 8px; height: 1px;
  background: var(--accent);
}
.exp__list strong { color: var(--fg); font-weight: 500; }
@media (max-width: 720px) {
  .exp { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 768px) {
  .exp { text-align: center; }
  .exp__period { padding-top: 0; }
  .exp__list { align-items: center; }
  .exp__list li { padding-left: 0; }
  .exp__list li::before { display: none; }
}

/* ---------- Projects ---------- */
.projects {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.project {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px;
  background: rgba(13, 13, 18, 0.88);
  backdrop-filter: blur(14px);
  transition: transform 0.5s var(--ease), border-color 0.5s, background 0.5s;
  position: relative;
  overflow: hidden;
}
.project::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.5s;
}
.project:hover {
  transform: translateY(-6px);
  border-color: var(--line-strong);
  background: rgba(28, 28, 40, 0.6);
}
.project:hover::before { opacity: 1; }
.project__head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 18px;
}
.project__num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-mute);
}
.project__year {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
}
.project__title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}
.project__desc {
  color: var(--fg-dim);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 20px;
}
.project__stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(124, 92, 255, 0.1);
  color: var(--accent);
  border: 1px solid rgba(124, 92, 255, 0.2);
}
@media (max-width: 820px) {
  .projects { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .project { text-align: center; }
  .project__head { justify-content: center; }
  .project__stack { justify-content: center; }
}

/* ---------- Skills ---------- */
.skills__group { margin-bottom: 48px; }
.skills__group-title {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--fg-mute);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.skills__group-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.skills__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.skill {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  color: var(--fg);
  background: rgba(255,255,255,0.02);
  transition: all 0.3s var(--ease);
}
.skill:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(124, 92, 255, 0.15);
}
.skill.featured {
  background: linear-gradient(120deg, rgba(124,92,255,0.15), rgba(52,226,192,0.1));
  border-color: var(--accent);
  color: var(--fg);
}
@media (max-width: 768px) {
  .skills__group-title { justify-content: center; }
  .skills__group-title::after { display: none; }
  .skills__chips { justify-content: center; }
}

/* ---------- Contact ---------- */
.contact {
  text-align: center;
  padding: 180px 0 140px;
}
.contact__lead {
  font-family: var(--font-display);
  font-size: clamp(36px, 6vw, 88px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 48px;
}
.contact__lead .accent {
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.contact__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}
.contact__link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 32px;
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  font-size: 15px;
  transition: all 0.4s var(--ease);
  background: var(--glass);
  backdrop-filter: blur(12px);
}
.contact__link.primary {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.contact__link:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}
.contact__link.primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 40px max(24px, 6vw);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-mute);
  flex-wrap: wrap;
  gap: 16px;
  position: relative;
  z-index: 2;
}
@media (max-width: 768px) {
  .footer { justify-content: center; text-align: center; }
}

/* ---------- Scroll progress ---------- */
.progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  z-index: 100;
  width: 0%;
  transition: width 0.1s linear;
}

/* loader */
.loader {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s 0.2s, visibility 0.8s 0.2s;
}
.loader.hide { opacity: 0; visibility: hidden; }
.loader__txt {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--fg-dim);
  text-transform: uppercase;
}
.loader__bar {
  position: absolute;
  bottom: 40px;
  left: max(24px, 6vw); right: max(24px, 6vw);
  height: 1px;
  background: var(--line);
}
.loader__bar::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: var(--accent);
  animation: loadBar 1.6s var(--ease) forwards;
}
@keyframes loadBar { to { width: 100%; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
