:root {
  --bg: #ffffff;
  --bg-alt: #f8f9fb;
  --text: #1a1a2e;
  --text-secondary: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-subtle: rgba(37, 99, 235, 0.06);
  --border: #e2e8f0;
  --card-bg: #ffffff;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --card-shadow-hover: 0 8px 24px rgba(0,0,0,0.08);
  --tag-bg: #eff6ff;
  --tag-text: #1e40af;
  --timeline-line: #e2e8f0;
  --timeline-dot: #2563eb;
  --nav-bg: rgba(255,255,255,0.8);
  --badge-bg: #dbeafe;
  --badge-text: #1e40af;
  --focus-ring: 0 0 0 3px rgba(37,99,235,0.4);
  --hero-gradient: linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%);
  --featured-bg: linear-gradient(135deg, rgba(37,99,235,0.03) 0%, rgba(37,99,235,0.07) 100%);
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-alt: #1e293b;
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-subtle: rgba(59, 130, 246, 0.08);
  --border: #334155;
  --card-bg: #1e293b;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.2);
  --card-shadow-hover: 0 8px 24px rgba(0,0,0,0.3);
  --tag-bg: #1e3a5f;
  --tag-text: #93c5fd;
  --timeline-line: #334155;
  --timeline-dot: #3b82f6;
  --nav-bg: rgba(15,23,42,0.8);
  --badge-bg: #1e3a5f;
  --badge-text: #93c5fd;
  --focus-ring: 0 0 0 3px rgba(59,130,246,0.4);
  --hero-gradient: linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%);
  --featured-bg: linear-gradient(135deg, rgba(59,130,246,0.04) 0%, rgba(59,130,246,0.08) 100%);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 4px;
}

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

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 200;
  padding: 12px 24px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border-radius: 0 0 8px 8px;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── Nav ─── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s, box-shadow 0.3s;
}

.nav-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-weight: 700;
  font-size: 17px;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.3px;
}

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

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: color 0.2s;
  position: relative;
  padding-bottom: 4px;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  transform: scaleX(0);
  transition: transform 0.25s ease;
}

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

.nav-links a.active::after,
.nav-links a:hover::after {
  transform: scaleX(1);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: 8px;
  align-items: center;
  transition: color 0.2s;
}

.mobile-menu-toggle:hover {
  color: var(--accent);
}

.mobile-menu-toggle .close-icon { display: none; }
.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon { display: none; }
.mobile-menu-toggle[aria-expanded="true"] .close-icon { display: block; }

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
}

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

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

/* ─── Sections (base) ─── */
section {
  padding: 80px 0;
}

.section-title {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 36px;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 12px;
}

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

/* ─── Hero ─── */
.hero {
  padding: 140px 0 80px;
  text-align: center;
  background: var(--hero-gradient);
}

.hero-photo {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 3px solid var(--border);
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  margin-bottom: 20px;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
}

.hero-photo:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 28px rgba(37,99,235,0.15);
  transform: scale(1.03);
}

.hero-stats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  margin: 28px auto 36px;
  padding: 18px 36px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  max-width: 500px;
  box-shadow: var(--card-shadow);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-number {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 500;
}

.stat-divider {
  width: 1px;
  height: 32px;
  background: var(--border);
}

.hero-greeting {
  font-size: 18px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 10px;
  letter-spacing: 0.3px;
}

.hero-name {
  font-size: clamp(36px, 6vw, 52px);
  font-weight: 700;
  letter-spacing: -1.5px;
  line-height: 1.1;
}

.hero-former {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  margin-bottom: 12px;
}

.hero-title {
  font-size: clamp(17px, 3vw, 21px);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.hero-tagline {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto 0;
  line-height: 1.5;
}

.hero-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37,99,235,0.25);
}

.btn-secondary {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--card-shadow);
}

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

.hero-links a {
  color: var(--text-secondary);
  transition: color 0.2s, transform 0.2s;
  display: flex;
  padding: 6px;
  border-radius: 8px;
}

.hero-links a:hover {
  color: var(--accent);
  transform: translateY(-2px);
}

/* ─── About ─── */
.about {
  background: var(--bg-alt);
}

.about-content {
  font-size: 16px;
  line-height: 1.8;
  max-width: 680px;
}

.about-content p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.about-content p:last-child {
  margin-bottom: 0;
}

.about-content strong {
  color: var(--text);
}

/* ─── Featured Work ─── */
.featured-work {
  background: var(--featured-bg);
}

.featured-grid {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.featured-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.3s, transform 0.3s;
}

.featured-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}

.featured-header {
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--accent-subtle);
}

.featured-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
  margin-bottom: 8px;
}

.featured-header h3 {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.3;
  letter-spacing: -0.3px;
}

.featured-context {
  font-size: 14px;
  color: var(--text-secondary);
}

.featured-body {
  padding: 20px 28px 24px;
}

.featured-body p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.featured-body p:last-child {
  margin-bottom: 0;
}

.featured-body strong {
  color: var(--text);
  font-weight: 600;
}

/* ─── Experience Timeline ─── */
.experience {
  background: var(--bg-alt);
}

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

.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--timeline-line);
}

.timeline-item {
  position: relative;
  margin-bottom: 32px;
}

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

.timeline-marker {
  position: absolute;
  left: -28px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--timeline-dot);
  border: 3px solid var(--bg-alt);
  box-shadow: 0 0 0 2px var(--timeline-dot);
}

.timeline-content {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.2s;
}

.timeline-content:hover {
  box-shadow: var(--card-shadow-hover);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  gap: 12px;
}

.timeline-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.timeline-company {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.timeline-date {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 500;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--badge-bg);
  color: var(--badge-text);
  margin-bottom: 10px;
  letter-spacing: 0.2px;
}

.timeline-content ul {
  list-style: none;
  padding: 0;
}

.timeline-content li {
  position: relative;
  padding-left: 16px;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.timeline-content li:last-child {
  margin-bottom: 0;
}

.timeline-content li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* ─── Skills ─── */
.skills {
  background: var(--bg);
}

.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.skill-group {
  padding: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
}

.skill-group h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.skill-tags span {
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 6px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.skill-tags span:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ─── Testimonials ─── */
.testimonials {
  background: var(--bg-alt);
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.testimonial-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.3s, transform 0.3s;
}

.testimonial-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}

.quote-icon {
  color: var(--accent);
  opacity: 0.3;
  margin-bottom: 14px;
}

.testimonial-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  font-style: italic;
  flex-grow: 1;
  margin-bottom: 20px;
}

.testimonial-author {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.testimonial-author h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1px;
}

.testimonial-author p {
  font-size: 12px;
  color: var(--text-secondary);
}

.testimonial-context {
  font-size: 11px !important;
  color: var(--accent) !important;
  margin-top: 2px;
}

/* ─── Education & Research ─── */
.education-research {
  background: var(--bg);
}

.education-research .education-grid {
  margin-bottom: 20px;
}

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

.edu-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.2s;
}

.edu-card:hover {
  box-shadow: var(--card-shadow-hover);
}

.edu-icon {
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 2px;
}

.edu-text h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 3px;
}

.edu-school {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 1px;
}

.edu-date {
  font-size: 12px;
  color: var(--text-secondary);
}

.pub-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 24px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.3s, transform 0.3s;
}

.pub-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}

.pub-icon {
  color: var(--accent);
  flex-shrink: 0;
}

.pub-text h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 3px;
  line-height: 1.4;
}

.pub-text p {
  font-size: 13px;
  color: var(--text-secondary);
}

.pub-arrow {
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: transform 0.2s, color 0.2s;
}

.pub-card:hover .pub-arrow {
  transform: translate(3px, -3px);
  color: var(--accent);
}

/* ─── Contact ─── */
.contact {
  text-align: center;
  background: var(--bg-alt);
}

.contact .section-title {
  justify-content: center;
}

.contact .section-title::after {
  display: none;
}

.contact-text {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 28px;
  line-height: 1.7;
}

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

/* ─── Footer ─── */
.footer {
  padding: 28px 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  letter-spacing: 0.2px;
}

/* ─── Animations ─── */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .fade-in {
    opacity: 1;
    transform: none;
  }
}

/* ─── Tablet (641px – 860px) ─── */
@media (max-width: 860px) {
  .nav-links {
    gap: 16px;
  }

  .nav-links a {
    font-size: 12.5px;
  }
}

/* ─── Mobile (≤640px) ─── */
@media (max-width: 640px) {
  section {
    padding: 60px 0;
  }

  .section-title {
    font-size: 22px;
    margin-bottom: 28px;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--nav-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    gap: 0;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links li {
    list-style: none;
  }

  .nav-links a {
    display: block;
    padding: 10px 0;
    font-size: 15px;
  }

  .nav-links a::after {
    display: none;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .hero {
    padding: 110px 0 50px;
  }

  .hero-photo {
    width: 140px;
    height: 140px;
  }

  .hero-stats {
    gap: 16px;
    padding: 14px 20px;
  }

  .stat-number {
    font-size: 18px;
  }

  .stat-divider {
    height: 24px;
  }

  .timeline-header {
    flex-direction: column;
  }

  .skills-grid,
  .education-grid,
  .testimonials-grid {
    grid-template-columns: 1fr;
  }

  .skill-group {
    padding: 16px;
  }

  .featured-header {
    padding: 18px 20px 14px;
  }

  .featured-body {
    padding: 16px 20px 20px;
  }

  .featured-header h3 {
    font-size: 17px;
  }

  .pub-card {
    flex-direction: column;
    text-align: center;
  }

  .pub-arrow {
    display: none;
  }

  .contact-actions {
    flex-direction: column;
    align-items: center;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }
}
