/* ============================================================
   Zhijun Cao — personal site
   Palette: muted blue and muted red on untinted grays (:root). Light theme only.
   ============================================================ */

/* ---------- self-hosted fonts ----------
   No Google Fonts CDN: unreachable in mainland China, and it blocks rendering. */
/* Gelasio: OFL Georgia clone (license in OFL-Gelasio.txt) with matching metrics, so line breaks don't
   shift; variable 400–700, unlike Georgia's 400/700. Latin subset incl. Latin Extended (map place names).
   Italic is only used below the fold: not preloaded. */
@font-face {
  font-family: 'Gelasio';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/Gelasio-var.woff2') format('woff2');
}
@font-face {
  font-family: 'Gelasio';
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/Gelasio-Italic-var.woff2') format('woff2');
}
/* Chinese: system PingFang / YaHei at 95%, since Han glyphs fill the em box and look oversized next to
   Latin at the same px. unicode-range limits it to CJK and full-width punctuation. */
@font-face {
  font-family: 'ZH Adj';
  font-weight: 400;
  src: local('PingFang SC Regular'), local('PingFangSC-Regular'), local('Microsoft YaHei'), local('MicrosoftYaHei');
  size-adjust: 95%;
  unicode-range: U+2E80-2FFF, U+3000-30FF, U+3100-33FF, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FE30-FE4F, U+FF00-FFEF;
}
@font-face {
  font-family: 'ZH Adj';
  font-weight: 600 700;
  src: local('PingFang SC Semibold'), local('PingFangSC-Semibold'), local('Microsoft YaHei Bold'), local('MicrosoftYaHei-Bold');
  size-adjust: 95%;
  unicode-range: U+2E80-2FFF, U+3000-30FF, U+3100-33FF, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FE30-FE4F, U+FF00-FFEF;
}

:root {
  /* Low saturation, three hues: a muted blue for links and structure, one muted red for highlights, and
     untinted grays for everything else. The grays carry no tint, so even a muted blue stands apart from the text. */
  --accent: #4c699a;   /* dusty blue, hue 260° (oklch), away from cyan: 5.5:1 on white, passes the 4.5:1 AA bar */
  --heading: #395076;  /* darker accent: section headings, bracket-link hover */
  --high:   #bc5c58;   /* muted red, the one warm color: published venues, author stars, the hero invitation's links */

  /* Show Lab logo colors: .shx (the "Show" in Show-Harness) only */
  --sl-blue:   #669ED3;
  --sl-green:  #67A651;
  --sl-red:    #D85E5D;
  --sl-orange: #F3AA68;
  --link:   var(--accent);

  /* Grays, dark to light, all untinted */
  --fg:     #292929;
  --subtle: #858585;   /* secondary text */
  --rule:   #d1d1d1;   /* dividers */
  --card-b: #e2e2e2;   /* shared border for all rounded boxes */
  --desk:   #eeeeee;   /* gray backdrop behind the homepage sheet, jemdoc-style */
  --chip:   #f1f1f1;
  --bg:     var(--desk);   /* page background; the gallery has no sheet and sets it to white (gallery/index.html :root { --bg }) */
  --card:   #ffffff;

  /* Fallback Georgia is metric-compatible (no reflow on swap). Chinese uses system fonts to avoid a
     large download ('ZH Adj' = 95% PingFang / YaHei); Songti looked fuzzy at body size. */
  --serif: "Gelasio", Georgia, "ZH Adj", "PingFang SC", "Microsoft YaHei", serif;
  /* All-serif site: --sans aliases --serif */
  --sans: var(--serif);

  /* Only five font sizes; pick from these for new styles. */
  --fs-xs: 13px;   /* map tooltip, footer */
  --fs-sm: 15px;   /* secondary text: authors, venues, dates, bracket links, nav, contacts, etc. */
  --fs-md: 16px;   /* body and titles. 17px looked crowded next to jemdoc pages (Georgia 16px) */
  --fs-lg: 20px;   /* section headings */
  --fs-xl: 34px;   /* name */

  /* Vertical spacing on the homepage: multiples of 6px, one per level of grouping; pick from these for new styles.
     With the single 1.45 line height, every text line carries ~1.5px of leading above and below, so a gap
     between two lines of text shows as its value + 3px: 9 / 15 / 21 / 27 / 45. Entries and sections are
     spaced by these alone: their first and last rows carry no outer space. */
  --sp-line:    6px;    /* lines of one entry: title, authors, venue, links; a title and its subtitle; the invitation's sentences */
  --sp-row:     12px;   /* rows: paragraphs, news items, sub-items, name to role; heading rule to content */
  --sp-block:   18px;   /* blocks within the hero: role to invitation */
  --sp-entry:   24px;   /* entries: papers, experiences; invitation to contacts */
  --sp-section: 42px;   /* sections */

  /* The site's single bold weight. Gelasio is variable, so 670 is a real weight;
     Chinese ≥600 maps to PingFang Semibold ('ZH Adj' above). */
  --bold: 670;

  --w: 860px;   /* max text column width: homepage, gallery and gallery list view */
  --radius: 6px;   /* shared corner radius: sheet, avatar, thumbnails, gallery photos */
  /* Homepage sheet (main.wrap): wider padding widens the sheet, keeping the text column at
     --w − 44px = 816px like the gallery. Sheet = 860 − 44 + 160 + 2 = 978px. */
  --sheet-pad: clamp(48px, 7vw, 80px);
  /* Minimum page width; must match MIN in the viewport script in both pages' <head>. Below it the hero
     doesn't fit, so phones lay out at 700px and scale down. */
  --page-min: 700px;
  --sheet-w: calc(var(--w) - 44px + 2 * var(--sheet-pad) + 2px);

  /* Hover tilt strength (max angle, zoom), shared by gallery photos and the avatar; each scales it by --hover-k.
     --hover-shadow is their common hover shadow: a tight contact layer for the edge plus a soft drop. */
  --hover-tilt: 6deg;
  --hover-zoom: .02;
  --hover-shadow: 0 1px 3px rgba(41, 41, 41, .08), 0 6px 16px rgba(41, 41, 41, .18);
  --ease-focus: cubic-bezier(.25, .8, .3, 1);   /* every focus entrance: pieces, sections, avatar, gallery photos */

  /* Light only: opt out of browser/OS forced dark mode. */
  color-scheme: light;

  /* Translucent fill for non-nav components: no blur, no highlight */
  --glass-fill: rgba(255, 255, 255, .20);
  --glass-cast: rgba(41, 41, 41, .09);
  --text-halo: rgba(255, 255, 255, .85);   /* faint halo keeps nav text legible over blurred dark content */
  /* Nav hover blob; also the loupe toggle's pressed and hint fill (see .liquid-lens) */
  --lens: color-mix(in srgb, var(--accent) 10%, var(--bg));
  --lg-spring: cubic-bezier(.3, 1.45, .5, 1);   /* springy easing: loupe and email popover entrance, hover blob slide */
}

* { box-sizing: border-box; }

/* [hidden] has only UA-level priority and loses to any explicit display below. */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth; scroll-padding-top: 72px;
  /* Stop iOS Safari's text inflation (landscape, desktop-mode pages). glass.js capturePage() relies on
     it too, so the SVG snapshot matches the page layout. */
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}

body {
  margin: 0; min-width: var(--page-min);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: var(--fs-md);
  /* The only text line height, Biography included, so equal gaps look equal (--sp-*). Dense by design;
     1.35 felt cramped with Georgia's tall x-height. zh-CN: 1.6. */
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* long URLs or unbroken words must not cause horizontal scroll */
  overflow-wrap: break-word;
}

html:lang(zh-CN) {
  --serif: "Gelasio", Georgia, "ZH Adj", "PingFang SC", "Microsoft YaHei", sans-serif;
}
html:lang(zh-CN) body { line-height: 1.6; }
html:lang(zh-CN) h2 { letter-spacing: .04em; }

a { color: var(--link); text-decoration: none; font-weight: var(--bold); }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

img { max-width: 100%; }

.wrap { max-width: var(--w); margin: 0 auto; padding: 0 22px; }

/* ---------- top nav ----------
   Sticky, no backing (iOS 26 soft scroll edge): .nav-edge adds a progressive blur plus a fading tint.
   Blur = four layers, radius 1/2/4/8px, each masked to a shorter top band; each backdrop-filter sees
   the layers before it, so blur accumulates upward.
   .nav and .nav-edge must not get opacity, filter or mask: that creates a backdrop root and the layers
   blur nothing, so the blur radius is transitioned instead of fading the layer.
   Blur is off until .nav.scrolled (nav.js): invisible at the top but costs GPU every frame. */
.nav {
  position: sticky; top: 0; z-index: 50;
  --nav-gap: 4px;
  display: flex; align-items: center; gap: var(--nav-gap);
  height: 60px;
  /* Sheet edges inset 16px (same width formula as main.wrap). Not the text column: at 700px that
     leaves only 570px and crowds the gallery loupe toggle. */
  padding: 0 calc((100% - min(var(--sheet-w), 100% - 28px)) / 2 + 16px);
}
.nav-edge {
  position: absolute; left: 0; right: 0; top: 0; z-index: -1;
  height: calc(100% + 26px);      /* blur fades out below the nav's bottom edge */
  pointer-events: none;
}
.nav-edge > i, .nav-edge::after { position: absolute; inset: 0; }
.nav-edge > i { transition: backdrop-filter .35s ease, -webkit-backdrop-filter .35s ease; }
.nav-edge > i:nth-child(1) { -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.nav-edge > i:nth-child(2) { -webkit-mask-image: linear-gradient(#000 45%, transparent 80%); mask-image: linear-gradient(#000 45%, transparent 80%); }
.nav-edge > i:nth-child(3) { -webkit-mask-image: linear-gradient(#000 30%, transparent 62%); mask-image: linear-gradient(#000 30%, transparent 62%); }
.nav-edge > i:nth-child(4) { -webkit-mask-image: linear-gradient(#000 15%, transparent 45%); mask-image: linear-gradient(#000 15%, transparent 45%); }
.nav.scrolled .nav-edge > i:nth-child(1) { -webkit-backdrop-filter: blur(1px); backdrop-filter: blur(1px); }
.nav.scrolled .nav-edge > i:nth-child(2) { -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.nav.scrolled .nav-edge > i:nth-child(3) { -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.nav.scrolled .nav-edge > i:nth-child(4) { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
/* tint: page color fading downward, keeps nav text legible over anything */
.nav-edge::after {
  content: '';
  background: linear-gradient(color-mix(in srgb, var(--bg) 88%, transparent),
                              color-mix(in srgb, var(--bg) 60%, transparent) 55%, transparent);
  opacity: 0; transition: opacity .35s ease;
}
.nav.scrolled .nav-edge::after { opacity: 1; }

/* liquid-glass WebGL canvas (created by glass.js); only the gallery loupe uses it */
.lg-refract {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: -3; pointer-events: none;
}
/* Gallery loupe (glass.js). Follows the mouse without catching clicks; dragged on touch (script enables
   pointer-events). Script writes translate per frame, so show/hide uses opacity and scale. */
.lg-loupe {
  position: fixed; left: 0; top: 0; z-index: 45; pointer-events: none;
  width: 170px; height: 170px; border-radius: 999px;
  overflow: hidden; overflow: clip; isolation: isolate;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .16), 0 2px 6px rgba(0, 0, 0, .08);
  opacity: 0; scale: .82;
  transition: opacity .2s ease, scale .45s var(--lg-spring);
  will-change: translate, transform; touch-action: none;
}
.lg-loupe.on { opacity: 1; scale: 1; }
.lg-loupe.drag { pointer-events: auto; cursor: grab; }
@media (prefers-reduced-motion: reduce) { .lg-loupe { transition: opacity .15s ease; scale: 1; } }
/* Gallery view switch (film / list): segmented control, active option in accent blue */
.view-switch {
  display: inline-flex; gap: 2px; margin-top: 12px; padding: 3px;
  border: 1px solid var(--rule); border-radius: 999px;
  background: var(--glass-fill); box-shadow: 0 2px 8px var(--glass-cast);
}
.view-switch button {
  font-family: var(--sans); font-size: var(--fs-sm); font-weight: var(--bold); line-height: 1.4;
  padding: 4px 13px; border: 0; border-radius: 999px; cursor: pointer;
  background: none; color: var(--subtle); white-space: nowrap;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}
.view-switch button:hover { color: var(--fg); }
.view-switch button[aria-pressed="true"] {
  color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.view-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Nav links: plain text with a faint accent pill on hover; with JS, the sliding .liquid-lens replaces it */
.nav .wrap {
  display: flex; align-items: center; gap: 2px;
  flex: 1 1 auto; min-width: 0; margin: 0; padding: 0;
  /* Override .wrap's 860px cap so the row fills the 978px nav; else the right-end buttons fall short. */
  max-width: none;
}
/* Hover blob (nav.js liquidLens), positioned in .nav: the links row must stay unpositioned so
   offsetLeft is relative to .nav. z-index -1 after .nav-edge: above the blur, below the text. */
.liquid-lens {
  position: absolute; left: 0; top: 0; z-index: -1; pointer-events: none;
  border-radius: 999px; opacity: 0;
  /* Accent mixed into --bg, not a fixed gray, so it fits both the gray homepage and white gallery.
     Must stay opaque, or blurred content under the nav shows through. */
  background: var(--lens);
  transition: transform .55s var(--lg-spring), width .55s var(--lg-spring),
              height .45s var(--lg-spring), opacity .25s ease;
}
.liquid-lens.on { opacity: 1; }
.nav.has-lens .wrap a:hover, .nav.has-lens .language-toggle:hover, .nav.has-lens .nav-loupe:hover { background: none; }
/* No text halo over the opaque blob; it would only blur the glyph edges */
.nav.has-lens .wrap a:hover, .nav.has-lens .language-toggle:hover, .nav.has-lens .nav-loupe:hover,
.nav.has-lens .wrap a:focus-visible, .nav.has-lens .language-toggle:focus-visible, .nav.has-lens .nav-loupe:focus-visible { text-shadow: none; }
.nav.has-lens .language-toggle:hover svg, .nav.has-lens .language-toggle:focus-visible svg { filter: none; }
.nav a {
  font-family: var(--sans);
  font-size: var(--fs-sm); font-weight: var(--bold); letter-spacing: .02em;
  color: var(--fg);
  padding: 6px 10px; border-radius: 999px; white-space: nowrap;
  /* halo for legibility over blurred dark photos */
  text-shadow: 0 0 3px var(--text-halo), 0 1px 2px var(--text-halo);
  transition: background .2s ease;
}
/* Only the Home / Gallery page links are bold, to set them apart from in-page anchors */
.nav .wrap > a:not([data-i18n="nav.home"]):not([data-i18n="nav.gallery"]) { font-weight: 400; }
.nav a.language-pair {
  /* both language labels share one grid cell and cross-fade in place */
  display: grid; flex: 0 0 auto; position: relative;
}
/* Hidden label leaves the flow so link width follows the visible one (else the short Chinese
   label would be as wide as "Biography" and spacing would look uneven) */
.nav a .language-label[aria-hidden="true"] { position: absolute; }
.nav a:hover, .language-toggle:hover, .nav-loupe:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  text-decoration: none;
}
/* Right-end round buttons: language toggle (globe + badge) and, on the gallery, the loupe toggle */
.language-toggle, .nav-loupe {
  flex: 0 0 40px; width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: 999px; background: none;
  display: grid; place-items: center;
  font-family: var(--sans); font-size: var(--fs-sm); font-weight: var(--bold);
  color: var(--fg); cursor: pointer;
  text-shadow: 0 0 3px var(--text-halo), 0 1px 2px var(--text-halo);
  transition: background .2s ease;
}
/* glass.js unhides the loupe toggle once the loupe is ready. Hidden = zero width plus a negative margin
   for its gap (not display: none), so it expands smoothly; stays collapsed without WebGL. */
.language-toggle, .nav-loupe { font-size: 18px; line-height: 1; text-shadow: none; }
/* Nav icons are centred on the inline emoji (🏠 🖼️ in the 15px links, ink ~14.5px tall) and larger: a lone line
   globe at the emoji's exact ink height looked a size smaller than an emoji set in text. The globe (20px) runs
   ~20% taller, counted from the top of its circle to the bottom of the badge's letters, the only part visible
   below it; top: -2px centres that on the emoji. The 🔍, a solid glyph, looked larger than the globe at the
   same height, so its ink matches the globe's circle alone (17px). Re-measure ink (not boxes) if the font size,
   the badge or these numbers change.
   Globe and badge after rlinf.org: a line globe with the target language on its lower-right corner. Stroke 1.8
   (~1.24px at this size) and a regular-weight badge match the nav links; the globe gets the link text's halo.
   The globe's lines are cut around the badge by an SVG mask, a pill the badge's size (one per badge width, picked
   by the target language in the button's lang). The badge itself has no background: a page-colored one shows as
   a patch over the frosted nav, the hover circle or the lens, and touch screens keep :hover after a tap, so a
   hover-colored one stayed lit after switching. If the badge text, size or offset changes, update the mask rects. */
.language-icon { position: relative; top: -2px; display: block; width: 20px; height: 20px; }
.language-toggle svg { display: block; width: 20px; height: 20px; filter: drop-shadow(0 0 2px var(--text-halo)); }
.language-toggle[lang="zh-CN"] .language-cut-en, .language-toggle[lang="en"] .language-cut-zh,
.language-cut-zh-s, .language-cut-en-s { display: none; }
/* WebKit (Safari, every iPad browser) draws emoji ~24% larger than Chrome: a 15px 🏠 has ~18px of ink, not
   ~14.5px. The globe grows to match (23.5px), with its own holes (-s) since the badge stays 8px; the 🔍 gets
   its own size below. Detected with a WebKit-only font keyword. */
@supports (font: -apple-system-body) {
  .language-icon, .language-toggle svg { width: 23.5px; height: 23.5px; }
  .language-icon { top: -1.85px; }
  .language-cut-zh, .language-cut-en { display: none; }
  .language-toggle[lang="zh-CN"] .language-cut-zh-s, .language-toggle[lang="en"] .language-cut-en-s { display: inline; }
}
.language-badge {
  position: absolute; right: -4px; bottom: -2.5px;
  padding: 1px 3px;                                /* sizes the mask's pill; it must stay inside the 40px hover circle */
  font-size: 8px; line-height: 10px; font-weight: 400; white-space: nowrap;   /* regular, like the nav links */
}
/* "EN" has nothing below its baseline, so its ink ends ~0.6px above "中"'s; lower it to the same line */
.language-toggle[lang="en"] .language-badge { bottom: -3.1px; }
.nav-loupe {
  transition: background .2s ease, flex-basis .4s cubic-bezier(.32,.72,0,1),
              width .4s cubic-bezier(.32,.72,0,1), margin .4s cubic-bezier(.32,.72,0,1),
              opacity .3s ease;
}
.nav .nav-loupe[hidden] {
  display: grid !important;                     /* beats global [hidden] so the transition can run */
  flex-basis: 0; width: 0; margin-left: calc(-1 * var(--nav-gap));
  opacity: 0; visibility: hidden; pointer-events: none;
}
/* Pressed: blob fill. Kept on hover, overriding the .nav.has-lens …:hover { background: none } rule,
   or it blinks out before the blob arrives. */
.nav .nav-loupe[aria-pressed="true"], .nav.has-lens .nav-loupe[aria-pressed="true"]:hover {
  background: var(--lens);
}
/* Loupe hint (motion gets noticed more than color): glass.js adds .hint ~1s after load and removes it
   on the button's own animationend, so loupe-breathe must stay. */
/* Ink as tall as the globe's circle (see .language-icon). Measure with the hint finished: loupe-wave scales the
   glyph up to 1.28x. WebKit's emoji don't scale with font size (16-18px all give ~20px of ink at 2x), so it
   gets its own size, 15.5px (~19px of ink, its globe's circle), checked at 2x like an iPad. */
.nav-loupe .ico { display: inline-block; font-size: 17px; }
@supports (font: -apple-system-body) {
  .nav-loupe .ico { position: relative; top: .2px; font-size: 15.5px; }
}
.nav-loupe.hint { animation: loupe-breathe 1.5s ease-in-out; }
.nav-loupe.hint .ico { animation: loupe-wave 1.5s ease-in-out; }
@keyframes loupe-breathe {
  0%, 100% { background-color: transparent; }
  50%      { background-color: var(--lens); }
}
@keyframes loupe-wave {
  0%, 100% { transform: none; }
  14%      { transform: rotate(-16deg) scale(1.28); }
  34%      { transform: rotate(14deg) scale(1.28); }
  54%      { transform: rotate(-11deg) scale(1.24); }
  74%      { transform: rotate(7deg) scale(1.12); }
}
.language-toggle:focus-visible, .nav-loupe:focus-visible, .nav a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: -3px;
}
.nav-divider {
  /* keeps neighbors' hover fill off the line */
  flex: 0 0 0; width: 0; height: 18px; margin: 0 6px;
  border-left: 1px solid var(--rule); opacity: .85;
}
.language-label {
  grid-area: 1 / 1;
  line-height: 1.4;
  opacity: 0; visibility: hidden; transform: translateY(3px);
  transition: opacity .18s ease, transform .24s cubic-bezier(.32,.72,0,1),
              visibility .18s;
}
.language-label[aria-hidden="false"] {
  opacity: 1; visibility: visible; transform: translateY(0);
}
/* Reduced transparency: no blur, solid underlay */
@media (prefers-reduced-transparency: reduce) {
  .nav.scrolled .nav-edge > i { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .nav-edge { height: 100%; }
  .nav-edge::after { background: var(--bg); }
}

/* ---------- hero ----------
   216px avatar, a bit taller than the text, vertically centered. Text column max = 816 − 216 − 32
   = 568px, room for one line of contacts. */
.hero {
  display: grid;
  grid-template-columns: 1fr 216px;
  gap: 32px; align-items: center;
  /* top = sheet padding: the avatar sets the row top, so space above it equals space to its right.
     bottom: the first screen stands a grid step farther from Biography than sections from each other */
  padding: var(--sheet-pad) 0 var(--sp-line);
}
.hero h1 {
  font-family: var(--sans);
  font-size: var(--fs-xl); font-weight: var(--bold); letter-spacing: -.02em;
  margin: 0; line-height: 1.2;
}
.hero .cn {
  font-size: var(--fs-md); color: var(--subtle); font-weight: 400;
  margin-left: 9px; letter-spacing: .06em;
  white-space: nowrap;   /* alternate-script name wraps as a whole, never mid-name */
}
/* Lines under the name use body font, size and line height; hierarchy via color/weight only.
   Name to role is a row gap; +3px since the name's 1.2 line height carries no leading, where body text has
   ~3px between lines. The invitation below is set apart (.hero .affil). */
.hero .role {
  font-size: var(--fs-md); color: var(--accent);
  font-weight: var(--bold); margin: calc(var(--sp-row) + 3px) 0 var(--sp-row);
}
/* Same size as the Biography body; line height inherited (don't fix it, or it drifts from the body).
   Italic sets the hero's invitation apart from the body text (Chinese is slanted synthetically, as in
   the publication venue lines; upright and Kai were both tried and dropped). Set apart from the lines
   around it: a block gap above, an entry gap below,
   which sets the contacts off as their own line. Margins collapse with the role's and the contacts' row gaps. */
.hero .affil {
  font-size: var(--fs-md); color: var(--fg); font-style: italic;
  margin: var(--sp-block) 0 var(--sp-entry);
}
/* One block per sentence, a line gap apart (a <br> can't take a margin): closer than paragraphs, yet at the
   dense 1.45 line height (3 px between wrapped lines) still clearly a break. At a looser line height the same
   gap read as uneven leading. */
.hero .affil .sent { display: block; }
.hero .affil .sent + .sent { margin-top: var(--sp-line); }
/* Emoji stay upright: a synthetic slant skews them (🖼️ turns into a parallelogram) */
.hero .affil .emo { font-style: normal; }
/* The invitation's two links (Gallery, email me) in the highlight red, as the job-seeking line's keywords were */
.hero .affil a { color: var(--high); }
.hero p { margin: 0 0 9px; font-size: var(--fs-md); }
/* Denoising canvas overlays the image. Hover tilt uses the gallery's strength; --tx / --ty come from
   the #avatarFx hover script in index.html. This transition is the slower return on leave. */
.avatar-wrap {
  position: relative; width: 216px; height: 216px;
  cursor: pointer; justify-self: end;
  border-radius: var(--radius); --hover-k: 1.3;
  transition: transform .6s cubic-bezier(.33,0,.2,1), box-shadow .6s cubic-bezier(.33,0,.2,1);
}
.avatar-wrap:hover {
  transform: perspective(800px)
             rotateX(calc(var(--hover-tilt) * var(--hover-k) * var(--ty, 0) * -1))
             rotateY(calc(var(--hover-tilt) * var(--hover-k) * var(--tx, 0)))
             scale(calc(1 + var(--hover-zoom) * var(--hover-k)));
  box-shadow: var(--hover-shadow);
  transition: transform .34s cubic-bezier(.32,.72,0,1), box-shadow .34s cubic-bezier(.32,.72,0,1);
}
.avatar-fx {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border-radius: var(--radius); border: 1px solid var(--card-b);
  opacity: 0; pointer-events: none;
}
/* Shown instantly (a fade-in would swallow the first steps) and kept after the run, its last frame being the
   image: handing back to the <img> made the picture jump on an iPad (see play() in index.html). */
.avatar-wrap.fx-on .avatar-fx { opacity: 1; }

.hero .avatar {
  width: 216px; height: 216px; object-fit: cover;
  border-radius: var(--radius); border: 1px solid var(--card-b);
  background: var(--card);
}

/* Contacts: plain links separated by "|". The divider is absolutely positioned in the gap with no
   pointer events, so it isn't part of a link (not clickable, not underlined on hover). */
.links {
  --sep: 18px;   /* item gap; the divider sits at its center */
  display: flex; flex-wrap: wrap; gap: 6px var(--sep); margin-top: var(--sp-row);
  /* No overflow clipping here: it would cut off the email popover, which is centred on the first link
     and wider than it. Line-leading dividers are dropped via .line-start (set by index.html's script). */
}
.links a {
  font-family: var(--sans); font-size: var(--fs-sm);
  display: inline-flex; align-items: center; gap: 5px;
}
.links > * { position: relative; }
.links > * + *::before {
  content: "|"; position: absolute; left: calc(var(--sep) / -2); top: 50%;
  transform: translate(-50%, -50%);
  color: var(--rule); pointer-events: none;
}
/* Zero-height full-width spacer forcing a 4 + 3 split; unused while the LinkedIn / Instagram links are
   commented out in index.html's .links */
.links .lbreak { flex-basis: 100%; height: 0; margin: 0; padding: 0; }
/* no divider on the spacer or the item after it, nor on an item that starts a wrapped line */
.links .lbreak::before, .links .lbreak + *::before, .links > .line-start::before { display: none; }
.links img { width: 15px; height: 15px; object-fit: contain; }
/* Email hover popover with the address and Copy. Solid background: it can overlap other text.
   Centered on the link (--px from script); shown with .on, dropping in slightly. */
.mailbox { position: relative; display: inline-flex; }
.copy-pop {
  --pop-bg: var(--card);
  position: absolute; left: var(--px, 0px); top: calc(100% + 9px); z-index: 20;
  display: flex; align-items: center; white-space: nowrap;
  padding: 5px 4px 5px 14px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--pop-bg);
  box-shadow: 0 2px 8px var(--glass-cast);
  font-family: var(--sans); font-size: var(--fs-sm); font-weight: var(--bold); color: var(--fg);
  opacity: 0; visibility: hidden; transform: translateY(-7px);
  transition: opacity .12s ease, transform .12s ease, visibility 0s .12s;
}
.copy-pop.on {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .2s ease, transform .45s var(--lg-spring);
}
.copy-pop .addr { user-select: all; -webkit-user-select: all; }
/* Copy button: right 10px + popover's 4px mirrors the left 14px. The "copied" label is wider, so
   place() in index.html's .mailbox script re-centers the popover. */
.copy-pop button {
  margin-left: 10px; padding: 0 10px; border: 0; border-left: 1px solid var(--rule);
  background: none; cursor: pointer; font: inherit; line-height: inherit; color: var(--accent);
  transition: color .18s ease;
}
.copy-pop button:hover { text-decoration: underline; }
.copy-pop button.done { color: var(--fg); text-decoration: none; }
.copy-pop button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
/* .copy-tip bridges the 9px gap to the popover (--pw, --px from script) and takes pointer events only
   when open, so moving onto the popover isn't a leave. Its arrow (at --ax) covers the popover's top border. */
.copy-tip {
  position: absolute; left: var(--px, 0px); top: 100%; z-index: 21;
  width: var(--pw, 260px); height: 10px; pointer-events: none;
  opacity: 0; transform: translateY(-7px);
  transition: opacity .12s ease, transform .12s ease;
}
.mailbox.open .copy-tip {
  pointer-events: auto; opacity: 1; transform: none;
  transition: opacity .2s ease, transform .45s var(--lg-spring);
}
.copy-tip::before {
  content: ''; position: absolute; left: calc(var(--ax, 42px) - 5px); top: 5px;
  width: 9px; height: 9px; transform: rotate(45deg); border-radius: 2px 0 0 0;
  background: var(--card); border: solid var(--rule); border-width: 1px 0 0 1px;
}


/* ---------- sheet ----------
   Homepage only: the gallery's <main> has no .wrap since its marquee spans the viewport. */
main.wrap {
  width: min(var(--sheet-w), 100% - 28px); max-width: none;
  /* blur is off until .nav.scrolled, so the sheet's top edge stays crisp */
  margin-top: 8px; padding: 0 var(--sheet-pad) var(--sheet-pad);   /* bottom = sides = space above the avatar */
  background: var(--card); border: 1px solid var(--card-b); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(41, 41, 41, .05);
}
/* the sheet edge already separates the footer: drop its rule and top space (gallery keeps them) */
main.wrap ~ footer.wrap { margin-top: 0; padding-top: 32px; border-top: 0; }

/* ---------- sections ---------- */
section { padding-top: 34px; }
main.wrap > section { padding-top: var(--sp-section); }
/* Section headings: bold, darker accent, 1px rule below. Entries aren't cards, so the rule does the grouping */
h2 {
  font-family: var(--sans);
  font-size: var(--fs-lg); font-weight: var(--bold);
  color: var(--heading);
  margin: 0 0 var(--sp-row); padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
}
/* Co-first note in the Publications heading keeps author-line styling: no h2 weight, color or zh letter-spacing */
h2 .cofirst {
  font-family: var(--serif); font-size: var(--fs-sm); font-weight: 400;
  letter-spacing: normal; color: var(--fg);
  margin-left: 4px;
}
h2 .zh {
  font-family: var(--serif); font-size: var(--fs-xs); font-weight: 400;
  letter-spacing: normal; color: var(--subtle); margin-left: 8px;
}
/* tighter than the 1em default */
p { margin: .65em 0; }
section > p:first-of-type { margin-top: 14px; }
/* Homepage paragraphs (Biography) are rows; the first one's top margin collapses into the heading's */
main.wrap > section > p { margin: var(--sp-row) 0 0; }

strong, b { font-weight: var(--bold); }

/* ---------- News ----------
   Square bullets, one item per line, each led by an accent-blue [MM/YYYY]. */
.news { margin: 0; padding-left: 1.25em; list-style: square; }
.news li { padding: calc(var(--sp-row) / 2) 0; font-size: var(--fs-md); }   /* a row gap between items, as on jemdoc pages */
.news li:first-child { padding-top: 0; }
.news li::marker { color: var(--accent); }
/* The leading emoji: a little room on both sides, on top of the spaces around it (Gelasio's space is narrow
   and emoji have almost no side bearing, so date, emoji and text ran together) */
.news .emo { margin: 0 .2em; }
/* Georgia digits are proportional with no tabular-nums, so dates misalign. Month and year get
   min-width cells sized for 08 / 2026 (month right-aligned), with brackets from CSS. */
.news time { display: inline-flex; color: var(--accent); white-space: nowrap; }
.news time::before { content: "["; }
.news time::after  { content: "]"; }
.news time span:first-child { min-width: 1.22em; text-align: right; }
.news time span:last-child  { min-width: 2.3em; }
/* "All News" as the list's last row: text aligned with items, a triangle in the bullet column.
   7.5 × 9px since a triangle has half a same-height square's area. inline-block: no hover underline.
   The toggle itself is a block with the text line height, spaced like any row: inline, it sat in a line box
   that added ~2px below it, and a <button> otherwise keeps line-height: normal. max-content keeps the
   click target to its text. */
.news-more, .pub-more {
  display: block; width: max-content; line-height: inherit;
  font-family: var(--sans); font-size: var(--fs-sm); color: var(--link);
  background: none; border: 0; cursor: pointer;
  padding: calc(var(--sp-row) / 2) 0 0 calc(var(--fs-md) * 1.25);   /* plus the last item's half: a row gap */
}
.news-more::before, .pub-more::before {
  content: ''; display: inline-block; width: 0; height: 0;
  border-style: solid; border-width: 4.5px 0 4.5px 7.5px;
  border-color: transparent transparent transparent var(--accent);
  vertical-align: 0;
  /* shift into the bullet column (center at 8px) and add it back so the text start doesn't move */
  margin: 0 calc(var(--fs-md) * 1.25 - 11.75px) 0 calc(4.25px - var(--fs-md) * 1.25);
  transition: transform .2s ease;
}
:is(.news-more, .pub-more)[aria-expanded="true"]::before { transform: rotate(90deg); }
:is(.news-more, .pub-more):hover { text-decoration: underline; }
/* "All Publications": the same toggle after the folded under-review papers. No bullet column here,
   so the triangle sits at the left edge (aligned with the thumbnails) and the text follows it.
   No top padding: the paper above keeps its bottom half-entry gap (12px = a row gap, as under News),
   and as the section's last child the toggle ends it, so the section gap is the same open or closed. */
.pub-more { padding-left: 0; padding-top: 0; }
.pub-more::before { margin: 0 6px 0 0; }

/* ---------- entries ----------
   Experience / publications sit directly on the sheet: no cards, no hover, separated by spacing only.
   Each carries half an entry gap above and below; the first under a heading and the last in a section drop
   theirs, so heading-to-content is a row gap and section-to-section the section gap, for every entry type. */
main.wrap > section > h2 + :is(.pub, .item) { padding-top: 0; }
main.wrap > section > :is(.pub, .item):last-child { padding-bottom: 0; }

/* ---------- publications ---------- */
.pub {
  display: grid; grid-template-columns: 220px 1fr;
  gap: 20px; padding: calc(var(--sp-entry) / 2) 0;
  /* default stretch would make .thumb as tall as the text, leaving empty bordered space */
  align-items: center;
}

.pub .thumb {
  width: 100%; border-radius: var(--radius);
  border: 1px solid var(--card-b); background: var(--card);
  overflow: hidden;
}
/* Spacing comes only from gap: margins zeroed, line height inherited (mixing them made gaps uneven). */
.pub > div:not(.thumb) { display: flex; flex-direction: column; gap: var(--sp-line); min-width: 0; }
.pub > div:not(.thumb) > * { margin: 0; }

/* height: auto is required: the width/height attributes (reserve space, no layout shift) would
   otherwise act as a fixed height and distort the image */
.pub .thumb img,
.pub .thumb video { display: block; width: 100%; height: auto; }
.pub h3 {
  font-family: var(--sans); font-size: var(--fs-md); font-weight: var(--bold);
  /* pretty, not balance: balance evens out the lines, cutting line one short (often at a hyphen);
     pretty fills lines normally and only avoids a lone last word. */
  text-wrap: pretty;
}
.pub .authors { font-size: var(--fs-sm); color: var(--subtle);
  text-wrap: pretty; }
.pub .authors .me { font-weight: var(--bold); }
.pub .venue {
  font-size: var(--fs-sm); color: var(--fg); font-style: italic;
}
/* Whole line italic (Chinese is slanted synthetically); published venues add the highlight red + bold.
   em is matched too, so the wrong tag still works. */
.pub .venue b,
.pub .venue em { color: var(--high); font-weight: var(--bold); }
.pub .venue .dot { margin: 0 5px; opacity: .6; font-style: normal; }
.star { color: var(--high); font-weight: var(--bold); }

/* "Show" in Show-Harness uses the four Show Lab logo colors. No whitespace between the four <span>s:
   HTML collapses newlines to spaces, rendering and copying as "S h o w". */
.shx span:nth-child(1) { color: var(--sl-blue); }
.shx span:nth-child(2) { color: var(--sl-green); }
.shx span:nth-child(3) { color: var(--sl-red); }
.shx span:nth-child(4) { color: var(--sl-orange); }
/* Funding note: same size as authors / venue, gray italic, matching the <em> notes in experience entries */
.note {
  font-size: var(--fs-sm); color: var(--subtle); font-style: italic;
  margin: 0 0 8px;
}

/* Bracketed links: with no fill or border they need the wider 12px column gap */
.tags { display: flex; flex-wrap: wrap; gap: var(--sp-line) 12px; }
/* direct children only: the star count is a <span> inside <a> and would get double brackets */
.tags > a, .tags > span {
  font-family: var(--sans); font-size: var(--fs-sm); font-weight: var(--bold);
  color: var(--link);
  transition: color .18s ease;
}
.tags > a::before, .tags > span::before { content: "["; opacity: .5; }
.tags > a::after,  .tags > span::after  { content: "]"; opacity: .5; }
.tags > a:hover { color: var(--heading); text-decoration: none; }   /* darker color instead of underline */
.tags > span { color: var(--subtle); }
/* GitHub star count: thin divider, secondary color, tabular digits */
.tags .gh-stars {
  margin-left: 6px; padding-left: 6px;
  border-left: 1px solid var(--rule);
  color: var(--subtle); font-variant-numeric: tabular-nums;
}

/* ---------- entries (experience / projects / writing) ---------- */
/* Second row spans full width, so sub-entries start at the left edge: they're entries, not title notes. */
.item {
  display: grid; grid-template-columns: 76px 1fr;
  column-gap: 16px; padding: calc(var(--sp-entry) / 2) 0;
}
.ilogo {
  grid-column: 1; grid-row: 1; align-self: center;
  display: flex; align-items: center; justify-content: center;
}
/* No fixed slot height (wide logos like the 7:1 mikomiko would float in a tall gap); row height
   follows the title column, logos only get a max height. */
.ilogo img { max-width: 100%; max-height: 42px; width: auto; height: auto; }
/* Round badges look heavier at equal height, but 34px (the NUS shield's width) looks small; 38px matches
   by area. Keyed on src: renaming the file silently breaks this. */
.ilogo img[src$="zju.png"] { max-height: 38px; }
/* min-width: 0, else a grid item's min size is its content and long org names overflow instead of wrapping */
.ihead { grid-column: 2; grid-row: 1; min-width: 0; }
.irest { grid-column: 1 / -1; margin-top: var(--sp-row); }
.item .row {
  display: flex; justify-content: space-between;
  align-items: baseline; gap: var(--sp-line) 16px; flex-wrap: wrap;
}
/* title shrinks and wraps internally; otherwise a long title pushes the date to the next line's left */
.item .t { flex: 1 1 340px; min-width: 0; }
.item .d { flex: 0 0 auto; }
.item .t { font-family: var(--sans); font-size: var(--fs-md); font-weight: var(--bold); text-wrap: pretty; }
.item .d {
  font-family: var(--sans); font-size: var(--fs-sm); color: var(--subtle);
  white-space: nowrap;
}
.item .s { font-size: var(--fs-sm); color: var(--subtle); margin-top: var(--sp-line); text-wrap: pretty; }
.item .s .me, .pub .authors .me { font-weight: var(--bold); color: var(--fg); }

/* Sub-items (e.g. RA under ZJU) each get their own short left bar; one continuous bar reads as a
   blockquote. .prow: one-line output; .pitem: title + date + text, smaller title so it reads as nested. */
.item .plist > .prow, .item .plist > .pitem {
  border-left: 2px solid var(--rule); padding-left: 14px; font-size: var(--fs-sm);
}
.item .plist > * + * { margin-top: var(--sp-row); }
.item .plist .row .t { font-size: var(--fs-sm); font-weight: var(--bold); }
/* Product status tag: set apart from the name by color and italic, not size */
.item .pst {
  font-family: var(--sans); font-style: italic; color: var(--subtle);
  white-space: nowrap;
}
/* Handle shows "..." and fades to data-h on hover / focus. Pseudo-element text can't be selected or
   copied, and keeps its width while transparent, so nothing jumps. */
.item .handle { position: relative; display: inline-block; outline: none; }
.item .handle::before { content: attr(data-h); opacity: 0; transition: opacity .6s ease; }
.item .handle::after { content: "..."; position: absolute; left: 0; top: 0; transition: opacity .6s ease; }
.item .handle:hover::before, .item .handle:focus-visible::before { opacity: 1; }
.item .handle:hover::after, .item .handle:focus-visible::after { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .item .handle::before, .item .handle::after { transition: none; } }
.item .t a { color: inherit; }
.item .t a:hover { color: inherit; }
.item ul { margin: var(--sp-line) 0 0; padding-left: 18px; font-size: var(--fs-sm); text-wrap: pretty; }
.item li + li { margin-top: var(--sp-line); }
.item li::marker { color: var(--accent); }


/* ---------- visitor map ---------- */
/* No heading, rule or caption: just the map, set off by the section gap like any section. */
.vmap {
  position: relative;
  width: 80%; margin: 0 auto;   /* narrower than the text, so it reads as an ornament */
  --vmap-dot: #dadada;          /* land dots: lighter than --rule, a background texture */
  --vmap-pin: var(--accent);    /* single-color fallback when the API gives no ago */

  /* Color by recency: accent (this week) → light blue (a month) → transparent (6+ months) */
  --vmap-hot:  var(--accent);
  --vmap-mid:  color-mix(in oklab, var(--accent) 50%, #fff);
}
.vmap-land { display: block; width: 100%; }
.vmap-pins { position: absolute; inset: 0; }
/* <button>, not <span>: keyboard-focusable, and screen readers announce city and count */
.vmap-pin {
  position: absolute; width: var(--s); height: var(--s);
  margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  padding: 0; border: 0; border-radius: 50%;
  color: var(--vmap-pin);          /* JS overrides with the recency color; the rest uses currentColor */
  background: currentColor;
  /* Thin white ring: invisible on the light map but separates overlapping dots.
     --fade (from JS, by visit age) fades the ring with the dot. */
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .9);
  opacity: calc(.8 * var(--fade, 1)); cursor: pointer;
  transition: transform .2s ease, opacity .2s ease;
}
.vmap-pin:hover, .vmap-pin:focus-visible {
  transform: scale(1.4); opacity: 1; outline: none; z-index: 1;
}
/* One city per line (JS joins with newlines). Fixed 20px offset above the pin, not a multiple of its
   own height, which drifts as lines grow. */
.vmap-tip {
  position: absolute; transform: translate(-50%, calc(-100% - 20px));
  font-family: var(--sans); font-size: var(--fs-xs); white-space: pre; line-height: 1.5;
  padding: 4px 9px; border-radius: 6px;
  background: var(--fg); color: var(--bg);
  pointer-events: none; z-index: 2;
}
/* ---------- footer ---------- */
/* Must be footer.wrap: the footer has class="wrap", whose margin/padding would beat a bare footer selector. */
footer.wrap {
  margin: 64px auto 0; padding: 60px 22px 40px;
  border-top: 1px solid var(--rule);
  font-family: var(--sans); font-size: var(--fs-xs); color: var(--subtle);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center;
}
/* Partner link, the row above the copyright, set like the hero's invitation ("Visit 👉 Gallery"): the
   whole line italic with the emoji upright (Chinese slanted too, as in the hero), the name bold in the link blue. It runs at --fs-sm, a step
   above the 13px fine print below it, so the text holds its own beside the 26px icon; at 13px the icon
   dwarfed the words and the 👉. The chibi Vitruvian figure stands where the hero has the 🖼️ emoji,
   whole, with its own circle and square as the frame (no badge crop): a small-size cut of the full
   drawing, line art only, heavier lines, no texture or hatching. The icon path is absolute so the same
   i18n string works on every page. */
footer .partner { font-size: var(--fs-sm); font-style: italic; }
footer .partner .emo { font-style: normal; }
footer .partner img { width: 26px; height: 26px; margin: 0 6px 0 3px; vertical-align: middle; }

/* Reduced motion: effectively disable transitions and animations */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

/* ---------- entrance ----------
   Homepage: one .rise (the whole <main>); gallery: one per heading, line and photo row. JS writes --d to stagger. */
/* Visible by default, so content still shows if reveal.js fails; hidden only once reveal.js
   (sync in <head>) adds .js-rise. */
.js-rise .rise {
  opacity: 0; transform: translateY(24px);
  transition: opacity .8s cubic-bezier(.32,.72,0,1),
              transform .8s cubic-bezier(.32,.72,0,1);
  transition-delay: var(--d, 0ms);
}
.js-rise .rise.in { opacity: 1; transform: none; }
/* No scroll anchoring: on reload it mistakes the 24px rise for a content shift and scrolls 24px further
   each time, pushing the sheet under the nav. */
.rise { overflow-anchor: none; }

/* Focus entrance, after the opening of the RUIBench demo video: pieces come into focus from a blur in turn.
   Each comes in as it scrolls into view (reveal.js). Gallery: every .rise is one piece (heading, line, photo
   row); homepage: each section below News is one, entering whole (one a tall screen shows at load follows
   News, --nested-from). Same motion, timing and spacing as the homepage's first-screen pieces below
   (reveal.js's --d steps 120 ms, as they do). The homepage's <main> is excluded:
   one sheet thousands of px tall, it only fades, and the pieces on its first screen carry the blur (below). */
.js-rise .rise:not(main) {
  filter: blur(var(--blur, 6px)); transform: translateY(6px) scale(.985);
  transition: opacity .65s var(--ease-focus), filter .65s var(--ease-focus), transform .65s var(--ease-focus);
  transition-delay: var(--d, 0ms);
}
.js-rise .rise.in:not(main) { filter: none; transform: none; }
.js-rise h2.rise { --blur: 10px; }

/* Homepage first screen: built piece by piece. The sheet only fades in, a still ground; on it each piece comes
   into focus in turn (name, role, invitation, the contact links left to right like the video's row of agent
   icons, Biography, News; the Chinese name comes in with the English one). The avatar keeps its own
   noise-to-image entrance (index.html), which starts with the sheet. The sheet itself never blurs: it is
   the whole page; the sections below News blur one at a time, as each scrolls in (above), at Biography's
   5 px. */
.js-rise main.rise { transform: translateY(10px); transition-duration: .5s; --nested-from: 900ms; }
.js-rise main section.rise { --blur: 5px; }
.js-rise main.rise :is(.hero h1, .hero .role, .hero .affil, .links > *, #biography, #news) {
  opacity: 0; filter: blur(var(--blur, 6px)); transform: translateY(var(--from-y, 6px)) scale(var(--from-s, .985));
  transition: opacity .65s var(--ease-focus), filter .65s var(--ease-focus), transform .65s var(--ease-focus);
  transition-delay: var(--bi, 0ms);
}
/* Per-piece values are custom properties: :is() takes the specificity of #biography, so a plain declaration
   on a lighter selector would lose to it. */
.js-rise main.rise.in :is(.hero h1, .hero .role, .hero .affil, .links > *, #biography, #news) {
  opacity: 1; filter: none; transform: none;
}
.js-rise main.rise .hero h1   { --bi: 80ms; --blur: 10px; }
.js-rise main.rise .hero .role  { --bi: 200ms; }
.js-rise main.rise .hero .affil { --bi: 320ms; }
.js-rise main.rise .links > *   { --bi: calc(440ms + var(--i, 0) * 70ms); --from-y: 4px; --from-s: .9; }
.links > :nth-child(2) { --i: 1; }
.links > :nth-child(3) { --i: 2; }
.links > :nth-child(4) { --i: 3; }
.links > :nth-child(5) { --i: 4; }
.links > :nth-child(6) { --i: 5; }
.links > :nth-child(7) { --i: 6; }
.links > :nth-child(8) { --i: 7; }
.js-rise main.rise #biography { --bi: 780ms; --blur: 5px; }
.js-rise main.rise #news      { --bi: 900ms; --blur: 5px; }
/* The avatar comes into focus while it denoises (both start as the sheet enters). A keyframe animation, not a
   transition: .avatar-wrap's transition list belongs to the hover tilt, and re-declaring it here would slow the
   hover. It touches opacity, filter and the separate scale property, never transform, which the tilt owns.
   Backwards fill only: after the animation the plain styles apply again, so no filter is left on the wrap. */
.js-rise main.rise .avatar-wrap { opacity: 0; }
.js-rise main.rise.in .avatar-wrap { opacity: 1; animation: avatar-focus .7s var(--ease-focus) 100ms backwards; }
@keyframes avatar-focus { from { opacity: 0; filter: blur(10px); scale: .96; } }

@media (prefers-reduced-motion: reduce) {
  .rise { opacity: 1; transform: none; transition: none; }
}
