/*
 * Collage design, layered over site.css. Every rule is scoped to
 * :root[data-style] (set on <html>) so it takes precedence over the base
 * stylesheet. Tokens come first; dark values follow under [data-theme="dark"].
 */

:root[data-style] {
  /* Compactness, 0 (original spacing) to 1 (compact), set by collage.js.
     Vertical whitespace between and inside blocks scales with --p-space,
     card padding with --p-space-in, side padding with --p-space-x. */
  --compact: 0.6;
  --p-space: calc(1 - 0.5 * var(--compact));
  --p-space-in: calc(1 - 0.35 * var(--compact));
  --p-space-x: calc(1 - 0.2 * var(--compact));
  /* Card transparency, 0 (denser fills) to 1 (clearest glass), set by collage.js. */
  --glass: 0.7;
  --p-glass-sheen: none;
  --p-inset-shadow: 0 0 #0000;
  --p-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, system-ui, sans-serif;
  --p-font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Inter, system-ui, sans-serif;
  --p-font-quote: "Crimson Pro", Georgia, serif;
  --p-body-tracking: 0;
  --p-h1-size: 46px;
  --p-h1-weight: 700;
  --p-h1-tracking: -0.02em;
  --p-title-size: 26px;
  --p-title-weight: 650;
  --p-title-tracking: -0.015em;
  --p-title-gap: calc(20px * var(--p-space));

  --p-canvas: #f4f3f0;
  --p-ink: #1c1a17;
  --p-text: #34312c;
  --p-muted: #6a655c;
  --p-link: #1c1a17;
  --p-link-hover: #000;
  --p-link-decoration: none;
  --p-link-underline: rgba(28, 26, 23, 0.28);
  --p-accent: #8a5a3b;
  --p-accent-text: #8a5a3b;
  --p-line: rgba(28, 26, 23, 0.1);
  --p-hover: rgba(28, 26, 23, 0.045);
  --p-focus: rgba(28, 26, 23, 0.6);
  --p-selection: rgba(138, 90, 59, 0.18);
  --p-scroll-thumb: rgba(28, 26, 23, 0.22);
  --p-icon-1: #5b6c7d;
  --p-icon-2: #5f7363;
  --p-icon-3: #8a5a3b;

  --p-container: 1080px;
  --p-gutter: 28px;
  --p-gap: 16px;
  --p-scroll-pad: 84px;

  --p-panel-bg: rgba(252, 251, 248, 0.8);
  --p-panel-border: rgba(28, 26, 23, 0.08);
  --p-panel-shadow: 0 1px 2px rgba(28, 26, 23, 0.04);
  --p-panel-radius: 12px;
  --p-panel-pad: 30px 34px;
  --p-hero-pad: calc(40px * var(--p-space)) calc(38px * var(--p-space-x)) calc(26px * var(--p-space));

  --p-inset-bg: rgba(28, 26, 23, 0.025);
  --p-inset-border: rgba(28, 26, 23, 0.08);
  --p-inset-radius: 10px;
  --p-row-radius: 8px;

  --p-card-bg: var(--p-panel-bg);
  --p-card-border: var(--p-panel-border);
  --p-card-shadow: var(--p-panel-shadow);
  --p-card-radius: var(--p-panel-radius);
  --p-card-bar-bg: rgba(28, 26, 23, 0.03);

  --p-nav-bg: rgba(244, 243, 240, 0.78);
  --p-nav-edge: var(--p-nav-bg);
  --p-nav-border: rgba(28, 26, 23, 0.08);
  --p-nav-shadow: none;
  --p-nav-filter: none;
  --p-nav-text: var(--p-text);

  --p-chip-bg: rgba(255, 255, 255, 0.6);
  --p-chip-border: rgba(28, 26, 23, 0.12);
  --p-chip-text: var(--p-ink);
  --p-chip-shadow: none;
  --p-chip-radius: 8px;
  --p-chip-hover-bg: rgba(255, 255, 255, 0.95);
  --p-chip-hover-border: rgba(28, 26, 23, 0.22);
  --p-chip-active-bg: #2b2824;
  --p-chip-active-text: #f7f5f1;
  --p-chip-active-border: #2b2824;
  --p-chip-active-shadow: none;
  --p-pill-radius: var(--p-chip-radius);

  --p-tag-bg: rgba(28, 26, 23, 0.055);
  --p-tag-text: #514c45;
  --p-tag-radius: 6px;

  --p-btn-bg: #2b2824;
  --p-btn-text: #f7f5f1;
  --p-btn-hover: #000;
  --p-btn-radius: 9px;

  --p-hl-bg: rgba(163, 120, 60, 0.1);
  --p-hl-border: rgba(163, 120, 60, 0.24);
  --p-hl-text: #74552b;
  --p-hl-icon: #a3783c;
  --p-gold: #8a6a3a;

  --p-thumb-bg: #fff;
  --p-thumb-border: rgba(28, 26, 23, 0.08);
  --p-thumb-radius: 8px;
  --p-tile-radius: 10px;
  --p-tile-shadow: none;
  --p-avatar-ring: rgba(255, 255, 255, 0.9);
  --p-avatar-shadow: 0 10px 28px rgba(28, 26, 23, 0.12);

  --p-seg-bg: rgba(28, 26, 23, 0.05);
  --p-seg-border: transparent;
  --p-seg-text: var(--p-muted);
  --p-seg-active-bg: rgba(255, 255, 255, 0.95);
  --p-seg-active-text: var(--p-ink);
  --p-seg-shadow: 0 1px 2px rgba(28, 26, 23, 0.12);

  --p-badge-border: var(--p-line);
  --p-badge-border-hover: rgba(28, 26, 23, 0.25);
  --p-badge-filter: saturate(0.75);
  --p-inline-badge-bg: #f4f3f0;
  --p-inline-badge-text: #333;
  --p-pill-logo-filter: brightness(0) opacity(0.8);

  --p-pop-solid: #fbfaf7;
  --p-pop-border: rgba(28, 26, 23, 0.12);
  --p-pop-shadow: 0 16px 40px rgba(28, 26, 23, 0.14);
  --p-pop-radius: 12px;
  --p-tip-bg: #2b2824;
  --p-tip-text: #f7f5f1;

  --p-fab-bg: rgba(43, 40, 36, 0.86);
  --p-fab-text: #f7f5f1;
  --p-fab-border: transparent;
  --p-fab-shadow: 0 8px 22px rgba(28, 26, 23, 0.2);
  --p-overlay-bg: rgba(22, 20, 18, 0.82);
  --p-overlay-filter: blur(14px) saturate(1.1);


  background: var(--p-canvas);
}

/* Anchor jumps land below the sticky navigation. Set on the sections, not as root
   scroll padding, so focusing a link inside the navigation never scrolls the page. */
:root[data-style] main > section[id] { scroll-margin-top: var(--p-scroll-pad); }

:root[data-style] body {
  background: transparent;
  color: var(--p-text);
  font-family: var(--p-font);
  letter-spacing: var(--p-body-tracking);
}

:root[data-style] ::selection { background: var(--p-selection); }

:root[data-style] button,
:root[data-style] .gallery-city-card .gallery-city-label { font-family: inherit; }

:root[data-style] a { color: var(--p-link); }
@media (hover: hover) and (pointer: fine) {
  :root[data-style] a:hover { color: var(--p-link-hover); }
}

:root[data-style] :is(.subtitle, .hero-bio, .collaboration-note, .news-text, .timeline-detail, .award-copy, .awards-note, .pub-note, .site-analytics) a:not(.profile-badge) {
  color: var(--p-link);
  text-decoration-color: var(--p-link-underline);
  text-decoration-line: var(--p-link-decoration);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  :root[data-style] :is(.subtitle, .hero-bio, .collaboration-note, .news-text, .timeline-detail, .award-copy, .awards-note, .pub-note, .site-analytics) a:not(.profile-badge):hover {
    color: var(--p-link-hover);
    text-decoration-color: currentColor;
    text-decoration-line: underline;
  }
}

/* Navigation */
:root[data-style] nav {
  /* The blur has nothing above the viewport to sample, so the fill is denser along
     the top edge, where text scrolling under the bar would stay legible. */
  background: linear-gradient(180deg, var(--p-nav-edge), color-mix(in srgb, var(--p-nav-edge) 90%, var(--p-nav-bg)) 14px, var(--p-nav-bg) 36px);
  border-bottom: 1px solid var(--p-nav-border);
  box-shadow: var(--p-nav-shadow);
  -webkit-backdrop-filter: var(--p-nav-filter);
  backdrop-filter: var(--p-nav-filter);
}

:root[data-style] .nav-inner {
  max-width: var(--p-container);
  padding-left: var(--p-gutter);
  padding-right: var(--p-gutter);
}

:root[data-style] .nav-name {
  color: var(--p-ink);
  font-family: var(--p-font-display);
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

:root[data-style] .nav-links a {
  color: var(--p-nav-text);
  font-weight: 550;
}

:root[data-style] .nav-links a.active { color: var(--p-ink); }

@media (hover: hover) and (pointer: fine) {
  :root[data-style] .nav-links a:hover { color: var(--p-ink); }
}

:root[data-style] .nav-links { position: relative; }
:root[data-style] .nav-links a::after {
  background: var(--p-hover);
  border-radius: 999px;
  height: auto;
  inset: -4px -10px;
  opacity: 0;
  transform: none;
  transform-origin: 50% 50%;
  transition: opacity 120ms ease;
  width: auto;
  z-index: -1;
}

@media (hover: hover) and (pointer: fine) {
  :root[data-style] .nav-links a:not(.active):hover::after { opacity: 1; }
}

/* Current section: a glass lens behind the active link (collage.js places it). */
.nav-lens {
  background: var(--p-lens-fill);
  border-radius: 999px;
  box-shadow: var(--p-lens-edge);
  left: 0;
  pointer-events: none;
  position: absolute;
  top: 0;
}
.nav-lens.is-placed { transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1), width 180ms cubic-bezier(0.2, 0.8, 0.2, 1); }
:root[data-style] {
  --p-lens-fill: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.16) 55%, rgba(255, 255, 255, 0.3));
  --p-lens-edge: inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 -1px 0 rgba(255, 255, 255, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.45), 0 1px 2px rgba(20, 30, 45, 0.18), 0 3px 10px rgba(20, 30, 45, 0.1);
}
:root[data-style][data-theme="dark"] {
  --p-lens-fill: linear-gradient(180deg, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0.05) 55%, rgba(255, 255, 255, 0.1));
  --p-lens-edge: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -1px 0 rgba(255, 255, 255, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 1px 2px rgba(0, 0, 0, 0.4), 0 3px 10px rgba(0, 0, 0, 0.25);
}
@media (prefers-reduced-motion: reduce) {
  .nav-lens.is-placed { transition: none; }
}

/* Layout: each section sits on one material panel; children stay flat. */
:root[data-style] .container {
  max-width: var(--p-container);
  padding-left: var(--p-gutter);
  padding-right: var(--p-gutter);
}

:root[data-style] main > section,
:root[data-style] footer > .container {
  background: var(--p-glass-sheen), var(--p-panel-bg);
  border: 1px solid var(--p-panel-border);
  border-radius: var(--p-panel-radius);
  box-shadow: var(--p-panel-shadow);
  margin-top: var(--p-gap);
  padding: var(--p-panel-pad);
}

:root[data-style] main > section.hero {
  margin-top: calc(var(--p-gap) + 10px * var(--p-space));
  padding: var(--p-hero-pad);
}

:root[data-style] h1,
:root[data-style] .section-title {
  color: var(--p-ink);
  font-family: var(--p-font-display);
}

:root[data-style] h1 {
  font-size: var(--p-h1-size);
  font-weight: var(--p-h1-weight);
  letter-spacing: var(--p-h1-tracking);
}

:root[data-style] .cn-name {
  letter-spacing: 0;
  white-space: nowrap;
}

:root[data-style] .section-title {
  border-bottom: 0;
  font-size: var(--p-title-size);
  font-weight: var(--p-title-weight);
  letter-spacing: var(--p-title-tracking);
  line-height: 1.15;
  margin-bottom: var(--p-title-gap);
  padding-bottom: 0;
}

:root[data-style] .gallery-heading { margin-bottom: var(--p-title-gap); }
:root[data-style] .gallery-heading .section-title { margin-bottom: 0; }

/* Hero */
:root[data-style] .hero-photo > img {
  border: 3px solid var(--p-avatar-ring);
  box-shadow: var(--p-avatar-shadow);
}

:root[data-style] .hero-photo > img:hover { box-shadow: var(--p-avatar-shadow); }

:root[data-style] .hero-quote {
  color: var(--p-muted);
  font-family: var(--p-font-quote);
}

:root[data-style] .subtitle { color: var(--p-muted); }
:root[data-style] .bio-icon-horizon { color: var(--p-icon-1); }
:root[data-style] .bio-icon-improve { color: var(--p-icon-2); }
:root[data-style] .bio-icon-observe { color: var(--p-icon-3); }
:root[data-style] .hero-bio strong,
:root[data-style] .collaboration-emphasis { color: var(--p-ink); }
:root[data-style] .collaboration-note { color: var(--p-text); }
/* Closes the hero card at full width, without a card of its own. */
:root[data-style] .hero > .collaboration-note {
  grid-column: 1 / -1;
  justify-self: stretch;
  margin: calc(18px * var(--p-space)) 0 0;
}
:root[data-style] .collaboration-contact { color: var(--p-ink); }

/* Profile badges and links */
:root[data-style] .profile-badge {
  border: 1px solid var(--p-badge-border);
  box-shadow: none;
}

:root[data-style] .profile-badge:hover {
  border-color: var(--p-badge-border-hover);
  box-shadow: none;
}

:root[data-style] .profile-badge img { filter: var(--p-badge-filter); }

:root[data-style] .profile-badge.inline-badge {
  background: var(--p-inline-badge-bg);
  color: var(--p-inline-badge-text);
}

/* The strip scrolls sideways, so it clips what it holds. Room below and left of the
   links keeps a hover shadow, a focus ring and a tooltip shown below a link (when the
   navigation would cover it above) whole; negative margins keep the layout. That room
   and the space above for tooltips, which reaches over the end of the bio, let the
   pointer through: only the badges, links and arrows take it. */
:root[data-style] .hero-profile-scroll {
  margin: 0 0 -72px -12px;
  padding: 50px var(--scroll-fade-size) 72px 12px;
  width: calc(100% + 12px);
}
:root[data-style] :is(.hero-profile-nav, .hero-profile-scroll) { pointer-events: none; }
:root[data-style] :is(.hero-profile-track, .profile-scroll-arrow) { pointer-events: auto; }

:root[data-style] .profile-scroll-arrow {
  background: var(--p-chip-hover-bg);
  border: 1px solid var(--p-chip-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  color: var(--p-muted);
}

:root[data-style] .profile-scroll-arrow:hover {
  background: var(--p-chip-hover-bg);
  border-color: var(--p-chip-hover-border);
  color: var(--p-ink);
}

:root[data-style] .pill-link {
  background: var(--p-chip-bg);
  border: 1px solid var(--p-chip-border);
  border-radius: var(--p-pill-radius);
  box-shadow: var(--p-chip-shadow);
  color: var(--p-chip-text);
  font-weight: 600;
}

@media (hover: hover) and (pointer: fine) {
  :root[data-style] .pill-link:hover {
    background: var(--p-chip-hover-bg);
    border-color: var(--p-chip-hover-border);
    color: var(--p-chip-text);
  }
}

:root[data-style] .pill-logo,
:root[data-style] .pill-link:hover .pill-logo { filter: var(--p-pill-logo-filter); }

:root[data-style] .pill-link:focus-visible { outline-color: var(--p-focus); }

:root[data-style] .profile-tooltip {
  background: var(--p-tip-bg);
  border-color: transparent;
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2);
  color: var(--p-tip-text);
}

/* site.js keeps a tooltip clear of the strip's faded ends; its pointer stays on the box. */
:root[data-style] .profile-tooltip::after {
  border-top-color: var(--p-tip-bg);
  left: clamp(14px, calc(50% - var(--tooltip-shift-x)), calc(100% - 14px));
}
/* Below the link when the navigation would cover it above (site.js sets .is-below). */
:root[data-style] .profile-tooltip.is-below {
  bottom: auto;
  top: calc(100% + 9px);
  transform: translate(-50%, -5px);
}
:root[data-style] .pill-link:is(:hover, :focus-visible) .profile-tooltip.is-below { transform: translate(-50%, 0); }
:root[data-style] .profile-tooltip.is-below::after {
  border-bottom: 6px solid var(--p-tip-bg);
  border-top: 0;
  bottom: 100%;
  top: auto;
}
:root[data-style] .profile-tooltip strong { color: var(--p-tip-text); }

/* Research cards and paper popover */
:root[data-style] .interest-grid {
  gap: var(--p-gap);
  margin-top: var(--p-gap);
  padding-top: 0;
}

:root[data-style] .interest-card {
  background: var(--p-card-bg);
  border: 1px solid var(--p-card-border);
  border-radius: var(--p-card-radius);
  box-shadow: var(--p-card-shadow);
}

:root[data-style] .interest-card:hover {
  box-shadow: var(--p-card-shadow);
  transform: none;
}

:root[data-style] .interest-window-bar {
  background: var(--p-card-bar-bg);
  border-bottom: 1px solid var(--p-line);
  border-radius: calc(var(--p-card-radius) - 1px) calc(var(--p-card-radius) - 1px) 0 0;
}

:root[data-style] .interest-window-content {
  background: transparent;
  border-radius: 0 0 calc(var(--p-card-radius) - 1px) calc(var(--p-card-radius) - 1px);
}

:root[data-style] .interest-title {
  color: var(--p-ink);
  font-weight: 650;
}

:root[data-style] .interest-topic-label { color: var(--p-ink); }
:root[data-style] .topic-papers { color: var(--p-muted); }

:root[data-style] .research-paper-trigger {
  color: var(--p-link);
  text-decoration-color: var(--p-link-underline);
}

:root[data-style] .research-paper-trigger:hover,
:root[data-style] .research-paper-trigger:focus-visible,
:root[data-style] .research-paper-trigger[aria-expanded="true"] {
  color: var(--p-accent-text);
  text-decoration-color: currentColor;
}

:root[data-style] .research-paper-popover {
  background: var(--p-pop-solid);
  border: 1px solid var(--p-pop-border);
  border-radius: var(--p-pop-radius);
  box-shadow: var(--p-pop-shadow);
  color: var(--p-text);
  padding: 14px;
}

:root[data-style] .research-paper-popover.is-below::before { border-bottom-color: var(--p-pop-border); }
:root[data-style] .research-paper-popover.is-below::after { border-bottom-color: var(--p-pop-solid); }
:root[data-style] .research-paper-popover.is-above::before { border-top-color: var(--p-pop-border); }
:root[data-style] .research-paper-popover.is-above::after { border-top-color: var(--p-pop-solid); }

/* Opaque, so details scrolling under the button stay behind it. */
:root[data-style] .research-paper-close { background: var(--p-pop-solid); color: var(--p-muted); border-radius: 6px; }

:root[data-style] .research-paper-close:hover,
:root[data-style] .research-paper-close:focus-visible {
  background: linear-gradient(var(--p-hover), var(--p-hover)), var(--p-pop-solid);
  color: var(--p-ink);
  outline: 0;
}

:root[data-style] .research-paper-venue { color: var(--p-accent-text); }
:root[data-style] .research-paper-popover h3 { color: var(--p-ink); }

:root[data-style] .research-paper-insight {
  background: var(--p-inset-bg);
  border: 1px solid var(--p-inset-border);
  border-radius: 8px;
  padding: 7px 9px;
}

:root[data-style] .research-paper-insight strong,
:root[data-style] .research-paper-resources > strong { color: var(--p-ink); }

:root[data-style] .research-paper-topics span {
  background: var(--p-tag-bg);
  border: 0;
  border-radius: var(--p-tag-radius);
  color: var(--p-tag-text);
}

:root[data-style] .research-paper-resources { border-top-color: var(--p-line); }

:root[data-style] .research-paper-links a {
  background: var(--p-chip-bg);
  border: 1px solid var(--p-chip-border);
  border-radius: var(--p-chip-radius);
  color: var(--p-chip-text);
}

@media (hover: hover) and (pointer: fine) {
  :root[data-style] .research-paper-links a:hover {
    background: var(--p-chip-active-bg);
    border-color: var(--p-chip-active-border);
    color: var(--p-chip-active-text);
  }
}

/* Education and experience */
:root[data-style] :is(.timeline-item, .news-item, .pub-item) {
  background-image: linear-gradient(var(--p-line), var(--p-line));
  background-origin: border-box;
  background-position: 50% 100%;
  background-repeat: no-repeat;
  background-size: calc(100% - 2 * var(--p-row-radius)) 1px;
  border-bottom: 1px solid transparent;
  border-radius: var(--p-row-radius);
}

:root[data-style] :is(.timeline-item, .news-item, .pub-item):last-child { background-image: none; }

:root[data-style] :is(.timeline-item, .news-item, .pub-item):hover {
  background-color: var(--p-hover);
  box-shadow: none;
  transform: none;
}

:root[data-style] .timeline-content h3 {
  color: var(--p-ink);
  font-weight: 650;
}

:root[data-style] .timeline-content h3 a { color: inherit; }
:root[data-style] .timeline-content h3 a:hover { color: var(--p-link-hover); }
:root[data-style] .timeline-date { color: var(--p-muted); font-weight: 600; }
:root[data-style] .timeline-entry + .timeline-entry::before { background: var(--p-line); }
:root[data-style] .timeline-detail strong { color: var(--p-ink); }

/*
 * News: the list scrolls on the section panel itself, without a card of its
 * own. A thin rounded thumb without arrow buttons; the edge with more items
 * past it fades (collage.js sets .has-before and .has-after). The scrollbar
 * strip at the right stays unfaded. Scroll padding the size of the fades keeps
 * a link that keyboard focus scrolls into view clear of them.
 */
:root[data-style] .news-container {
  --news-bar: 10px;
  --news-fade-top: 0px;
  --news-fade-bottom: 0px;
  background: none;
  border: 0;
  border-radius: var(--p-row-radius);
  box-shadow: none;
  -webkit-mask:
    linear-gradient(transparent, #000 var(--news-fade-top), #000 calc(100% - var(--news-fade-bottom)), transparent) left / calc(100% - var(--news-bar)) 100% no-repeat,
    linear-gradient(#000, #000) right / var(--news-bar) 100% no-repeat;
  mask:
    linear-gradient(transparent, #000 var(--news-fade-top), #000 calc(100% - var(--news-fade-bottom)), transparent) left / calc(100% - var(--news-bar)) 100% no-repeat,
    linear-gradient(#000, #000) right / var(--news-bar) 100% no-repeat;
  padding: 0;
  scroll-padding: 28px 0 36px;
  scrollbar-color: var(--p-scroll-thumb) transparent;
  scrollbar-width: thin;
}
:root[data-style] .news-container.has-before { --news-fade-top: 28px; }
:root[data-style] .news-container.has-after { --news-fade-bottom: 36px; }
/* Chrome and Safari draw the bar from these; the standard properties would
   take precedence in Chrome and bring back its arrow buttons. */
@supports selector(::-webkit-scrollbar) {
  :root[data-style] .news-container { scrollbar-color: auto; scrollbar-width: auto; }
  :root[data-style] .news-container::-webkit-scrollbar { width: var(--news-bar); }
  :root[data-style] .news-container::-webkit-scrollbar-button { display: none; height: 0; width: 0; }
  :root[data-style] .news-container::-webkit-scrollbar-track { background: transparent; }
  :root[data-style] .news-container::-webkit-scrollbar-thumb {
    background: var(--p-scroll-thumb);
    background-clip: padding-box;
    border: 2px solid transparent;
    border-radius: 999px;
    min-height: 36px;
  }
  :root[data-style] .news-container::-webkit-scrollbar-thumb:hover { background-color: var(--p-muted); }
  :root[data-style] .news-container::-webkit-scrollbar-corner { background: transparent; }
}
:root[data-style] .news-container:focus { outline: 0; }
/* Keyboard focus shows the whole list with a ring, so the fades step aside. */
:root[data-style] .news-container:focus-visible {
  -webkit-mask: none;
  mask: none;
  outline: 2px solid var(--p-focus);
  outline-offset: 2px;
}


:root[data-style] .news-date {
  color: var(--p-muted);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

:root[data-style] .news-text strong { color: var(--p-ink); }

/* Publications */
:root[data-style] .pub-note { color: var(--p-muted); }

:root[data-style] .filter-btn {
  background: var(--p-chip-bg);
  border: 1px solid var(--p-chip-border);
  border-radius: var(--p-chip-radius);
  box-shadow: var(--p-chip-shadow);
  color: var(--p-chip-text);
  font-weight: 600;
}

@media (hover: hover) and (pointer: fine) {
  :root[data-style] .filter-btn:hover {
    background: var(--p-chip-hover-bg);
    border-color: var(--p-chip-hover-border);
    box-shadow: var(--p-chip-shadow);
    color: var(--p-chip-text);
    transform: none;
  }
}

:root[data-style] .filter-btn.active,
:root[data-style] .filter-btn.active:hover {
  background: var(--p-chip-active-bg);
  border-color: var(--p-chip-active-border);
  box-shadow: var(--p-chip-active-shadow);
  color: var(--p-chip-active-text);
  transform: none;
}


:root[data-style] .pub-thumb {
  background: var(--p-thumb-bg);
  border: 1px solid var(--p-thumb-border);
  border-radius: var(--p-thumb-radius);
}

:root[data-style] .pub-thumb:hover {
  border-color: var(--p-chip-hover-border);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

:root[data-style] .pub-title { color: var(--p-ink); font-weight: 700; }
:root[data-style] .pub-title:hover { color: var(--p-link-hover); }
:root[data-style] .pub-authors { color: var(--p-muted); }
:root[data-style] .pub-venue em { color: var(--p-text); font-weight: 600; }

:root[data-style] .me {
  color: var(--p-ink);
  font-weight: 700;
  text-decoration-color: var(--p-accent);
}

:root[data-style] .paper-highlight {
  background: var(--p-hl-bg);
  border: 1px solid var(--p-hl-border);
  border-radius: 6px;
  color: var(--p-hl-text);
  font-weight: 700;
}

@media (hover: hover) and (pointer: fine) {
  :root[data-style] .paper-highlight:hover {
    background: var(--p-hl-bg);
    border-color: var(--p-hl-text);
    color: var(--p-hl-text);
  }
}

:root[data-style] .paper-highlight i { color: var(--p-hl-icon); }

:root[data-style] .pub-link {
  background: var(--p-chip-bg);
  border: 1px solid var(--p-chip-border);
  border-radius: var(--p-chip-radius);
  box-shadow: var(--p-chip-shadow);
  color: var(--p-chip-text);
  font-weight: 600;
}

@media (hover: hover) and (pointer: fine) {
  :root[data-style] .pub-link:hover {
    background: var(--p-chip-active-bg);
    border-color: var(--p-chip-active-border);
    color: var(--p-chip-active-text);
    transform: none;
  }
}

:root[data-style] .tag {
  background: var(--p-tag-bg);
  border-radius: var(--p-tag-radius);
  color: var(--p-tag-text);
  font-weight: 600;
}

:root[data-style] .pub-show-all,
:root[data-style] .gallery-actions button {
  background: var(--p-btn-bg);
  border-radius: var(--p-btn-radius);
  color: var(--p-btn-text);
  font-weight: 600;
}

@media (hover: hover) and (pointer: fine) {
  :root[data-style] .pub-show-all:hover,
  :root[data-style] .gallery-actions button:hover {
    background: var(--p-btn-hover);
    transform: none;
  }
}

/* Awards */
:root[data-style] .awards-list { border-color: var(--p-line); }
:root[data-style] .award-item { border-bottom-color: var(--p-line); }
:root[data-style] .award-item:hover { background: var(--p-hover); }
:root[data-style] .award-year { color: var(--p-muted); }

:root[data-style] .award-copy h3 {
  color: var(--p-ink);
  font-family: var(--p-font);
  font-weight: 650;
}

:root[data-style] .award-copy h3 a { color: inherit; }
:root[data-style] .award-copy p { color: var(--p-muted); }
:root[data-style] .award-selectivity { border-left: 0; }
:root[data-style] .award-selectivity strong { color: var(--p-gold); }
:root[data-style] .award-selectivity span,
:root[data-style] .awards-note { color: var(--p-muted); }

/* Gallery */
:root[data-style] .gallery-view-toggle {
  background: var(--p-seg-bg);
  border: 1px solid var(--p-seg-border);
}

:root[data-style] .gallery-view-toggle button { color: var(--p-seg-text); }

:root[data-style] .gallery-view-toggle button.active {
  background: var(--p-seg-active-bg);
  box-shadow: var(--p-seg-shadow);
  color: var(--p-seg-active-text);
}

:root[data-style] .gallery-item {
  border: 0;
  border-radius: var(--p-tile-radius);
  box-shadow: var(--p-tile-shadow);
}

:root[data-style] .gallery-item:hover { border-color: transparent; }
:root[data-style] .gallery-city-card { background: var(--p-inset-bg); }

/* Fun facts: flat cards, no accent stripe */
:root[data-style] .fun-fact {
  background: var(--p-inset-bg);
  border: 1px solid var(--p-inset-border);
  border-radius: var(--p-inset-radius);
}

:root[data-style] .fun-fact strong { color: var(--p-ink); }

/* Compactness in lists and cards; text size and line height stay. */
:root[data-style] .hero-photo { gap: calc(20px * var(--p-space)); }
:root[data-style] .hero-bio { margin-bottom: calc(18px * var(--p-space)); }
:root[data-style] .timeline-item { padding-block: calc(18px * var(--p-space)); }
:root[data-style] .timeline-entry + .timeline-entry {
  margin-top: calc(7px * var(--p-space));
  padding-top: calc(7px * var(--p-space));
}
:root[data-style] .news-item { padding-block: calc(10px * var(--p-space)); }
:root[data-style] .pub-filter { margin-bottom: calc(20px * var(--p-space)); }
:root[data-style] .pub-item { padding-block: calc(18px * var(--p-space)); }
:root[data-style] .award-item {
  min-height: calc(68px * var(--p-space-in));
  padding-block: calc(11px * var(--p-space));
}
:root[data-style] .fun-facts-grid { gap: calc(14px * var(--p-space)); }
:root[data-style] .fun-fact { padding-block: calc(16px * var(--p-space-in)); }
:root[data-style] .interest-window-content { padding-block: calc(10px * var(--p-space-in)); }
/* Wider screens give the research cards a fixed height (site.css); it shrinks too. */
@media (min-width: 561px) {
  :root[data-style] .interest-grid { grid-auto-rows: calc(136px - 16px * var(--compact)); }
}

/* Overlays and floating controls */
:root[data-style] .lightbox,
:root[data-style] .fig-viewer {
  background: var(--p-overlay-bg);
  -webkit-backdrop-filter: var(--p-overlay-filter);
  backdrop-filter: var(--p-overlay-filter);
}

:root[data-style] .fig-viewer-frame img { border-radius: 12px; }

/* The viewer backdrop is always dark: keep the caption link light in every theme. */
:root[data-style] .fig-viewer-link {
  color: #e7edf5;
  text-decoration-color: rgba(231, 237, 245, 0.45);
}
:root[data-style] .fig-viewer-link:is(:hover, :focus-visible) {
  color: #fff;
  text-decoration-color: currentColor;
}

:root[data-style] .back-to-top {
  background: var(--p-fab-bg);
  border: 1px solid var(--p-fab-border);
  box-shadow: var(--p-fab-shadow);
  color: var(--p-fab-text);
}

/* Footer */
:root[data-style] footer {
  border-top: 0;
  color: var(--p-muted);
  margin-top: 0;
  padding: 0 var(--p-gutter) calc(40px * var(--p-space));
}

:root[data-style] footer > .container {
  max-width: calc(var(--p-container) - 2 * var(--p-gutter));
  padding: calc(26px * var(--p-space)) 24px;
}

/* The visitor map lays itself out once at load. collage.js scales the whole
   widget to the footer width later; the clip keeps the page width intact. */
:root[data-style] #visitorMapMount {
  max-width: 100%;
  overflow: hidden;
}
:root[data-style] #visitorMapMount #mapmyvisitors-widget {
  border-radius: 12px;
  margin-inline: auto;
  max-width: none;
  overflow: hidden;
}
:root[data-style][data-theme="dark"] #visitorMapMount #mapmyvisitors-widget { filter: brightness(0.8); }
/* The mount clips the map, so the map's own focus ring would be cut: the mount draws it
   instead, round like the map's corners, which collage.js scales with the map. */
@supports selector(:has(*)) {
  :root[data-style] #visitorMapMount #mapmyvisitors-widget:focus-visible { outline: none; }
  :root[data-style] #visitorMapMount:has(#mapmyvisitors-widget:focus-visible) {
    border-radius: calc(12px * var(--map-scale, 1));
    outline: 2px solid var(--p-focus);
    outline-offset: 2px;
  }
}

:root[data-style] .site-analytics strong { color: var(--p-ink); }
:root[data-style] .visitor-map-fallback { color: var(--p-muted); }

@media (max-width: 860px) {
  :root[data-style] { --p-hero-pad: calc(32px * var(--p-space)) calc(26px * var(--p-space-x)) calc(22px * var(--p-space)); }
}

@media (max-width: 560px) {
  :root[data-style] {
    --p-gutter: 10px;
    --p-gap: 12px;
    --p-h1-size: 36px;
    --p-title-size: 22px;
    --p-panel-pad: 22px 16px;
    --p-hero-pad: calc(26px * var(--p-space)) calc(16px * var(--p-space-x)) calc(18px * var(--p-space));
    --p-scroll-pad: 104px;
  }

  :root[data-style] .nav-inner {
    padding-left: 18px;
    padding-right: 18px;
  }

  :root[data-style] footer > .container { padding: calc(22px * var(--p-space)) 16px; }

  /* Award figures stay on one line; the description wraps. */
  :root[data-style] .award-selectivity strong { flex: none; white-space: nowrap; }
  :root[data-style] .award-selectivity span { min-width: 0; }
  :root[data-style] .award-item { padding-block: calc(12px * var(--p-space)); }
}

/* Dark appearance */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

:root[data-style][data-theme="dark"] {
  --p-canvas: #101115;
  --p-ink: #f4f4f7;
  --p-text: #dedee4;
  --p-muted: #b5b6c0;
  --p-link: #bad4ff;
  --p-link-hover: #e1ebff;
  --p-link-underline: rgba(186, 212, 255, 0.4);
  --p-accent: #e9b78a;
  --p-accent-text: #f0c49b;
  --p-line: rgba(255, 255, 255, 0.12);
  --p-hover: rgba(255, 255, 255, 0.055);
  --p-focus: #bad4ff;
  --p-selection: rgba(169, 200, 255, 0.28);
  --p-scroll-thumb: rgba(255, 255, 255, 0.28);
  --p-icon-1: #a6c7f7;
  --p-icon-2: #a3d6bc;
  --p-icon-3: #efbc90;
  --p-panel-bg: rgba(18, 20, 26, 0.78);
  --p-panel-border: rgba(255, 255, 255, 0.12);
  --p-panel-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 18px 48px rgba(0, 0, 0, 0.28);
  --p-card-bg: rgba(22, 24, 30, 0.8);
  --p-card-border: rgba(255, 255, 255, 0.13);
  --p-card-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 14px 34px rgba(0, 0, 0, 0.28);
  --p-card-bar-bg: rgba(255, 255, 255, 0.035);
  --p-inset-bg: rgba(255, 255, 255, 0.045);
  --p-inset-border: rgba(255, 255, 255, 0.12);
  --p-nav-bg: rgba(23, 25, 31, 0.66);
  --p-nav-edge: rgba(23, 25, 31, 0.97);
  --p-nav-filter: blur(16px) saturate(1.3);
  --p-nav-border: rgba(255, 255, 255, 0.16);
  --p-nav-text: #dedee4;
  --p-nav-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
  --p-chip-bg: rgba(255, 255, 255, 0.075);
  --p-chip-border: rgba(255, 255, 255, 0.18);
  --p-chip-text: #ececf2;
  --p-chip-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --p-chip-hover-bg: rgba(255, 255, 255, 0.14);
  --p-chip-hover-border: rgba(255, 255, 255, 0.28);
  --p-chip-active-bg: #eeeeF4;
  --p-chip-active-text: #15161c;
  --p-chip-active-border: #eeeef4;
  --p-chip-active-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
  --p-tag-bg: rgba(255, 255, 255, 0.09);
  --p-tag-text: #d8dae4;
  --p-btn-bg: #eeeef4;
  --p-btn-text: #15161c;
  --p-btn-hover: #fff;
  --p-hl-bg: rgba(233, 176, 124, 0.12);
  --p-hl-border: rgba(233, 176, 124, 0.3);
  --p-hl-text: #f3cba3;
  --p-hl-icon: #efbc90;
  --p-gold: #ebcc98;
  --p-thumb-border: rgba(255, 255, 255, 0.14);
  --p-tile-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  --p-avatar-ring: rgba(255, 255, 255, 0.3);
  --p-avatar-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
  --p-seg-bg: rgba(255, 255, 255, 0.07);
  --p-seg-border: rgba(255, 255, 255, 0.13);
  --p-seg-text: #c6c8d0;
  --p-seg-active-bg: rgba(255, 255, 255, 0.18);
  --p-seg-active-text: #fff;
  --p-seg-shadow: 0 1px 5px rgba(0, 0, 0, 0.18);
  --p-badge-border: rgba(255, 255, 255, 0.2);
  --p-badge-border-hover: rgba(255, 255, 255, 0.4);
  --p-badge-filter: brightness(0.94) saturate(0.9);
  --p-inline-badge-bg: #e9e9ee;
  --p-inline-badge-text: #222;
  --p-pill-logo-filter: brightness(0) invert(1) opacity(0.9);
  --p-pop-solid: #1c1e25;
  --p-pop-border: rgba(255, 255, 255, 0.16);
  --p-pop-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 24px 60px rgba(0, 0, 0, 0.45);
  --p-tip-bg: #eeeef4;
  --p-tip-text: #15161c;
  --p-fab-bg: rgba(28, 30, 37, 0.93);
  --p-fab-text: #f1f1f6;
  --p-fab-border: rgba(255, 255, 255, 0.2);
  --p-fab-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 10px 26px rgba(0, 0, 0, 0.3);
  --p-overlay-bg: rgba(5, 6, 9, 0.86);
}

/* A light backing preserves each logo's own colors on a dark material. */
:root[data-style][data-theme="dark"] .inline-logo {
  background: #fafbfc;
  border-radius: 2px;
  box-shadow: 0 0 0 1.5px #fafbfc;
  margin-left: 2px;
}
:root[data-style][data-theme="dark"] .inline-logo-seal { border-radius: 50%; }
:root[data-style][data-theme="dark"] .timeline-logo {
  background: rgba(250, 250, 252, 0.95);
  border-radius: 16px;
  padding: 9px;
}
:root[data-style][data-theme="dark"] .timeline-logo img { max-height: 100%; max-width: 100%; }

:root[data-style] {
  --p-light-wash: rgba(255, 255, 255, 0.72);
  --p-light-rim: rgba(255, 255, 255, 0.95);
  --p-lift-shadow: 0 14px 30px rgba(24, 38, 58, 0.16);
  --p-control-bg: rgba(255, 255, 255, 0.58);
  --p-control-rim: rgba(255, 255, 255, 0.95);
  --p-control-edge: rgba(45, 57, 76, 0.13);
}

:root[data-style][data-theme="dark"] {
  --p-light-wash: rgba(205, 225, 255, 0.14);
  --p-light-rim: rgba(224, 239, 255, 0.58);
  --p-lift-shadow: 0 18px 36px rgba(0, 0, 0, 0.35);
  --p-control-bg: rgba(255, 255, 255, 0.07);
  --p-control-rim: rgba(255, 255, 255, 0.3);
  --p-control-edge: rgba(255, 255, 255, 0.17);
}

/* Appearance and background controls end the navigation row. */
:root[data-style] .nav-inner {
  column-gap: 16px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

:root[data-style] .nav-links { gap: 18px; justify-self: end; min-width: 0; }
:root[data-style] .nav-links a:focus-visible {
  outline: 2px solid var(--p-focus);
  outline-offset: 2px;
}

.site-appearance { align-items: center; display: flex; gap: 6px; grid-column: 3; grid-row: 1; }
.site-control {
  align-items: center;
  appearance: none;
  background: var(--p-control-bg);
  border: 1px solid var(--p-control-edge);
  border-radius: 50%;
  box-shadow: inset 0 1px 0 var(--p-control-rim), 0 2px 6px rgba(0, 0, 0, 0.05);
  color: var(--p-ink);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  height: 36px;
  justify-content: center;
  padding: 0;
  transition: background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
  width: 36px;
}
.site-control svg { fill: none; height: 18px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.65; width: 18px; }
.site-control[hidden] { display: none; }
@media (hover: hover) and (pointer: fine) {
  .site-control:hover { background: var(--p-chip-hover-bg); box-shadow: inset 0 1px 0 var(--p-control-rim), 0 4px 12px rgba(0, 0, 0, 0.1); }
}
.site-control:active { transform: scale(0.92); }
.site-control:focus-visible,
.background-reset:focus-visible { outline: 2px solid var(--p-focus); outline-offset: 3px; }
:root[data-theme="light"] .theme-sun,
:root[data-theme="dark"] .theme-moon,
.motion-toggle:not([data-state="paused"]) .motion-play,
.motion-toggle[data-state="paused"] .motion-pause { display: none; }

.background-panel {
  background: var(--p-pop-solid);
  border: 1px solid var(--p-pop-border);
  border-radius: 20px;
  box-shadow: inset 0 1px 0 var(--p-control-rim), 0 18px 54px rgba(0, 0, 0, 0.22);
  color: var(--p-text);
  font: 14px/1.4 var(--p-font);
  overflow: auto;
  padding: 14px 18px 12px;
  position: fixed;
  z-index: 1200;
}
.background-panel[hidden] { display: none; }
.background-panel-heading { align-items: center; display: flex; justify-content: space-between; margin-bottom: 10px; }
.background-panel-heading strong { color: var(--p-ink); font-size: 14px; font-weight: 650; }
.background-close { background: transparent; border: 0; box-shadow: none; height: 28px; margin-right: -6px; width: 28px; }
.background-layouts {
  background: var(--p-seg-bg);
  border: 1px solid var(--p-seg-border);
  border-radius: 999px;
  display: grid;
  gap: 2px;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  margin-bottom: 16px;
  padding: 2px;
}
.background-layouts button {
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--p-seg-text);
  cursor: pointer;
  font: 600 12px/1.4 var(--p-font);
  padding: 5px 0;
}
.background-layouts button[aria-pressed="true"] {
  background: var(--p-seg-active-bg);
  box-shadow: var(--p-seg-shadow);
  color: var(--p-seg-active-text);
}
.background-layouts button:focus-visible { outline: 2px solid var(--p-focus); outline-offset: 1px; }
.background-setting { align-items: center; display: grid; gap: 9px 12px; grid-template-columns: 1fr auto; margin-bottom: 17px; }
.background-setting label { color: var(--p-text); font-weight: 550; }
.background-setting output { color: var(--p-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.background-setting input {
  accent-color: var(--p-ink);
  cursor: pointer;
  grid-column: 1 / -1;
  height: 18px;
  margin: 0;
  width: 100%;
}
.background-setting input:focus-visible { outline: 2px solid var(--p-focus); outline-offset: 4px; border-radius: 8px; }
.background-reset { background: transparent; border: 0; border-radius: 6px; color: var(--p-link); cursor: pointer; font: 550 12px/1.4 var(--p-font); padding: 5px 0; }
@media (hover: hover) and (pointer: fine) {
  .background-reset:hover { text-decoration: underline; text-underline-offset: 3px; }
}

/*
 * Cards with pointer feedback: .fun-fact and .interest-card.
 * ::before is the card surface and ::after its 1px edge; under a mouse pointer
 * both tilt while the text stays flat. collage.js adds a .card-light to each
 * card: the lift shadow, a rim highlight and a soft light that follows the
 * pointer. The light gradient stays static; moving the pointer only updates
 * its offset and the tilt. Set on the card:
 *   --card-surface  fill color          --card-edge  edge color
 *   --card-ring     edge image(s), drawn over --card-edge by default
 *   --card-shadow   resting shadow      --card-tilt  tilt scale (0 disables tilt)
 */
@property --tilt-x {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
@property --tilt-y {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
:root[data-style] .fun-fact {
  --card-surface: var(--p-inset-bg);
  --card-edge: var(--p-inset-border);
  --card-shadow: var(--p-inset-shadow);
  --card-sheen: none;
  --card-tilt: 1;
}
:root[data-style] .interest-card {
  --card-surface: var(--p-card-bg);
  --card-edge: var(--p-card-border);
  --card-shadow: var(--p-card-shadow);
  --card-sheen: var(--p-glass-sheen);
  --card-tilt: 0.55;
}
:root[data-style] :is(.fun-fact, .interest-card) {
  --card-ring: linear-gradient(var(--card-edge), var(--card-edge));
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  isolation: isolate;
  position: relative;
  /* A lifted card (below) stays above its neighbours until its shadow has faded. */
  transition: transform 340ms cubic-bezier(0.2, 0.7, 0.2, 1), z-index 0s 240ms;
  z-index: 0;
}
:root[data-style] :is(.fun-fact, .interest-card):hover { box-shadow: none; }
:root[data-style] :is(.fun-fact, .interest-card)::before,
:root[data-style] :is(.fun-fact, .interest-card)::after,
:root[data-style] .card-light {
  --tilt-x: inherit;
  --tilt-y: inherit;
  border-radius: inherit;
  inset: -1px;
  pointer-events: none;
  position: absolute;
  transform: perspective(900px) rotateX(calc(var(--tilt-x) * var(--card-tilt))) rotateY(calc(var(--tilt-y) * var(--card-tilt)));
  transition: transform 340ms cubic-bezier(0.2, 0.7, 0.2, 1);
  z-index: -1;
}
:root[data-style] :is(.fun-fact, .interest-card)::before,
:root[data-style] :is(.fun-fact, .interest-card)::after { content: ""; }
:root[data-style] :is(.fun-fact, .interest-card)::before {
  background: var(--card-sheen), var(--card-surface);
  box-shadow: var(--card-shadow);
}
:root[data-style] :is(.fun-fact, .interest-card)::after,
:root[data-style] .card-light::after {
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  padding: 1px;
}
:root[data-style] :is(.fun-fact, .interest-card)::after { background: var(--card-ring); }
:root[data-style] :is(.fun-fact, .interest-card):focus-within { --card-edge: var(--p-focus); }

:root[data-style] .card-light {
  box-shadow: var(--p-lift-shadow);
  opacity: 0;
  overflow: hidden;
  transition: transform 340ms cubic-bezier(0.2, 0.7, 0.2, 1), opacity 240ms ease;
}
:root[data-style] .card-light::before {
  background: radial-gradient(closest-side, color-mix(in srgb, var(--p-light-wash) 55%, transparent), transparent);
  content: "";
  height: 140%;
  left: 0;
  position: absolute;
  top: 0;
  transform: translate3d(calc(var(--light-x, 0px) - 50%), calc(var(--light-y, 0px) - 50%), 0);
  width: 140%;
}
:root[data-style] .card-light::after {
  background: linear-gradient(135deg, var(--p-light-rim), transparent 36%, transparent 62%, var(--p-light-rim));
  border-radius: inherit;
  content: "";
  inset: 0;
  position: absolute;
}

/*
 * Fun facts tilt as one plane, text included: one mild perspective, at most
 * about 2.3 by 2.9 degrees, applied only while the pointer moves. When it rests
 * (collage.js drops .is-tilting) or leaves, the card settles flat on a plain
 * translation, so the text is crisp again.
 */
:root[data-style] .fun-fact { --card-tilt: 0.65; }
:root[data-style] .fun-fact::before,
:root[data-style] .fun-fact::after,
:root[data-style] .fun-fact > .card-light { transform: none; }

@media (hover: hover) and (pointer: fine) {
  :root[data-style] :is(.fun-fact, .interest-card).is-pointer-active {
    transform: translateY(-3px);
    transition: transform 200ms cubic-bezier(0.2, 0.7, 0.2, 1);
    z-index: 1;
  }
  :root[data-style] .fun-fact.is-pointer-active.is-tilting {
    transform: perspective(1200px) translateY(-3px) rotateX(calc(var(--tilt-x) * var(--card-tilt))) rotateY(calc(var(--tilt-y) * var(--card-tilt)));
    transition: transform 100ms ease-out;
    will-change: transform;
  }
  :root[data-style] .fun-fact.is-pointer-active::before,
  :root[data-style] .fun-fact.is-pointer-active::after,
  :root[data-style] .fun-fact.is-pointer-active > .card-light { will-change: auto; }
  :root[data-style] .is-pointer-active::before,
  :root[data-style] .is-pointer-active::after,
  :root[data-style] .is-pointer-active > .card-light {
    transition: transform 100ms ease-out, opacity 240ms ease;
    will-change: transform;
  }
  :root[data-style] .is-pointer-active > .card-light { opacity: 1; }
  :root[data-style] .is-pointer-active > .card-light::before { will-change: transform; }
  :root[data-style] :is(.pill-link, .filter-btn, .pub-link, .pub-show-all, .gallery-actions button, .site-control) {
    transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease, color 180ms ease;
  }
  :root[data-style] :is(.pill-link, .pub-link, .pub-show-all, .gallery-actions button, .site-control):hover { transform: translateY(-2px); }
  :root[data-style] .filter-btn:hover { transform: translateY(-1px); }
  :root[data-style] :is(.pill-link, .filter-btn, .pub-link, .pub-show-all, .gallery-actions button, .site-control):active { transform: translateY(0) scale(0.96); }
}

@media (max-width: 980px) {
  :root[data-style] .nav-inner {
    align-items: center;
    gap: 5px 12px;
    grid-template-columns: minmax(0, 1fr) auto;
    height: auto;
    padding-bottom: 5px;
    padding-top: 9px;
  }
  :root[data-style] .site-appearance { grid-column: 2; }
  :root[data-style] .nav-links {
    gap: 18px;
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    /* The row scrolls, so it clips; padding gives focus rings and the current-section
       lens (10px wider than its link) and its shadow room, the right padding keeps the
       lens clear of the fade, and the negative margins keep the layout. */
    --nav-fade: 28px;
    margin: -4px 0 -5px -18px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - var(--nav-fade)), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - var(--nav-fade)), transparent);
    overflow-x: auto;
    padding: 4px 40px 14px 18px;
    scrollbar-width: none;
    width: calc(100% + 18px);
  }
  :root[data-style] .nav-links::-webkit-scrollbar { display: none; }
}

@media (min-width: 861px) and (max-width: 960px) {
  :root[data-style] .interest-grid { grid-auto-rows: auto; }
  :root[data-style] .interest-window-content { height: auto; }
  :root[data-style] .interest-topics { gap: 5px; grid-template-rows: none; height: auto; }
  :root[data-style] .interest-topics li { white-space: normal; }
}

@media (pointer: coarse) {
  .site-appearance .site-control { height: 42px; width: 42px; }
  .background-setting input { height: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  :root[data-style] :is(.fun-fact, .interest-card),
  :root[data-style] :is(.fun-fact, .interest-card)::before,
  :root[data-style] :is(.fun-fact, .interest-card)::after,
  :root[data-style] :is(.pill-link, .filter-btn, .pub-link, .pub-show-all, .gallery-actions button, .site-control) { transition: none; }
  :root[data-style] :is(.fun-fact, .interest-card).is-pointer-active,
  :root[data-style] :is(.fun-fact, .interest-card).is-pointer-active::before,
  :root[data-style] :is(.fun-fact, .interest-card).is-pointer-active::after,
  :root[data-style] :is(.pill-link, .filter-btn, .pub-link, .pub-show-all, .gallery-actions button, .site-control):is(:hover, :active) { transform: none; }
}

/* Keep the site's blue actions, gold highlights and original logo artwork. */
:root[data-style][data-theme] :is(.profile-badge img, .pill-logo, .inline-logo, .timeline-logo img),
:root[data-style][data-theme] .pill-link:hover .pill-logo { filter: none; }

:root[data-style] .profile-badge {
  border-color: var(--brand-border, var(--p-badge-border));
}
:root[data-style] .profile-badge:hover {
  border-color: var(--brand-color, var(--p-badge-border-hover));
}
.badge-github { --brand-border: rgba(24, 23, 23, 0.38); --brand-color: #181717; }
.badge-scholar { --brand-border: rgba(66, 133, 244, 0.42); --brand-color: #4285f4; }
.badge-zhihu { --brand-border: rgba(0, 132, 255, 0.42); --brand-color: #0084ff; }
.badge-rednote { --brand-border: rgba(255, 36, 66, 0.42); --brand-color: #ff2442; }
.badge-bilibili { --brand-border: rgba(0, 174, 236, 0.42); --brand-color: #00aeec; }
.badge-steam { --brand-border: rgba(19, 67, 117, 0.42); --brand-color: #134375; }

:root[data-style] :is(.pill-link, .pub-link, .filter-btn, .research-paper-links a) {
  background: rgba(255, 255, 255, 0.94);
  border-color: var(--blue);
  color: var(--blue);
}
@media (hover: hover) and (pointer: fine) {
  :root[data-style] :is(.pill-link, .pub-link, .research-paper-links a):hover,
  :root[data-style] .filter-btn:not([data-filter]):hover {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
  }
  :root[data-style] .pill-link:hover .pill-logo {
    background: #fff;
    border-radius: 2px;
    box-shadow: 0 0 0 2px #fff;
  }
}

/*
 * Category tags and their filters are one system. Each keeps its category hue
 * from site.css; lightness, fill and edge adapt to the design and appearance.
 */
:root[data-style] :is(.tag, .filter-btn[data-filter]) {
  --tag-hue: var(--tag-color, var(--blue));
  --tag-ink: color-mix(in oklab, var(--tag-hue) 86%, #000);
  --tag-fill: color-mix(in srgb, var(--tag-hue) 9%, transparent);
  --tag-fill-hover: color-mix(in srgb, var(--tag-hue) 16%, transparent);
  --tag-edge: color-mix(in srgb, var(--tag-hue) 24%, transparent);
  --tag-edge-hover: color-mix(in srgb, var(--tag-hue) 46%, transparent);
  --tag-solid: var(--tag-ink);
  --tag-on-solid: #fff;
  --tag-sheen: 0 0 #0000;
  background: var(--tag-fill);
  border: 1px solid var(--tag-edge);
  border-radius: 999px;
  box-shadow: var(--tag-sheen);
  color: var(--tag-ink);
}
:root[data-style] .tag { padding: 1px 8px; }
:root[data-style][data-theme="dark"] :is(.tag, .filter-btn[data-filter]) {
  --tag-ink: color-mix(in oklab, var(--tag-hue) 50%, #fff);
  --tag-fill: color-mix(in srgb, var(--tag-ink) 12%, transparent);
  --tag-fill-hover: color-mix(in srgb, var(--tag-ink) 20%, transparent);
  --tag-edge: color-mix(in srgb, var(--tag-ink) 28%, transparent);
  --tag-edge-hover: color-mix(in srgb, var(--tag-ink) 54%, transparent);
  --tag-on-solid: #121318;
}

/* Filter states: a stronger tint on hover, the solid hue when selected. */
@media (hover: hover) and (pointer: fine) {
  :root[data-style] .filter-btn[data-filter]:hover {
    background: var(--tag-fill-hover);
    border-color: var(--tag-edge-hover);
    box-shadow: var(--tag-sheen);
    color: var(--tag-ink);
  }
}
:root[data-style] .filter-btn[data-filter].active,
:root[data-style] .filter-btn[data-filter].active:hover {
  background: var(--tag-solid);
  border-color: var(--tag-solid);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 2px 8px color-mix(in srgb, var(--tag-solid) 32%, transparent);
  color: var(--tag-on-solid);
}
:root[data-style] .filter-btn[data-filter]:focus-visible {
  outline: 2px solid var(--tag-ink);
  outline-offset: 2px;
}
:root[data-style] :is(.pill-link, .pub-link, .research-paper-links a, .filter-btn:not([data-filter]), .pub-show-all, .gallery-actions button):focus-visible {
  outline: 2px solid var(--p-focus);
  outline-offset: 2px;
}
:root[data-style] .paper-highlight {
  background: #fff8e6;
  border-color: #ead6a4;
  color: #7a4b00;
}
@media (hover: hover) and (pointer: fine) {
  :root[data-style] .paper-highlight:hover {
    background: #fff1cc;
    border-color: #d7b76c;
    color: #684100;
  }
}
:root[data-style] .paper-highlight i { color: var(--orange); }

:root[data-style] :is(.pub-show-all, .gallery-actions button) {
  background: var(--ink);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
@media (hover: hover) and (pointer: fine) {
  :root[data-style] :is(.pub-show-all, .gallery-actions button):hover { background: var(--blue); }
}
:root[data-style] .gallery-view-toggle button.active { background: #fff; color: var(--blue); }
:root[data-style] .back-to-top { background: var(--blue); color: #fff; }
:root[data-style] .bio-icon-horizon { color: var(--blue); }
:root[data-style] .bio-icon-improve { color: var(--green); }
:root[data-style] .bio-icon-observe { color: var(--orange); }
/* Dark: lighter versions of the same three hues (dark tokens), no tiles. */
:root[data-style][data-theme="dark"] .bio-icon-horizon { color: var(--p-icon-1); }
:root[data-style][data-theme="dark"] .bio-icon-improve { color: var(--p-icon-2); }
:root[data-style][data-theme="dark"] .bio-icon-observe { color: var(--p-icon-3); }

/*
 * Collage geometry, light palette and the materials that differ by theme.
 * The photography collection drifts behind the panels (see the background
 * section at the end).
 */

:root[data-style] {
  --p-title-size: 28px;
  --p-title-weight: 650;
  --p-title-tracking: -0.02em;

  --p-gap: calc(22px * var(--p-space));
  --p-panel-radius: 20px;
  --p-panel-pad: calc(34px * var(--p-space)) calc(38px * var(--p-space-x));
  --p-card-radius: 16px;
  --p-inset-radius: 14px;
  --p-row-radius: 12px;

  --p-chip-radius: 999px;
  --p-tag-radius: 999px;
  --p-btn-radius: 999px;
  --p-thumb-radius: 10px;
  --p-tile-radius: 12px;
  --p-pop-radius: 16px;
  --p-overlay-filter: blur(20px);

  -webkit-font-smoothing: antialiased;
}

/* Narrow screens: panels share the hero's side padding instead of the desktop 38px. */
@media (max-width: 860px) {
  :root[data-style] { --p-panel-pad: calc(30px * var(--p-space)) calc(26px * var(--p-space-x)); }
}

@media (max-width: 560px) {
  :root[data-style] {
    --p-title-size: 23px;
    --p-gap: calc(16px * var(--p-space));
    --p-panel-pad: calc(22px * var(--p-space)) calc(16px * var(--p-space-x));
    --p-panel-radius: 18px;
  }
}

/*
 * Wide layout: windows wider than 1440px get a wider column, up to 1280px at
 * 1940px. Long text keeps its measure, the gallery keeps five columns so its
 * rows stay full, and publication figures grow a little.
 */
:root[data-style][data-layout="wide"] { --p-container: clamp(1080px, 1080px + (100vw - 1440px) * 0.4, 1280px); }
@media (min-width: 1500px) {
  :root[data-style][data-layout="wide"] { --pub-thumb-size: 196px; }
  :root[data-style][data-layout="wide"] .hero > .collaboration-note { max-width: 60rem; }
  :root[data-style][data-layout="wide"] .gallery-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* Light appearance */
:root[data-style][data-theme="light"] {
  --p-canvas: #d4d6d8;
  --p-ink: #15171c;
  --p-text: #2d3037;
  --p-muted: #4e535e;
  --p-link: #17497d;
  --p-link-hover: #0d335c;
  --p-link-underline: rgba(23, 73, 125, 0.35);
  --p-accent: #a85c30;
  --p-accent-text: #93461e;
  --p-line: rgba(20, 25, 35, 0.12);
  --p-hover: rgba(255, 255, 255, 0.45);
  --p-focus: #17497d;
  --p-selection: rgba(23, 73, 125, 0.18);
  --p-scroll-thumb: rgba(20, 25, 35, 0.27);
  --p-icon-1: #2f5d8c;
  --p-icon-2: #376c53;
  --p-icon-3: #a65828;
  --p-panel-bg: rgb(252 253 255 / calc(0.84 - 0.42 * var(--glass)));
  --p-panel-border: rgba(255, 255, 255, 0.7);
  --p-panel-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 -1px 0 rgba(255, 255, 255, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.18), inset 0 0 0 2px rgba(255, 255, 255, 0.1), 0 18px 48px rgba(20, 30, 45, 0.12);
  --p-card-bg: rgb(253 254 255 / calc(0.82 - 0.4 * var(--glass)));
  --p-card-border: rgba(255, 255, 255, 0.75);
  --p-card-shadow: inset 0 1px 0 #fff, inset 0 -1px 0 rgba(255, 255, 255, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.18), inset 0 0 0 2px rgba(255, 255, 255, 0.1), 0 14px 34px rgba(20, 30, 45, 0.12);
  --p-card-bar-bg: rgb(255 255 255 / calc(0.25 - 0.13 * var(--glass)));
  --p-inset-bg: rgb(255 255 255 / calc(0.44 - 0.26 * var(--glass)));
  --p-inset-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  --p-glass-sheen: radial-gradient(1100px 300px at 16% -60px, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0) 72%);
  --p-inset-border: rgba(30, 40, 55, 0.13);
  --p-nav-bg: rgba(247, 249, 253, 0.48);
  --p-nav-edge: rgba(247, 249, 253, 0.97);
  --p-nav-filter: blur(16px) saturate(1.5);
  --p-nav-border: rgba(255, 255, 255, 0.75);
  --p-nav-shadow: 0 6px 24px rgba(20, 30, 45, 0.08);
  --p-chip-bg: rgba(255, 255, 255, 0.6);
  --p-chip-border: rgba(35, 45, 60, 0.15);
  --p-chip-text: #232730;
  --p-chip-hover-bg: rgba(255, 255, 255, 0.95);
  --p-chip-hover-border: rgba(35, 45, 60, 0.25);
  --p-chip-active-bg: #292e38;
  --p-chip-active-text: #fff;
  --p-chip-active-border: #292e38;
  --p-tag-bg: rgba(20, 25, 35, 0.07);
  --p-tag-text: #424854;
  --p-btn-bg: #292e38;
  --p-btn-text: #fff;
  --p-btn-hover: #11141a;
  --p-hl-bg: rgba(255, 244, 220, 0.72);
  --p-hl-border: rgba(160, 110, 40, 0.3);
  --p-hl-text: #6e4610;
  --p-hl-icon: #9d5c0c;
  --p-gold: #6a4c17;
  --p-thumb-border: rgba(255, 255, 255, 0.8);
  --p-tile-shadow: 0 8px 20px rgba(20, 30, 45, 0.15);
  --p-avatar-ring: rgba(255, 255, 255, 0.92);
  --p-avatar-shadow: 0 16px 36px rgba(20, 30, 45, 0.18);
  --p-seg-bg: rgba(30, 40, 55, 0.07);
  --p-seg-border: rgba(30, 40, 55, 0.09);
  --p-seg-text: #4e535e;
  --p-seg-active-bg: rgba(255, 255, 255, 0.96);
  --p-seg-active-text: #15171c;
  --p-seg-shadow: 0 1px 5px rgba(20, 30, 45, 0.12);
  --p-badge-border: rgba(255, 255, 255, 0.8);
  --p-badge-border-hover: #fff;
  --p-badge-filter: none;
  --p-inline-badge-bg: #f4f5f8;
  --p-inline-badge-text: #222;
  --p-pill-logo-filter: brightness(0) opacity(0.85);
  --p-pop-solid: #fafcff;
  --p-pop-border: rgba(30, 40, 55, 0.15);
  --p-pop-shadow: 0 24px 60px rgba(20, 30, 45, 0.2);
  --p-tip-bg: #292e38;
  --p-tip-text: #fff;
  --p-fab-bg: rgba(249, 251, 255, 0.92);
  --p-fab-text: #20252e;
  --p-fab-border: rgba(255, 255, 255, 0.8);
  --p-fab-shadow: inset 0 1px 0 #fff, 0 10px 26px rgba(20, 30, 45, 0.16);
  --p-overlay-bg: rgba(8, 11, 17, 0.8);
}

/* A faint cool light keeps the card hover sheen visible on near-white glass. */
:root[data-style][data-theme="light"] {
  --p-light-wash: rgba(150, 182, 235, 0.42);
  --p-light-rim: rgba(118, 152, 210, 0.62);
}

/* Dark appearance: smoked glass that lets the photographs keep their color. */
:root[data-style][data-theme="dark"] {
  --p-panel-bg: rgb(17 19 25 / calc(0.88 - 0.16 * var(--glass)));
  --p-card-bg: rgb(21 23 30 / calc(0.89 - 0.16 * var(--glass)));
  --p-panel-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.035), inset 0 0 0 2px rgba(255, 255, 255, 0.02), 0 18px 48px rgba(0, 0, 0, 0.28);
  --p-card-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.035), inset 0 0 0 2px rgba(255, 255, 255, 0.02), 0 14px 34px rgba(0, 0, 0, 0.28);
  --p-inset-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --p-glass-sheen: radial-gradient(1100px 300px at 16% -60px, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0) 72%);
  --collage-action: #bad4ff;
  --collage-action-ink: #0f1828;
  /* Turns a single-colour glyph into --collage-action; recompute if that changes. */
  --collage-action-filter: brightness(0) invert(77%) sepia(51%) saturate(417%) hue-rotate(187deg) contrast(102%);
}

/*
 * Category tags and filters: rounded labels like the prints in the collage.
 * Frosted paper on light glass, smoked glass on dark; the category hue stays
 * in the text and edge, and a selected filter fills with it.
 */
:root[data-style] :is(.tag, .filter-btn[data-filter]) {
  --tag-ink: color-mix(in oklab, var(--tag-hue) 84%, #000);
  --tag-fill: color-mix(in srgb, var(--tag-hue) 7%, rgba(255, 255, 255, 0.62));
  --tag-fill-hover: color-mix(in srgb, var(--tag-hue) 13%, rgba(255, 255, 255, 0.82));
  --tag-edge: color-mix(in srgb, var(--tag-hue) 24%, rgba(255, 255, 255, 0.6));
  --tag-edge-hover: color-mix(in srgb, var(--tag-hue) 46%, transparent);
  --tag-sheen: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 1px 2px rgba(20, 30, 45, 0.07);
  border-radius: 999px;
}
:root[data-style][data-theme="dark"] :is(.tag, .filter-btn[data-filter]) {
  --tag-ink: color-mix(in oklab, var(--tag-hue) 48%, #fff);
  --tag-fill: color-mix(in srgb, var(--tag-ink) 11%, rgba(8, 10, 15, 0.28));
  --tag-fill-hover: color-mix(in srgb, var(--tag-ink) 19%, rgba(8, 10, 15, 0.28));
  --tag-edge: color-mix(in srgb, var(--tag-ink) 27%, transparent);
  --tag-edge-hover: color-mix(in srgb, var(--tag-ink) 54%, transparent);
  --tag-sheen: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 2px rgba(0, 0, 0, 0.2);
}
:root[data-style][data-theme] .tag {
  border-radius: var(--p-tag-radius);
  padding: 1px 9px;
}

/* The tag-list toggle sits in the filter row, so it takes the row's shape. */
:root[data-style] .filter-btn:not([data-filter]) {
  border-radius: 999px;
  border-width: 1px;
}

/*
 * Dark actions keep their blue and gold meaning as tinted glass; white chips
 * and the near-black button would otherwise glare or disappear on smoked glass.
 */
:root[data-style][data-theme="dark"] :is(.pill-link, .pub-link, .research-paper-links a, .filter-btn:not([data-filter])) {
  background: rgba(186, 212, 255, 0.08);
  border-color: rgba(186, 212, 255, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--collage-action);
}
:root[data-style][data-theme="dark"] :is(.pub-show-all, .gallery-actions button) {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 0 0 1px rgba(255, 255, 255, 0.12);
  color: var(--p-ink);
}
/*
 * The two pill SVGs are single-colour #124f8f glyphs, so they follow the pill
 * text like the icon font: light blue in dark, also while a tap leaves :hover
 * behind, and the hover text colour under a real pointer (below), as the
 * original site does, instead of a white plate.
 */
:root[data-style][data-theme="dark"] .pill-link .pill-logo,
:root[data-style][data-theme="dark"] .pill-link:hover .pill-logo {
  background: none;
  box-shadow: none;
  filter: var(--collage-action-filter);
}
:root[data-style][data-theme="dark"] .back-to-top {
  background: var(--collage-action);
  color: var(--collage-action-ink);
}
:root[data-style][data-theme="dark"] .gallery-view-toggle button.active {
  background: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 1px 4px rgba(0, 0, 0, 0.25);
  color: var(--collage-action);
}
:root[data-style][data-theme="dark"] .paper-highlight {
  background: rgba(235, 204, 152, 0.1);
  border-color: rgba(235, 204, 152, 0.38);
  color: #f0d29f;
}
:root[data-style][data-theme="dark"] .paper-highlight i { color: var(--p-hl-icon); }

/*
 * Profile links: glass card buttons of the same material as the round controls
 * in the navigation. The label stays ink; each icon keeps its brand colour,
 * lightened in dark only where the brand colour is near black or too dim.
 */
.brand-cv, .brand-email { --brand: var(--p-link); }
.brand-scholar { --brand: #4285f4; }
.brand-github { --brand: #181717; }
.brand-linkedin { --brand: #0a66c2; }
.brand-zhihu { --brand: #0084ff; }
.brand-rednote { --brand: #ff2442; }
.brand-bilibili { --brand: #00aeec; }
.brand-steam { --brand: #1b2838; }
:root[data-theme="dark"] .brand-github { --brand: #f0f6fc; }
:root[data-theme="dark"] .brand-linkedin { --brand: #70b5f9; }
:root[data-theme="dark"] .brand-steam { --brand: #c7d5e0; }
:root[data-style][data-theme] .hero-links .pill-link {
  background: var(--p-control-bg);
  border: 1px solid var(--p-control-edge);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 var(--p-control-rim), 0 2px 6px rgba(0, 0, 0, 0.05);
  color: var(--p-ink);
  font-weight: 600;
  padding: 6px 13px;
}
:root[data-style][data-theme] .hero-links .pill-link > i { color: var(--brand); }
:root[data-style][data-theme] .hero-links .pill-link .pill-logo,
:root[data-style][data-theme] .hero-links .pill-link:hover .pill-logo {
  background: none;
  box-shadow: none;
  filter: none;
}
:root[data-style][data-theme] .hero-links .pill-link:focus-visible { outline: 2px solid var(--p-focus); outline-offset: 2px; }

/* Hover fills need a real hovering pointer; a tap must not leave them behind. */
@media (hover: hover) and (pointer: fine) {
  :root[data-style][data-theme="dark"] :is(.pill-link, .pub-link, .research-paper-links a, .filter-btn:not([data-filter])):hover,
  :root[data-style][data-theme="dark"] :is(.pub-show-all, .gallery-actions button):hover {
    background: var(--collage-action);
    border-color: var(--collage-action);
    color: var(--collage-action-ink);
  }
  :root[data-style][data-theme] .pill-link:hover .pill-logo {
    background: none;
    box-shadow: none;
    filter: brightness(0) invert(1);
  }
  :root[data-style][data-theme="dark"] .pill-link:hover .pill-logo { filter: brightness(0); }
  :root[data-style][data-theme] .hero-links .pill-link:hover {
    background: var(--p-chip-hover-bg);
    border-color: var(--p-control-edge);
    box-shadow: inset 0 1px 0 var(--p-control-rim), 0 4px 12px rgba(0, 0, 0, 0.1);
    color: var(--p-ink);
  }
  :root[data-style][data-theme="dark"] .paper-highlight:hover {
    background: rgba(235, 204, 152, 0.18);
    border-color: rgba(235, 204, 152, 0.62);
    color: #f7e2bd;
  }
}

/*
 * Photo background: one pre-baked texture of the gallery (images/background,
 * built by scripts/build-background.py) repeated on a tilted plane. collage.js
 * sizes the plane to cover the background area and drifts the texture with a
 * compositor animation. Blur and corners are baked in, so nothing is filtered
 * at run time, and the fixed, clipped layer keeps rendering to the viewport.
 *
 * Wide windows: the area is at most --backdrop-band wide (collage.js sets it
 * from the page layout), centred on the canvas. Its sides fade into the canvas
 * colour over --edge-fade, which grows only once the window is wider than the
 * band (Focus), than 1680px (Wide) or than 1440px (Dusk). Both gradients are
 * static layers over the plane.
 */
:root[data-style] {
  --edge-fade: clamp(0px, (100vw - var(--backdrop-band, 100vw)) / 2, 240px);
  --backdrop-edges: linear-gradient(90deg, var(--p-canvas), transparent var(--edge-fade), transparent calc(100% - var(--edge-fade)), var(--p-canvas));
}
:root[data-style][data-layout="wide"] { --edge-fade: clamp(0px, (100vw - 1680px) * 0.4, 360px); }
:root[data-style][data-layout="dusk"] { --edge-fade: clamp(0px, (100vw - 1440px) * 0.6, 600px); }
:root[data-style][data-theme="light"] {
  --backdrop-opacity: 0.3;
  --backdrop-veil: linear-gradient(180deg, rgba(236, 241, 248, 0.27), rgba(242, 245, 250, 0.12) 45%, rgba(236, 241, 248, 0.26));
}
/* Dark: the photographs stay recognisable through the glass but recede. */
:root[data-style][data-theme="dark"] {
  --backdrop-opacity: 0.5;
  --backdrop-veil:
    radial-gradient(120% 90% at 50% 40%, rgba(12, 13, 15, 0.1), rgba(12, 13, 15, 0.5)),
    linear-gradient(180deg, rgba(12, 13, 15, 0.38), rgba(12, 13, 15, 0.14) 30%, rgba(12, 13, 15, 0.44));
}
/* Dusk: dimmer still, and darker towards the bottom of the window. */
:root[data-style][data-theme="dark"][data-layout="dusk"] {
  --backdrop-opacity: 0.4;
  --backdrop-veil:
    radial-gradient(130% 100% at 50% 20%, rgba(12, 13, 15, 0.05), rgba(12, 13, 15, 0.55)),
    linear-gradient(180deg, rgba(12, 13, 15, 0.3), rgba(12, 13, 15, 0.12) 25%, rgba(12, 13, 15, 0.6));
}
:root[data-style][data-theme="light"][data-layout="dusk"] {
  --backdrop-opacity: 0.26;
  --backdrop-veil: linear-gradient(180deg, rgba(236, 241, 248, 0.2), rgba(242, 245, 250, 0.14) 40%, rgba(236, 241, 248, 0.4));
}
.backdrop {
  contain: strict;
  inset: 0;
  margin-inline: auto;
  max-width: var(--backdrop-band, none);
  overflow: hidden;
  pointer-events: none;
  position: fixed;
  z-index: -1;
}
.backdrop::after {
  background: var(--backdrop-edges), var(--backdrop-veil);
  content: "";
  inset: 0;
  position: absolute;
}
.backdrop-plane {
  left: 50%;
  opacity: 0;
  position: absolute;
  top: 50%;
  transition: opacity 700ms ease;
}
.backdrop-plane.is-ready { opacity: var(--backdrop-opacity); }
.backdrop-texture {
  background-position: 50% 0;
  background-repeat: repeat;
  left: 0;
  position: absolute;
  top: 0;
  width: 100%;
  will-change: transform;
}
