:root {
  --bg: #131720;
  --bg-elevated: #1b212c;
  --bg-elevated-2: #212836;
  --border: #2a3241;
  --text: #e9edf3;
  --text-dim: #8b93a3;
  --text-dimmer: #5f6879;
  --blue: #5b9bd5;
  --blue-dim: #3d6a94;
  --gold: #ffd43b;
  --gold-dim: #cca92f;
  --red: #ef6b6b;
  --green: #6bcf8f;

  --font-display: 'Sora', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;

  --max-width: 1080px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 65% 55% at 50% 55%, rgba(20, 150, 130, 0.5), transparent 65%),
    radial-gradient(ellipse 45% 40% at 50% 75%, rgba(13, 110, 95, 0.4), transparent 60%);
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; }

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

#snow-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.85;
}

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(19, 23, 32, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
  color: var(--gold);
}

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

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(107, 207, 143, 0.15);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.status-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-right: 10px;
  display: none;
}

@media (min-width: 560px) {
  .status-text { display: inline; }
}

.lang-switch {
  display: flex;
  gap: 2px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}

.lang-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 5px 9px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

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

.lang-btn.active {
  background: var(--blue-dim);
  color: #fff;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  z-index: 2;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 64px 24px 32px;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 40px;
  align-items: center;
}

@media (max-width: 760px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-photo-wrap { order: -1; display: flex; justify-content: center; }
}

.hero-terminal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  background: var(--bg-elevated-2);
  border-bottom: 1px solid var(--border);
}

.term-bar .dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.term-title {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dimmer);
  margin-left: 8px;
}

.term-body {
  padding: 20px 22px 24px;
  font-family: var(--font-mono);
  font-size: 14px;
}

.term-body p { margin: 0 0 6px; }

.prompt { color: var(--gold); font-weight: 600; }

.term-out {
  color: var(--text);
  margin-left: 0;
  margin-bottom: 14px !important;
  font-size: 20px;
  font-weight: 600;
  font-family: var(--font-display);
}

.term-out.accent { color: var(--green); font-family: var(--font-mono); font-size: 14px; font-weight: 500; }

.cursor-line { margin-top: 4px !important; }

.blink { color: var(--text); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.hero-photo {
  width: 240px;
  height: 240px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
  position: relative;
}

.hero-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 20px;
  box-shadow: inset 0 0 0 1px rgba(255,212,59,0.15);
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 12%;
  display: block;
  filter: grayscale(15%) contrast(1.03);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  margin-top: 36px;
}

.icon-row { display: flex; gap: 10px; }

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: var(--text-dim);
  transition: fill 0.15s;
}

.icon-btn:hover { transform: translateY(-2px); }
.icon-btn.icon-github:hover { border-color: #ffffff55; background: #ffffff14; }
.icon-btn.icon-github:hover svg { fill: #ffffff; }
.icon-btn.icon-linkedin:hover { border-color: #0A66C2; background: #0A66C21a; }
.icon-btn.icon-linkedin:hover svg { fill: #4a9fe8; }
.icon-btn.icon-telegram:hover { border-color: #26A5E4; background: #26A5E41a; }
.icon-btn.icon-telegram:hover svg { fill: #26A5E4; }

.text-row { display: flex; flex-wrap: wrap; gap: 10px; }

.btn {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
  display: inline-block;
}

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

.btn-primary { background: var(--blue); color: #0d1117; }
.btn-primary:hover { background: #6fa8dc; }

.btn-secondary { background: var(--bg-elevated); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--blue-dim); }

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

/* ---------- Sections ---------- */
.section {
  position: relative;
  z-index: 2;
  padding: 64px 0;
  border-top: 1px solid var(--border);
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.eyebrow {
  font-family: var(--font-mono);
  color: var(--gold);
  font-size: 13px;
  margin: 0 0 8px;
  letter-spacing: 0.02em;
}

.section h2 {
  font-size: 30px;
  margin-bottom: 24px;
}

.about-text {
  max-width: 680px;
  font-size: 17px;
  color: var(--text-dim);
  line-height: 1.75;
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.skill-group {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}

.skill-group h3 {
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  font-weight: 600;
}

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

.skill-tag {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 10px;
  border-radius: 6px;
}

/* ---------- Git log timeline ---------- */
.git-log {
  position: relative;
  padding-left: 28px;
}

.git-log::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(var(--blue-dim), var(--border));
}

.commit {
  position: relative;
  padding-bottom: 30px;
}

.commit:last-child { padding-bottom: 0; }

.commit::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--gold);
}

.commit-hash {
  font-family: var(--font-mono);
  color: var(--gold);
  font-size: 13px;
  font-weight: 600;
}

.commit-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dimmer);
  margin: 3px 0 8px;
}

.commit-msg {
  font-size: 16px;
  font-weight: 500;
}

.commit-desc {
  font-size: 14px;
  color: var(--text-dim);
  margin-top: 4px;
  max-width: 620px;
}

/* ---------- Portfolio ---------- */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.project-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  transition: border-color 0.15s, transform 0.15s;
  display: block;
}

.project-card:hover {
  border-color: var(--blue-dim);
  transform: translateY(-3px);
}

.project-name {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.project-desc {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 14px;
  min-height: 42px;
}

.project-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.project-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--blue);
  background: rgba(91,155,213,0.1);
  padding: 3px 8px;
  border-radius: 5px;
}

/* ---------- Contact ---------- */
.contact-lead {
  color: var(--text-dim);
  font-size: 16px;
  max-width: 560px;
  margin-bottom: 28px;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.contact-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.15s;
}

.contact-card:hover { border-color: var(--gold-dim); }

.contact-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dimmer);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.contact-value {
  font-size: 15px;
  font-weight: 500;
}

/* ---------- Footer ---------- */
.footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 32px 24px;
  border-top: 1px solid var(--border);
  color: var(--text-dimmer);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* focus visibility */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}