/* ---------- Theme tokens ---------- */
:root {
  --bg: #fbfbf9;
  --surface: #ffffff;
  --text: #1d1f21;
  --muted: #595f66;
  --border: #e3e3df;
  --brand: #0a8194;       /* main turquoise: fills, buttons, markers */
  --accent: #08717f;      /* same hue, slightly deeper so small text stays readable (AA) */
  --accent-soft: #e0f1f3;
  --c1: #0a8194;          /* turquoise */
  --c2: #e8b10e;          /* yellow */
  --c3: #2d5ba8;          /* blue */
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 4px 14px rgb(0 0 0 / .06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121416;
    --surface: #1a1d20;
    --text: #e7e8e9;
    --muted: #a4a9ae;
    --border: #2c3034;
    --brand: #0a8194;
    --accent: #4fc3d3;
    --accent-soft: #12343a;
    --c1: #2aa3b5;
    --c2: #f2c94c;
    --c3: #7fa6e8;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 4px 14px rgb(0 0 0 / .3);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #121416;
  --surface: #1a1d20;
  --text: #e7e8e9;
  --muted: #a4a9ae;
  --border: #2c3034;
  --brand: #0a8194;
  --accent: #4fc3d3;
  --accent-soft: #12343a;
  --c1: #2aa3b5;
  --c2: #f2c94c;
  --c3: #7fa6e8;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 4px 14px rgb(0 0 0 / .3);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  padding: 3rem 1.25rem 2rem;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

main, footer { max-width: 72rem; margin-inline: auto; }

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 { line-height: 1.25; }
p { margin: 0 0 .5rem; }
ul { margin: .4rem 0 0; padding-left: 1.2rem; }
li { margin-bottom: .3rem; }
.muted { color: var(--muted); font-size: .92rem; }

.skip-link {
  position: absolute; left: 1rem; top: -3rem;
  background: var(--surface); color: var(--text);
  padding: .5rem .8rem; border-radius: 6px; z-index: 10;
}
.skip-link:focus { top: 1rem; }

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: fixed; top: 1rem; right: 1rem; z-index: 5;
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  cursor: pointer;
}
.theme-toggle svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle[data-mode="dark"] .icon-sun { display: block; }
.theme-toggle[data-mode="dark"] .icon-moon { display: none; }

/* ---------- Intro: profile (left) + career (right) ---------- */
.intro {
  display: grid;
  grid-template-columns: minmax(15rem, 20rem) minmax(0, 1fr);
  gap: 2rem 4rem;
  align-items: start;
}

.avatar {
  position: relative;
  width: 200px; height: 200px; margin: 0 0 1.25rem;
  border-radius: 50%; overflow: hidden;
  background: var(--accent-soft);
  border: 3px solid var(--surface); box-shadow: var(--shadow);
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-fallback {
  display: grid; place-items: center; height: 100%;
  font-size: 2.6rem; font-weight: 600; letter-spacing: .05em; color: var(--accent);
}

.profile h1 { font-size: clamp(1.7rem, 4vw, 2.1rem); margin: 0 0 .35rem; letter-spacing: -.01em; }
.tagline { color: var(--muted); font-size: 1rem; margin-bottom: 1.1rem; }

.social { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }
.social a {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .4rem .85rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); text-decoration: none; font-size: .92rem;
}
.social a:hover { border-color: var(--accent); color: var(--accent); }
.social svg { width: 1rem; height: 1rem; fill: currentColor; }
.social svg .cut { fill: none; stroke: var(--surface); stroke-width: 2.2; stroke-linecap: round; }
.social svg .outline { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }

.about { margin-top: 1.75rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.about p { margin-bottom: 1rem; }
.skills { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; padding: 0; margin: 0; }
.skills li { margin: 0; padding: .15rem .6rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: .82rem; }

/* ---------- Sections ---------- */
#projects { padding-top: 2.25rem; margin-top: 2.25rem; border-top: 1px solid var(--border); }
.side-section { margin-top: 1.75rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.side-section .pub-title { font-size: 1rem; line-height: 1.4; }
.side-section .authors, .side-section .org { font-size: .9rem; }
h2 { font-size: 1.35rem; margin: 0 0 1.1rem; }
h2::before { content: ""; display: inline-block; width: .55rem; height: .55rem; margin-right: .6rem; border-radius: 2px; background: var(--brand); vertical-align: .15em; }

.entry { margin-bottom: 1.6rem; }
.entry:last-child { margin-bottom: 0; }
.entry-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .1rem 1rem; }
.entry h3 { font-size: 1.05rem; margin: 0; }
.date { color: var(--muted); font-size: .9rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.org { color: var(--muted); margin-bottom: .35rem; }
.pub-title { margin-bottom: .2rem !important; }


/* ---------- Career timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: calc(1.625rem - 1px); top: 1rem; bottom: 1rem;
  width: 2px; background: var(--border);
}
.tl-item { position: relative; min-height: 3.25rem; padding: 0 0 1.75rem 4.5rem; margin: 0; }
.tl-item:last-child { padding-bottom: 0; }
.tl-logo {
  position: absolute; left: 0; top: 0;
  width: 3.25rem; height: 3.25rem; padding: .25rem;
  object-fit: contain; border-radius: 10px;
  background: #fff; /* logos are designed for white backgrounds, in both themes */
  border: 1px solid var(--border);
  box-shadow: 0 0 0 4px var(--bg);
}
.tl-work { --dot: var(--c1); }
.tl-edu { --dot: var(--c2); }
.tl-volunteer { --dot: var(--c3); }

.tl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .7rem; margin-bottom: .25rem; }
.badge {
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: .05rem .5rem; border-radius: 4px;
  color: var(--text); background: color-mix(in srgb, var(--dot) 22%, transparent);
}
.tl-item h3 { font-size: 1.05rem; margin: 0 0 .1rem; }
.tl-item .org { margin-bottom: .25rem; }
.tl-item ul { margin-top: .2rem; }

/* ---------- Project cards ---------- */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
@media (max-width: 640px) { .cards { grid-template-columns: 1fr; } }

.card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden; box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgb(0 0 0 / .06), 0 10px 26px rgb(0 0 0 / .1); }
@media (prefers-reduced-motion: reduce) { .card, .card:hover { transition: none; transform: none; } }

.thumb { margin: 0; aspect-ratio: 2 / 1; background: var(--accent-soft); border-bottom: 1px solid var(--border); }
.thumb svg { display: block; width: 100%; height: 100%; }
.thumb .c1 { fill: var(--c1); }
.thumb .c2 { fill: var(--c2); }
.thumb .c3 { fill: var(--c3); }
.thumb-a .c1, .thumb-a .c2 { opacity: .75; }
.thumb .nuc { fill: var(--surface); opacity: .85; }
.thumb .line { fill: none; stroke: var(--muted); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.thumb .box, .thumb .node rect { fill: var(--surface); stroke: var(--border); stroke-width: 2; }
.thumb .node rect:last-child { stroke: var(--c2); }
.thumb .label text { fill: var(--text); font: 600 13px system-ui, sans-serif; text-anchor: middle; }
.thumb .state { opacity: .8; }

.card-body { display: flex; flex-direction: column; flex: 1; padding: 1.1rem 1.25rem 1.25rem; }
.card h3 { font-size: 1.08rem; margin: 0 0 .5rem; }
.question { margin-bottom: .8rem; }
.tags { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; padding: 0; margin: 0 0 .8rem; }
.tags li { margin: 0; padding: .1rem .55rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .78rem; font-weight: 600; }
.card-meta { color: var(--muted); font-size: .86rem; }
.card-links { margin-top: auto; padding-top: .4rem; }

/* ---------- Footer ---------- */
footer { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); text-align: center; }
.contact-button {
  display: inline-block; margin-bottom: 1rem;
  padding: .6rem 1.2rem; border-radius: 999px;
  background: var(--brand); color: #fff;
  font-weight: 600; text-decoration: none;
}
.contact-button:hover { filter: brightness(1.12); }

/* ---------- Narrow screens: stack the intro ---------- */
@media (max-width: 860px) {
  .intro { grid-template-columns: 1fr; }
  .profile { position: static; text-align: center; }
  .avatar { margin-inline: auto; width: 160px; height: 160px; }
  .social { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .about, .side-section { text-align: left; }
  .career { padding-top: 2.25rem; border-top: 1px solid var(--border); }
}
@media (max-width: 480px) {
  body { padding-top: 4rem; }
  .avatar { width: 128px; height: 128px; }
}

/* ---------- Publication and repository links ---------- */
.authors { margin-bottom: .2rem; }
.pub-title a { color: inherit; text-decoration-color: var(--brand); }
.repo-link {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .88rem; font-weight: 600; text-decoration: none;
}
.repo-link:hover span { text-decoration: underline; }
.repo-link svg { width: 1rem; height: 1rem; fill: currentColor; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.tl-item h3 a { color: inherit; text-decoration-color: var(--brand); }
.tl-item .org a { color: inherit; text-decoration-color: var(--muted); }
.tl-item .org a:hover { color: var(--accent); }
.tl-link a { display: inline-flex; align-items: center; gap: .4rem; font-size: .92rem; font-weight: 600; text-decoration: none; }
.tl-link a:hover { text-decoration: underline; }
.tl-link svg { width: 1.1rem; height: 1.1rem; flex: none; fill: var(--brand); }
.tl-link svg .cut { fill: #fff; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; }
.thumb .code { fill: none; stroke: var(--border); stroke-width: 6; stroke-linecap: round; }
.thumb .tick { fill: none; stroke: var(--c1); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.thumb .cross { fill: none; stroke: var(--c2); stroke-width: 4; stroke-linecap: round; }
.thumb-f .c1, .thumb-f .c2, .thumb-f .c3 { opacity: .85; }
.thumb .fish { opacity: .85; }
.thumb .eye { fill: var(--surface); }
.thumb .thermo { fill: var(--surface); stroke: var(--border); stroke-width: 2; }

/* ---------- Project cards: Methods / Tools rows ---------- */
.stack { display: flex; gap: .6rem; align-items: flex-start; margin-bottom: .55rem; }
.stack-label {
  flex: none; width: 4.2rem; padding-top: .15rem;
  font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.stack .tags { margin: 0; }
.tags-tools li { background: transparent; color: var(--text); border: 1px solid var(--border); font-weight: 500; }
.card .card-meta { margin-top: .3rem; }
.thumb .stem { fill: none; stroke: var(--muted); stroke-width: 3; stroke-linecap: round; }
.thumb .open { fill: var(--surface); stroke: var(--c1); stroke-width: 3; }
.thumb .hap text { fill: var(--muted); font: 700 12px system-ui, sans-serif; }
.repo-link svg .cut { fill: none; stroke: var(--surface); stroke-width: 1.6; stroke-linecap: round; }
.thumb .band { fill: var(--c1); opacity: .18; }
.thumb .q { fill: none; stroke: var(--c1); stroke-width: 2.5; stroke-dasharray: 6 6; stroke-linecap: round; }
.thumb .q50 { fill: none; stroke: var(--c1); stroke-width: 4; stroke-linecap: round; }
.thumb-i .c3 { opacity: .7; }
