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

:root {
  --blue:        #1a4a8a;
  --blue-mid:    #2563b0;
  --blue-light:  #dbeafe;
  --blue-pale:   #eff6ff;
  --text:        #1e2330;
  --text-mid:    #4b5563;
  --text-soft:   #6b7280;
  --border:      #e2e8f0;
  --white:       #ffffff;
  --bg:          #f7f9fc;
  --radius:      6px;
  --shadow:      0 2px 12px rgba(0,40,100,.07);
  --shadow-lg:   0 4px 24px rgba(0,40,100,.10);
  --font-sans:   'Inter', system-ui, sans-serif;
  --font-serif:  'Source Serif 4', Georgia, serif;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Top Bar ─────────────────────────────────────── */
#topbar {
  background: var(--blue);
  color: white;
  font-size: 12px;
  letter-spacing: .04em;
  padding: 6px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#topbar a { color: rgba(255,255,255,.8); text-decoration: none; }
#topbar a:hover { color: white; }
#topbar .toplinks { display: flex; gap: 20px; }

/* ── Site Header ─────────────────────────────────── */
#site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.site-logo { font-weight: 700; font-size: 15px; color: var(--blue); letter-spacing: -.01em; }
.site-logo span { color: var(--text-mid); font-weight: 400; }

/* ── Navigation Tabs ─────────────────────────────── */
nav#main-nav {
  display: flex;
  gap: 2px;
}
nav#main-nav button {
  background: none;
  border: none;
  padding: 18px 16px;
  font: 13px/1 var(--font-sans);
  color: var(--text-mid);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: color .2s, border-color .2s;
  white-space: nowrap;
}
nav#main-nav button:hover { color: var(--blue); }
nav#main-nav button.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 600;
}

/* ── Profile Hero ────────────────────────────────── */
#hero {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 40px 0 32px;
}
.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 32px;
  display: grid;
  grid-template-columns: 150px 1fr auto;
  gap: 32px;
  align-items: start;
}
.hero-photo {
  width: 150px;
  height: 150px;
  border-radius: var(--radius);
  object-fit: cover;
  object-position: top center;
  border: 1px solid var(--border);
}
.hero-info h1 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 6px;
}
.hero-role { color: var(--text-mid); font-size: 14px; margin-bottom: 14px; line-height: 1.4; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--blue-pale);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-mid);
  text-decoration: none;
  transition: background .2s, color .2s;
}
.badge:hover { background: var(--blue-light); color: var(--blue); }
.badge svg { width: 13px; height: 13px; opacity: .6; }
.badge.phd { background: var(--blue-pale); border-color: var(--blue-light); }

.hero-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.ext-link {
  font-size: 12px;
  color: var(--blue-mid);
  text-decoration: none;
  display: flex; align-items: center; gap: 4px;
}
.ext-link:hover { text-decoration: underline; }

/* Metrics box */
.metrics-box {
  background: var(--blue-pale);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 24px;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.metrics-box h4 {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 4px;
}
.metric-item { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.metric-val { font-size: 22px; font-weight: 700; color: var(--blue); font-variant-numeric: tabular-nums; }
.metric-lbl { font-size: 11px; color: var(--text-soft); text-align: right; max-width: 80px; line-height: 1.3; }
.metrics-source { font-size: 10px; color: var(--text-soft); margin-top: 4px; }

/* ── Page Layout ─────────────────────────────────── */
.page-body {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 32px 64px;
}

/* ── Sections ────────────────────────────────────── */
.tab-section { display: none; }
.tab-section.active { display: block; }

.section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
}
.section-grid.full { grid-template-columns: 1fr; }

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card h3 {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.card h3 .count {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 400;
  background: var(--blue-light);
  color: var(--blue-mid);
  border-radius: 10px;
  padding: 1px 8px;
}

/* ── Bio ─────────────────────────────────────────── */
.bio-text { font-size: 14.5px; line-height: 1.75; color: var(--text); text-wrap: pretty; }

/* ── Research Keywords ───────────────────────────── */
.keyword-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.kw {
  background: var(--blue-pale);
  border: 1px solid var(--blue-light);
  border-radius: 20px;
  padding: 5px 13px;
  font-size: 12.5px;
  color: var(--blue);
  cursor: default;
  transition: background .15s;
}
.kw:hover { background: var(--blue-light); }

/* ── Education ───────────────────────────────────── */
.edu-list { display: flex; flex-direction: column; gap: 0; }
.edu-item {
  display: grid;
  grid-template-columns: 3px 1fr;
  gap: 0 16px;
  padding-bottom: 20px;
  position: relative;
}
.edu-item:last-child { padding-bottom: 0; }
.edu-line {
  background: var(--blue-light);
  border-radius: 2px;
  position: relative;
}
.edu-line::before {
  content: '';
  position: absolute;
  top: 4px; left: 50%;
  transform: translateX(-50%);
  width: 10px; height: 10px;
  background: var(--blue);
  border: 2px solid var(--white);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--blue-light);
}
.edu-body {}
.edu-degree { font-weight: 600; font-size: 14px; color: var(--text); }
.edu-inst { font-size: 13px; color: var(--blue-mid); margin: 2px 0; }
.edu-meta { font-size: 12px; color: var(--text-soft); }
.edu-thesis { font-size: 12.5px; color: var(--text-mid); font-style: italic; margin-top: 3px; }

/* ── SDGs ─────────────────────────────────────────── */
.sdg-intro { font-size: 13.5px; color: var(--text-mid); margin-bottom: 16px; line-height: 1.6; }
.sdg-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.sdg-card {
  width: 130px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.sdg-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.sdg-top {
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
}
.sdg-num { font-size: 28px; line-height: 1; }
.sdg-label {
  background: rgba(0,0,0,.15);
  padding: 6px 8px;
  font-size: 11px;
  color: white;
  text-align: center;
  line-height: 1.3;
  min-height: 36px;
  display: flex; align-items: center; justify-content: center;
}

/* ── Publications ────────────────────────────────── */
.pub-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.pub-filter {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12.5px;
  cursor: pointer;
  color: var(--text-mid);
  transition: all .15s;
}
.pub-filter:hover { border-color: var(--blue-mid); color: var(--blue); }
.filter-count {
  font-size: 11px;
}
.pub-filter.active .filter-count { opacity: .85; }

.pub-list { display: flex; flex-direction: column; gap: 0; }
.pub-year-group { }
.pub-year-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-soft);
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 16px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.pub-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
}
.pub-item:last-child { border-bottom: none; }
.pub-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
  margin-bottom: 4px;
}
.pub-title a { color: inherit; text-decoration: none; }
.pub-title a:hover { color: var(--blue); text-decoration: underline; }
.pub-authors { font-size: 12.5px; color: var(--text-mid); margin-bottom: 3px; }
.pub-authors strong { color: var(--blue); }
.pub-journal { font-size: 12.5px; color: var(--text-soft); font-style: italic; }
.pub-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.pub-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--blue-pale);
  color: var(--text-soft);
}
.pub-tag.oa { background: #e8f5e9; color: #2e7d32; }
.pub-tag.q1 { background: #e3f2fd; color: #1565c0; }
.pub-tag.conf { background: #fff8e1; color: #f57f17; }
.pub-citations {
  font-size: 13px;
  color: var(--text-soft);
  white-space: nowrap;
  display: flex; align-items: center; gap: 4px;
}
.pub-citations strong { color: var(--blue); font-size: 15px; }

/* ── Network ─────────────────────────────────────── */
#network-container {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
#network-svg { width: 100%; display: block; }
#network-legend {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,.95);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 12px;
  backdrop-filter: blur(4px);
}
#network-legend h5 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-soft); margin-bottom: 8px; }
.legend-item { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
#network-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(10,30,60,.88);
  color: white;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12.5px;
  max-width: 220px;
  display: none;
  z-index: 10;
  line-height: 1.5;
}
.network-instructions {
  font-size: 12px;
  color: var(--text-soft);
  padding: 12px 16px;
  background: var(--blue-pale);
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ── Map ─────────────────────────────────────────── */
#map-container {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
#map-svg { width: 100%; display: block; }
#map-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(10,30,60,.88);
  color: white;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12.5px;
  max-width: 220px;
  display: none;
  z-index: 10;
  line-height: 1.6;
}
.collab-info {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.collab-country-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  transition: border-color .2s, box-shadow .2s;
  cursor: default;
}
.collab-country-card:hover { border-color: var(--blue-mid); box-shadow: var(--shadow-lg); }
.collab-country-name { font-weight: 700; font-size: 14px; color: var(--text); margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; }
.collab-count { font-size: 11px; background: var(--blue-light); color: var(--blue); border-radius: 10px; padding: 1px 8px; font-weight: 600; }
.collab-areas { font-size: 12px; color: var(--text-soft); line-height: 1.5; }

/* ── Research areas bar chart ────────────────────── */
.area-bar-list { display: flex; flex-direction: column; gap: 10px; }
.area-bar-item {}
.area-bar-label { font-size: 13px; color: var(--text-mid); margin-bottom: 4px; display: flex; justify-content: space-between; }
.area-bar-track { background: var(--blue-pale); border-radius: 3px; height: 8px; overflow: hidden; }
.area-bar-fill { background: var(--blue); border-radius: 3px; height: 100%; transition: width .5s ease; }

/* ── Grants ──────────────────────────────────────── */
.grant-list { display: flex; flex-direction: column; gap: 14px; }
.grant-item { border-left: 3px solid var(--blue-light); padding-left: 14px; }
.grant-title { font-size: 13.5px; font-weight: 600; color: var(--text); line-height: 1.4; }
.grant-meta { font-size: 12px; color: var(--text-soft); margin-top: 3px; display: flex; gap: 12px; flex-wrap: wrap; }
.grant-status {
  font-size: 11px; padding: 1px 8px; border-radius: 10px; font-weight: 600;
}
.grant-status.ongoing { background: #e8f5e9; color: #2e7d32; }
.grant-status.completed { background: #e3f2fd; color: #1565c0; }

/* ── Awards ──────────────────────────────────────── */
.award-list { display: flex; flex-direction: column; gap: 10px; }
.award-item { display: flex; gap: 12px; align-items: start; }
.award-year { font-size: 12px; color: var(--blue-mid); font-weight: 700; white-space: nowrap; min-width: 68px; padding-top: 2px; }
.award-body {}
.award-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.award-org { font-size: 12px; color: var(--text-soft); }

/* ── Activities ──────────────────────────────────── */
.activity-list { display: flex; flex-direction: column; gap: 8px; }
.activity-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px;
  background: var(--blue-pale);
  border-radius: var(--radius);
  font-size: 13px;
}
.activity-role { font-weight: 600; color: var(--text); }
.activity-org { color: var(--text-soft); font-size: 12px; }
.activity-type-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: var(--blue-light); color: var(--blue-mid); white-space: nowrap;
}

/* ── Contact ─────────────────────────────────────── */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.contact-info { }
.contact-info p { font-size: 14px; color: var(--text-mid); margin-bottom: 12px; line-height: 1.7; }
.contact-detail { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13.5px; }
.contact-detail a { color: var(--blue); text-decoration: none; }
.contact-detail a:hover { text-decoration: underline; }

.contact-form { display: flex; flex-direction: column; gap: 12px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 12.5px; font-weight: 600; color: var(--text-mid); }
.form-group input, .form-group textarea, .form-group select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: 14px var(--font-sans);
  color: var(--text);
  background: var(--white);
  transition: border-color .2s;
  resize: vertical;
}
.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px #dbeafe;
}
.btn-submit {
  background: var(--blue);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius);
  font: 14px/1 var(--font-sans);
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
  align-self: flex-start;
}
.btn-submit:hover { background: var(--blue-mid); }

/* ── Footer ──────────────────────────────────────── */
footer {
  background: #172033;
  color: rgba(255,255,255,.6);
  text-align: center;
  padding: 20px;
  font-size: 12px;
}
footer a { color: rgba(255,255,255,.8); text-decoration: none; }
footer a:hover { color: white; }

/* ── Dark Mode ───────────────────────────────────── */
body.dark {
  --blue:        #4a90d9;
  --blue-mid:    #60a5fa;
  --blue-light:  #1e3a5f;
  --blue-pale:   #172033;
  --text:        #e8ecf0;
  --text-mid:    #a0aec0;
  --text-soft:   #718096;
  --border:      #2d3748;
  --white:       #1a202c;
  --bg:          #0f1318;
}
body.dark #topbar          { background: #0d1829; }
body.dark #site-header     { background: #1a202c; }
body.dark #hero            { background: #1a202c; }
body.dark .metrics-box     { background: #1f2940; }
body.dark .pub-tag.oa      { background: #1b3a1c; color: #6fcf7a; }
body.dark .pub-tag.q1      { background: #0d2340; color: #64b0f4; }
body.dark .pub-tag.conf    { background: #2e2000; color: #f9c74f; }
body.dark .grant-status.ongoing   { background: #1b3a1c; color: #6fcf7a; }
body.dark .grant-status.completed { background: #0d2340; color: #64b0f4; }
body.dark .sdg-card        { box-shadow: 0 2px 12px rgba(0,0,0,.4); }

/* Dark mode toggle button */
#dark-toggle {
  background: none;
  border: none;
  padding: 6px 8px;
  font-size: 15px;
  cursor: pointer;
  color: var(--text-soft);
  opacity: 0.5;
  transition: opacity .2s;
  line-height: 1;
  flex-shrink: 0;
}
#dark-toggle:hover { opacity: 1; }

/* CV download button */
.btn-cv {
  display: inline-flex !important; align-items: center; gap: 7px;
  background: var(--blue);
  color: white;
  text-decoration: none;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  transition: background .2s, transform .15s;
  margin-top: 10px;
}
.btn-cv:hover { background: var(--blue-mid); transform: translateY(-1px); }
.btn-cv svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 800px) {
  .hero-inner { grid-template-columns: 1fr; gap: 16px; }
  .hero-photo { width: 100px; height: 100px; }
  .metrics-box { min-width: unset; }
  .section-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .collab-info { grid-template-columns: 1fr 1fr; }
  nav#main-nav { overflow-x: auto; }
  nav#main-nav button { padding: 16px 12px; font-size: 12px; }
  .header-inner { padding: 0 16px; }
  .page-body { padding: 20px 16px 48px; }
}
