/* ===========================================================
   Anvar Jamgirov — Portfolio
   Minimalist single-page CV. Plain CSS, no framework.
   Theme tokens live in :root and [data-theme="light"].
   =========================================================== */

/* ----- Theme tokens (dark by default) ----- */
:root {
  --bg:            #0d1117;
  --bg-soft:       #161b22;
  --bg-card:       #161b22;
  --border:        #21262d;
  --text:          #c9d1d9;
  --text-strong:   #f0f6fc;
  --text-muted:    #8b949e;
  --accent:        #58a6ff;
  --accent-soft:   rgba(88, 166, 255, 0.12);
  --shadow:        0 10px 30px -15px rgba(0, 0, 0, 0.7);

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  --max-width: 1080px;
  --radius: 12px;
  --transition: 0.25s ease;
}

[data-theme="light"] {
  --bg:            #ffffff;
  --bg-soft:       #f6f8fa;
  --bg-card:       #ffffff;
  --border:        #d0d7de;
  --text:          #424a53;
  --text-strong:   #1f2328;
  --text-muted:    #656d76;
  --accent:        #0969da;
  --accent-soft:   rgba(9, 105, 218, 0.10);
  --shadow:        0 10px 30px -18px rgba(31, 35, 40, 0.35);
}

/* ----- Reset ----- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; overflow-x: hidden; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
  width: 100%;
}

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

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--text-strong); }

ul { list-style: none; }

h1, h2, h3 { color: var(--text-strong); line-height: 1.2; }

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 999;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ----- Layout ----- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.section { padding-block: 5.5rem; }

.section__title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  margin-bottom: 2.5rem;
}
.section__title.centered { justify-content: center; }
.section__num {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 1rem;
  font-weight: 500;
}
.section__title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
  max-width: 240px;
}
.section__title.centered::after { display: none; }

/* ----- Header / Nav ----- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav__logo {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--text-strong);
}
.nav__logo span { color: var(--accent); }

.nav__menu {
  display: flex;
  align-items: center;
  gap: 1.8rem;
}
.nav__menu a {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
}
.nav__menu a:hover { color: var(--accent); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.icon-moon { display: none; }
[data-theme="light"] .icon-sun  { display: none; }
[data-theme="light"] .icon-moon { display: block; }

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav__toggle span {
  width: 24px;
  height: 2px;
  background: var(--text-strong);
  transition: transform var(--transition), opacity var(--transition);
}

/* ----- Hero ----- */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 3rem;
  align-items: center;
  min-height: calc(100vh - 64px);
  padding-block: 3rem;
}

.hero__eyebrow {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}
.hero__title {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1.2rem;
}
.accent { color: var(--accent); }
.hero__lead {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 34ch;
  margin-bottom: 2rem;
}

.hero__actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.hero__socials {
  display: flex;
  gap: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
}
.hero__socials a { color: var(--text-muted); }
.hero__socials a:hover { color: var(--accent); }

/* Code card */
.hero__card { display: flex; justify-content: center; }
.code-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.code-card__bar {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.code-card__bar span {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--border);
}
.code-card__bar span:nth-child(1) { background: #ff5f56; }
.code-card__bar span:nth-child(2) { background: #ffbd2e; }
.code-card__bar span:nth-child(3) { background: #27c93f; }
.code-card__body {
  padding: 1.2rem 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.7;
  overflow-x: auto;
  color: var(--text);
}
.tok-kw   { color: #ff7b72; }
.tok-cls  { color: #f0c674; }
.tok-fn   { color: #d2a8ff; }
.tok-str  { color: #a5d6ff; }
.tok-var  { color: #79c0ff; }
.tok-bool { color: #ff7b72; }
.tok-cmt  { color: var(--text-muted); font-style: italic; }
[data-theme="light"] .tok-kw   { color: #cf222e; }
[data-theme="light"] .tok-cls  { color: #953800; }
[data-theme="light"] .tok-fn   { color: #8250df; }
[data-theme="light"] .tok-str  { color: #0a3069; }
[data-theme="light"] .tok-var  { color: #0969da; }
[data-theme="light"] .tok-bool { color: #cf222e; }

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform var(--transition), background var(--transition), color var(--transition), border-color var(--transition);
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { color: #fff; opacity: 0.92; }
.btn--ghost { border-color: var(--accent); color: var(--accent); background: transparent; }
.btn--ghost:hover { background: var(--accent-soft); color: var(--accent); }
.btn--lg { padding: 0.9rem 2.2rem; font-size: 1rem; }

/* ----- About ----- */
.about {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 3rem;
  align-items: start;
}
.about__text p + p { margin-top: 1rem; }
.about__facts {
  display: grid;
  gap: 1rem;
}
.fact {
  display: flex;
  flex-direction: column;
  padding: 1.2rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.fact__num { font-size: 1.8rem; font-weight: 800; color: var(--accent); }
.fact__label { color: var(--text-muted); font-size: 0.9rem; }

/* ----- Skills ----- */
.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}
.skill-group {
  padding: 1.5rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform var(--transition), border-color var(--transition);
}
.skill-group:hover { transform: translateY(-4px); border-color: var(--accent); }
.skill-group h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--accent);
  font-family: var(--font-mono);
}
.skill-group ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.skill-group li {
  font-size: 0.85rem;
  padding: 0.3rem 0.7rem;
  background: var(--accent-soft);
  color: var(--text-strong);
  border-radius: 6px;
}

/* ----- Timeline / Experience ----- */
.timeline { position: relative; }
.timeline__item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1.5rem;
  padding-bottom: 2.5rem;
  position: relative;
}
.timeline__item:last-child { padding-bottom: 0; }
.timeline__date {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.timeline__body {
  border-left: 2px solid var(--border);
  padding-left: 1.5rem;
  position: relative;
}
.timeline__body::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}
.timeline__body h3 { font-size: 1.15rem; margin-bottom: 0.6rem; }
.timeline__co { color: var(--accent); font-weight: 500; }
.timeline__body ul { margin: 0.6rem 0; }
.timeline__body li {
  position: relative;
  padding-left: 1.2rem;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
}
.timeline__body li::before {
  content: "▹";
  position: absolute;
  left: 0;
  color: var(--accent);
}
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }
.tags span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 5px;
}

/* ----- Projects ----- */
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.project {
  display: flex;
  flex-direction: column;
  padding: 1.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.project:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.project__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}
.project__folder { color: var(--accent); }
.project__links { display: flex; gap: 0.8rem; }
.project__links a { color: var(--text-muted); display: grid; place-items: center; }
.project__links a:hover { color: var(--accent); transform: translateY(-2px); }
.project__title { font-size: 1.2rem; margin-bottom: 0.7rem; }
.project__desc { color: var(--text-muted); font-size: 0.95rem; flex: 1; }
.project__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ----- Contact ----- */
.section--contact { text-align: center; max-width: 640px; }
.contact__lead { color: var(--text-muted); margin-bottom: 2rem; }
.contact__socials {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 2.5rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}
.contact__socials a { color: var(--text-muted); }
.contact__socials a:hover { color: var(--accent); }

/* ----- Footer ----- */
.footer {
  text-align: center;
  padding-block: 2rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
}

/* ----- Scroll reveal ----- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ----- Responsive ----- */
@media (max-width: 820px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-block: 3rem 4rem;
    text-align: left;
  }
  .hero__card { order: -1; }
  .code-card { max-width: 360px; }
  .about { grid-template-columns: 1fr; }
  .about__facts { grid-template-columns: repeat(3, 1fr); }

  /* backdrop-filter establishes a containing block that traps the fixed
     drawer inside the 64px header — disable it on mobile, use a solid bg */
  .site-header {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--bg);
  }

  .nav__toggle { display: flex; z-index: 110; }
  .nav__menu {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(75vw, 300px);
    flex-direction: column;
    justify-content: center;
    gap: 2rem;
    background: var(--bg-soft);
    border-left: 1px solid var(--border);
    box-shadow: -10px 0 30px -15px rgba(0, 0, 0, 0.5);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform var(--transition), visibility var(--transition);
  }
  .nav__menu.is-open { transform: translateX(0); visibility: visible; }
  .nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* ----- Education ----- */
.education { margin-top: 3rem; }
.education__title {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 1rem;
  margin-bottom: 1.2rem;
}
.education__item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1.5rem;
}
.education__date { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-muted); }
.education__item strong { color: var(--text-strong); }
.education__item p { color: var(--text-muted); }

/* ----- Spoken languages line ----- */
.about__langs { margin-top: 1.4rem; color: var(--text-muted); font-size: 0.95rem; }
.about__langs strong { color: var(--text-strong); }

@media (max-width: 540px) {
  .timeline__item { grid-template-columns: 1fr; gap: 0.5rem; }
  .education__item { grid-template-columns: 1fr; gap: 0.4rem; }
  .about__facts { grid-template-columns: 1fr; }
  .section { padding-block: 4rem; }
}
