/* Charter ships with Apple devices; other visitors download a copy (fonts/LICENSE.txt). */
@font-face {
  font-family: "Charter";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: local("Charter-Roman"), local("Charter Roman"), url("fonts/charter-roman.woff2") format("woff2");
}

@font-face {
  font-family: "Charter";
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  src: local("Charter-Italic"), local("Charter Italic"), url("fonts/charter-italic.woff2") format("woff2");
}

@font-face {
  font-family: "Charter";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: local("Charter-Bold"), local("Charter Bold"), url("fonts/charter-bold.woff2") format("woff2");
}

@font-face {
  font-family: "Charter";
  font-weight: 700;
  font-style: italic;
  font-display: swap;
  src: local("Charter-BoldItalic"), local("Charter BT Bold Italic"), url("fonts/charter-bolditalic.woff2") format("woff2");
}

:root {
  --fg: #1f2328;
  --muted: #57606a;
  --hairline: #e5e7eb;
  --bg: #ffffff;
  --fg-soft: #3d444d;
  --brand: #0f766e;
  --measure: 580px;
  --portrait: 110px;
  /* The music logos have white built in; their chip on dark pages matches it. */
  --logo-chip: #ffffff;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e6e8eb;
    --muted: #9aa4ae;
    --fg-soft: #c3cad1;
    --hairline: #2b3138;
    --bg: #121519;
    --brand: #2dd4bf;
  }
}

html {
  color-scheme: light dark;
}

body {
  margin: 0;
  padding: 0 1.25rem;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Reading text is serif; the site chrome and small labels stay sans. */
.site-header,
.site-footer {
  font-family: var(--sans);
}

.site-header,
.page,
.site-footer {
  max-width: var(--measure);
  margin-left: auto;
  margin-right: auto;
}

/* Header: name left, pages right; wraps under the name on narrow screens. */
.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem 1.5rem;
  padding: 1.25rem 0 1rem;
  border-bottom: 1px solid var(--hairline);
}

.site-name {
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav li {
  margin: 0;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

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

.site-nav a[aria-current="page"] {
  color: var(--brand);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.45em;
}

/* Phones can't fit every page on one line: two even rows of equal columns instead of a straggler. */
@media (max-width: 480px) {
  .site-header {
    row-gap: 0.6rem;
    padding: 1rem 0 0.85rem;
  }

  .site-nav {
    width: 100%;
  }

  .site-nav ul {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.45rem 1rem;
  }

  .site-nav a {
    font-size: 0.92rem;
  }
}

/* Content */
.page {
  padding: 2.25rem 0 3rem;
}

a {
  color: var(--brand);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  /* Faint, but present: teal alone isn't 3:1 against body text (WCAG 1.4.1). */
  text-decoration-color: color-mix(in srgb, var(--brand) 22%, transparent);
}

/* Author names (linked to their ORCID) read as text; only some authors have one,
   so a visible underline would scatter marks through the list. */
.pub a[href*="//orcid.org/"] {
  color: inherit;
  text-decoration-color: transparent;
}

.pub a[href*="//orcid.org/"]:hover {
  text-decoration-color: currentColor;
}

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

h1,
h2,
h3 {
  color: var(--fg);
  font-weight: 700;
  line-height: 1.25;
}

h1 {
  font-size: 1.75rem;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.2rem;
  margin: 2.25rem 0 0.75rem;
}

h3 {
  font-size: 1.05rem;
  margin: 1.75rem 0 0.4rem;
}

p,
li,
dd {
  overflow-wrap: anywhere;
}

p {
  margin: 0 0 1rem;
}

ul,
ol {
  padding-left: 1.25rem;
}

li {
  margin-bottom: 0.35rem;
}

img,
iframe {
  max-width: 100%;
}

img {
  height: auto;
}

/* The few rules from Sphinx's basic.css this site relies on; that file isn't loaded. */
a.headerlink {
  visibility: hidden;
}

h1:hover > a.headerlink,
h2:hover > a.headerlink,
h3:hover > a.headerlink {
  visibility: visible;
}

ul.simple p {
  margin-bottom: 0;
}

dl > dd:last-child,
dl > dd:last-child > :last-child {
  margin-bottom: 0;
}

/* Footer */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 0 2rem;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer .icons {
  display: flex;
  gap: 0.5rem;
}

/* WCAG 2.5.8: at least 24x24px targets. */
.site-footer .icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  color: var(--muted);
}

.site-footer .icons a:hover {
  color: var(--fg);
}

.site-footer .icons svg {
  width: 18px;
  height: 18px;
}

/* Home intro: photo beside the name and tagline; everything after spans the column.
   :where() keeps these selectors at zero specificity so the per-element rules win. */
:where(.page > section:has(> .portrait)) {
  display: grid;
  grid-template-columns: var(--portrait) 1fr;
  grid-template-areas:
    "photo name"
    "photo tagline";
  column-gap: 1.5rem;
  align-items: center;

  & > * {
    grid-column: 1 / -1;
  }

  & > h1 {
    grid-area: name;
    align-self: end;
    margin: 0 0 0.25rem;
  }

  @media (max-width: 480px) {
    grid-template-columns: 1fr;
    grid-template-areas:
      "photo"
      "name"
      "tagline";
  }
}

.portrait {
  grid-area: photo;
  width: var(--portrait);
  height: var(--portrait);
  border-radius: 50%;
  object-fit: cover;
}

.tagline {
  grid-area: tagline;
  align-self: start;
  color: var(--muted);
  line-height: 1.5;
}

.tagline p {
  margin: 0;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 1.5rem 0 0.5rem;
}

@media (max-width: 480px) {
  .portrait {
    margin-bottom: 1rem;
  }
}

/* Small grey labels group items within a list: Projects themes, publication years. */
section:has(> .project-list) > h2,
section:has(> .pub) > h3 {
  margin: 2.5rem 0 0.75rem;
  font-family: var(--sans);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-list ul,
.music-links ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.project-list li {
  margin: 0 0 0.6rem;
  color: var(--fg-soft);
}

.project-list strong a {
  color: var(--fg);
  font-weight: 700;
  text-decoration: none;
}

.project-list strong a:hover {
  color: var(--brand);
}

/* The first year label sits right under its section heading. */
h2 + section:has(> .pub) > h3 {
  margin-top: 1rem;
}

/* Publications: the title leads; authors and venue follow in smaller grey text. */
.pub {
  margin: 0 0 1.25rem;
}

/* Publications and dated lists share one entry shape: a lead line, then grey details. */
.pub p,
.dated dd p {
  margin: 0;
}

.pub p + p,
.dated dd p + p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.pub p + p strong {
  color: var(--fg);
  white-space: nowrap;
}

/* Talks and Teaching: the date sits in a narrow left column; title, then details in grey. */
.dated dl {
  display: grid;
  grid-template-columns: 5.25rem 1fr;
  column-gap: 1rem;
  margin: 0;
}

.dated dt {
  padding-top: 0.15rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
}

.dated dd {
  margin: 0 0 1.1rem;
}

@media (max-width: 480px) {
  .dated dl {
    display: block;
  }

  .dated dt {
    padding-top: 0;
  }
}

/* Fun page: photos flush with the text column, three across (two on phones). */
.photos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 0 0 1.25rem;
}

.photos img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

@media (max-width: 480px) {
  .photos {
    grid-template-columns: repeat(2, 1fr);
  }

  /* An odd photo out spans the last row instead of sitting alone. */
  .photos img:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

iframe {
  display: block;
  margin-bottom: 1.25rem;
}

/* Music sources: a small logo beside each named link, description in grey. */
.music-links li {
  color: var(--muted);
}

.music-links img {
  height: 32px;
  width: auto;
  margin-right: 0.75rem;
  vertical-align: middle;
}

@media (prefers-color-scheme: dark) {
  .music-links img {
    background: var(--logo-chip);
    border-radius: 4px;
    padding: 2px;
  }
}
