/* Styles for zezeaaa.github.io.
   One hand-written file, no framework. Colours and sizes are custom properties on :root; the
   dark theme (same palette as the X-Splat project page) only overrides those properties. */

/* ------------------------------------------------------------------ fonts */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/site/inter-latin-wght.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* The three characters of the Chinese name, nothing else. */
@font-face {
  font-family: "Noto Serif SC Name";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/site/noto-serif-sc-name.woff2") format("woff2");
  unicode-range: U+6CFD, U+738B, U+8BB8;
}

/* ----------------------------------------------------------------- tokens */

:root {
  color-scheme: light;
  --bg: #fcfcfb;
  --bg-alt: #f3f4f6;
  --surface: #ffffff;
  --line: #e5e7eb;
  --line-strong: #cdd1d8;
  --text: #14161b;
  --muted: #565d6b;
  --faint: #697080;
  --accent: #0b63ce;
  --accent-soft: #e6effc;
  --accent-ink: #0a4da3;
  --ok: #1f9d63;
  --warm: #ff9a62;
  --glow: 11%;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 12px 32px -16px rgba(16, 24, 40, 0.18);

  --radius: 14px;
  --radius-sm: 9px;
  --wrap: 62rem;
  --gutter: clamp(1.15rem, 4vw, 2rem);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "PingFang SC",
    "Hiragino Sans", "Microsoft YaHei", sans-serif;
  --serif-zh: "Noto Serif SC Name", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --figure-filter: none;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0b0f;
  --bg-alt: #12141c;
  --surface: #171a23;
  --line: #232836;
  --line-strong: #353c4d;
  --text: #e9ecf4;
  --muted: #a0a8ba;
  --faint: #7a8296;
  --accent: #8fd0ff;
  --accent-soft: rgba(143, 208, 255, 0.13);
  --accent-ink: #b5e0ff;
  --ok: #4ad295;
  --glow: 9%;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
  --figure-filter: brightness(0.8);
}

/* Without JavaScript nothing sets data-theme, so follow the system setting directly. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0a0b0f;
    --bg-alt: #12141c;
    --surface: #171a23;
    --line: #232836;
    --line-strong: #353c4d;
    --text: #e9ecf4;
    --muted: #a0a8ba;
    --faint: #7a8296;
    --accent: #8fd0ff;
    --accent-soft: rgba(143, 208, 255, 0.13);
    --accent-ink: #b5e0ff;
    --ok: #4ad295;
    --glow: 9%;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
    --figure-filter: brightness(0.8);
  }
}

/* ------------------------------------------------------------------- base */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}

body {
  position: relative;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

/* A faint two-tone glow behind the top of the page; it scrolls away with the introduction. */
body::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: -1;
  height: 36rem;
  background:
    radial-gradient(44rem 24rem at 84% -8%, color-mix(in srgb, var(--accent) var(--glow), transparent), transparent 72%),
    radial-gradient(38rem 20rem at 6% -14%, color-mix(in srgb, var(--warm) var(--glow), transparent), transparent 72%);
  pointer-events: none;
}

h1,
h2,
h3,
p,
ul,
ol,
figure {
  margin: 0;
}

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

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 32%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-color 0.15s ease, color 0.15s ease;
}

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

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

::selection {
  background: color-mix(in srgb, var(--accent) 26%, transparent);
}

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.muted {
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0.75rem;
}

.icon {
  width: 1.05em;
  height: 1.05em;
  flex: none;
}

/* ----------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
}

/* At the very top the bar is clear, so the glow behind the introduction is not cut by a strip. */
.js .site-header:not(.is-scrolled) {
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.5rem;
}

.brand {
  flex: none;
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.015em;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 0.15rem;
  margin-left: auto;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-links::-webkit-scrollbar {
  display: none;
}

.nav-links a {
  display: block;
  padding: 0.38rem 0.72rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.925rem;
  font-weight: 520;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-links a:hover,
.nav-links a[aria-current] {
  color: var(--text);
  background: var(--bg-alt);
}

.theme-toggle {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 1.05rem;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--bg-alt);
}

.theme-icon {
  display: none;
  line-height: 0;
}

/* The icon shows the colours in use: a sun in the light theme, a moon in the dark one. */
:root:not([data-theme="dark"]) .theme-icon-light,
:root[data-theme="dark"] .theme-icon-dark {
  display: block;
}

/* Without JavaScript the button could not do anything. */
:root:not(.js) .theme-toggle {
  display: none;
}

/* ------------------------------------------------------------------- hero */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "head  photo"
    "body  photo";
  column-gap: clamp(2rem, 6vw, 4.5rem);
  align-items: start;
  padding-block: clamp(2.5rem, 7vw, 4.75rem) clamp(2.25rem, 5vw, 3.5rem);
}

.hero-head {
  grid-area: head;
}

.hero-body {
  grid-area: body;
}

.hero-photo {
  grid-area: photo;
  width: clamp(12rem, 25vw, 17rem);
  margin-top: 0.4rem;
}

.hero-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.hero-photo.is-round img {
  border-radius: 50%;
}

.name {
  font-size: clamp(2.15rem, 5.4vw, 3.3rem);
  font-weight: 680;
  line-height: 1.08;
  letter-spacing: -0.032em;
}

.name .nowrap {
  white-space: nowrap;
  font-weight: 400;
  color: var(--muted);
}

.name .title-zh {
  font-family: var(--serif-zh);
  font-weight: 500;
  font-size: 0.86em;
  letter-spacing: 0.02em;
  color: var(--text);
}

.role {
  margin-top: 0.7rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.2vw, 1.2rem);
}

.hero-body {
  margin-top: 1.5rem;
}

.prose p + p,
.prose p + ul,
.prose ul + p {
  margin-top: 0.85em;
}

.prose ul {
  padding-left: 1.2rem;
}

.prose li + li {
  margin-top: 0.3em;
}

.prose li::marker {
  color: var(--faint);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.6rem;
  padding: 0;
  list-style: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.46rem 0.9rem 0.46rem 0.78rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.925rem;
  font-weight: 530;
  line-height: 1.3;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.chip:hover {
  border-color: var(--text);
  transform: translateY(-1px);
}

.chip-strong {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.chip-strong:hover {
  background: transparent;
  color: var(--text);
}

.status {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.15rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.status-dot {
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--faint);
}

.status[data-state="awake"] .status-dot {
  background: var(--ok);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent);
  animation: pulse 2.6s ease-out infinite;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 0.45rem transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

/* --------------------------------------------------------------- sections */

.section {
  padding-block: clamp(2rem, 5vw, 3rem);
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1.5rem;
  margin-bottom: 1.5rem;
}

.section h2,
.page-head h1 {
  font-weight: 670;
  letter-spacing: -0.022em;
  line-height: 1.2;
}

.section h2 {
  font-size: 1.5rem;
}

.section-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.925rem;
  font-weight: 530;
  text-decoration: none;
}

.section-link .icon {
  transition: transform 0.15s ease;
}

.section-link:hover .icon {
  transform: translateX(3px);
}

/* Sections fade up once as they enter the viewport (only when motion is welcome). */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .js [data-reveal].is-visible {
    opacity: 1;
    transform: none;
  }
}

/* ------------------------------------------------------- news and honors */

.news-list {
  display: grid;
  gap: 0.1rem;
  padding: 0;
  list-style: none;
}

.news-list li {
  display: grid;
  grid-template-columns: 7.25rem minmax(0, 1fr);
  gap: 1rem;
  padding-block: 0.42rem;
}

.news-list time {
  color: var(--faint);
  font-size: 0.925rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.83;
  white-space: nowrap;
}

.more {
  margin-top: 0.4rem;
}

.more summary {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem 0.3rem 0.5rem;
  margin-left: -0.5rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.925rem;
  font-weight: 530;
  cursor: pointer;
  list-style: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.more summary::-webkit-details-marker {
  display: none;
}

.more summary:hover {
  color: var(--text);
  background: var(--bg-alt);
}

.more summary .icon {
  transition: transform 0.2s ease;
}

.more[open] summary .icon {
  transform: rotate(180deg);
}

.more[open] summary {
  margin-bottom: 0.3rem;
}

/* ----------------------------------------------------------- publications */

.pubs ol.bibliography {
  display: grid;
  gap: clamp(1.75rem, 4vw, 2.25rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.pubs h2.bibliography {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2.75rem 0 1.5rem;
  color: var(--faint);
  font-size: 0.95rem;
  font-weight: 620;
  letter-spacing: 0.08em;
}

.pubs h2.bibliography::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.pubs h2.bibliography:first-child {
  margin-top: 0;
}

.pub {
  display: grid;
  grid-template-columns: 19rem minmax(0, 1fr);
  gap: clamp(1.25rem, 3vw, 1.9rem);
  align-items: start;
}

/* An entry without a preview picture uses the full width. */
.pub-text-only {
  grid-template-columns: minmax(0, 1fr);
}

.pub-media {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  line-height: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

:root[data-theme="dark"] .pub-media {
  background: #0d0f15;
}

.pub:hover .pub-media {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.pub-media img,
.pub-media video {
  display: block;
  width: 100%;
  height: auto;
}

.pub-media video {
  background: #000;
}

.zoom {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

/* A diagram on white is the brightest thing on a dark page. It is held back until the reader
   turns to its card; the enlarged view always shows it as it is. */
.zoom img {
  filter: var(--figure-filter);
  transition: filter 0.2s ease;
}

.pub:hover .zoom img,
.zoom:focus-visible img {
  filter: none;
}

.pub-tag {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.74rem;
  font-weight: 660;
  letter-spacing: 0.055em;
  line-height: 1.4;
  text-transform: uppercase;
}

.pub-title {
  margin-top: 0.55rem;
  font-size: 1.125rem;
  font-weight: 640;
  letter-spacing: -0.012em;
  line-height: 1.36;
  text-wrap: balance;
}

.pub-authors {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.pub-authors a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-decoration-style: dotted;
}

.pub-authors a:hover {
  color: var(--text);
  text-decoration-style: solid;
}

.pub-authors .me {
  color: var(--text);
  font-weight: 650;
}

.pub-authors sup {
  font-size: 0.72em;
  line-height: 0;
}

.pub-venue {
  margin-top: 0.25rem;
  color: var(--faint);
  font-size: 0.9rem;
  line-height: 1.5;
}

.pub-tldr {
  margin-top: 0.55rem;
  font-size: 0.95rem;
  line-height: 1.55;
  text-wrap: pretty;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.85rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  padding: 0.3rem 0.66rem 0.3rem 0.56rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: 530 0.82rem/1.35 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  border-color: var(--text);
  background: var(--bg-alt);
}

.btn-toggle {
  border-style: dashed;
}

.btn-toggle[aria-expanded="true"] {
  border-style: solid;
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.pub-panel {
  position: relative;
  margin-top: 0.85rem;
  padding: 0.95rem 1.1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  color: var(--muted);
  font-size: 0.925rem;
  line-height: 1.62;
}

/* Panels are collapsed until their button is pressed; without JavaScript they stay readable. */
.js .pub-panel:not(.is-open) {
  display: none;
}

.pub-bibtex {
  padding-right: 5.6rem;
}

.pub-bibtex pre {
  margin: 0;
  color: var(--text);
  font: 0.8rem/1.6 var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
}

.btn-copy {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  background: var(--surface);
}

:root:not(.js) .btn-copy,
:root:not(.js) .btn-toggle {
  display: none;
}

.pub-filter {
  margin-bottom: 2rem;
}

.pub-filter input {
  width: min(100%, 26rem);
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}

.pub-filter input::placeholder {
  color: var(--faint);
}

.pub-filter p {
  margin-top: 1.25rem;
}

:root:not(.js) .pub-filter {
  display: none;
}

/* --------------------------------------------- education and experience */

.cv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem clamp(2rem, 5vw, 3.5rem);
}

.cv-col h3 {
  margin-bottom: 1rem;
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 660;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.cv-list {
  display: grid;
  gap: 1.3rem;
  padding: 0;
  list-style: none;
}

.cv-item {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: 0.95rem;
  align-items: start;
}

.cv-logo {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0.34rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
}

.cv-logo picture {
  display: contents;
}

.cv-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cv-title {
  font-weight: 630;
  line-height: 1.4;
}

.cv-title a {
  color: inherit;
  text-decoration-color: transparent;
}

.cv-title a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.cv-sub {
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.55;
}

.cv-sub a {
  color: inherit;
}

.cv-sub a:hover {
  color: var(--accent);
}

.cv-meta {
  margin-top: 0.15rem;
  color: var(--faint);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------ visitor map */

/* A small sign-off below the contact note, not a section of its own. */
.visitors {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: clamp(2rem, 5vw, 3rem);
}

.vmap {
  position: relative;
  width: min(100%, 23rem);
}

.vmap-land,
.vmap-markers {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.vmap-markers {
  overflow: visible;
}

.vmap-markers circle {
  fill: var(--accent);
  fill-opacity: 0.45;
  stroke: var(--accent);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  transition: fill-opacity 0.15s ease;
}

.vmap-markers circle.is-active {
  fill-opacity: 0.95;
}

.vmap-tip {
  position: absolute;
  z-index: 1;
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.76rem;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 7px));
}

.vmap-caption {
  color: var(--faint);
  font-size: 0.8rem;
  text-align: center;
}

/* Shown only when the map is drawn from a local sample file. */
.sample-flag {
  margin-left: 0.3rem;
  padding: 0.1rem 0.45rem;
  border-radius: 5px;
  background: #fff1c9;
  color: #7a4f00;
  font-weight: 620;
}

:root[data-theme="dark"] .sample-flag {
  background: rgba(255, 196, 64, 0.16);
  color: #ffd98a;
}

/* ---------------------------------------------------------------- contact */

.contact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  text-align: center;
}

.contact p {
  max-width: 34rem;
  color: var(--muted);
}

/* ------------------------------------------------------------ inner pages */

.page {
  padding-block: clamp(2.25rem, 6vw, 3.75rem) clamp(2rem, 5vw, 3rem);
}

.page-head {
  margin-bottom: 2rem;
}

.page-head h1 {
  font-size: clamp(1.9rem, 4.5vw, 2.5rem);
}

.lede {
  margin-top: 0.6rem;
  color: var(--muted);
}

.page > p {
  margin-top: 1em;
}

/* -------------------------------------------------------------------- 404 */

.lost {
  text-align: center;
}

/* The digits: plain text at first, replaced by the canvas once assets/js/lost.js has drawn them. */
.lost-stage {
  position: relative;
  height: clamp(10rem, 36vw, 19rem);
  margin-bottom: 0.75rem;
  touch-action: pan-y;
}

.lost-code {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: clamp(6rem, 24vw, 14rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

.lost-canvas {
  position: absolute;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
  /* blobs that drift out fade away at the edges instead of being cut off */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent),
    linear-gradient(transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent),
    linear-gradient(transparent, #000 10%, #000 90%, transparent);
  mask-composite: intersect;
}

.lost-stage.is-live .lost-code {
  visibility: hidden;
}

.lost-stage.is-live .lost-canvas {
  display: block;
}

.lost h1 {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
}

.lost .lede {
  max-width: 34rem;
  margin-inline: auto;
}

.lost code {
  font-family: var(--mono);
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

.lost-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 1.6rem;
}

.lost-links .btn {
  padding: 0.45rem 0.9rem;
  font-size: 0.9rem;
}

/* ----------------------------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.875rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.3rem 1.5rem;
  padding-block: 1.6rem 2.4rem;
}

.site-footer a {
  color: inherit;
}

.site-footer a:hover {
  color: var(--text);
}

/* --------------------------------------------------------------- lightbox */

.lightbox {
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  cursor: zoom-out;
}

.lightbox::backdrop {
  background: rgba(6, 7, 11, 0.86);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.lightbox img {
  display: block;
  max-width: 94vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  background: #fff;
}

/* ----------------------------------------------------------- small screens */

@media (max-width: 45.99rem) {
  body {
    font-size: 1rem;
  }

  .brand {
    display: none;
  }

  .nav {
    gap: 0.25rem;
  }

  .nav-links {
    gap: 0;
    margin-left: -0.55rem;
    margin-right: auto;
  }

  .nav-links a {
    padding-inline: 0.55rem;
    font-size: 0.9rem;
  }

  .hero {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "photo head"
      "body  body";
    column-gap: 1rem;
    align-items: center;
  }

  .hero-photo {
    width: 5.5rem;
    margin-top: 0;
  }

  .hero-photo img {
    border-radius: 16px;
  }

  .name {
    font-size: clamp(1.7rem, 7.4vw, 2.15rem);
  }

  .role {
    margin-top: 0.4rem;
    font-size: 0.98rem;
  }

  .news-list li {
    grid-template-columns: 6.3rem minmax(0, 1fr);
    gap: 0.75rem;
  }

  .news-list time {
    font-size: 0.86rem;
    line-height: 1.86;
  }

  .pub {
    grid-template-columns: minmax(0, 1fr);
  }

  .cv-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .pub-bibtex {
    padding-right: 1.1rem;
    padding-bottom: 3.2rem;
  }

  .btn-copy {
    top: auto;
    bottom: 0.7rem;
  }
}

@media (min-width: 46rem) and (max-width: 58rem) {
  .pub:not(.pub-text-only) {
    grid-template-columns: 15rem minmax(0, 1fr);
  }
}

/* ------------------------------------------------------- page transitions
   Moving between pages of the site, what both pages show stays or moves instead of being
   replaced: the top bar stays where it is, and a publication card that is on both pages
   slides from its old place to its new one (site.js and the script in the head give the cards
   their names). Everything else cross-fades, the new page rising slightly into place.
   This needs view transitions between pages (Chrome, Edge, Safari). A browser without them
   only fades the new page in ("page-enter", set by the script in the head). */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }

  .site-header {
    view-transition-name: site-header;
  }

  ::view-transition-old(root) {
    animation: 0.3s ease-in both page-fade-out;
  }

  ::view-transition-new(root) {
    animation: 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) 0.12s both page-rise;
  }

  /* A card on both pages travels from its old place to its new one, its old and new pictures
     blending on the way. The class keeps these rules to the cards. */
  .pub {
    view-transition-class: pub;
  }

  ::view-transition-group(*.pub) {
    animation-duration: 0.7s;
    animation-timing-function: cubic-bezier(0.3, 0.7, 0.15, 1);
  }

  ::view-transition-old(*.pub),
  ::view-transition-new(*.pub) {
    height: 100%;
    object-fit: cover;
    object-position: top;
  }

  /* A card on one of the two pages only leaves or arrives with the rest of its page. */
  ::view-transition-old(*.pub):only-child {
    animation: 0.18s ease-out both page-fade-out;
  }

  ::view-transition-new(*.pub):only-child {
    animation: 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) 0.12s both page-rise;
  }

  .page-enter main,
  .page-enter .site-footer {
    animation: 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both page-rise;
  }

  /* A change of colour theme opens in a circle from its button; site.js draws the circle.
     The fade above, the separate top bar and the colour transitions of single elements would
     all show through it, so they are off while it runs. */
  .theme-switching::view-transition-old(root),
  .theme-switching::view-transition-new(root) {
    animation: none !important;
    mix-blend-mode: normal;
  }

  .theme-switching .site-header,
  .theme-switching .pub {
    view-transition-name: none !important;
  }

  .theme-switching *,
  .theme-switching *::before,
  .theme-switching *::after {
    transition: none !important;
  }
}

@keyframes page-fade-out {
  to {
    opacity: 0;
  }
}

@keyframes page-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .site-header,
  .theme-toggle,
  .pub-links,
  .skip-link {
    display: none;
  }

  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
