/* ---------- Fonts ---------- */
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/fonts/plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/fonts/plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("assets/fonts/inter.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Literata";
  src: url("assets/fonts/literata-italic.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Literata";
  src: url("assets/fonts/literata.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Young Serif";
  src: url("assets/fonts/young-serif.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */
:root {
  /* neutrals */
  --bg: #f3f4f6;
  --ink: #14161a;
  --soft: #3a3e45;
  --muted: #6b7079;
  --line: #e2e4e8;
  --card: #ffffff;
  --plate: #ffffff;
  --shadow: 0 1px 2px rgba(20, 22, 26, 0.05), 0 10px 28px rgba(20, 22, 26, 0.05);

  /* pops, taken from the Freehand mark */
  --blue: #2a62e0;
  --violet: #6d48e5;
  --coral: #e5482f;
  --amber: #e8a013;
  --teal: #0d98ba;

  /* type */
  --display: "Young Serif", Georgia, serif;
  --body: "Literata", Georgia, serif;
  --ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --display-weight: 400;
  --display-tracking: -0.01em;
  --display-scale: 1;
  --body-size: 1.0625rem;
  --body-leading: 1.7;

  --hue: var(--blue);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101113;
    --ink: #e9eaec;
    --soft: #c3c6cb;
    --muted: #8d929a;
    --line: #2a2c31;
    --card: #191a1d;
    --plate: #fafafa;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

.hue-amber { --hue: var(--amber); }
.hue-blue { --hue: var(--blue); }
.hue-violet { --hue: var(--violet); }
.hue-coral { --hue: var(--coral); }

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--body-size);
  line-height: var(--body-leading);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.22em;
  text-decoration-color: color-mix(in srgb, var(--blue) 55%, transparent);
  transition: color 0.15s, text-decoration-color 0.15s;
}
a:hover {
  color: var(--blue);
  text-decoration-color: var(--blue);
}
a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 3px;
}

code { font-family: var(--mono); font-size: 0.86em; }

/* ---------- Layout ---------- */
.shell {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  column-gap: 4rem;
  max-width: 68rem;
  margin: 0 auto;
  padding: 4.5rem 2rem 3rem;
}

/* ---------- Sidebar ---------- */
.side {
  position: sticky;
  top: 4.5rem;
  align-self: start;
  font-family: var(--ui);
}
.portrait {
  /* position of the photo inside the round frame: 0 to 1 on each axis, plus zoom */
  --px: 0.5;
  --py: 0.5;
  --pz: 1;
  --photo-ratio: 1; /* photo height / width */
  --photo-bg: #1f1f21; /* shown only while the photo loads */
  position: relative;
  width: 10.5rem;
  height: 10.5rem;
  border: 5px solid var(--card);
  border-radius: 50%;
  overflow: hidden;
  background: var(--photo-bg);
  box-shadow: 0 0 0 1px var(--line), 0 12px 30px rgba(20, 22, 26, 0.14);
}
.portrait img {
  position: absolute;
  left: calc((1 - var(--pz)) * var(--px) * 100%);
  top: calc((1 - var(--pz) * var(--photo-ratio)) * var(--py) * 100%);
  width: calc(var(--pz) * 100%);
  max-width: none;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}
h1 {
  margin: 1.6rem 0 0.5rem;
  font-family: var(--display);
  font-size: calc(1.9rem * var(--display-scale));
  font-weight: var(--display-weight);
  line-height: 1.12;
  letter-spacing: var(--display-tracking);
}
.role {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.45;
}
.affil {
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--muted);
}

.contact {
  margin: 1.5rem 0 0;
  padding: 1.25rem 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
  font-size: 0.9375rem;
}
.contact li + li { margin-top: 0.5rem; }
.contact a {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 500;
  text-decoration: none;
}
.contact svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
  flex: none;
}

/* list of sections, set in the heading serif */
.toc {
  margin: 1.5rem 0 0;
  padding: 1.25rem 0 0;
  border-top: 1px solid var(--line);
  font-family: var(--display);
  font-size: 1.12rem;
  letter-spacing: var(--display-tracking);
}
.toc a {
  display: block;
  padding: 0.14rem 0;
  color: var(--muted);
  text-decoration: none;
}
.toc a:hover,
.toc a[aria-current] { color: var(--ink); }

/* ---------- Main ---------- */
main { min-width: 0; padding-top: 0.25rem; }
section { scroll-margin-top: 2rem; }
section + section { margin-top: 3.25rem; }

.bio { font-size: 1.06em; }
/* running text sets flush on both edges */
.bio,
.entry > .tldr {
  text-align: justify;
  hyphens: auto;
}
.bio + .bio { margin-top: 1rem; }
.bio strong { font-weight: 700; }
.org { white-space: nowrap; }
.strong-link {
  font-weight: 700;
  text-decoration: none;
}
.logo {
  width: auto;
  height: 1.2em;
  margin-right: 0.32em;
  vertical-align: -0.24em;
}
img[src$="microsoft-mark.svg"].logo {
  height: 0.95em;
  vertical-align: -0.1em;
}

/* invitation to write: a line of its own between two hairlines */
.cta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  margin-top: 1.6rem;
  padding: 0.8rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: var(--display);
  font-size: 1.08rem;
  letter-spacing: var(--display-tracking);
}
.cta a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--ui);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
}
.cta svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: currentColor;
  flex: none;
}

h2 {
  margin: 0 0 1.4rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--display);
  font-size: calc(1.55rem * var(--display-scale));
  font-weight: var(--display-weight);
  line-height: 1.2;
  letter-spacing: var(--display-tracking);
}
/* ---------- News ---------- */
.news {
  margin: 0;
  padding: 0;
  list-style: none;
}
.news li {
  display: grid;
  grid-template-columns: 5.25rem minmax(0, 1fr);
  column-gap: 1rem;
  align-items: baseline;
}
.news li + li { margin-top: 0.6rem; }
.news span { text-wrap: pretty; }
.news time {
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
}

/* ---------- Entries ---------- */
.entry + .entry { margin-top: 1.5rem; }
.entry {
  padding: 1.5rem 1.6rem 1.4rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

/* paper figures: white artwork sits straight on the white card, with no frame */
.figs {
  display: grid;
  gap: 1.5rem;
  margin: 1.4rem 0 0.4rem;
}
.figs a {
  display: block;
  border-radius: 8px;
  background: var(--plate);
  cursor: zoom-in;
}
.figs img,
.oss-logo img {
  display: block;
  width: 100%;
  height: auto;
}
@media (prefers-color-scheme: dark) {
  .figs a { padding: 0.9rem; }
}

/* project photos: black-background shots share one black plate */
.strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 1.4rem 0 0;
  padding: 0.25rem 0.25rem 1.2rem;
  background: #000;
  border-radius: 10px;
}
.strip figure { margin: 0; }
.strip img {
  display: block;
  width: 100%;
  height: auto;
}
.strip figcaption {
  padding: 0 0.5rem;
  font-family: var(--ui);
  font-size: 0.78rem;
  line-height: 1.45;
  text-align: center;
  text-wrap: balance;
  color: rgba(255, 255, 255, 0.64);
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 1.35rem 0 0.2rem;
  padding: 0;
  list-style: none;
  font-family: var(--ui);
}
.steps li {
  padding: 0 0.95rem;
  border-left: 1px solid var(--line);
}
.steps li:first-child {
  padding-left: 0;
  border-left: 0;
}
.steps li:last-child { padding-right: 0; }
.steps .n {
  display: block;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}
.steps strong {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.9375rem;
  font-weight: 600;
}
.steps .d {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--muted);
}

.entry-oss {
  display: grid;
  grid-template-columns: 11.25rem minmax(0, 1fr);
  column-gap: 1.5rem;
  align-items: center;
  padding-top: 1.5rem;
}
.oss-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--display);
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: var(--display-tracking);
  text-decoration: none;
}
.oss-logo:hover { color: inherit; }
.oss-logo picture { display: contents; }
.oss-logo img.mark {
  flex: none;
  width: 2.75rem;
}
.entry-oss .tldr { margin-top: 0; }
.by {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.55rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--muted);
}
.by img {
  width: auto;
  height: 1rem;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

h3 {
  margin: -0.15rem 0 0.45rem;
  font-family: var(--display);
  font-size: calc(1.3rem * var(--display-scale));
  font-weight: var(--display-weight);
  line-height: 1.28;
  letter-spacing: var(--display-tracking);
  text-wrap: pretty;
}
h3 a { text-decoration: none; }
.mark-inline {
  width: auto;
  height: 1.3em;
  margin-right: 0.35em;
  vertical-align: -0.26em;
}
h3 a:hover { color: var(--hue); }
.authors { color: var(--soft); }
.me {
  color: var(--ink);
  font-weight: 700;
}
.venue {
  margin-top: 0.15rem;
  color: var(--soft);
}
.tldr { margin-top: 0.75rem; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.1rem;
  font-family: var(--ui);
  font-size: 0.8125rem;
  font-weight: 600;
}
.actions a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.85rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.actions a:hover {
  border-color: var(--hue);
  color: var(--hue);
}
.actions svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: currentColor;
  flex: none;
}
.actions svg use[href="#i-arxiv"] { fill: #b31b1b; }

/* ---------- Footer ---------- */
.foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.25rem 2rem;
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-family: var(--ui);
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ---------- Narrow screens ---------- */
@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    padding: 2.25rem 1.25rem 2.5rem;
  }
  .side { position: static; }
  .who {
    display: flex;
    align-items: center;
    gap: 1.25rem;
  }
  .portrait { width: 6.5rem; height: 6.5rem; border-width: 4px; flex: none; }
  h1 { margin-top: 0; font-size: calc(1.6rem * var(--display-scale)); }
  .contact { margin-top: 1.25rem; padding-top: 1rem; }
  .toc { display: none; }
  main { padding-top: 2rem; }
  section + section { margin-top: 2.75rem; }
}

@media (max-width: 640px) {
  .bio,
  .entry > .tldr { text-align: start; hyphens: manual; }
  .entry { padding: 1.1rem 1rem; }
  .figs { gap: 1.1rem; }
  .entry-oss { grid-template-columns: minmax(0, 1fr); row-gap: 1.1rem; }
  .oss-logo { max-width: 11rem; }
  .strip figcaption { padding: 0 0.35rem; font-size: 0.6875rem; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 1rem; }
  .steps li:nth-child(odd) { padding-left: 0; border-left: 0; }
  .steps li:nth-child(even) { padding-right: 0; }
  h3 { margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

@media print {
  .toc { display: none; }
  .side { position: static; }
}
