/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
  --bg: #f7f8fb;
  --bg-alt: #eef1f6;
  --surface: #ffffff;
  --border: #dfe3ea;
  --text: #0f1726;
  --text-2: #4a5568;
  --muted: #6b7686;
  --accent: #2f6bff;
  --accent-2: #00a3a3;
  --accent-soft: rgba(47, 107, 255, .1);
  --shadow: 0 1px 2px rgba(15, 23, 38, .04), 0 8px 24px rgba(15, 23, 38, .06);
  --grid: rgba(15, 23, 38, .06);

  --radius: 16px;
  --radius-sm: 10px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --container: 1120px;
  --nav-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f17;
    --bg-alt: #0f1520;
    --surface: #131a26;
    --border: #222c3b;
    --text: #e8edf5;
    --text-2: #b3bdcc;
    --muted: #8391a5;
    --accent: #6b9bff;
    --accent-2: #3dd6c6;
    --accent-soft: rgba(107, 155, 255, .12);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .25);
    --grid: rgba(255, 255, 255, .05);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b0f17;
  --bg-alt: #0f1520;
  --surface: #131a26;
  --border: #222c3b;
  --text: #e8edf5;
  --text-2: #b3bdcc;
  --muted: #8391a5;
  --accent: #6b9bff;
  --accent-2: #3dd6c6;
  --accent-soft: rgba(107, 155, 255, .12);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .25);
  --grid: rgba(255, 255, 255, .05);
  color-scheme: dark;
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.02em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
svg { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
strong { font-weight: 600; color: var(--text); }

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

.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.mt { margin-top: 28px; }

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  padding: 8px 14px; border-radius: 8px; background: var(--accent); color: #fff;
}
.skip-link:focus { top: 12px; }

.kicker {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: .02em;
}

/* ==========================================================================
   Nav
   ========================================================================== */
.nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.nav.is-scrolled { border-bottom-color: var(--border); }

.nav__inner {
  max-width: var(--container); height: 100%; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 24px;
}
.nav__logo { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.monogram {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 13px; font-weight: 800; letter-spacing: .02em;
}
.nav nav { margin-left: auto; }
.nav__links { display: flex; gap: 4px; }
.nav__links a {
  display: block; padding: 8px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: var(--text-2);
  transition: color .15s, background-color .15s;
}
.nav__links a:hover { color: var(--text); background: var(--accent-soft); }
.nav__links a.is-active { color: var(--accent); }

.nav__actions { display: flex; gap: 6px; }
.icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  cursor: pointer; transition: color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
.nav__burger { display: none; }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative; overflow: hidden;
  padding: 96px 0 72px;
  border-bottom: 1px solid var(--border);
}
.hero__grid {
  position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 30% 30%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 30% 30%, #000 30%, transparent 75%);
}
.hero__grid::after {
  content: ""; position: absolute; width: 560px; height: 560px; right: -120px; top: -160px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 28%, transparent), transparent 65%);
  filter: blur(20px);
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-family: var(--mono); font-size: 13px; color: var(--text-2);
}
.dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.hero__title {
  margin-top: 24px;
  font-size: clamp(44px, 8vw, 88px);
  font-weight: 800; letter-spacing: -.045em;
  background: linear-gradient(120deg, var(--text) 40%, var(--accent) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__lead {
  margin-top: 20px; max-width: 640px;
  font-size: clamp(17px, 2vw, 20px); color: var(--text-2);
}
.hero__meta {
  display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 20px;
  font-size: 14px; color: var(--muted);
}
.hero__meta span { display: inline-flex; align-items: center; gap: 8px; }

.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 46px; padding: 0 20px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: 600 15px var(--font); cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s, background-color .15s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--accent); box-shadow: var(--shadow); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn--ghost { background: transparent; }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin: 64px 0 0;
}
.stat {
  display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 6px;
  padding: 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
}
.stat dd { margin: 0; font-size: 36px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.stat dt { font-size: 13px; color: var(--muted); line-height: 1.4; }

/* ==========================================================================
   Sections
   ========================================================================== */
.section { padding: 96px 0; }
.section--alt { background: var(--bg-alt); border-block: 1px solid var(--border); }

.section__head { margin-bottom: 48px; }
.section__head h2 { margin-top: 10px; font-size: clamp(28px, 4vw, 40px); font-weight: 800; }
.section__sub { margin-top: 12px; color: var(--muted); }

.two-col { display: grid; grid-template-columns: 5fr 7fr; gap: 48px; }
.two-col .section__head { margin: 0; }

.prose { display: grid; gap: 18px; font-size: 17px; color: var(--text-2); }
.goal {
  display: grid; gap: 4px;
  padding: 18px 20px; border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  color: var(--text); font-weight: 500;
}

/* Highlights */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card {
  padding: 28px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.card h3 { margin-top: 18px; font-size: 18px; }
.card p { margin-top: 10px; font-size: 15px; color: var(--text-2); }
.card__icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
}
.card__icon svg { width: 22px; height: 22px; }
.card--accent {
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, var(--accent), var(--accent-2)) border-box;
  border: 1px solid transparent;
}

/* Timeline */
.timeline { display: grid; gap: 28px; }
.company {
  padding: 32px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
}
.company__head { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.company__head h3 { font-size: 22px; }
.company__head p { margin-top: 2px; font-size: 14px; }
.company__logo {
  display: grid; place-items: center; flex-shrink: 0;
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--bg-alt); border: 1px solid var(--border);
  font-weight: 800; color: var(--accent);
}

.roles { position: relative; display: grid; gap: 28px; padding-left: 28px; }
.roles::before {
  content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px;
  background: linear-gradient(var(--accent), var(--border));
  border-radius: 2px;
}
.role { position: relative; }
.role::before {
  content: ""; position: absolute; left: -28px; top: 6px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent);
}
.role--current::before { background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.role__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.role__head h4 { font-size: 17px; }
.role__date { font-family: var(--mono); font-size: 13px; color: var(--muted); white-space: nowrap; }
.role > p { margin-top: 8px; color: var(--text-2); font-size: 15px; }
.role > ul:not(.tags) { margin-top: 10px; display: grid; gap: 6px; }
.role > ul:not(.tags) li {
  position: relative; padding-left: 18px; color: var(--text-2); font-size: 15px;
}
.role > ul:not(.tags) li::before {
  content: ""; position: absolute; left: 2px; top: .7em;
  width: 6px; height: 2px; background: var(--accent); border-radius: 1px;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tags li {
  padding: 3px 10px; border-radius: 999px;
  font-family: var(--mono); font-size: 12px; color: var(--text-2);
  background: var(--bg-alt); border: 1px solid var(--border);
}

/* Skills */
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.skill-group {
  padding: 24px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
}
.skill-group h3 { font-size: 16px; }
.tags--lg li { font-size: 13px; padding: 5px 12px; }

/* Linked tags: the whole pill is the link */
.tags li:has(> a) { padding: 0; transition: border-color .15s, color .15s; }
.tags li > a { display: block; padding: 3px 10px; border-radius: inherit; }
.tags--lg li > a { padding: 5px 12px; }
.tags li:has(> a):hover { border-color: var(--accent); color: var(--accent); }
.tags li > a::after {
  content: "↗"; display: inline-block; margin-left: 4px;
  font-size: .85em; opacity: 0; transform: translate(-2px, 1px);
  transition: opacity .15s, transform .15s;
}
.tags li > a:hover::after, .tags li > a:focus-visible::after { opacity: .8; transform: none; }
.legend { display: flex; align-items: center; gap: 8px; margin-top: 20px; font-size: 13px; color: var(--muted); }

/* Learning */
.learning { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.learning h3 { font-size: 16px; margin-bottom: 14px; }
.list { display: grid; }
.list li {
  display: grid; gap: 2px; padding: 12px 0;
  border-bottom: 1px solid var(--border); font-weight: 500;
}
.list li:first-child { padding-top: 0; }
.list__meta { font-size: 13px; font-weight: 400; color: var(--muted); }

.list--links li:has(> a) { padding: 0; }
.list--links li:has(> a):first-child > a { padding-top: 0; }
.list--links a {
  position: relative; display: grid; gap: 2px; padding: 12px 28px 12px 0;
  transition: color .15s;
}
.list--links a::after {
  content: "↗"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  color: var(--muted); transition: color .15s, transform .15s;
}
.list--links li:first-child > a::after { top: calc(50% - 6px); }
.list--links a:hover { color: var(--accent); }
.list--links a:hover::after { color: var(--accent); transform: translate(2px, calc(-50% - 2px)); }

.lang-btn { width: auto; min-width: 38px; padding: 0 10px; font: 600 13px var(--mono); }

.langs { display: grid; gap: 14px; }
.langs li { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 4px 12px; font-weight: 500; }
.langs .list__meta { grid-column: 2; }
.bar {
  position: relative; height: 6px; border-radius: 3px; background: var(--bg-alt); border: 1px solid var(--border); overflow: hidden;
}
.bar::after {
  content: ""; position: absolute; inset: 0; width: var(--v);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* Contact */
.section--contact { background: var(--bg-alt); border-top: 1px solid var(--border); }
.contact { text-align: center; }
.contact h2 { margin-top: 10px; font-size: clamp(32px, 5vw, 52px); font-weight: 800; }
.contact__lead { max-width: 560px; margin: 16px auto 0; color: var(--text-2); font-size: 17px; }
.contact__email {
  display: inline-block; margin-top: 32px;
  font-size: clamp(20px, 3.4vw, 32px); font-weight: 700; letter-spacing: -.02em;
  color: var(--accent); border-bottom: 2px solid var(--accent-soft);
  transition: border-color .2s;
  overflow-wrap: anywhere;
}
.contact__email:hover { border-color: var(--accent); }
.socials { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 32px; }
.socials a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 14px; font-weight: 500; color: var(--text-2);
  transition: color .15s, border-color .15s;
}
.socials a:hover { color: var(--accent); border-color: var(--accent); }

.footer { padding: 28px 0; font-size: 14px; color: var(--muted); border-top: 1px solid var(--border); }
.footer__inner { display: flex; justify-content: space-between; gap: 16px; }
.footer__top:hover { color: var(--accent); }
.footer__inner { align-items: center; }
.footer__views { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 13px; }
.footer__views[hidden] { display: none; }

/* Reveal on scroll (only when JS is running) */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .card, .btn { transition: none; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 960px) {
  .cards, .skills { grid-template-columns: repeat(2, 1fr); }
  .learning { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; gap: 24px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .nav__name { display: none; }
  .nav__burger { display: grid; }
  .nav__actions { margin-left: auto; }
  .nav nav { margin: 0; }
  .nav__links {
    position: absolute; left: 0; right: 0; top: var(--nav-h);
    flex-direction: column; gap: 0; padding: 8px 16px 16px;
    background: var(--bg); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: none;
  }
  .nav__links.is-open { display: flex; }
  .nav__links a { padding: 12px; font-size: 16px; }
}

@media (max-width: 640px) {
  .container, .nav__inner { padding: 0 16px; }
  .section { padding: 64px 0; }
  .hero { padding: 56px 0 48px; }
  .stats { margin-top: 40px; gap: 10px; }
  .stat { padding: 16px; }
  .stat dd { font-size: 28px; }
  .cards, .skills, .learning { grid-template-columns: 1fr; }
  .footer__inner { flex-wrap: wrap; row-gap: 8px; }
  .footer__views { order: 3; flex-basis: 100%; }
  .company { padding: 20px; }
  .roles { padding-left: 24px; }
  .role::before { left: -24px; }
  .btn { flex: 1 1 auto; justify-content: center; }
}

/* ==========================================================================
   Print: turns the page into a compact one-column CV
   ========================================================================== */
@media print {
  :root, :root[data-theme="dark"] {
    --bg: #fff; --bg-alt: #fff; --surface: #fff; --border: #d5d9e0;
    --text: #000; --text-2: #222; --muted: #555; --accent: #1f4fd1; --accent-soft: transparent;
    color-scheme: light;
  }
  @page { margin: 12mm 14mm; }
  body { font-size: 9.5pt; line-height: 1.4; }
  .nav, .skip-link, .hero__cta, .hero__grid, .footer, .legend, .contact__lead, .kicker,
  .stats, .dot, #highlights, .company__logo { display: none !important; }
  .js .reveal { opacity: 1; transform: none; }
  h2, h3, h4 { break-after: avoid; }

  .hero { padding: 0 0 6pt; border: 0; }
  .eyebrow { border: 0; padding: 0; font-size: 10pt; }
  .hero__title { margin-top: 2pt; font-size: 24pt; color: #000; background: none; -webkit-text-fill-color: #000; }
  .hero__lead { font-size: 10.5pt; margin-top: 4pt; max-width: none; }
  .hero__meta { margin-top: 4pt; font-size: 9pt; }
  .hero__meta::after { content: "ali.artukov@gmail.com · linkedin.com/in/aliartukov"; }

  .section, .section--alt, .section--contact { padding: 8pt 0; border: 0; }
  .section__head { margin-bottom: 6pt; }
  .section__head h2 { margin: 0; font-size: 13pt; }
  .section__sub { margin-top: 2pt; }
  .two-col { grid-template-columns: 1fr; gap: 4pt; }
  .two-col .section__head h2 { font-size: 13pt; }
  .prose { font-size: 9.5pt; gap: 4pt; }
  .goal { padding: 0; border: 0; }

  .timeline { gap: 10pt; }
  .company { padding: 0; border: 0; }
  .company__head { margin-bottom: 6pt; break-after: avoid; }
  .company__head h3 { font-size: 12pt; }
  .company__head p { font-size: 9pt; }
  .roles { gap: 6pt; padding-left: 16pt; }
  .role::before { left: -16pt; width: 9px; height: 9px; top: 4px; }
  .roles::before { left: 3px; }
  .role { break-inside: avoid; }
  .role__head h4 { font-size: 10pt; }
  .role > p, .role > ul:not(.tags) li { font-size: 9.5pt; }
  .role > ul:not(.tags) { margin-top: 3pt; gap: 1pt; }

  /* Tags print as a plain comma-separated line */
  .tags { display: block; margin-top: 3pt; color: var(--muted); font-size: 9pt; }
  .tags li, .tags li:has(> a) { display: inline; padding: 0; border: 0; background: none; font: inherit; color: inherit; }
  .tags li > a { display: inline; padding: 0; }
  .tags li:not(:last-child)::after { content: ", "; }
  .tags li > a::after, .list--links a::after { content: none; }

  .skills { grid-template-columns: 1fr 1fr 1fr; gap: 8pt 14pt; }
  .skill-group { padding: 0; border: 0; break-inside: avoid; }
  .skill-group h3 { font-size: 10pt; }

  .learning { grid-template-columns: 1fr 1fr 1fr; gap: 14pt; }
  .learning__col { break-inside: avoid; }
  .learning h3 { font-size: 10pt; margin-bottom: 4pt; }
  .mt { margin-top: 8pt; }
  .list li, .list--links a { display: block; padding: 1.5pt 0; }
  .list li { border-bottom: 0; }
  .list__meta { font-size: 8.5pt; }
  .list__meta::before { content: " · "; }
  .list--links li:has(> a) { padding: 0; }
  .langs { gap: 3pt; }
  .langs li { display: flex; gap: 6pt; }
  .bar { display: none; }

  /* Contacts are already in the header line */
  #contact { display: none; }
  .card, .card:hover { box-shadow: none; transform: none; }
}
