/* ==========================================================================
   Jingwei Kang — personal academic homepage
   Direction: "Classic academic, refined"

   Layout concept: one centred reading column (max 60rem) in which every
   section below the hero shares the same two-column scaffold — a 15rem
   margin column for the section heading and its sub-headings (years, research
   themes) and a 41.5rem prose column — collapsing to a single column under 52em.

   Type: Newsreader (display and prose, optical sizing on), Source Sans 3
   (navigation, metadata, labels, buttons), the system monospace for BibTeX.
   One size per job; the scale is listed in the tokens below.

   Colour: the page sits on "the field", a fixed, grainy colour field in the
   manner of midem.com: a lilac ground with soft orange, periwinkle and khaki
   blobs, an overlay layer of acid-yellow and periwinkle highlights, fine film
   grain and a slow drift (section "The field" below). The type is set
   directly on it: a plum-black ink, a dark muted grey and a deep indigo for
   links, each chosen for 4.5:1 or better against the field behind the reading
   column, which a soft light wash keeps calmer than the edges. The dark theme
   is a night palette of the same place, not an inversion: a warm charcoal
   ground, the orange as a sunset glow, the periwinkle as a dusk blue, the
   yellow as lamp-light, cream type and amber links (the dark token blocks say
   why). Every colour on the page comes from the tokens below.
   ========================================================================== */

:root {
  --bg: #D290F7;                         /* the field's lilac ground: painted under the field, and the flat colour for the browser chrome */
  --surface: rgb(255 255 255 / 42%);     /* recessed surface: BibTeX blocks, email field, buttons, the portrait plate */
  --line: rgb(36 30 36 / 26%);           /* hairlines and borders: translucent ink */
  --fg: #241E24;                         /* plum-black ink, at least 7:1 on the field behind the column */
  --muted: #342E33;                      /* secondary text: 4.5:1 even on the field's pure orange (L 0.35) */
  --accent: #2C1F72;                     /* deep indigo: links, markers, focus; 4.5:1 on the field's pure orange */

  /* The field (section "The field" below): midem's palette, as measured on the reference page. */
  --field-base: #D290F7;                 /* lilac ground */
  --field-orange: #EE8432;               /* left edge, bottom left, top centre */
  --field-peri: #A69DF2;                 /* periwinkle: centre left, right of centre */
  --field-khaki: #C3CA8B;                /* bottom right, under the yellow highlight */
  --field-yellow: rgb(228 247 38 / 58%);     /* acid yellow, overlay layer: the pale zone and the yellow corner */
  --field-peri-hi: rgb(164 154 241 / 46%);   /* periwinkle, overlay layer: the pink-lilac top right */
  --field-peri-deep: #9B91EE;            /* the periwinkle disc above the overlay, a shade deeper since it takes no highlight */
  --field-blur: clamp(56px, 13vmin, 120px);  /* softness of every blob edge (sigma); 120px at 1440 x 900 */
  --field-wash: rgb(255 255 255 / 12%);  /* the light wash behind the reading column */
  --field-wash-span: 30.5rem;            /* half-width of the full-strength wash (half the 60rem page, plus a little) */
  --field-wash-feather: 8rem;            /* the wash fades out over this width on each side */
  --field-grain: var(--grain-light);
  --field-grain-opacity: 1;              /* multiplier on the grain tile's own strength */
  --field-flow: 22s;                     /* base period of one tour of the field (each blob uses a multiple of it), paced like midem's loop; 0s stops it */
  /* The grain tiles: 256px of SVG fractal noise (seamless), mapped to white (light theme) or
     warm umber (dark theme) specks. The last row of the colour matrix is the alpha ramp
     (alpha = a * noise + b): light 1.52 / -0.8 gives a 6/255 amplitude, as measured on the
     reference; dark 0.72 / -0.38 is fainter, and its speck colour sits at L 0.09, so the
     grain lightens the charcoal but can never lift a glow behind the column above the
     dark theme's contrast budget. */
  --grain-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='g' x='0' y='0' width='100%' height='100%' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.3' numOctaves='2' stitchTiles='stitch' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1.52 0 0 0 -0.8'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23g)'/%3E%3C/svg%3E");
  --grain-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='g' x='0' y='0' width='100%' height='100%' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.3' numOctaves='2' stitchTiles='stitch' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .31 0 0 0 0 .19 0.72 0 0 0 -0.38'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23g)'/%3E%3C/svg%3E");

  --font-display: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-body: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-ui: "Source Sans 3", "Source Sans Pro", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;

  /* Type scale — one size per job */
  --text-xs: 0.75rem;      /* 12px  running labels: "Papers", years on narrow screens */
  --text-ui: 0.9375rem;    /* 15px  navigation, author and venue lines, links, buttons */
  --text-sm: 1rem;         /* 16px  paper summaries */
  --text-body: 1.125rem;   /* 18px  running text */
  --text-md: 1.25rem;      /* 20px  paper titles, theme names, years, degrees, the bio */
  --text-lg: 1.75rem;      /* 28px  section headings */
  --text-xl: 2.75rem;      /* 44px  the name */
  --text-mono: 0.8125rem;  /* 13px  BibTeX */

  /* Layout */
  --page: 60rem;           /* content width of the page (gutters come on top): 15 + 3.5 + 41.5rem */
  --margin-col: 15rem;     /* heading column beside every section; also the portrait width */
  --gutter: 3.5rem;        /* between the margin column and the prose */
  --measure: 41.5rem;      /* prose column: about 85 characters of Newsreader at 18px */

  /* Baseline nudges so margin-column headings sit on the first prose baseline
     (measured with the web fonts loaded; see README) */
  --h2-shift: -6px;
  --side-shift: -1px;
  --year-shift: 0px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1A1411;  /* warm charcoal: a brown-black on the orange's own hue, so every glow fades into the ground on-hue instead of into grey */
    --surface: rgb(241 233 220 / 8%);  /* cream at 8%: a plate one step lighter than the field (BibTeX, email, buttons, the portrait frame), warm like paper under a lamp */
    --line: rgb(241 233 220 / 24%);  /* hairlines and borders: translucent cream */
    --fg: #F1E9DC;  /* cream ink (L 0.82): 15:1 on the bare ground, 4.5:1 up to L 0.144 behind the column */
    --muted: #E3DBCC;  /* secondary text, light parchment (L 0.71): 4.5:1 up to L 0.12 */
    --accent: #FAD69A;  /* amber, the lamp's colour (L 0.66): links, icons, focus; 4.5:1 up to L 0.107, and on --surface */
    --field-base: #1A1411;
    --field-orange: rgb(255 102 22 / 52%);  /* sunset orange: redder and purer than the day's #EE8432, so that dimmed by the wash it reads as ember rather than tan; 52% puts the core at L 0.09 (174 85 32) */
    --field-peri: rgb(84 112 255 / 60%);  /* dusk blue: the periwinkle cooled by 20 degrees and saturated, a blue light instead of a grey-violet haze; its core is only L 0.06 */
    --field-peri-deep: rgb(104 104 255 / 62%);  /* the disc above the overlay keeps a little of the periwinkle's violet */
    --field-khaki: rgb(222 170 60 / 32%);  /* the khaki corner becomes dim gold: the base of the lamp-light */
    --field-yellow: rgb(255 206 72 / 28%);  /* lamp yellow, screen-blended (the night-only rules below): a faint lamp in the corner where the day has acid yellow */
    --field-peri-hi: rgb(150 160 255 / 14%);  /* a cool haze along the top, screen-blended; the day's pink-lilac becomes dusk violet */
    --field-blur: clamp(72px, 17vmin, 160px);  /* softer edges than by day: night glows are light, not paint, so cores shrink and halos widen */
    --field-wash: rgb(26 20 17 / 42%);  /* the ground itself at 42% behind the column: the glows stay visible through it, and 46% keeps any pile-up of blobs under L 0.106 */
    --field-wash-feather: 22rem;  /* twice the day's feather, so the wash is a vignette and not a band with edges */
    --field-grain: var(--grain-dark);
    --field-grain-opacity: 1;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #1A1411;
  --surface: rgb(241 233 220 / 8%);
  --line: rgb(241 233 220 / 24%);
  --fg: #F1E9DC;
  --muted: #E3DBCC;
  --accent: #FAD69A;
  --field-base: #1A1411;
  --field-orange: rgb(255 102 22 / 52%);
  --field-peri: rgb(84 112 255 / 60%);
  --field-peri-deep: rgb(104 104 255 / 62%);
  --field-khaki: rgb(222 170 60 / 32%);
  --field-yellow: rgb(255 206 72 / 28%);
  --field-peri-hi: rgb(150 160 255 / 14%);
  --field-blur: clamp(72px, 17vmin, 160px);
  --field-wash: rgb(26 20 17 / 42%);
  --field-wash-feather: 22rem;
  --field-grain: var(--grain-dark);
  --field-grain-opacity: 1;
  color-scheme: dark;
}

/* Night-only rules. By day the overlay layer blends with `overlay`, which on a dark
   ground can only darken (the old dark theme's yellow corner was invisible for this
   reason); by night it blends with `screen`, so the two highlight blobs add light. The
   body's document-anchored copy of the field blends its yellow layer the same way. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .field__overlay {
    mix-blend-mode: screen;
  }

  :root:not([data-theme="light"]) body {
    background-blend-mode: normal, normal, screen, normal, normal, normal, normal;
  }
}

:root[data-theme="dark"] .field__overlay {
  mix-blend-mode: screen;
}

:root[data-theme="dark"] body {
  background-blend-mode: normal, normal, screen, normal, normal, normal, normal;
}

/* Night-only: the wash ramps in with eased stops instead of a straight line, so
   a bright core beside the column does not draw a soft vertical edge. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .field__wash {
    background-image: linear-gradient(
      to right,
      transparent calc(50% - var(--field-wash-span) - var(--field-wash-feather)),
      color-mix(in srgb, var(--field-wash) 22%, transparent) calc(50% - var(--field-wash-span) - var(--field-wash-feather) * 0.62),
      color-mix(in srgb, var(--field-wash) 64%, transparent) calc(50% - var(--field-wash-span) - var(--field-wash-feather) * 0.26),
      var(--field-wash) calc(50% - var(--field-wash-span)),
      var(--field-wash) calc(50% + var(--field-wash-span)),
      color-mix(in srgb, var(--field-wash) 64%, transparent) calc(50% + var(--field-wash-span) + var(--field-wash-feather) * 0.26),
      color-mix(in srgb, var(--field-wash) 22%, transparent) calc(50% + var(--field-wash-span) + var(--field-wash-feather) * 0.62),
      transparent calc(50% + var(--field-wash-span) + var(--field-wash-feather))
    );
  }
}

:root[data-theme="dark"] .field__wash {
  background-image: linear-gradient(
    to right,
    transparent calc(50% - var(--field-wash-span) - var(--field-wash-feather)),
    color-mix(in srgb, var(--field-wash) 22%, transparent) calc(50% - var(--field-wash-span) - var(--field-wash-feather) * 0.62),
    color-mix(in srgb, var(--field-wash) 64%, transparent) calc(50% - var(--field-wash-span) - var(--field-wash-feather) * 0.26),
    var(--field-wash) calc(50% - var(--field-wash-span)),
    var(--field-wash) calc(50% + var(--field-wash-span)),
    color-mix(in srgb, var(--field-wash) 64%, transparent) calc(50% + var(--field-wash-span) + var(--field-wash-feather) * 0.26),
    color-mix(in srgb, var(--field-wash) 22%, transparent) calc(50% + var(--field-wash-span) + var(--field-wash-feather) * 0.62),
    transparent calc(50% + var(--field-wash-span) + var(--field-wash-feather))
  );
}

/* Night-only, phones: the wash covers the whole width and the blobs are small,
   so the two main glows get more alpha there (the phone has contrast headroom). */
@media (max-width: 52em) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --field-orange: rgb(255 102 22 / 64%);
    --field-peri: rgb(84 112 255 / 70%);
  }
}

@media (max-width: 52em) {
  :root[data-theme="dark"] {
    --field-orange: rgb(255 102 22 / 64%);
    --field-peri: rgb(84 112 255 / 70%);
  }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

html {
  /* Fluid scale: every width and size on the page is in rem, so one root size
     scales the whole layout with the screen while keeping the line length.
     16px up to a 1200px viewport, 17px at 1440, 19.5px at 1920, 20px cap
     (rem-based terms keep the reader's own font-size preference in play). */
  font-size: clamp(1rem, 0.5208vw + 0.59375rem, 1.25rem);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Anchor jumps leave a little air above the section's hairline. */
  scroll-padding-top: 1rem;
}

/* Smooth scrolling is switched on by main.js once the page and its web fonts
   have loaded (html.fonts-ready). The jump to a #fragment on first load must
   stay instant: a smooth scroll aims at a position measured in the fallback
   fonts and lands off target when Newsreader and Source Sans 3 swap in. */
@media (prefers-reduced-motion: no-preference) {
  html.fonts-ready {
    scroll-behavior: smooth;
  }
}

/* The ground under the field. The body carries a flat, document-anchored copy
   of the field (the orange left edge, the periwinkle tint and the yellow
   highlight on the right, the two bottom corners, the wash and the grain) built
   from the same tokens. In a browser the fixed field covers it completely; it
   shows only where a fixed layer cannot be drawn, such as a full-page
   screenshot, which draws the fixed layer once at the top, so that the rest
   of the page still reads as the field. The print stylesheet removes it. */
body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    var(--field-grain),
    linear-gradient(
      to right,
      transparent calc(50% - var(--field-wash-span) - var(--field-wash-feather)),
      var(--field-wash) calc(50% - var(--field-wash-span)),
      var(--field-wash) calc(50% + var(--field-wash-span)),
      transparent calc(50% + var(--field-wash-span) + var(--field-wash-feather))
    ),
    radial-gradient(ellipse 60vw 45vh at 100% 100%, var(--field-yellow), transparent 70%),
    radial-gradient(ellipse 45vw 35vh at 100% 100%, var(--field-khaki), transparent 70%),
    radial-gradient(ellipse 55vw 32vh at 0% 100%, var(--field-orange), transparent 70%),
    linear-gradient(to right, transparent 55%, color-mix(in srgb, var(--field-peri) 55%, transparent) 100%),
    linear-gradient(to right, var(--field-orange) 0, color-mix(in srgb, var(--field-orange) 85%, transparent) 9%, transparent 30%);
  background-blend-mode: normal, normal, overlay, normal, normal, normal, normal;
  background-size: 256px 256px, auto, auto, auto, auto, auto, auto;
  background-repeat: repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.55;
  font-optical-sizing: auto;
  font-kerning: normal;
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

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

/* Phrases that must not break across lines: the two names in the bio and the
   compounds with a one-letter first part (F-shaped, L-shaped, F-pattern), where
   the letter would stand alone at a line end. Every other hyphenated compound
   breaks at its hyphen, as in print. */
.nb {
  white-space: nowrap;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
  text-decoration-color: var(--line);
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

a:hover {
  text-decoration-color: currentColor;
}

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

/* Shift+Tab scrolls a control in top-aligned at scroll-padding-top; the margin
   keeps its focus ring clear of the viewport edge. Anchor jumps target
   sections, not controls, so they are unaffected. */
a,
button {
  scroll-margin-top: 6px;
}

/* The skip link moves focus to <main> (tabindex="-1"), so the next Tab starts
   inside the content; no ring is drawn around the whole page. */
main:focus {
  outline: none;
}

::selection {
  background: var(--line);
  background: color-mix(in srgb, var(--accent) 22%, var(--bg));
}

button {
  font: inherit;
  color: inherit;
}

@media (prefers-reduced-motion: no-preference) {
  a,
  button {
    transition: color 120ms ease, border-color 120ms ease, background-color 120ms ease, text-decoration-color 120ms ease;
  }
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  padding: 0.5rem 0.75rem;
  border-radius: 3px;
  background: var(--fg);
  color: var(--bg);
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  font-weight: 500;
  text-decoration: none;
  transform: translateY(-300%);
}

.skip-link:focus {
  transform: none;
  outline-color: var(--bg);
  outline-offset: -4px;
}

/* One outer wrapper carries the side gutter; --page is the content width,
   so the scaffold (15rem + 3.5rem + 41.5rem) fits exactly. */
.page {
  box-sizing: content-box;
  max-width: var(--page);
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* The small, letter-spaced running label: one treatment, two uses (the
   "Papers" label and the year headings on narrow screens). */
.label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   The field: the page background

   A fixed, full-viewport layer behind everything (<div class="field"> at the
   top of <body>), built from the --field-* tokens above:

   - the ground (--field-base) and eight soft blobs. Each blob is one element
     with a radial gradient whose stops trace a Gaussian edge (full colour up
     to rx - 2 sigma, half at rx, gone at rx + 3 sigma; sigma = --field-blur),
     which looks the same as a hard shape under filter: blur() but is painted
     once instead of being blurred every frame. Its colour (--c), centre
     (--x/--y, in viewport units), half-size (--rx/--ry) and rotation (--rot)
     are set per blob below;
   - six blobs sit in the main layer; two (acid yellow, periwinkle) sit in
     .field__overlay, which blends with mix-blend-mode: overlay and so lights
     up the lilac into pink-lilac and the khaki corner into acid yellow;
   - three main blobs drift slowly (transform animations on their own
     composited layers; nothing under prefers-reduced-motion). They are
     painted above .field__overlay, not under it: a moving layer under a
     blended one would make the browser re-blend the whole field every frame,
     while this way the blended part is composited once and only the three
     small layers move;
   - .field__wash lifts the strip behind the reading column so that the text
     keeps its contrast while the edges stay saturated;
   - .field__grain tiles the SVG noise at --field-grain-opacity.

   To tone the field down, raise the wash or lower the blob colours' alpha
   (as the dark theme does); to change the palette, change the --field-*
   colours; to stop the drift, set --field-drift to 0s. See README.md.
   -------------------------------------------------------------------------- */

.field {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--field-base);
  pointer-events: none;
  isolation: isolate;
  transform: translateZ(0);
}

.field__blob {
  --s: var(--field-blur);
  position: absolute;
  top: var(--y);
  left: var(--x);
  width: calc(2 * (var(--rx) + 3 * var(--s)));
  height: calc(2 * (var(--ry) + 3 * var(--s)));
  translate: -50% -50%;
  rotate: var(--rot, 0deg);
  background-image: radial-gradient(
    ellipse calc(var(--rx) + 3 * var(--s)) calc(var(--ry) + 3 * var(--s)) at 50% 50%,
    var(--c) calc(var(--rx) - 2 * var(--s)),
    color-mix(in srgb, var(--c) 84%, transparent) calc(var(--rx) - var(--s)),
    color-mix(in srgb, var(--c) 50%, transparent) var(--rx),
    color-mix(in srgb, var(--c) 16%, transparent) calc(var(--rx) + var(--s)),
    color-mix(in srgb, var(--c) 2.5%, transparent) calc(var(--rx) + 2 * var(--s)),
    transparent calc(var(--rx) + 3 * var(--s))
  );
}

/* Main layer: placement measured from the reference at 1440 x 900 (x in vw,
   y in vh, so the composition follows the viewport; sizes in vmin so that the
   blobs stay round on phones). The orange keeps to the left edge and the
   bottom-left corner, the periwinkle to the left of the prose column. The
   blobs orange top, khaki and periwinkle right sit under the overlay layer
   and take its highlights; the others sit above it. All of them flow (see
   "The flow" below). */
.field__blob--orange-left {
  --c: var(--field-orange);
  --x: -3vw;
  --y: 45vh;
  --rx: 23vw;
  --ry: 70vh;
}

.field__blob--orange-top {
  --c: var(--field-orange);
  --x: 39vw;
  --y: -4vh;
  --rx: 22vmin;
  --ry: 22vmin;
}

.field__blob--orange-bottom {
  --c: var(--field-orange);
  --x: 17vw;
  --y: 103vh;
  --rx: 29vw;
  --ry: 20vh;
}

.field__blob--khaki {
  --c: var(--field-khaki);
  --x: 86vw;
  --y: 88vh;
  --rx: 19vw;
  --ry: 28vh;
}

.field__blob--peri-right {
  --c: var(--field-peri);
  --x: 83vw;
  --y: 70vh;
  --rx: max(28vmin, 24vw);
  --ry: max(28vmin, 24vw);
}

.field__blob--peri {
  --c: var(--field-peri-deep);
  --x: 26vw;
  --y: 48vh;
  --rx: 22vmin;
  --ry: 22vmin;
}

/* Overlay layer */
.field__overlay {
  position: absolute;
  inset: 0;
  mix-blend-mode: overlay;
}

/* Overlay layer: a long acid-yellow band leaning from the bottom right up
   towards the centre (pale where it crosses the lilac and the periwinkle,
   acid yellow over the khaki corner) and a periwinkle band across the top
   (the pink-lilac top right, the salmon top centre). */
.field__blob--yellow-hi {
  --c: var(--field-yellow);
  --x: 84vw;
  --y: 82vh;
  --rx: 26vw;
  --ry: 55vh;
  --rot: -22deg;
}

.field__blob--peri-hi {
  --c: var(--field-peri-hi);
  --x: 62vw;
  --y: 6vh;
  --rx: 50vw;
  --ry: 24vh;
  --rot: 8deg;
}

/* The flow. Every blob, the two highlight blobs included, tours the whole
   field: each follows its own closed route through the corners and the
   centre (the tour-… keyframes, translations from its resting place in
   viewport units), on its own period and phase, so the colours keep
   trading places: the orange is sometimes on the right or along the top,
   the periwinkle and the khaki wander to the left. Everything is a
   composited transform; the only per-frame cost is the overlay blend, which
   midem pays too. Under prefers-reduced-motion the movers stand still at the
   reference composition. */
.field__mover,
.field__mover-y {
  position: absolute;
  inset: 0;
}

.field__mover {
  will-change: transform;
  animation: var(--tour) calc(var(--field-flow) * var(--k, 1)) ease-in-out var(--phase, 0s) infinite;
}

.field__blob--breathe {
  animation: field-breathe calc(var(--field-flow) * var(--ks, 0.3)) ease-in-out var(--pb, 0s) infinite alternate;
}

@keyframes field-breathe {
  from { transform: scale(0.9); }
  to { transform: scale(1.12); }
}

/* Rests at the left edge, mid-height. */
@keyframes tour-orange-left {
  0% { transform: translate(0, 0); }
  20% { transform: translate(45vw, -30vh); }
  40% { transform: translate(95vw, 5vh); }
  60% { transform: translate(72vw, 45vh); }
  80% { transform: translate(25vw, 42vh); }
  100% { transform: translate(0, 0); }
}

/* Rests at the top, centre-left. */
@keyframes tour-orange-top {
  0% { transform: translate(0, 0); }
  22% { transform: translate(48vw, 58vh); }
  45% { transform: translate(-18vw, 92vh); }
  68% { transform: translate(-32vw, 30vh); }
  86% { transform: translate(12vw, -8vh); }
  100% { transform: translate(0, 0); }
}

/* Rests below the bottom edge, left of centre. */
@keyframes tour-orange-bottom {
  0% { transform: translate(0, 0); }
  18% { transform: translate(58vw, -58vh); }
  40% { transform: translate(74vw, -100vh); }
  62% { transform: translate(18vw, -82vh); }
  82% { transform: translate(-12vw, -32vh); }
  100% { transform: translate(0, 0); }
}

/* Rests in the bottom-right corner. */
@keyframes tour-khaki {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-52vw, -8vh); }
  50% { transform: translate(-72vw, -80vh); }
  72% { transform: translate(-22vw, -62vh); }
  100% { transform: translate(0, 0); }
}

/* Rests right of centre, low. */
@keyframes tour-peri-right {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-62vw, -22vh); }
  42% { transform: translate(-76vw, -62vh); }
  64% { transform: translate(-30vw, -66vh); }
  84% { transform: translate(8vw, -30vh); }
  100% { transform: translate(0, 0); }
}

/* Rests left of centre, mid-height. */
@keyframes tour-peri {
  0% { transform: translate(0, 0); }
  22% { transform: translate(56vw, -36vh); }
  46% { transform: translate(62vw, 36vh); }
  68% { transform: translate(10vw, 42vh); }
  86% { transform: translate(-22vw, 2vh); }
  100% { transform: translate(0, 0); }
}

/* Highlight band, rests over the bottom-right corner. */
@keyframes tour-yellow-hi {
  0% { transform: translate(0, 0); }
  28% { transform: translate(-62vw, -28vh); }
  54% { transform: translate(-72vw, -72vh); }
  78% { transform: translate(-20vw, -76vh); }
  100% { transform: translate(0, 0); }
}

/* Highlight band, rests along the top. */
@keyframes tour-peri-hi {
  0% { transform: translate(0, 0); }
  30% { transform: translate(2vw, 62vh); }
  55% { transform: translate(-42vw, 82vh); }
  78% { transform: translate(-46vw, 28vh); }
  100% { transform: translate(0, 0); }
}

/* Per-blob route, period factor (times --field-flow) and phase. */
.field__mover--orange-left { --tour: tour-orange-left; --k: 0.9; --phase: -4s; }
.field__mover--orange-top { --tour: tour-orange-top; --k: 1.03; --phase: -11s; }
.field__mover--orange-bottom { --tour: tour-orange-bottom; --k: 1.17; --phase: -18s; --ks: 0.32; --pb: -6s; }
.field__mover--khaki { --tour: tour-khaki; --k: 0.97; --phase: -7s; --ks: 0.27; --pb: -3s; }
.field__mover--peri-right { --tour: tour-peri-right; --k: 1.1; --phase: -15s; }
.field__mover--peri { --tour: tour-peri; --k: 0.83; --phase: -3s; --ks: 0.24; --pb: -10s; }
.field__mover--yellow-hi { --tour: tour-yellow-hi; --k: 1.23; --phase: -10s; }
.field__mover--peri-hi { --tour: tour-peri-hi; --k: 1; --phase: -6s; }

/* Phones: only the three blobs above the overlay keep touring, so the
   blended layer is composited once and the battery is spared. */
@media (max-width: 52em) {
  .field__mover--orange-top,
  .field__mover--khaki,
  .field__mover--peri-right,
  .field__mover--yellow-hi,
  .field__mover--peri-hi {
    animation: none;
  }
}

/* The wash: a vertical band of --field-wash behind the reading column, full
   strength across the column and fading out over --field-wash-feather. On
   phones the column is the whole width, so the whole field is washed. */
.field__wash {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
    to right,
    transparent calc(50% - var(--field-wash-span) - var(--field-wash-feather)),
    var(--field-wash) calc(50% - var(--field-wash-span)),
    var(--field-wash) calc(50% + var(--field-wash-span)),
    transparent calc(50% + var(--field-wash-span) + var(--field-wash-feather))
  );
}

.field__grain {
  position: absolute;
  inset: 0;
  background: var(--field-grain) 0 0 / 256px 256px repeat;
  opacity: var(--field-grain-opacity);
}

/* Less transparency: no highlights, no grain, a stronger wash. */
@media (prefers-reduced-transparency: reduce) {
  :root {
    --field-wash: rgb(255 255 255 / 55%);
    --field-grain-opacity: 0;
  }

  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --field-wash: rgb(26 20 17 / 62%);
      --field-grain-opacity: 0;
    }
  }

  :root[data-theme="dark"] {
    --field-wash: rgb(26 20 17 / 62%);
    --field-grain-opacity: 0;
  }

  .field__overlay {
    display: none;
  }
}

/* Forced colours (Windows High Contrast) draw their own backgrounds. */
@media (forced-colors: active) {
  .field {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Header and navigation
   -------------------------------------------------------------------------- */

/* The header scrolls with the page: a bar that stays on top would need a
   panel of its own on the field, and the field is meant to run uninterrupted. */
.site-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 2rem;
  row-gap: 0.5rem;
  padding-block: 0.875rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-ui);
  font-size: var(--text-ui);
}

.brand {
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  color: var(--accent);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.375rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-block;
  padding-block: 0.3rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.35em;
  text-decoration-color: transparent;
}

.site-nav a:hover {
  color: var(--fg);
  text-decoration-color: var(--accent);
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--fg);
  border-color: var(--muted);
}

.theme-toggle svg {
  width: 1.0625rem;
  height: 1.0625rem;
}

/* Show the moon in the light theme (it leads to dark) and the sun in dark. */
.icon-sun {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .icon-moon {
    display: none;
  }
}

:root[data-theme="dark"] .icon-sun {
  display: block;
}

:root[data-theme="dark"] .icon-moon {
  display: none;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: var(--margin-col) minmax(0, 1fr);
  /* row 1 is the name and role line; the side column spans both rows, and any
     height it needs beyond the bio goes to row 2, not between the role and the bio */
  grid-template-rows: auto 1fr;
  column-gap: var(--gutter);
  row-gap: 1.5rem;
  align-items: start;
  padding-block: 3.5rem 3.25rem;
}

/* The side column: the portrait with the quick links stacked under it. */
.hero-side {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: grid;
  row-gap: 1rem;
  align-content: start;
}

.portrait {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
}

.hero-head {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.hero-body {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  max-width: var(--measure);
}

h1 {
  font-size: var(--text-xl);
  line-height: 1.1;
  letter-spacing: -0.012em;
}

.role {
  margin: 0.625rem 0 0;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--fg);
}

.bio p {
  font-size: var(--text-md);
  line-height: 1.5;
  margin-bottom: 0.85em;
}

.bio p:last-child {
  margin-bottom: 0;
}

/* Three round icon buttons under the portrait: Google Scholar, LinkedIn,
   email. Each link names itself with aria-label and title; the SVG inside is
   decorative and takes the link colour. */
.quick-links {
  display: flex;
  justify-content: center;
  gap: 0.625rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.quick-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.375rem;
  height: 2.375rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
}

.quick-links a:hover {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
}

.quick-links svg {
  width: 1.125rem;
  height: 1.125rem;
  fill: currentColor;
}

/* Vertical padding on the links in single-row lists widens the touch target
   without moving the text. Links inside running text get
   none: their padding boxes would overlap across lines and steal taps. */
.pub-links a,
.site-footer a {
  padding-block: 0.35rem;
}

/* --------------------------------------------------------------------------
   Section scaffold: heading column + prose column
   -------------------------------------------------------------------------- */

/* The prose column carries the gutter as padding (not a grid gap) so that a
   hairline on a heading and on its prose block reads as one continuous rule. */
.section {
  display: grid;
  grid-template-columns: var(--margin-col) minmax(0, 1fr);
  column-gap: 0;
  row-gap: 2rem;
  padding-block: 3rem;
  border-top: 1px solid var(--line);
}

.section > h2 {
  grid-column: 1;
  position: relative;
  top: var(--h2-shift);
  font-size: var(--text-lg);
  line-height: 1.2;
}

/* Education opens with a 20px degree line rather than a 17px paragraph. */
#education > h2 {
  top: calc(var(--h2-shift) + 1px);
}

.side {
  grid-column: 1;
  position: relative;
  top: var(--side-shift);
  font-size: var(--text-md);
  line-height: 1.3;
}

/* The year carries a hairline, so its text (not the box) is nudged. */
.year {
  top: 0;
  padding-top: var(--year-shift);
  font-variant-numeric: tabular-nums;
}

.body {
  grid-column: 2;
  min-width: 0;
  max-width: calc(var(--measure) + var(--gutter));
  padding-left: var(--gutter);
}

.body > :last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   News
   -------------------------------------------------------------------------- */

/* The dates hang in the margin column, like the years in Publications, so
   the items keep the full prose measure: the list spans both columns of the
   scaffold and lays out its own date column, and the heading sits above it.
   Each item rule then runs across both columns like the year rules. (Under
   52em the date column narrows and the body keeps the measure; see below.) */
/* --------------------------------------------------------------------------
   Research
   -------------------------------------------------------------------------- */

/* Research: each theme lists its papers, newest first, title then venue key. */
.theme-papers {
  display: grid;
  row-gap: 0.55rem;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
  list-style: none;
}

.theme-papers li {
  line-height: 1.45;
}

/* The venue key always sits on its own line under the title. */
.theme-papers .venue {
  display: block;
  margin-top: 0.1rem;
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  font-weight: 600;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Publications
   -------------------------------------------------------------------------- */

.section--pubs {
  row-gap: 1.5rem;
}

.section--pubs > .year:first-of-type,
.section--pubs > .pubs:first-of-type {
  margin-top: 0.5rem;
}

.pubs {
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
  list-style: none;
}

/* Every year group after the first opens with a rule that runs across both columns. */
.year ~ .year {
  padding-top: calc(1.5rem + var(--year-shift));
  border-top: 1px solid var(--line);
}

.pubs ~ .pubs {
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.pub {
  position: relative;
  min-width: 0;
}

.pub + .pub {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

/* A link to the first paper of a year lands with the same 1.5rem of air above
   the title that later papers get from their padding. */
.pubs > .pub:first-child {
  scroll-margin-top: 1.5rem;
}

/* An award on the type line, in the accent colour. */
.pub-kind .award {
  color: var(--accent);
}

/* The paper type sits as a running label between the year and the title; the
   6px of padding puts its baseline on the year's baseline (measured). */
.pub-kind {
  margin: 0 0 0.3rem;
  padding-top: 6px;
  line-height: 1.5;
}

.pub-title {
  font-size: var(--text-md);
  line-height: 1.3;
}

.pub-meta {
  margin: 0.3rem 0 0;
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  line-height: 1.5;
}

.pub-authors {
  color: var(--fg);
}

.me {
  font-weight: 600;
}

.pub-venue {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.venue {
  font-weight: 600;
  color: var(--fg);
}

/* One step below the title (20 to 16px, the ratio of the rest of the scale),
   so a three-line summary does not outweigh its two-line title. */
.pub-summary {
  margin: 0.5rem 0 0;
  font-size: var(--text-sm);
  line-height: 1.5;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.125rem;
  margin: 0.55rem 0 0;
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  font-weight: 500;
}

/* A button dressed as a text link, for disclosures. */
.textbutton {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: -0.35rem 0;
  padding: 0.35rem 0;
  border: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
  text-decoration-color: var(--line);
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  cursor: pointer;
}

.textbutton:hover {
  text-decoration-color: currentColor;
}

.textbutton::after {
  content: "";
  width: 0;
  height: 0;
  margin-top: 1px;
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
  border-left: 6px solid currentColor;
}

@media (prefers-reduced-motion: no-preference) {
  .textbutton::after {
    transition: transform 150ms ease;
  }
}

.textbutton[aria-expanded="true"]::after {
  transform: rotate(90deg);
}

.bib {
  margin-top: 0.75rem;
}

/* One BibTeX field per line, however long. Each line sits in a <span class="f">
   that wraps whatever does not fit under the value, with a four-character
   hanging indent, so an entry reads as typed at any width and nothing scrolls
   sideways. The <code> is a flex column: the newlines between the spans are
   whitespace-only text runs, which a flex container does not render, so they
   stay in the copied text (the Copy button reads the plain text) without
   adding blank lines. */
.bib pre {
  margin: 0;
  padding: 0.875rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.bib code {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.bib .f {
  min-width: 0;
  padding-left: 4ch;
  text-indent: -4ch;
}

.bib-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem 0.75rem;
  margin: 0.5rem 0 0;
  font-family: var(--font-ui);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

/* Every boxed control (Copy buttons, the email field, the theme toggle) is
   2.25rem tall. */
.btn,
.email {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0 0.7rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  line-height: 1.3;
}

.btn {
  background: var(--surface);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  font-weight: 500;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--muted);
}

.btn:active {
  background: var(--line);
}

/* Room for both labels (Copy, Copied), so the button keeps its width while
   its label confirms the copy. */
.btn-copy {
  min-width: 4.5rem;
  justify-content: center;
}

.copy-status {
  font-size: var(--text-ui);
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Education
   -------------------------------------------------------------------------- */

.edu {
  margin: 0;
  padding: 0;
  list-style: none;
}

.edu li + li {
  margin-top: 1.25rem;
}

.edu-degree {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 500;
  line-height: 1.3;
}

.edu-detail {
  margin: 0.2rem 0 0;
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  line-height: 1.5;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Contact
   -------------------------------------------------------------------------- */

.email-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.625rem;
  margin: 0 0 1.5rem;
  font-family: var(--font-ui);
}

.email {
  background: var(--surface);
  color: var(--fg);
  font-size: var(--text-body);
  text-decoration: none;
  user-select: all;
  -webkit-user-select: all;
}

.email:hover {
  border-color: var(--muted);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.375rem 1.5rem;
  padding-block: 1.75rem 2.75rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-ui);
  font-size: var(--text-ui);
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: inherit;
}

/* --------------------------------------------------------------------------
   Narrow screens: one column, the heading above its prose
   -------------------------------------------------------------------------- */

@media (max-width: 52em) {
  html {
    scroll-padding-top: 1rem;
  }

  /* The name is right below in the hero, so the header keeps only the nav and the toggle. */
  .site-header {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 1rem;
    align-items: start;
    padding-block: 0.75rem;
  }

  .brand {
    display: none;
  }

  .site-nav {
    grid-column: 1;
    grid-row: 1;
    padding-top: 0.2rem;
  }

  .theme-toggle {
    grid-column: 2;
    grid-row: 1;
  }

  .site-nav ul {
    gap: 0 1rem;
  }

  .hero {
    grid-template-columns: 5.5rem minmax(0, 1fr);
    grid-template-rows: none;
    column-gap: 1.25rem;
    row-gap: 1.5rem;
    padding-block: 2rem 2.25rem;
  }

  .hero-side {
    display: contents;
  }

  .portrait {
    grid-column: 1;
    grid-row: 1;
  }

  .hero-head {
    align-self: center;
  }

  .hero-body {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .quick-links {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-content: flex-start;
    margin-top: -0.25rem;
  }

  h1 {
    font-size: 2rem;
  }

  .role {
    margin-top: 0.375rem;
  }

  .bio p {
    font-size: var(--text-body);
    line-height: 1.55;
  }

  .section {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 1rem;
    padding-block: 2.25rem;
  }

  .section > h2,
  .side,
  .body {
    grid-column: 1;
  }

  /* #education > h2 is named so that it outranks its desktop-only nudge. */
  .section > h2,
  #education > h2 {
    top: 0;
    font-size: 1.5rem;
  }

  .side {
    top: 0;
    margin-top: 0.75rem;
  }

  /* Years become running labels above their papers, so they do not read as
     one-word titles next to the 20px paper titles. */
  .year {
    margin-top: 0;
    padding-top: 0;
    font-family: var(--font-ui);
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .body {
    max-width: var(--measure);
    padding-left: 0;
  }

  .section--pubs {
    row-gap: 1rem;
  }

  .year ~ .year {
    margin-top: 0.5rem;
    padding-top: 1.5rem;
  }

  /* The year heading already carries the rule on narrow screens. */
  .pubs ~ .pubs {
    padding-top: 0;
    border-top: 0;
  }

  /* The date becomes a narrow label beside its item. */
}

/* Phones, up to 488px (the width from which the six nav links fit on one
   row): the nav wraps into two even rows (text-wrap: balance) instead of
   leaving an orphan; the date sits above its news item. */
@media (max-width: 30.5em) {
  .site-nav ul {
    display: block;
    line-height: 1.3;
    text-wrap: balance;
  }

  .site-nav li {
    display: inline-block;
    margin-right: 0.875rem;
  }

  .site-nav li:last-child {
    margin-right: 0;
  }

  .site-nav a {
    padding-block: 0.2rem;
  }

}

/* Small phones, up to 384px: the BibTeX type drops to 12px (41 columns), so
   the longest lines that cannot wrap, a 40-character DOI line or a citation
   key, still fit on one line. */
@media (max-width: 24em) {
  .bib pre {
    padding: 0.75rem;
    font-size: 0.75rem;
  }
}

/* --------------------------------------------------------------------------
   Without JavaScript: hide controls that need it, show every BibTeX entry
   -------------------------------------------------------------------------- */

.no-js .theme-toggle,
.no-js .textbutton,
.no-js .bib-foot,
.no-js .btn-copy,
.no-js .copy-status {
  display: none;
}

.no-js .bib[hidden] {
  display: block;
}

/* --------------------------------------------------------------------------
   Motion and print
   -------------------------------------------------------------------------- */

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

@media print {
  .edu li {
    break-inside: avoid;
  }

  /* Plain white paper: no field, black ink, in whichever theme the page was. */
  :root,
  :root:not([data-theme="light"]),
  :root[data-theme="dark"] {
    --bg: #FFFFFF;
    --surface: #F2F2F2;
    --line: #BBBBBB;
    --fg: #000000;
    --muted: #333333;
    --accent: #000000;
    color-scheme: light;
  }

  body {
    background-image: none;
  }

  .field,
  .site-header,
  .skip-link,
  .btn,
  .bib-foot,
  .textbutton {
    display: none;
  }

  .bib[hidden] {
    display: block;
  }

  .pub,
  a {
    color: inherit;
  }

  .pub-links a::after {
    content: " (" attr(href) ")";
    font-weight: 400;
  }
}
