/* One page, no JavaScript, no web fonts.
   Colours follow the visitor's light/dark setting; the dark ground matches the avatar.
   The sage green is used only inside the little drawings. */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --ink: #16161a;
  --mute: #5c5f66;
  --line: #e7e7ea;
  --link: #1d4ed8;
  --thumb: #f3f3f5;
  --sun: #b7cba9;
  --serif: "Iowan Old Style", Charter, "Bitstream Charter", "Source Serif Pro", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1e;
    --ink: #ececee;
    --mute: #a3a3aa;
    --line: #333337;
    --link: #8db4ff;
    --thumb: #28282c;
    --sun: #8fa684;
  }
}

* { box-sizing: border-box; min-width: 0; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  overflow-x: clip;
}

img { max-width: 100%; height: auto; }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 2px; }

/* Links open in a new tab; a small arrow after the text says so */
a[target="_blank"]::after {
  content: "";
  display: inline-block;
  width: 0.72em;
  height: 0.72em;
  margin-left: 0.18em;
  vertical-align: -0.04em;
  background: currentColor;
  -webkit-mask: var(--arrow) center / contain no-repeat;
  mask: var(--arrow) center / contain no-repeat;
}
:root { --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12L12 4M6 4h6v6'/%3E%3C/svg%3E"); }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(32px, 6vw, 80px) max(5vw, 20px);
}

/* Sidebar: who and where */
.avatar {
  display: block;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  transition: transform 0.5s cubic-bezier(0.3, 1.6, 0.5, 1);
}
/* A small nod to the tilt sensor */
.avatar:hover { transform: rotate(-14deg); }

h1 {
  font: 600 clamp(34px, 4vw, 42px)/1.05 var(--serif);
  letter-spacing: -0.02em;
  margin: 24px 0 12px;
}

.role { margin: 0 0 20px; }

.links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }

.side { margin-bottom: 48px; }

/* Main column */
section + section { margin-top: 56px; }

h2 {
  font: 600 22px/1.2 var(--serif);
  letter-spacing: -0.01em;
  margin: 0 0 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.intro p, #misc p { margin: 0 0 1em; max-width: 66ch; }
.intro p:first-child { font-size: 19px; }
#misc p:last-child { margin-bottom: 0; }

h3 { font-size: 17px; font-weight: 600; line-height: 1.4; margin: 0 0 2px; }
h3 a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }
h3 a:hover { color: var(--link); text-decoration-color: currentColor; }

.where { color: var(--mute); font-size: 15px; }
.where b { color: var(--ink); font-weight: 600; }

.more { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 15px; }

/* Writing, projects and publications: a drawing beside each entry */
.work { list-style: none; margin: 0; padding: 0; }
.work > li { display: grid; grid-template-columns: 150px minmax(0, 1fr); column-gap: 24px; align-items: start; scroll-margin-top: 24px; }
.work > li + li { margin-top: 32px; }
.work p { margin: 0; max-width: 66ch; }
.work p + p { margin-top: 6px; }

.thumb { background: var(--thumb); border-radius: 12px; aspect-ratio: 160 / 110; color: var(--ink); margin-top: 3px; }
.thumb svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.thumb .s { fill: var(--sun); stroke: none; }
.thumb .k { fill: currentColor; stroke: none; }
.thumb .b { fill: var(--bg); }
.thumb .t { fill: var(--thumb); stroke: none; }
.thumb .f { opacity: 0.35; }
.thumb .d { stroke-dasharray: 4 6; }
.thumb text { fill: #16161a; stroke: none; font: 700 14px var(--sans); }


footer {
  margin-top: 72px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--mute);
  font-size: 14px;
}

/* Two columns once there is room: sidebar stays in view while the main column scrolls */
@media (min-width: 760px) {
  .wrap {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    column-gap: clamp(40px, 6vw, 88px);
  }
  .side { position: sticky; top: clamp(32px, 6vw, 80px); align-self: start; margin-bottom: 0; }
  .links { flex-direction: column; gap: 4px; }
  footer { grid-column: 2; }
}

@media (max-width: 520px) {
  .work > li { grid-template-columns: 92px minmax(0, 1fr); column-gap: 14px; }
  .intro p:first-child { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .avatar { transition: none; }
}

/* 404 */
.wrap.notfound { display: block; max-width: 640px; }
