/* ============================================================
   Dmitri Ivanov — CV / personal page
   Hand-authored CSS, no framework.
   ============================================================ */

:root {
  --bg: #0b0d10;
  --bg-elev: #12151a;
  --bg-elev-2: #171b21;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e9edf2;
  --text-muted: #a3adba;
  --text-dim: #6c7581;
  --accent: #ef7f4d;
  --accent-strong: #ff9463;
  --accent-ink: #2a1608;
  --ok: #7cc99a;
  --shadow: 0 20px 45px -20px rgba(0, 0, 0, 0.55);
  --radius-s: 10px;
  --radius-m: 16px;
  --radius-l: 26px;
  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --container: 1120px;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f6f4f0;
  --bg-elev: #ffffff;
  --bg-elev-2: #efece5;
  --border: rgba(20, 20, 20, 0.09);
  --border-strong: rgba(20, 20, 20, 0.16);
  --text: #191a1d;
  --text-muted: #565c66;
  --text-dim: #838993;
  --accent: #d9622c;
  --accent-strong: #b94f21;
  --accent-ink: #fff2ea;
  --ok: #2f8f5b;
  --shadow: 0 20px 45px -20px rgba(20, 15, 10, 0.18);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.35s ease, color 0.35s ease;
}

.wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 28px;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; margin: 0; }
p { margin: 0; }
a { color: inherit; }
ul { margin: 0; padding: 0; list-style: none; }
code { font-family: var(--font-mono); }
button { font-family: inherit; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--accent); color: #100a06; padding: 10px 16px; border-radius: 0 0 8px 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

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

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

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 150;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; gap: 24px;
  height: 68px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-display); font-weight: 600; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--bg-elev-2); border: 1px solid var(--border-strong);
  color: var(--accent); font-family: var(--font-mono); font-weight: 700; font-size: 0.8rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-name { font-size: 0.98rem; white-space: nowrap; }

.main-nav { display: flex; gap: 2px; margin-left: 4px; flex: 1; min-width: 0; }
.main-nav a {
  text-decoration: none; color: var(--text-muted); font-size: 0.87rem; font-weight: 500;
  padding: 8px 10px; border-radius: 8px; transition: color 0.2s, background 0.2s;
  position: relative; white-space: nowrap;
}
.main-nav a:hover { color: var(--text); background: var(--bg-elev); }
.main-nav a.is-active { color: var(--text); }
.main-nav a.is-active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px; height: 2px;
  background: var(--accent); border-radius: 2px;
}

.header-actions { display: flex; align-items: center; gap: 10px; }

.lang-switch {
  display: flex; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 30px; padding: 3px;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.03em;
}
.lang-btn {
  border: none; background: transparent; color: var(--text-dim); padding: 6px 11px; border-radius: 20px;
  cursor: pointer; transition: all 0.2s;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.is-active { background: var(--accent); color: #17100a; }

.icon-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text-muted);
  cursor: pointer; transition: all 0.2s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-moon { display: none; }
[data-theme="light"] .icon-moon { display: block; }
[data-theme="light"] .icon-sun { display: none; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  font-weight: 600; font-size: 0.9rem; padding: 12px 20px; border-radius: 12px;
  border: 1px solid transparent; cursor: pointer; transition: transform 0.15s ease, background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #17100a; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-text { background: transparent; color: var(--text-muted); padding: 12px 6px; }
.btn-text:hover { color: var(--text); }
.btn-sm { padding: 9px 16px; font-size: 0.82rem; }

.menu-toggle { display: none; flex-direction: column; gap: 4px; padding: 0; }
.menu-toggle span { width: 16px; height: 2px; background: currentColor; border-radius: 2px; transition: all 0.25s; }
.menu-toggle.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle.is-open span:nth-child(2) { opacity: 0; }
.menu-toggle.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.mobile-nav {
  display: none; flex-direction: column; gap: 2px; padding: 10px 28px 22px;
  border-top: 1px solid var(--border);
}
.mobile-nav a {
  text-decoration: none; color: var(--text-muted); padding: 12px 4px; font-weight: 500;
  border-bottom: 1px solid var(--border);
}
.mobile-nav a.btn { margin-top: 12px; border-bottom: none; text-align: center; justify-content: center; }
.mobile-nav.is-open { display: flex; }

@media (max-width: 1060px) {
  .main-nav, .header-actions .resume-link.btn-sm { display: none; }
  .menu-toggle { display: inline-flex; }
}

/* ---------- reveal-on-scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s ease; transition-delay: calc(var(--delay, 0) * 90ms); }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: 92px 0 70px;
  border-bottom: 1px solid var(--border);
}
#heroCanvas {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.55; pointer-events: none;
}
.hero-inner {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1.35fr 1fr; gap: 56px; align-items: center;
}
.eyebrow {
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.04em; color: var(--accent);
  margin-bottom: 18px; text-transform: uppercase;
}
.hero-name { font-size: clamp(2.4rem, 5.4vw, 3.6rem); margin-bottom: 14px; }
.hero-tagline { font-size: 1.12rem; color: var(--text-muted); max-width: 46ch; line-height: 1.55; margin-bottom: 26px; }

.hero-meta { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 30px; }
.meta-item { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--text-muted); }
.meta-item svg { color: var(--text-dim); flex-shrink: 0; }
.status-dot i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); flex-shrink: 0; }

.hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 44px; }

.hero-stats { display: flex; gap: 34px; flex-wrap: wrap; }
.stat-item { display: flex; flex-direction: column; }
.stat-value { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: 0.82rem; color: var(--text-dim); }

/* terminal card */
.terminal-card {
  background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: var(--radius-m);
  box-shadow: var(--shadow); overflow: hidden; font-family: var(--font-mono); font-size: 0.84rem;
}
.terminal-bar {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  background: var(--bg-elev-2); border-bottom: 1px solid var(--border);
}
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-r { background: #ff5f57; } .dot-y { background: #febc2e; } .dot-g { background: #28c840; }
.terminal-title { margin-left: 8px; color: var(--text-dim); font-size: 0.75rem; }
.terminal-body { padding: 20px 18px 24px; min-height: 150px; }
.term-line { margin-bottom: 14px; }
.term-line:last-child { margin-bottom: 0; }
.term-prompt { color: var(--accent); }
.term-cmd { color: var(--text); }
.term-out { color: var(--text-muted); display: block; margin-top: 4px; padding-left: 18px; }
.term-cursor { display: inline-block; width: 7px; height: 14px; background: var(--accent); margin-left: 4px; vertical-align: middle; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.scroll-hint {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 0.72rem; color: var(--text-dim); font-family: var(--font-mono); letter-spacing: 0.04em;
  animation: bob 2.2s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 6px); } }

@media (max-width: 480px) {
  .wrap { padding: 0 18px; }
  .header-actions { gap: 6px; }
  .lang-switch { padding: 2px; }
  .lang-btn { padding: 5px 8px; }
  .brand-name { display: none; }
}

@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-side { max-width: 420px; margin-top: 8px; }
  .scroll-hint { display: none; }
}

/* ---------- sections ---------- */
.section { padding: 96px 0; }
.section-alt { background: var(--bg-elev); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { max-width: 640px; margin-bottom: 48px; }
.kicker { font-family: var(--font-mono); color: var(--accent); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 12px; }
.section-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); margin-bottom: 14px; }
.section-lead { color: var(--text-muted); font-size: 1.02rem; line-height: 1.6; }
.mini-title { font-family: var(--font-display); font-size: 1rem; font-weight: 600; margin-bottom: 16px; display: block; }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 56px; }
.lead-text { font-size: 1.12rem; line-height: 1.65; margin-bottom: 18px; color: var(--text); }
.body-text { color: var(--text-muted); line-height: 1.7; margin-bottom: 34px; }
.check-list li { display: flex; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.95rem; line-height: 1.5; }
.check-list li:last-child { border-bottom: 1px solid var(--border); }
.check-list li::before {
  content: "→"; color: var(--accent); font-family: var(--font-mono); flex-shrink: 0; font-weight: 600;
}
.strength-list { display: flex; flex-direction: column; gap: 14px; }
.strength-card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-m); padding: 20px 22px;
  transition: border-color 0.25s, transform 0.25s;
}
.strength-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.strength-card h4 { font-family: var(--font-display); font-size: 1rem; margin-bottom: 6px; }
.strength-card p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.55; }

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

/* ---------- timeline ---------- */
.timeline { position: relative; padding-left: 32px; }
.timeline::before {
  content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px;
  background: linear-gradient(var(--border-strong), var(--border) 85%, transparent);
}
.timeline-item { position: relative; padding-bottom: 44px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: ""; position: absolute; left: -32px; top: 6px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.timeline-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 14px; margin-bottom: 6px; }
.timeline-role { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }
.timeline-company { color: var(--accent); font-weight: 600; }
.timeline-tag {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.03em; text-transform: uppercase;
  background: var(--accent-ink); color: var(--accent); padding: 3px 9px; border-radius: 20px; border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.timeline-sub { color: var(--text-dim); font-size: 0.86rem; margin-bottom: 16px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.timeline-bullets li {
  position: relative; padding: 7px 0 7px 20px; color: var(--text-muted); line-height: 1.55; font-size: 0.95rem;
}
.timeline-bullets li::before { content: "—"; position: absolute; left: 0; color: var(--text-dim); }
.timeline-bullets code {
  background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text);
  padding: 1px 6px; border-radius: 6px; font-size: 0.84em;
}

/* ---------- skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 52px; }
.skill-card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-m); padding: 24px;
  transition: border-color 0.25s, transform 0.25s;
}
.skill-card:hover { border-color: var(--border-strong); transform: translateY(-3px); }
.skill-card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.skill-card p { color: var(--text-muted); font-size: 0.87rem; line-height: 1.55; margin-bottom: 16px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  font-family: var(--font-mono); font-size: 0.74rem; padding: 5px 10px; border-radius: 7px;
  background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text-muted);
}
.tools-list { display: flex; flex-wrap: wrap; gap: 9px; }
.tools-list .tag { background: transparent; }

@media (max-width: 980px) { .skills-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .skills-grid { grid-template-columns: 1fr; } }

/* ---------- focus ---------- */
.focus-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 34px; }
.focus-card { border-top: 2px solid var(--accent); padding-top: 16px; }
.focus-num { font-family: var(--font-mono); color: var(--text-dim); font-size: 0.8rem; }
.focus-card h4 { font-family: var(--font-display); margin: 6px 0 8px; font-size: 1.02rem; }
.focus-card p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.55; }
.focus-extra {
  border: 1px dashed var(--border-strong); border-radius: var(--radius-m); padding: 20px 22px; color: var(--text-muted);
  font-size: 0.92rem; line-height: 1.6;
}
.focus-extra .mini-title { color: var(--text); margin-bottom: 8px; }

@media (max-width: 980px) { .focus-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .focus-grid { grid-template-columns: 1fr; } }

/* ---------- contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 24px; align-items: start; }
.contact-card, .languages-card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-l); padding: 30px;
}
.contact-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 26px; }
.contact-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.contact-row:last-child { border-bottom: none; }
.contact-row-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.contact-icon {
  width: 38px; height: 38px; border-radius: 10px; background: var(--bg-elev-2); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; color: var(--accent); flex-shrink: 0;
}
.contact-text { min-width: 0; }
.contact-label { font-size: 0.74rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.03em; font-family: var(--font-mono); }
.contact-value { font-weight: 600; text-decoration: none; color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-value:hover { color: var(--accent); }
.copy-btn {
  border: 1px solid var(--border); background: transparent; color: var(--text-dim); width: 34px; height: 34px;
  border-radius: 9px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: all 0.2s;
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.copy-btn.is-copied { color: var(--ok); border-color: var(--ok); }

.chip-list { display: flex; flex-direction: column; gap: 8px; }
.chip-list li { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 0.9rem; }
.chip-list li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

.lang-levels { display: flex; flex-direction: column; gap: 20px; }
.lang-row-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.lang-row-head strong { font-family: var(--font-display); font-size: 0.98rem; }
.lang-bar { display: flex; gap: 5px; margin-bottom: 6px; }
.lang-bar i { height: 6px; flex: 1; border-radius: 4px; background: var(--bg-elev-2); border: 1px solid var(--border); }
.lang-bar i.is-filled { background: var(--accent); border-color: var(--accent); }
.lang-note { color: var(--text-dim); font-size: 0.82rem; line-height: 1.4; }

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

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 34px 0; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; }
.footer-brand { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; color: var(--text-muted); }
.footer-brand .brand-mark { width: 28px; height: 28px; font-size: 0.68rem; }
.footer-made { color: var(--text-dim); font-size: 0.82rem; flex-basis: 100%; order: 3; }
.footer-top { text-decoration: none; color: var(--text-dim); font-size: 0.85rem; font-weight: 500; }
.footer-top:hover { color: var(--accent); }

@media print {
  .site-header, .scroll-hint, #heroCanvas, .progress-bar, .site-footer { display: none !important; }
  body { background: #fff; color: #111; }
}
