:root, [data-theme="dark"] {
  --bg: #0d1117;
  --bg-card: #161b22;
  --bg-card-hover: #1c2128;
  --border: #30363d;
  --text: #e6edf3;
  --text-secondary: #8b949e;
  --accent: #58a6ff;
  --accent-purple: #bc8cff;
  --accent-green: #3fb950;
  --accent-orange: #d29922;
  --accent-pink: #f778ba;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --max-w: 960px;
}
[data-theme="light"] {
  --bg: #ffffff;
  --bg-card: #f6f8fa;
  --bg-card-hover: #eef1f4;
  --border: #d0d7de;
  --text: #1f2328;
  --text-secondary: #656d76;
  --accent: #0969da;
  --accent-purple: #8250df;
  --accent-green: #1a7f37;
  --accent-orange: #9a6700;
  --accent-pink: #bf3989;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Skip navigation */
.skip-nav {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--accent);
  color: #0d1117;
  padding: 8px 16px;
  border-radius: 4px;
  z-index: 200;
  font-size: 14px;
  font-weight: 600;
}
.skip-nav:focus { top: 16px; text-decoration: none; }

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Theme toggle */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 100;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--text); background: var(--bg-card-hover); }
.theme-toggle:active { transform: scale(0.90); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Hero */
.hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 60px 32px 40px;
  display: flex;
  gap: 48px;
  align-items: center;
}
.hero-photo {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 3px solid var(--border);
  flex-shrink: 0;
  box-shadow: var(--shadow);
}
.hero-text h1 {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 4px;
}
.hero-text .subtitle {
  font-size: 18px;
  color: var(--accent);
  margin-bottom: 8px;
  font-weight: 500;
}
.hero-text .location {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.hero-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.hero-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  transition: all 0.2s;
}
.hero-links a:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  text-decoration: none;
  transform: translateY(-1px);
}
.hero-links a.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d1117;
}
.hero-links a.primary:hover {
  background: #79c0ff;
  border-color: #79c0ff;
}
[data-theme="light"] .hero-links a.primary { color: #ffffff; }
[data-theme="light"] .hero-links a.primary:hover { background: #0550ae; border-color: #0550ae; }

/* Navigation */
nav {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
  overflow-x: auto;
}
nav a {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.2s;
}
nav a:hover { color: var(--text); text-decoration: none; }
nav a.active { color: var(--text); border-bottom-color: var(--accent); }

/* Sections */
.content {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 32px 80px;
}
/* Progressive enhancement: sections visible by default for SEO/no-JS.
   JS adds .js-tabs-active to <body>, which activates tab-hiding behavior. */
body.js-tabs-active section { display: none; }
body.js-tabs-active section.active { display: block; }

.section-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  transition: all 0.2s;
}
.card:hover {
  border-color: rgba(88,166,255,0.3);
}
.card h3 {
  font-size: 18px;
  margin-bottom: 4px;
}
.card .meta {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.card p, .card li {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* Education timeline */
.edu-card {
  position: relative;
  padding-left: 24px;
  border-left: 2px solid var(--border);
  margin-left: 12px;
}
.edu-card::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 28px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}
.edu-card.phd::before { background: var(--accent-purple); width: 14px; height: 14px; left: -8px; }
.edu-card .degree {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-bottom: 2px;
}
.edu-card.phd .degree { color: var(--accent-purple); }
.edu-card .gpa {
  display: inline-block;
  background: rgba(88,166,255,0.1);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 8px;
}

/* Skills grid */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.skill-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
}
.skill-card h4 {
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 10px;
  font-weight: 600;
}
.skill-tag {
  display: inline-block;
  background: rgba(88,166,255,0.08);
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  margin: 3px 4px 3px 0;
  border: 1px solid rgba(48,54,61,0.5);
}

/* PhD explainer */
.phd-explainer {
  background: linear-gradient(135deg, rgba(188,140,255,0.08) 0%, rgba(88,166,255,0.08) 100%);
  border: 1px solid rgba(188,140,255,0.2);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 24px;
}
.phd-explainer h4 {
  color: var(--accent-purple);
  font-size: 16px;
  margin-bottom: 12px;
}
.phd-explainer p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
}
.phd-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.phd-compare div {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 16px;
  border: 1px solid var(--border);
}
.phd-compare h5 {
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.phd-compare li {
  font-size: 13px;
  color: var(--text-secondary);
  margin-left: 16px;
  line-height: 1.8;
}

/* Dashboard cards */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  display: block;
}
.dash-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.dash-icon {
  font-size: 40px;
  margin-bottom: 12px;
}
.dash-card h3 {
  font-size: 18px;
  margin-bottom: 6px;
}
.dash-card p {
  font-size: 14px;
  color: var(--text-secondary);
}
.dash-lock {
  font-size: 12px;
  color: var(--accent-orange);
  margin-top: 10px;
}

/* CV section */
.cv-actions {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

/* Footer */
footer {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Utility classes (extracted from inline styles) */
.skills-grid-flush { margin-bottom: 0; }
.skill-card-accent { border-left: 3px solid var(--accent); }
.skill-card-purple { border-left: 3px solid var(--accent-purple); }
.skill-card-green  { border-left: 3px solid var(--accent-green); }
.skill-card-orange { border-left: 3px solid var(--accent-orange); }
.card-text-primary { font-size: 15px; color: var(--text); }
.card-text-sub     { font-size: 13px; margin-top: 4px; }
.list-indented     { padding-left: 20px; }
.list-plain        { list-style: none; padding: 0; }
.gpa-phd           { background: rgba(188,140,255,0.15); color: var(--accent-purple); }
.mt-16             { margin-top: 16px; }
.dissertation-line { margin-top: 8px; }
.text-primary      { color: var(--text); }
/* Paragraph spacing inside cards (replaces <br> spacing) */
.card p + p { margin-top: 14px; }

/* CV download button — reusable primary action style */
.btn-primary-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--accent);
  color: #0d1117;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
}
.btn-primary-download:hover {
  background: #79c0ff;
  text-decoration: none;
}
[data-theme="light"] .btn-primary-download { color: #ffffff; }
[data-theme="light"] .btn-primary-download:hover { background: #0550ae; }

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

/* Responsive */
@media (max-width: 640px) {
  .hero { flex-direction: column; text-align: center; padding: 40px 20px 24px; gap: 24px; }
  .hero-photo { width: 150px; height: 150px; }
  .hero-links { justify-content: center; }
  .hero-text h1 { font-size: 28px; }
  nav { padding: 0 16px; }
  .content { padding: 0 16px 60px; }
  .phd-compare { grid-template-columns: 1fr; }
}
