/* ==========================================================================
   publications.css — research section (toolbar, cards, list, BibTeX popover)
   Prefixes: .pubs* (section) · .pub* (a paper) · .pub-grid/.pub-item/.pub-list/.pub-row
   Consumes tokens only (no hard-coded colors) so both themes work.
   ========================================================================== */

.pubs {
  --pub-gap: clamp(14px, 2vw, 24px);
  --pub-pad: clamp(18px, 2.3vw, 28px);
  --pub-chip-h: 34px;
  --pub-px: var(--pub-pad); /* card side padding (16px on the narrowest phones, set below) */
  /* text-input boundary >= 3:1 against the page (WCAG 1.4.11) */
  --pub-field-line: var(--text-3);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(22px, 3vw, 34px);
  min-width: 0;
}

.pubs [hidden] {
  display: none !important;
}

@supports (color: color-mix(in srgb, red, blue)) {
  .pubs {
    --pub-field-line: color-mix(in srgb, var(--text-3) 75%, transparent);
  }
}

/* --------------------------------------------------------------------------
   Toolbar
   -------------------------------------------------------------------------- */
.pubs__bar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pubs__search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 54px;
  padding: 0 12px 0 18px;
  border: 1px solid var(--pub-field-line);
  border-radius: var(--r-md);
  background: var(--panel);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  cursor: text;
  transition: border-color var(--dur-2), box-shadow var(--dur-3) var(--ease), background var(--dur-2);
}
@media (hover: hover) and (pointer: fine) {
  .pubs__search:hover {
    border-color: var(--line-accent);
  }
}
.pubs__search:focus-within {
  border-color: var(--accent);
  box-shadow: var(--glow-sm);
  background: var(--panel-hover);
}
.pubs__mag {
  flex: none;
  display: inline-flex;
  color: var(--text-3);
  transition: color var(--dur-2);
}
.pubs__search:focus-within .pubs__mag {
  color: var(--accent);
}
.pubs__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  caret-color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.01em;
  -webkit-appearance: none;
  appearance: none;
}
.pubs__input::placeholder {
  color: var(--text-3);
  opacity: 1;
}
.pubs__input::-webkit-search-decoration,
.pubs__input::-webkit-search-cancel-button,
.pubs__input::-webkit-search-results-button {
  -webkit-appearance: none;
  display: none;
}
.pubs__kbd {
  flex: none;
}
.pubs__search:focus-within .pubs__kbd,
.pubs__search.has-value .pubs__kbd {
  display: none;
}
.pubs__clear {
  flex: none;
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--text-3);
  transition: color var(--dur-1), background var(--dur-2);
}
.pubs[data-shortcuts="off"] .pubs__kbd,
.pubs[data-shortcuts="off"] .pubs__hint {
  display: none;
}
@media (hover: hover) and (pointer: fine) {
  .pubs__clear:hover {
    color: var(--text);
    background: rgba(var(--accent-rgb), 0.1);
  }
}
.pubs__search.has-value .pubs__clear {
  display: inline-flex;
}

/* chips */
.pubs__filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px 28px;
}
.pubs__group {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}
.pubs__glabel {
  flex: none;
  /* sits on the first chip row's center line, however many rows the chips wrap to */
  padding-top: calc((var(--pub-chip-h) - 1em) / 2);
  color: var(--text-3);
  font-size: var(--fs-micro);
  line-height: 1;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
.pubs__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.pubs__chip {
  min-height: var(--pub-chip-h);
  white-space: nowrap;
}
/* calm dark: the selected chip is a brighter neutral (text + hairline + faint tint), not a cyan glow */
:root:not([data-theme="light"]) .pubs__chip[aria-pressed="true"] {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--line);
  box-shadow: none;
}
.pubs__chip.is-empty {
  opacity: 0.38;
  cursor: not-allowed;
}
@media (hover: hover) and (pointer: fine) {
  .pubs__chip.is-empty:hover {
    color: var(--text-2);
    border-color: var(--line);
  }
}

/* labels that sit straight on the WebGL backdrop use --text-2 (--text-3 dips under 4.5:1 over hazy pixels) */
.pubs__glabel,
.pubs__chip .chip__count,
.pub-row__year {
  color: var(--text-2);
}
.pub-row__venue .pub__venue {
  color: var(--text-2);
}

/* results line */
.pubs__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 26px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-2);
}
.pubs__meta-l {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 14px;
  min-width: 0;
}
.pubs__status {
  letter-spacing: 0.02em;
}
.pubs__status b {
  color: var(--text);
  font-weight: 500;
}
.pubs__reset {
  padding: 4px 0;
  color: var(--accent);
  font-family: inherit;
  font-size: inherit;
  letter-spacing: 0.02em;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size var(--dur-3) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .pubs__reset:hover {
    background-size: 100% 1px;
  }
}
.pubs__hint {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.03em;
}
/* dark: the search box already shows its "/" key — drop the duplicate line */
:root:not([data-theme="light"]) .pubs__hint {
  display: none;
}

/* --------------------------------------------------------------------------
   Stage: quiet headings, grid, list
   -------------------------------------------------------------------------- */
.pubs__stage {
  min-width: 0;
}
.pubs__h {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: clamp(34px, 5.5vw, 60px) 0 clamp(16px, 2.2vw, 24px);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
.pubs__h::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}
/* group count ("5 papers"): a quiet gray tally, deliberately unlike the cyan 01-06 section numerals */
.pubs__h-n {
  order: 2;
  color: var(--text-3);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: none;
  white-space: nowrap;
}
.pubs__h-t {
  order: 0;
}
.pubs__h::after {
  order: 1;
}

.pub-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--pub-gap);
}
.pub-grid--hero {
  grid-template-columns: minmax(0, 1fr);
}
.pub-item {
  display: flex;
  min-width: 0;
}
.pub-item > .pub {
  flex: 1;
  min-width: 0;
}
.pub-item--wide,
.pub-item--hero {
  grid-column: 1 / -1;
}
.pub-item--pop {
  animation: pub-pop 0.55s var(--ease-out) both;
  animation-delay: calc(var(--k, 0) * 45ms);
}
@keyframes pub-pop {
  from {
    opacity: 0;
    transform: translate3d(0, 14px, 0) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Paper card
   -------------------------------------------------------------------------- */
.pub {
  scroll-margin-top: calc(var(--nav-h) + 24px);
}
.pub.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.pub--feature.panel {
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.07), transparent 42%), var(--panel);
  border-color: var(--line-strong);
}
/* calm dark: the featured card is set apart by its size and a stronger hairline, not by a coloured wash */
:root:not([data-theme="light"]) .pub--feature.panel {
  background: var(--panel);
}

/* teaser frame */
.pub__frame {
  position: relative;
  flex: none;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  isolation: isolate;
  background: var(--bg-sunk);
  border-bottom: 1px solid var(--line);
}
.pub__frame > img,
.pub__frame > canvas,
.pub__frame > video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pub__img {
  transition: transform 1.4s var(--ease-out), filter 0.5s var(--ease);
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* Figure teasers sit on one dark "mat" plate: fixed frame, the whole figure shown
   (object-fit: contain, never cropped), a hairline inset and a little padding. */
.pub__frame {
  container-type: inline-size;
}
@container (max-width: 270px) {
  .pub__cap {
    display: none; /* big text on a narrow plate would cover the figure */
  }
}
.pub__frame--img {
  aspect-ratio: 2 / 1; /* between the 2.4:1 sources and 16:9, so every card in a row aligns */
  background: var(--bg-sunk);
}
.pub__frame--img::before {
  content: "";
  position: absolute;
  inset: 8px;
  z-index: 1;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  pointer-events: none;
}
.pub__frame--img > img,
.pub__frame--img > video {
  inset: 12px;
  width: calc(100% - 24px);
  height: calc(100% - 24px);
  object-fit: contain;
  border-radius: 2px;
}
.pub__frame--img::after {
  display: none;
}
/* dark theme: the white-background figures are the brightest thing on the page; dim them a
   touch and restore on hover / focus. The teaser VIDEO (also a white background) never fully
   restores: it keeps a slightly deeper dim while it plays, so it is never brighter than the UI. */
:root:not([data-theme="light"]) .pub__frame--img > img {
  filter: brightness(0.86) contrast(1.04);
}
:root:not([data-theme="light"]) .pub__frame--img > video {
  filter: brightness(0.82) contrast(1.04);
}
:root:not([data-theme="light"]) .pub.panel:focus-within .pub__frame--img > img {
  filter: none;
}
@media (hover: hover) and (pointer: fine) {
  :root:not([data-theme="light"]) .pub.panel:hover .pub__frame--img > img {
    filter: none;
  }
}
/* The teaser video sits in the same inset box as the still (contain, never cropped, mat visible around
   it) and cross-fades with it: still out, video in, about 320 ms. (Reduced motion / the pause switch
   zero every transition globally, so the swap is then instant.) */
.pub__video {
  z-index: 1;
  opacity: 0;
  transition: opacity 0.32s var(--ease-out);
  pointer-events: none;
}
.pub__video.is-playing {
  opacity: 1;
}
.pub__frame--img > .pub__img {
  transition: transform 1.4s var(--ease-out), filter 0.5s var(--ease), opacity 0.32s var(--ease-out);
}
.pub__frame--img.is-playing > .pub__img {
  opacity: 0;
}
.pub__frame::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 42%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.5;
  background: linear-gradient(to top, var(--panel-solid), transparent);
}
.pub__cover {
  position: absolute;
  inset: 0;
  z-index: 2;
}
.pub__cap {
  position: absolute;
  left: 12px;
  bottom: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 24px);
  padding: 4px 8px;
  border-radius: var(--r-xs);
  background: var(--veil);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
  pointer-events: none;
  transition: opacity var(--dur-2);
}
.pub__cap .pub__ico {
  color: var(--accent);
}
:root:not([data-theme="light"]) .pub__cap .pub__ico {
  color: var(--text-3);
}
.pub__frame.is-playing .pub__cap {
  opacity: 0;
}

/* typographic placeholder (paper without a teaser figure) */
.pub__frame--type {
  aspect-ratio: 16 / 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background:
    radial-gradient(ellipse at 22% 18%, rgba(var(--accent-rgb), 0.14), transparent 60%),
    radial-gradient(ellipse at 82% 92%, rgba(var(--accent-2-rgb), 0.16), transparent 55%),
    var(--bg-sunk);
}
.pub__frame--type::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 15%, transparent 72%);
  mask-image: radial-gradient(ellipse at center, #000 15%, transparent 72%);
}
.pub__glyph {
  position: relative;
  z-index: 1;
  max-width: 90%;
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 1rem + 2.2vw, 2.5rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.1;
  text-align: center;
  overflow-wrap: anywhere;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
:root:not([data-theme="light"]) .pub__frame--type {
  background: radial-gradient(ellipse at 22% 18%, rgba(var(--accent-rgb), 0.1), transparent 60%), var(--bg-sunk);
}
:root:not([data-theme="light"]) .pub__glyph {
  background-image: linear-gradient(100deg, var(--accent) 0%, var(--text) 100%);
}
.pub__glyph-sub {
  position: relative;
  z-index: 1;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

/* body */
.pub__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  padding: var(--pub-pad);
}
.pub__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.pub__meta .badge {
  max-width: 100%;
}
.pub__badge-award .pub__ico {
  display: inline-flex;
}
.pub__badge-new::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pub-pulse 2.2s ease-in-out infinite;
}
@keyframes pub-pulse {
  50% {
    opacity: 0.35;
    transform: scale(0.8);
  }
}
/* calm dark: NEW / award are neutral grey status badges (wording + icon carry the meaning, not hue); the NEW dot is
   a still, unlit dot. Only venue badges keep their own colour. */
:root:not([data-theme="light"]) .pub__meta .badge--new,
:root:not([data-theme="light"]) .pub__meta .badge--award {
  --badge: var(--venue-preprint);
}
:root:not([data-theme="light"]) .pub__badge-new::before {
  box-shadow: none;
  animation: none;
}

.pub__title {
  margin-bottom: 10px;
  font-size: clamp(1.05rem, 0.98rem + 0.32vw, 1.2rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--text);
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.pub__title-a {
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: color var(--dur-2), background-size 0.55s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  a.pub__title-a:hover {
    color: var(--accent);
    background-size: 100% 1px;
  }
}
.pub__mark {
  padding: 0 1px;
  border-radius: 2px;
  background: rgba(var(--accent-rgb), 0.24);
  color: inherit;
}
.pub--feature .pub__title {
  font-size: clamp(1.3rem, 1rem + 1.15vw, 1.85rem);
  line-height: 1.22;
  letter-spacing: -0.025em;
}

/* authors */
.pub__authors {
  margin-bottom: 4px;
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.65;
  overflow-wrap: anywhere;
}
/* lines may break between authors (the ', ' is plain text inside .pub__au); a name never splits */
.pub__au-name {
  white-space: nowrap;
  transition: color var(--dur-1);
}
.pub__au--gap {
  color: var(--text-3);
}
/* co-author links: a persistent quiet underline (not color alone); the 'me' author is
   highlighted text, never a link, on every card */
a.pub__au-name {
  position: relative;
  text-decoration: underline dotted;
  text-decoration-color: var(--text-3);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
@media (hover: hover) and (pointer: fine) {
  a.pub__au-name:hover {
    color: var(--text);
    text-decoration-style: solid;
    text-decoration-color: var(--accent);
  }
}
.pub__au--me .pub__au-name {
  color: var(--accent);
  font-weight: 600;
}
.pub__eq {
  margin-left: 1px;
  color: var(--text-3);
  /* superscript by position, not by shrinking: the asterisk stays at the 12px floor */
  font-size: max(0.72em, var(--fs-micro));
  line-height: 0;
}
.pub__authors:not(.is-open) .pub__au--x {
  display: none;
}
.pub__au-more {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  min-height: 22px;
  margin: 0 8px 0 0;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  line-height: 1;
  vertical-align: 1px;
  transition: color var(--dur-1), border-color var(--dur-2), background var(--dur-2);
}
@media (hover: hover) and (pointer: fine) {
  .pub__au-more:hover {
    color: var(--accent);
    border-color: var(--line-accent);
    background: rgba(var(--accent-rgb), 0.08);
  }
}
/* expanded: the '+N' pill gives way to a labeled 'Show fewer' link at the end of the list */
.pub__authors.is-open .pub__au-more {
  display: none;
}
.pub__au-less {
  position: relative;
  display: none;
  align-items: center;
  min-height: 24px;
  margin-left: 6px;
  padding: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.04em;
  line-height: 1;
  vertical-align: 1px;
}
.pub__authors.is-open .pub__au-less {
  display: inline-flex;
}
@media (hover: hover) and (pointer: fine) {
  .pub__au-less:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}
.pub__au-note {
  color: var(--text-3);
  font-size: max(0.85em, var(--fs-micro));
}
.pub__eqnote {
  margin-bottom: 2px;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.04em;
}
.pub__eqnote sup {
  font-size: 1em; /* the note itself is already at the 12px floor */
  line-height: 0;
}

.pub__venue {
  margin: 8px 0 14px;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.01em;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

/* tl;dr — 3 lines, expandable when clipped */
.pub__tldrwrap {
  min-width: 0;
}
.pub__tldr {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  color: var(--text-2);
  font-size: 0.92rem;
  line-height: 1.65;
}
.pub--feature .pub__tldr {
  -webkit-line-clamp: 5;
  line-clamp: 5;
  font-size: 0.98rem;
}
.pub__tldrwrap.is-open .pub__tldr {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
}
.pub__toggle {
  display: none;
  align-items: center;
  min-height: 28px;
  margin-top: 2px;
  padding: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.04em;
}
@media (hover: hover) and (pointer: fine) {
  .pub__toggle:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}
.pub__tldrwrap.is-clamped .pub__toggle,
.pub__tldrwrap.is-open .pub__toggle {
  display: inline-flex;
}

/* highlights + tags */
.pubs .pub__hl {
  list-style: none;
  margin: 14px 0 0; /* .pubs prefix: base.css `ul[role=list]` would otherwise zero this */
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pub__pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0.38em 0.75em;
  border: 1px solid rgba(var(--accent-2-rgb), 0.4);
  border-radius: var(--r-pill);
  background: rgba(var(--accent-2-rgb), 0.1);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  line-height: 1.25;
  letter-spacing: 0.01em;
}
.pub__pill::before {
  content: "";
  flex: none;
  width: 0;
  height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-bottom: 6px solid var(--accent-2);
}
/* calm dark: neutral pills (hairline + faint tint, grey marker) */
:root:not([data-theme="light"]) .pub__pill {
  border-color: var(--line-strong);
  background: var(--line);
  color: var(--text-2);
}
:root:not([data-theme="light"]) .pub__pill::before {
  border-bottom-color: var(--text-3);
}
.pubs .pub__tags {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 14px;
}
.pub__tag {
  position: relative;
  padding: 4px 0;
  cursor: pointer;
  transition: color var(--dur-1);
}
@media (hover: hover) and (pointer: fine) {
  .pub__tag:hover {
    color: var(--accent);
  }
}

/* actions */
.pub__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 18px;
}
.pub__btn {
  min-height: 36px;
  padding: 0.5em 0.95em;
}
/* featured card on desktop: five or six actions read as a 3-column grid, not a ragged 4+2 wrap
   (cards with four actions keep the flex row: a 3-column grid would strand one button; below 980px the
   text column is too narrow for three English columns, so the row simply wraps) */
@media (min-width: 980px) {
  .pub--feature .pub__actions[data-n="5"],
  .pub--feature .pub__actions[data-n="6"] {
    display: grid;
    grid-template-columns: repeat(3, max-content);
    justify-content: start;
  }
}
.pub__ico {
  display: inline-flex;
  flex: none;
}
.pub__btn .pub__ico {
  color: var(--text-3);
  transition: color var(--dur-2);
}
@media (hover: hover) and (pointer: fine) {
  .pub__btn:hover .pub__ico {
    color: var(--accent);
  }
}
.pub__btn--primary {
  --_bd: var(--line-accent);
  --_bg: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
}
.pub__btn--primary .pub__ico {
  color: var(--accent);
}
.pub__stars {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 3px;
  padding-left: 9px;
  border-left: 1px solid var(--line-strong);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
}
.pub__stars .pub__ico {
  color: var(--text-3);
}

/* --------------------------------------------------------------------------
   Feature (hero) + wide cards: two columns on desktop
   -------------------------------------------------------------------------- */
@media (min-width: 900px) {
  .pub--feature.panel,
  .pub--wide.panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .pub--feature.panel {
    grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr);
  }
  .pub--feature .pub__frame,
  .pub--wide .pub__frame {
    aspect-ratio: auto;
    min-height: 280px;
    border-bottom: 0;
    border-right: 1px solid var(--line);
  }
  .pub--feature .pub__frame {
    min-height: 340px;
  }
  .pub--feature .pub__frame::after,
  .pub--wide .pub__frame::after {
    inset: 0 0 0 auto;
    width: 30%;
    height: auto;
    background: linear-gradient(to left, var(--panel-solid), transparent);
    opacity: 0.4;
  }
  .pub--feature .pub__frame--type,
  .pub--wide .pub__frame--type {
    aspect-ratio: auto;
  }
  .pub--feature .pub__body {
    justify-content: center;
    padding: clamp(24px, 3vw, 40px);
  }
}
@media (max-width: 899px) {
  .pub-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* tablets: a full-width 2:1 plate is a screenful tall; cap it (contain + mat stay, nothing is cropped) */
@media (min-width: 600px) and (max-width: 899px) {
  .pub__frame--img {
    max-height: clamp(180px, 34vw, 300px);
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .pub__frame--img {
    max-height: 46vh;
  }
}

/* --------------------------------------------------------------------------
   Compact list — "Other publications & preprints"
   -------------------------------------------------------------------------- */
.pub-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.pub-item--row {
  display: block;
  border-bottom: 1px solid var(--line);
}
.pub-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) minmax(0, auto);
  gap: 10px clamp(14px, 2.4vw, 28px);
  align-items: start;
  padding: 20px 8px;
  transition: background var(--dur-3) var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .pub-row:hover {
    background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.06), transparent 70%);
  }
}
.pub-row__year {
  padding-top: 3px;
  font-size: var(--fs-sm);
  letter-spacing: 0.04em;
}
.pub-row__year.is-dup {
  visibility: hidden;
}
.pub-row__main {
  min-width: 0;
}
.pub-row__title {
  margin-bottom: 4px;
  font-size: 1rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.pub-row__authors {
  margin-bottom: 0;
  font-size: 0.84rem;
}
.pub-row__venue {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-top: 8px;
}
.pub-row__venue .pub__venue {
  margin: 0;
}
.pub__actions--mini {
  justify-content: flex-end;
  align-self: start;
  max-width: 400px;
  margin: 0;
  padding: 0;
  gap: 6px;
}
.pub__actions--mini .pub__btn {
  min-height: 32px;
  padding: 0.42em 0.8em;
}
@media (max-width: 899px) {
  .pub-row {
    grid-template-columns: minmax(0, 1fr);
    padding: 18px 0;
  }
  .pub-row__year {
    padding-top: 0;
  }
  .pub-row__year.is-dup {
    display: none;
  }
  .pub__actions--mini {
    justify-content: flex-start;
    max-width: none;
  }
}

/* --------------------------------------------------------------------------
   Empty state
   -------------------------------------------------------------------------- */
.pubs__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: clamp(36px, 7vw, 72px) 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--panel);
  text-align: center;
}
.pubs__empty-glyph {
  color: var(--accent);
  font-size: 2rem;
  line-height: 1;
}
.pubs__empty-t {
  max-width: 44ch;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   BibTeX popover (non-modal dialog)
   -------------------------------------------------------------------------- */
.pubs-pop {
  position: absolute;
  z-index: 5;
  width: min(580px, 100%);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--panel-solid);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--line-strong);
  outline: none;
  animation: pop-in 0.24s var(--ease-out);
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: translate3d(0, 8px, 0) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.pubs-pop:focus-visible {
  border-color: var(--line-accent);
}
.pubs-pop__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 6px 16px;
  border-bottom: 1px solid var(--line);
}
.pubs-pop__title {
  color: var(--accent);
  font-size: var(--fs-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
.pubs-pop__key {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-3);
  font-size: var(--fs-xs);
}
.pubs-pop__x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-3);
  transition: color var(--dur-1), background var(--dur-2);
}
@media (hover: hover) and (pointer: fine) {
  .pubs-pop__x:hover {
    color: var(--text);
    background: rgba(var(--accent-rgb), 0.1);
  }
}
.pubs-pop__pre {
  margin: 0;
  padding: 14px 16px;
  max-height: min(300px, 46vh);
  overflow: auto;
  background: var(--bg-sunk);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
  -webkit-overflow-scrolling: touch;
}
.pubs-pop__pre:focus-visible {
  outline-offset: -3px;
}
.pubs-pop__code {
  font: inherit;
}
/* one block per BibTeX line; field lines hang-indent so a wrapped value stays inside its field
   (the two leading spaces of the source line sit in the first 2ch) */
.bib-l {
  display: block;
}
.bib-l--f {
  padding-left: 4ch;
  text-indent: -4ch;
}
.bib-t {
  color: var(--accent-2);
}
/* calm dark: one accent + neutrals in the BibTeX listing (entry type, then key, field names and values in greys) */
:root:not([data-theme="light"]) .pubs-pop__title,
:root:not([data-theme="light"]) .bib-t {
  color: var(--text-2);
}
:root:not([data-theme="light"]) .bib-k {
  color: var(--accent);
}
.bib-k {
  color: var(--accent);
}
.bib-f {
  color: var(--text-3);
}
.bib-v {
  color: var(--text);
}
.pubs-pop__foot {
  display: flex;
  justify-content: flex-end;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}
.pubs-pop__copy {
  min-height: 38px;
  padding-inline: 1.1em;
}
.pubs-pop__copy-i {
  display: inline-flex;
}
.pubs-pop__copy.is-done {
  --_bg: var(--ok);
}
.pubs-pop.is-sheet {
  position: fixed;
  left: 12px;
  right: 12px;
  top: auto;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  width: auto;
  z-index: 5;
  animation-name: pop-sheet;
}
.pubs-pop.is-sheet .pubs-pop__pre {
  max-height: min(260px, 40vh);
}
/* phone sheet: a scrim behind it (a tap on it closes the sheet; see publications.js) */
.pubs-pop-scrim {
  position: fixed;
  inset: 0;
  z-index: 4;
  background: var(--veil);
  animation: scrim-in 0.24s var(--ease-out);
}
@supports (color: color-mix(in srgb, red, blue)) {
  .pubs-pop-scrim {
    background: color-mix(in srgb, var(--bg) 60%, transparent);
  }
}
@supports (backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px)) {
  .pubs-pop-scrim {
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }
}
@keyframes scrim-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes pop-sheet {
  from {
    opacity: 0;
    transform: translate3d(0, 24px, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Deep-link flash
   -------------------------------------------------------------------------- */
.pub.is-flash {
  animation: pub-flash 1.4s var(--ease-out) 2;
}
@keyframes pub-flash {
  0% {
    box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.7), var(--glow-md);
  }
  65% {
    box-shadow: 0 0 0 12px rgba(var(--accent-rgb), 0), var(--glow-md);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0), 0 0 0 0 transparent;
  }
}
:root:not([data-theme="light"]) .pub.is-flash {
  animation-name: pub-flash-soft;
}
@keyframes pub-flash-soft {
  0% {
    box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.4);
  }
  65% {
    box-shadow: 0 0 0 10px rgba(var(--accent-rgb), 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0);
  }
}
.pub-row.is-flash {
  animation: pub-flash-row 1.6s var(--ease-out) 2;
}
@keyframes pub-flash-row {
  0%,
  100% {
    background: transparent;
  }
  30% {
    background: rgba(var(--accent-rgb), 0.16);
  }
}

/* --------------------------------------------------------------------------
   Hover / focus (pointer devices only for motion)
   -------------------------------------------------------------------------- */
.pub.panel:has(:focus-visible) {
  border-color: var(--line-accent);
  box-shadow: var(--glow-sm);
}
/* The lift is keyed to the STATIC list item that wraps the card (same box, never moves), not to the
   card itself: a card that lifted 3px away from a pointer resting on its bottom edge would lose :hover,
   drop back and strobe. The li keeps the pointer, so the lifted card stays lifted. */
@media (hover: hover) and (pointer: fine) {
  .pub-item:hover > .pub.panel {
    border-color: var(--line-accent);
    box-shadow: var(--glow-sm);
    transform: translateY(-3px);
  }
  .pub.panel:hover .pub__img {
    transform: scale(1.03);
  }
}

/* --------------------------------------------------------------------------
   Touch + small screens
   -------------------------------------------------------------------------- */
@media (pointer: coarse) {
  .pubs {
    --pub-chip-h: 44px;
  }
  .pubs__kbd,
  .pubs__hint {
    display: none;
  }
  .pubs__chip {
    min-height: 44px;
  }
  .pub__btn {
    min-height: 44px;
  }
  .pub__actions--mini .pub__btn {
    min-height: 44px;
  }
  /* Inline links / small controls: enlarge the hit area, not the layout.
     Author names are inline text links inside a wrapped sentence (WCAG 2.5.8 inline exception); their
     zone is trimmed to the line pitch so neighboring names on adjacent lines never overlap (mis-taps). */
  .pub__authors {
    line-height: 1.85;
  }
  a.pub__au-name::after {
    content: "";
    position: absolute;
    inset: -4px -3px;
  }
  /* '+N' pill and 'Show fewer': 28px visible, 44px hit zone */
  .pub__au-more,
  .pub__au-less {
    min-height: 28px;
  }
  .pub__au-more {
    min-width: 40px;
  }
  .pub__au-more::after,
  .pub__au-less::after {
    content: "";
    position: absolute;
    inset: -8px -4px;
  }
  /* hashtags are real 44px boxes (no overlapping pseudo zones); the side padding is cancelled by a
     negative margin so the tag text keeps its column */
  .pub__tag {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    min-width: var(--tap);
    padding: 0 6px;
    margin-inline: -6px;
    justify-content: center;
  }
  .pubs .pub__tags {
    gap: 0 8px;
  }
  .pub__title-a {
    padding-block: 12px;
    background-position: 0 calc(100% - 12px);
  }
  .pubs-pop__copy {
    min-height: var(--tap);
  }
  .pub__toggle {
    min-height: 44px;
    margin-top: 0;
  }
  .pubs-pop__x {
    width: 44px;
    height: 44px;
  }
  .pubs__clear {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 760px) {
  .pubs__search {
    height: 52px;
    padding-left: 14px;
    gap: 10px;
  }
  .pubs__input {
    font-size: 16px; /* no iOS zoom-on-focus */
  }
  .pubs__filters {
    flex-direction: column;
    flex-wrap: nowrap; /* a wrapping column sized every group to max-content and hid the chips */
    align-items: stretch;
    gap: 10px;
  }
  .pubs__group {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .pubs__glabel {
    padding-top: 0;
  }
  /* chips: one horizontally-scrolling row, edge-to-edge with faded ends */
  .pubs__chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: -6px calc(var(--gutter) * -1);
    padding: 10px var(--gutter) 12px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent 100%);
  }
  .pubs__chips::-webkit-scrollbar {
    display: none;
  }
  .pubs__chip {
    flex: none;
  }
  .pub__authors {
    font-size: 0.9rem;
  }
  .pub-row__authors {
    font-size: 0.875rem;
  }
}
/* phones: hashtags are ONE scrolling row per card (same idiom as the filter chips), not two rows of 44px boxes */
@media (max-width: 640px) {
  .pubs .pub__tags {
    flex-wrap: nowrap;
    overflow-x: auto;
    /* bleed to the card edges; the padding puts the first and last tag back on the text column */
    margin: 6px calc(var(--pub-px) * -1) -4px;
    padding: 4px var(--pub-px);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
    mask-image: linear-gradient(90deg, #000 88%, transparent);
  }
  .pubs .pub__tags::-webkit-scrollbar {
    display: none;
  }
  .pubs .pub__tags > li {
    flex: none;
  }
  .pub__tag {
    flex: none;
    white-space: nowrap;
  }
}
@media (max-width: 560px) {
  /* justified action rows: every row fills edge to edge (flex-grow) and holds at most three buttons */
  .pub__actions {
    gap: 8px;
  }
  .pub__btn {
    flex: 1 1 auto;
    justify-content: center;
    min-width: 24%;
  }
  .pub__actions--mini .pub__btn {
    flex: 0 1 auto;
    min-width: 0;
  }
  /* Four actions are an even 2x2 grid. Any other card whose last row would end in one lone stretched
     button gets the same two-column grid (publications.js adds .is-grid after measuring; with an odd
     count the first, primary action then takes a full-width row). Row counts never grow by it. */
  .pub__actions[data-n="4"]:not(.pub__actions--mini),
  .pub__actions.is-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pub__actions.is-grid[data-n="3"] > :first-child,
  .pub__actions.is-grid[data-n="5"] > :first-child,
  .pub__actions.is-grid[data-n="7"] > :first-child {
    grid-column: 1 / -1;
  }
  .pub__actions[data-n="4"]:not(.pub__actions--mini) .pub__btn,
  .pub__actions.is-grid .pub__btn {
    min-width: 0;
    white-space: nowrap;
  }
}
@media (max-width: 520px) {
  .pubs {
    --pub-px: 16px;
  }
  .pub__body {
    padding: 18px var(--pub-px) 20px;
  }
}

/* --------------------------------------------------------------------------
   Light theme touch-ups (tokens do most of the work)
   -------------------------------------------------------------------------- */
:root[data-theme="light"] .pub__frame::after {
  opacity: 0.35;
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) and (hover: hover) and (pointer: fine) {
  .pub-item:hover > .pub.panel,
  .pub.panel:hover .pub__img {
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .pub-item--pop,
  .pubs-pop,
  .pubs-pop-scrim {
    animation: none;
  }
  .pub__badge-new::before {
    animation: none;
  }
  .pub.is-flash {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
  }
  .pub-row.is-flash {
    background: rgba(var(--accent-rgb), 0.16);
  }
}

/* the in-page pause control (html.motion-off) behaves like prefers-reduced-motion */
@media (hover: hover) and (pointer: fine) {
  html.motion-off .pub-item:hover > .pub.panel,
  html.motion-off .pub.panel:hover .pub__img {
    transform: none;
  }
}
