/* ==========================================================================
   Fonts (self-hosted, SIL Open Font License; see assets/fonts/LICENSE-*.txt)
   ========================================================================== */

@font-face {
  font-family: "Bodoni Moda";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../fonts/bodoni-moda-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/geist-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/geist-mono-latin.woff2") format("woff2");
}

/* ==========================================================================
   Design tokens
   The site is dark by default. The header button switches to the light set
   below and remembers the choice.
   ========================================================================== */

:root {
  color-scheme: dark;

  --font-serif: "Bodoni Moda", "Bodoni MT", Didot, "Iowan Old Style", Georgia,
    serif;
  --font-sans: "Geist", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    monospace;

  /* A dimmed slate rather than near-black; the text colours are lifted a
     little to keep their contrast against it. */
  --bg: #1e2228;
  --surface: #272b32;
  --text: #eeeef0;
  --muted: #b8bcc3;
  --faint: #989da6;
  --accent: #7fa1d0;
  --accent-strong: #a9c3e6;
  --on-accent: #0e1013;
  --rule: #3b4048;
  --rule-soft: #2f333a;
  /* The band of light that crosses the research interests on the home page. */
  --sheen: #ffffff;

  --page-width: 72rem;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --column-gap: 1.5rem;
  --measure: 40rem;
  --header-height: 4rem;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --section-space: clamp(3rem, 7vw, 5rem);

  /* Where the section label and the section content sit on the 12-column grid. */
  --zone-side: 1 / 5;
  --zone-main: 5 / 13;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f8f8f6;
  --surface: #ffffff;
  --text: #15171a;
  --muted: #4b5159;
  --faint: #676d76;
  --accent: #2d5a94;
  --accent-strong: #1b3f70;
  --on-accent: #ffffff;
  --rule: #d3d6db;
  --rule-soft: #e5e7ea;
  --sheen: #8fb4e6;
}

@media (max-width: 760px) {
  :root {
    --column-gap: 1rem;
    --zone-side: 1 / -1;
    --zone-main: 1 / -1;
  }
}

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

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-height) + 1.5rem);
}

body {
  margin: 0;
  background: var(--bg);
  /* A soft glow behind the top of the page. */
  background-image: radial-gradient(
    46rem 30rem at 0% 24rem,
    color-mix(in srgb, var(--accent) 9%, transparent),
    transparent 70%
  );
  background-repeat: no-repeat;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

h1,
h2,
h3 {
  font-weight: 400;
  margin: 0;
  overflow-wrap: break-word;
}

p {
  margin: 0;
  overflow-wrap: break-word;
  text-wrap: pretty;
}

strong {
  font-weight: 500;
  color: var(--text);
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--text);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: color-mix(in srgb, currentColor 55%, transparent);
}

a:hover {
  color: var(--accent-strong);
  text-decoration-color: currentColor;
}

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  a,
  button {
    transition: color 0.15s ease, background-color 0.15s ease,
      border-color 0.15s ease, text-decoration-color 0.15s ease;
  }
}

/* ==========================================================================
   Layout
   ========================================================================== */

.shell {
  width: min(100% - 2 * var(--gutter), var(--page-width));
  margin-inline: auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--column-gap);
}

@media (max-width: 760px) {
  .grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: 1rem;
  z-index: 30;
  padding: 0.5rem 1rem;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
  transform: translateY(-300%);
}

.skip-link:focus {
  transform: none;
  color: var(--bg);
}

/* Small monospace captions: roles, dates, venues, footers. */
.label {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--faint);
}

/* ==========================================================================
   Icons (drawn with CSS masks so they take the colour of the text around them)
   Mail, GitHub, and LinkedIn outlines are from Feather Icons (MIT).
   ========================================================================== */

.icon {
  display: inline-block;
  flex: none;
  width: 1rem;
  height: 1rem;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.icon--mail {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z'/%3E%3Cpath d='M22 6l-10 7L2 6'/%3E%3C/svg%3E");
}

.icon--scholar {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.5 9L12 4l10.5 5L12 14z'/%3E%3Cpath d='M6 11.4v4.4c0 1.3 2.7 2.7 6 2.7s6-1.4 6-2.7v-4.4'/%3E%3Cpath d='M22.5 9v6'/%3E%3C/svg%3E");
}

.icon--github {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22'/%3E%3C/svg%3E");
}

.icon--linkedin {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z'/%3E%3Cpath d='M2 9h4v12H2z'/%3E%3Ccircle cx='4' cy='4' r='2'/%3E%3C/svg%3E");
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1.5rem;
  min-height: var(--header-height);
}

.brand {
  margin-right: auto;
  font-family: var(--font-serif);
  font-optical-sizing: none;
  font-variation-settings: "opsz" 18;
  font-size: 1.5rem;
  line-height: 2rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  color: var(--text);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
}

.nav a {
  position: relative;
  padding-block: 0.7rem;
  color: var(--muted);
  text-decoration: none;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.45rem;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.nav a:hover {
  color: var(--text);
}

/* The current page is marked by colour and by a line under it. */
.nav a[aria-current="page"] {
  color: var(--accent);
}

.nav a:hover::after,
.nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

/* Each menu word is doubled by the script so it can roll over on hover. */
.flip {
  display: inline-grid;
  overflow: hidden;
  vertical-align: bottom;
}

.flip__line {
  grid-area: 1 / 1;
}

.flip__line + .flip__line {
  transform: translateY(110%);
}

.nav a:nth-child(even) .flip__line + .flip__line {
  transform: translateY(-110%);
}

/* The name in the header; the script copies it into data-text for the
   hover effect defined under "Motion". */
.brand__text {
  position: relative;
  display: inline-block;
}

.brand__text::before,
.brand__text::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.brand__text::before {
  text-shadow: -2px 0 var(--accent);
}

.brand__text::after {
  color: var(--accent-strong);
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-right: -0.6rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--surface);
}

/* Shows the sun while dark (press for light) and the moon while light. */
.theme-toggle .icon {
  width: 1.15rem;
  height: 1.15rem;
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E");
}

:root[data-theme="light"] .theme-toggle .icon {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.5 14.2A8.5 8.5 0 0 1 9.8 3.5a8.5 8.5 0 1 0 10.7 10.7z'/%3E%3C/svg%3E");
}

/* On phones the menu sits on its own row and the header scrolls with the page,
   so it never covers the text. */
@media (max-width: 760px) {
  .site-header {
    position: static;
    padding-top: 0.5rem;
  }

  .nav {
    order: 3;
    flex-basis: 100%;
    gap: 0 1.25rem;
    font-size: 0.875rem;
  }

  html {
    scroll-padding-top: 1rem;
  }
}

/* ==========================================================================
   Page header (title and one-line introduction)
   ========================================================================== */

.page-header {
  padding-block: clamp(1.5rem, 5vw, 3.5rem) clamp(2.5rem, 6vw, 4.5rem);
}

.page-title {
  font-family: var(--font-serif);
  font-optical-sizing: none;
  font-variation-settings: "opsz" 30;
  font-size: clamp(2.75rem, 12vw, 6rem);
  line-height: 1;
  letter-spacing: -0.045em;
  color: var(--accent);
  /* Keeps the descenders of a Bodoni headline clear of the text below. */
  padding-bottom: 0.08em;
}

.page-lead {
  max-width: 38rem;
  margin-top: 1.25rem;
  font-size: 1.125rem;
}

/* ==========================================================================
   Sections: a rule, a label on the left, content on the right
   ========================================================================== */

.section {
  align-items: start;
  row-gap: 1.25rem;
  margin-top: var(--section-space);
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

.page-header + .section,
.section--first {
  margin-top: 0;
}

.section__label {
  grid-column: var(--zone-side);
  position: sticky;
  top: calc(var(--header-height) + 1.5rem);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.section__body {
  grid-column: var(--zone-main);
  min-width: 0;
}

@media (max-width: 760px) {
  .section__label {
    position: static;
  }
}

.prose > * {
  max-width: var(--measure);
}

.prose > * + * {
  margin-top: 1.25rem;
}

.section__more {
  margin-top: 1.5rem;
}

/* ==========================================================================
   Links with an arrow, link rows, buttons
   ========================================================================== */

@property --orbit {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

.arrow-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  min-height: 2.75rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
}

.arrow-link::after {
  content: "";
  width: 1.1rem;
  height: 1.1rem;
  background: currentColor;
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h16M14 6l6 6-6 6'/%3E%3C/svg%3E");
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

/* A ring that draws itself round the arrow on hover. */
.arrow-link::before {
  content: "";
  position: absolute;
  right: -0.45rem;
  top: 50%;
  width: 2rem;
  height: 2rem;
  margin-top: -1rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.7;
  -webkit-mask: conic-gradient(from -90deg, #000 var(--orbit), transparent 0);
  mask: conic-gradient(from -90deg, #000 var(--orbit), transparent 0);
}

.arrow-link:hover,
.arrow-link:focus-visible {
  color: var(--accent-strong);
}

.arrow-link:hover::before,
.arrow-link:focus-visible::before {
  --orbit: 360deg;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2.25rem;
}

/* Paper, code, and project links under an entry. */
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
  margin-top: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.links a {
  padding-block: 0.4rem;
  color: var(--accent);
  text-decoration: none;
  /* The underline is a background so it can grow from the left on hover. */
  background: linear-gradient(currentColor, currentColor) 0
    calc(100% - 0.3rem) / 0 1px no-repeat;
}

.links a:hover,
.links a:focus-visible {
  color: var(--accent-strong);
  background-size: 100% 1px;
}

.more-button {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  margin-top: 0.75rem;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--accent);
  cursor: pointer;
}

.more-button:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

/* Email, Scholar, GitHub. */
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.contact-links a {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 2.75rem;
  color: var(--muted);
  text-decoration: none;
}

.contact-links .icon {
  color: var(--accent);
}

/* A disc fills in behind the icon on hover. */
.contact-links a::before {
  content: "";
  position: absolute;
  left: -0.45rem;
  top: 50%;
  z-index: -1;
  width: 1.9rem;
  height: 1.9rem;
  margin-top: -0.95rem;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transform: scale(0.6);
}

.contact-links a:hover,
.contact-links a:focus-visible {
  color: var(--text);
}

.contact-links a:hover::before,
.contact-links a:focus-visible::before {
  opacity: 1;
  transform: none;
}

.contact-links a:hover .icon,
.contact-links a:focus-visible .icon {
  color: var(--on-accent);
}

/* ==========================================================================
   Home: portrait and name on the left, introduction on the right
   ========================================================================== */

.hero {
  align-items: start;
  row-gap: 2rem;
  padding-block: clamp(1.5rem, 5vw, 3.5rem) 0;
}

.hero__identity {
  grid-column: var(--zone-side);
}

.portrait-frame {
  width: min(100%, 15rem);
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface);
}

.portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.hero__name {
  margin-top: 1.5rem;
  font-family: var(--font-serif);
  font-optical-sizing: none;
  font-variation-settings: "opsz" 30;
  font-size: clamp(2.75rem, 5.2vw, 4.25rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text);
}

/* Each word of the name sits in a clipping line so it can slide up into view. */
.hero__name .line {
  display: block;
  overflow: hidden;
  margin-bottom: -0.14em;
  padding-bottom: 0.14em;
}

.hero__name .line__in {
  display: block;
}

.hero__identity .contact-links {
  margin-top: 1rem;
}

/* The address takes a line of its own; the profile links share the next. */
.hero__identity .contact-links a:first-child {
  flex-basis: 100%;
}

@media (hover: hover) and (pointer: fine) {
  .hero__identity .contact-links a {
    min-height: 2rem;
  }
}

.hero__copy {
  grid-column: var(--zone-main);
  min-width: 0;
}

.hero__affiliation {
  margin-top: 0.4rem;
  line-height: 1.5;
  color: var(--text);
}

.hero__affiliation a {
  text-decoration-color: transparent;
}

.hero__affiliation a:hover {
  text-decoration-color: currentColor;
}

.hero__bio {
  margin-top: 1.75rem;
}

.hero__bio > * + * {
  margin-top: 1.1rem;
}

.hero__copy .link-row {
  margin-top: 1.25rem;
}

/* Research interests: a numbered index. Each row is one link to a project,
   with its number on the left and an arrow on the right, so the list runs
   the full width of the column. */
.interests {
  margin-top: 2.25rem;
}

.interests__list {
  margin-top: 0.75rem;
  border-top: 1px solid var(--rule);
  counter-reset: interest;
}

.interests__list li {
  position: relative;
  isolation: isolate;
  border-bottom: 1px solid var(--rule);
  counter-increment: interest;
}

.interests__list li:nth-child(1) { --i: 0; }
.interests__list li:nth-child(2) { --i: 1; }
.interests__list li:nth-child(3) { --i: 2; }
.interests__list li:nth-child(4) { --i: 3; }
.interests__list li:nth-child(5) { --i: 4; }

.interests__list a {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 0.75rem;
  padding: 0.7rem 0.4rem 0.75rem 0;
  color: var(--accent);
  text-decoration: none;
}

/* The number is drawn by the stylesheet, so it is never copied or read out. */
.interests__list a::before {
  content: counter(interest, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  color: var(--faint);
}

.interests__name {
  font-family: var(--font-serif);
  font-optical-sizing: none;
  font-variation-settings: "opsz" 24;
  font-size: clamp(1.5rem, 2.6vw, 2.05rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.interests__list a::after {
  content: "";
  align-self: center;
  width: 1.3rem;
  height: 1.3rem;
  background: currentColor;
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h16M14 6l6 6-6 6'/%3E%3C/svg%3E");
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
  opacity: 0.55;
}

/* On hover the row brightens, its arrow steps forward, and a line in the
   accent colour runs along the rule beneath it. */
.interests__list a:hover,
.interests__list a:focus-visible {
  color: var(--accent-strong);
}

.interests__list a:hover::before,
.interests__list a:focus-visible::before {
  color: var(--accent);
}

.interests__list a:hover::after,
.interests__list a:focus-visible::after {
  opacity: 1;
  transform: translateX(0.35rem);
}

.interests__list li::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

.interests__list li:hover::after,
.interests__list li:focus-within::after {
  transform: scaleX(1);
}


@media (max-width: 760px) {
  .hero__identity {
    display: grid;
    grid-template-columns: 6.5rem minmax(0, 1fr);
    column-gap: 1.25rem;
    align-items: end;
  }

  .portrait-frame {
    width: 6.5rem;
  }

  .hero__name {
    margin-top: 0;
    font-size: clamp(2.25rem, 11vw, 3rem);
  }

  .hero__identity .contact-links {
    grid-column: 1 / -1;
  }

  .interests {
    margin-top: 1.75rem;
  }
}

/* ==========================================================================
   Rows: a short key on the left, text on the right
   Used for talks, service, and tools on the research page.
   ========================================================================== */

.rows > li {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  column-gap: 1.5rem;
  padding-block: 0.9rem;
  border-top: 1px solid var(--rule-soft);
}

.rows > li:first-child {
  padding-top: 0;
  border-top: 0;
}

.rows__key,
.rows time {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.75rem;
  color: var(--accent);
  white-space: nowrap;
}

.rows p {
  max-width: var(--measure);
}

.rows h3 {
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--text);
}

@media (max-width: 520px) {
  .rows > li {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ==========================================================================
   News: the date sits in the left column and the text in the right, on the
   same column lines as the rest of the page, so a row uses the full width.
   ========================================================================== */

.news {
  margin-top: 1.5rem;
}

.news > li {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--column-gap);
  align-items: baseline;
  padding-block: 0.9rem;
  border-top: 1px solid var(--rule-soft);
}

.news > li:first-child {
  padding-top: 0;
  border-top: 0;
}

.news time {
  grid-column: var(--zone-side);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent);
  white-space: nowrap;
}

.news p {
  grid-column: var(--zone-main);
}

/* The "show all" button lines up with the text column: four columns and
   four gaps in from the left edge. */
.news + .more-button {
  margin-left: calc((100% + var(--column-gap)) / 3);
}

@media (max-width: 760px) {
  .news > li {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0.15rem;
  }

  .news + .more-button {
    margin-left: 0;
  }
}

/* ==========================================================================
   Education and experience, side by side
   The two lists share one set of rows, so the first entries are the same
   height, the second entries are the same height, and so on. If the lists
   grow beyond three entries, raise --cv-rows to the longer list's length.
   ========================================================================== */

.pair {
  --cv-rows: 3;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: auto repeat(var(--cv-rows), auto);
  column-gap: clamp(1.5rem, 3vw, 2.5rem);
  row-gap: 1rem;
}

.pair__col {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span calc(var(--cv-rows) + 1);
  min-width: 0;
}

/* Inside a column the label is an ordinary row, not a cell of the page grid. */
.pair .section__label {
  position: static;
  grid-column: auto;
}

.cv {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: 2 / span var(--cv-rows);
  min-width: 0;
}

/* One entry: logo beside the name and dates, description underneath. */
.cv > li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: start;
  align-items: center;
  gap: 1rem 1.25rem;
  padding: 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
}

/* Logos keep a white plate so dark marks stay legible on the dark page. */
.cv__logo {
  width: 5rem;
  height: 5rem;
  padding: 7px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 6px;
}

.cv__logo--wide {
  width: 10rem;
}

.cv h3 {
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
}

.cv__date {
  margin-top: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent);
}

.cv__text {
  grid-column: 1 / -1;
}

/* Narrower columns: the logo moves above the name so the name has room. */
@media (max-width: 1040px) {
  .cv > li {
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
  }
}

/* Phones: one list after the other. */
@media (max-width: 760px) {
  .pair {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
  }

  .pair__col,
  .cv {
    grid-template-rows: none;
    grid-row: auto;
    row-gap: 1rem;
  }

  .pair__col + .pair__col {
    margin-top: 2rem;
  }

  .cv > li {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .cv__logo {
    width: 4rem;
    height: 4rem;
  }

  .cv__logo--wide {
    width: 8rem;
  }
}

@media (max-width: 440px) {
  .cv > li {
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
  }
}

/* ==========================================================================
   Simple lists (honours)
   ========================================================================== */

.plain-list > li {
  max-width: var(--measure);
  padding-block: 0.75rem;
  border-top: 1px solid var(--rule-soft);
}

.plain-list > li:first-child {
  padding-top: 0;
  border-top: 0;
}

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

.pub {
  padding-bottom: 1.5rem;
}

.pub:last-child {
  padding-bottom: 0;
}

/* A rule between papers. Written this way so that the first paper left on
   screen by a filter still starts flush with its year. */
.pub:not([hidden]) ~ .pub:not([hidden]) {
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule-soft);
}

.pub__title {
  max-width: 44rem;
  font-size: 1.1875rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--text);
}

.pub__authors {
  margin-top: 0.5rem;
  font-size: 1rem;
}

.pub__authors .me {
  font-weight: 500;
  color: var(--text);
}

.pub__venue {
  margin-top: 0.2rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--faint);
}

/* The full list numbers each paper in a narrow column of its own. */
.pubs--numbered .pub {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr);
  column-gap: 0.75rem;
}

.pubs--numbered .pub > * {
  grid-column: 2;
}

.pubs--numbered .pub > .pub__num {
  grid-column: 1;
  grid-row: 1;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6625rem;
  color: var(--faint);
}

/* The year already heads each group, so the per-paper copy stays hidden. */
.pub__year {
  display: none;
}

.tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--accent);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  vertical-align: 0.15em;
  white-space: nowrap;
}

/* Pending outcomes read as neutral rather than as an achievement. */
.tag--pending {
  border-color: var(--rule);
  color: var(--faint);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filters button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: none;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--muted);
  cursor: pointer;
}

.filters button:hover {
  border-color: var(--faint);
  color: var(--text);
}

.filters button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.filters__count {
  opacity: 0.75;
}

.filters__status {
  margin-top: 0.75rem;
}

/* ==========================================================================
   Research: a list of projects on the left, the projects on the right
   ========================================================================== */

/* The label and the project list stay in view together while the projects
   scroll past. The side padding leaves room for the highlight on the links. */
.section__side {
  grid-column: var(--zone-side);
  position: sticky;
  top: calc(var(--header-height) + 1.5rem);
  max-height: calc(100vh - var(--header-height) - 3rem);
  margin-left: -0.6rem;
  padding-left: 0.6rem;
  overflow-y: auto;
}

.section__side .section__label {
  position: static;
}

.index {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  margin-top: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.index a {
  margin-left: -0.6rem;
  padding: 0.4rem 0.6rem;
  border-radius: 2px;
  color: var(--muted);
  text-decoration: none;
}

.index a:hover {
  color: var(--text);
}

.index a[aria-current="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

.projects {
  grid-column: var(--zone-main);
  min-width: 0;
}

.project + .project {
  margin-top: 3rem;
  padding-top: 3rem;
  border-top: 1px solid var(--rule-soft);
}

.project__title {
  max-width: 42rem;
  margin-top: 0.5rem;
  font-family: var(--font-serif);
  font-optical-sizing: none;
  font-variation-settings: "opsz" 24;
  font-size: clamp(1.75rem, 3.6vw, 2.5rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--accent);
  text-wrap: balance;
}

.project__text {
  max-width: var(--measure);
  margin-top: 1rem;
}

@media (max-width: 760px) {
  .section__side {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

/* ==========================================================================
   Figures from the papers
   Diagrams are drawn on white, so on the dark page they are inverted and their
   hues turned back; the light theme and photographs are shown as they are.
   ========================================================================== */

.fig {
  display: block;
  border-radius: 4px;
}

.fig--diagram {
  filter: invert(0.84) hue-rotate(180deg) saturate(1.3);
}

:root[data-theme="light"] .fig--diagram {
  filter: none;
  outline: 1px solid var(--rule-soft);
  outline-offset: -1px;
}

/* Home: each selected paper is a row with its figure on the left. */
.section--stacked .section__label {
  position: static;
}

.works {
  margin-top: 2rem;
}

.work {
  position: relative;
  align-items: start;
  row-gap: 1.25rem;
}

.work + .work {
  margin-top: 2.25rem;
  padding-top: 2.25rem;
  border-top: 1px solid var(--rule-soft);
}

.work__figure {
  grid-column: var(--zone-side);
  justify-self: start;
  display: block;
  max-width: 100%;
  overflow: hidden;
  border-radius: 4px;
}

.work__figure img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 15rem;
}

.work__body {
  grid-column: var(--zone-main);
  min-width: 0;
}

.works + .section__more .arrow-link {
  grid-column: var(--zone-main);
  justify-self: start;
}

/* Research: the figure sits between a project's title and its text. */
.project__figure {
  width: fit-content;
  max-width: min(100%, var(--measure));
  margin: 1.25rem 0 0;
  overflow: hidden;
  border-radius: 4px;
}

.project__figure img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 19rem;
}

/* ==========================================================================
   Rows that light up under the pointer
   The script keeps --mx and --my at the pointer's position inside the row.
   ========================================================================== */

.pub,
.work,
.cv > li,
.rows > li,
.news > li {
  position: relative;
  isolation: isolate;
}

@media (hover: hover) and (pointer: fine) {
  .pub::before,
  .work::before,
  .cv > li::before,
  .rows > li::before,
  .news > li::before,
  .interests__list li::before {
    content: "";
    position: absolute;
    inset: 0 -1rem;
    z-index: -1;
    border-radius: 6px;
    background: radial-gradient(
      20rem circle at var(--mx, 50%) var(--my, 50%),
      color-mix(in srgb, var(--accent) 12%, transparent),
      transparent 72%
    );
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
  }

  .pub:hover::before,
  .work:hover::before,
  .cv > li:hover::before,
  .rows > li:hover::before,
  .news > li:hover::before,
  .interests__list li:hover::before {
    opacity: 1;
  }

  .cv > li::before {
    inset: 0;
    border-radius: 5px;
  }

  .cv > li {
    transition: border-color 0.3s ease;
  }

  .cv > li:hover {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--rule));
  }
}

/* ==========================================================================
   Typed text and decoding titles (both built by the script)
   ========================================================================== */

.typed {
  position: relative;
}

/* While a sentence is being typed, the real text keeps its place but is
   transparent, and a copy on top appears letter by letter. */
.typed--running .typed__copy,
.typed--running .typed__copy * {
  color: transparent !important;
  text-decoration-color: transparent !important;
}

.typed__overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

.typed__off,
.typed__overlay--done .typed__word {
  visibility: hidden;
}

.typed__cursor {
  position: absolute;
  width: 2px;
  background: var(--accent);
  visibility: visible;
  animation: cursor-blink 1.05s steps(1, end) infinite;
}

@keyframes cursor-blink {
  0%,
  55% {
    opacity: 1;
  }
  56%,
  100% {
    opacity: 0;
  }
}

/* A page title settles letter by letter out of stand-in letters. */
.glyph {
  position: relative;
}

.glyph[data-noise] {
  color: transparent;
}

.glyph[data-noise]::after {
  content: attr(data-noise);
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent-strong);
  opacity: 0.45;
}

/* ==========================================================================
   Motion
   Everything here applies only while <html> has the class "motion", which
   boot.js adds unless the visitor's system asks for reduced motion.
   ========================================================================== */

/* Sections, paper rows, and projects rise into place as they scroll in. */
.motion .section,
.motion .work,
.motion .project {
  opacity: 0;
  transform: translateY(1.5rem);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}

.motion .section.is-in,
.motion .work.is-in,
.motion .project.is-in {
  opacity: 1;
  transform: none;
}

/* Home: the portrait fades in and settles, the name slides up, the text
   follows. The photo itself is never masked, tinted, or covered. */
.motion .portrait-frame {
  animation: fade-in 0.9s ease both;
}

.motion .portrait {
  animation: settle 1.6s var(--ease-out) backwards;
  transition: transform 0.8s var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .motion .portrait-frame:hover .portrait {
    transform: scale(1.03);
  }
}

.motion .hero__name .line__in {
  animation: line-up 0.95s var(--ease-out) 0.25s both;
}

.motion .hero__name .line + .line .line__in {
  animation-delay: 0.37s;
}

.motion .hero__identity .contact-links {
  animation: rise 0.7s var(--ease-out) 0.7s both;
}

.motion .hero__copy > * {
  animation: rise 0.7s var(--ease-out) both;
  animation-delay: calc(0.15s + var(--i, 0) * 0.09s);
}

.hero__copy > :nth-child(2) { --i: 1; }
.hero__copy > :nth-child(3) { --i: 2; }
.hero__copy > :nth-child(4) { --i: 5; }
.hero__copy > :nth-child(5) { --i: 7; }

.motion .interests__list li {
  animation: rise 0.7s var(--ease-out) both;
  animation-delay: calc(0.75s + var(--i, 0) * 0.08s);
}

/* Now and then a band of light crosses each interest, one row after another. */
.motion .interests__name {
  background: linear-gradient(
      100deg,
      var(--accent) 0%,
      var(--accent) 40%,
      var(--sheen) 50%,
      var(--accent) 60%,
      var(--accent) 100%
    )
    100% 0 / 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: sheen 11s linear infinite;
  animation-delay: calc(2.2s + var(--i, 0) * 0.9s);
}

.motion .interests__list a:hover .interests__name,
.motion .interests__list a:focus-visible .interests__name {
  -webkit-text-fill-color: currentColor;
}

@keyframes sheen {
  0% {
    background-position: 100% 0;
  }
  24%,
  100% {
    background-position: 0% 0;
  }
}

/* Inner pages: the title comes into focus, the first line is typed. */
.motion .page-title {
  animation: focus-in 0.9s var(--ease-out) both;
}

/* A typed sentence stays out of sight until the script starts typing it. */
.motion [data-typed]:not(.typed) {
  visibility: hidden;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0.9rem);
  }
}

@keyframes line-up {
  from {
    transform: translateY(110%);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes settle {
  from {
    transform: scale(1.07);
  }
}

@keyframes focus-in {
  from {
    opacity: 0;
    filter: blur(10px);
    transform: translateY(0.2em);
  }
}

/* Small transitions on hover. */
.motion .nav a::after {
  transition: transform 0.3s var(--ease-out);
}

.motion .links a {
  transition: color 0.15s ease, background-size 0.3s var(--ease-out);
}

.motion .arrow-link::before {
  transition: --orbit 0.45s ease;
}

.motion .contact-links a::before {
  transition: opacity 0.18s ease, transform 0.25s var(--ease-out);
}

.motion .interests__list a,
.motion .interests__list a::before {
  transition: color 0.2s ease;
}

.motion .interests__list a::after {
  transition: opacity 0.2s ease, transform 0.35s var(--ease-out);
}

.motion .interests__list li::after {
  transition: transform 0.5s var(--ease-out);
}

.motion .work__figure img,
.motion .project__figure img {
  transition: transform 0.6s var(--ease-out);
}

.motion .work__figure:hover img,
.motion .project__figure:hover img {
  transform: scale(1.03);
}

@media (hover: hover) and (pointer: fine) {
  /* Menu words roll over. */
  .motion .flip__line {
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .motion .nav a:hover .flip__line:first-child {
    transform: translateY(-110%);
  }

  .motion .nav a:nth-child(even):hover .flip__line:first-child {
    transform: translateY(110%);
  }

  .motion .nav a:hover .flip__line + .flip__line {
    transform: none;
  }

  /* The name in the header breaks up for a moment, like a bad signal. */
  .motion .brand:hover .brand__text {
    animation: signal-shear 0.42s steps(1, end) both;
  }

  .motion .brand:hover .brand__text::before {
    animation: signal-upper 0.42s steps(1, end) both;
  }

  .motion .brand:hover .brand__text::after {
    animation: signal-lower 0.42s steps(1, end) both;
  }
}

@keyframes signal-shear {
  0%,
  100% {
    transform: none;
  }
  14% {
    transform: skewX(-5deg);
  }
  30% {
    transform: skewX(2deg) translateX(1px);
  }
  56% {
    transform: skewX(-1deg);
  }
  72% {
    transform: none;
  }
}

@keyframes signal-upper {
  0%,
  100% {
    opacity: 0;
  }
  14%,
  28% {
    opacity: 0.9;
    clip-path: inset(18% 0 58%);
    transform: translateX(5px);
  }
  44%,
  58% {
    opacity: 0.7;
    clip-path: inset(38% 0 40%);
    transform: translateX(-3px);
  }
  74% {
    opacity: 0;
  }
}

@keyframes signal-lower {
  0%,
  100% {
    opacity: 0;
  }
  22%,
  36% {
    opacity: 0.8;
    clip-path: inset(64% 0 14%);
    transform: translateX(-4px);
  }
  50%,
  66% {
    opacity: 0.5;
    clip-path: inset(74% 0 6%);
    transform: translateX(2px);
  }
  80% {
    opacity: 0;
  }
}

/* A thin line across the top shows how far down the page you are. */
@supports (animation-timeline: scroll()) {
  .motion body::before {
    content: "";
    position: fixed;
    inset: 0 0 auto;
    z-index: 40;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: 0 50%;
    animation: page-progress linear both;
    animation-timeline: scroll(root block);
  }
}

@keyframes page-progress {
  to {
    transform: scaleX(1);
  }
}

/* Moving between pages: the old page lifts away, the new one settles, and
   the header stays where it is. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }

  .site-header {
    view-transition-name: site-header;
  }

  ::view-transition-old(root) {
    animation: 0.22s cubic-bezier(0.4, 0, 1, 1) both page-leave;
  }

  ::view-transition-new(root) {
    animation: 0.35s cubic-bezier(0, 0, 0.2, 1) 0.05s both page-arrive;
  }

  /* Switching theme: the new colours spread out from the button instead. */
  .theme-switching .site-header {
    view-transition-name: none;
  }

  .theme-switching::view-transition-old(root),
  .theme-switching::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
  }
}

@keyframes page-leave {
  to {
    opacity: 0;
    transform: translateY(-10px);
    filter: blur(3px);
  }
}

@keyframes page-arrive {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

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

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-top: clamp(4rem, 9vw, 7rem);
  padding-block: 2rem 3rem;
  border-top: 1px solid var(--rule);
}

.site-footer__name {
  font-family: var(--font-serif);
  font-optical-sizing: none;
  font-variation-settings: "opsz" 18;
  font-size: 1.5rem;
  line-height: 2rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.site-footer__name:hover {
  color: var(--text);
}

.site-footer__meta {
  margin-top: 0.35rem;
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
  :root,
  :root[data-theme="light"] {
    --bg: #fff;
    --surface: #fff;
    --text: #000;
    --muted: #222;
    --faint: #444;
    --accent: #1b3f70;
    --rule: #bbb;
    --rule-soft: #ddd;
  }

  .site-header {
    position: static;
  }

  .nav,
  .theme-toggle,
  .filters,
  .filters__status,
  .index,
  .more-button,
  .skip-link {
    display: none;
  }

  .section__label,
  .section__side {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .motion .section,
  .motion .work,
  .motion .project,
  .motion [data-typed] {
    opacity: 1 !important;
    transform: none !important;
    visibility: visible !important;
  }

  .fig--diagram {
    filter: none;
  }

  body {
    background-image: none;
  }
}
