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

:root {
  --bg:        #f5f7ff;
  --surface:   #ffffff;
  --surface-2: #eef1fb;
  --border:    #dde1f5;
  --accent:    #4f6ef7;
  --accent-2:  #8b5cf6;
  --accent-3:  #10b981;
  --text:      #1a1d2e;
  --muted:     #6b7094;
  --radius:    12px;
  --gap:       2rem;
  --nav-h:     56px;
  --nav-bg-scrolled: rgba(245, 247, 255, .88);
  --hero-glow-1: rgba(79, 110, 247, .08);
  --hero-glow-2: rgba(139, 92, 246, .06);
}

[data-theme="dark"] {
  --bg:        #080b14;
  --surface:   #0f1320;
  --surface-2: #161b2e;
  --border:    #1e2438;
  --accent:    #6c8ef5;
  --accent-2:  #a78bfa;
  --accent-3:  #34d399;
  --text:      #e2e4ed;
  --muted:     #6b7094;
  --nav-bg-scrolled: rgba(8, 11, 20, .85);
  --hero-glow-1: rgba(108, 142, 245, .12);
  --hero-glow-2: rgba(167, 139, 250, .08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 1rem;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { padding-left: 1.25rem; }
li { margin-block: .3rem; }

/* ── Layout ───────────────────────────────────────────── */
.container {
  max-width: 820px;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

/* ── Sticky nav ───────────────────────────────────────── */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-h);
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background .3s, border-color .3s, backdrop-filter .3s;
}

.topnav.scrolled {
  background: var(--nav-bg-scrolled);
  border-bottom-color: var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.nav-logo {
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .06em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  list-style: none;
  padding: 0;
  gap: .25rem;
}

.nav-links a {
  font-size: .82rem;
  color: var(--muted);
  padding: .3rem .65rem;
  border-radius: 6px;
  transition: color .2s, background .2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
}

.nav-links a.active { color: var(--accent); }

/* ── Hero ─────────────────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  padding-top: calc(var(--nav-h) + 4rem);
  padding-bottom: 5rem;
  text-align: left;
}

.hero-bg-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 40%, var(--hero-glow-1) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 80% 60%, var(--hero-glow-2) 0%, transparent 70%);
  pointer-events: none;
}

.hero-inner {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  flex-wrap: wrap;
}

.avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: block;
  position: relative;
  z-index: 1;
}

.avatar-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  z-index: 0;
  opacity: .6;
  animation: ring-pulse 3s ease-in-out infinite;
}

@keyframes ring-pulse {
  0%, 100% { transform: scale(1); opacity: .6; }
  50% { transform: scale(1.05); opacity: .3; }
}

.hero-label {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent);
  margin-bottom: .5rem;
}

.hero-text h1 {
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
  margin-bottom: .75rem;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.contacts {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}

.contacts a {
  font-size: .85rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: .35rem .85rem;
  border-radius: 999px;
  transition: border-color .2s, color .2s;
}

.contacts a:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.hero-scroll-hint {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 1.1rem;
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: .6; }
  50% { transform: translateX(-50%) translateY(6px); opacity: 1; }
}

/* ── Main ─────────────────────────────────────────────── */
main { padding-block: 3.5rem; }

/* ── Sections ─────────────────────────────────────────── */
section { margin-bottom: 4rem; }

section h2 {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--muted);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}

section h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.about-text {
  font-size: 1.05rem;
  color: var(--text);
  max-width: 62ch;
  line-height: 1.8;
}

/* ── Scroll reveal ────────────────────────────────────── */
.reveal,
.tl-item,
.project-card {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .55s ease, transform .55s ease;
}

.reveal.visible,
.tl-item.visible,
.project-card.visible {
  opacity: 1;
  transform: none;
}

.tl-item:nth-child(2) { transition-delay: .1s; }
.tl-item:nth-child(3) { transition-delay: .2s; }
.project-card:nth-child(2) { transition-delay: .1s; }
.project-card:nth-child(3) { transition-delay: .2s; }

/* ── Timeline ─────────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent) 0%, var(--border) 100%);
  border-radius: 2px;
}

.tl-item {
  position: relative;
  margin-bottom: 2.5rem;
}

.tl-item:last-child { margin-bottom: 0; }

.tl-dot {
  position: absolute;
  left: -2rem;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(79, 110, 247, .1);
  transition: box-shadow .2s;
}

.tl-item:hover .tl-dot {
  box-shadow: 0 0 0 6px rgba(79, 110, 247, .18);
}

.tl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  transition: border-color .2s, transform .2s;
}

.tl-card:hover {
  border-color: rgba(79, 110, 247, .35);
  transform: translateX(3px);
  box-shadow: 0 4px 20px rgba(79, 110, 247, .08);
}

.tl-meta {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .4rem;
}

.tl-period {
  font-size: .8rem;
  color: var(--muted);
}

.tl-badge {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .15rem .5rem;
  border-radius: 999px;
}

.tl-badge.active {
  background: rgba(52, 211, 153, .12);
  color: var(--accent-3);
  border: 1px solid rgba(52, 211, 153, .25);
}

.tl-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: .2rem;
}

.tl-company {
  color: var(--muted);
  font-size: .875rem;
  margin-bottom: .75rem;
}

.tl-card ul {
  color: var(--text);
  font-size: .9rem;
}

/* ── Projects grid ────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  cursor: default;
}

.project-card:hover {
  border-color: rgba(79, 110, 247, .35);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(79, 110, 247, .1);
}

.project-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.project-icon {
  font-size: 1.4rem;
  color: var(--accent);
}

.btn-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 1rem;
  transition: border-color .2s, color .2s;
}

.btn-icon:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.project-card h3 { font-size: 1rem; font-weight: 600; }
.project-card p { color: var(--muted); font-size: .875rem; flex: 1; line-height: 1.6; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.tags span {
  font-size: .75rem;
  background: rgba(79, 110, 247, .08);
  color: var(--accent);
  padding: .2rem .55rem;
  border-radius: 999px;
  border: 1px solid rgba(79, 110, 247, .2);
}

/* ── Skills ───────────────────────────────────────────── */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.75rem;
}

.skill-group h4 {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: .75rem;
}

.skill-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.skill-pills span {
  font-size: .82rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .3rem .7rem;
  border-radius: 8px;
  transition: border-color .2s, color .2s;
}

.skill-pills span:hover {
  border-color: var(--accent);
  color: var(--accent);
}

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

/* ── Theme toggle ─────────────────────────────────────── */
body { transition: background .35s, color .35s; }
.surface, .tl-card, .project-card, .topnav { transition: background .35s, border-color .35s, color .35s; }

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1rem;
  flex-shrink: 0;
  transition: border-color .2s, color .2s, background .2s;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 600px) {
  .hero-inner { flex-direction: column; text-align: center; }
  .contacts { justify-content: center; }
  .nav-links { display: none; }
  .timeline { padding-left: 1.5rem; }
  .tl-dot { left: -1.5rem; }
}
