/* =========================================================
   Муминов Рустам — Резюме
   Design system: ElevenLabs (warm cream editorial, whisper type)
   Fonts: Inter (Waldenburg substitute) + JetBrains Mono (Geist Mono role)
   ========================================================= */

:root {
  /* Colors */
  --color-eggshell: #fdfcfc;
  --color-warm-taupe: #f5f3f1;
  --color-stone: #ebe8e4;
  --color-ink: #000000;
  --color-graphite: #44403b;
  --color-smoke: #777169;
  --color-ash: #a59f97;
  --color-violet-spark: #0447ff;
  --color-ember-orange: #ff4704;

  /* Type */
  --font-display: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Spacing */
  --sp-4: 4px;  --sp-8: 8px;   --sp-12: 12px; --sp-16: 16px;
  --sp-20: 20px; --sp-24: 24px; --sp-32: 32px; --sp-40: 40px;
  --sp-48: 48px; --sp-56: 56px; --sp-64: 64px; --sp-72: 72px; --sp-96: 96px;

  /* Radius */
  --radius-card: 20px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  --radius-sm: 4px;

  /* Shadow */
  --shadow-subtle: rgba(0,0,0,0.4) 0 0 1px 0, rgba(0,0,0,0.04) 0 1px 1px 0, rgba(0,0,0,0.04) 0 2px 4px 0;

  --page-max: 1120px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Dark theme ----------
   Warm editorial mirror of the light system: no pure black (canvas is a warm
   near-black), text is warm off-white, hairlines stay warm. The violet/ember
   sparks are unchanged — they only glow behind the avatar. Activated solely via
   <html data-theme="dark"> set by JS (sunset-driven), never by OS preference. */
:root[data-theme="dark"] {
  --color-eggshell: #100f0e;   /* canvas */
  --color-warm-taupe: #1b1917; /* surfaces: plates, tag chips */
  --color-stone: #2c2926;      /* hairlines, dividers */
  --color-ink: #f6f4f1;        /* primary text & light fills (monogram, bullets) */
  --color-graphite: #cec8c0;   /* strong secondary text */
  --color-smoke: #9c968d;      /* body / muted */
  --color-ash: #6f6a62;        /* faintest helper text */
  --shadow-subtle: rgba(0,0,0,0.6) 0 2px 10px 0, rgba(255,255,255,0.05) 0 0 0 1px inset;
}
:root[data-theme="dark"] .topbar.is-stuck {
  background: rgba(16, 15, 14, 0.72);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.16px;
  color: var(--color-graphite);
  background: var(--color-eggshell);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { list-style: none; padding: 0; }
a { color: inherit; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--color-ink); color: var(--color-eggshell);
  padding: var(--sp-8) var(--sp-16); border-radius: 0 0 var(--radius-sm) 0;
  z-index: 100; font-size: 14px;
}
.skip-link:focus { left: 0; }

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

/* ---------- Page shell ---------- */
.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--sp-32);
}

/* ---------- Sticky top panel ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-16);
  height: 64px;
  margin: 0 calc(-1 * var(--sp-32));
  padding: 0 var(--sp-32);
  border-bottom: 1px solid transparent;
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease), backdrop-filter 0.35s var(--ease), opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
/* Soft blur (never a shadow) once the page is scrolled */
.topbar.is-stuck {
  background: rgba(253, 252, 252, 0.72);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  backdrop-filter: blur(18px) saturate(1.6);
  border-bottom-color: var(--color-stone);
}
.topbar__mark {
  display: flex; align-items: center; gap: var(--sp-12); min-width: 0;
  cursor: pointer; background: none; border: 0; padding: 0;
  font: inherit; color: inherit; text-align: left;
}
.topbar__avatar {
  width: 40px; height: 40px; border-radius: var(--radius-full);
  object-fit: cover; object-position: center 18%;
  flex: none;
}
.topbar__name {
  font-size: 15px; font-weight: 600; color: var(--color-ink);
  letter-spacing: -0.01em; white-space: nowrap;
}

/* Desktop: the panel stays hidden until the hero title is scrolled past. */
@media (min-width: 621px) {
  .topbar.is-atop {
    opacity: 0;
    transform: translateY(-100%);
    pointer-events: none;
  }
}

/* Contacts hidden at the top, revealed when the panel is stuck */
.topbar__contacts {
  display: flex; align-items: center; gap: var(--sp-24);
  font-size: 14px; font-weight: 500; color: var(--color-graphite);
  opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
.topbar.is-stuck .topbar__contacts { opacity: 1; transform: none; pointer-events: auto; }
.topbar__contacts a { position: relative; white-space: nowrap; transition: color 0.2s var(--ease); }
.topbar__contacts a::after {
  content: ""; position: absolute; left: 0; bottom: -3px; width: 100%; height: 1px;
  background: var(--color-ink); transform: scaleX(0); transform-origin: left;
  transition: transform 0.25s var(--ease);
}
.topbar__contacts a:hover { color: var(--color-ink); }
.topbar__contacts a:hover::after { transform: scaleX(1); }

.monogram {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: var(--radius-full);
  background: var(--color-ink); color: var(--color-eggshell);
  font-size: 11px; font-weight: 500; letter-spacing: 0.5px;
}
.monogram--sm { width: 28px; height: 28px; font-size: 11px; }

/* ---------- Resume grid (mirrors the reference two-column layout) ---------- */
.resume {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 0;
  padding: var(--sp-48) 0 var(--sp-72);
}
.main { padding-right: var(--sp-56); min-width: 0; }
.sidebar {
  padding-left: var(--sp-48);
  border-left: 1px solid var(--color-stone);
  min-width: 0;
}

/* ---------- Hero ---------- */
.name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(48px, 8.4vw, 82px);
  line-height: 0.94;
  letter-spacing: -0.035em;
  color: var(--color-ink);
  margin-top: var(--sp-24);
  margin-bottom: var(--sp-24);
}
.name__line { display: block; }
.role {
  font-size: 18px; font-weight: 500;
  color: var(--color-graphite);
  letter-spacing: 0.1px;
  margin-bottom: var(--sp-24);
}
.summary {
  font-size: 16px; line-height: 1.6;
  color: var(--color-smoke);
  max-width: 60ch;
  margin-bottom: var(--sp-40);
}

/* Stat rail */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-24);
  padding: var(--sp-24) 0 var(--sp-8);
}
.stat { display: flex; flex-direction: column; gap: var(--sp-8); }
.stat__value {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(20px, 2.3vw, 26px); line-height: 1.1;
  letter-spacing: -0.03em; color: var(--color-ink);
  white-space: nowrap;
}
.stat__label {
  font-family: var(--font-mono); font-size: 11px; font-weight: 400;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--color-ash);
  order: 2;
}

/* ---------- Rules ---------- */
.rule { height: 1px; background: var(--color-stone); margin: var(--sp-48) 0; }
.rule--soft { background: var(--color-stone); margin: var(--sp-32) 0; opacity: 0.7; }

/* ---------- Blocks ---------- */
.block__title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.1; letter-spacing: -0.02em;
  color: var(--color-ink);
  margin-bottom: var(--sp-40);
}

/* ---------- Job ---------- */
.job { padding: 0; }
.job__head { margin-bottom: var(--sp-20); }
.job__meta {
  font-family: var(--font-mono);
  font-size: 13px; color: var(--color-smoke);
  letter-spacing: 0.3px; margin-bottom: var(--sp-8);
}
.job__company {
  font-size: 20px; font-weight: 500; color: var(--color-ink);
  letter-spacing: -0.01em; margin-bottom: var(--sp-4);
}
.job__role {
  font-size: 15px; font-weight: 400; color: var(--color-graphite);
}
.duties, .wins { display: flex; flex-direction: column; gap: var(--sp-12); }
.duties li, .wins li {
  position: relative; padding-left: var(--sp-24);
  font-size: 15px; line-height: 1.55; color: var(--color-smoke);
}
.duties li::before {
  content: ""; position: absolute; left: 2px; top: 10px;
  width: 5px; height: 5px; border-radius: var(--radius-full);
  border: 1px solid var(--color-ash);
}
.wins__label {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--color-graphite);
  margin: var(--sp-24) 0 var(--sp-16);
}
.wins li { color: var(--color-graphite); }
.wins li::before {
  content: ""; position: absolute; left: 0; top: 9px;
  width: 6px; height: 6px; border-radius: var(--radius-full);
  background: var(--color-ink);
}
.wins strong { font-weight: 500; color: var(--color-ink); }

/* Achievements highlighted on an ElevenLabs taupe plate */
.wins-plate {
  margin-top: var(--sp-24);
  padding: var(--sp-24) var(--sp-32);
  background: var(--color-warm-taupe);
  border-radius: var(--radius-card);
}
.wins-plate .wins__label { margin-top: 0; }
.wins-plate .wins li:last-child { padding-bottom: 0; }
@media (max-width: 560px) {
  .wins-plate { padding: var(--sp-20); }
}

/* ---------- Sidebar avatar ---------- */
.avatar-wrap { position: relative; width: 220px; max-width: 100%; margin-bottom: var(--sp-40); }
.avatar__glow {
  position: absolute; z-index: 0;
  inset: -8% -8% auto -8%; height: 100%;
  border-radius: var(--radius-full);
  background: radial-gradient(60% 60% at 30% 30%, var(--color-ember-orange), transparent 70%),
             radial-gradient(60% 60% at 75% 65%, var(--color-violet-spark), transparent 72%);
  filter: blur(32px);
  opacity: 0.3;
}
.avatar {
  position: relative; z-index: 1;
  display: block; width: 100%;
  aspect-ratio: 1 / 1; object-fit: cover; object-position: center 15%;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-subtle);
  margin-bottom: var(--sp-16);
}
.avatar__caption {
  position: relative; z-index: 1;
  font-family: var(--font-mono);
  font-size: 11px; color: var(--color-ash);
  letter-spacing: 0.4px;
}

.side { }
.side__title {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--color-graphite);
  margin-bottom: var(--sp-16);
}

.contacts { display: flex; flex-direction: column; gap: var(--sp-12); }
.contacts li { display: flex; flex-direction: column; gap: 2px; }
.contacts__k {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--color-ash);
}
.contacts a, .contacts li > span:last-child {
  font-size: 15px; color: var(--color-ink); width: fit-content;
}
.contacts a {
  position: relative;
  transition: color 0.2s var(--ease);
}
.contacts a::after {
  content: ""; position: absolute; left: 0; bottom: -2px;
  width: 100%; height: 1px; background: var(--color-ink);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.25s var(--ease);
}
.contacts a:hover::after { transform: scaleX(1); }

.langs { display: flex; flex-direction: column; gap: var(--sp-8); }
.langs li { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; color: var(--color-ink); }
.langs__lvl { font-size: 13px; color: var(--color-smoke); }

.tags { display: flex; flex-wrap: wrap; gap: var(--sp-8); }
.tags li {
  font-size: 13px; color: var(--color-graphite);
  padding: 6px var(--sp-12);
  background: var(--color-warm-taupe);
  border-radius: var(--radius-full);
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}
.tags li:hover { background: var(--color-stone); transform: translateY(-1px); }

.skills { display: flex; flex-direction: column; }
.skills li {
  font-size: 15px; color: var(--color-graphite);
  padding: var(--sp-12) 0;
  border-bottom: 1px solid var(--color-stone);
  transition: color 0.2s var(--ease), padding-left 0.2s var(--ease);
}
.skills li:last-child { border-bottom: none; }
.skills li:hover { color: var(--color-ink); padding-left: var(--sp-8); }

/* ---------- Footer ---------- */
.footer { padding-bottom: var(--sp-48); }
.footer .rule { margin: 0 0 var(--sp-24); }
.footer__row {
  display: flex; align-items: center; gap: var(--sp-16);
  font-size: 13px; color: var(--color-smoke);
}
.footer__row p { flex: 1; }
.footer__top {
  font-size: 13px; color: var(--color-graphite);
  transition: color 0.2s var(--ease);
}
.footer__top:hover { color: var(--color-ink); }

/* ---------- Theme toggle (sun / moon) ---------- */
.theme-toggle {
  position: fixed; right: var(--sp-24); bottom: var(--sp-24); z-index: 60;
  width: 44px; height: 44px; border-radius: var(--radius-full);
  display: grid; place-items: center;
  background: var(--color-eggshell); color: var(--color-graphite);
  border: 1px solid var(--color-stone);
  box-shadow: var(--shadow-subtle);
  cursor: pointer;
  transition: transform 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.theme-toggle:hover { transform: translateY(-2px); color: var(--color-ink); border-color: var(--color-ash); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle__sun { display: none; }
.theme-toggle__moon { display: block; }
:root[data-theme="dark"] .theme-toggle__moon { display: none; }
:root[data-theme="dark"] .theme-toggle__sun { display: block; }
@media (max-width: 560px) {
  .theme-toggle { right: var(--sp-16); bottom: var(--sp-16); width: 40px; height: 40px; }
}

/* ---------- Reveal animation ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
[data-reveal].is-in {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .topbar__mail { display: none; }
}
@media (max-width: 880px) {
  .resume {
    grid-template-columns: 1fr;
    padding-top: var(--sp-32);
  }
  .main { padding-right: 0; }
  .sidebar {
    padding-left: 0; border-left: none;
    border-top: 1px solid var(--color-stone);
    margin-top: var(--sp-48); padding-top: var(--sp-48);
  }
  .avatar-wrap { width: 200px; }
}

@media (max-width: 620px) {
  /* On mobile the pinned panel keeps only the phone number on the right */
  .topbar__contacts a:not(.topbar__tel) { display: none; }
  /* Panel slides away while the Контакты block is on screen, returns after it */
  .topbar.is-hidden {
    opacity: 0;
    transform: translateY(-100%);
    pointer-events: none;
  }
}
@media (max-width: 560px) {
  .page { padding: 0 var(--sp-20); }
  .topbar { margin: 0 calc(-1 * var(--sp-20)); padding: 0 var(--sp-20); }
  .stats { grid-template-columns: repeat(2, 1fr); gap: var(--sp-20); }
  .name { font-size: clamp(40px, 13vw, 60px); }
}
