/* ==========================================================================
   site.css — Xiaoyu (Shaw) Xia · academic homepage
   --------------------------------------------------------------------------
   1. Design tokens
   2. Reset & base typography
   3. Top navigation
   4. Page layout (nav + sidebar + content)
   5. Profile sidebar
   6. Content blocks (headings, lists, news, awards)
   7. Publications
   8. Analytics widget
   9. Footer & utilities
   ========================================================================== */

/* ==========================================================================
   1. Design tokens
   ========================================================================== */

:root {
  /* Brand */
  --brand:          #13294b;   /* RMIT navy — nav, headings */
  --brand-soft:     #1f4374;
  --accent:         #c8a028;   /* muted gold — rules, markers */
  --link:           #1c6ea4;
  --link-hover:     #0d4b76;
  --heading:        #13294b;   /* headings & section titles */
  --spark:          #0f3d1f;   /* SPARK Lab green */
  --icon:           #13294b;   /* social icons */

  /* Ink & surfaces */
  --ink:            #4a4f57;
  --ink-strong:     #23262b;
  --ink-muted:      #7c828c;
  --surface:        #ffffff;
  --surface-2:      #f6f7f9;
  --surface-3:      #eef0f4;
  --border:         #e2e5ea;

  /* Semantic accents used in the news list */
  --venue:          #2e7d32;   /* venue / good news */
  --person:         #9c4dcc;   /* student names */
  --alert:          #d84315;   /* call-outs */

  /* Spacing scale (4 px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  /* Structure */
  --page-max:   1120px;
  --gutter:     clamp(1rem, 4vw, 2.5rem);
  --sidebar-w:  240px;
  --column-gap: clamp(2rem, 5vw, 4.5rem);
  --nav-h:      56px;

  /* Shape & depth */
  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 14px;
  --shadow-1:  0 1px 2px rgba(19, 41, 75, 0.06), 0 2px 8px rgba(19, 41, 75, 0.06);
  --shadow-2:  0 4px 10px rgba(19, 41, 75, 0.10), 0 12px 28px rgba(19, 41, 75, 0.10);

  /* Type */
  --font-body: "Crimson Pro", Georgia, "Times New Roman", serif;
  --font-mono: "Ubuntu Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --leading:   1.6;

  color-scheme: light;
}

/*
 * Dark palette.
 *
 * The same declarations are needed under two different conditions, and CSS has
 * no way to share them across a media query and a plain selector, so the block
 * is written twice — keep the two copies in sync:
 *
 *   1. the media query serves visitors who have not picked a theme (it steps
 *      aside as soon as someone explicitly chooses light);
 *   2. the attribute selector serves an explicit choice made with the toggle,
 *      which assets/js/theme.js stores in localStorage.
 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand:      #0f1723;
    --brand-soft: #1b2a3f;
    --accent:     #d9b44a;
    --link:       #56b6e6;
    --link-hover: #85cbf0;
    --heading:    #56b6e6;
    --icon:       #56b6e6;
    --spark:      #7fc08f;

    --ink:        #c9ccd3;
    --ink-strong: #eef0f4;
    --ink-muted:  #8b919b;
    --surface:    #1b1c24;
    --surface-2:  #22242e;
    --surface-3:  #2a2d39;
    --border:     #333644;

    --venue:      #6cc16f;
    --person:     #c58ae8;
    --alert:      #ff8a65;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.30);
    --shadow-2: 0 4px 10px rgba(0, 0, 0, 0.40), 0 12px 28px rgba(0, 0, 0, 0.35);

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
    --brand:      #0f1723;
    --brand-soft: #1b2a3f;
    --accent:     #d9b44a;
    --link:       #56b6e6;
    --link-hover: #85cbf0;
    --heading:    #56b6e6;
    --icon:       #56b6e6;
    --spark:      #7fc08f;

    --ink:        #c9ccd3;
    --ink-strong: #eef0f4;
    --ink-muted:  #8b919b;
    --surface:    #1b1c24;
    --surface-2:  #22242e;
    --surface-3:  #2a2d39;
    --border:     #333644;

    --venue:      #6cc16f;
    --person:     #c58ae8;
    --alert:      #ff8a65;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.30);
    --shadow-2: 0 4px 10px rgba(0, 0, 0, 0.40), 0 12px 28px rgba(0, 0, 0, 0.35);

    color-scheme: dark;
}

/* ==========================================================================
   2. Reset & base typography
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding-top: var(--nav-h);
  background-color: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;      /* 17px */
  font-weight: 400;
  line-height: var(--leading);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--heading);
  font-weight: 600;
  line-height: 1.25;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0 0 var(--space-4); }

ul, ol { margin: 0 0 var(--space-5); padding-left: 1.35em; }

li { margin-bottom: var(--space-2); }
li:last-child { margin-bottom: 0; }

li::marker { color: var(--accent); }

strong { color: var(--ink-strong); font-weight: 600; }

em { font-style: italic; }

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover,
a:focus-visible { color: var(--link-hover); text-decoration: underline; }

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

hr {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: var(--space-6) 0;
}

code, pre { font-family: var(--font-mono); }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus {
  left: 0;
}

/* ==========================================================================
   3. Top navigation
   ========================================================================== */

.topnav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 999;
  height: var(--nav-h);
  background-color: var(--brand);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

.topnav__inner {
  max-width: var(--page-max);
  height: 100%;
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.topnav__brands {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.topnav__brand { display: inline-flex; align-items: center; }

.topnav__brand img { width: 84px; display: block; }

/* The SPARK mark sits beside the RMIT logo, separated by a hairline rule. */
.topnav__brand-spark {
  padding-left: var(--space-4);
  border-left: 1px solid rgba(255, 255, 255, 0.22);
  opacity: 0.92;
  transition: opacity 0.15s ease;
}

.topnav__brand-spark:hover { opacity: 1; }

.topnav__brand-spark img { width: auto; height: 17px; }

.topnav__links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.topnav__links a {
  color: rgba(255, 255, 255, 0.82);
  white-space: nowrap;
  font-size: 1rem;
  line-height: 1;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.topnav__links a:hover,
.topnav__links a:focus-visible {
  background-color: rgba(255, 255, 255, 0.14);
  color: #fff;
  text-decoration: none;
}

.topnav__links a[aria-current="page"] {
  background-color: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 600;
}

/* Theme toggle ----------------------------------------------------------- */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin-left: var(--space-2);
  padding: 0;
  color: rgba(255, 255, 255, 0.82);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

/* The class sets display, so it has to opt back out when the button is hidden. */
.theme-toggle[hidden] { display: none; }

.theme-toggle:hover,
.theme-toggle:focus-visible {
  background-color: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.theme-toggle__icon {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle__icon--moon { fill: currentColor; stroke: none; }

/* Show the icon for the theme the button would switch *to*. */
.theme-toggle__icon--sun { display: none; }

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

:root[data-theme="dark"] .theme-toggle__icon--sun  { display: block; }
:root[data-theme="dark"] .theme-toggle__icon--moon { display: none; }
:root[data-theme="light"] .theme-toggle__icon--sun  { display: none; }
:root[data-theme="light"] .theme-toggle__icon--moon { display: block; }

/* Space gets tight once the SPARK Lab entry joins the links: drop the RMIT
   logo first, then the SPARK mark, before the links themselves are squeezed. */
@media (max-width: 1000px) {
  .topnav__brand:not(.topnav__brand-spark) { display: none; }
  .topnav__brand-spark { padding-left: 0; border-left: 0; }
}

@media (max-width: 700px) {
  .topnav__brands { display: none; }
  .topnav__inner { justify-content: center; }
  .topnav__links a { padding: var(--space-2) var(--space-2); font-size: 0.95rem; }
}

@media (max-width: 560px) {
  /* "SPARK Lab" is the first thing to give when the bar runs out of room. */
  .nav-word { display: none; }
}

@media (max-width: 440px) {
  .topnav__links a { padding: var(--space-2) 5px; font-size: 0.875rem; }
}

/* ==========================================================================
   4. Page layout
   ========================================================================== */

.wrapper {
  max-width: var(--page-max);
  margin-inline: auto;
  padding: var(--space-7) var(--gutter) var(--space-8);
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  column-gap: var(--column-gap);
  align-items: start;
}

.content { min-width: 0; }

/*
 * Pages that stand on their own — the SPARK Lab page — drop the profile
 * sidebar. Narrower than the full 1120px so the prose keeps a sane measure.
 */
.wrapper--full {
  grid-template-columns: minmax(0, 1fr);
  max-width: 900px;
}

/* The publication list carries wider rows and a wider filter bar. */
.wrapper--wide { max-width: 1000px; }

.content > :first-child { margin-top: 0; }

@media (max-width: 900px) {
  .wrapper {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--space-6);
    padding-top: var(--space-6);
  }
}

/* ==========================================================================
   5. Profile sidebar
   ========================================================================== */

.profile {
  position: sticky;
  top: calc(var(--nav-h) + var(--space-6));
  text-align: center;
}

.profile__avatar {
  display: inline-block;
  width: 150px;
  height: 150px;
  margin-bottom: var(--space-4);
  border-radius: 50%;
  overflow: hidden;
  box-shadow: var(--shadow-1);
  background: var(--surface-2);
}

.profile__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile__name {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.profile__role {
  color: var(--ink);
  font-size: 1.0625rem;
  margin-bottom: var(--space-3);
}

.profile__affiliation {
  font-size: 0.9375rem;
  line-height: 1.45;
  margin-bottom: var(--space-3);
}

.profile__affiliation a { color: inherit; }
.profile__affiliation a:hover { color: var(--link); }

.profile__email {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  word-break: break-word;
  margin-bottom: var(--space-4);
}

.profile__email a { color: var(--ink); }
.profile__email a:hover { color: var(--link); }

.social-icons {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
}

.social-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  color: var(--icon);
  font-size: 1.1rem;
  background: var(--surface-2);
  transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.social-icons a:hover,
.social-icons a:focus-visible {
  transform: translateY(-2px);
  background: var(--surface-3);
  color: var(--link-hover);
  text-decoration: none;
}

@media (max-width: 900px) {
  .profile {
    position: static;
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--border);
  }
  .profile__avatar { width: 128px; height: 128px; }
}

/* ==========================================================================
   6. Content blocks
   ========================================================================== */

.section-title {
  font-size: 1.6rem;
  margin: var(--space-7) 0 var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}

.section-title:first-child { margin-top: 0; }

.subsection-title {
  font-size: 1.15rem;
  margin: var(--space-6) 0 var(--space-3);
}

.lead { font-size: 1.09375rem; }

.page-byline {
  margin: calc(-1 * var(--space-2)) 0 var(--space-5);
  color: var(--ink-muted);
  font-size: 1rem;
}

.page-byline a { color: var(--ink-strong); font-weight: 600; }
.page-byline a:hover { color: var(--link); }

.callout {
  margin: 0 0 var(--space-5);
  padding: var(--space-4) var(--space-5);
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}

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

.callout__lead { margin-bottom: var(--space-2); }

.callout__list {
  margin: 0 0 var(--space-4);
  padding-left: 1.4em;
}

.callout__list li { margin-bottom: var(--space-2); }
.callout__list li::marker { color: var(--ink-muted); font-weight: 600; }

/* Inline semantic accents (replace former inline colour styles) */
.venue  { color: var(--venue); }
.person { color: var(--person); }
.alert  { color: var(--alert); }
.date   { color: var(--ink-strong); font-weight: 600; white-space: nowrap; }

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

.news-list { list-style: none; padding-left: 0; margin-bottom: var(--space-4); }

.news-list li {
  margin-bottom: var(--space-3);
  padding-left: var(--space-5);
  text-indent: calc(-1 * var(--space-5));
}

.news-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  padding: var(--space-2) var(--space-4);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--venue);
  background: color-mix(in srgb, var(--venue) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--venue) 35%, transparent);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.news-toggle:hover {
  color: #fff;
  background: var(--venue);
}

.news-toggle .chevron {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}

.news-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }

#news-extra { display: none; }
#news-extra.is-open { display: block; }

/* Plain reference lists (awards, funding, services, teaching) ------------ */

.stack-list { padding-left: 1.15em; }

.stack-list li { margin-bottom: var(--space-3); }

/* ==========================================================================
   7. Publications
   ========================================================================== */

.pub-scholar {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 0.15em 0.7em;
  border: 1px solid var(--border);
  border-radius: 999px;
  vertical-align: middle;
}

.pub-scholar:hover {
  border-color: var(--link);
  text-decoration: none;
}

.section-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-3); }

.publications { margin-bottom: var(--space-6); }

.publications ol.bibliography {
  list-style: none;
  padding: 0;
  margin: 0;
}

.publications ol.bibliography > li { margin-bottom: var(--space-4); }

.pub-row {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: var(--space-5);
  align-items: center;
  padding: var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.pub-row:hover {
  background: var(--surface-2);
  border-color: var(--border);
  box-shadow: var(--shadow-1);
}

.pub-thumb { position: relative; }

.pub-thumb .teaser {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.badge {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  display: inline-block;
  padding: 0.2em 0.55em;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.02em;
  color: #fff;
  background-color: var(--brand-soft);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-1);
  white-space: nowrap;
}

.pub-meta { min-width: 0; }

.pub-meta > * { margin: 0; }

.pub-meta .title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--ink-strong);
  line-height: 1.35;
  margin-bottom: var(--space-1);
}

.pub-meta .title a { color: inherit; }
.pub-meta .title a:hover { color: var(--link); }

.pub-meta .author {
  font-size: 0.96875rem;
  line-height: 1.5;
  margin-bottom: var(--space-1);
}

.pub-meta .author strong { color: var(--ink-strong); }

.pub-meta .periodical {
  font-size: 0.9375rem;
  color: var(--ink-muted);
}

.pub-links {
  margin-top: var(--space-2);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.pub-links a.btn {
  font-size: 0.85rem;
  line-height: 1;
  padding: 0.35em 0.7em;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.pub-links a.btn:hover {
  color: var(--link);
  border-color: var(--link);
  text-decoration: none;
}

@media (max-width: 700px) {
  .pub-row {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-3);
  }
  .pub-thumb .teaser { aspect-ratio: 16 / 8; }
}

/* Topic filter ----------------------------------------------------------- */

.pub-filter {
  margin: 0 0 var(--space-6);
  padding: var(--space-4) var(--space-5);
  background: var(--surface-2);
  border-radius: var(--radius-lg);
}

.pub-filter[hidden] { display: none; }

.pub-filter__row {
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  align-items: baseline;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}

.pub-filter__row:last-of-type { border-bottom: 0; }

.pub-filter__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pub-filter__chips--note {
  color: var(--ink-muted);
  font-size: 0.9375rem;
  align-self: center;
}

.pub-filter__pillar,
.pub-filter__chip {
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.3;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.32em 0.8em;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.pub-filter__pillar {
  justify-self: start;
  white-space: nowrap;
  font-weight: 600;
  color: var(--heading);
  border-color: transparent;
  padding-left: 0.5em;
}

.pub-filter__pillar:hover,
.pub-filter__chip:hover {
  border-color: var(--link);
  color: var(--link);
}

.pub-filter__pillar.is-active,
.pub-filter__chip.is-active {
  color: #fff;
  background: var(--brand-soft);
  border-color: var(--brand-soft);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pub-filter__pillar.is-active,
  :root:not([data-theme="light"]) .pub-filter__chip.is-active {
    color: var(--surface);
    background: var(--link);
    border-color: var(--link);
  }
}

:root[data-theme="dark"] .pub-filter__pillar.is-active,
:root[data-theme="dark"] .pub-filter__chip.is-active {
  color: var(--surface);
  background: var(--link);
  border-color: var(--link);
}

.pub-filter__count {
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}

.pub-filter__count::before { content: "("; }
.pub-filter__count::after  { content: ")"; }

.pub-filter__status {
  margin: var(--space-3) 0 0;
  font-size: 0.9375rem;
  color: var(--ink-muted);
}

.pub-filter__status:empty { display: none; }

@media (max-width: 700px) {
  .pub-filter { padding: var(--space-3) var(--space-4); }
  .pub-filter__row { grid-template-columns: minmax(0, 1fr); }
  .pub-filter__pillar { padding-left: 0.85em; }
}

/* Topic tags on each entry ----------------------------------------------- */

.pub-topics {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.pub-topic {
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--ink-muted);
  padding: 0.1em 0.6em;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.pub-topic-section[hidden],
.pub-pillar[hidden] { display: none; }

/* Pillar and topic headings ---------------------------------------------- */

.page-theme {
  margin: 0 0 var(--space-5);
  padding: var(--space-4) var(--space-5);
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.page-theme__label {
  margin: 0 0 var(--space-1);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.page-theme__name {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--heading);
}

.page-theme__span {
  margin: var(--space-1) 0 0;
  font-size: 0.9375rem;
  color: var(--ink-muted);
}

.pillar-title {
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: var(--space-7) 0 0;
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--border);
}

.pillar-sub {
  margin: var(--space-2) 0 0;
  color: var(--ink-muted);
  font-size: 0.9375rem;
  font-style: italic;
}

.pub-pillar:first-child .pillar-title { margin-top: var(--space-2); }

.pub-topic-section .subsection-title {
  font-size: 1.15rem;
  margin: var(--space-5) 0 var(--space-3);
}

/* "also: ..." marks a paper that belongs to a second topic as well. */
.pub-topics { margin-top: var(--space-2); }

/* ==========================================================================
   7b. SPARK Lab page
   ========================================================================== */

.lab-hero {
  margin-bottom: var(--space-7);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border);
}

.lab-hero__logo {
  display: block;
  margin-bottom: var(--space-5);
}

.lab-hero__logo img {
  display: block;
  width: 100%;
  max-width: 340px;
  height: auto;
}

.lab-hero__blurb {
  margin: 0;
  font-size: 1.09375rem;
  max-width: 60ch;
}

/* Research themes ------------------------------------------------------- */

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--space-4);
  list-style: none;
  margin: 0 0 var(--space-6);
  padding: 0;
}

.theme {
  margin: 0;
  padding: var(--space-4) var(--space-5);
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  border-top: 3px solid var(--spark);
}

.theme__name {
  margin: 0 0 var(--space-2);
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--spark);
}

.theme p {
  margin: 0;
  font-size: 0.96875rem;
}

/* Members --------------------------------------------------------------- */

.lab-lead {
  margin: 0 0 var(--space-3);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-5);
  list-style: none;
  margin: 0 0 var(--space-6);
  padding: 0;
}

.member {
  margin: 0;
  text-align: center;
}

/* The group lead reads better as one wide card than as a lone grid cell. */
.member-grid--lead { grid-template-columns: minmax(0, 1fr); }

.member-grid--lead .member {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  grid-template-rows: repeat(4, auto);
  align-content: center;
  column-gap: var(--space-5);
  text-align: left;
  padding: var(--space-5);
  background: var(--surface-2);
  border-radius: var(--radius-lg);
}

.member-grid--lead .member__photo {
  grid-column: 1;
  grid-row: 1 / -1;
  align-self: center;
  margin: 0;
}

.member-grid--lead .member__name,
.member-grid--lead .member__role,
.member-grid--lead .member__focus,
.member-grid--lead .member__links { grid-column: 2; }

.member-grid--lead .member__links { justify-content: flex-start; }

@media (max-width: 560px) {
  .member-grid--lead .member {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    justify-items: center;
    text-align: center;
    row-gap: var(--space-2);
  }
  .member-grid--lead .member__photo,
  .member-grid--lead .member__name,
  .member-grid--lead .member__role,
  .member-grid--lead .member__focus,
  .member-grid--lead .member__links {
    grid-column: 1;
    grid-row: auto;
  }
  .member-grid--lead .member__links { justify-content: center; }
}

.member__photo {
  display: block;
  width: 112px;
  height: 112px;
  margin: 0 auto var(--space-3);
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  box-shadow: var(--shadow-1);
}

.member__name {
  margin: 0 0 2px;
  font-size: 1.0625rem;
  font-weight: 600;
}

.member__name a { color: inherit; }
.member__name a:hover { color: var(--link); }

.member__role {
  margin: 0 0 var(--space-2);
  font-size: 0.9375rem;
  color: var(--ink-muted);
}

.member__focus {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.45;
}

.member__links {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  margin: var(--space-2) 0 0;
  font-size: 0.875rem;
}

/* Alumni ---------------------------------------------------------------- */

.alumni-list {
  list-style: none;
  margin: 0 0 var(--space-6);
  padding: 0;
}

.alumnus {
  display: grid;
  grid-template-columns: minmax(140px, auto) minmax(0, 1fr);
  gap: 0 var(--space-4);
  margin: 0;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.alumnus:last-child { border-bottom: 0; }

.alumnus__name { font-weight: 600; color: var(--ink-strong); }

.alumnus__detail { font-size: 0.96875rem; }

.alumnus__next {
  grid-column: 2;
  font-size: 0.9375rem;
  color: var(--ink-muted);
}

.alumnus--empty {
  display: block;
  color: var(--ink-muted);
  border-bottom: 0;
  padding-top: 0;
}

@media (max-width: 560px) {
  .alumnus { grid-template-columns: minmax(0, 1fr); }
  .alumnus__next { grid-column: 1; }
}

/* ==========================================================================
   8. Visitor map
   ========================================================================== */

.visitor-map {
  --map-ocean:  #f3f6fa;
  --map-land:   #dde3ec;
  --map-border: #f3f6fa;
  --map-bubble: var(--link);
  margin-bottom: var(--space-6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .visitor-map {
    --map-ocean:  #1f212b;
    --map-land:   #333849;
    --map-border: #1f212b;
  }
}

:root[data-theme="dark"] .visitor-map {
    --map-ocean:  #1f212b;
    --map-land:   #333849;
    --map-border: #1f212b;
}

.visitor-map__note {
  margin: 0 0 var(--space-4);
  color: var(--ink-muted);
  font-size: 0.875rem;
}

.visitor-map__note code {
  padding: 0 0.3em;
  font-size: 0.95em;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
}

.visitor-map__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: var(--space-4);
  align-items: start;
}

.visitor-map__canvas {
  margin: 0;
  padding: var(--space-2);
  background: var(--map-ocean);
  border-radius: var(--radius-lg);
}

.visitor-map__svg { display: block; width: 100%; height: auto; }

.visitor-map__land { fill: var(--map-land); }

.visitor-map__borders {
  fill: none;
  stroke: var(--map-border);
  stroke-width: 0.8;
  stroke-linejoin: round;
}

.visitor-map__bubble {
  fill: var(--map-bubble);
  fill-opacity: 0.5;
  stroke: var(--map-bubble);
  stroke-width: 1;
  cursor: default;
  transition: fill-opacity 0.15s ease, stroke-width 0.15s ease;
}

.visitor-map__bubble:hover,
.visitor-map__bubble:focus,
.visitor-map__bubble.is-active {
  fill-opacity: 0.85;
  stroke-width: 2;
  outline: none;
}

/* Ranking ---------------------------------------------------------------- */

.visitor-map__ranking {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.875rem;
}

.visitor-map__row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 0 var(--space-2);
  margin: 0;
  padding: 3px var(--space-2) 5px;
  border-radius: var(--radius-sm);
  line-height: 1.35;
  transition: background-color 0.15s ease;
}

.visitor-map__row.is-active { background: var(--surface-2); }

.visitor-map__flag {
  grid-row: 1;
  width: 20px;
  height: 15px;
  border-radius: 2px;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--border);
}

.visitor-map__flag--blank { box-shadow: none; }

.visitor-map__country {
  grid-row: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visitor-map__value {
  grid-row: 1;
  text-align: right;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.visitor-map__bar {
  grid-column: 1 / -1;
  grid-row: 2;
  display: block;
  height: 3px;
  margin-top: 2px;
  border-radius: 2px;
  background: var(--surface-3);
  overflow: hidden;
}

.visitor-map__bar-fill {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--map-bubble);
  opacity: 0.65;
}

@media (max-width: 760px) {
  .visitor-map__body {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-4);
  }
  .visitor-map__ranking {
    columns: 2;
    column-gap: var(--space-5);
  }
  .visitor-map__row { grid-template-columns: 18px minmax(0, 1fr) 28px; }
  .visitor-map__flag { width: 18px; height: 13.5px; }
  .visitor-map__row { break-inside: avoid; }
}

/* ==========================================================================
   9. Footer & utilities
   ========================================================================== */

.site-footer {
  margin-top: var(--space-7);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  color: var(--ink-muted);
  font-size: 0.9375rem;
  text-align: center;
}

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

@media print {
  .topnav, .news-toggle, .visitor-map, .skip-link, .theme-toggle, .pub-filter { display: none !important; }
  body { padding-top: 0; font-size: 11pt; color: #000; }
  .wrapper { display: block; max-width: none; padding: 0; }
  .profile { position: static; text-align: left; margin-bottom: 1.5rem; }
  .pub-row { break-inside: avoid; }
}
