:root,
html[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #2b2b2b;
  --muted: #5e6670;
  --heading: #222222;
  --border: #d9dde2;
  --border-light: #eceff2;
  --accent: #005ea8;
  --accent-hover: #003f72;
  --visited: #005a9c;
  --focus: #005ea8;
  --nav-active: #f1f4f7;
  --control-bg: #f5f7f9;
  --control-border: #cfd5dc;
  --control-active-bg: #174f78;
  --control-active-text: #ffffff;
  --body-line-height: 1.65;
  --body-letter-spacing: normal;
  --body-word-spacing: normal;
  --maxw: 1120px;
  --sidebar: 250px;
  --content: 800px;
  --label-w: 8.5rem;
}

html[data-theme="reading"] {
  color-scheme: light;
  --bg: #fff8dc;
  --surface: #fffaf0;
  --text: #27251f;
  --muted: #575349;
  --heading: #1f1e1a;
  --border: #d8cfaa;
  --border-light: #e8dfbd;
  --accent: #005a9c;
  --accent-hover: #003d6b;
  --visited: #07517f;
  --focus: #005a9c;
  --nav-active: #f3e9bd;
  --control-bg: #f7edc5;
  --control-border: #cfc49d;
  --control-active-bg: #174f78;
  --control-active-text: #ffffff;
  --body-line-height: 1.78;
  --body-letter-spacing: 0.012em;
  --body-word-spacing: 0.035em;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #17191d;
  --surface: #1d2025;
  --text: #e9edf2;
  --muted: #bcc4cd;
  --heading: #ffffff;
  --border: #4a515b;
  --border-light: #343a42;
  --accent: #8cc8ff;
  --accent-hover: #c2e3ff;
  --visited: #a9d6ff;
  --focus: #ffcf5c;
  --nav-active: #292e35;
  --control-bg: #252a30;
  --control-border: #505864;
  --control-active-bg: #8cc8ff;
  --control-active-text: #101317;
  --body-line-height: 1.65;
  --body-letter-spacing: normal;
  --body-word-spacing: normal;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: var(--body-line-height);
  letter-spacing: var(--body-letter-spacing);
  word-spacing: var(--body-word-spacing);
  -webkit-font-smoothing: antialiased;
}

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

p {
  margin: 0 0 1.15rem;
}

ul,
ol,
dl {
  margin-top: 0.5rem;
  margin-bottom: 1.35rem;
}

li + li {
  margin-top: 0.35rem;
}

h1,
h2,
h3 {
  margin-top: 0;
  color: var(--heading);
  font-weight: 700;
  line-height: 1.3;
  scroll-margin-top: 1rem;
}

h1 {
  margin-bottom: 1.1rem;
  font-size: clamp(2rem, 4vw, 2.55rem);
}

h2 {
  margin: 2.5rem 0 0.9rem;
  font-size: clamp(1.4rem, 2.5vw, 1.7rem);
}

h3 {
  margin: 1.65rem 0 0.55rem;
  font-size: 1.15rem;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

a:visited {
  color: var(--visited);
}

a:hover {
  color: var(--accent-hover);
  text-decoration-thickness: 0.12em;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
    border-radius: 2px;
}

.container {
  width: min(calc(100% - 2.5rem), var(--maxw));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  z-index: 1000;
  left: 1rem;
  top: 0;
  transform: translateY(-140%);
  padding: 0.7rem 0.9rem;
  background: var(--heading);
  color: var(--bg);
  font-weight: 700;
}

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

/* Masthead */
.masthead {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.masthead__inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.site-title {
  color: var(--heading);
  font-size: 1.08rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.site-title:visited {
  color: var(--heading);
}

.greedy-nav {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.nav__item {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.75rem;
  color: var(--text);
  font-size: 0.97rem;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.nav__item:visited {
  color: var(--text);
}

.nav__item:hover {
  color: var(--heading);
  background: var(--nav-active);
  text-decoration: none;
}

.nav__item.active,
.nav__item[aria-current="page"] {
  color: var(--heading);
  border-bottom-color: var(--accent);
}


.masthead__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
  min-width: 0;
}

/* Three-way colour theme selector */
.theme-switcher {
  display: inline-flex;
  align-items: stretch;
  gap: 2px;
  flex: 0 0 auto;
  padding: 3px;
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  border-radius: 6px;
}

.theme-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
  padding: 0.45rem 0.6rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.theme-button:hover {
  background: var(--nav-active);
  color: var(--heading);
}

.theme-button[aria-pressed="true"] {
  background: var(--control-active-bg);
  color: var(--control-active-text);
}

.theme-button i { font-size: 1rem; }

/* Icons in the Home page's Currently section */
.entry__label {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  color: var(--heading);
  font-weight: 700;
}

.entry__icon {
  width: 1.25em;
  flex: 0 0 1.25em;
  margin-top: 0.15em;
  color: var(--accent);
  font-size: 1.05rem;
  text-align: center;
}

/* Main two-column layout */
.initial-content {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, var(--content));
  justify-content: space-between;
  gap: clamp(2.25rem, 5vw, 4.25rem);
  align-items: start;
}

.layout--two-col,
.layout--single {
  padding-block: 2.5rem 3.5rem;
}

.page {
  width: 100%;
  min-width: 0;
  max-width: var(--content);
}

/* Keep all text and list content aligned to the same width. */
.page__header,
.page__content,
.archive,
.quick-facts,
.contact-card,
.module-list,
.publication-list,
.talk-list {
  width: 100%;
  max-width: none;
}

.sidebar {
  position: sticky;
  top: 1.25rem;
}

/* Profile: deliberately flat, closer to Minimal Mistakes */
.author {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.author__avatar {
  width: 145px;
  height: 145px;
  object-fit: cover;
  border-radius: 50%;
  margin: 0 0 1rem;
}

.author__name {
  margin: 0 0 0.25rem;
  color: var(--heading);
  font-size: 1.2rem;
  font-weight: 700;
}

.author__role,
.author__affiliation {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.5;
}

.author__affiliation {
  margin-top: 0.55rem;
  color: var(--text);
}

.author__section {
  margin-top: 1.4rem;
  padding-top: 0;
}

.author__label {
  margin: 0 0 0.45rem;
  color: var(--heading);
  font-size: 0.94rem;
  font-weight: 700;
}

.interest-list {
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.interest-list li {
  margin: 0 0 0.25rem;
}

.author__social {
  margin-top: 1.15rem;
}

.author__links.icons {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0;
  margin: 0;
}

.author__links.icons li {
  margin: 0;
}

.author__links.icons a {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 1.2rem;
  text-decoration: none;
}

.author__links.icons a:visited {
  color: var(--muted);
}

.author__links.icons a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* Content */
.breadcrumbs {
  margin-bottom: 0.8rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.page__header {
  margin-bottom: 2.25rem;
}

.page__title {
  padding-bottom: 0;
}

.lede,
.page__excerpt {
  margin-bottom: 1.25rem;
  color: var(--text);
  font-size: 1.06rem;
  line-height: inherit;
}

/* Simple definition list: no card, no coloured stripe */
.quick-facts {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 0.45rem 1rem;
  margin: 1.6rem 0 2.1rem;
  padding: 0;
}

.quick-facts dt {
  font-weight: 700;
  color: var(--heading);
}

.quick-facts dd {
  margin: 0;
}

.page__content > :first-child {
  margin-top: 0;
}

.page__content h2 {
  padding-bottom: 0;
}

.contact-card {
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--text);
  font-style: normal;
}

/* Home posts: plain archive entries rather than cards */
.archive {
  margin-top: 2.65rem;
}

.archive__title {
  margin-top: 0;
  margin-bottom: 1rem;
  padding-bottom: 0;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.list__item {
  margin: 0;
  padding: 0.8rem 0;
}

.list__item + .list__item {
  margin-top: 0.45rem;
}

.list__date {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.list__title {
  margin: 0 0 0.25rem;
  font-size: 1.17rem;
}

.list__excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

/* ---------- Structured entries ------------------------------------------ */

.entries {
  width: 100%;
  list-style: none;
  display: grid;
  gap: 1.15rem;
  margin: 0;
  padding: 0;
}

.entry {
  width: 100%;
  display: grid;
  gap: 0.15rem 1.5rem;
  padding-block: 0.25rem;
}

@media (min-width: 34rem) {
  .entry { grid-template-columns: var(--label-w) minmax(0, 1fr); }
}

.entry__label {
  margin: 0;
  align-self: start;
  padding-top: 0.22rem;
}

.entry__body {
  min-width: 0;
  width: 100%;
}

.entry__title {
  margin: 0;
  font-size: 1.065rem;
  font-weight: 700;
  line-height: 1.45;
}

.entry__meta {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.entry__note {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.entry__meta .label { font-size: 0.82rem; }

.group { margin-top: 2.1rem; }

.group__name {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

/* Teaching and research: structured lists, not card grids */
.module-list,
.publication-list,
.talk-list {
  list-style: none;
  display: grid;
  gap: 0.75rem;
  padding: 0;
  margin-left: 0;
}

.module-list > li,
.publication-list > li,
.talk-list > li {
  margin: 0;
  padding: 0.25rem 0;
  background: transparent;
}

.module-code {
  display: inline-block;
  min-width: 7.2rem;
  margin-right: 0.45rem;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  font-weight: 600;
}

.publication__title,
.talk__title {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--heading);
  font-weight: 700;
}

a.publication__title,
a.talk__title {
  color: var(--accent);
}

.publication__meta,
.talk__meta {
  display: block;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.55;
}

.compact-list {
  padding-left: 1.2rem;
}


/* Past-module disclosures -------------------------------------------------- */
.module-disclosures {
  width: 100%;
  margin: 0.45rem 0 2rem;
}

.module-disclosure {
  width: 100%;
}

.module-disclosure + .module-disclosure {
  border-top: 1px solid var(--border-light);
}

.module-disclosure summary {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 0.15rem;
  color: var(--heading);
  cursor: pointer;
  list-style: none;
  font-weight: 700;
}

.module-disclosure summary::-webkit-details-marker {
  display: none;
}

.module-disclosure summary::after {
  content: "\F282";
  flex: 0 0 auto;
  margin-left: 0.15rem;
  font-family: "bootstrap-icons";
  font-size: 0.95rem;
  line-height: 1;
  color: var(--accent);
  transition: transform 0.18s ease;
}

.module-disclosure[open] summary::after {
  transform: rotate(180deg);
}

.module-disclosure summary:hover {
  color: var(--accent);
}

.module-disclosure summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 3px;
}

.module-disclosure__title {
  min-width: 0;
  flex: 1 1 auto;
}

.module-disclosure__hint {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

.module-disclosure__content {
  padding: 0 0 0.55rem;
}

.module-disclosure__content .module-list {
  margin: 0;
}

.module-disclosure__content .module-list > li:first-child {
  border-top: 0;
}

@media (max-width: 520px) {
  .module-disclosure__hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .module-disclosure summary::after {
    transition: none;
  }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
}

.site-footer .container {
  padding-block: 1.25rem 2rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer p {
  margin: 0;
}

/* Mobile */
@media (max-width: 820px) {
  .masthead__inner {
    padding-block: 0.7rem;
    flex-wrap: wrap;
  }

  .site-title {
    width: 100%;
  }

  .greedy-nav {
    width: 100%;
    justify-content: flex-start;
  }

  .initial-content {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .sidebar {
    position: static;
  }

  .author {
    display: grid;
    grid-template-columns: 110px 1fr;
    column-gap: 1.25rem;
    align-items: start;
  }

  .author__avatar {
    width: 110px;
    height: 110px;
    grid-row: 1 / span 4;
    margin: 0;
  }

  .author__section,
  .author__social {
    grid-column: 2;
  }

  .quick-facts {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }

  .quick-facts dd {
    margin-bottom: 0.8rem;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 1rem;
  }

  .container {
    width: min(calc(100% - 1.5rem), var(--maxw));
  }

  .nav__item {
    padding-inline: 0.55rem;
  }

  .author {
    display: block;
  }

  .author__avatar {
    width: 120px;
    height: 120px;
    margin-bottom: 1rem;
  }

  .author__section,
  .author__social {
    margin-top: 1rem;
  }

  .module-code {
    display: block;
    min-width: 0;
    margin: 0 0 0.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media (prefers-contrast: more) {
  :root {
    --text: #111;
    --muted: #333;
    --border: #777;
    --border-light: #aaa;
    --accent: #004b87;
  }
}

@media (forced-colors: active) {
  .nav__item.active,
  .nav__item[aria-current="page"] {
    border-bottom: 3px solid CanvasText;
  }
}

@media print {
  .masthead,
  .sidebar,
  .site-footer,
  .skip-link {
    display: none !important;
  }

  .initial-content {
    display: block;
  }

  .page {
    max-width: none;
  }

  a {
    color: #000;
  }
}


/* Reading theme: warm paper and slightly more generous spacing without narrowing content. */
html[data-theme="reading"] .publication__meta,
html[data-theme="reading"] .talk__meta,
html[data-theme="reading"] .author__role,
html[data-theme="reading"] .author__affiliation,
html[data-theme="reading"] .interest-list,
html[data-theme="reading"] .entry__note {
  line-height: 1.7;
}

@media (max-width: 980px) {
  .masthead__inner { align-items: flex-start; flex-wrap: wrap; }
  .masthead__actions { width: 100%; justify-content: space-between; flex-wrap: wrap; }
}

@media (max-width: 680px) {
  .masthead__actions { display: block; }
  .theme-switcher { margin-top: 0.6rem; }
  .theme-button span { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
  .theme-button { width: 44px; padding: 0; }
}

@media print {
  .theme-switcher { display: none !important; }
}
