/* ============================================
   Ренат Губаев — тёмная тема, спокойный тон
   ============================================ */

:root {
  --bg: #09090b;
  --bg-alt: #0f0f14;
  --surface: #16161d;
  --border: #23232f;
  --border-hover: #3a3a50;
  --text: #c8c8d4;
  --text-dim: #8a8a9e;
  --text-bright: #f0f0f4;
  --accent: #7c6cff;
  --accent-green: #22c997;
  --accent-glow: rgba(124, 108, 255, 0.12);
  --green-glow: rgba(34, 201, 151, 0.12);
  --link: #8a7eff;
  --radius: 10px;
  --transition: 0.2s ease;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --max-w: 880px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: #fff; }

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

a { color: var(--link); text-decoration: underline; text-decoration-color: rgba(138, 126, 255, 0.3); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--link); }

.nav a, .contact-link, .footer a, .card__link, .card__links a, .project__head a { text-decoration: none; }
.nav a:hover, .footer a:hover, .card__link:hover, .card__links a:hover, .project__head a:hover { text-decoration: underline; }
.contact-link:hover { text-decoration: none; }

/* ---- Nav ---- */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav__container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
}
.nav__brand:hover { color: var(--text-bright); text-decoration: none; }

.nav__icon { opacity: 0.6; }
.nav__brand:hover .nav__icon { opacity: 1; }

.nav__menu {
  display: flex;
  list-style: none;
  gap: 24px;
}

.nav__menu a {
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
}
.nav__menu a:hover { color: var(--text-bright); text-decoration: none; }
.nav__menu a.active { color: var(--accent); }

.nav__toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 4px;
}
.nav__toggle span {
  display: block; width: 20px; height: 1.5px;
  background: var(--text); transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: center;
}
.nav__toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(5.5px) rotate(45deg);
}
.nav__toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav__toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-5.5px) rotate(-45deg);
}

/* ---- Header ---- */

.header {
  min-height: auto;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding: 140px 0 80px;
}

.header__bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 20% 40%, rgba(124, 108, 255, 0.18) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 60%, rgba(34, 201, 151, 0.12) 0%, transparent 45%);
  pointer-events: none;
}

.header__bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.15) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 1;
  mask-image: radial-gradient(ellipse at 30% 50%, black 0%, transparent 60%);
  -webkit-mask-image: radial-gradient(ellipse at 30% 50%, black 0%, transparent 60%);
}

.header__content {
  position: relative;
  z-index: 1;
  max-width: 720px;
  display: flex;
  align-items: center;
  gap: 40px;
}

.header__photo {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  -webkit-border-radius: 50%;
  clip-path: circle(50%);
  -webkit-clip-path: circle(50%);
  object-fit: cover;
  border: 3px solid var(--border);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .header__content {
    flex-direction: column;
    text-align: center;
  }
  .header__photo {
    width: 220px;
    height: 220px;
  }
}

.header h1 {
  font-size: clamp(2rem, 4vw, 2.5rem);
  font-weight: 800;
  color: var(--text-bright);
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 12px;
}

.header__role {
  font-size: 1rem;
  color: var(--text-dim);
  margin-bottom: 24px;
  font-weight: 400;
}

.header__summary {
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.7;
}

.header__cta {
  display: inline-block;
  margin-top: 28px;
  padding: 10px 28px;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}
.header__cta:hover {
  background: #6b5ce7;
  transform: translateY(-1px);
  text-decoration: none;
}

/* ---- Sections ---- */

.section { padding: 80px 0; }
.section--alt { background: var(--bg-alt); }

.section__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 40px;
  letter-spacing: -0.02em;
}

.section__lead {
  font-size: 0.95rem;
  color: var(--text-dim);
  font-style: italic;
  margin-top: -24px;
  margin-bottom: 32px;
}

/* ---- Two-column ---- */

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

/* ---- Labels ---- */

.label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 20px;
}

.label--spaced { margin-top: 32px; }

/* ---- Cards ---- */

.card {
  position: relative;
  display: flex;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 14px;
}

.card--subtle { background: transparent; }

.card__accent {
  width: 3px;
  flex-shrink: 0;
  background: var(--accent);
}
.card__accent--pub { background: var(--accent-green); }
.card__accent--oss { background: var(--text-dim); }

.card__body { padding: 18px 22px; flex: 1; }

.card__top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.card__year {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
}

.card__degree {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 3px;
  background: var(--accent-glow);
  color: #a99aff;
}

.card__venue {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent-green);
}

.card__location {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.card__body h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 4px;
  line-height: 1.4;
}

.card__body > p {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 2px;
  line-height: 1.55;
}

.card__sub {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 4px;
  margin-bottom: 0;
  line-height: 1.5;
}

.card__sub a { color: var(--link); }

.card__sub--divider {
  padding-bottom: 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.card__thesis {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text);
  font-style: italic;
  line-height: 1.55;
}

.card__thesis-label {
  font-style: normal;
  font-weight: 600;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  display: block;
  margin-bottom: 2px;
}

.card__authors {
  font-size: 0.85rem;
  color: var(--text);
}

.card__doi {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.card__link {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.8rem;
}

.card__links {
  display: flex;
  gap: 16px;
  margin-top: 6px;
}
.card__links a { font-size: 0.8rem; }

.dim { color: var(--text-dim); font-size: 0.8rem; }

/* ---- Experience Timeline ---- */

.timeline {
  --dot-size: 7px;
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: calc(var(--dot-size) / 2);
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--border);
}

.timeline__item {
  position: relative;
  padding-bottom: 28px;
}

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

.timeline__dot {
  position: absolute;
  left: -28px;
  top: 8px;
  width: var(--dot-size);
  height: var(--dot-size);
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent);
}

.timeline__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.timeline__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.timeline__period {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
}

.timeline__role {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.timeline__card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 6px;
}

.timeline__card p {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.65;
}

.timeline__voice {
  margin-top: 10px;
  font-style: italic;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* ---- Expertise ---- */

.expertise__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.expertise__grid .exp-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.exp-card {
  padding: 24px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.exp-card__icon {
  color: var(--accent);
  margin-bottom: 12px;
  opacity: 0.7;
}

.exp-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 8px;
}

.exp-card p {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.65;
}

/* ---- Projects ---- */

.projects__list {
  display: flex;
  flex-direction: column;
}

.project {
  display: flex;
  gap: 20px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}

.project:first-child { padding-top: 0; }
.project:last-child { border-bottom: none; }

.project__marker {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 10px;
}

.project__body { flex: 1; }

.project__head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.project__head h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-bright);
}

.project__scale {
  font-size: 0.75rem;
  font-family: var(--mono);
  color: var(--text-dim);
  white-space: nowrap;
}

.project__body > p {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.65;
}

.projects__more {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-style: italic;
  padding-top: 20px;
  text-align: center;
}

/* ---- Open Source ---- */

.os-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.os-item__key {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 4px;
}

.os-item__val {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 4px;
}

.os-item__note {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ---- Contacts ---- */

.section__title--center { text-align: center; }
.section__lead--center { text-align: center; }

.contact-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 160px;
  padding: 12px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.contact-link svg {
  color: var(--text-dim);
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.contact-link:hover {
  border-color: var(--border-hover);
  color: var(--text-bright);
  transform: translateY(-1px);
  text-decoration: none;
}

.contact-link:hover svg { color: var(--accent); }

.contact-link--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.contact-link--primary svg { color: rgba(255, 255, 255, 0.8); }

.contact-link--primary:hover {
  background: #6b5ce7;
  border-color: #6b5ce7;
  color: #fff;
}

.contact-link--primary:hover svg { color: #fff; }

/* ---- Footer ---- */

.footer {
  padding: 48px 0 32px;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}

.footer__oss {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 20px;
  justify-content: center;
}

.footer__oss a {
  color: var(--text);
}

.footer__oss a:hover {
  color: var(--link);
}

.footer__oss .footer__sep {
  color: var(--border);
}

.footer__copy {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
}

/* ---- Fade-in animations ---- */

.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
  .nav__menu {
    display: none;
    position: absolute;
    top: 52px; left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 12px 24px;
    gap: 12px;
  }
  .nav__menu.active { display: flex; }
  .nav__toggle { display: flex; }

  .header { padding: 96px 0 48px; }
  .header h1 { font-size: 2rem; }
  .two-col { grid-template-columns: 1fr; gap: 40px; }
  .expertise__grid { grid-template-columns: 1fr; }
  .os-grid { grid-template-columns: 1fr; gap: 20px; }
  .project { flex-direction: column; gap: 0; }
  .project__marker { display: none; }
  .project__head { flex-direction: column; gap: 2px; }
  .section { padding: 56px 0; }
  .timeline__card { padding: 16px 18px; }
}
