/* Self-hosted fonts: Newsreader and Public Sans (SIL Open Font License) */
@font-face { font-family: "Newsreader"; src: url("/fonts/newsreader.woff2") format("woff2"); font-weight: 400 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("/fonts/public-sans.woff2") format("woff2"); font-weight: 400 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("/fonts/public-sans-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

/* Base reset */
*, *::before, *::after { box-sizing: border-box; }
:root { color-scheme: light; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* Layout: desktop = fixed identity column (photo, name, statement, nav) beside one quiet reading column; phone = identity header, sticky section tabs, then content. */
:root {
  --bg: #FFFFFF;
  --surface: #F3F5F8;
  --ink: #111A24;
  --body: #2E3845;
  --muted: #6A7482;
  --line: #E3E7EC;
  --accent: #1F4E79;
  --accent-soft: #E9F0F7;
  --oral-bg: #E6EDF7; --oral-fg: #1C4A76;
  --poster-bg: #E3F2EE; --poster-fg: #1A6457;
  --abstract-bg: #FBF0DA; --abstract-fg: #8A5A0B;
  --award: #C2962A;

  --f-display: "Newsreader", "Iowan Old Style", "Times New Roman", serif;
  --f-sans: "Public Sans", "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;

  --gl: max(16px, env(safe-area-inset-left, 0px));
  --gr: max(16px, env(safe-area-inset-right, 0px));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1218; --surface: #151C25; --ink: #EEF1F5; --body: #C6CDD6; --muted: #8B95A2;
    --line: #232C37; --accent: #93BCE8; --accent-soft: #15243A;
    --oral-bg: #172A44; --oral-fg: #A3C6EE; --poster-bg: #12302B; --poster-fg: #86D3C3; --abstract-bg: #33270F; --abstract-fg: #EBC47C; --award: #E3C26A;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D1218; --surface: #151C25; --ink: #EEF1F5; --body: #C6CDD6; --muted: #8B95A2;
  --line: #232C37; --accent: #93BCE8; --accent-soft: #15243A;
    --oral-bg: #172A44; --oral-fg: #A3C6EE; --poster-bg: #12302B; --poster-fg: #86D3C3; --abstract-bg: #33270F; --abstract-fg: #EBC47C; --award: #E3C26A;
  color-scheme: dark;
}
@media (min-width: 760px) {
  :root { --gl: max(40px, env(safe-area-inset-left, 0px)); --gr: max(40px, env(safe-area-inset-right, 0px)); }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (min-width: 1024px) { html { scroll-padding-top: 64px; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body {
  background: var(--bg); color: var(--body);
  font-family: var(--f-sans); font-size: 16px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 4px; z-index: 20; }
.skip:focus { left: var(--gl); }

/* ---------- Frame ---------- */
.layout {
  max-width: 1180px; margin: 0 auto;
  padding-left: var(--gl); padding-right: var(--gr);
  display: grid; grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 1024px) {
  .layout { grid-template-columns: 300px minmax(0, 1fr); column-gap: clamp(64px, 8vw, 120px); }
}

/* ---------- Identity column ---------- */
.side { padding-block: 48px 32px; min-width: 0; }
@media (min-width: 1024px) {
  .side {
    position: sticky; top: 0; align-self: start;
    max-height: 100vh; overflow-y: auto; scrollbar-width: none;
    padding-block: 64px 44px;
  }
  .side::-webkit-scrollbar { display: none; }
}

/* Identity block: centred photo, name, statement */
.id { display: grid; justify-items: center; text-align: center; }
.avatar {
  width: 176px; height: 176px; border-radius: 50%; overflow: hidden;
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--line), 0 0 0 6px var(--bg), 0 0 0 7px var(--line);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

h1 {
  font-family: var(--f-display); font-weight: 400; color: var(--ink);
  font-size: clamp(44px, 6vw, 52px); line-height: 1; letter-spacing: -0.02em;
  margin: 32px 0 10px;
}
.affil { margin: 0; font-size: 15px; color: var(--muted); line-height: 1.5; }
.scholar { margin: 6px 0 0; font-size: 13.5px; font-weight: 500; color: var(--ink); letter-spacing: .01em; }
.statement {
  font-family: var(--f-display); font-style: normal; font-weight: 400;
  font-size: 19px; line-height: 1.45; color: var(--ink);
  margin: 22px 0 0; max-width: 15em; text-wrap: balance;
}
.statement::before {
  content: ""; display: block; width: 28px; height: 1px; background: var(--accent); margin: 0 auto 18px;
}

.links { margin: 18px 0 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 20px; font-size: 14.5px; font-weight: 500; }
.linkbtn { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.mail[hidden] { display: none; }
.mail { margin: 10px 0 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 10px; font-size: 14px; }
.mail #mailText { color: var(--ink); font-weight: 500; user-select: all; overflow-wrap: anywhere; }
.copy {
  font: 500 12px/1 var(--f-sans); color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; cursor: pointer;
}
.copy:hover { color: var(--ink); border-color: var(--muted); }
.copy-status { flex-basis: 100%; font-size: 12.5px; color: var(--muted); min-height: 0; }
.copy-status:empty { display: none; }

.snav { display: none; }
@media (min-width: 1024px) {
  .snav { display: block; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
  .snav ul { list-style: none; margin: 0; padding: 0; display: grid; justify-items: center; gap: 2px; }
  .snav a {
    display: inline-block; padding: 5px 2px 3px; font-size: 14.5px; font-weight: 500; color: var(--muted);
    border-bottom: 1.5px solid transparent; transition: color .2s, border-color .2s;
  }
  .snav a:hover { color: var(--ink); text-decoration: none; }
  .snav a.active { color: var(--ink); border-bottom-color: var(--accent); }
}
/* Shorter laptop screens: tighten so the column fits without scrolling */
@media (min-width: 1024px) and (max-height: 940px) {
  .side { padding-block: 36px 24px; }
  .avatar { width: 116px; height: 116px; }
  h1 { font-size: 42px; margin-top: 20px; }
  .statement { font-size: 17.5px; margin-top: 16px; }
  .statement::before { margin-bottom: 12px; }
  .links { margin-top: 12px; }
  .snav { margin-top: 20px; padding-top: 14px; }
  .snav a { padding: 2px 2px 1px; }
}
@media (min-width: 1024px) and (max-height: 800px) {
  .avatar { width: 92px; height: 92px; }
  h1 { font-size: 38px; margin-top: 16px; }
  .statement::before { display: none; }
}
@media (min-width: 1024px) and (max-height: 740px) {
  .side { padding-block: 22px 14px; }
  .statement { margin-top: 12px; }
}
@media (max-width: 1023px) { .avatar { width: 160px; height: 160px; } }

/* Project screenshot */
.shot {
  display: block; margin-top: 16px; max-width: 100%;
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface);
  box-shadow: 0 1px 2px rgba(15, 26, 42, .05), 0 12px 28px -16px rgba(15, 26, 42, .25);
  transition: transform .25s ease, box-shadow .25s ease;
}
.shot img { display: block; width: 100%; height: auto; }
.shot:hover { transform: translateY(-2px); box-shadow: 0 1px 2px rgba(15, 26, 42, .05), 0 18px 36px -18px rgba(15, 26, 42, .32); }

/* ---------- Phone section tabs ---------- */
.mnav {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 9;
  margin-left: calc(-1 * var(--gl)); margin-right: calc(-1 * var(--gr));
  padding-left: var(--gl); padding-right: var(--gr);
  background: var(--bg); border-block: 1px solid var(--line);
  display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none;
}
.mnav::-webkit-scrollbar { display: none; }
.mnav a {
  flex: none; padding: 14px 0 12px; font-size: 14px; font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent;
}
.mnav a:hover { text-decoration: none; color: var(--ink); }
.mnav a.active { color: var(--ink); border-bottom-color: var(--accent); }
@media (min-width: 1024px) { .mnav { display: none; } }

/* ---------- Reading column ---------- */
main { min-width: 0; max-width: 720px; padding-block: 48px 80px; }
@media (min-width: 1024px) { main { padding-block: 64px 120px; } }

section + section { margin-top: clamp(72px, 9vw, 104px); }
.sec-title {
  display: flex; align-items: center; gap: 20px;
  font-family: var(--f-display); font-weight: 400; color: var(--ink);
  font-size: clamp(26px, 3vw, 30px); letter-spacing: -0.01em; line-height: 1.2;
  margin: 0 0 32px;
}
.sec-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.lead {
  font-family: var(--f-display); font-weight: 400; color: var(--ink);
  font-size: clamp(23px, 2.7vw, 28px); line-height: 1.42; letter-spacing: -0.008em;
  margin: 0; max-width: 28em; text-wrap: pretty;
}
.interests-label {
  margin: 44px 0 14px; font-size: 12px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
}
.interests {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 640px) {
  .interests { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto auto auto; gap: 14px; }
  .interests li { grid-row: span 3; grid-template-rows: subgrid; row-gap: 0; }
}
.interests li {
  min-width: 0; background: var(--surface); border-radius: 12px;
  padding: 20px 20px 22px; display: grid; align-content: start; gap: 0;
}
.icon {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: var(--bg); border: 1px solid var(--line); color: var(--accent); margin-bottom: 18px;
}
.icon svg { width: 20px; height: 20px; }
.interests h3 { font-family: var(--f-display); font-weight: 500; font-size: 19px; line-height: 1.3; color: var(--ink); margin: 0; text-wrap: balance; }
.interests p { margin: 8px 0 0; font-size: 14.5px; line-height: 1.55; color: var(--muted); }
@media (min-width: 640px) and (max-width: 860px) { .interests li { padding: 18px 16px 20px; } }
@media (min-width: 1024px) and (max-width: 1239px) {
  .interests { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; gap: 10px; }
  .interests li { grid-row: auto; grid-template-rows: none; grid-template-columns: 40px minmax(0, 1fr); column-gap: 16px; padding: 16px 20px 18px; }
  .interests li .icon { grid-row: span 2; margin-bottom: 0; }
  .interests h3 { align-self: end; }
  .interests p { margin-top: 4px; }
}
@media (max-width: 639px) {
  .interests li { grid-template-columns: 40px minmax(0, 1fr); column-gap: 14px; padding: 16px 16px 18px; }
  .icon { grid-row: span 2; margin-bottom: 0; }
  .interests h3 { align-self: center; }
}

/* Conference photo mosaic: phone = lead photo + 2x2; wider = lead photo spans 2x2 with tiles around it */
.gallery {
  display: grid; gap: 8px; margin-bottom: 48px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: 210px 140px 140px;
}
.g-drive { grid-column: 1 / -1; }
@media (min-width: 640px) {
  .gallery { gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: 165px 165px 215px; }
  .g-drive { grid-column: 1 / span 2; grid-row: 1 / span 2; }
  .g-gairdner { grid-column: 3; grid-row: 1; }
  .g-aimi { grid-column: 3; grid-row: 2; }
  .g-acfp { grid-column: 1; grid-row: 3; }
  .g-rbc { grid-column: 2 / span 2; grid-row: 3; }
}
.tile {
  position: relative; display: block; width: 100%; height: 100%; min-width: 0;
  padding: 0; border: 0; border-radius: 6px; overflow: hidden; cursor: zoom-in;
  background: var(--surface); font: inherit;
}
.tile img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.tile:hover img { transform: scale(1.035); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 32px 12px 10px; text-align: left;
  background: linear-gradient(to top, rgba(8, 12, 18, .82), rgba(8, 12, 18, .35) 60%, rgba(8, 12, 18, 0));
  color: #FFFFFF; font-size: 12.5px; font-weight: 500; line-height: 1.35;
}
.cap span { display: block; font-weight: 400; opacity: .82; }

/* Discourage saving photos: no drag, no long-press menu on phones */
img { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
/* Invisible cover over each photo, so right-click and long-press hit the cover, not the image (works without JavaScript) */
.avatar, .shot, .lightbox figure { position: relative; }
.avatar::after, .tile::after, .shot::after, .lightbox figure::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.tile .cap { z-index: 2; }

/* Lightbox */
.lightbox { border: 0; padding: 0; background: transparent; max-width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: visible; }
.lightbox::backdrop { background: rgba(8, 12, 18, .95); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.lightbox figure { margin: 0; }
.lightbox img { display: block; max-width: 100%; max-height: calc(100vh - 120px); width: auto; height: auto; margin: 0 auto; border-radius: 6px; }
.lightbox figcaption { margin-top: 12px; text-align: center; font-size: 14px; color: #E9EDF2; }
.lb-close {
  position: fixed; top: calc(16px + env(safe-area-inset-top, 0px)); right: calc(16px + env(safe-area-inset-right, 0px));
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .3);
  background: rgba(8, 12, 18, .5); color: #FFFFFF; font-size: 22px; line-height: 1; cursor: pointer;
}
.lb-close:hover { border-color: #FFFFFF; }
.lb-count { display: block; margin-top: 4px; font-size: 12.5px; color: #9AA6B6; font-variant-numeric: tabular-nums; }
.lb-nav {
  position: fixed; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .3);
  background: rgba(8, 12, 18, .5); color: #FFFFFF; font-size: 26px; line-height: 1; cursor: pointer;
}
.lb-nav:hover { border-color: #FFFFFF; }
.lb-prev { left: calc(16px + env(safe-area-inset-left, 0px)); }
.lb-next { right: calc(16px + env(safe-area-inset-right, 0px)); }
@media (max-width: 639px) { .lb-nav { top: auto; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: none; } }

/* Entries */
.entries { list-style: none; margin: 0; padding: 0; display: grid; gap: 30px; }
.entry { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
@media (min-width: 640px) { .entry { grid-template-columns: minmax(0, 1fr) auto; column-gap: 32px; } }
.entry h3 {
  margin: 0; font-family: var(--f-display); font-weight: 500; font-size: 18.5px;
  line-height: 1.38; letter-spacing: -0.005em; color: var(--ink); text-wrap: pretty;
}
.entry .where { margin: 4px 0 0; font-size: 14.5px; color: var(--muted); }
.entry .desc { margin: 6px 0 0; font-size: 15px; color: var(--body); max-width: 40em; }
.entry[hidden] { display: none; }
.entry .date {
  font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap;
  order: -1; margin-bottom: 4px;
}
@media (min-width: 640px) { .entry .date { order: 0; grid-column: 2; grid-row: 1; margin: 2px 0 0; text-align: right; } }
.entry-main { min-width: 0; }
.fmt {
  display: inline-block; margin-right: 8px; padding: 2px 9px 2px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .04em; line-height: 1.5; vertical-align: 1px;
}
.fmt-oral { background: var(--oral-bg); color: var(--oral-fg); }
.fmt-poster { background: var(--poster-bg); color: var(--poster-fg); }
.fmt-abstract { background: var(--abstract-bg); color: var(--abstract-fg); }
.tag { display: inline-block; margin-top: 6px; font-size: 13.5px; font-weight: 500; color: var(--accent); }
/* Award notes: plain text with a small ribbon, so they don't read as links */
span.tag { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
span.tag::before {
  content: ""; flex: none; width: 14px; height: 14px; background-color: var(--award);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='6'/%3E%3Cpath d='M15.48 12.89 17 22l-5-3-5 3 1.52-9.11'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='6'/%3E%3Cpath d='M15.48 12.89 17 22l-5-3-5 3 1.52-9.11'/%3E%3C/svg%3E") center / contain no-repeat;
}

.more-btn {
  margin-top: 28px; font: 500 14px/1 var(--f-sans); color: var(--ink); cursor: pointer;
  background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 10px 18px;
  transition: border-color .2s;
}
.more-btn:hover { border-color: var(--muted); }

/* Publications */
.pub .authors { margin: 8px 0 0; font-size: 14.5px; color: var(--muted); }
.pub .authors b { color: var(--ink); font-weight: 600; }
.pub .src { margin: 4px 0 0; font-size: 14.5px; color: var(--body); }

/* Compact list (honours, service) */
.compact { gap: 20px; }
.honours { gap: 28px; }
.title-link { color: var(--ink); }
.title-link span { color: var(--accent); font-size: .9em; }
.title-link:hover { color: var(--accent); }

.note-body { max-width: 34em; display: grid; gap: 16px; }
.note-body::before { content: ""; width: 28px; height: 1px; background: var(--accent); margin-bottom: 6px; }
.note-body p {
  margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 19px;
  line-height: 1.6; color: var(--ink); text-wrap: pretty;
}
.note-body .note-sign {
  margin-top: 6px; font-family: var(--f-sans); font-size: 14px; font-weight: 500; color: var(--muted);
}
.note-body .note-sign::before { content: "\2014\00a0"; }

footer { margin-top: 104px; padding-top: 24px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }

/* Photo crops */
.pos-drive { object-position: 20% 50%; }
.pos-gairdner { object-position: 68% 30%; }
.pos-aimi { object-position: 25% 40%; }
.pos-acfp { object-position: 40% 35%; }
.pos-rbc { object-position: 50% 68%; }

/* 404 page */
main.nf { max-width: none; }
.nf { min-height: 100vh; display: grid; place-content: center; justify-items: center; text-align: center; gap: 0;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 48px; }
.nf-code { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .12em; color: var(--muted); }
.nf h1 { margin: 14px 0 10px; font-size: clamp(38px, 6vw, 52px); }
.nf-text { margin: 0; color: var(--muted); font-size: 16px; }
.nf-home { display: inline-block; margin-top: 28px; text-decoration: none; }
.nf-home:hover { text-decoration: none; }
