/* ==========================================================================
   Tokens
   ========================================================================== */

:root {
  --bg: #F7F6F2;
  --card: #FFFFFF;
  --card-border: rgba(27, 26, 23, 0.07);
  --inner: #F3F1EC;
  --text: #1B1A17;
  --muted: #69655D;
  --line: #E4E0D7;
  --accent: #3B48C4;
  --button-bg: #1B1A17;
  --button-hover: #3A3833;
  --button-text: #F7F6F2;
  --figure-filter: none;
  /* Course topic colors (word cloud) */
  --topic-ml: #6B47C9;
  --topic-math: #2563B8;
  --topic-cs: #2C7A57;
  --topic-other: #93621A;
  color-scheme: light;

  /* System fonts only: no external requests (SF Pro on Apple, Segoe UI on Windows, Roboto on Android) */
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Sized so the full name (about 10× its font size wide) fits on one line beside the photo */
  --size-intro: clamp(20px, 1vw + 15px, 28px);
  --size-h2: clamp(30px, 1.3vw + 22px, 40px);
  --size-h3: clamp(21px, 0.5vw + 18px, 26px);
  --size-body: clamp(17px, 0.25vw + 16px, 19px);
  --size-lead: clamp(19px, 0.3vw + 17px, 21px);
  --size-small: 15px;

  --gutter: 24px;
  --max-width: 1040px;
  --section-gap: clamp(72px, 6vw + 40px, 112px);
}

/* Dark theme: used when the visitor picks it with the toggle (data-theme="dark" on <html>),
   or when the system is dark and they haven't picked light. Keep the two blocks identical. */
:root[data-theme="dark"] {
  --bg: #141413;
  --card: #1C1C1A;
  --card-border: rgba(255, 255, 255, 0.06);
  --inner: #262623;
  --text: #EDEBE6;
  --muted: #A29E95;
  --line: #2F2E2A;
  --accent: #9AA5FF;
  --button-bg: #EDEBE6;
  --button-hover: #FFFFFF;
  --button-text: #141413;
  --figure-filter: brightness(0.9);
  --topic-ml: #B8A4F7;
  --topic-math: #8FB6F2;
  --topic-cs: #8DD0AE;
  --topic-other: #E0BE86;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141413;
    --card: #1C1C1A;
    --card-border: rgba(255, 255, 255, 0.06);
    --inner: #262623;
    --text: #EDEBE6;
    --muted: #A29E95;
    --line: #2F2E2A;
    --accent: #9AA5FF;
    --button-bg: #EDEBE6;
    --button-hover: #FFFFFF;
    --button-text: #141413;
    --figure-filter: brightness(0.9);
    --topic-ml: #B8A4F7;
    --topic-math: #8FB6F2;
    --topic-cs: #8DD0AE;
    --topic-other: #E0BE86;
    color-scheme: dark;
  }
}

/* ==========================================================================
   Base
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--size-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

.container {
  max-width: calc(var(--max-width) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

main > * + * { margin-top: var(--section-gap); }

.section-heading {
  font-size: var(--size-h2);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.text-link { font-weight: 500; }

::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }

/* ==========================================================================
   Theme toggle (round button at the right of the top bar)
   ========================================================================== */

/* Just the icon: no circle or fill, but the full 40px stays clickable */
.icon-button.theme-toggle {
  margin-right: -10px;   /* lines the icon itself up with the column edge */
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: color 0.2s ease;
}
.icon-button.theme-toggle:hover { background: transparent; color: var(--text); }
/* It needs JavaScript; without it the site just follows the system setting */
html:not(.js) .theme-toggle { display: none; }
.theme-toggle span { display: grid; place-items: center; }

/* Show the moon in light mode (switch to dark) and the sun in dark mode */
.theme-icon-sun,
[data-theme="dark"] .theme-icon-moon { display: none !important; }
[data-theme="dark"] .theme-icon-sun { display: grid !important; }

/* Theme switch: the page cross-fades via the View Transitions API (see the toggle script) */
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 0.3s; }

/* ==========================================================================
   Section nav (left margin, wide screens only)
   ========================================================================== */

html { scroll-behavior: smooth; }
main > section { scroll-margin-top: 104px; }   /* clears the sticky top bar */

.section-nav { display: none; }

/* Shown only where the left margin beside the 1040px column has room for it */
@media (min-width: 1360px) {
  .section-nav {
    display: block;
    position: fixed;
    top: 50%;
    left: calc((100vw - var(--max-width)) / 4 - 60px);
    transform: translateY(-50%);
  }
}

/* Stacked list on a thin line; the current section gets text color and an accent bar */
.section-nav ol { border-left: 1px solid var(--line); }
.section-nav a {
  display: block;
  margin-left: -1px;
  padding: 6px 0 6px 16px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: var(--size-small);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.section-nav a:hover { color: var(--text); text-decoration: none; }
.section-nav a[aria-current="true"] {
  border-left-color: var(--accent);
  color: var(--text);
  font-weight: 500;
}

/* ==========================================================================
   Header
   ========================================================================== */

/* Top bar: sticky, small photo and name on the left, theme toggle on the right */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.name {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  white-space: nowrap;
}
.name-photo {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--card);
}

/* Intro: the tagline as the page's opening statement (two-tone: the lead in `text`, the rest
   `muted`), then the contact links as small outlined pills like the course filters */
.intro { padding-top: clamp(36px, 2.5vw + 16px, 56px); }

.tagline {
  max-width: 34em;
  text-wrap: balance;
  font-size: var(--size-intro);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--muted);
}
.tagline-lead { color: var(--text); }

/* A shorter gap under the intro than between sections, so the header stays compact */
main > .intro + * { margin-top: clamp(56px, 3vw + 32px, 80px); }

/* The email address is built by a script; without JavaScript there is no link, so hide it */
html:not(.js) .contact-links li:has(> [data-mail]),
html:not(.js) .footer-links [data-mail] { display: none; }

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}
.contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.contact-links a:hover {
  border-color: transparent;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  text-decoration: none;
}
.contact-links a:focus-visible { border-radius: 999px; }
.contact-links svg { width: 15px; height: 15px; flex-shrink: 0; fill: currentColor; color: var(--muted); }
.contact-links svg[fill="none"] { fill: none; }

/* External links get a small arrow, set in CSS so it isn't read out as part of the name */
.contact-links a[target="_blank"]::after {
  content: "\2197";
  content: "\2197" / "";
  margin-left: -2px;
  color: var(--muted);
  font-size: 0.85em;
  transition: transform 0.2s ease;
}
.contact-links a[target="_blank"]:hover::after { transform: translate(1px, -1px); }

.button-primary {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--button-bg);
  color: var(--button-text);
  font-size: 16px;
  font-weight: 500;
  transition: background-color 0.2s ease;
}
.button-primary:hover { background: var(--button-hover); text-decoration: none; }
.button-primary:focus-visible { border-radius: 999px; }

.icon-button {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  transition: background-color 0.2s ease;
}
.icon-button:hover { background: var(--inner); }
.icon-button:focus-visible { border-radius: 50%; }
.icon-button svg { width: 20px; height: 20px; fill: currentColor; }
.icon-button svg[fill="none"] { fill: none; }

/* ==========================================================================
   Projects
   ========================================================================== */


/* Project list: rows like the publications and timeline lists. Each row is a <details>:
   the summary line has a thumbnail, title / one-line summary / meta, and a chevron;
   opening it shows the description, details and links below, aligned with the text. */
.project-list { margin-top: 32px; }

.project-row { border-top: 1px solid var(--line); }
.project-row:last-child { border-bottom: 1px solid var(--line); }

.project-summary-row {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  align-items: center;
  gap: 28px;
  padding: 20px 0;
  cursor: pointer;
  list-style: none;
}
.project-summary-row::-webkit-details-marker { display: none; }
.project-summary-row:focus-visible { outline-offset: 4px; border-radius: 12px; }

.project-thumb {
  display: block;
  width: 160px;
  height: 120px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #FFFFFF;
  object-fit: cover;
  filter: var(--figure-filter);
}
/* Drawn stand-in until a project has a figure */
.project-thumb-placeholder {
  display: grid;
  place-items: center;
  background: var(--inner);
  color: var(--muted);
  filter: none;
}
.project-thumb-placeholder svg { width: 100%; height: 100%; }

.project-info { display: block; }
.project-title {
  display: block;
  font-size: var(--size-h3);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
  transition: color 0.2s ease;
}
.project-summary {
  display: block;
  margin-top: 6px;
  font-size: var(--size-body);
  line-height: 1.45;
}
.project-meta {
  display: block;
  margin-top: 8px;
  font-size: var(--size-small);
  color: var(--muted);
}

/* Chevron on the right that flips when the row is open */
.project-toggle {
  display: grid;
  place-items: center;
  align-self: start;
  margin-top: 2px;
  color: var(--muted);
  transition: color 0.2s ease;
}
.project-chevron {
  width: 22px;
  height: 22px;
  transition: transform 0.25s ease;
}
.project[open] .project-chevron { transform: rotate(180deg); }
.project-summary-row:hover .project-title,
.project-summary-row:hover .project-toggle { color: var(--accent); }

/* Expanded details, indented to line up with the text column */
.project-details {
  max-width: calc(62ch + 188px);
  padding: 0 0 24px 188px;      /* thumbnail 160 + gap 28 */
  font-size: 16px;
  line-height: 1.6;
}
.project-details > * + * { margin-top: 16px; }

/* Small labelled facts (supervisors, tech): muted label column, text beside it */
.project-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  font-size: var(--size-small);
  line-height: 1.5;
}
.project-facts dt { color: var(--muted); }
.project-facts dd { margin: 0; }

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

/* Key result: a quiet accent rule rather than a boxed card */
.key-result {
  padding-left: 18px;
  border-left: 2px solid var(--accent);
}
.key-result-label {
  margin-bottom: 4px;
  font-size: var(--size-small);
  font-weight: 600;
  color: var(--accent);
}

/* Smooth open/close where the browser can animate <details> (others just snap) */
:root { interpolate-size: allow-keywords; }
.project::details-content {
  block-size: 0;
  overflow: hidden;
  transition: block-size 0.3s ease, content-visibility 0.3s allow-discrete;
}
.project[open]::details-content { block-size: auto; }

/* ==========================================================================
   Publications
   ========================================================================== */

.pub-list { margin-top: 32px; }

/* Same 240px grid as the timeline: kind + year on the left, citation on the right */
.pub-row {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}
.pub-row:last-child { border-bottom: 1px solid var(--line); }

.pub-kind {
  padding-top: 2px;
  font-size: var(--size-small);
  color: var(--muted);
}

.pub-title {
  font-size: var(--size-body);
  font-weight: 600;
  line-height: 1.45;
}

.pub-authors,
.pub-venue {
  margin-top: 4px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--muted);
}
.pub-authors strong { font-weight: 600; color: var(--text); }
.pub-venue { margin-top: 0; font-style: italic; }

.pub-links {
  margin-top: 8px;
  font-size: 16px;
}

/* ==========================================================================
   Experience & Education
   ========================================================================== */

.timeline { margin-top: 32px; }

/* LinkedIn-style rows: logo + date on the left (240px column), role and description on the right */
.timeline-row {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}
.timeline-row:last-child { border-bottom: 1px solid var(--line); }

.timeline-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  align-self: start;
}

.timeline-marker {
  position: relative;
  flex-shrink: 0;
}

.timeline-date {
  font-size: var(--size-small);
  color: var(--muted);
}

.timeline-logo {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
}

.timeline-logo-placeholder {
  display: grid;
  place-items: center;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Secondary logo overlapping the main one's corner */
.timeline-logo-badge {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  box-shadow: 0 0 0 2px var(--bg);
}

/* Offset so the role line sits level with the logo's centre */
.timeline-body { padding-top: 7px; }

.timeline-role {
  font-size: var(--size-body);
  font-weight: 600;
  line-height: 1.55;
}
.timeline-org { font-weight: 400; color: var(--muted); }
.timeline-org::before { content: " · "; }

.timeline-body p,
.timeline-list li {
  margin-top: 4px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--muted);
}

/* Sub-projects within one role (e.g. one per summer) */
.timeline-list li {
  display: grid;
  grid-template-columns: 48px 1fr;
  margin-top: 6px;
}
.timeline-year { font-weight: 500; color: var(--text); }

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 40px;   /* close under the last section; the top rule separates it */
  padding: 28px 0 48px;
  border-top: 1px solid var(--line);
  font-size: var(--size-small);
  color: var(--muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
}
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--text); }

/* ==========================================================================
   Courses (word cloud colored by topic, with a pure-CSS topic filter)
   ========================================================================== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.courses-note {
  margin-top: 12px;
  font-size: var(--size-small);
  color: var(--muted);
}
.courses-note code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.t-ml   { --topic: var(--topic-ml); }
.t-math { --topic: var(--topic-math); }
.t-cs   { --topic: var(--topic-cs); }
.t-other { --topic: var(--topic-other); }
.t-project { --topic: var(--text); }

.course-cloud-wrap { margin-top: 28px; }

/* Topic filter: radio buttons drawn as pills */
.course-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}
.course-filter label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.course-filter label:hover { color: var(--text); }
.course-filter input:checked + label {
  border-color: var(--text);
  color: var(--text);
  font-weight: 500;
}
.course-filter input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.course-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--topic);
}
.course-count {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
}

/* The cloud: centered, wrapping words of three sizes, each in its topic color */
.course-cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 12px 28px;
  padding: 40px 40px;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  background: var(--card);
  text-align: center;
}
/* Small vertical offsets so rows don't look ruled */
.course-cloud li:nth-child(3n) { transform: translateY(3px); }
.course-cloud li:nth-child(4n + 1) { transform: translateY(-3px); }

.course-word {
  display: inline-block;
  color: var(--topic);
  line-height: 1.25;
  text-decoration: underline 1.5px transparent;
  text-underline-offset: 4px;
  transition: opacity 0.25s ease, text-decoration-color 0.2s ease;
}
.course-word:hover { text-decoration-color: currentColor; }
.course-word.size-l { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.course-word.size-m { font-size: 18px; font-weight: 500; }
.course-word.size-s { font-size: 15.5px; }

/* Filtering: courses outside the chosen topic fade out and can't be clicked;
   in the graph, edges that touch no course of the topic fade too */
.course-cloud-wrap:has(#topic-ml:checked)    :is(.course-word, .graph-node):not(.t-ml),
.course-cloud-wrap:has(#topic-math:checked)  :is(.course-word, .graph-node):not(.t-math),
.course-cloud-wrap:has(#topic-cs:checked)    :is(.course-word, .graph-node):not(.t-cs),
.course-cloud-wrap:has(#topic-other:checked) :is(.course-word, .graph-node):not(.t-other),
.course-cloud-wrap:has(#topic-project:checked) .graph-node:not(.t-project) {
  opacity: 0.12;
  pointer-events: none;
}
.course-cloud-wrap:has(#topic-ml:checked)    .graph-edge:not(.a-ml, .b-ml),
.course-cloud-wrap:has(#topic-math:checked)  .graph-edge:not(.a-math, .b-math),
.course-cloud-wrap:has(#topic-cs:checked)    .graph-edge:not(.a-cs, .b-cs),
.course-cloud-wrap:has(#topic-other:checked) .graph-edge:not(.a-other, .b-other),
.course-cloud-wrap:has(#topic-project:checked) .graph-edge:not(.a-project, .b-project) {
  opacity: 0.1;
}

/* Graph (wide screens, built by the "Course graph" script): replaces the cloud */
.graph-note { display: none; }
.courses:has(.has-graph) .graph-note { display: block; }   /* its own line under the first sentence */
.course-cloud-wrap.has-graph .course-cloud { display: none; }
/* Embedding buttons: a row above the topic filter, graph only. Small separate pills,
   lighter than the filter: the chosen one is softly filled rather than outlined */
.course-cloud-wrap:not(.has-graph) .embedding-switch { display: none; }
.embedding-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.embedding-switch button {
  padding: 3px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.embedding-switch button:hover { color: var(--text); }
.embedding-switch button[aria-pressed="true"] {
  border-color: transparent;
  background: color-mix(in srgb, var(--text) 9%, transparent);
  color: var(--text);
}
.course-cloud-wrap:not(.has-graph) :is(.course-graph, label.graph-only) { display: none; }

.course-graph {
  position: relative;
  height: 620px;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  background: var(--card);
  overflow: hidden;
}
.course-graph svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* Edges: soft curves tinted with the mix of the two courses' topic colors (--ea, --eb set by the script) */
.graph-edge {
  fill: none;
  stroke: color-mix(in srgb, color-mix(in srgb, var(--ea) 50%, var(--eb)) 28%, transparent);
  stroke-width: 1;
  stroke-linecap: round;
  transition: opacity 0.15s ease;   /* opacity only: animating the stroke color is costly */
}
.course-graph.is-focus .graph-edge:not(.is-lit) { opacity: 0.35; }
.course-graph.is-focus .graph-edge.is-lit {
  stroke: color-mix(in srgb, color-mix(in srgb, var(--ea) 50%, var(--eb)) 85%, transparent);
  stroke-width: 1.75;
}

/* LDA hover card: the hovered course's top three topics */
.graph-tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  padding: 8px 12px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: var(--card);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.graph-tip.is-shown { opacity: 1; }
.graph-tip p { margin: 0; }
.graph-tip-title { color: var(--muted); font-size: 11.5px; margin-bottom: 2px !important; }
.graph-tip-share {
  display: inline-block;
  min-width: 3.2em;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

/* Nodes: the course name in its topic color, sized by level like the word cloud,
   with no backing, so edges run unchanged under the text */
.graph-node {
  position: absolute;
  top: 0;
  left: 0;
  padding: 2px 7px;
  border-radius: 6px;
  color: var(--topic);
  font-size: 13.5px;
  line-height: 1.3;
  white-space: nowrap;
  transition: opacity 0.15s ease;
}
.graph-node.size-l { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.graph-node.size-m { font-size: 14.5px; font-weight: 500; }
.graph-node.t-project { box-shadow: inset 0 0 0 1.5px var(--text); }
/* Hovered or focused course: a soft pill in its own color (no link underline) */
.graph-node:hover, .graph-node:focus-visible { text-decoration: none; background: color-mix(in srgb, var(--topic) 14%, var(--card)); }
.graph-node:focus-visible { outline: 2px solid var(--topic); outline-offset: 1px; }
.course-graph.is-focus .graph-node:not(.is-lit) { opacity: 0.25; }

/* ==========================================================================
   Motion
   ========================================================================== */

.js .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}

/* ==========================================================================
   Mobile
   ========================================================================== */

@media (max-width: 760px) {
  .topbar-inner { height: 56px; }
  .name { font-size: 16px; gap: 10px; }
  .name-photo { width: 30px; height: 30px; }
  .intro { padding-top: 32px; }
  .contact-links { gap: 6px; margin-top: 18px; }
  .contact-links a { gap: 6px; height: 32px; padding: 0 11px; font-size: 14px; }


  /* Logo on the left spanning the entry; date, role, org and description stacked beside it */
  .timeline-row {
    grid-template-columns: 40px 1fr;
    grid-template-areas:
      "marker date"
      "marker body";
    column-gap: 14px;
    row-gap: 0;
    padding: 18px 0;
  }
  .timeline-meta { display: contents; }
  .timeline-marker { grid-area: marker; align-self: start; }
  .timeline-date { grid-area: date; font-size: 14px; }
  .timeline-body { grid-area: body; padding-top: 0; }
  .timeline-org { display: block; }
  .timeline-org::before { content: none; }
  .timeline-body p,
  .timeline-list li { margin-top: 6px; font-size: 15px; }
  .timeline-list li { grid-template-columns: 42px 1fr; }

  .pub-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 18px 0;
  }
  .pub-kind { padding-top: 0; font-size: 14px; }
  .pub-authors, .pub-venue, .pub-links { font-size: 15px; }

  /* Smaller thumbnail beside the text; toggle becomes just the chevron; details full width */
  .project-summary-row {
    grid-template-columns: 88px 1fr auto;
    align-items: start;
    gap: 16px;
    padding: 18px 0;
  }
  .project-thumb { width: 88px; height: 66px; border-radius: 10px; }
  .project-title { font-size: 18px; }
  .project-summary { font-size: 15px; }
  .project-meta { margin-top: 6px; font-size: 13px; }
  .project-chevron { width: 18px; height: 18px; }
  .project-details { padding-left: 0; font-size: 15px; }

  /* Courses: smaller words and padding */
  .course-filter label { padding: 5px 11px; font-size: 13px; }
  .course-cloud { gap: 6px 14px; padding: 22px 14px; border-radius: 16px; }
  .course-word.size-l { font-size: 16.5px; }
  .course-word.size-m { font-size: 14.5px; }
  .course-word.size-s { font-size: 13px; }

  .footer {
    flex-direction: column-reverse;
    align-items: flex-start;
  }
}
