/* Source Sans 3, self-hosted */
@font-face { font-family: 'Source Sans 3'; font-style: normal; font-weight: 200 900; font-display: swap; src: url(../fonts/source-sans-3-latin-wght-normal.woff2) format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-style: italic; font-weight: 200 900; font-display: swap; src: url(../fonts/source-sans-3-latin-wght-italic.woff2) format('woff2'); }

:root {
  --bg: #ffffff;
  --ink: #1f1f1f;
  --muted: #5c5c5c;
  --rule: #d6dde0;
  --rule-strong: #1f1f1f;
  --accent: #0a5f7a;
  --accent-dark: #074a60;
  --link: #0a5f7a;
  --soft: #f2f6f7;
  --panel: #1d2c34;
  --font: 'Source Sans 3', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --measure: 46rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212; --ink: #e6e6e6; --muted: #a3a3a3; --rule: #3a3a3a; --rule-strong: #e6e6e6;
    --link: #f0a3a3; --soft: #1c1b1a; --accent: #0a5f7a;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 1.0625rem; line-height: 1.6;
  display: flex; flex-direction: column; min-height: 100vh;
}
main { flex: 1; width: 100%; max-width: 50rem; margin: 0 auto; padding: 2rem 1.25rem 3.5rem; }
main:not(.wide) > * { max-width: var(--measure); }
main:not(.wide) > .course-grid { max-width: none; }

a { color: var(--link); text-decoration: underline; text-underline-offset: .15em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
sub, sup { font-size: .75em; line-height: 0; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9em; }
img { max-width: 100%; height: auto; }
p { margin: 0 0 .9em; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--ink); color: var(--bg); padding: .4rem .7rem; z-index: 10; }
.skip:focus { left: .5rem; top: .5rem; }
.faint { color: var(--muted); }
.fine { font-size: .875rem; color: var(--muted); }
.label, .label-line { color: var(--muted); }
.label-line { margin: 0 0 .2em; font-weight: 600; color: var(--ink); }

/* Header */
.topband { background: var(--accent); color: #fff; font-size: .95rem; }
.topband-inner { max-width: 50rem; margin: 0 auto; padding: .4rem 1.25rem; font-family: Georgia, 'Times New Roman', serif; font-size: 1.05rem; }
.masthead { background: #fff; color: #1f1f1f; box-shadow: 0 1px 4px rgba(0,0,0,.18); position: relative; }
.masthead-inner { max-width: 50rem; margin: 0 auto; padding: .8rem 1.25rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1.5rem; }
.wordmark { display: flex; flex-direction: column; text-decoration: none; line-height: 1.15; margin-right: auto; }
.wm-name { font-weight: 700; font-size: 1.55rem; color: var(--accent); letter-spacing: -.01em; }
.wm-sub { font-size: .95rem; color: #333; }
.wordmark:hover .wm-name { text-decoration: underline; }
.site-nav { display: flex; flex-wrap: wrap; gap: .25rem 1.3rem; font-size: 1rem; }
.site-nav a { color: #1f1f1f; text-decoration: none; padding: .25rem 0; border-bottom: 3px solid transparent; }
.site-nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.site-nav a[aria-current='page'] { font-weight: 700; border-bottom-color: var(--accent); }
.menu-toggle { display: none; align-items: center; flex-direction: column; gap: 0; font: inherit; font-size: .95rem; background: none; border: 0; color: #1f1f1f; cursor: pointer; padding: .2rem .3rem; }
.menu-toggle:hover { color: var(--accent); }

/* Footer */
.colophon { background: var(--accent); color: #fff; margin-top: 2rem; }
.colophon a { color: #fff; }
.colophon-inner { max-width: 50rem; margin: 0 auto; padding: 2rem 1.25rem 1.5rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem 2rem; }
.colophon-id p { margin: 0 0 .5rem; font-size: .975rem; line-height: 1.5; }
.colophon-name { font-family: Georgia, 'Times New Roman', serif; font-size: 1.5rem !important; line-height: 1.2 !important; }
.colophon-links { margin-top: .6rem !important; }
.colophon-links a { text-decoration: underline; }
.colophon-nav { display: flex; flex-direction: column; gap: .4rem; font-weight: 600; }
.colophon-nav a { text-decoration: none; }
.colophon-nav a:hover { text-decoration: underline; }
.colophon-nav a[aria-current='page'] { text-decoration: underline; }
.colophon-fine { grid-column: 1 / -1; margin: 0; font-size: .875rem; border-top: 1px solid rgba(255,255,255,.35); padding-top: .9rem; }
.to-top { position: fixed; right: 1rem; bottom: 1rem; display: inline-flex; align-items: center; gap: .3rem; background: var(--accent); color: #fff; text-decoration: none; font-weight: 600; padding: .55rem .9rem; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.3); z-index: 20; }
.to-top:hover { background: var(--accent-dark); color: #fff; text-decoration: none; }
.to-top[hidden] { display: none; }

/* Home */
.intro { display: grid; grid-template-columns: 1fr 10.5rem; gap: 2rem; align-items: start; }
h1 { font-size: 2.1rem; line-height: 1.2; font-weight: 700; margin: 0 0 .5rem; }
.affil { color: var(--muted); font-size: .975rem; line-height: 1.5; margin-bottom: 1.1rem; }
.portrait { margin: .3rem 0 0; }
.portrait img { display: block; width: 100%; aspect-ratio: 1; border-radius: 50%; background: var(--soft); }
.links { font-size: .975rem; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem 1.4rem; }
.tiles a { display: block; height: 100%; padding: .55rem .9rem; border-left: 4px solid var(--accent); background: var(--soft); text-decoration: none; color: var(--ink); }
.tiles a:hover { background: var(--bg); box-shadow: inset 0 0 0 1px var(--rule), inset 4px 0 0 var(--accent); }
.tile-title { display: block; font-weight: 700; color: var(--link); font-size: 1.1rem; }
.tile-desc { display: block; font-size: .95rem; line-height: 1.45; color: var(--ink); }
.tiles a:hover .tile-title { text-decoration: underline; }
.block { margin-top: 2.2rem; }
h2 { font-size: 1.35rem; line-height: 1.3; font-weight: 700; margin: 0 0 .7rem; padding-bottom: .25rem; border-bottom: 2px solid var(--accent); }
.block-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid var(--accent); margin-bottom: .7rem; }
.block-head h2 { border: 0; margin: 0; }
.more { font-size: .9rem; white-space: nowrap; }
.row-list, .timeline, .note-list, .courses, .books { list-style: none; margin: 0; padding: 0; }
.row-list li { margin-bottom: .9rem; }
.row-link { text-decoration: none; display: block; color: var(--ink); }
.row-title { display: block; font-weight: 700; color: var(--link); }
.row-link:hover .row-title { text-decoration: underline; }
.row-meta { display: block; font-size: .875rem; color: var(--muted); }
.row-desc { display: block; }
.timeline li { display: grid; grid-template-columns: 6.5rem 1fr; gap: .8rem; padding: .3rem 0; }
.when { color: var(--muted); font-size: .95rem; }

/* Lists */
.bullets { margin: 0 0 1em; padding-left: 1.3rem; }
.bullets li { margin-bottom: .35em; }

/* Entries (research, projects) */
.page-head { margin-bottom: 1.6rem; }
.page-head h1 { margin-bottom: .6rem; }
.page-head p { color: var(--ink); }
.entry { padding: 1.6rem 0 .6rem; border-top: 1px solid var(--rule); }
.entry:first-of-type { border-top: 0; padding-top: .4rem; }
.entry h2 { border: 0; padding: 0; margin: 0 0 .15rem; font-size: 1.25rem; }
.entry header { margin-bottom: .9rem; }
.meta-line { font-size: .9rem; color: var(--muted); margin: 0; line-height: 1.5; }
.highlight { font-weight: 600; }
.keywords { font-size: .9rem; color: var(--muted); margin: 0 0 1em; }

/* Tables: rules only */
table.data { border-collapse: collapse; margin: 1.1rem 0 1.4rem; font-size: .95rem; width: 100%; max-width: 38rem; font-variant-numeric: tabular-nums; }
table.data caption { caption-side: top; text-align: left; font-size: .9rem; color: var(--muted); padding-bottom: .35rem; }
table.data th, table.data td { padding: .3rem .8rem .3rem 0; text-align: left; vertical-align: top; font-weight: 400; }
table.data thead th { font-weight: 600; border-top: 2px solid var(--accent); border-bottom: 1px solid var(--rule-strong); padding-top: .35rem; padding-bottom: .35rem; }
table.data tbody tr:last-child th, table.data tbody tr:last-child td { padding-bottom: .4rem; }
table.data tbody { border-bottom: 1.5px solid var(--rule-strong); }
table.data tbody th { font-weight: 400; }

/* Figures and diagram */
.figure { margin: 1.2rem 0 1.4rem; }
.figure img { display: block; max-width: 100%; height: auto; border: 1px solid var(--rule); }
.figure figcaption { font-size: .9rem; color: var(--muted); margin-top: .4rem; }
.diagram { width: 100%; max-width: 40rem; height: auto; color: var(--ink); font-family: var(--font); }
.diagram text { fill: currentColor; font-size: 12.5px; text-anchor: middle; }
.d-line path { stroke: var(--muted); stroke-width: 1.3; fill: none; }
.d-box rect { fill: var(--bg); stroke: var(--ink); stroke-width: 1.2; }
.d-done rect { fill: var(--soft); stroke-width: 2; }
.d-wip rect { stroke-dasharray: 4 3; stroke: var(--muted); }
.d-note { text-anchor: start !important; fill: var(--muted) !important; }
.d-key text { text-anchor: start; fill: var(--muted); font-size: 11.5px; }
.k-done { fill: var(--soft); stroke: var(--ink); stroke-width: 1.6; }
.k-wip { fill: var(--bg); stroke: var(--muted); stroke-dasharray: 3 2; stroke-width: 1.2; }

/* Project filters */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .9rem; }
.filters[hidden] { display: none; }
.chip { font: inherit; font-size: .9rem; background: none; color: var(--link); border: 1px solid var(--rule); border-radius: 3px; padding: .1rem .6rem; cursor: pointer; }
.chip:hover { border-color: var(--link); }
.chip[aria-pressed='true'] { background: var(--accent); color: #fff; border-color: var(--accent); }
[data-areas][hidden] { display: none; }

/* Coursework */
.course-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 2.5rem; }
.course-group { margin-bottom: 1.5rem; break-inside: avoid; }
.course-group h2 { font-size: 1.1rem; }
.courses li { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; padding: .22rem 0; line-height: 1.4; }
.course-meta { font-size: .85rem; color: var(--muted); white-space: nowrap; display: inline-flex; gap: .6rem; }
.course-meta .more { font-size: .85rem; }

/* CV */
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 0; }
.btn { font: inherit; font-size: .95rem; display: inline-block; text-decoration: none; background: none; color: var(--link); border: 1px solid var(--link); border-radius: 3px; padding: .25rem .8rem; cursor: pointer; }
.btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.cv-section { margin-bottom: 1.8rem; }
.cv-section h2 { font-size: 1.2rem; }
.cv-row { display: grid; grid-template-columns: 9rem 1fr; gap: 1rem; padding: .45rem 0; }
.cv-when { color: var(--muted); font-size: .95rem; }
.cv-title { font-weight: 600; margin: 0; line-height: 1.4; }
.cv-what .bullets { margin: .3rem 0 0; font-size: 1rem; }
.cv-what p:last-child { margin-bottom: 0; }
.print-only { display: none; }

/* Beyond */
.life-section { margin-bottom: 1.4rem; }
.life-section h2 { font-size: 1.15rem; }
.life-section p:last-child { margin-bottom: 0; }
.books { margin: .5rem 0 0; padding-left: 1.3rem; list-style: disc; }
.books li { padding: .1rem 0; }
.book-title { font-style: italic; }

/* Notes */
.note-item { padding: .7rem 0; }
.note-item p:last-child { margin-bottom: 0; }
.prose h2 { margin-top: 1.8rem; }
.prose h3 { font-size: 1.1rem; margin: 1.4rem 0 .4rem; }
.prose blockquote { margin: 1.1rem 0; padding-left: 1rem; border-left: 3px solid var(--rule); color: var(--muted); }
.prose img { display: block; margin: 1.2rem 0; }
.prose pre { background: var(--soft); padding: .8rem; overflow-x: auto; }
.prose :not(pre) > code { background: var(--soft); padding: .05em .3em; }

/* Small screens */
@media (max-width: 720px) {
  body { font-size: 1.025rem; }
  .intro { grid-template-columns: 1fr; gap: 1rem; }
  .portrait { order: -1; width: 7.5rem; }
  .tiles { grid-template-columns: 1fr; }
  .course-grid { grid-template-columns: 1fr; }
  .cv-row { grid-template-columns: 1fr; gap: 0; }
  .timeline li { grid-template-columns: 1fr; gap: 0; }
  table.data { font-size: .9rem; }
  .colophon-inner { grid-template-columns: 1fr; }
  .colophon-fine { padding-right: 9rem; }
  /* menu: collapsed behind a button when JavaScript is available */
  .js .menu-toggle { display: inline-flex; }
  .masthead-inner { flex-wrap: wrap; }
  .js .site-nav { display: none; flex: 0 0 auto; width: calc(100% + 2.5rem); margin: .7rem -1.25rem -.8rem; padding: 0 1.25rem .6rem; background: var(--panel); flex-direction: column; gap: 0; }
  .js .site-nav.open { display: flex; }
  .js .site-nav a { color: #fff; font-weight: 700; font-size: 1.15rem; padding: 1rem .4rem 1rem 1rem; border-bottom: 1px solid #3b4e58; border-left: 5px solid transparent; }
  .js .site-nav a:hover { color: #fff; background: #27394a; }
  .js .site-nav a[aria-current='page'] { border-left-color: #4cc9e0; }
}

/* Print (saving the CV page as PDF) */
@media print {
  :root { --bg: #fff; --ink: #000; --muted: #333; --rule: #bbb; --rule-strong: #000; --link: #000; }
  body { font-size: 10.5pt; line-height: 1.4; display: block; }
  .topband, .masthead, .colophon, .to-top, .no-print, .skip { display: none !important; }
  .print-only { display: block; }
  main { max-width: none; padding: 0; }
  h1 { font-size: 20pt; }
  a { text-decoration: none; color: #000; }
  .cv-section { break-inside: avoid-page; margin-bottom: 1rem; }
  .cv-row { break-inside: avoid; padding: .25rem 0; grid-template-columns: 8rem 1fr; }
}
