/* ---------- Tokens ---------- */
:root {
  --paper: #fdfcf9;
  --card: #f6f2e8;
  --ink: #121212;
  --grey-1: #2b2b2b;
  --grey-2: #555555;
  --grey-3: #8a8a8a;
  --rule: #e4e1da;

  --serif: "Cormorant Garamond", "Garamond", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --pad: clamp(1.25rem, 5vw, 5rem);
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
em { font-style: italic; }
h1, h2, h3 { font-weight: 300; margin: 0; }

/* Underline that draws in from the left */
.links a, .pub-links a, .hero-links a, .email, .colophon a {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.5s var(--ease);
}
.links a:hover, .pub-links a:hover, .hero-links a:hover, .email:hover, .colophon a:hover { background-size: 100% 1px; }

/* ---------- Header: inverts over light and dark ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.75rem var(--pad);
  color: #fff;
  mix-blend-mode: difference;
}
.mark { font: 500 1.35rem var(--serif); letter-spacing: 0.04em; }
.mark span { margin: 0 0.1em; opacity: 0.5; }
nav a {
  margin-left: 2rem;
  font: 400 0.72rem var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
nav a:hover { opacity: 0.55; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100svh;
}
.hero-text {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  padding: 7rem var(--pad) 4.75rem;
}
.hero-main { margin: auto 0; }
/* the skyline across the lake, bottom right of the column */
.skyline { align-self: flex-end; width: min(22rem, 100%); margin: 2.5rem 0 0; }
.skyline svg { display: block; width: 100%; height: auto; }
.skyline .ripple { animation: ripple 7s ease-in-out infinite alternate; }
@keyframes ripple { from { transform: translateX(-1.5px); } to { transform: translateX(1.5px); } }
.eyebrow em {
  display: block;
  margin-top: 0.45rem;
  font: italic 300 1.15rem var(--serif);
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  cursor: help;
}
.eyebrow {
  margin: 0 0 2.25rem;
  font: 400 0.72rem var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--grey-2);
}
h1 {
  font: 300 clamp(3.4rem, 9vw, 10.5rem)/0.95 var(--serif);
  letter-spacing: -0.03em;
  margin-left: -0.05em;
  white-space: nowrap;
}
h1 em { font-weight: 300; }
/* the name sets itself letter by letter */
.js h1 .ch {
  display: inline-block;
  white-space: pre;
  opacity: 0;
  transform: translateY(0.3em);
  animation: ch-in 1.1s var(--ease) forwards;
  animation-delay: calc(0.15s + var(--i) * 0.055s);
}
@keyframes ch-in { to { opacity: 1; transform: none; } }
.lede {
  max-width: 26rem;
  margin: 2.25rem 0 0;
  font: italic 300 clamp(1.3rem, 1.8vw, 1.6rem)/1.45 var(--serif);
  color: var(--ink);
}
.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.75rem;
  max-width: 30rem;
  margin: 2.5rem 0 0;
  padding: 1.25rem 0 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}
.hero-links li::before { content: "↗"; margin-right: 0.45rem; font: 400 0.7rem var(--mono); color: var(--grey-3); }
.hero-links a { font: 400 0.7rem var(--mono); letter-spacing: 0.12em; text-transform: uppercase; }
.hero-foot {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  bottom: 2.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: fx-fade 1.2s var(--ease) 1.2s both;
}
.coords { font: 400 0.68rem var(--mono); letter-spacing: 0.1em; color: var(--grey-3); }
.coords abbr { text-decoration: none; cursor: help; }
.scroll-cue {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font: 400 0.68rem var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--grey-2);
}
.scroll-cue span {
  position: relative;
  width: 3.5rem;
  height: 1px;
  background: var(--rule);
  overflow: hidden;
}
.scroll-cue span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  animation: cue 2.6s var(--ease) infinite;
}
@keyframes cue {
  0% { transform: translateX(-100%); }
  60%, 100% { transform: translateX(100%); }
}

.hero-figure { position: relative; min-height: 100svh; }
.plate {
  position: absolute;
  top: calc(50% + 0.5rem);
  right: var(--pad);
  width: min(100% - var(--pad) - 1rem, (100svh - 13rem) * 0.7756);
  aspect-ratio: 1400 / 1805;
  margin: 0;
  transform: translateY(-50%);
}
/* the plate mark: the faint ridge a copper plate presses into the paper */
.plate::before {
  content: "";
  position: absolute;
  inset: -0.9rem;
  border: 1px solid var(--rule);
  pointer-events: none;
  animation: plate-mark 1.8s var(--ease) both;
}
@keyframes plate-mark {
  from { clip-path: inset(0 100% 100% 0); }
  to { clip-path: inset(0 0 0 0); }
}
#engraving { display: block; width: 100%; height: 100%; cursor: none; }
.plate figcaption {
  position: absolute;
  top: calc(100% + 1.6rem);
  left: -0.9rem;
  right: -0.9rem;
  font: 400 0.68rem/1.6 var(--mono);
  letter-spacing: 0.02em;
  color: var(--grey-2);
}
.plate figcaption span { color: var(--ink); margin-right: 0.4rem; }

/* ---------- Content blocks ---------- */
.block {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) 3fr;
  gap: 2rem 4rem;
  padding: 7rem var(--pad);
  border-top: 1px solid var(--rule);
}
.block-label {
  position: sticky;
  top: 6rem;
  align-self: start;
  font: 400 0.72rem var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.block-label span { display: block; margin-bottom: 0.35rem; color: var(--grey-3); }
.block-body { max-width: 58rem; margin: 0; padding: 0; }

.statement {
  margin: 0;
  font: 300 clamp(1.6rem, 2.6vw, 2.35rem)/1.32 var(--serif);
  text-indent: 2.5em;
}
/* About: one hairline row per entry, like a table of contents */
#about .block-body { container-type: inline-size; }
/* one grid for all rows, so the institutions line up on their first letter */
.facts {
  display: grid;
  grid-template-columns: 7rem 1fr auto;
  column-gap: 1.75rem;
  margin: 4.5rem 0 0;
}
.facts > div {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  row-gap: 0.15rem;
  align-items: baseline;
  padding: 1.15rem 0;
  border-top: 1px solid var(--rule);
}
.facts > div:last-child { border-bottom: 1px solid var(--rule); }
.facts > div:has(> dt:empty) { padding-top: 0; border-top-color: transparent; }
.facts dt { font: 400 0.68rem var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--grey-3); }
.facts dd { margin: 0; font: 400 clamp(1.1rem, 1.42vw, 1.3rem)/1.35 var(--serif); white-space: nowrap; }
.facts dd small { display: block; margin-top: 0.2rem; font: 400 0.82rem var(--sans); color: var(--grey-2); }
.facts dd small:empty { display: none; }
.facts dd.where { font-style: italic; color: var(--grey-2); }
/* too narrow for degree and institution side by side: the institution goes underneath */
@container (max-width: 54rem) {
  .facts { grid-template-columns: 7rem 1fr; }
  .facts dd { white-space: normal; }
  .facts dd.where { grid-column: 2; }
  .facts dd.where:empty { display: none; }
}

/* Research: one row per area, the figure framed like a plate */
.themes.block-body { max-width: none; list-style: none; }
.themes li {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 2rem 3.5rem;
  align-items: center;
  padding: 3rem 0;
  border-top: 1px solid var(--rule);
}
.themes li:first-child { padding-top: 0; border-top: 0; }
.fig { margin: 0; padding: clamp(1rem, 2.5vw, 2rem); border: 1px solid var(--rule); }
.fig svg, .fig img { display: block; width: 100%; height: auto; }
.themes h3 { margin-bottom: 1rem; font: 300 clamp(2.2rem, 3.4vw, 3.2rem)/1 var(--serif); letter-spacing: -0.01em; }
.themes p { margin: 0; max-width: 24rem; font-size: 0.92rem; color: var(--grey-2); }

/* Figure animation: lines draw, shapes grow, texture fades in */
.fx-draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: fx-draw 1.5s var(--ease) forwards; }
.fx-slow { animation-duration: 2.8s; }
.fx-pop {
  opacity: 0;
  transform: scale(0.8);
  transform-box: fill-box;
  transform-origin: center;
  animation: fx-pop 1.3s var(--ease) forwards;
}
.fx-fade { opacity: 0; animation: fx-fade 1.2s var(--ease) forwards; }
.fx-out { animation: fx-out 1.6s var(--ease) forwards; }
@keyframes fx-draw { to { stroke-dashoffset: 0; } }
@keyframes fx-pop { to { opacity: 1; transform: none; } }
@keyframes fx-fade { to { opacity: 1; } }
@keyframes fx-out { to { opacity: 0; } }
.js .themes li:not(.is-in) .fig * { animation-play-state: paused; }

/* Interlude: a plate set in the middle of the page: headline, line, board, reading */
.interlude-body { text-align: center; }
.interlude-body h2 {
  font: italic 300 clamp(2.2rem, 3.4vw, 3.3rem)/1.08 var(--serif);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.interlude-line { margin: 0.9rem 0 0; font-size: 0.92rem; color: var(--grey-2); }
.quincunx { width: min(100%, 31rem); margin: 1.5rem auto 0; }
#quincunx { display: block; width: 100%; aspect-ratio: 540 / 568; }
/* the running count, set as statistics are set in a book */
.quincunx-stats {
  margin: 0.4rem 0 0;
  font: 400 1.2rem var(--serif);
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--ink);
}
.quincunx-stats i { font-style: italic; }
.quincunx-stats i + span { display: inline-block; min-width: 2em; text-align: left; }
.quincunx-stats span + i { margin-left: 0.8em; }
.quincunx figcaption { margin-top: 0.6rem; font: 400 0.68rem/1.6 var(--mono); letter-spacing: 0.02em; color: var(--grey-2); }
.quincunx-again {
  margin-top: 1rem;
  padding: 0.2rem 0;
  font: 400 0.68rem var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey-2);
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  border: 0;
  cursor: pointer;
  transition: color 0.3s var(--ease), background-size 0.5s var(--ease);
}
.quincunx-again:hover { color: var(--ink); background-size: 100% 1px; }
.quincunx-again[hidden] { display: inline-block; visibility: hidden; }   /* keeps its place, so nothing jumps */

/* Publications */
.pubs { list-style: none; container-type: inline-size; }
.pubs li {
  display: grid;
  grid-template-columns: 3.25rem 1fr;
  gap: 1.25rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--rule);
}
.pubs li:first-child { border-top: 1px solid var(--rule); }
.pub-year { padding-top: 0.45rem; font: 400 0.75rem var(--mono); color: var(--grey-3); }
.pubs h3 { font: 400 clamp(1.35rem, 1.9vw, 1.7rem)/1.25 var(--serif); }
.pubs p { margin: 0; }
.pub-meta { margin-top: 0.5rem !important; font-size: clamp(0.8rem, 0.95vw, 0.86rem); color: var(--grey-2); }
/* wide enough: keep each author line on one line */
@container (min-width: 54rem) { .pub-meta { white-space: nowrap; } }
.pub-meta strong { font-weight: 500; color: var(--ink); }
.pub-links { margin-top: 0.9rem !important; display: flex; gap: 1.25rem; }
.pub-links a { font: 400 0.68rem var(--mono); letter-spacing: 0.12em; text-transform: uppercase; }

/* Contact + magic square */
.contact {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4rem;
  align-items: start;
}
.contact > div:first-child { display: flex; align-items: center; height: 15rem; }
.email { font: 300 clamp(1.8rem, 3.6vw, 3.2rem)/1.2 var(--serif); }
.links { list-style: none; margin: 2.5rem 0 0; padding: 0; }
.links li { padding: 0.35rem 0; font: 400 0.75rem var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.links li::before { content: "↗"; margin-right: 0.75rem; color: var(--grey-3); }

.magic { margin: 0; width: 15rem; }
.magic-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-left: 1px solid var(--rule);
  border-top: 1px solid var(--rule);
}
.magic-grid span {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font: 300 1.5rem var(--serif);
  color: var(--ink);
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
  cursor: default;
}
.magic-grid span.on { background: var(--ink); color: var(--paper); }
.magic-sum { margin-top: 1rem; font: 400 0.75rem var(--mono); letter-spacing: 0.06em; }
.magic-note { margin-top: 0.6rem; font: 400 0.8rem/1.55 var(--sans); color: var(--grey-2); }

/* Colophon */
.colophon {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 2.5rem var(--pad) 3rem;
  border-top: 1px solid var(--rule);
  font: 400 0.68rem/1.7 var(--mono);
  letter-spacing: 0.04em;
  color: var(--grey-2);
}
.colophon p { margin: 0; max-width: 34rem; }
.colophon p:last-child { text-align: right; }

/* ---------- Reveal on scroll ---------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 1.1s var(--ease), transform 1.1s var(--ease);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .scroll-cue span::after, .plate::before, .skyline .ripple { animation: none; }
  .fx-draw, .fx-pop, .fx-fade, .js h1 .ch { animation: none; opacity: 1; transform: none; stroke-dashoffset: 0; }
  .fx-out { animation: none; opacity: 0; }
}

/* ---------- Small screens ---------- */
@media (max-width: 860px) {
  .site-header { flex-direction: column; gap: 0.5rem; padding-top: 1.25rem; }
  nav a { margin: 0 1.1rem 0 0; }
  nav a:first-child { display: none; }
  .hero { grid-template-columns: 1fr; }
  .hero-text { min-height: 88svh; padding-top: 8rem; }
  .hero-figure { min-height: 0; padding: 1rem calc(var(--pad) + 0.9rem) 6rem; }
  .plate { position: relative; top: auto; right: auto; width: 100%; transform: none; }
  .block { grid-template-columns: 1fr; padding: 5rem var(--pad); }
  .block-label { position: static; }
  .facts { grid-template-columns: 1fr; }
  .facts dd.where { grid-column: auto; }
  .themes li { grid-template-columns: 1fr; }
  .interlude-body h2 { font-size: 6.8vw; }
  .coords { display: none; }
  .contact { grid-template-columns: 1fr; }
  .contact > div:first-child { height: auto; }
  .colophon { flex-direction: column; }
  .colophon p:last-child { text-align: left; }
}
