/* =========================================================
   COLOURS — "cosmic" Material 3 palette
   Every colour is written once as light-dark(LIGHT, DARK). The browser
   picks the side from color-scheme: the visitor's system setting by
   default, or the theme toggle (html[data-theme]).
   ========================================================= */
:root {
  color-scheme: light dark;

  --bg:              light-dark(#FAF8FF, #090B18);
  --surface:         light-dark(#FFFFFF, #171A2D);  /* cards */
  --surface-2:       light-dark(#E8E3EF, #202338);  /* tags, hovers, notes */
  --text:            light-dark(#1B1930, #E6E1F5);
  --muted:           light-dark(#494554, #C9C3D5);
  --border:          light-dark(#CAC4D5, #45465C);

  --accent:          light-dark(#5941A9, #C9B9FF);  /* primary: links, labels */
  --accent-ink:      light-dark(#FFFFFF, #321D6D);  /* text on accent / gradient */
  --accent-soft:     light-dark(#E8DDFF, #49338A);
  --accent-soft-ink: light-dark(#25105C, #E8DDFF);
  --accent-2:        light-dark(#00658A, #80D8FF);  /* secondary: years & dates */
  --inverse-bg:      light-dark(#302E43, #E6E1F5);
  --inverse-fg:      light-dark(#F2EFFA, #302E43);
  --success:         #22C55E;                        /* "open to roles" dot */

  --gradient-1:      light-dark(#5941A9, #B8A4FF);
  --gradient-2:      light-dark(#884A76, #F2A9D8);
  --gradient-3:      light-dark(#00658A, #80D8FF);
  --cosmic-gradient: linear-gradient(135deg, var(--gradient-1), var(--gradient-2), var(--gradient-3));

  --shadow:
    0 1px 2px light-dark(rgba(27, 25, 48, 0.05), rgba(0, 0, 0, 0.4)),
    0 8px 24px light-dark(rgba(89, 65, 169, 0.1), rgba(0, 0, 0, 0.45));

  /* Type, shape, layout */
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 18px;      /* cards */
  --radius-sm: 10px;   /* small blocks: badges, notes, list rows */
  --pill: 999px;       /* buttons, tags, chips */
  --max: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 72px;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 18px); }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s, color 0.3s;
}
main { flex: 1; }

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
}
p { margin: 0 0 1em; }
a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }

::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
}
.skip-link:focus { left: 8px; }

/* Gradient text: big accent words and topic numbers */
.accent,
.topic-num {
  background: var(--cosmic-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Night-sky background (js/stars.js) */
.night-sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

/* =========================================================
   Header / nav
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.site-header.scrolled { border-bottom-color: var(--border); }

.nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: var(--header-h); }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--cosmic-gradient);
  color: var(--accent-ink);
  font-size: 0.9rem;
  letter-spacing: 0;
}

.nav-right { display: flex; align-items: center; gap: 8px; }
.nav-links { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: block;
  padding: 8px 14px;
  border-radius: var(--pill);
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s, background-color 0.2s;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a[aria-current="page"] { color: var(--inverse-fg); background: var(--inverse-bg); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 18px; height: 18px; }

/* Sun/moon icon: shows the theme you'd switch TO */
#theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] #theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] #theme-toggle .icon-moon { 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; }
}

#nav-toggle { display: none; }

@media (max-width: 720px) {
  #nav-toggle { display: grid; }
  .nav-links {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    padding: 12px var(--gutter) 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 16px; font-size: 1.1rem; }
}

/* =========================================================
   Sections, headings, text
   ========================================================= */
.section { padding: clamp(56px, 9vw, 110px) 0; }
.section + .section,
.section-flush { padding-top: 0; }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
}
.section-head h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); margin: 0; }

.eyebrow {
  display: inline-block;
  margin-bottom: 14px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.page-hero { padding: clamp(56px, 9vw, 100px) 0 clamp(32px, 5vw, 56px); }
.page-hero h1 { font-size: clamp(2.8rem, 8vw, 5.5rem); font-weight: 700; margin-bottom: 20px; }

.lead { font-size: clamp(1.1rem, 2vw, 1.3rem); color: var(--muted); max-width: 640px; }

/* =========================================================
   Buttons, links, tags
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  border: 2px solid var(--text);
  border-radius: var(--pill);
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s, background-color 0.2s, border-color 0.2s, color 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.text-link {
  padding-bottom: 2px;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}
.text-link:hover { border-color: var(--accent); color: var(--accent); }
/* A <button> that looks like .text-link */
.link-btn { background: none; border-top: 0; border-left: 0; border-right: 0; padding-inline: 0; font: inherit; font-weight: 600; color: inherit; cursor: pointer; }

.pill-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--pill);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}
.pill-link:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.tags li {
  padding: 4px 11px;
  border-radius: var(--pill);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

/* =========================================================
   Home
   ========================================================= */
/* First screen = hero + stats row. The stats sit on the bottom edge of
   the screen (fully visible, never cut off); the hero content is centred
   in the space above them. */
.first-screen {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100svh - var(--header-h));
}
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* Height-aware spacing so hero + stats fit on one laptop screen */
  padding: clamp(16px, 4vh, 80px) 0 clamp(16px, 4vh, 64px);
}
.first-screen-stats { padding-bottom: clamp(12px, 2.5vh, 32px); }
/* Window too short for both (set by main.js): the stats start exactly at
   the bottom edge of the screen instead of being cut in half */
.first-screen.stats-below .hero { min-height: calc(100svh - var(--header-h)); }

.hero-greeting { font-size: 1.15rem; color: var(--muted); margin-bottom: 4px; }
.hero h1 {
  font-size: clamp(3rem, min(11vw, 10.5vh), 7.5rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.95;
  margin-bottom: clamp(12px, 2.5vh, 28px);
}
/* Role: gradient text, matching the accent word in every page heading */
.hero-role {
  width: fit-content;
  margin: 0 0 clamp(10px, 2vh, 20px);
  background: var(--cosmic-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  letter-spacing: 0;
  line-height: 1.3;
}
.hero-tagline {
  max-width: 660px;
  margin-bottom: clamp(16px, 3vh, 36px);
  font-size: clamp(1.1rem, min(2.2vw, 2.6vh), 1.45rem);
  line-height: 1.55;
  color: var(--muted);
}
/* Buttons on one row, profile links on their own row underneath */
.hero-cta-row { display: flex; flex-direction: column; align-items: flex-start; gap: clamp(14px, 2.8vh, 32px); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-links { display: flex; flex-wrap: wrap; gap: 22px; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.stat { display: flex; flex-direction: column; padding: clamp(14px, 2.6vh, 28px) 0; }
.stat + .stat { padding-left: 24px; border-left: 1px solid var(--border); }
.stat-num { font-family: var(--font-display); font-size: clamp(2rem, min(5vw, 5.5vh), 3.4rem); font-weight: 700; line-height: 1; }
.stat-label { margin-top: 6px; color: var(--muted); font-size: 0.95rem; }
@media (max-width: 820px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat + .stat { padding-left: 0; border-left: none; }
  .stat:nth-child(even) { padding-left: 24px; border-left: 1px solid var(--border); }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--border); }
}

.topic-teasers { display: grid; border-top: 1px solid var(--border); }
.topic-teaser {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 26px 8px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: background-color 0.2s, padding 0.25s;
}
.topic-teaser:hover { background: var(--surface); padding-inline: 20px; }
.topic-teaser-body { display: flex; flex-direction: column; gap: 2px; }
.topic-teaser strong { font-family: var(--font-display); font-size: clamp(1.2rem, 2.4vw, 1.6rem); }
.topic-teaser-body span { color: var(--muted); }
.topic-teaser .arrow { font-size: 1.6rem; transition: transform 0.25s, color 0.2s; }
.topic-teaser:hover .arrow { transform: translateX(6px); color: var(--accent); }
@media (max-width: 520px) {
  .topic-teaser { grid-template-columns: auto 1fr; }
  .topic-teaser .arrow { display: none; }
}

/* "Open to new roles" section */
.open-to:has(.container:empty) { display: none; }
.eyebrow-status { display: inline-flex; align-items: center; gap: 10px; }
.status-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  animation: status-pulse 2.2s ease-out infinite;
}
@keyframes status-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent); }
  70%, 100% { box-shadow: 0 0 0 9px transparent; }
}
.role-areas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.role-areas li {
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  font-weight: 600;
}

/* "Featured projects" disappears while it has nothing to show */
.featured:has(.grid:empty) { display: none; }

/* =========================================================
   Project cards
   ========================================================= */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
@media (max-width: 400px) { .grid { grid-template-columns: 1fr; } }

.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); }
.card h3 { font-size: 1.5rem; margin: 0; }
.card p { flex: 1; margin: 0; color: var(--muted); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-highlight {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--pill);
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
}
.card-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.filter {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--pill);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}
.filter:hover { border-color: var(--text); }
.filter.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* =========================================================
   About
   ========================================================= */
.about-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: start;
}
.about-side { position: sticky; top: calc(var(--header-h) + 28px); }
@media (max-width: 820px) {
  .about-grid { grid-template-columns: 1fr; }
  .about-side { position: static; }
}

.photo {
  display: grid;
  place-items: center;
  max-width: 300px;
  aspect-ratio: 4 / 5;
  margin-bottom: 24px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--cosmic-gradient);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-size: 5rem;
  font-weight: 700;
}
.photo img { width: 100%; height: 100%; object-fit: cover; }

.meta-list { list-style: none; padding: 0; margin: 0 0 24px; }
.meta-list li {
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  overflow-wrap: anywhere;
}
.meta-list span { font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

.bio p { font-size: 1.15rem; }
.bio p:first-child { font-family: var(--font-display); font-size: clamp(1.3rem, 2.4vw, 1.6rem); font-weight: 500; line-height: 1.45; }

.about-block { margin-top: 56px; }
.about-block > h2 { font-size: 1.8rem; margin-bottom: 20px; }

.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.skill-group { padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.skill-group h3 { font-size: 1.05rem; margin-bottom: 14px; }

.timeline { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--border); }
.timeline > li {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.timeline strong { display: block; font-family: var(--font-display); font-size: 1.15rem; }
.timeline > li > div > span { display: block; color: var(--muted); }
.tl-details { margin: 10px 0 0; padding-left: 1.1em; color: var(--muted); font-size: 0.95rem; }
.tl-details li { margin-bottom: 4px; }
.tl-details li::marker { color: var(--accent); }
@media (max-width: 520px) { .timeline > li { grid-template-columns: 1fr; gap: 2px; } }

/* Years and dates use the secondary colour everywhere */
.tl-years, .pub-year, .card-year {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
}
.card-year { font-size: 0.85rem; }

/* =========================================================
   Research topics
   ========================================================= */
.research-toolbar { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.topics { display: grid; gap: 20px; }

.topic-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.25s, box-shadow 0.25s;
}
.topic-card:hover,
.topic-card.open { border-color: var(--accent); }
.topic-card.open { box-shadow: var(--shadow); }

.topic-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: clamp(16px, 3vw, 32px);
  padding: clamp(22px, 4vw, 36px);
}
.topic-num { font-family: var(--font-display); font-weight: 700; font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1; }
.topic-period { display: block; margin-bottom: 6px; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.topic-intro h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin-bottom: 10px; }
.topic-summary { margin-bottom: 16px; color: var(--muted); font-size: 1.08rem; }

.topic-toggle {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  padding: 4px;
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  text-align: right;
  cursor: pointer;
}
.topic-count { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.toggle-label { font-weight: 600; font-size: 0.95rem; white-space: nowrap; }
.chevron {
  position: relative;
  width: 44px;
  height: 44px;
  border: 2px solid var(--text);
  border-radius: var(--pill);
  transition: transform 0.35s, background-color 0.2s, border-color 0.2s;
}
.chevron::before,
.chevron::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 2px;
  background: currentColor;
  transform: translate(-50%, -50%);
}
.chevron::after { transform: translate(-50%, -50%) rotate(90deg); transition: transform 0.35s; }
.topic-toggle:hover .chevron { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.topic-card.open .chevron { transform: rotate(180deg); }
.topic-card.open .chevron::after { transform: translate(-50%, -50%) rotate(0deg); }

@media (max-width: 640px) {
  .topic-head { grid-template-columns: 1fr; }
  .topic-toggle { flex-direction: row; align-items: center; justify-content: space-between; width: 100%; text-align: left; }
  .topic-count { margin-right: auto; }
}

/* Body: open by default (no JS / search engines); with JS it collapses
   and expands smoothly via grid rows */
.topic-body-inner {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: clamp(24px, 4vw, 48px);
  padding: 0 clamp(22px, 4vw, 36px) clamp(22px, 4vw, 36px);
}
.topic-body-inner.single { grid-template-columns: 1fr; }
.topic-body-inner.single .topic-details { max-width: 760px; }
@media (max-width: 820px) { .topic-body-inner { grid-template-columns: 1fr; } }

.js .topic-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.js .topic-card.open .topic-body { grid-template-rows: 1fr; }
.js .topic-body-inner {
  overflow: hidden;
  min-height: 0;
  padding-bottom: 0;
  visibility: hidden;
  transition: visibility 0s 0.45s, padding 0.45s;
}
.js .topic-card.open .topic-body-inner {
  padding-bottom: clamp(22px, 4vw, 36px);
  visibility: visible;
  transition: visibility 0s, padding 0.45s;
}
html:not(.js) .topic-toggle,
html:not(.js) .research-toolbar { display: none; }

.topic-body h3 {
  margin: 0 0 14px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.topic-body h3.topic-subhead { margin-top: 28px; }
.topic-details p { color: var(--muted); }
.topic-note {
  margin: 8px 0 0;
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-2);
  font-weight: 500;
}

.pub-list { display: grid; gap: 4px; list-style: none; padding: 0; margin: 0; }
.pub {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  margin: 0 -14px;
  padding: 14px;
  border-radius: var(--radius-sm);
  transition: background-color 0.2s;
}
.pub:hover { background: var(--surface-2); }
.pub p { margin: 0; }
.pub-year { font-weight: 700; padding-top: 1px; }
.pub-title { margin-bottom: 4px !important; font-weight: 600; font-size: 1.05rem; line-height: 1.4; }
.pub-authors { color: var(--muted); font-size: 0.92rem; }
.pub-authors strong { color: var(--text); }
.pub-venue { margin-bottom: 8px !important; color: var(--muted); font-size: 0.92rem; font-style: italic; }

.full-pubs { margin-top: 32px; text-align: center; }

/* =========================================================
   Footer
   ========================================================= */
.site-footer { padding: 32px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.92rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
.footer-sep { margin: 0 10px; }
.footer-credit { text-decoration-color: var(--border); text-underline-offset: 3px; }
.footer-credit:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* =========================================================
   Motion
   ========================================================= */
/* Scroll reveal only when JS is running (otherwise content would stay hidden) */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .reveal.visible { opacity: 1; transform: none; }

@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.rise { animation: rise 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.rise-2 { animation-delay: 0.1s; }
.rise-3 { animation-delay: 0.2s; }
.rise-4 { animation-delay: 0.3s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; }
}

@media print {
  .night-sky, .site-header, .research-toolbar, .topic-toggle { display: none; }
  .js .reveal { opacity: 1; transform: none; }
  .js .topic-body { grid-template-rows: 1fr; }
  .js .topic-body-inner { visibility: visible; }
}

/* =========================================================
   Phones
   ========================================================= */
@media (max-width: 520px) {
  /* Hero buttons: main action full width, the other two side by side */
  .hero-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .hero-actions .btn { justify-content: center; padding: 13px 16px; }
  .hero-actions .btn-primary { grid-column: 1 / -1; }
  .hero-links { gap: 14px 22px; }
  /* Footer: bigger tap targets */
  .footer-links { gap: 4px 20px; }
  .footer-links a,
  .footer-credit { display: inline-block; padding: 10px 0; }
}
