:root {
  color-scheme: light dark;
  --paper: #fff; --ink: #25282c; --muted: #62686e;
  --line: #e4e6e8; --link: #0872a3;
  /* Waterloo brand palette, https://uwaterloo.ca/brand/how-express-our-brand/colour
     gold = level 3 (primary), selection = level 1 (pale) */
  --gold: #fed34c; --select: #f2eda8;
  --portrait: #fed34c; --tint: #f8f9fa;
  /* ordinal ramp, one hue, light->dark; validated for the light surface */
  --viz-1: #86b6ef; --viz-2: #5598e7; --viz-3: #2a78d6; --viz-4: #184f95;
  --font: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 2rem; }
body {
  margin: 0; border-top: 3px solid var(--gold);
  background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: 1.0625rem; line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
::selection { color: #1b1d20; background: var(--select, #f2eda8); }
a { color: var(--link); text-decoration: none; text-underline-offset: .2em; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--link); outline-offset: 5px; border-radius: 2px; }
p { margin: 0 0 1.15rem; }
h1, h2, h3, h4 { margin: 0; color: var(--ink); line-height: 1.35; }
h1 { font-size: 2rem; font-weight: 600; letter-spacing: -.035em; }
h2 { font-size: 1.65rem; font-weight: 600; letter-spacing: -.025em; margin-bottom: 1.2rem; }
h3 { font-size: 1.125rem; font-weight: 600; margin-bottom: .4rem; }
h4 { font-size: .9375rem; font-weight: 600; margin-bottom: .75rem; }
.wrap { width: min(1032px, calc(100% - 4rem)); margin-inline: auto; }
.skip-link { position: absolute; top: -5rem; left: 1rem; padding: .6rem 1rem; background: var(--paper); z-index: 5; }
.skip-link:focus { top: 1rem; }
.site-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .65rem 2rem; padding-block: 1.55rem; border-bottom: 1px solid var(--line); }
.wordmark { font-size: 1.1875rem; font-weight: 600; letter-spacing: -.02em; color: var(--ink); }
.site-nav { display: flex; flex-wrap: wrap; gap: .3rem 1.5rem; }
.site-nav a { font-size: .9375rem; color: var(--muted); padding-block: .25rem; }
.site-nav a:hover { color: var(--link); }
.page-layout { display: grid; grid-template-columns: 224px minmax(0, 1fr); gap: 4.25rem; align-items: start; padding-block: 3.5rem 3rem; }
.profile { position: sticky; top: 2rem; text-align: center; }
.portrait { display: block; width: 172px; height: 172px; margin: 0 auto 1.35rem; object-fit: cover; border-radius: 50%; background: var(--portrait); }
.role { margin: .6rem 0 .9rem; color: var(--muted); font-size: 1rem; line-height: 1.65; }
.affiliation { font-size: .9375rem; line-height: 1.65; margin-bottom: 1rem; }
.affiliation a { color: var(--muted); }
.affiliation .university { color: var(--ink); }
.profile-email { font-size: .875rem; overflow-wrap: anywhere; }
.profile-links { display: flex; justify-content: center; flex-wrap: wrap; gap: .35rem 1rem; padding-top: .7rem; margin-top: 1rem; border-top: 1px solid var(--line); font-size: .9375rem; }
.profile-links .portfolio { flex-basis: 100%; }
.content, .section-content { min-width: 0; }
.section + .section { margin-top: 2.7rem; padding-top: 2.5rem; border-top: 1px solid var(--line); }
.section-content > :last-child, .about p:last-child { margin-bottom: 0; }
.about h2 { margin-top: -.2rem; }
.research-label { margin-bottom: .65rem; font-size: .875rem; color: var(--muted); }
.section-lead { color: var(--muted); font-size: .9375rem; margin-bottom: .6rem; }
.research-topics { margin: 0; padding: .15rem 0 .15rem 2rem; border-left: 2px solid var(--gold); }
.research-topics li { padding-left: .15rem; margin-block: .25rem; }
.position { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .2rem 1rem; }
.date { font-size: .875rem; color: var(--muted); }
.institution { margin: 0 0 1rem; color: var(--muted); font-size: .9375rem; }
.teaching-current { margin-bottom: 2rem; }
.teaching-current p:last-child { margin-bottom: 0; }
.courses { display: grid; grid-template-columns: 1.18fr 1fr; gap: 1.5rem; margin-top: 1.4rem; }
.course-list { list-style: none; margin: 0; padding: 0; }
.course-list li { display: grid; grid-template-columns: 4.6rem minmax(0, 1fr); gap: .55rem; padding-block: .55rem; border-top: 1px solid var(--line); align-items: baseline; font-size: .875rem; line-height: 1.6; }
.course-code { font-weight: 500; }
.course-name { color: var(--muted); }
.education-entry + .education-entry { margin-top: 1.65rem; }
.education-entry p { margin: .3rem 0 0; }
.education-note { font-size: .9375rem; color: var(--muted); }
.contact-links { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; font-size: .9375rem; }
.contact-links a { overflow-wrap: anywhere; }
.site-footer { border-top: 1px solid var(--line); display: flex; justify-content: space-between; flex-wrap: wrap; gap: .4rem 1rem; padding-block: 1.25rem 2rem; color: var(--muted); font-size: .875rem; }
@media (max-width: 950px) {
  .page-layout { grid-template-columns: 210px minmax(0, 1fr); gap: 2.5rem; }
  .courses { grid-template-columns: 1fr; gap: 1.5rem; }
}
@media (max-width: 700px) {
  .wrap { width: calc(100% - 2.5rem); }
  .site-header { padding-block: 1rem; }
  .site-nav { gap: .2rem 1.1rem; }
  .page-layout { grid-template-columns: 1fr; gap: 2.5rem; padding-top: 2.25rem; }
  .profile { position: static; max-width: 360px; margin-inline: auto; }
  .portrait { width: 144px; height: 144px; margin-bottom: 1rem; }
  .profile-links { padding-top: .85rem; }
  .profile-links .portfolio { flex-basis: auto; }
  .about { padding-top: 2.25rem; border-top: 1px solid var(--line); }
  .section + .section { margin-top: 2.2rem; padding-top: 2rem; }
  h2 { font-size: 1.5rem; }
}
@media (max-width: 380px) {
  .wrap { width: calc(100% - 2rem); }
  .site-nav { gap: .2rem .9rem; }
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #17191c; --ink: #e6e8eb; --muted: #adb3ba; --line: #34373d; --link: #7fc6eb; --gold: #fed34c; --portrait: #fed34c; --tint: #1e2126;
    /* same hue, re-stepped for the dark surface, not an inverted light ramp */
    --viz-1: #1c5cab; --viz-2: #3987e5; --viz-3: #86b6ef; --viz-4: #cde2fb; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print {
  :root { color-scheme: light; --paper: #fff; --ink: #000; --muted: #444; --line: #ccc; --link: #000; --portrait: #fed34c; }
  body { font-size: 10pt; border: 0; }
  .wrap { width: 100%; }
  .site-header, .skip-link { display: none; }
  .page-layout { grid-template-columns: 160px minmax(0, 1fr); gap: 2rem; padding-top: 0; }
  .profile { position: static; }
  .portrait { width: 110px; height: 110px; }
  h1 { font-size: 22pt; }
  h2 { font-size: 16pt; }
  .about { padding-top: 0; border: 0; }
  .section + .section { padding-top: 1rem; margin-top: 1.5rem; }
  .education-entry, .teaching-current, .course-list li { break-inside: avoid; }
}

/* ---------- Notes: index and article pages ---------- */
.note-layout { padding-block: 3.25rem 2.5rem; }
.note-layout > * { width: min(720px, 100%); }
.page-head { margin-bottom: 2.5rem; }
.page-head h1 { font-size: 2.1rem; }
.page-head .lede { margin: .9rem 0 0; color: var(--muted); font-size: 1.0625rem; }
.kicker { display: block; margin-bottom: .55rem; font-size: .8125rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.note-list { list-style: none; margin: 0; padding: 0; }
.note-list > li { padding-block: 1.6rem; border-top: 1px solid var(--line); }
.note-list > li:last-child { border-bottom: 1px solid var(--line); }
.note-list h2, .note-list h3 { font-size: 1.25rem; margin-bottom: .45rem; }
.note-list h2 a, .note-list h3 a { color: var(--ink); }
.note-list h2 a:hover, .note-list h3 a:hover { color: var(--link); }
.note-list p { margin-bottom: 0; font-size: .9375rem; }
.entry-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .7rem; margin-bottom: .75rem; font-size: .8125rem; color: var(--muted); }
.tag { font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); }
.entry-meta > * + *::before { content: '·'; margin-right: .7rem; color: var(--muted); }
.empty-note { margin-top: 2rem; font-size: .9375rem; color: var(--muted); }

.note article > * { width: 100%; }
.dek { margin: 1rem 0 0; font-size: 1.1875rem; line-height: 1.6; color: var(--muted); }
.note-meta { margin: 1.4rem 0 0; padding-top: 1.1rem; border-top: 1px solid var(--line); font-size: .875rem; color: var(--muted); line-height: 1.8; }
.note-meta strong { color: var(--ink); font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; }
.actions a { display: inline-block; padding: .45rem .9rem; border: 1px solid var(--line); border-radius: 3px; font-size: .875rem; }
.actions a:hover { border-color: var(--link); text-decoration: none; }
.note h2 { margin-top: 2.6rem; font-size: 1.4rem; }
.note h3 { margin-top: 1.8rem; font-size: 1.05rem; }
.note h2 + p, .note h3 + p { margin-top: 0; }
.note ul, .note ol { padding-left: 1.3rem; }
.note li { margin-block: .4rem; }
.lead-in { color: var(--muted); font-size: .9375rem; margin-bottom: .5rem; }
.pullout { margin: 1.8rem 0; padding: 1.1rem 1.35rem; border-left: 2px solid var(--gold); background: var(--tint); }
.pullout p:last-child { margin-bottom: 0; }
.pullout .label { display: block; margin-bottom: .4rem; font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.eq { margin: 1.4rem 0; overflow-x: auto; font-size: 1.0625rem; }
.eq math { margin-inline: auto; }
.table-scroll { overflow-x: auto; margin: 1.5rem 0; }
.table-scroll:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }
.data-table { width: 100%; border-collapse: collapse; margin: 0; font-size: .9375rem; }
.data-table caption { caption-side: bottom; padding-top: .7rem; font-size: .8125rem; color: var(--muted); text-align: left; }
.data-table th, .data-table td { padding: .55rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table thead th { border-bottom: 1px solid var(--ink); font-size: .8125rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.refs { list-style: none; margin: 0; padding: 0; font-size: .9375rem; }
.refs li { padding-block: .7rem; border-top: 1px solid var(--line); line-height: 1.6; }
.refs .cite-note { display: block; color: var(--muted); font-size: .875rem; }
.note-foot { margin-top: 2.6rem; padding-top: 1.4rem; border-top: 1px solid var(--line); font-size: .875rem; color: var(--muted); }
.back-link { display: inline-block; margin-bottom: 1.6rem; font-size: .875rem; }

/* ---------- Figures ---------- */
figure { margin: 2rem 0; }
figure figcaption { margin-top: .8rem; font-size: .8125rem; line-height: 1.65; color: var(--muted); }
.vz { display: block; width: 100%; height: auto; overflow: visible; }
.vz-grid { stroke: var(--line); stroke-width: 1; }
.vz-axis { stroke: var(--muted); stroke-width: 1; }
.vz-tick, .vz-axtitle, .vz-note, .vz-slab { fill: var(--muted); font-family: var(--font); font-size: 11px; }
.vz-axtitle { font-size: 11.5px; }
.vz-note { fill: var(--muted); font-size: 11px; }
/* series labels wear ink, never the series colour; the short connector
   drawn in the series colour is what carries identity */
.vz-slab { fill: var(--ink); font-size: 11px; font-weight: 600; }
.vz-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vz-ref { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; }
.vz-s1 { stroke: var(--viz-1); }
.vz-s2 { stroke: var(--viz-2); }
.vz-s3 { stroke: var(--viz-3); }
.vz-s4 { stroke: var(--viz-4); }
