/* ==========================================================================
   dgalandieguez.com — main stylesheet
   --------------------------------------------------------------------------
   The palette comes from a gravity-darkened star: hot blue-white poles and a
   cooler yellow-red equator (see --gd). Sora is used for headings and Plus
   Jakarta Sans for body and interface text. Everything is self-hosted.

   CONTENTS
     1.  Fonts (@font-face)
     2.  Design tokens (custom properties)
     3.  Base elements and utilities
     4.  Site header and navigation
     5.  Page header (inner pages)
     6.  Sections, section tabs and section headings
     7.  Layouts: two columns, matched columns, sidebar (rail)
     8.  Buttons, link rows, pills and chips
     9.  Cards
     10. Card grids, filters and timeline
     11. Home page: hero, interactive star, research strands, software
     12. Lists: dated items, publications, stats, people, entries
     13. Content blocks: figures, tables, steps, notes, citations, modules
     14. Contact form
     15. Site footer
     16. Reduced motion
   ========================================================================== */


/* ==========================================================================
   1. FONTS
   Each weight is split in two files (latin / latin-ext) so that browsers
   only download the characters a page actually uses.
   ========================================================================== */

/* ---------- Sora (headings) ---------- */

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

/* Sora 600 normal, latin-ext */
@font-face {
  font-family: "Sora";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../fonts/sora-latin-ext-600-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

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

/* Sora 700 normal, latin-ext */
@font-face {
  font-family: "Sora";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/sora-latin-ext-700-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Plus Jakarta Sans (body and interface) ---------- */

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

/* Plus Jakarta Sans 400 normal, latin-ext */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/plus-jakarta-sans-latin-ext-400-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

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

/* Plus Jakarta Sans 500 normal, latin-ext */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../fonts/plus-jakarta-sans-latin-ext-500-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

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

/* Plus Jakarta Sans 600 normal, latin-ext */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../fonts/plus-jakarta-sans-latin-ext-600-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

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

/* Plus Jakarta Sans 700 normal, latin-ext */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/plus-jakarta-sans-latin-ext-700-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Plus Jakarta Sans 400 italic, latin */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/plus-jakarta-sans-latin-400-italic.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Plus Jakarta Sans 400 italic, latin-ext */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/plus-jakarta-sans-latin-ext-400-italic.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}


/* ==========================================================================
   2. DESIGN TOKENS
   ========================================================================== */

:root {
  /* ---------- Colours: dark "night sky" surfaces ---------- */
  --night: #0a1033;
  --night-2: #16204a;
  --night-text: #dfe5f7;
  --night-muted: #9aa5c7;

  /* ---------- Colours: light surfaces and text ---------- */
  --paper: #f5f6f9;          /* page background */
  --surface: #ffffff;        /* cards, alternate sections */
  --ink: #1c2236;            /* main text */
  --muted: #596178;          /* secondary text */
  --rule: #dce0ea;           /* borders and dividers */

  /* ---------- Colours: accents (hot pole / cool equator) ---------- */
  --pole: #2459e8;           /* links, primary buttons */
  --pole-soft: #e6eeff;
  --equator: #d9480f;        /* warm accent text and markers */
  --equator-soft: #fff1e6;

  /* Gravity-darkening gradient, used for thin decorative bars */
  --gd: linear-gradient(90deg, #3a7bff 0%, #7cc4ff 17%, #f2f7ff 33%, #ffd84d 50%, #ff8c1a 66%, #e8361e 83%, #9d0b5b 100%);

  /* ---------- Colours: status pills ---------- */
  --ok: #2e7d4f;             /* completed / published */
  --ok-soft: #e5f4ea;
  --rev: #1f63c6;            /* under review / upcoming */
  --rev-soft: #e3eefc;
  --prep: #c2410c;           /* in preparation / in progress */
  --prep-soft: #fff1e6;
  --vio: #a3195b;
  --vio-soft: #fce7f1;

  /* ---------- Typography ---------- */
  /* --serif keeps its historical name but is now the body sans-serif */
  --serif: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Sora", "Plus Jakarta Sans", system-ui, sans-serif;
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Type scale */
  --step--1: .875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3125rem;
  --step-2: 1.6875rem;
  --step-3: 2.25rem;
  --step-4: clamp(2.4rem, 4.6vw, 3.6rem);

  /* ---------- Layout ---------- */
  --wrap: 88rem;             /* maximum page width */
  --measure: 46rem;          /* comfortable reading width */
  --radius: 6px;             /* small elements (code, figures) */
  --card-r: 14px;            /* cards and boxes */

  /* ---------- Shadows ---------- */
  --shadow-1: 0 1px 2px rgba(18, 28, 70, .06), 0 2px 8px rgba(18, 28, 70, .04);   /* resting */
  --shadow-2: 0 22px 45px -20px rgba(18, 28, 70, .38);                            /* hover */
}


/* ==========================================================================
   3. BASE ELEMENTS AND UTILITIES
   ========================================================================== */

/* ---------- Reset and document ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 5rem;  /* anchors are not hidden under the sticky header */
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.72;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

main {
  display: block;
}

/* ---------- Links and focus ---------- */

a {
  color: var(--pole);
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

/* ---------- Headings ---------- */

h1,
h2,
h3,
h4 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 .5em;
  letter-spacing: -.02em;
}

h2 {
  font-size: var(--step-2);
}

h3 {
  font-size: var(--step-1);
}

h4 {
  font-size: var(--step-0);
}

/* ---------- Running text ---------- */

/* Justified, hyphenated text by default... */
p,
li,
figcaption,
blockquote {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

p {
  margin: 0 0 1em;
}

/* ...except in interface elements, where it would look odd */
.nav li,
.social,
.actions li,
.pill-row,
.card-foot,
.star-readout,
.site-footer li,
.site-footer p,
.stat-cards li {
  text-align: left;
  hyphens: manual;
  -webkit-hyphens: manual;
}

em {
  font-style: italic;
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
}

/* ---------- Code ---------- */

code {
  font-family: var(--mono);
  font-size: .85em;
  background: #eef0f5;
  padding: .1em .35em;
  border-radius: 3px;
}

pre {
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.55;
  background: var(--night);
  color: #e4e9f8;
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 0 0 1.25rem;
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* ---------- Accessibility helpers ---------- */

/* Visually hidden, still read by screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* "Skip to content" link: off-screen until focused with the keyboard */
.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--surface);
  padding: .5rem 1rem;
  z-index: 100;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
}

/* ---------- Layout and text utilities ---------- */

/* Centred page container */
.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 clamp(1rem, 3.5vw, 3rem);
}

/* Long-form text at a comfortable line length */
.prose {
  max-width: var(--measure);
}

.prose p,
.prose li {
  hyphens: auto;
}

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

.prose li {
  margin-bottom: .45em;
}

.ui {
  font-family: var(--sans);
}

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

.small {
  font-size: var(--step--1);
}

/* Larger introductory paragraph */
.lead {
  font-size: 1.15rem;
  line-height: 1.65;
  color: var(--ink);
  font-weight: 500;
}


/* ==========================================================================
   4. SITE HEADER AND NAVIGATION
   ========================================================================== */

/* ---------- Header bar (sticky, translucent) ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(12, 19, 48, .94);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  color: var(--night-text);
  font-family: var(--sans);
}

/* Thin gravity-darkening line under the header */
.site-header::after {
  content: "";
  display: block;
  height: 2px;
  background: var(--gd);
  opacity: .85;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
}

/* ---------- Brand (logo + name) ---------- */

.brand {
  color: #fff;
  text-decoration: none;
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -.01em;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: .6rem;
}

.brand svg,
.brand img {
  width: 40px;
  height: 40px;
  flex: none;
  display: block;
}

.brand:hover {
  text-decoration: none;
  color: #fff;
}

/* ---------- Navigation links ---------- */

.nav {
  display: flex;
  align-items: center;
  gap: .25rem;
}

.nav > ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: .15rem;
  align-items: center;
}

.nav a,
.nav button {
  color: var(--night-text);
  text-decoration: none;
  font: 500 .95rem/1 var(--sans);
  padding: .65rem .75rem;
  border-radius: 4px;
  background: none;
  border: 0;
  cursor: pointer;
  display: block;
}

.nav a:hover,
.nav button:hover,
.nav li.open > button {
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

/* Gradient underline of the top-level items.
   It marks the current page (or the menu that contains it); while the mouse
   is over the bar it moves to the hovered item, and comes back on leaving. */
.nav a[aria-current="page"] {
  color: #fff;
}

.nav > ul > li > a,
.nav > ul > li > button {
  position: relative;
}

.nav > ul > li > a:not(.cv-link)::before,
.nav > ul > li > button::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--gd);
  transform: scaleX(0);
  transition: transform .25s ease;
}

/* current page, or the dropdown that holds it */
.nav > ul > li > a[aria-current="page"]::before,
.nav > ul > li:where(:has([aria-current="page"])) > button::before {
  transform: scaleX(1);
}

/* hovering the bar hides it... */
.nav > ul:hover > li > :is(a, button)::before {
  transform: scaleX(0);
}

/* ...and draws it under the hovered item */
.nav > ul > li:hover > :is(a, button)::before,
.nav > ul > li.open > button::before {
  transform: scaleX(1);
}

/* ---------- Dropdown menus (Software, Theses) ---------- */

.nav .has-sub {
  position: relative;
}

/* Chevron after the dropdown button; turns over when the menu is open */
.nav .has-sub > button::after {
  content: "";
  display: inline-block;
  margin-left: .45rem;
  width: .38rem;
  height: .38rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-3px) rotate(45deg);
  transition: transform .25s ease;
}

.nav li.open > button::after {
  transform: translateY(1px) rotate(-135deg);
}

/* Parent button of the current page: white text */
.nav .has-sub:has([aria-current="page"]) > button {
  color: #fff;
}

/* The panel: always rendered, faded and slid in when its item gets .open */
.nav .sub {
  list-style: none;
  margin: 0;
  padding: .45rem;
  position: absolute;
  /* (header height 4rem - button 2.25rem) / 2 + 2px line = flush under the line */
  top: calc(100% + .875rem + 2px);
  left: 50%;
  min-width: 13.5rem;
  z-index: 10;
  background: rgba(22, 32, 74, .92);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, .1);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 24px 50px -12px rgba(0, 0, 0, .55), 0 0 0 1px rgba(0, 0, 0, .15);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -6px);
  transform-origin: top center;
  transition: opacity .2s ease, transform .25s cubic-bezier(.2, .7, .2, 1), visibility 0s linear .25s;
}

/* Invisible bridge over the gap, so moving the mouse down keeps the menu open */
.nav .sub::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -1.1rem;
  height: 1.1rem;
}

/* site.js adds .open on hover / click; keyboard focus also opens it */
.nav li.open > .sub,
.nav .has-sub:has(:focus-visible) > .sub {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
  transition: opacity .2s ease, transform .25s cubic-bezier(.2, .7, .2, 1), visibility 0s;
}

.nav .sub a {
  position: relative;
  padding: .65rem .85rem .65rem 1rem;
  line-height: 1.3;
  border-radius: 8px;
  white-space: nowrap;
  transition: background .2s, color .2s, padding-left .2s;
}

/* Gradient accent bar that grows on the left of the hovered / current item */
.nav .sub a::before {
  content: "";
  position: absolute;
  left: .35rem;
  top: 50%;
  width: 3px;
  height: 0;
  border-radius: 2px;
  background: linear-gradient(#3a7bff, #ffd84d, #e8361e);
  transform: translateY(-50%);
  transition: height .2s ease;
}

.nav .sub a:hover,
.nav .sub a:focus-visible {
  background: rgba(255, 255, 255, .07);
  color: #fff;
  padding-left: 1.3rem;
}

.nav .sub a:hover::before,
.nav .sub a:focus-visible::before,
.nav .sub a[aria-current="page"]::before {
  height: 60%;
}

/* Inside the panel the current page uses the accent bar, not the underline */
.nav .sub a[aria-current="page"] {
  background: rgba(255, 255, 255, .05);
  padding-left: 1.3rem;
}

.nav .sub a[aria-current="page"]::after {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .nav .sub,
  .nav .sub a,
  .nav .has-sub > button::after {
    transition: none;
  }
}

/* CV link drawn as an outlined button */
.nav .cv-link {
  border: 1px solid rgba(255, 255, 255, .28);
  margin-left: .4rem;
}

/* ---------- Mobile menu button (hidden on desktop) ---------- */

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid rgba(255, 255, 255, .3);
  color: #fff;
  border-radius: 4px;
  padding: .45rem .7rem;
  font: 500 .9rem var(--sans);
  cursor: pointer;
}

/* ---------- Mobile navigation (≤ 900px): full-width panel ---------- */

@media (max-width: 900px) {
  .nav-toggle {
    display: block;
  }

  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--night);
    display: none;
    padding: .5rem 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
    max-height: calc(100vh - 4rem);
    overflow: auto;
  }

  .nav.open {
    display: block;
  }

  .nav > ul {
    flex-direction: column;
    align-items: stretch;
  }

  .nav a,
  .nav button {
    width: 100%;
    text-align: left;
    padding: .85rem .5rem;
    font-size: 1rem;
  }

  /* Submenus are always open and indented */
  .nav .sub {
    position: static;
    display: block;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 0;
    border-left: 2px solid rgba(255, 255, 255, .12);
    border-radius: 0;
    box-shadow: none;
    margin: 0 0 .5rem .5rem;
    padding: 0 0 0 .5rem;
    min-width: 0;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    transition: none;
  }

  .nav .sub::before,
  .nav .sub::after {
    display: none;
  }

  .nav .sub a {
    white-space: normal;
  }

  /* Dropdown buttons become plain group labels */
  .nav .has-sub > button {
    pointer-events: none;
    color: var(--night-muted);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding-bottom: .35rem;
  }

  .nav .has-sub:has([aria-current="page"]) > button {
    color: var(--night-muted);
  }

  .nav .has-sub > button::before {
    display: none;
  }

  .nav .has-sub > button::after {
    display: none;
  }

  .nav .cv-link {
    margin: .5rem 0 0;
    text-align: center;
  }
}


/* ==========================================================================
   5. PAGE HEADER (inner pages)
   Dark banner with a background photo, title, intro and buttons.
   ========================================================================== */

.page-head {
  position: relative;
  background: var(--night);
  color: var(--night-text);
  overflow: hidden;
}

/* Background photo (set inline on each page) */
.page-head .bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: .38;
}

/* Dark gradient over the photo so the text stays readable */
.page-head::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(12, 19, 48, .96) 0%, rgba(12, 19, 48, .72) 55%, rgba(12, 19, 48, .35) 100%);
  z-index: 1;
}

.page-head .wrap {
  position: relative;
  z-index: 2;
  padding-top: 3.5rem;
  padding-bottom: 3rem;
}

.page-head h1 {
  font-size: var(--step-4);
  color: #fff;
  margin: 0 0 .35em;
  max-width: 22ch;
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: 1.05;
}

.page-head .lede {
  font-size: var(--step-1);
  line-height: 1.5;
  max-width: 36rem;
  color: var(--night-text);
  margin: 0;
}

/* Breadcrumb above the title */
.page-head .crumb {
  font-family: var(--sans);
  font-size: .9rem;
  color: var(--night-muted);
  margin: 0 0 .75rem;
}

.page-head .crumb a {
  color: var(--night-muted);
}

.page-head .actions {
  margin-top: 1.5rem;
}


/* ==========================================================================
   6. SECTIONS, SECTION TABS AND SECTION HEADINGS
   ========================================================================== */

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

.section {
  position: relative;
  padding: 4.5rem 0;
}

.section + .section {
  border-top: 0;
}

/* Alternate (white) sections */
.section.alt {
  background: var(--surface);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

/* ---------- Section tab: label centred on the top edge of a section ---------- */

.tab {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  background: var(--surface);
  color: var(--ink);
  font: 600 .74rem/1 var(--display);
  letter-spacing: .22em;
  text-transform: uppercase;
  padding: 1rem 2.2rem;
  border-radius: 10px;
  box-shadow: 0 10px 30px -12px rgba(12, 19, 48, .45);
  white-space: nowrap;
}

.section.alt .tab {
  background: var(--paper);
}

@media (max-width: 600px) {
  .tab {
    font-size: .7rem;
    padding: .8rem 1.4rem;
    letter-spacing: .16em;
  }
}

/* ---------- Section headings ---------- */

.section-title {
  font-size: var(--step-3);
  margin-bottom: .4em;
}

.section-intro {
  color: var(--muted);
  max-width: var(--measure);
  font-size: 1.1rem;
  margin-bottom: 2.25rem;
}

/* Title + intro on the left, optional extras on the right */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-bottom: 2rem;
}

.section-head .section-intro {
  margin: 0;
}

.section-head h2 {
  margin: 0 0 .35rem;
}

/* Sub-heading inside a section (Education, Research stays...) */
.block-title {
  font-size: var(--step-2);
  margin: 3.5rem 0 1.25rem;
}

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


/* ==========================================================================
   7. LAYOUTS: TWO COLUMNS, MATCHED COLUMNS, SIDEBAR (RAIL)
   ========================================================================== */

/* ---------- Two columns: content + 22rem sidebar ---------- */

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22rem;
  gap: clamp(2rem, 4vw, 4rem);
  align-items: start;
}

@media (max-width: 900px) {
  .two-col {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.5rem;
  }
}

/* ---------- Matched columns (About: education / fellowships) ----------
   Both columns have the same height and their blocks share top and bottom. */

.match-cols {
  align-items: stretch;
}

.match-cols > div {
  display: flex;
  flex-direction: column;
}

.match-cols .block-title {
  white-space: nowrap;
}

.match-cols > div > .timeline,
.match-cols > div > .cards {
  flex: 1;
  grid-auto-rows: 1fr;
  gap: 1rem;
}

.match-cols > div > .timeline > li > .card {
  height: 100%;
}

/* ---------- Biography in two text columns (About) ---------- */

.bio {
  columns: 2 22rem;
  column-gap: 3rem;
}

.bio p {
  break-inside: avoid-column;
}

.bio .lead {
  column-span: all;
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -.02em;
  font-size: 1.35rem;
  line-height: 1.4;
  margin-bottom: 1.25rem;
}

/* ---------- Sidebar (rail): stacked boxes ---------- */

.rail {
  font-family: var(--sans);
  font-size: .95rem;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Each <section> of the rail is a white box */
.rail section {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--card-r);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow-1);
}

.rail section:first-child {
  border-top: 0;
  padding-top: 1.25rem;
}

.rail h2,
.rail h3 {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 .6rem;
  color: var(--ink);
}

.rail ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rail li {
  margin: 0 0 .45rem;
}

/* Term / value pairs (e.g. Languages) */
.rail dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .3rem 1rem;
}

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

.rail dd {
  margin: 0;
}

.rail p {
  margin: 0 0 .6rem;
}

/* The rail follows the page while scrolling (desktop only) */
@media (min-width: 901px) {
  .rail.sticky {
    position: sticky;
    top: 5.5rem;
  }
}


/* ==========================================================================
   8. BUTTONS, LINK ROWS, PILLS AND CHIPS
   ========================================================================== */

/* ---------- Button row ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- Buttons: solid (default) and ghost (outlined) ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font: 600 .95rem/1 var(--sans);
  text-decoration: none;
  padding: .8rem 1.15rem;
  border-radius: 4px;
  border: 1px solid var(--pole);
  background: var(--pole);
  color: #fff;
  cursor: pointer;
}

.btn:hover {
  background: #1a45c4;
  border-color: #1a45c4;
  color: #fff;
}

.btn.ghost {
  background: transparent;
  color: var(--pole);
}

.btn.ghost:hover {
  background: var(--pole-soft);
}

/* Buttons on dark backgrounds (hero, page header) */
.on-dark .btn.ghost,
.page-head .btn.ghost {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, .45);
}

.on-dark .btn.ghost:hover,
.page-head .btn.ghost:hover {
  background: rgba(255, 255, 255, .1);
}

.on-dark .btn,
.page-head .btn {
  background: #fff;
  color: var(--night);
  border-color: #fff;
}

.on-dark .btn:hover,
.page-head .btn:hover {
  background: #ffd84d;
  border-color: #ffd84d;
}

/* Small button */
.btn.sm {
  padding: .5rem .8rem;
  font-size: .85rem;
}

/* ---------- Row of text links with icons ---------- */

.link-row {
  font-family: var(--sans);
  font-size: .92rem;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1.1rem;
  margin-top: .5rem;
}

.link-row a {
  text-decoration: none;
  font-weight: 600;
}

.link-row a:hover {
  text-decoration: underline;
}

.link-row i {
  margin-right: .3rem;
}

/* ---------- Chips: small tags (e.g. research interests) ---------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.chips li {
  font-family: var(--sans);
  font-size: .84rem;
  border: 1px solid var(--rule);
  background: var(--surface);
  border-radius: 3px;
  padding: .2rem .55rem;
}

/* ---------- Pills: status / type labels on cards ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  align-self: flex-start;
  font: 600 .7rem/1 var(--sans);
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .38rem .65rem;
  border-radius: 999px;
  background: var(--pole-soft);
  color: var(--pole);
  margin-bottom: .75rem;
}

.pill.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.pill.rev {
  background: var(--rev-soft);
  color: var(--rev);
}

.pill.prep {
  background: var(--prep-soft);
  color: var(--prep);
}

.pill.vio {
  background: var(--vio-soft);
  color: var(--vio);
}

.pill.dark {
  background: linear-gradient(90deg, #0a1033, #26307a);
  color: #fff;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.pill-row .pill {
  margin-bottom: .75rem;
}

/* ---------- Chip buttons: small actions inside cards ---------- */

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font: 600 .8rem/1 var(--sans);
  text-decoration: none;
  padding: .5rem .75rem;
  border-radius: 8px;
  background: #eef1f8;
  color: var(--ink);
  border: 1px solid transparent;
  transition: background .2s, color .2s;
}

.chip-btn:hover {
  background: var(--pole);
  color: #fff;
  text-decoration: none;
}

.chip-btn.primary {
  background: var(--pole);
  color: #fff;
}

.chip-btn.primary:hover {
  background: #1a45c4;
}


/* ==========================================================================
   9. CARDS
   White boxes used for papers, talks, stays, projects... A card can be an
   <article> or a whole clickable <a>. On hover it lifts and shows a thin
   gravity-darkening line on top.
   ========================================================================== */

/* ---------- Base card ---------- */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--card-r);
  padding: 1.5rem 1.5rem 1.25rem;
  box-shadow: var(--shadow-1);
  color: inherit;
  text-decoration: none;
  transition: transform .3s cubic-bezier(.2, .7, .2, 1), box-shadow .3s, border-color .3s;
  overflow: hidden;
}

/* Gradient line on the top edge, visible on hover */
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--gd);
  opacity: 0;
  transition: opacity .3s;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-2);
  border-color: #9db8ff;
}

.card:hover::before {
  opacity: 1;
}

a.card:hover {
  text-decoration: none;
}

a.card:hover h3 {
  color: var(--pole);
}

/* Cards inside white sections use the page background colour */
.section.alt .card {
  background: var(--paper);
}

/* ---------- Card content ---------- */

.card h3 {
  font-size: 1.05rem;
  line-height: 1.38;
  margin: .15rem 0 .55rem;
  letter-spacing: -.015em;
}

.card p {
  font-size: .93rem;
  line-height: 1.62;
  margin: 0 0 .75rem;
  color: #3a4157;
}

/* Small details line (venue, host, dates...) */
.card .meta {
  font-family: var(--sans);
  font-size: .86rem;
  color: var(--muted);
  margin: 0 0 .6rem;
  line-height: 1.45;
}

.card .meta b {
  color: var(--ink);
  font-weight: 600;
}

/* Footer pushed to the bottom of the card: date + buttons */
.card-foot {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}

.card-foot .when {
  font-family: var(--sans);
  font-size: .82rem;
  color: var(--muted);
  margin-right: auto;
}

/* ---------- Icon square (feature cards) ---------- */

.card .icon {
  width: 3rem;
  height: 3rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: #fff;
  background: linear-gradient(135deg, #2459e8, #4cc9f0);
}

.card .icon.warm {
  background: linear-gradient(135deg, #e8361e, #ffb02e);
}

.card .icon.ink {
  background: linear-gradient(135deg, #5b0f6e, #d6246e);
}

/* ---------- Card variants ---------- */

/* Feature card (home overview) */
.card.feature {
  padding: 1.6rem;
}

/* Media card: image on top, text below */
.card.media {
  padding: 0;
}

.card.media .thumb {
  aspect-ratio: 16 / 10;
  background: #fff;
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.card.media .thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform .5s;
}

.card.media:hover .thumb img {
  transform: scale(1.04);
}

.card.media .body {
  padding: 1.3rem 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Highlighted card (first-author papers): warm gradient bar on the left */
.card.highlight-first {
  border-left: 1px solid var(--rule);
}

.card.highlight-first::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(#ffd84d, #ff8c1a, #e8361e, #9d0b5b);
}

/* Cards hidden by the filters */
.card[hidden] {
  display: none;
}

/* Short animation when a filter shows the card again */
.cards .card.reveal {
  animation: pop .35s ease;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Horizontal thesis card (My theses) ----------
   Details on the left, text on the right; stacked on small screens. */

.card.thesis {
  display: grid;
  grid-template-columns: minmax(0, 19rem) minmax(0, 1fr);
  gap: 0 2.5rem;
}

.card.thesis .thesis-info {
  display: flex;
  flex-direction: column;
}

.card.thesis .thesis-body p:last-child {
  margin-bottom: 0;
}

@media (max-width: 760px) {
  .card.thesis {
    grid-template-columns: minmax(0, 1fr);
  }

  .card.thesis .thesis-body {
    margin-top: 1.25rem;
  }
}

/* ---------- Table inside a card-like box ---------- */

.table-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--card-r);
  padding: .25rem 1.25rem;
  box-shadow: var(--shadow-1);
  overflow-x: auto;
}

.table-card .spec {
  margin: 0;
}

.table-card .spec tr:last-child td {
  border-bottom: 0;
}


/* ==========================================================================
   10. CARD GRIDS, FILTERS AND TIMELINE
   ========================================================================== */

/* ---------- Responsive card grid (as many columns as fit) ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: clamp(1rem, 1.6vw, 1.5rem);
}

.cards.wide {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr));
}

.cards.narrow {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
}

/* ---------- Fixed column grids ----------
   They drop to fewer columns on smaller screens instead of leaving a
   single orphan card on the last row. */

.cards.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cards.cols-3,
.people-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cards.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* One card per row (My theses) */
.cards.thesis-list {
  grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 1200px) {
  .cards.cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1000px) {
  .cards.cols-3,
  .people-grid.cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .cards.cols-2,
  .cards.cols-3,
  .cards.cols-4,
  .people-grid.cols-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Synced rows ----------
   The four parts of each card (label, title, details, footer) line up with
   the cards next to it, using CSS subgrid. */

.cards.rows-sync > .card {
  display: grid;
  grid-row: span 4;
  grid-template-rows: subgrid;
  row-gap: 0;
}

.cards.rows-sync > .card[hidden] {
  display: none;
}

/* ---------- Filter buttons above a card grid (see site.js) ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 0 0 1.75rem;
  padding: 0;
  list-style: none;
}

.filters button {
  font: 600 .85rem/1 var(--sans);
  padding: .65rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: all .2s;
}

.filters button:hover {
  border-color: var(--pole);
  color: var(--pole);
}

.filters button[aria-pressed="true"] {
  background: var(--night);
  border-color: var(--night);
  color: #fff;
}

/* Number of cards in each category (added by site.js) */
.filters button .n {
  opacity: .6;
  margin-left: .35rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- Timeline: cards joined by a vertical gradient line ---------- */

.timeline {
  position: relative;
  display: grid;
  gap: 1rem;
  padding-left: 1.75rem;
  margin: 0;
  list-style: none;
}

/* The vertical line */
.timeline::before {
  content: "";
  position: absolute;
  left: .45rem;
  top: .5rem;
  bottom: .5rem;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(#3a7bff, #7cc4ff, #ffd84d, #ff8c1a, #e8361e, #9d0b5b);
}

.timeline > li {
  position: relative;
}

/* The dot of each item: blue in progress, red when done */
.timeline > li::before {
  content: "";
  position: absolute;
  left: -1.75rem;
  top: 1.6rem;
  width: .95rem;
  height: .95rem;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--pole);
  transform: translateX(.0rem);
}

.timeline > li.done::before {
  border-color: #e8361e;
}


/* ==========================================================================
   11. HOME PAGE: HERO, INTERACTIVE STAR, RESEARCH STRANDS, SOFTWARE
   ========================================================================== */

/* ---------- Hero ---------- */

.hero {
  background: radial-gradient(120% 90% at 78% 40%, #1c2c8a 0%, var(--night) 55%, #060a22 100%);
  color: var(--night-text);
  overflow: hidden;
}

/* Text on the left, star on the right */
.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 3rem;
  align-items: center;
  padding-top: 4rem;
  padding-bottom: 4rem;
}

.hero h1 {
  font-size: var(--step-4);
  color: #fff;
  margin: 0 0 .75rem;
  letter-spacing: -.035em;
  line-height: 1.02;
  font-weight: 700;
}

.hero .role {
  font-family: var(--sans);
  color: var(--night-muted);
  font-size: 1rem;
  margin: 0 0 1.75rem;
}

.hero .statement {
  font-size: clamp(1.15rem, 1.8vw, 1.4rem);
  line-height: 1.5;
  font-weight: 500;
  color: #eef2fc;
  max-width: 30rem;
  margin: 0 0 2rem;
}

.hero .statement em {
  color: #ffd84d;
  font-style: italic;
}

/* Profile icons (ORCID, ADS, GitHub...) */
.hero .social {
  display: flex;
  gap: 1.1rem;
  margin-top: 2rem;
  font-size: 1.25rem;
}

.hero .social a {
  color: var(--night-muted);
}

.hero .social a:hover {
  color: #fff;
}

.hero .stat-cards {
  margin-top: 2rem;
  max-width: 34rem;
}

/* Single column: text, then the star, then the profile icons */
@media (max-width: 960px) {
  .hero .wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding-top: 2.5rem;
  }

  .hero .wrap > div:first-child {
    display: contents;
  }

  .hero .star-lab {
    order: 1;
    margin-top: 2.5rem;
  }

  .hero .social {
    order: 2;
  }
}

/* ---------- Interactive star: layout ---------- */

.star-lab {
  position: relative;
  font-family: var(--sans);
}

.star-lab figure {
  margin: 0;
}

/* Star canvas next to the vertical sliders */
.star-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  max-width: 640px;
  margin: 0 auto;
}

.star-stage {
  position: relative;
  aspect-ratio: 1 / 1;
  max-width: 520px;
  margin: 0 auto;
}

.star-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.star-row .star-stage {
  flex: 1;
  min-width: 0;
  margin: 0;
}

/* Values under the star (R_eq/R_pole, T_pole, T_eq, v sin i) */
.star-readout {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: .4rem 1.4rem;
  max-width: 520px;
  margin: 1rem auto .75rem;
  position: relative;
  font-size: .85rem;
  color: var(--night-muted);
  line-height: 1.5;
}

.star-readout b {
  color: #fff;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Synthetic line profile under the readout */
.star-profile {
  max-width: 520px;
  margin: .25rem auto 0;
}

.star-profile canvas {
  width: 100%;
  height: 96px;
  display: block;
}

.star-caption {
  max-width: 520px;
  margin: 1rem auto 0;
  font-family: var(--serif);
  font-size: .9rem;
  line-height: 1.55;
  color: var(--night-muted);
}

/* ---------- Interactive star: vertical sliders ---------- */

.star-controls {
  flex: none;
  display: flex;
  gap: 1rem;
  height: 60%;
  align-self: center;
  --bar-h: clamp(140px, 40vw, 260px);   /* slider and colour bar length */
}

/* Each control: label / slider / value */
.star-controls > div {
  display: grid;
  grid-template-rows: 1.5rem var(--bar-h) 1.5rem;
  justify-items: center;
  align-items: center;
  gap: .5rem;
  width: 3.5rem;
}

.star-controls sub,
.star-controls sup,
.star-readout sub,
.star-readout sup {
  line-height: 0;
}

.star-controls label {
  font-size: .85rem;
  color: var(--night-muted);
  white-space: nowrap;
}

.star-controls output {
  color: #fff;
  font-size: .85rem;
  font-variant-numeric: tabular-nums;
}

/* A horizontal range input rotated by -90° */
.vslider {
  position: relative;
  width: 1.25rem;
  height: var(--bar-h);
}

.star-controls input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  margin: 0;
  padding: 0;
  cursor: pointer;
}

.vslider input[type=range] {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--bar-h);
  height: 1.25rem;
  transform: translate(-50%, -50%) rotate(-90deg);
}

/* Track (WebKit / Firefox) */
.star-controls input[type=range]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .22);
}

.star-controls input[type=range]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .22);
}

.star-controls input[type=range]::-moz-range-progress {
  height: 6px;
  border-radius: 3px;
  background: #ffd84d;
}

/* Thumb (WebKit / Firefox) */
.star-controls input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -5px;
  border-radius: 50%;
  background: #ffd84d;
  border: 0;
}

.star-controls input[type=range]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffd84d;
  border: 0;
}

.star-controls input[type=range]:focus-visible {
  outline: 2px solid #ffd84d;
  outline-offset: 3px;
}

/* ---------- Interactive star: temperature colour key ---------- */

.gd-key {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .78rem;
  color: var(--night-muted);
}

.star-controls .gd-key {
  gap: .5rem;
  width: auto;
}

/* Vertical bar next to the sliders */
.star-controls .gd-key span.bar {
  flex: none;
  width: 6px;
  height: var(--bar-h);
  background: linear-gradient(to top, #3a7bff 0%, #7cc4ff 25%, #f2f7ff 50%, #ffd84d 67%, #ff8c1a 83%, #e8361e 100%);
}

/* Horizontal bar (anywhere else) */
.gd-key span.bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #3a7bff 0%, #7cc4ff 25%, #f2f7ff 50%, #ffd84d 67%, #ff8c1a 83%, #e8361e 100%);
}

/* ---------- Interactive star: phones (≤ 520px) ----------
   Sliders become horizontal and sit under the star. */

@media (max-width: 520px) {
  .star-row {
    flex-direction: column;
  }

  .star-controls {
    height: auto;
    width: 100%;
    max-width: 520px;
    flex-wrap: wrap;
    column-gap: 1.5rem;
    row-gap: .75rem;
  }

  .star-controls > div {
    display: flex;
    flex: 1;
    flex-direction: row;
    align-items: center;
    gap: .5rem;
    width: auto;
  }

  .vslider {
    flex: 1;
    width: auto;
    height: 1.25rem;
  }

  .vslider input[type=range] {
    position: static;
    width: 100%;
    transform: none;
  }

  .star-controls .gd-key {
    order: 3;
    flex: 1 1 100%;
    flex-direction: row-reverse;
    width: 100%;
  }

  .star-controls .gd-key span.bar {
    flex: 1;
    width: auto;
    height: 6px;
    background: linear-gradient(90deg, #3a7bff 0%, #7cc4ff 25%, #f2f7ff 50%, #ffd84d 67%, #ff8c1a 83%, #e8361e 100%);
  }
}

/* ---------- Research strands (three columns of text) ---------- */

.strands {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.5rem;
  counter-reset: none;
}

.strand h3 {
  font-size: 1.3rem;
  margin-bottom: .5rem;
}

.strand p {
  color: var(--ink);
  margin-bottom: .75rem;
}

.strand .tools {
  font-family: var(--sans);
  font-size: .88rem;
  color: var(--muted);
}

/* Short coloured bar above each strand */
.strand::before {
  content: "";
  display: block;
  width: 3rem;
  height: 3px;
  border-radius: 2px;
  margin-bottom: 1.1rem;
  background: var(--gd);
}

.strand:nth-child(2)::before {
  background: linear-gradient(90deg, #ffd84d, #ff8c1a);
}

.strand:nth-child(3)::before {
  background: linear-gradient(90deg, #e8361e, #9d0b5b);
}

@media (max-width: 900px) {
  .strands {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* ---------- Software list and software cards ---------- */

.software-list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--rule);
}

.software-item {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr) auto;
  gap: 1.5rem;
  align-items: baseline;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
}

.software-item:hover h3 {
  color: var(--pole);
}

.software-item h3 {
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: .04em;
  margin: 0;
}

.software-item p {
  margin: 0;
  color: var(--ink);
}

.software-item .go {
  font-family: var(--sans);
  font-size: .9rem;
  color: var(--pole);
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .software-item {
    grid-template-columns: 1fr;
    gap: .35rem;
  }
}

.software-cards .thumb {
  background: #fff;
}

.software-cards .card h3 {
  font-family: var(--display);
  letter-spacing: .02em;
  font-size: 1.25rem;
}


/* ==========================================================================
   12. LISTS: DATED ITEMS, PUBLICATIONS, STATS, PEOPLE, ENTRIES
   ========================================================================== */

/* ---------- Dated list: date column + description ---------- */

.dated {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dated li {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 1.25rem;
  padding: .9rem 0;
  border-bottom: 1px solid var(--rule);
}

.dated li:first-child {
  border-top: 1px solid var(--rule);
}

.dated time,
.dated .when {
  font-family: var(--sans);
  font-size: .88rem;
  color: var(--muted);
  padding-top: .2rem;
  font-variant-numeric: tabular-nums;
}

.dated .what {
  min-width: 0;
}

.dated .what strong {
  font-weight: 600;
}

.dated .what .where {
  display: block;
  font-family: var(--sans);
  font-size: .88rem;
  color: var(--muted);
}

.dated .what p {
  margin: .35rem 0 0;
  font-size: .98rem;
}

/* Small coloured label next to an item */
.dated .tag {
  font-family: var(--sans);
  font-size: .75rem;
  font-weight: 600;
  color: var(--equator);
  background: var(--equator-soft);
  padding: .12rem .45rem;
  border-radius: 3px;
  margin-left: .35rem;
  white-space: nowrap;
  vertical-align: .1em;
}

.dated .tag.pole {
  color: var(--pole);
  background: var(--pole-soft);
}

@media (max-width: 600px) {
  .dated li {
    grid-template-columns: 1fr;
    gap: .2rem;
  }
}

/* Compact variant: date above the text */
.dated.compact {
  font-size: .95rem;
}

.dated.compact li {
  grid-template-columns: 1fr;
  gap: .15rem;
  padding: .75rem 0;
}

/* ---------- Publication list: year column + reference ---------- */

.pubs {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pub {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--rule);
}

.pub:first-child {
  border-top: 1px solid var(--rule);
}

.pub .year {
  font-family: var(--sans);
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: .15rem;
}

.pub h3 {
  font-size: 1.15rem;
  margin: 0 0 .3rem;
  line-height: 1.35;
}

.pub .authors {
  margin: 0;
  font-size: .98rem;
}

.pub .authors b {
  font-weight: 600;
}

.pub .venue {
  font-family: var(--sans);
  font-size: .88rem;
  color: var(--muted);
  margin: .2rem 0 0;
}

.pub .note {
  margin: .6rem 0 0;
  font-size: .98rem;
  color: var(--ink);
}

.pub .status {
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 600;
  color: var(--equator);
  background: var(--equator-soft);
  padding: .12rem .45rem;
  border-radius: 3px;
  margin-left: .25rem;
  white-space: nowrap;
}

/* Dot before first-author papers */
.pub.first h3::before {
  content: "";
  display: inline-block;
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: var(--equator);
  margin-right: .5rem;
  vertical-align: .15em;
}

@media (max-width: 600px) {
  .pub {
    grid-template-columns: 1fr;
    gap: .25rem;
  }
}

/* ---------- Plain stats: big number + label ---------- */

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  margin: 0 0 2.5rem;
  padding: 0;
  list-style: none;
  font-family: var(--sans);
}

.stats li {
  display: flex;
  flex-direction: column;
}

.stats b {
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
}

.stats span {
  font-size: .9rem;
  color: var(--muted);
  margin-top: .35rem;
}

/* ---------- Stat cards: boxed big numbers with gradient text ---------- */

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stat-cards li {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--card-r);
  padding: 1.25rem 1.3rem;
  box-shadow: var(--shadow-1);
}

.stat-cards b {
  display: block;
  font-family: var(--display);
  font-size: clamp(2rem, 3vw, 2.6rem);
  line-height: 1;
  font-weight: 600;
  background: linear-gradient(90deg, #2459e8, #e8361e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-cards span {
  display: block;
  font-family: var(--sans);
  font-size: .88rem;
  color: var(--muted);
  margin-top: .5rem;
  line-height: 1.35;
}

/* On dark backgrounds */
.on-dark .stat-cards li {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .12);
  box-shadow: none;
}

.on-dark .stat-cards b {
  background: linear-gradient(90deg, #7cc4ff, #ffd84d);
  -webkit-background-clip: text;
  background-clip: text;
}

.on-dark .stat-cards span {
  color: var(--night-muted);
}

/* ---------- People: photo (or initials) + name and role ---------- */

.people {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.person {
  display: flex;
  gap: .9rem;
  align-items: center;
}

.person img,
.person .mono {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: var(--pole-soft);
}

/* Initials when there is no photo */
.person .mono {
  display: grid;
  place-items: center;
  font: 600 1rem var(--sans);
  color: var(--pole);
}

.person b {
  display: block;
  font-weight: 600;
  line-height: 1.3;
}

.person span {
  display: block;
  font-size: .86rem;
  color: var(--muted);
  line-height: 1.35;
}

.person a {
  font-size: .84rem;
  text-decoration: none;
}

/* People shown as cards (same hover effect as .card) */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.people-grid .person {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--card-r);
  padding: 1rem;
  box-shadow: var(--shadow-1);
  transition: transform .3s cubic-bezier(.2, .7, .2, 1), box-shadow .3s, border-color .3s;
}

.people-grid .person::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--gd);
  opacity: 0;
  transition: opacity .3s;
}

.people-grid .person:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-2);
  border-color: #9db8ff;
}

.people-grid .person:hover::before {
  opacity: 1;
}

.people-grid .person img,
.people-grid .person .mono {
  width: 64px;
  height: 64px;
}

/* ---------- Entries: thesis / project blocks separated by rules ---------- */

.entry {
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--rule);
}

.entry:first-of-type {
  border-top: 1px solid var(--rule);
}

.entry .meta {
  font-family: var(--sans);
  font-size: .9rem;
  color: var(--muted);
  margin: 0 0 .5rem;
}

.entry h3 {
  font-size: 1.35rem;
  margin: 0 0 .6rem;
}

.entry .meta .tag {
  font-weight: 600;
  color: var(--equator);
}

.entry .meta .tag.done {
  color: #2f7a4a;
}


/* ==========================================================================
   13. CONTENT BLOCKS: FIGURES, TABLES, STEPS, NOTES, CITATIONS, MODULES
   ========================================================================== */

/* ---------- Figures ---------- */

figure {
  margin: 2rem 0;
}

figure img {
  border-radius: var(--radius);
  background: #fff;
}

figcaption {
  font-family: var(--sans);
  font-size: .88rem;
  color: var(--muted);
  margin-top: .6rem;
  line-height: 1.5;
}

/* Two figures side by side */
.fig-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 2rem 0;
}

.fig-pair figure {
  margin: 0;
}

.fig-pair img {
  border: 1px solid var(--rule);
}

@media (max-width: 640px) {
  .fig-pair {
    grid-template-columns: 1fr;
  }
}

/* ---------- Specification / definition tables ---------- */

.spec {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: .94rem;
  margin: 1rem 0 2rem;
}

.spec th,
.spec td {
  text-align: left;
  padding: .65rem .75rem .65rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

/* Row headers: as narrow as their content */
.spec th {
  font-weight: 600;
  white-space: nowrap;
  color: var(--ink);
  width: 1%;
}

.spec td code {
  white-space: nowrap;
}

/* Wide tables scroll sideways on small screens */
.table-scroll {
  overflow-x: auto;
  margin: 1rem 0 2rem;
}

.table-scroll .spec {
  margin: 0;
  min-width: 34rem;
}

/* Column headers */
.spec thead th {
  color: var(--muted);
  font-weight: 600;
  font-size: .85rem;
  width: auto;
}

/* ---------- Numbered steps ---------- */

.steps {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  counter-reset: s;
}

.steps li {
  counter-increment: s;
  position: relative;
  padding: 0 0 1.1rem 2.75rem;
}

/* Number in a circle */
.steps li::before {
  content: counter(s);
  position: absolute;
  left: 0;
  top: .1rem;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 600 .85rem var(--sans);
  color: var(--pole);
  background: var(--pole-soft);
}

.steps li strong {
  display: block;
}

/* ---------- Note box ---------- */

.note-box {
  border-left: 3px solid var(--equator);
  background: var(--equator-soft);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.5rem 0;
}

.note-box p:last-child {
  margin: 0;
}

/* ---------- BibTeX citation with a "Copy" button (see site.js) ---------- */

.cite {
  position: relative;
}

.cite pre {
  padding-right: 3.5rem;
  white-space: pre;
  font-size: .74rem;
  max-height: 14rem;
}

.cite button {
  position: absolute;
  top: .5rem;
  right: .5rem;
  font: 600 .78rem var(--sans);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border: 0;
  border-radius: 3px;
  padding: .35rem .55rem;
  cursor: pointer;
}

.cite button:hover {
  background: rgba(255, 255, 255, .22);
}

/* ---------- Module grid (PANORAMA page) ---------- */

.modules {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 2.5rem;
  margin: 1.5rem 0 2rem;
}

.module {
  padding: 1.1rem 0;
  border-top: 1px solid var(--rule);
}

.module h3 {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 .3rem;
  color: var(--pole);
}

.module p {
  margin: 0 0 .4rem;
  font-size: .98rem;
}

/* List of function names */
.module .fns {
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 700px) {
  .modules {
    grid-template-columns: 1fr;
  }
}


/* ==========================================================================
   14. CONTACT FORM
   ========================================================================== */

/* Form on the left, contact details on the right */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 3.5rem;
}

@media (max-width: 860px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Form fields ---------- */

.form {
  display: grid;
  gap: 1rem;
  font-family: var(--sans);
}

/* Two fields on the same row */
.form .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 520px) {
  .form .row {
    grid-template-columns: 1fr;
  }
}

.form label {
  display: block;
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: .3rem;
}

.form input,
.form textarea {
  width: 100%;
  font: 1rem var(--sans);
  padding: .7rem .8rem;
  border: 1px solid #c8cedb;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
}

.form input:focus,
.form textarea:focus {
  outline: 2px solid var(--pole);
  outline-offset: 0;
  border-color: var(--pole);
}

.form textarea {
  min-height: 9rem;
  resize: vertical;
}

/* ---------- Contact details ---------- */

.contact-facts {
  font-family: var(--sans);
  font-size: .98rem;
  line-height: 1.6;
}

.contact-facts h3 {
  font-family: var(--sans);
  font-size: .95rem;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 .25rem;
}

.contact-facts div {
  margin-bottom: 1.25rem;
}


/* ==========================================================================
   15. SITE FOOTER
   ========================================================================== */

.site-footer {
  background: var(--night);
  color: var(--night-muted);
  font-family: var(--sans);
  font-size: .9rem;
  padding: 1.75rem 0 1rem;
}

/* Gradient line on top (pulled up over the padding) */
.site-footer::before {
  content: "";
  display: block;
  height: 2px;
  background: var(--gd);
  opacity: .7;
  margin-top: -1.75rem;
  margin-bottom: 1.75rem;
}

/* ---------- Columns: about / research profiles / contact ---------- */

.site-footer .cols {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  justify-content: space-between;
  gap: 1.5rem 2rem;
}

.site-footer p {
  white-space: nowrap;
}

.site-footer h2 {
  font-family: var(--sans);
  font-size: .95rem;
  color: #fff;
  font-weight: 600;
  margin: 0 0 .75rem;
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer li {
  margin: 0;
}

.site-footer p,
.site-footer li:last-child {
  margin-bottom: 0;
}

/* Research profiles in two columns */
.site-footer ul.two-cols {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 0 1.75rem;
}

.site-footer ul.two-cols li {
  margin: 0;
}

.site-footer a {
  color: var(--night-text);
  text-decoration: none;
}

.site-footer a:hover {
  color: #fff;
  text-decoration: underline;
}

/* ---------- Bottom line: copyright and image credits ---------- */

.site-footer .fine {
  border-top: 1px solid rgba(255, 255, 255, .1);
  margin-top: 1rem;
  padding-top: .85rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 2rem;
  justify-content: space-between;
  font-size: .82rem;
}

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

/* Tablets: name on its own row, then two columns */
@media (max-width: 1000px) {
  .site-footer .cols {
    grid-template-columns: repeat(2, max-content);
    justify-content: start;
    column-gap: 4rem;
  }

  .site-footer .cols > div:first-child {
    grid-column: 1 / -1;
  }
}

/* Phones: one column, text can wrap */
@media (max-width: 560px) {
  .site-footer .cols {
    grid-template-columns: 1fr;
  }

  .site-footer p {
    white-space: normal;
  }
}


/* ==========================================================================
   16. REDUCED MOTION
   Respect the "reduce motion" setting of the operating system.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }

  .card:hover,
  .people-grid .person:hover {
    transform: none;
  }
}
