@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-opsz.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-opsz-italic.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #FBFBF9;
  --ink: #1A1D1B;
  --ink-2: #4A4F4C;
  --ink-3: #666C68;
  --accent: #1F5F4A;
  --accent-line: rgb(31 95 74 / 0.35);
  --ink-line: rgb(26 29 27 / 0.28);
  --selection: #D3E6DC;
  --hover-wash: rgb(26 29 27 / 0.06);
  --photo-wash: rgb(26 29 27 / 0.05);

  --font: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;

  --size-display: clamp(3rem, 1.6rem + 5.4vw, 5.25rem);
  --size-lead: clamp(1.3125rem, 1.15rem + 0.6vw, 1.5rem);
  --size-text: 1.125rem;
  --size-meta: 1rem;

  --weight-text: 400;
  --weight-title: 520;
  --weight-name: 500;
  --leading: 1.5;

  --gutter: 4.5rem;
  --gap: 2rem;
  --content: 40rem;
  --margin: 1.5rem;

  --section-gap: clamp(5rem, 3rem + 6vw, 8.5rem);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1A1C1B;
    --ink: #E8EAE8;
    --ink-2: #B6BBB8;
    --ink-3: #959B98;
    --accent: #A7CDBB;
    --accent-line: rgb(167 205 187 / 0.4);
    --ink-line: rgb(232 234 232 / 0.3);
    --selection: #34493F;
    --hover-wash: rgb(232 234 232 / 0.08);
    --photo-wash: rgb(232 234 232 / 0.06);
    --weight-text: 420;
    --weight-title: 540;
    --weight-name: 520;
    --leading: 1.55;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #1A1C1B;
  --ink: #E8EAE8;
  --ink-2: #B6BBB8;
  --ink-3: #959B98;
  --accent: #A7CDBB;
  --accent-line: rgb(167 205 187 / 0.4);
  --ink-line: rgb(232 234 232 / 0.3);
  --selection: #34493F;
  --hover-wash: rgb(232 234 232 / 0.08);
  --photo-wash: rgb(232 234 232 / 0.06);
  --weight-text: 420;
  --weight-title: 540;
  --weight-name: 520;
  --leading: 1.55;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--ink-3) transparent;
  background: var(--paper);
}

body {
  position: relative;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--size-text);
  font-weight: var(--weight-text);
  line-height: var(--leading);
  font-optical-sizing: auto;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

::selection { background: var(--selection); color: var(--ink); }

h1, h2, h3 { margin: 0; font-weight: 500; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
b { font-weight: var(--weight-name); }

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 0.22em;
  transition: color 150ms ease, text-decoration-color 150ms ease;
}
@media (hover: hover) {
  a:hover { text-decoration-color: currentColor; }
}

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

.theme-switching *, .theme-switching *::before, .theme-switching *::after {
  transition: none !important;
}

.skip {
  position: absolute;
  left: var(--margin);
  top: -4rem;
  padding: 0.5rem 0.75rem;
  background: var(--ink);
  color: var(--paper);
  font-size: var(--size-meta);
  z-index: 2;
}
.skip:focus { top: 1rem; }

.page {
  max-width: calc(var(--gutter) + var(--gap) + var(--content) + 2 * var(--margin));
  margin: 0 auto;
  padding: clamp(6rem, 4rem + 8vw, 11rem) var(--margin) clamp(4rem, 3rem + 4vw, 6rem);
}

.theme-toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  touch-action: manipulation;
  transition: color 150ms ease, background-color 150ms ease;
}
.theme-toggle[hidden] { display: none; }
@media (hover: hover) {
  .theme-toggle:hover { color: var(--ink); background: var(--hover-wash); }
}
.theme-toggle:active { background: var(--hover-wash); }
.theme-toggle svg { transition: transform 200ms var(--ease-out); }
:root[data-theme="dark"] .theme-toggle svg { transform: rotate(180deg); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle svg { transform: rotate(180deg); }
}

.portrait {
  display: block;
  width: clamp(6rem, 5rem + 2.5vw, 7.5rem);
  aspect-ratio: 4 / 5;
  height: auto;
  border-radius: 0.25rem;
  object-fit: cover;
  object-position: 50% 30%;
  background: var(--photo-wash);
  margin-bottom: 2rem;
}
.page:has(.portrait) { padding-top: clamp(4.5rem, 3rem + 5vw, 7.5rem); }

@media (min-width: 48rem) {
  .intro:has(.portrait) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 2.5rem;
    align-items: start;
  }
  .intro:has(.portrait) > * { grid-column: 1; }
  .intro .portrait {
    grid-column: 2;
    grid-row: 1 / span 3;
    margin: calc(var(--size-display) * -0.03) 0 0;
  }
  .page:has(.portrait) { padding-top: clamp(6rem, 4rem + 8vw, 11rem); }
}

.portrait--placeholder { display: flex; overflow: hidden; }
.portrait--placeholder svg {
  width: 100%;
  height: 100%;
  fill: var(--ink-3);
  opacity: 0.22;
}

.intro h1 {
  font-size: var(--size-display);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 0.95;
  margin-left: -0.04em;
}

.statement {
  margin-top: 1.75rem;
  max-width: 27em;
  font-size: var(--size-lead);
  line-height: 1.42;
  color: var(--ink);
}

.links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 2rem;
  margin-top: 1.5rem;
  font-size: var(--size-text);
}
.links li {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}
.links a {
  color: var(--ink);
  text-decoration-color: var(--ink-line);
}
@media (hover: hover) {
  .links a:hover { color: var(--accent); text-decoration-color: currentColor; }
}

#publications {
  margin-top: var(--section-gap);
  scroll-margin-top: 2rem;
}

#publications > h2 {
  font-size: var(--size-lead);
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: 2.5rem;
}

.year + .year { margin-top: 3rem; }

.year h3 {
  margin-bottom: 1rem;
  font-size: var(--size-meta);
  font-weight: 500;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--ink-3);
  line-height: 1.55;
}

.year ol { display: grid; gap: 1.75rem; }

.title {
  font-weight: var(--weight-title);
  line-height: 1.38;
}
.title a {
  color: var(--ink);
  text-decoration-color: transparent;
}
@media (hover: hover) {
  .title a:hover {
    color: var(--accent);
    text-decoration-color: var(--accent-line);
  }
}

.authors,
.venue {
  font-size: var(--size-meta);
  color: var(--ink-2);
  line-height: 1.5;
}
.authors { margin-top: 0.25rem; }
.authors b { color: var(--ink); }

.status {
  margin-left: 0.5rem;
  color: var(--accent);
  white-space: nowrap;
}

@media (min-width: 40rem) {
  .year {
    display: grid;
    grid-template-columns: var(--gutter) minmax(0, 1fr);
    column-gap: var(--gap);
  }
  .year h3 {
    position: sticky;
    top: 1.5rem;
    align-self: start;
    margin-bottom: 0;
    padding-top: 0.0625rem;
  }
}

.earlier { margin-top: 3rem; }

.earlier > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.75rem;
  font-size: var(--size-meta);
  color: var(--ink-2);
  cursor: pointer;
  list-style: none;
  touch-action: manipulation;
  transition: color 150ms ease;
}
.earlier > summary::-webkit-details-marker { display: none; }
.earlier > summary::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.1rem) rotate(-45deg);
  transition: transform 200ms var(--ease-out);
}
.earlier[open] > summary::before { transform: translateY(-0.2rem) rotate(45deg); }
@media (hover: hover) {
  .earlier > summary:hover { color: var(--ink); }
}
.earlier[open] > summary { margin-bottom: 2rem; }

@media (min-width: 40rem) {
  .earlier > summary { margin-left: calc(var(--gutter) + var(--gap)); }
}

@media (prefers-reduced-motion: no-preference) {
  .intro h1 { animation: name-settle 1200ms var(--ease-out) backwards; }
  .portrait, .statement, .links, #publications {
    animation: settle 700ms var(--ease-out) backwards;
  }
  .portrait, .statement { animation-delay: 70ms; }
  .links { animation-delay: 140ms; }
  #publications { animation-delay: 210ms; }

  @keyframes name-settle {
    from { opacity: 0; font-weight: 250; letter-spacing: 0.03em; }
    30% { opacity: 1; }
  }
  @keyframes settle {
    from { opacity: 0; transform: translateY(0.5rem); }
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

@media print {
  :root, :root[data-theme="dark"] {
    --paper: #fff; --ink: #000; --ink-2: #333; --ink-3: #555; --accent: #000;
    color-scheme: light;
  }
  @page { margin: 1.6cm 1.8cm; }
  body { font-size: 10.5pt; }
  .page { padding-top: 0; max-width: none; }
  .theme-toggle, .skip, .earlier > summary, .portrait--placeholder { display: none !important; }
  .page:has(.portrait) { padding-top: 0; }
  .portrait { width: 2.6cm; margin-bottom: 0.5cm; }
  .intro h1 { font-size: 28pt; }
  #publications { margin-top: 1.5rem; }
  .year h3 { position: static; }
  .year ol li { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}
