/* This stylesheet implements a restrained academic layout with warm neutral surfaces and a steel-blue accent shared with the site mark. */

@font-face {
  font-family: "Latin Modern Sans";
  src: url("assets/fonts/latin-modern-sans-regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: fallback;
  unicode-range:
    U+0000-024F, U+1E00-1EFF, U+2000-206F, U+20AC, U+2113, U+2122, U+2190-21FF,
    U+2212, U+2217;
}

@font-face {
  font-family: "Latin Modern Sans";
  src: url("assets/fonts/latin-modern-sans-bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: fallback;
  unicode-range:
    U+0000-024F, U+1E00-1EFF, U+2000-206F, U+20AC, U+2113, U+2122, U+2190-21FF,
    U+2212, U+2217;
}

@font-face {
  font-family: "Latin Modern Sans";
  src: url("assets/fonts/latin-modern-sans-oblique.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: fallback;
  unicode-range:
    U+0000-024F, U+1E00-1EFF, U+2000-206F, U+20AC, U+2113, U+2122, U+2190-21FF,
    U+2212, U+2217;
}

:root {
  color-scheme: light;

  --paper: #f6f4ee;
  --paper-raised: #fdfcf7;
  --ink: #201e18;
  --ink-soft: #45412f;
  --muted: #6e6858;
  --line: #dcd7c9;
  --line-strong: #201e18;
  --media-line: #c7c0b0;
  --accent: #315f91;
  --accent-strong: #274d77;

  --footer-bg: #201e18;
  --footer-ink: #efece1;
  --footer-muted: #a29c8b;
  --footer-line: #3b382f;
  --footer-accent: #9dc1e8;

  --font-sans:
    "Latin Modern Sans", Arial, Helvetica, "Helvetica Neue", "DejaVu Sans",
    sans-serif;

  --content-width: 68rem;
  --measure: 46rem;
  --marker-col: 12rem;
}

/* The dark palette appears twice by design: once for the explicit
   data-theme choice and once for the system preference. The two blocks
   must stay value-identical; edit them together. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #171512;
  --paper-raised: #1e1c18;
  --ink: #e9e5da;
  --ink-soft: #cfcaba;
  --muted: #a09a89;
  --line: #353128;
  --line-strong: #e9e5da;
  --media-line: #5b5447;
  --accent: #9dc1e8;
  --accent-strong: #c0d8f2;

  --footer-bg: #110f0c;
  --footer-ink: #e9e5da;
  --footer-muted: #a09a89;
  --footer-line: #2e2b23;
  --footer-accent: #9dc1e8;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #171512;
    --paper-raised: #1e1c18;
    --ink: #e9e5da;
    --ink-soft: #cfcaba;
    --muted: #a09a89;
    --line: #353128;
    --line-strong: #e9e5da;
    --media-line: #5b5447;
    --accent: #9dc1e8;
    --accent-strong: #c0d8f2;

    --footer-bg: #110f0c;
    --footer-ink: #e9e5da;
    --footer-muted: #a09a89;
    --footer-line: #2e2b23;
    --footer-accent: #9dc1e8;
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-block-start: var(--masthead-offset, 4.5rem);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.68;
  font-synthesis: none;
}

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

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

h1,
h2,
h3,
h4 {
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  text-wrap: balance;
  margin: 0;
}

p {
  margin: 0;
  text-wrap: pretty;
}

p,
li,
dd,
dt,
cite,
figcaption,
blockquote,
a {
  overflow-wrap: anywhere;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-underline-offset: 0.22em;
  transition:
    color 0.15s ease,
    text-decoration-color 0.15s ease;
}

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

button {
  font: inherit;
  color: inherit;
}

:where(a, button):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 1px;
}

.container {
  width: min(100% - 2.75rem, var(--content-width));
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.6rem 0.9rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  text-decoration: none;
  transform: translateY(calc(-100% - 1.5rem));
}

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

.meta {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.label {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.masthead {
  position: sticky;
  inset-block-start: 0;
  z-index: 50;
  background: var(--paper);
}

.masthead-is-tall .masthead {
  position: static;
}

.masthead-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  min-block-size: 3.75rem;
  gap: 0.25rem 1.25rem;
  padding-block: 0.4rem;
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.55rem;
  min-block-size: 44px;
  color: var(--ink);
  text-decoration: none;
}

.brand-name {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

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

.brand:hover .brand-name {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
}

.brand svg {
  inline-size: 32px;
  block-size: 36px;
  max-inline-size: none;
  color: var(--accent);
  transition: color 0.15s ease;
}

.brand:hover svg {
  color: var(--accent-strong);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.1rem 1.6rem;
  margin-left: auto;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.35em;
}

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

.theme-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 999px;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--muted);
}

.js .theme-toggle {
  display: inline-grid;
  place-items: center;
}

.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

.rule-double {
  height: 7px;
  border-top: 2px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.intro {
  padding-block-start: clamp(3.5rem, 8vw, 6.5rem);
  padding-block-end: clamp(3rem, 6vw, 4.75rem);
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(12rem, 22vw, 15rem);
  align-items: start;
  gap: clamp(2.5rem, 6vw, 5.5rem);
}

.intro-eyebrow {
  margin-bottom: 1.5rem;
}

.intro h1 {
  font-size: clamp(2.6rem, 5.5vw, 4rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.02em;
  max-width: 16ch;
}

.intro-lede {
  margin-top: 1.6rem;
  font-size: clamp(1.2rem, 1.9vw, 1.4rem);
  line-height: 1.5;
  max-width: 48ch;
}

.intro-bio {
  margin-top: 1.4rem;
  max-width: 34rem;
  color: var(--ink-soft);
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2.25rem;
  margin-top: 2.2rem;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  font-size: 1.0625rem;
}

.link-arrow::after {
  content: "\2192" / "";
  font-family: var(--font-sans);
  font-size: 0.9em;
  transition: translate 0.15s ease;
}

.link-arrow:hover::after {
  translate: 3px 0;
}

.portrait {
  margin: 0;
}

.portrait img {
  width: 100%;
  border: 1px solid var(--media-line);
  background: var(--paper-raised);
}

.section-inner {
  border-top: 1px solid var(--line);
  padding-block: clamp(3.5rem, 7vw, 5.5rem);
}

.section-grid {
  display: grid;
  grid-template-columns: var(--marker-col) minmax(0, 1fr);
  gap: 1.25rem 3.5rem;
  align-items: start;
}

.marker {
  padding-top: 0.55rem;
  position: sticky;
  /* Track the measured masthead height so the marker never tucks under a masthead that grows with larger text. */
  top: calc(var(--masthead-offset, 5.25rem) - 0.5rem);
}

.marker-no {
  color: var(--accent);
  font-weight: 400;
  margin-right: 0.5em;
}

.section-body > h2 {
  font-size: clamp(1.55rem, 2.6vw, 2rem);
  letter-spacing: -0.015em;
}

.section-body {
  min-width: 0;
}

.section-intro {
  margin-top: 0.9rem;
  color: var(--muted);
  max-width: var(--measure);
}

.section-body > .section-content {
  margin-top: 2.6rem;
}

.pub-list {
  display: grid;
  min-width: 0;
  padding: 0;
  margin: 0;
  list-style: none;
}

.pub {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  padding-block: 1.6rem;
}

.pub:first-child {
  padding-top: 0;
}

.pub + .pub {
  border-top: 1px solid var(--line);
}

.pub-title {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.25rem;
  font-style: normal;
  font-weight: 700;
  line-height: 1.3;
  max-width: var(--measure);
}

.pub-authors {
  margin-top: 0.45rem;
  font-size: 1rem;
  color: var(--muted);
}

/* The site owner's name inside author lists; visual emphasis only. */
.pub-self {
  font-weight: 700;
}

.pub-more {
  margin-top: 1.9rem;
}

.subheading {
  margin-bottom: 0.85rem;
}

.themes-heading {
  margin-top: 3rem;
}

.research-overview p {
  max-width: var(--measure);
  color: var(--ink-soft);
}

.research-overview p + p {
  margin-top: 1rem;
}

.section-body > .research-overview {
  margin-top: 1.4rem;
}

.cv-list {
  display: grid;
  min-width: 0;
  padding: 0;
  margin: 0;
  list-style: none;
}

.cv-row {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 11rem) minmax(0, 1fr);
  gap: 0.5rem 2.75rem;
  padding-block: 1.7rem;
}

.pub > *,
.cv-row > * {
  min-width: 0;
}

.cv-row:first-child {
  padding-top: 0;
}

.cv-row + .cv-row {
  border-top: 1px solid var(--line);
}

.cv-when {
  padding-top: 0.3rem;
}

.cv-row h3 {
  font-size: 1.25rem;
}

.cv-role {
  margin-top: 0.15rem;
  font-style: italic;
  color: var(--ink-soft);
}

.cv-row ul {
  margin: 0.8rem 0 0;
  padding-left: 1.15rem;
  color: var(--ink-soft);
}

.cv-row ul li {
  padding-left: 0.2rem;
  text-wrap: pretty;
}

.cv-row ul li::marker {
  content: "\2013\2002" / "";
  color: var(--muted);
}

.cv-row ul li + li {
  margin-top: 0.35rem;
}

.cv-note {
  margin-top: 0.8rem;
  color: var(--ink-soft);
  max-width: 38rem;
}

.skills-list {
  display: grid;
  margin: 0;
}

.skills-row {
  display: grid;
  grid-template-columns: minmax(0, 11rem) minmax(0, 1fr);
  gap: 0.4rem 2.75rem;
  padding-block: 1.15rem;
}

.skills-row:first-child {
  padding-top: 0;
}

.skills-row + .skills-row {
  border-top: 1px solid var(--line);
}

.skills-row dt {
  padding-top: 0.2rem;
}

.skills-row dd {
  margin: 0;
  color: var(--ink-soft);
}

.site-footer {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  background: var(--footer-bg);
  color: var(--footer-ink);
  padding: clamp(3.5rem, 7vw, 5.5rem) 0 1.9rem;
}

.site-footer .label {
  color: var(--footer-muted);
}

.site-footer :where(a, button):focus-visible {
  outline-color: var(--footer-accent);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2.5rem 4rem;
  align-items: start;
}

.footer-grid > * {
  min-width: 0;
}

.footer-grid h2 {
  font-size: clamp(1.8rem, 3.4vw, 2.5rem);
  letter-spacing: -0.015em;
  max-width: 22ch;
}

.footer-email {
  display: inline-block;
  margin-top: 1.3rem;
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  color: var(--footer-accent);
  overflow-wrap: anywhere;
  text-decoration-color: color-mix(
    in srgb,
    var(--footer-accent) 45%,
    transparent
  );
}

.footer-email:hover {
  color: var(--footer-accent);
  text-decoration-color: currentColor;
}

.footer-profiles {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.35rem;
}

.footer-profiles a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 40px;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--footer-ink);
  text-decoration-color: color-mix(in srgb, var(--footer-ink) 35%, transparent);
}

.footer-profiles a:hover {
  color: var(--footer-accent);
}

.footer-base {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-top: clamp(3rem, 6vw, 4.5rem);
  padding-top: 1.4rem;
  border-top: 1px solid var(--footer-line);
}

.footer-base p,
.footer-base a {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--footer-muted);
}

.footer-base a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  text-decoration-color: color-mix(
    in srgb,
    var(--footer-muted) 45%,
    transparent
  );
}

.footer-base a:hover {
  color: var(--footer-ink);
}

.error-layout {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.error-page {
  flex: 1;
  display: grid;
  align-items: center;
  padding-block: clamp(4rem, 10vw, 8rem);
}

.error-copy h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  letter-spacing: -0.02em;
  max-width: 18ch;
}

.error-page .section-intro {
  margin-top: 1.2rem;
  max-width: 34rem;
}

.error-page .link-arrow {
  margin-top: 2rem;
}

.error-layout .site-footer {
  margin-top: 0;
}

@media (max-width: 880px) {
  .section-grid {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }

  .marker {
    padding-top: 0;
    position: static;
  }
}

@media (max-width: 700px) {
  html {
    scroll-padding-block-start: var(--masthead-offset, 10rem);
  }

  .masthead-row {
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr) 44px;
    gap: 0.25rem 0.75rem;
  }

  .site-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    margin-left: 0;
    justify-content: center;
    gap: 0.1rem 0.9rem;
  }

  .site-nav a {
    min-height: 40px;
  }

  .theme-toggle {
    grid-column: 3;
    grid-row: 1;
  }

  .intro-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .portrait {
    order: -1;
    width: min(100%, clamp(11rem, 40vw, 14rem));
  }

  .cv-row,
  .skills-row {
    grid-template-columns: 1fr;
  }

  .cv-when {
    padding-top: 0;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-profiles {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.25rem 1.75rem;
    padding-top: 0;
  }
}

@media (max-width: 560px) {
  .container {
    width: min(100% - 2.25rem, var(--content-width));
  }

  .masthead-row {
    gap: 0.25rem 1rem;
  }

  .pub {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}

@media (max-width: 380px) {
  .site-nav {
    gap: 0.1rem 0.7rem;
  }

  .site-nav a {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
  }
}

@media (max-height: 28rem) and (max-width: 700px) {
  html {
    scroll-padding-block-start: 1.5rem;
  }

  .masthead {
    position: static;
  }
}

@media (prefers-contrast: more) {
  :root {
    --muted: #4f4a3f;
    --line: #8c8575;
    --media-line: #6e675a;
  }

  :root[data-theme="dark"] {
    --muted: #d1cabb;
    --line: #777061;
    --media-line: #a39b8a;
  }
}

@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --muted: #d1cabb;
    --line: #777061;
    --media-line: #a39b8a;
  }
}

@media (forced-colors: active) {
  .rule-double,
  .section-inner,
  .pub + .pub,
  .cv-row + .cv-row,
  .skills-row + .skills-row,
  .footer-base {
    border-color: CanvasText;
  }

  .portrait img,
  .theme-toggle {
    border-color: ButtonText;
  }

  .marker-no,
  a {
    color: LinkText;
  }

  :where(a, button):focus-visible {
    outline-color: Highlight;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@media print {
  :root[data-theme],
  :root:not([data-theme]) {
    color-scheme: light;
    --paper: #ffffff;
    --paper-raised: #ffffff;
    --ink: #000000;
    --ink-soft: #1a1a1a;
    --muted: #444444;
    --line: #bbbbbb;
    --line-strong: #000000;
    --accent: #1a3c61;
    --accent-strong: #1a3c61;
  }

  body {
    font-size: 11pt;
  }

  .masthead {
    position: static;
  }

  .skip-link,
  .site-nav,
  .theme-toggle,
  .footer-base a[href="#top"] {
    display: none !important;
  }

  .site-footer {
    background: none;
    color: #000000;
    --footer-ink: #000000;
    --footer-muted: #444444;
    --footer-accent: #1a3c61;
    --footer-line: #bbbbbb;
    border-top: 1px solid #bbbbbb;
    margin-top: 2rem;
    padding-top: 2rem;
  }

  .section-inner,
  .intro {
    padding-block: 1.5rem;
  }

  .footer-profiles a::after {
    content: " (" attr(href) ")";
    color: var(--footer-muted);
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .footer-profiles {
    gap: 0.5rem;
  }

  .footer-profiles a {
    display: block;
    min-height: 0;
  }

  .footer-base {
    break-inside: avoid;
    margin-top: 1.5rem;
    padding-top: 0.75rem;
  }

  .footer-email {
    font-size: 12pt;
    overflow-wrap: normal;
  }

  .marker {
    break-after: avoid;
  }

  h2,
  h3,
  h4,
  .subheading {
    break-after: avoid;
  }

  .cv-row,
  .pub,
  .skills-row {
    break-inside: avoid;
  }

  p {
    orphans: 3;
    widows: 3;
  }
}
