/* ---------- tokens ----------
   White ground, black type, one typeface. The only colour on the page comes from the figures. */
:root {
  --ground: #FFFFFF;
  --ink: #000000;
  --muted: #6B6B6B;
  --rule: #000000;
  --hairline: #D9D9D9;
  --mat: #F2F2F0;           /* the plate each figure sits on */
  --gesture: #D24E1F;       /* the hand-drawn circle */
  --star-text: #7A5410;     /* starlight, from the star-map version: the closing quote */
  --sans: 'Libre Franklin', 'Franklin Gothic Medium', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --pad: clamp(20px, 3.4vw, 48px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
}
h1, h2 { margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
img { max-width: 100%; }
::selection { background: var(--ink); color: var(--ground); }

/* ---------- masthead ---------- */
.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 32px;
  padding: 26px var(--pad) 22px;
  border-bottom: 1px solid var(--rule);
}
.masthead h1 {
  font-size: clamp(34px, 4.2vw, 52px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.035em;
}
.masthead h1 a:hover { text-decoration: none; }
.masthead nav { display: flex; flex-wrap: wrap; gap: 6px 28px; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
/* a swallow in ink, in the gap between the name and the tabs, with open sky ahead of it.
   It flies about the page from here (main.js): onto the figures, the name, the tabs and the heading
   it is pointed to, and after the pointer itself. Its negative margins keep it from making the masthead any taller. */
.bird {
  position: relative;
  display: block;
  align-self: center;
  width: clamp(54px, 4.6vw, 68px);
  aspect-ratio: 520 / 358;
  margin: -12px auto -12px clamp(24px, 6vw, 112px);
  translate: 0 -2px;
  z-index: 1;
}
.bird img { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; user-select: none; }
.bird-rig { position: absolute; inset: 0; visibility: hidden; transform-origin: 59% 37%; pointer-events: none; }   /* the middle of its body */
.bird.flying .bird-still { visibility: hidden; }
.bird.flying .bird-rig { visibility: visible; }
.bird .wing-l { transform-origin: 47.9% 27.2%; }   /* the shoulders */
.bird .wing-r { transform-origin: 65.4% 28.2%; }
/* the words it perches on stand in front of it: its tail hangs behind the letters */
.masthead h1, .masthead nav, .section-head h2 { position: relative; z-index: 2; }
@media (max-width: 819px) {
  .bird { display: none; }   /* the masthead wraps here: no gap left to fly in */
}

/* ---------- layout ----------
   Narrow (the default): one column, statement, then publications, then about.
   Wide: two columns, with .me (statement + about) held in view on the left. */
.layout { display: flex; flex-direction: column; padding: 0 var(--pad); }
.me { display: contents; }
.statement { order: 1; padding: 36px 0 48px; max-width: 720px; }
.pubs { order: 2; padding: 28px 0 56px; border-top: 1px solid var(--rule); }
.about { order: 3; padding: 28px 0 56px; border-top: 1px solid var(--rule); max-width: 720px; }

@media (min-width: 1080px) {
  .layout {
    display: grid;
    grid-template-columns: minmax(420px, 38%) minmax(0, 1fr);
    column-gap: clamp(48px, 5.5vw, 88px);
    align-items: start;
  }
  .me {
    display: block;
    position: sticky;
    top: 0;                 /* main.js lowers this when the statement is taller than the window */
    padding: 40px 0 48px;
  }
  .statement { padding: 0 0 40px; max-width: none; }
  .statement p { font-size: clamp(18px, 1.46vw, 21px); line-height: 1.5; }
  .about { padding: 28px 0 0; border-top: 1px solid var(--hairline); max-width: none; }
  .pubs { padding: 40px 0 72px; border-top: 0; }
}

/* ---------- the statement ---------- */
.statement { display: flex; flex-direction: column; gap: 20px; }
.statement p { font-size: 21px; line-height: 31px; letter-spacing: -0.008em; text-wrap: pretty; }
.statement .closing { font-style: italic; }
.closing em { font-style: inherit; color: var(--star-text); }
.statement a.paper { font-weight: 700; }

/* each language in the opening sentence is written in its own form */
.lang-speech { font-style: italic; }
.lang-charts { font-weight: 800; }
.lang-code { font-family: var(--mono); font-size: .84em; background: var(--mat); padding: .1em .32em; border-radius: 2px; }
.lang-gesture { position: relative; white-space: nowrap; }
.loop {
  position: absolute;
  left: -.2em;
  top: -.04em;
  width: calc(100% + .44em);
  height: calc(100% + .16em);
  overflow: visible;
  pointer-events: none;
}
.loop path { fill: none; stroke: var(--gesture); stroke-width: 2; stroke-linecap: round; vector-effect: non-scaling-stroke; }

/* ---------- about ---------- */
.about { display: flex; flex-direction: column; gap: 22px; }
.about-row { display: flex; align-items: flex-start; gap: 22px; }
.about-row p { text-wrap: pretty; }
.about a.paper { font-weight: 700; }
.who { display: flex; flex-direction: column; align-items: flex-start; color: var(--muted); }
.who strong { color: var(--ink); font-weight: 700; }
.who a { color: var(--ink); }
@media (max-width: 479px) {
  .about-row { flex-direction: column; }
}

/* ---------- publications: each figure on its own plate, the title set under it ---------- */
.section-head { margin-bottom: 26px; }
.section-head h2 { font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: -0.03em; }
.pub-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: 44px clamp(24px, 3vw, 44px);
  align-items: start;
}
.pub { display: flex; flex-direction: column; gap: 14px; scroll-margin-top: 24px; }
/* ---------- figures: a detail of each figure fills its frame; pointing at the paper zooms out to the whole figure ---------- */
.pub-fig {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--mat);
  overflow: hidden;
  isolation: isolate;
  container-type: inline-size;
}
.pub-fig img {
  position: absolute;
  /* without the script, or before it runs: the whole figure on the mat */
  left: var(--dl, 7%);
  top: var(--dt, 9.333%);
  width: var(--dw, 86%);
  height: var(--dh, 81.333%);
  max-width: none;
  object-fit: contain;
  mix-blend-mode: multiply;   /* white figure grounds take on the colour of the mat */
}
.pub-fig.ready img { transition: left .6s ease, top .6s ease, width .6s ease, height .6s ease; }
.pub:hover .pub-fig img,
.pub:has(a:focus-visible) .pub-fig img {
  left: var(--wl, 7%);
  top: var(--wt, 9.333%);
  width: var(--ww, 86%);
  height: var(--wh, 81.333%);
}
/* a paper without a good figure gets a line of type instead */
.pub-fig.words { display: flex; align-items: center; padding: 0 9%; }
.pub-fig.words p { font-size: 10.5cqi; line-height: 1.1; font-weight: 600; font-style: italic; letter-spacing: -0.025em; text-wrap: balance; }
.pub-body { display: flex; flex-direction: column; min-width: 0; }
.pub-title { font-size: 20px; line-height: 24px; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 8px; text-wrap: balance; }
.pub-authors { color: var(--muted); font-size: 15px; line-height: 22px; }
.pub-authors b { color: var(--ink); font-weight: 700; }
.pub-venue { color: var(--muted); font-size: 15px; line-height: 22px; }
.pub-links { display: flex; flex-wrap: wrap; gap: 0 16px; margin-top: 6px; font-size: 15px; font-weight: 700; }
.pub-links span { font-weight: 400; color: var(--muted); }

/* ---------- avatar: zoomed-in still frame; hover zooms out and plays (from the old site) ---------- */
.my-pic {
  position: relative;
  flex: 0 0 auto;
  width: var(--crop-width, 170px);
  height: var(--crop-height, 170px);
  overflow: hidden;
}
.my-pic video, .my-pic img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: translate(var(--offset-x, 0px), var(--offset-y, 0px)) scale(var(--zoom-scale, 1.4));
  transform-origin: center center;
  transition: transform .6s ease;
  will-change: transform;
  pointer-events: none;
}
/* zoomed all the way out. --full-scale stays a little above 1 when the video has black bars
   burnt into its sides (swimming.mp4 does), so the bars stay outside the frame */
.my-pic:hover video, .my-pic:hover img,
.my-pic.playing video { transform: translate(0, 0) scale(var(--full-scale, 1)); }

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