:root {
  color-scheme: light;
  --surface-1: #fffcf6;
  --page: #fff9f0;
  --text-primary: #241a0d;
  --text-secondary: #77644c;
  --text-muted: #a08a6c;
  --gridline: #f0e0cf;
  --baseline: #dcbd9a;
  --series-1: #fa4616;
  --series-1-wash: rgba(250, 70, 22, 0.1);
  --accent-warm: #0021a5;
  --border: rgba(36, 26, 13, 0.14);
  --card-bg: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1: #211a10;
    --page: #171208;
    --text-primary: #fbf2e4;
    --text-secondary: #c8b696;
    --text-muted: #a08f70;
    --gridline: #3a2a1c;
    --baseline: #55402a;
    --series-1: #ff6a3d;
    --series-1-wash: rgba(255, 106, 61, 0.16);
    --accent-warm: #4d7fff;
    --border: rgba(255, 255, 255, 0.12);
    --card-bg: #241c12;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #211a10;
  --page: #171208;
  --text-primary: #fbf2e4;
  --text-secondary: #c8b696;
  --text-muted: #a08f70;
  --gridline: #3a2a1c;
  --baseline: #55402a;
  --series-1: #ff6a3d;
  --series-1-wash: rgba(255, 106, 61, 0.16);
  --accent-warm: #4d7fff;
  --border: rgba(255, 255, 255, 0.12);
  --card-bg: #241c12;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}

html {
  scroll-behavior: smooth;
}

#draft-banner {
  background: var(--series-1);
  color: #ffffff;
  text-align: center;
  font-size: 0.85rem;
  padding: 8px 16px;
}

.wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}


#section-nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  background: var(--page);
  padding: 12px 0;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--gridline);
  z-index: 10;
}

.nav-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 0 0 10px;
}

.nav-tab:hover {
  color: var(--series-1);
}

.nav-tab.active {
  color: var(--series-1);
  border-bottom-color: var(--series-1);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}

.skills-list li {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.skills-list li.skill-wet {
  border-color: var(--series-1);
  color: var(--series-1);
}

.skills-list li.skill-dry {
  border-color: var(--accent-warm);
  color: var(--accent-warm);
}

.edu-journey {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
  aspect-ratio: 640 / 700;
}

.edu-journey-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.edu-curve-path {
  fill: none;
  stroke: var(--series-1);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 2 10;
}

.edu-journey-line {
  display: none;
}

.edu-stop {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 14px;
  transform: translateY(-50%);
}

.edu-stop.edu-side-right {
  left: var(--x);
}

.edu-stop.edu-side-left {
  left: var(--x);
  flex-direction: row-reverse;
  transform: translate(-100%, -50%);
}

.edu-stop-marker {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 2px solid var(--series-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--series-1);
  flex-shrink: 0;
}

.edu-stop.edu-marker-alt .edu-stop-marker {
  border-color: var(--accent-warm);
  color: var(--accent-warm);
}

.edu-stop-marker img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 1.5px;
  border-radius: 50%;
}

.edu-stop-text {
  max-width: 220px;
}

.edu-side-left .edu-stop-text {
  text-align: right;
}

.edu-stop-years {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 2px;
}

.edu-stop-degree {
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 1px;
}

.edu-stop-institution {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.edu-stop-location {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
}

@media (max-width: 560px) {
  .edu-journey {
    aspect-ratio: auto;
    height: 420px;
  }

  .edu-curve-path {
    display: none;
  }

  .edu-journey-line {
    display: block;
    position: absolute;
    left: 26px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: repeating-linear-gradient(to bottom, var(--series-1) 0, var(--series-1) 6px, transparent 6px, transparent 11px);
  }

  .edu-stop,
  .edu-stop.edu-side-left {
    left: 0 !important;
    right: 0;
    flex-direction: row;
    transform: translateY(-50%);
  }

  .edu-stop-text,
  .edu-side-left .edu-stop-text {
    text-align: left;
    max-width: none;
    width: 100%;
    padding-left: 66px;
  }

  .edu-stop-marker {
    position: absolute;
    left: 0;
  }
}

.subsection-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 0 0 12px;
}

summary.subsection-title {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

summary.subsection-title::-webkit-details-marker {
  display: none;
}

summary.subsection-title::before {
  content: "▸";
  font-size: 0.75em;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

summary.subsection-title:hover {
  color: var(--series-1);
}

details[open] summary.subsection-title::before {
  transform: rotate(90deg);
}

#papers-details #publications-list {
  margin-top: 12px;
}

.project {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 20px;
}

.project:last-child {
  margin-bottom: 0;
}

.project-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.project-affiliation {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin: 0 0 16px;
}

.project-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
}

@media (max-width: 640px) {
  .project-body {
    grid-template-columns: 1fr;
  }
}

.project-figure {
  background: var(--surface-1);  
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-align: center;
  padding: 1px;
  overflow: hidden;
}

.project-figure.is-placeholder {
  border-style: dashed;
  padding: 12px;
}

.project-figure img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: zoom-in;
}

.project-summary {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin: 0 0 16px;
}

.project-subheading {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.project-subheading:not(:first-child) {
  margin-top: 16px;
}

.project-pubs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-pubs-list a {
  color: var(--series-1);
  text-decoration: none;
  font-size: 0.9rem;
}

.project-pubs-list a:hover {
  text-decoration: underline;
}

.project-pub-year {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.collaboration {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 20px;
}

.collaboration:last-child {
  margin-bottom: 0;
}

.collaboration-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.collaboration-collaborator {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin: 0 0 12px;
}

.collaboration-summary {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin: 0 0 16px;
}

#publications .chart-card {
  margin-bottom: 32px;
}

header.hero {
  position: relative;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 24px;
  align-items: start;
  margin-bottom: 40px;
}

@media (max-width: 600px) {
  header.hero {
    grid-template-columns: 1fr;
  }
}

.hero-photo {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 8px;
  text-align: left;
}

.bio {
  color: var(--text-secondary);
  max-width: 60ch;
  margin: 0 0 16px;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.links a {
  color: var(--series-1);
  text-decoration: none;
  font-size: 0.9rem;
}

.links a:hover {
  text-decoration: underline;
}

#theme-toggle {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 8px 10px;
  flex-shrink: 0;
}

section {
  margin-bottom: 48px;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 16px;
}

.chart-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 20px 8px;
}

.chart-stats {
  display: flex;
  gap: 32px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
}

#stat-latest {
  color: var(--accent-warm);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

svg#citation-chart {
  width: 100%;
  height: auto;
  overflow: visible;
}

.axis-label {
  fill: var(--text-muted);
  font-size: 11px;
}

.gridline {
  stroke: var(--gridline);
  stroke-width: 1;
}

.baseline {
  stroke: var(--baseline);
  stroke-width: 1;
}

.chart-area {
  fill: var(--series-1-wash);
}

.chart-line {
  fill: none;
  stroke: var(--series-1);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-dot {
  fill: var(--series-1);
  stroke: var(--surface-1);
  stroke-width: 2;
}

.crosshair {
  stroke: var(--text-muted);
  stroke-width: 1;
  opacity: 0;
  pointer-events: none;
}

.hit-area {
  fill: transparent;
}

#tooltip {
  position: absolute;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

#tooltip .tooltip-value {
  font-weight: 700;
  color: var(--text-primary);
}

#tooltip .tooltip-label {
  color: var(--text-secondary);
}

.paper {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.paper-title {
  font-weight: 600;
  margin: 0 0 4px;
}

.paper-title a {
  color: var(--series-1);
  text-decoration: none;
}

.paper-title a:hover {
  text-decoration: underline;
}

.paper-meta {
  color: var(--text-secondary);
  font-size: 0.85rem;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.paper-type {
  text-transform: capitalize;
  color: var(--accent-warm);
}

.paper-year {
  font-weight: 700;
  color: var(--text-primary);
  background: var(--series-1-wash);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.78rem;
}

footer {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
  margin-top: 64px;
}

footer a {
  color: var(--text-muted);
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  z-index: 100;
  cursor: zoom-out;
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  cursor: default;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: #ffffff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
}
