:root {
  --bg: #f7f8fb;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --text: #14161f;
  --text-muted: #565a6e;
  --border: #e5e7ef;
  --accent: #4f46e5;
  --accent-2: #06b6d4;
  --accent-soft: rgba(79, 70, 229, 0.1);
  --shadow: 0 10px 30px rgba(20, 22, 31, 0.08);
  --header-h: 72px;
  --radius: 14px;
  --particle-color: 79, 70, 229;
}

:root[data-theme="dark"] {
  --bg: #0a0b10;
  --bg-alt: #10121a;
  --surface: #14161f;
  --text: #edeef5;
  --text-muted: #9498ab;
  --border: #24273350;
  --accent: #818cf8;
  --accent-2: #22d3ee;
  --accent-soft: rgba(129, 140, 248, 0.14);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  --particle-color: 129, 140, 248;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

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

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  z-index: 100;
  background: transparent;
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  border-bottom: 1px solid transparent;
}

.site-header.scrolled {
  background: color-mix(in srgb, var(--bg-alt) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom-color: var(--border);
  box-shadow: var(--shadow);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
}

.logo {
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

.logo-dot {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
  padding: 4px 0;
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.25s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  transition: background-color 0.2s ease;
}

.icon-btn:hover {
  background: var(--accent-soft);
}

.icon {
  width: 20px;
  height: 20px;
}

.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 40px;
  height: 40px;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Hero */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg);
}

#particle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 760px;
  text-align: center;
  padding: 0 24px;
}

.eyebrow {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

.hero-content h1 {
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 12px;
}

.hero-role {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-muted);
  margin-bottom: 20px;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 32px;
}

.hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 28px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  cursor: pointer;
  border: 2px solid transparent;
}

.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 8px 20px -6px rgba(79, 70, 229, 0.5);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -6px rgba(79, 70, 229, 0.6);
}

.btn-outline {
  border-color: var(--border);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.scroll-cue {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 42px;
  border: 2px solid var(--border);
  border-radius: 20px;
  z-index: 2;
}

.scroll-cue span {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 4px;
  height: 8px;
  background: var(--accent);
  border-radius: 4px;
  transform: translateX(-50%);
  animation: scrollCue 1.8s ease infinite;
}

@keyframes scrollCue {
  0% { opacity: 1; top: 8px; }
  70% { opacity: 0; top: 20px; }
  100% { opacity: 0; top: 20px; }
}

/* Sections */
.section {
  padding: 120px 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 32px;
}

.section-eyebrow {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.section-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 48px;
  max-width: 640px;
}

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 64px;
  align-items: start;
}

.about-text {
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: 1.02rem;
}

.about-facts {
  display: grid;
  gap: 16px;
}

.fact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fact-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.fact-value {
  font-weight: 600;
}

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

.skill-group h3 {
  font-size: 1rem;
  margin-bottom: 14px;
  color: var(--text-muted);
  font-weight: 600;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
}

.pill-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 32px;
  border-left: 2px solid var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 48px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -39px;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
}

.timeline-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
}

.timeline-content h3 {
  font-size: 1.15rem;
  margin: 6px 0 10px;
  font-weight: 700;
}

.timeline-sub {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
}

.timeline-content p {
  color: var(--text-muted);
  max-width: 620px;
}

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.project-card-top {
  margin-bottom: 14px;
}

.project-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
}

.project-card h3 {
  font-size: 1.2rem;
  margin-bottom: 10px;
}

.project-card p {
  color: var(--text-muted);
  margin-bottom: 18px;
  font-size: 0.95rem;
}

.project-card-ghost {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-style: dashed;
  color: var(--text-muted);
}

.ghost-plus {
  font-size: 2rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.project-card-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: none;
  box-shadow: none;
}

/* Contact */
.contact-section {
  text-align: center;
}

.contact-inner {
  max-width: 620px;
  margin: 0 auto;
}

.contact-inner .section-title {
  margin: 0 auto 16px;
}

.contact-inner .about-text {
  margin: 0 auto 32px;
}

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

/* Footer */
.site-footer {
  text-align: center;
  padding: 32px 24px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

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

/* Responsive */
@media (max-width: 860px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
    transform: translateY(-120%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
  }

  .nav-links a {
    padding: 16px 32px;
    width: 100%;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-toggle.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .nav-toggle.open span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .section {
    padding: 88px 0;
  }
}
