/* FILE: css/main.css */
/* ─── Light (default) ─── 
:root {
  --bg:        #F5F2ED;
  --bg-warm:   #EDE9E3;
  --surface:   #E8E3DB;
  --rule:      #D4CEC5;
  --muted:     #A89F93;
  --body:      #3D3730;
  --head:      #1E1A16;
  --accent:    #7C6A55;
  --link:      #5C4A35;
  --tag-bg:    #DDD8D0;
  --tag-text:  #6B5E50;
  --green:     #4A7C59;
  --amber:     #A06B2A;

  --canvas-bg:          #F5F2ED;
  --panel-bg:           rgba(232,227,219,.95);
  --panel-bin-bg:       rgba(237,233,227,.92);
  --panel-border:       #9ab0e0;
  --panel-border-inner: #D4CEC5;
  --unorder-bin-fill:   rgba(130,160,255,.22);
  --unorder-bin-stroke: #1e2d50;

  --red:       #9D0006;
  --orange:    #AF3A03;
  --violet:    #8F3F71;
  --cyan:      #076678;
  --cyan-vis:  #5C4A35;
  --green-vis: #5C4A35;
  --yell-grn:  #79740E;
  --pink:      #D3869B;

  --tag-preprint-bg:       #E8DFD5;
  --tag-preprint-text:     #7A5C3A;
  --tag-published-bg:      #D8E8DC;
  --tag-published-text:    #2F6042;

  --course-lecture-bg:     #D8E8DC;
  --course-lecture-text:   #2A5C3A;
  --course-seminar-bg:     #D6E4F0;
  --course-seminar-text:   #1C4A72;
  --course-tutorial-bg:    #FEF3C7;
  --course-tutorial-text:  #7A5A0A;
  --course-misc-bg:        #FDEBD0;
  --course-misc-text:      #7A3A10;

  --talk-tag-speaker-bg:     #D8E8DC;
  --talk-tag-speaker-text:   #2F6042;
  --talk-tag-attendant-bg:   #E8E3DB;
  --talk-tag-attendant-text: #7A6A58;

  --serif:    'Spectral', 'Georgia', serif;
  --mono:     'JetBrains Mono', 'Fira Mono', monospace;
  --sans:     'DM Sans', 'Helvetica Neue', sans-serif;

  --max-w:    680px;
  --lh:       1.72;
  --lh-tight: 1.35;
  --t-fast:   120ms ease;
  --t-slow:   240ms ease;
} */

/* ─── Gruvebox Hard Light ─── */

:root {
  --bg:        #f9f5d7;
  --bg-warm:   #f5edc9;
  --surface:   #f7f1cf;
  --rule:      #e2d9c9;
  --muted:     #bdae93;
  --body:      #504945;
/*  --head:      #282828; */
  --head:      #076678;
  --accent:    #b57614;
  --link:      #076678;
  --tag-bg:    #f5edc9;
  --tag-text:  #504945;
  --green:     #79740e;
  --amber:     #b57614;

  /* ── Canvas / visualiser panel colours ──────────────────────────────────
     --canvas-bg: Fills to page colour so the canvas feels like the same
       paper surface. Depth comes from the ctrl-card (--surface) above it.
     --panel-bg: Floating panels lifted above canvas; --surface tone (.95).
     --panel-bin-bg: Pool bin slightly lighter/more open; --bg-warm tone.
     --panel-border: Accent border on counter/bin panels. Purpose: a cool
       pop against warm bg. Default used periwinkle; Gruvbox uses a muted
       teal drawn from the --link/aqua family.
     --panel-border-inner: Internal strokes inside panels; follows --rule.
     --unorder-bin-fill: Translucent cool wash marking the unorder bin area.
       Default was blue-tinted; Gruvbox uses aqua-tinted.
     --unorder-bin-stroke: Hard outline of the unorder bin. */
  --canvas-bg:          #f9f5d7;
  --panel-bg:           rgba(239,232,216,.95);
  --panel-bin-bg:       rgba(245,239,223,.92);
  --panel-border:       #7da0a8;
  --panel-border-inner: #e2d9c9;
  --unorder-bin-fill:   rgba(110,168,175,.20);
  --unorder-bin-stroke: #1e4a52;

  /* ── Semantic canvas text colours ───────────────────────────────────────
     --red: error / negation / cancel strikethroughs. Gruvbox dark red.
     --orange: warning accents. Gruvbox dark orange.
     --violet: progress bar gradient end. Gruvbox dark purple.
     --cyan-vis: glow/heading highlight on canvas. In Default Light this was
       a warm brown (same as --link). Here: muted aqua for cool contrast pop
       against the paper background. */
  --red:       #9d0006;
  --orange:    #af3a03;
  --violet:    #8f3f71;
  --cyan:      #076678;
  --cyan-vis:  #427b8a;
  --green-vis:  #427b8a;

  /* ── Publication tag colours ────────────────────────────────────────────
     Preprint: warm parchment bg, medium-brown text. Default: #E8DFD5 /
       #7A5C3A. Gruvbox: shifts toward yellowed-paper tones.
     Published: fresh green tint. Default: soft sage / forest green.
       Gruvbox: olive-green family. */
  --tag-preprint-bg:       #ede0c0;
  --tag-preprint-text:     #7c5c2a;
  --tag-published-bg:      #d9e4b0;
  --tag-published-text:    #3c5a1a;

  /* ── Course type tag colours ────────────────────────────────────────────
     Each colour family stays recognisable but shifts to Gruvbox Hard Light.
     Lecture  — green family   Seminar  — aqua/blue family
     Tutorial — yellow family  Misc     — orange/peach family */
  --course-lecture-bg:     #d9e4b0;
  --course-lecture-text:   #3a5218;
  --course-seminar-bg:     #cce0e4;
  --course-seminar-text:   #1a5462;
  --course-tutorial-bg:    #f2e6a0;
  --course-tutorial-text:  #6e4e08;
  --course-misc-bg:        #f0d8b0;
  --course-misc-text:      #6e2e08;

  /* ── Talk tag colours ───────────────────────────────────────────────────
     Speaker: green family (same as lecture/published — active/positive).
     Attendant: neutral warm surface tone, muted text. */
  --talk-tag-speaker-bg:     #d9e4b0;
  --talk-tag-speaker-text:   #3a5218;
  --talk-tag-attendant-bg:   #efe8d8;
  --talk-tag-attendant-text: #6b5e50;

  --serif:    'Spectral', 'Georgia', serif;
  --mono:     'JetBrains Mono', 'Fira Mono', monospace;
  --sans:     'DM Sans', 'Helvetica Neue', sans-serif;

  --max-w:    680px;
  --lh:       1.72;
  --lh-tight: 1.35;
  --t-fast:   120ms ease;
  --t-slow:   240ms ease;
}

/* ─── Groovebox Dark ─── */
html.dark {
  --bg:        #282828;
  --bg-warm:   #32302F;
  --surface:   #3C3836;
  --rule:      #504945;
  --muted:     #928374;
  --body:      #D5C4A1;
/*  --head:      #EBDBB2; */
  --head:      #D79921;
  --accent:    #D79921;
  --link:      #FABD2F;
  --tag-bg:    #3C3836;
  --tag-text:  #A89984;

  --canvas-bg:          #282828;
  --panel-bg:           rgba(60,56,54,.95);
  --panel-bin-bg:       rgba(50,48,47,.92);
  --panel-border:       #1e2d50;
  --panel-border-inner: #504945;
  --unorder-bin-fill:   rgba(10,20,50,.32);
  --unorder-bin-stroke: #1e2d50;

  --red:       #CC241D;
  --orange:    #D65D0E;
  --violet:    #B16286;
  --cyan:      #83A598;
  --cyan-vis:  #83A598;

  --tag-preprint-bg:       #3C3836;
  --tag-preprint-text:     #D79921;
  --tag-published-bg:      #3C3836;
  --tag-published-text:    #98971A;

  --course-lecture-bg:     #3C3836;
  --course-lecture-text:   #98971A;
  --course-seminar-bg:     #3C3836;
  --course-seminar-text:   #458588;
  --course-tutorial-bg:    #3C3836;
  --course-tutorial-text:  #D79921;
  --course-misc-bg:        #3C3836;
  --course-misc-text:      #D65D0E;

  --talk-tag-speaker-bg:     #3C3836;
  --talk-tag-speaker-text:   #98971A;
  --talk-tag-attendant-bg:   #3C3836;
  --talk-tag-attendant-text: #928374;
}


/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--serif);
  background: var(--bg);
  color: var(--body);
  line-height: var(--lh);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background var(--t-slow), color var(--t-slow);
}
a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--head); }
img { max-width: 100%; display: block; }

/* ─── Layout ─── */
.site-wrap { display: grid; grid-template-columns: 200px 1fr; min-height: 100vh; }

/* ─── Sidebar / Nav ─── */
#site-nav {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
  z-index: 30;                              /* its theme panel opens over the page */
  scrollbar-width: none;                    /* still scrolls if it must, but never shows a bar */
  padding: 3rem 1.5rem 2rem 2.5rem;
  border-right: 1px solid var(--rule);
  display: flex; flex-direction: column; gap: 0;
}
.nav-name {
  font-family: var(--sans); font-size: 0.82rem; font-weight: 600;
  letter-spacing: 0.02em; color: var(--head); text-decoration: none;
  display: block; margin-bottom: 2.5rem; line-height: 1.3;
}
.nav-name:hover { color: var(--accent); }
.nav-links { list-style: none; display: flex; flex-direction: column; gap: 0.15rem; }
.nav-links a {
  font-family: var(--sans); font-size: 0.78rem; text-decoration: none;
  color: var(--muted); letter-spacing: 0.02em; display: block;
  padding: 0.2rem 0; transition: color var(--t-fast);
}
.nav-links a:hover, .nav-links a.active { color: var(--head); }
.nav-links a.active { font-weight: 600; color: var(--body); }

#site-nav::-webkit-scrollbar { display: none; }

/* ─── Nav bottom controls ─── */
.nav-controls { margin-top: auto; padding-top: 2rem; display: flex; flex-direction: column; gap: 0.85rem; }
.nav-ctrl-row { display: flex; align-items: center; gap: 0.55rem; }
.nav-ctrl-label {
  font-family: var(--sans); font-size: 0.67rem; color: var(--muted);
  letter-spacing: 0.04em; text-transform: uppercase; flex: 1;
}

/* ─── Toggle switch ─── */
.toggle-switch { position: relative; width: 28px; height: 16px; flex-shrink: 0; cursor: pointer; display: inline-block; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute; inset: 0; border-radius: 8px;
  background: var(--rule); transition: background var(--t-fast);
}
.toggle-thumb {
  position: absolute; top: 2px; left: 2px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--muted);
  transition: transform var(--t-fast), background var(--t-fast);
}
.toggle-switch input:checked ~ .toggle-track { background: var(--accent); }
.toggle-switch input:checked ~ .toggle-thumb { transform: translateX(12px); background: var(--bg); }

/* ─── Main Content ─── */
#main-content { padding: 3.5rem 3rem 5rem 3.5rem; max-width: calc(var(--max-w) + 3.5rem); }

/* ─── Typography ─── */
h1 { font-family: var(--serif); font-weight: 400; font-size: 1.5rem; letter-spacing: -0.01em; color: var(--head); line-height: var(--lh-tight); margin-bottom: 0.35rem; }
h2 { font-family: var(--sans); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); margin: 2.8rem 0 1rem; }
h2:first-child { margin-top: 0; }
h3 { font-family: var(--serif); font-weight: 400; font-size: 1rem; color: var(--head); line-height: var(--lh-tight); }
p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }
hr { border: none; border-top: 1px solid var(--rule); margin: 2.4rem 0; }

/* ─── Home ─── */
.identity { padding-bottom: 2rem; border-bottom: 1px solid var(--rule); margin-bottom: 2.5rem; }
.identity h1 { font-size: 1.7rem; margin-bottom: 0.5rem; }
.identity .affiliation { font-family: var(--sans); font-size: 0.82rem; color: var(--muted); margin-bottom: 0.75rem; }
.identity .tagline { font-size: 0.97rem; color: var(--body); max-width: 520px; line-height: 1.6; font-style: italic; }
.home-section { margin-bottom: 2.2rem; }
.home-section p { font-size: 0.95rem; }
.brief-pubs { list-style: none; }
.brief-pubs li { padding: 0.55rem 0; border-bottom: 1px solid var(--rule); font-size: 0.88rem; display: flex; gap: 1.5rem; align-items: baseline; }
.brief-pubs li:first-child { border-top: 1px solid var(--rule); }
.brief-pubs .pub-year { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); min-width: 36px; flex-shrink: 0; }
.brief-pubs .pub-title { color: var(--link); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.brief-pubs .pub-title:hover { color: var(--head); }

/* ─── Filter bar ─── */
.filter-bar { display: flex; align-items: center; gap: 1.2rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.filter-btn {
  font-family: var(--sans); font-size: 0.73rem; letter-spacing: 0.04em;
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 0; transition: color var(--t-fast); white-space: nowrap;
}
.filter-btn:hover { color: var(--body); }
.filter-btn.active { color: var(--head); font-weight: 600; border-bottom: 1px solid var(--body); }
.filter-divider { width: 1px; height: 12px; background: var(--rule); flex-shrink: 0; }

/* ─── Inline filter search ─── */
.filter-search {
  font-family: var(--sans); font-size: 0.73rem;
  background: none; border: none; border-bottom: 1px solid transparent;
  color: var(--body); width: 155px; padding: 0.1rem 0; outline: none;
  transition: border-color var(--t-fast), width var(--t-slow);
  letter-spacing: 0.02em;
}
.filter-search::placeholder { color: var(--rule); font-style: italic; }
.filter-search:focus { border-bottom-color: var(--muted); width: 195px; }
.filter-search:not(:placeholder-shown) { border-bottom-color: var(--muted); }

/* ─── Publications ─── */
.pub-list { list-style: none; }
.pub-entry { padding: 1.1rem 0; border-bottom: 1px solid var(--rule); }
.pub-entry:first-child { border-top: 1px solid var(--rule); }
.pub-row { display: grid; grid-template-columns: 44px 1fr; gap: 0 1.2rem; align-items: start; }
.pub-year { font-family: var(--mono); font-size: 0.73rem; color: var(--muted); padding-top: 0.18rem; }
.pub-title-link { font-family: var(--serif); font-size: 0.97rem; color: var(--link); cursor: pointer; text-decoration: none; line-height: 1.45; display: block; margin-bottom: 0.22rem; }
.pub-title-link:hover { color: var(--head); }
.pub-authors { font-size: 0.82rem; color: var(--muted); margin-bottom: 0.2rem; }
.pub-authors em { font-style: normal; color: var(--body); }
.pub-venue { font-size: 0.8rem; color: var(--accent); font-style: italic; }
.pub-tags { display: flex; gap: 0.4rem; margin-top: 0.4rem; flex-wrap: wrap; }
.pub-tag { font-family: var(--sans); font-size: 0.65rem; letter-spacing: 0.05em; text-transform: uppercase; background: var(--tag-bg); color: var(--tag-text); padding: 0.15rem 0.5rem; border-radius: 2px; }
.pub-tag.preprint  { background: var(--tag-preprint-bg);  color: var(--tag-preprint-text); }
.pub-tag.published, .pub-tag.accepted { background: var(--tag-published-bg); color: var(--tag-published-text); }
/* Theses: a lemon yellow, kept apart from the orange-brown of preprints. */
.pub-tag.thesis {
  background: var(--tag-thesis-bg, color-mix(in srgb, #e8c93a 30%, var(--bg)));
  color: var(--tag-thesis-text, color-mix(in srgb, #6f5c00 88%, var(--body)));
}
html.dark .pub-tag.thesis {
  background: var(--tag-thesis-bg, color-mix(in srgb, #e8cf5a 14%, var(--bg)));
  color: var(--tag-thesis-text, #e6d070);
}
.pub-abstract { display: none; margin-top: 0.9rem; padding: 0.9rem 1rem; background: var(--bg-warm); border-left: 2px solid var(--rule); font-size: 0.88rem; line-height: 1.65; color: var(--body); }
.pub-abstract.open { display: block; }
.pub-links { display: flex; gap: 1rem; margin-top: 0.6rem; }
.pub-links a { font-family: var(--sans); font-size: 0.73rem; color: var(--muted); text-decoration: none; letter-spacing: 0.03em; }
.pub-links a:hover { color: var(--link); }
.filter-empty { padding: 1.5rem 0; font-family: var(--sans); font-size: 0.82rem; color: var(--muted); border-top: 1px solid var(--rule); }

/* ─── Research ─── */
.research-area { margin-bottom: 2.4rem; }
.research-area h3 { margin-bottom: 0.5rem; }
.research-area p { font-size: 0.93rem; line-height: 1.68; }

/* ─── CV ─── */
.cv-section { margin-bottom: 2.6rem; }
.cv-entries { list-style: none; }
.cv-entry { display: grid; grid-template-columns: 100px 1fr; gap: 0 1.4rem; padding: 0.5rem 0; border-bottom: 1px solid var(--rule); font-size: 0.9rem; align-items: start; }
.cv-entry:first-child { border-top: 1px solid var(--rule); }
.cv-date { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); padding-top: 0.18rem; line-height: 1.4; }
.cv-body { color: var(--body); line-height: 1.5; }
.cv-body strong { font-weight: 600; color: var(--head); }
.cv-body small { font-size: 0.82rem; color: var(--muted); display: block; margin-top: 0.15rem; }

/* ─── Teaching tabs ─── */
/* The tabs stay at the top of the window while the page scrolls under them,
 * with their hairline; the search line below them scrolls away. */
.teaching-tabs {
  display: flex; gap: 1.5rem; margin-bottom: 2rem; border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 20;
  padding-top: 1.1rem; margin-top: -1.1rem;
  background: var(--bg);
}
.teaching-tab {
  font-family: var(--sans); font-size: 0.75rem; letter-spacing: 0.05em; text-transform: uppercase;
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 0 0 0.65rem; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.teaching-tab:hover { color: var(--body); }
.teaching-tab.active { color: var(--head); font-weight: 600; border-bottom-color: var(--body); }

/* ─── Teaching – courses list ─── */
.teaching-list { list-style: none; }
.teaching-entry { padding: 0.9rem 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 100px 1fr; gap: 0 1.4rem; font-size: 0.9rem; }
.teaching-entry:first-child { border-top: 1px solid var(--rule); }
.teaching-term { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); padding-top: 0.18rem; }
.teaching-body strong { color: var(--head); }
.course-code { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); margin-left: 0.5rem; }
.teaching-materials { margin-top: 0.3rem; display: flex; gap: 0.9rem; }
.teaching-materials a { font-family: var(--sans); font-size: 0.73rem; color: var(--muted); text-decoration: none; }
.teaching-materials a:hover { color: var(--link); }
.course-syllabus { display: none; margin-top: 0.9rem; padding: 0.9rem 1rem; background: var(--bg-warm); border-left: 2px solid var(--rule); font-size: 0.88rem; line-height: 1.65; color: var(--body); }
.course-syllabus.open { display: block; }

/* ─── Teaching – interactive resources ─── */
.interactive-grid { display: flex; flex-direction: column; }
.interactive-entry { padding: 1rem 0; border-bottom: 1px solid var(--rule); position: relative; }
.interactive-entry:first-child { border-top: 1px solid var(--rule); }
.interactive-header { display: flex; align-items: baseline; gap: 0.8rem; flex-wrap: wrap; }
.interactive-title { font-family: var(--serif); font-size: 0.97rem; color: var(--link); text-decoration: none; line-height: 1.4; }
.interactive-title:hover { color: var(--head); }
.interactive-desc { font-size: 0.85rem; color: var(--muted); margin-top: 0.3rem; line-height: 1.55; }
.interactive-tags { display: flex; gap: 0.4rem; margin-top: 0.45rem; flex-wrap: wrap; }
/* "Titles only" on the interactive tab */
.filter-btn-end { margin-left: auto; }
.interactive-grid.is-compact .interactive-entry { padding: 0.55rem 0; }
.interactive-grid.is-compact .interactive-desc,
.interactive-grid.is-compact .interactive-tags { display: none; }

/* ─── Preview panel ─── */
.preview-panel {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
  width: 260px;
}
.preview-panel.visible { opacity: 1; }
.preview-inner {
  background: var(--bg-warm);
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 6px 28px rgba(0,0,0,0.12);
}
.preview-label {
  font-family: var(--sans); font-size: 0.63rem; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted); padding: 0.35rem 0.65rem; border-bottom: 1px solid var(--rule);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.preview-viewport { width: 260px; height: 170px; overflow: hidden; position: relative; }
.preview-iframe {
  border: none; display: block;
  width: 780px; height: 510px;
  transform: scale(0.3333);
  transform-origin: top left;
  pointer-events: none;
  background: var(--bg);
}
.preview-unavail {
  width: 260px; height: 170px; display: flex; align-items: center; justify-content: center;
  font-family: var(--sans); font-size: 0.72rem; color: var(--rule); letter-spacing: 0.04em;
}

/* ─── Paper page ─── */
.paper-page { max-width: var(--max-w); }
.paper-back { font-family: var(--sans); font-size: 0.75rem; color: var(--muted); text-decoration: none; letter-spacing: 0.03em; display: inline-block; margin-bottom: 2rem; }
.paper-back:hover { color: var(--body); }
.paper-title { font-size: 1.45rem; font-weight: 400; margin-bottom: 0.8rem; line-height: 1.3; }
.paper-authors { font-size: 0.88rem; color: var(--muted); margin-bottom: 0.3rem; }
.paper-venue { font-size: 0.85rem; color: var(--accent); font-style: italic; margin-bottom: 1.4rem; }
.paper-abstract-head { font-family: var(--sans); font-size: 0.68rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.6rem; margin-top: 1.6rem; }
.paper-abstract-text { font-size: 0.95rem; line-height: 1.72; }
.paper-links { display: flex; gap: 1.2rem; margin-top: 1.8rem; padding-top: 1.2rem; border-top: 1px solid var(--rule); }
.paper-links a { font-family: var(--sans); font-size: 0.78rem; color: var(--muted); text-decoration: none; }
.paper-links a:hover { color: var(--link); }

/* ─── Math ─── */
.math-inline { font-style: italic; }
mjx-container { display: inline !important; }

/* ─── Global search overlay ─── */
#search-overlay { display: none; position: fixed; inset: 0; background: color-mix(in srgb, var(--bg) 97%, transparent); z-index: 100; padding: 8rem 3rem; overflow-y: auto; }
#search-overlay.open { display: block; }
/* The hits go on as far as there are any; no scrollbar says so. */
#search-overlay { scrollbar-width: none; }
#search-overlay::-webkit-scrollbar { display: none; }
#search-input { font-family: var(--serif); font-size: 1.3rem; background: none; border: none; border-bottom: 1px solid var(--rule); color: var(--head); width: 100%; max-width: 560px; padding: 0.5rem 0; outline: none; display: block; margin: 0 auto; }
#search-results { max-width: 560px; margin: 1.5rem auto 0; list-style: none; }
#search-results li { padding: 0.6rem 0; border-bottom: 1px solid var(--rule); cursor: pointer; font-size: 0.9rem; }
#search-results li:hover { color: var(--head); }
.search-hint { font-family: var(--sans); font-size: 0.73rem; color: var(--muted); text-align: center; margin-top: 2rem; letter-spacing: 0.04em; }

/* ─── Responsive ─── */
@media (max-width: 720px) {
  .site-wrap { grid-template-columns: 1fr; }
  #site-nav { position: relative; height: auto; padding: 1.5rem 1.5rem 1rem; flex-direction: row; align-items: center; border-right: none; border-bottom: 1px solid var(--rule); gap: 2rem; flex-wrap: wrap; }
  .nav-name { margin-bottom: 0; }
  .nav-links { flex-direction: row; gap: 1rem; }
  .nav-controls { margin-top: 0; padding-top: 0; flex-direction: row; }
  #main-content { padding: 2rem 1.5rem 4rem; }
  .pub-row { grid-template-columns: 36px 1fr; }
  .cv-entry, .teaching-entry { grid-template-columns: 72px 1fr; }
  .preview-panel { display: none; }
  .filter-search { width: 120px; }
}

/* ─── Talks & Seminars ─── */
.talk-entry {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--rule);
}
.talk-entry:first-child { border-top: 1px solid var(--rule); }

.talk-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 0 1.2rem;
  align-items: start;
}
.talk-row.has-image {
  grid-template-columns: 44px 1fr 180px;
  gap: 0 1.4rem;
}
.talk-image {
  align-self: start;
  border: 1px solid var(--rule);
  border-radius: 2px;
  overflow: hidden;
  width: 180px;
}
.talk-image img { width: 100%; height: auto; display: block; }
.talk-image-placeholder {
  width: 180px;
  height: 110px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-size: 0.65rem;
  color: var(--rule);
  letter-spacing: 0.05em;
}

.talk-tag.speaker   { background: var(--talk-tag-speaker-bg);   color: var(--talk-tag-speaker-text); }
.talk-tag.attendant { background: var(--talk-tag-attendant-bg);  color: var(--talk-tag-attendant-text); }
html.dark .talk-tag.speaker   { background: var(--talk-tag-speaker-bg);   color: var(--talk-tag-speaker-text); }
html.dark .talk-tag.attendant { background: var(--talk-tag-attendant-bg);  color: var(--talk-tag-attendant-text); }

.talk-event {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}
.talk-location {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
}

/* ─── Conference data panel ─── */
.conf-data-panel {
  margin-top: 0.9rem;
  padding: 0.9rem 1rem;
  background: var(--bg-warm);
  border-left: 2px solid var(--rule);
  font-size: 0.88rem;
  line-height: 1.65;
}
.conf-data-panel iframe {
  width: 100%;
  height: 420px;
  border: none;
  display: block;
  margin-top: 0.6rem;
  background: var(--bg);
}
.conf-data-close {
  font-family: var(--sans);
  font-size: 0.7rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  letter-spacing: 0.04em;
  float: right;
  margin-top: -0.1rem;
}
.conf-data-close:hover { color: var(--body); }

/* ─── Research area: keywords and linked IDs ─── */
.research-area-footer {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
}
.research-keyword {
  font-family: var(--sans);
  font-size: 0.63rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 0.12rem 0.45rem;
  border-radius: 2px;
}
.research-id-link {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  padding: 0;
  transition: color var(--t-fast), border-color var(--t-fast);
  letter-spacing: 0.02em;
}
.research-id-link:hover {
  color: var(--link);
  border-bottom-color: var(--link);
}

/* Inline item view */
.inline-item-view {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  background: var(--bg-warm);
  border-left: 2px solid var(--rule);
}
.inline-item-close {
  font-family: var(--sans);
  font-size: 0.7rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  letter-spacing: 0.04em;
  float: right;
}
.inline-item-close:hover { color: var(--body); }
.inline-item-title {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 400;
  color: var(--head);
  line-height: 1.35;
  margin-bottom: 0.3rem;
  clear: right;
}
.inline-item-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.6rem;
}
.inline-item-abstract {
  font-size: 0.87rem;
  line-height: 1.65;
  color: var(--body);
}
.inline-item-links {
  display: flex;
  gap: 1rem;
  margin-top: 0.65rem;
}
.inline-item-links a {
  font-family: var(--sans);
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
}
.inline-item-links a:hover { color: var(--link); }

/* ─── Conference data panels (talks) ─── */
.conf-data-btn {
  font-family: var(--sans);
  font-size: 0.73rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  letter-spacing: 0.03em;
  transition: color var(--t-fast);
}
.conf-data-btn:hover { color: var(--link); }

.conf-panel-inline {
  margin-top: 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.conf-panel-label {
  font-family: var(--sans);
  font-size: 0.65rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.35rem 0.7rem;
  background: var(--bg-warm);
  border-bottom: 1px solid var(--rule);
}
.conf-panel-label--full { font-size: 0.72rem; margin-bottom: 0.6rem; }
.conf-panel-iframe {
  width: 100%;
  height: 380px;
  border: none;
  display: block;
  background: var(--bg);
}
.conf-panel-iframe--full {
  width: 100%;
  height: calc(100vh - 200px);
  min-height: 400px;
}
.conf-panel-max-btn {
  position: absolute;
  top: 0.3rem;
  right: 0.6rem;
  font-family: var(--sans);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color var(--t-fast);
  z-index: 2;
}
.conf-panel-max-btn:hover { color: var(--link); }
.conf-panel-min-btn {
  font-family: var(--sans);
  font-size: 0.73rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: block;
  margin-bottom: 1rem;
  letter-spacing: 0.03em;
}
.conf-panel-min-btn:hover { color: var(--link); }

/* ─── Research id link active state ─── */
.research-id-link.active-id {
  color: var(--link);
  border-bottom-color: var(--link);
}

/* ─── Teaching: course title link ─── */
.teaching-title-link {
  font-family: var(--serif);
  font-size: 0.97rem;
  color: var(--link);
  cursor: pointer;
  line-height: 1.45;
  display: inline;
}
.teaching-title-link:hover { color: var(--head); }

/* ─── Teaching detail panel ─── */
.teaching-detail {
  margin-top: 0.6rem;
  padding-top: 0.5rem;
}
.underlined-link-btn {
  font-family: var(--sans);
  font-size: 0.73rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  letter-spacing: 0.03em;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--t-fast);
}
.boxed-link-btn:hover { color: var(--link); }
.teaching-info-panel { margin-top: 0.6rem; }

/* ─── Interactive tags — clickable, navigate on click ─── */
.interactive-tag {
  font-family: var(--sans);
  font-size: 0.63rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 0.12rem 0.45rem;
  border-radius: 2px;
  border: none;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.interactive-tag:hover {
  background: var(--accent);
  color: var(--bg);
}

/* ─── Course type tags ─── */
.course-type-tag {
  font-family: var(--sans);
  font-size: 0.63rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.12rem 0.45rem;
  border-radius: 2px;
  margin-left: 0.5rem;
  vertical-align: middle;
  display: inline-block;
}

.course-type-lecture  { background: var(--course-lecture-bg);  color: var(--course-lecture-text); }
.course-type-seminar  { background: var(--course-seminar-bg);  color: var(--course-seminar-text); }
.course-type-tutorial { background: var(--course-tutorial-bg); color: var(--course-tutorial-text); }
.course-type-misc     { background: var(--course-misc-bg);     color: var(--course-misc-text); }

/* Filter button active state for type filters */
.filter-btn.active[data-type] { border-bottom-color: var(--body); }


/* ─── Custom scrollbar — thin, expands on hover ─── */
/* Firefox */
* { scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }

/* WebKit */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--rule);
  border-radius: 4px;
  transition: background 0.2s;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
::-webkit-scrollbar-corner { background: transparent; }

#site-nav { scrollbar-width: thin; }
#site-nav:hover { scrollbar-width: auto; scrollbar-color: var(--muted) transparent; }
#site-nav:hover::-webkit-scrollbar { width: 6px; }

/* ─── Research hierarchy ─── */
.research-group {
  margin-bottom: 2rem;
}
.research-group-title {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}
.research-top {
  margin-bottom: 3rem;
}
.research-top-title {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--head);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}
.research-group-title-sub {
  font-family: var(--sans);
  font-size: 0.69rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.5rem 0 0.75rem;
}

/* ─── Search result keyboard selection ─── */
#search-results li.search-selected {
  background: var(--bg-warm);
  color: var(--head);
  padding-left: 0.4rem;
  margin-left: -0.4rem;
  border-radius: 2px;
}

/* Navigation profile image */
.nav-image {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 auto 0.75rem auto;
}

#site-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.nav-name {
  /* existing styles */
}

:root {
  --text-scale: 1;
}

html {
  font-size: calc(100% * var(--text-scale));
  transition: font-size 0.1s ease-out;
}

html.no-transition {
  transition: none;
}

/* ═══ Module pages ══════════════════════════════════════════════════
   A module home page renders in three places from one code path: as a
   nested panel inside the teaching list, as a subpage filling the main
   column, and as a standalone page at module.html?m=…  Only the chrome
   around it changes; everything below is shared.
   ══════════════════════════════════════════════════════════════════ */

/* Fixes a typo in the rule above: the hover state was written against
   .boxed-link-btn, a class that doesn't exist. */
.underlined-link-btn:hover { color: var(--link); }

.module-page { max-width: var(--max-w); }

.module-head {
  padding-bottom: 1.1rem;
  margin-bottom: 1.6rem;
  border-bottom: 1px solid var(--rule);
}
.module-title {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 400;
  color: var(--head);
  line-height: var(--lh-tight);
  margin-bottom: 0.4rem;
}
.module-sub {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.55rem;
}
.module-sub .module-code {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--body);
}

.module-sec { margin-bottom: 2.2rem; }
.module-sec:last-child { margin-bottom: 0; }
.module-sec-title {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.8rem;
}
.module-prose {
  font-size: 0.94rem;
  line-height: var(--lh);
  color: var(--body);
}

.module-links { display: flex; gap: 1.1rem; flex-wrap: wrap; align-items: baseline; }
.module-links a, .module-links button {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: color var(--t-fast);
}
.module-links a:hover, .module-links button:hover { color: var(--link); }

.module-empty {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

/* Homework entry point on the module page */
.module-hw-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  text-align: left;
  font: inherit;
  padding: 0.9rem 1.05rem;
  background: var(--bg-warm);
  border: 1px solid var(--rule);
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color var(--t-fast);
}
.module-hw-card:hover { border-color: var(--muted); }
.module-hw-card .module-hw-label {
  font-family: var(--serif);
  font-size: 0.97rem;
  color: var(--link);
}
.module-hw-card:hover .module-hw-label { color: var(--head); }
.module-hw-card .module-hw-desc {
  display: block;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.2rem;
}
.module-hw-card .module-hw-go { color: var(--muted); font-size: 1.1rem; line-height: 1; }

/* Nested panel: the module page shown inside the teaching list, capped
   in height so it reads as a preview rather than a page, mirroring how
   a talk's data panel behaves before it is maximised. */
.module-nested {
  margin-top: 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  position: relative;
  background: var(--bg);
}
.module-nested-body {
  max-height: 420px;
  overflow-y: auto;
  padding: 1.1rem 1.2rem;
}
.module-nested-body .module-page { max-width: none; }
.module-nested-body .module-title { font-size: 1.15rem; }

/* Standalone module page (module.html) */
.module-standalone {
  max-width: calc(var(--max-w) + 3.5rem);
  margin: 0 auto;
  padding: 3rem 2rem 5rem;
}
.module-standalone-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 1.2rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}
.module-standalone-bar a,
.module-standalone-bar button {
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--muted);
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: color var(--t-fast);
}
.module-standalone-bar a:hover,
.module-standalone-bar button:hover { color: var(--link); }
.module-standalone-toggles { display: flex; gap: 1.1rem; flex-wrap: wrap; }

@media (max-width: 700px) {
  .module-standalone { padding: 2rem 1.2rem 4rem; }
  .module-nested-body { max-height: 340px; padding: 0.9rem; }
}

/* The course code doubles as a link to the interactive resources tagged
   with it. */
.course-code-link,
.module-code-link {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.course-code-link:hover,
.module-code-link:hover {
  color: var(--link);
  border-bottom-color: var(--rule);
}

/* ═══ PDF colours ═══════════════════════════════════════════════════
   What a recoloured PDF is drawn in (the "Recolour" toggle, zathura
   style). Paper becomes the page background, ink the body text, and
   every hue the site colour nearest to it, so a PDF reads as part of
   the page. All of them point at colours defined above, so a change
   of palette carries over. Mapped from the slides' own scheme:
     paper FFFFFF → --bg         ink 1B1B1D, muted, hairline → --body
     accent (slate, sea, …) → blue/aqua    warn 9C3A2C → red
   ══════════════════════════════════════════════════════════════════ */
:root {
  --pdf-paper:  var(--bg);
  --pdf-ink:    var(--body);
  --pdf-red:    var(--red);
  --pdf-orange: var(--orange);
  --pdf-yellow: var(--accent);
  --pdf-green:  var(--green);
  --pdf-aqua:   var(--cyan-vis);
  --pdf-blue:   var(--head);
  --pdf-purple: var(--violet);
}
html.dark {
  --pdf-green:  var(--course-lecture-text);
  --pdf-aqua:   var(--cyan);
  --pdf-blue:   var(--cyan);
}

/* ═══ Module materials ══════════════════════════════════════════════
   Driven by the module's materials.json. A group of several files is
   one card (the same card as "Weekly problem sheets") that opens into
   its list; a single file is a card of its own.
   ══════════════════════════════════════════════════════════════════ */
.module-mat-list { display: flex; flex-direction: column; gap: 0.5rem; }
.module-mat-items {
  display: flex; flex-direction: column; gap: 0.4rem;
  margin: 0.6rem 0 0.35rem 0.9rem;
}
.module-mat-items[hidden] { display: none; }
.module-mat-folder .module-hw-go { transition: transform var(--t-slow); }
.module-mat-folder[aria-expanded="true"] > .module-hw-go { transform: rotate(90deg); }
.module-mat-row {
  display: flex; align-items: center; gap: 0.9rem;
  width: 100%; text-align: left; font: inherit; cursor: pointer;
  padding: 0.6rem 1.05rem;
  background: var(--bg-warm);
  border: 1px solid var(--rule);
  border-radius: 3px;
  text-decoration: none;
  transition: border-color var(--t-fast), box-shadow var(--t-slow);
}
.module-mat-row:hover { border-color: var(--muted); }
.module-mat-main { flex: 1; min-width: 0; }
.module-mat-title {
  font-family: var(--serif); font-size: 0.95rem; color: var(--link);
}
.module-mat-row:hover .module-mat-title { color: var(--head); }
.module-mat-desc {
  display: block; font-family: var(--sans); font-size: 0.76rem;
  color: var(--muted); margin-top: 0.1rem;
}
.module-mat-date {
  font-family: var(--mono); font-size: 0.7rem; color: var(--muted);
  white-space: nowrap;
}
.module-mat-row .module-hw-go { color: var(--muted); font-size: 1.1rem; line-height: 1; }
.module-mat-flash { box-shadow: 0 0 0 2px var(--accent); }

/* Interactive pages in a module: the abstract on the left, a small
   picture of the page on the right (about a quarter of the row) */
.module-int-row { align-items: flex-start; gap: 1.1rem; padding-top: 0.75rem; padding-bottom: 0.75rem; }
.module-int-desc { line-height: 1.5; }
.module-int-desc:not(.is-open) {
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}
.module-int-row .module-fold-toggle { margin-top: 0.3rem; font-size: 0.72rem; }
.module-int-thumb {
  flex: 0 0 27%; max-width: 230px;
  aspect-ratio: 16 / 10;
  position: relative; overflow: hidden;
  border: 1px solid var(--rule); border-radius: 2px;
  background: var(--bg);
  transition: border-color var(--t-fast);
}
.module-int-row:hover .module-int-thumb { border-color: var(--muted); }
.module-int-thumb iframe {
  position: absolute; top: 0; left: 0;
  border: 0; transform-origin: 0 0;
  pointer-events: none;
  background: var(--bg);
}
.module-int-thumb img {
  display: block; width: 100%; height: 100%;
  object-fit: cover; object-position: top left;
}
.module-int-all { margin-top: 0.2rem; }
@media (max-width: 520px) { .module-int-thumb { display: none; } }

/* About this module: folds to about one and a half title blocks */
.module-syllabus.is-folded { max-height: 9.5rem; overflow: hidden; position: relative; }
.module-syllabus.is-open { max-height: none; }
.module-syllabus.is-clamped:not(.is-open)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2.6rem;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}
.module-fold-toggle {
  font-family: var(--sans); font-size: 0.75rem; letter-spacing: 0.03em;
  color: var(--muted); background: none; border: none; padding: 0;
  margin-top: 0.45rem; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
  transition: color var(--t-fast);
}
.module-fold-toggle:hover { color: var(--link); }
.module-fold-toggle[hidden] { display: none; }

/* The module folded out in the teaching list: no title block, so the
   maximise control sits beside the first heading. */
.module-compact .module-sec:first-child .module-sec-title { padding-right: 6rem; }

/* Search results */
#search-results li .search-label { color: var(--head); }
#search-results li .search-sub { color: var(--muted); font-size: 0.78rem; margin-left: 0.5rem; }
#search-results li .search-snippet {
  color: var(--muted); font-size: 0.8rem; line-height: 1.5; margin-top: 0.15rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#search-results li.search-none { color: var(--muted); cursor: default; }

/* First-page preview on hover */
.preview-pdf .preview-viewport { width: 260px; height: auto; line-height: 0; }
.preview-pdf canvas { display: block; }

/* ═══ PDF reader ════════════════════════════════════════════════════ */
/* Only while open. Never set overflow on body for good: the interactive
   pages rely on that (their SITE-REQUESTS.md, request 3). */
html.pdfr-open, html.pdfr-open body { overflow: hidden; }
.pdfr-root {
  position: fixed; inset: 0; z-index: 300;
  background: var(--bg);
  display: none;
}
.pdfr-root.pdfr-open-now { display: block; }
.pdfr-scroll {
  position: absolute; inset: 0;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  outline: none;
}
.pdfr-root.pdfr-wide .pdfr-scroll { touch-action: pan-x pan-y; }
.pdfr-pages { width: max-content; min-width: 100%; }
.pdfr-zooming .pdfr-pages { will-change: transform; }
.pdfr-zooming .pdfr-text, .pdfr-zooming .pdfr-links { visibility: hidden; }
.pdfr-page {
  position: relative;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 0 0 1px var(--rule);
}
html.pdf-recolour .pdfr-page { background: var(--bg); box-shadow: none; }
.pdfr-page canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}
.pdfr-status {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; gap: 0.6rem;
  align-items: center; justify-content: center;
  font-family: var(--sans); font-size: 0.8rem; letter-spacing: 0.04em;
  color: var(--muted);
  pointer-events: none;
}
.pdfr-status:empty { display: none; }
.pdfr-status a { pointer-events: auto; color: var(--link); }

/* Text layer (pdf.js), invisible but selectable and searchable */
.pdfr-text {
  position: absolute; inset: 0; overflow: clip;
  line-height: 1; text-align: initial;
  -webkit-text-size-adjust: none; text-size-adjust: none;
  forced-color-adjust: none;
  transform-origin: 0 0;
  z-index: 1;
}
.pdfr-text :is(span, br) {
  color: transparent; position: absolute;
  white-space: pre; cursor: text; transform-origin: 0% 0%;
}
.pdfr-text span.markedContent { top: 0; height: 0; }
.pdfr-text ::selection { background: color-mix(in srgb, var(--link) 26%, transparent); }
.pdfr-text br::selection { background: transparent; }
.pdfr-text .endOfContent {
  display: block; position: absolute; inset: 100% 0 0;
  user-select: none; cursor: default;
}
.pdfr-text.selecting .endOfContent { top: 0; }

.pdfr-links { position: absolute; inset: 0; z-index: 2; pointer-events: none; }

/* Search hits inside the PDF */
.pdfr-hits { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.pdfr-hit {
  position: absolute; border-radius: 2px;
  background: color-mix(in srgb, var(--accent) 28%, transparent);
}
.pdfr-hit.pdfr-hit-cur {
  background: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 0 0 1px var(--accent);
}
.pdfr-find {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 4;
  display: flex; align-items: center; gap: 0.15rem;
  padding: 0.25rem 0.35rem 0.25rem 0.85rem;
  font-family: var(--sans); font-size: 0.78rem; color: var(--muted);
  background: color-mix(in srgb, var(--surface) 97%, transparent);
  border: 1px solid var(--rule); border-radius: 999px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.09), 0 1px 3px rgba(0, 0, 0, 0.05);
}
.pdfr-find[hidden] { display: none; }
.pdfr-find input {
  width: min(16rem, 52vw);
  font: inherit; color: var(--body);
  background: none; border: none; outline: none; padding: 0.25rem 0;
}
.pdfr-find input::placeholder { color: var(--muted); font-style: italic; }
.pdfr-find-count { font-family: var(--mono); font-size: 0.7rem; padding: 0 0.4rem; white-space: nowrap; }
.pdfr-find .pdfr-btn { padding: 0.25rem 0.5rem; }
.pdfr-link {
  position: absolute; display: block; pointer-events: auto;
  border-radius: 2px;
  transition: background var(--t-fast);
}
.pdfr-link:hover { background: color-mix(in srgb, var(--link) 12%, transparent); }

/* The control panel: small, floating, draggable, fades when not needed */
.pdfr-panel {
  position: fixed; left: 0; top: 0; z-index: 3;
  display: flex; align-items: center; gap: 0.1rem;
  padding: 0.28rem 0.4rem 0.28rem 0.2rem;
  font-family: var(--sans); font-size: 0.74rem; letter-spacing: 0.02em;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border: 1px solid var(--rule);
  border-radius: 999px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.09), 0 1px 3px rgba(0, 0, 0, 0.05);
  cursor: grab;
  touch-action: none;
  user-select: none; -webkit-user-select: none;
  transition: opacity 280ms ease, transform 280ms ease;
}
.pdfr-panel.pdfr-dragging { cursor: grabbing; transition: none; }
.pdfr-panel.pdfr-hidden { opacity: 0; transform: translateY(8px); pointer-events: none; }
.pdfr-panel.pdfr-top.pdfr-hidden { transform: translateY(-8px); }
.pdfr-grip {
  width: 10px; height: 14px; margin: 0 0.15rem 0 0.25rem;
  background: radial-gradient(circle, var(--muted) 1px, transparent 1.3px) 0 0 / 5px 5px;
  opacity: 0.55;
}
.pdfr-btn {
  font: inherit; color: inherit; letter-spacing: inherit;
  background: none; border: none; border-radius: 999px;
  padding: 0.34rem 0.6rem; line-height: 1;
  cursor: pointer; text-decoration: none;
  transition: color var(--t-fast), background var(--t-fast);
}
.pdfr-btn:hover { color: var(--head); background: color-mix(in srgb, var(--bg) 70%, transparent); }
.pdfr-prev, .pdfr-next { font-size: 1rem; padding: 0.2rem 0.5rem 0.3rem; }
.pdfr-zoom { font-size: 0.9rem; }
.pdfr-back { color: var(--body); }
.pdfr-sep { width: 1px; height: 14px; background: var(--rule); margin: 0 0.25rem; flex-shrink: 0; }
.pdfr-pageno {
  display: inline-flex; align-items: baseline; gap: 0.3rem;
  font-family: var(--mono); font-size: 0.72rem; color: var(--body);
  cursor: default;
}
.pdfr-pageno input {
  width: 2.4em; text-align: right;
  font: inherit; color: inherit;
  background: none; border: none; border-bottom: 1px solid transparent;
  padding: 0; outline: none; cursor: text;
}
.pdfr-pageno input:focus { border-bottom-color: var(--muted); }
.pdfr-total { color: var(--muted); }
.pdfr-recolour {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0 0.45rem; cursor: pointer;
}
.pdfr-recolour:hover { color: var(--head); }
.pdfr-fit, .pdfr-dl, .pdfr-theme { font-size: 0.85rem; }

/* Landscape switch: phones and tablets only (js/site-boot.js) */
.pdfr-land { display: none; gap: 0.35rem; }
html.pdf-land-ok .pdfr-land { display: inline-flex; }
.pdfr-land-icon { display: inline-flex; margin-right: 0.05rem; }
.pdfr-land-icon svg { width: 0.95rem; height: 0.95rem; display: block; }
html.pdf-land-ok .nav-ctrl-landscape { display: flex; }
.nav-ctrl-landscape, .module-land-btn { display: none; }
html.pdf-land-ok .module-land-btn { display: inline; }

/* The note shown the first time a PDF turns to landscape */
.pdfr-tip {
  position: fixed; z-index: 5; left: 0; top: 0;
  max-width: min(21rem, calc(100vw - 16px));
  padding: 0.55rem 0.85rem 0.6rem;
  font-family: var(--sans); font-size: 0.76rem; line-height: 1.45; color: var(--body);
  background: color-mix(in srgb, var(--surface) 97%, transparent);
  border: 1px solid var(--rule); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.05);
  opacity: 0; transform: translateY(4px);
  transition: opacity 600ms ease, transform 600ms ease;
  pointer-events: none;
}
.pdfr-tip.is-on { opacity: 1; transform: none; }
.pdfr-tip-arrow {
  position: absolute; top: 100%; left: var(--arrow-x, 50%);
  width: 12px; height: 16px; margin: 3px 0 0 -6px;
  color: var(--accent);
  animation: pdfr-tip-bob 1.3s ease-in-out infinite;
}
.pdfr-tip-arrow svg { width: 100%; height: 100%; display: block; }
.pdfr-tip.is-below .pdfr-tip-arrow { top: auto; bottom: 100%; margin: 0 0 3px -6px; transform: rotate(180deg); animation-name: pdfr-tip-bob-up; }
@keyframes pdfr-tip-bob { 0%, 100% { transform: translateY(-2px); } 50% { transform: translateY(3px); } }
@keyframes pdfr-tip-bob-up { 0%, 100% { transform: rotate(180deg) translateY(-2px); } 50% { transform: rotate(180deg) translateY(3px); } }

@media (max-width: 560px) {
  .pdfr-zoom, .pdfr-recolour-label { display: none; }
  .pdfr-panel { font-size: 0.72rem; }
  /* Upright on a narrow phone: the landscape switch is just its icon,
     coloured while on; tapping it turns the screen. */
  .pdfr-land .toggle-switch { display: none; }
  .pdfr-land { padding: 0 0.3rem; }
  .pdfr-land:has(input:checked) .pdfr-land-icon { color: var(--accent); }
  .pdfr-land-icon svg { width: 1.05rem; height: 1.05rem; }
  /* Kept on one line: "Back" and "1 / 5" used to break in two. */
  .pdfr-panel { white-space: nowrap; max-width: calc(100vw - 16px); }
  .pdfr-panel .pdfr-btn { padding-left: 0.42rem; padding-right: 0.42rem; }
  .pdfr-panel .pdfr-sep { margin: 0 0.12rem; }
  .pdfr-panel .pdfr-recolour { padding: 0 0.3rem; }
}
@media (prefers-reduced-motion: reduce) {
  .pdfr-panel { transition: opacity 120ms ease; }
  .pdfr-panel.pdfr-hidden, .pdfr-panel.pdfr-top.pdfr-hidden { transform: none; }
  .pdfr-tip { transition: opacity 200ms ease; transform: none; }
  .pdfr-tip-arrow { animation: none; }
}

/* ═══ Theme menu ════════════════════════════════════════════════════ */
/* A button with the theme's colours and name; it opens a panel of every
 * theme, each as a miniature page in its own colours. */
.theme-pick { position: relative; display: inline-flex; }
.theme-pick .theme-pick-btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: var(--sans); font-size: 0.7rem; letter-spacing: 0.02em; color: var(--body);
  background: transparent; border: 1px solid var(--rule); border-radius: 999px;
  padding: 0.2rem 0.5rem 0.2rem 0.4rem; cursor: pointer; line-height: 1.2;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.theme-pick .theme-pick-btn:hover, .theme-pick.is-open .theme-pick-btn { border-color: var(--muted); background: color-mix(in srgb, var(--surface) 70%, transparent); }
.theme-pick-btn:focus-visible { outline: 1px solid var(--muted); outline-offset: 2px; }
.theme-pick-dots { display: inline-flex; }
.theme-pick-dots i {
  width: 9px; height: 9px; border-radius: 50%; background: var(--muted);
  box-shadow: 0 0 0 1.5px var(--bg); transition: background var(--t-slow);
}
.theme-pick-dots i + i { margin-left: -3px; }
.theme-pick-dots i:nth-child(1) { background: var(--accent); }
.theme-pick-dots i:nth-child(2) { background: var(--link); }
.theme-pick-dots i:nth-child(3) { background: var(--head); }
.theme-pick-chev svg { width: 8px; height: 5px; display: block; fill: none; stroke: var(--muted); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--t-fast); }
.theme-pick.is-open .theme-pick-chev svg { transform: rotate(180deg); }

.theme-menu {
  position: fixed; z-index: 60; left: 0; top: 0;
  min-width: 11.5rem; padding: 0.3rem;
  background: var(--bg); border: 1px solid var(--rule); border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.06);
  opacity: 0; transform: translateY(-4px); transform-origin: top left;
  transition: opacity 140ms ease, transform 160ms cubic-bezier(.2,.7,.2,1);
}
.theme-pick.opens-up .theme-menu { transform: translateY(4px); transform-origin: bottom left; }
.theme-pick.is-open .theme-menu { opacity: 1; transform: none; }
.theme-menu[hidden] { display: none; }
.theme-pick .theme-opt {
  display: flex; align-items: center; gap: 0.6rem; width: 100%;
  padding: 0.32rem 0.45rem; border: 0; border-radius: 5px; background: none; cursor: pointer;
  font-family: var(--sans); font-size: 0.74rem; color: var(--body); text-align: left;
}
.theme-pick .theme-opt:hover, .theme-pick .theme-opt:focus-visible { background: color-mix(in srgb, var(--surface) 85%, var(--rule)); outline: none; }
.theme-opt[aria-selected="true"] .theme-opt-name { color: var(--head); font-weight: 600; }
.theme-opt-name { flex: 1; }
.theme-opt-tick svg { width: 11px; height: 9px; display: block; fill: none; stroke: var(--head); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.theme-opt[aria-selected="true"] .theme-opt-tick svg { opacity: 1; }

/* The miniature: a heading bar, two lines of text and an accent dot. */
.theme-sw {
  position: relative; flex: none; width: 34px; height: 22px; border-radius: 4px;
  background: var(--sw-bg); box-shadow: inset 0 0 0 1px var(--sw-rule), 0 0 0 1px color-mix(in srgb, var(--rule) 60%, transparent);
  overflow: hidden;
}
.theme-sw.is-empty { background: var(--surface); }
.theme-sw i { position: absolute; left: 5px; height: 2px; border-radius: 1px; }
.theme-sw .sw-h { top: 5px; width: 14px; height: 3px; background: var(--sw-head); }
.theme-sw .sw-l { top: 11px; width: 21px; background: var(--sw-body); opacity: 0.55; }
.theme-sw .sw-short { top: 15px; width: 12px; background: var(--sw-link); opacity: 1; }
.theme-sw .sw-dot { left: auto; right: 5px; top: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--sw-accent); }
@media (prefers-reduced-motion: reduce) { .theme-menu { transition: none; } }
.theme-pick.module-theme-pick .theme-pick-btn { font-size: 0.75rem; }
/* In the sidebar, a chip of the theme's colours as wide as the switches
 * above it; the name is in the panel and on hover. */
.nav-ctrl-theme .theme-pick-name, .nav-ctrl-theme .theme-pick-chev { display: none; }
.nav-ctrl-theme .theme-pick .theme-pick-btn { padding: 0.24rem 0.42rem; gap: 0; }
.nav-ctrl-theme .theme-pick-dots i { width: 8px; height: 8px; }
.nav-ctrl, .nav-controls, .nav-ctrl-row { min-width: 0; }

/* ═══ CV entry pages ("At the University of Galway") ═══════════════════
   The CV's own page for one position: a quiet header (role and years,
   the place, where it sits in the career, one line of numbers), then the
   work done there in the site's year-column lists. */
.cv-entry-linked { grid-template-columns: 100px 1fr auto; cursor: pointer; }
.cv-entry-linked .cv-go { color: var(--muted); align-self: center; font-size: 1.05rem; transition: color var(--t-fast), transform var(--t-fast); }
.cv-entry-linked:hover strong { color: var(--link); }
.cv-entry-linked:hover .cv-go { color: var(--link); transform: translateX(2px); }
.cv-entry-linked:focus-visible { outline: 1px solid var(--muted); outline-offset: 2px; }

.cvx { max-width: var(--max-w); }
.cvx-head { padding-bottom: 1.5rem; margin-bottom: 2.2rem; border-bottom: 1px solid var(--rule); }
.cvx-kicker {
  font-family: var(--sans); font-size: 0.7rem; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 0.6rem;
}
.cvx-title {
  font-family: var(--serif); font-weight: 400; font-size: 1.8rem;
  letter-spacing: -0.01em; line-height: 1.2; color: var(--head); margin-bottom: 0.35rem;
}
.cvx-note { font-family: var(--serif); font-style: italic; font-size: 0.97rem; color: var(--body); }
.cvx-timeline { margin: 1.4rem 0 0.1rem; }
.cvx-tl-line { position: relative; height: 3px; background: var(--rule); border-radius: 2px; }
.cvx-tl-other {
  position: absolute; top: 0; height: 100%; border-radius: 2px;
  background: color-mix(in srgb, var(--muted) 45%, transparent);
}
.cvx-tl-seg {
  position: absolute; top: -1px; height: 5px; border-radius: 3px;
  background: var(--head);
  transform-origin: left center;
  animation: cvx-grow 700ms cubic-bezier(.2,.7,.2,1) both 120ms;
}
.cvx-tl-ends {
  display: flex; justify-content: space-between; margin-top: 0.35rem;
  font-family: var(--mono); font-size: 0.65rem; color: var(--muted);
}
.cvx-stats {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.6rem;
  margin-top: 1.05rem; font-family: var(--sans); font-size: 0.8rem; color: var(--muted);
}
.cvx-stats b {
  font-family: var(--serif); font-weight: 500; font-size: 1.1rem;
  color: var(--head); margin-right: 0.12rem;
}
.cvx-dot { color: var(--rule); }

.cvx-sec { margin-bottom: 2.5rem; animation: cvx-in 420ms ease both; }
.cvx-sec:nth-of-type(2) { animation-delay: 60ms; }
.cvx-sec:nth-of-type(3) { animation-delay: 120ms; }
.cvx-sec:nth-of-type(4) { animation-delay: 180ms; }
.cvx-sec:nth-of-type(5) { animation-delay: 240ms; }
.cvx-row {
  display: grid; grid-template-columns: 64px 1fr; gap: 0 1.2rem;
  padding: 0.75rem 0; border-bottom: 1px solid var(--rule);
}
.cvx-sec h2 + .cvx-row { border-top: 1px solid var(--rule); }
.cvx-row-go { cursor: pointer; }
.cvx-row-go:hover .cvx-name { color: var(--head); }
.cvx-row-go:focus-visible { outline: 1px solid var(--muted); outline-offset: 2px; }
.cvx-when { font-family: var(--mono); font-size: 0.73rem; color: var(--muted); padding-top: 0.22rem; }
.cvx-name {
  display: block; font-family: var(--serif); font-size: 0.97rem; line-height: 1.45;
  color: var(--link); transition: color var(--t-fast);
}
.cvx-sub { display: block; margin-top: 0.15rem; font-size: 0.8rem; color: var(--muted); line-height: 1.5; }
.cvx-sub i { color: var(--accent); }
.cvx-sub i + .pub-tag, .cvx-sub .course-type-tag { margin-left: 0.35rem; }
.cvx-sub .pub-tag, .cvx-sub .course-type-tag { vertical-align: 1px; }

.cvx-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1.2rem 1.1rem; }
.cvx-tool { display: flex; flex-direction: column; gap: 0.45rem; cursor: pointer; }
.cvx-tool .cvx-thumb { flex: none; width: 100%; max-width: none; }
.cvx-tool .cvx-name { font-size: 0.93rem; }
.cvx-tool-desc {
  font-size: 0.78rem; line-height: 1.45; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cvx-thumb-wrap { position: relative; display: block; }
.cvx-tool .cvx-thumb { display: block; }
@media (max-width: 520px) {
  .cvx-tool-year { position: static; display: inline-block; }
}
.cvx-tool-year {
  position: absolute; left: 0.45rem; top: 0.45rem; padding: 0.05rem 0.4rem;
  font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.02em; color: var(--body);
  background: color-mix(in srgb, var(--bg) 88%, transparent); border: 1px solid var(--rule); border-radius: 999px;
}
.cvx-tool-note { font-family: var(--sans); font-size: 0.72rem; line-height: 1.45; color: var(--muted); }
.cvx-tool-linked .cvx-thumb { opacity: 0.72; transition: opacity var(--t-fast), border-color var(--t-fast); }
.cvx-tool-linked:hover .cvx-thumb { opacity: 1; }
.cvx-intro { font-size: 0.84rem; color: var(--muted); margin: -0.4rem 0 1rem; line-height: 1.5; }
.cvx-tool:hover .cvx-name { color: var(--head); }
.cvx-tool:hover .cvx-thumb { border-color: var(--muted); }
.cvx-tool:focus-visible { outline: 1px solid var(--muted); outline-offset: 3px; }

@keyframes cvx-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes cvx-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { .cvx-sec, .cvx-tl-seg { animation: none; } }
@media (max-width: 720px) {
  .cvx-title { font-size: 1.45rem; }
  .cvx-row { grid-template-columns: 52px 1fr; gap: 0 0.9rem; }
  .cv-entry-linked { grid-template-columns: 72px 1fr auto; }
}

/* ─── "← Publications   ← CV": a second way back ─── */
.back-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 1.3rem; margin-bottom: 2rem; }
.back-row .paper-back { margin-bottom: 0; }
.back-row > span:empty { display: none; }

/* ─── CV timeline: the stretch can be grabbed ─── */
.cvx-tl-track { position: relative; }
.cvx-tl-movable .cvx-tl-track {
  padding: 9px 0; margin: -9px 0;           /* a finger-sized hold on a 3px line */
  cursor: grab; touch-action: pan-y; -webkit-user-select: none; user-select: none;
}
.cvx-tl-movable.is-held .cvx-tl-track { cursor: grabbing; }
.cvx-tl-seg { transition: left 220ms cubic-bezier(.3,.7,.2,1), width 220ms cubic-bezier(.3,.7,.2,1), height 160ms ease, top 160ms ease; }
.cvx-tl-seg.no-anim { animation: none; }
.cvx-tl-movable .cvx-tl-seg:hover,
.cvx-tl-movable.is-held .cvx-tl-seg { top: -2px; height: 7px; border-radius: 4px; }
.cvx-tl-seg:focus { outline: none; }
.cvx-tl-seg:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--muted); }

.cvx-tl-marks { position: absolute; left: 0; right: 0; top: 50%; height: 0; pointer-events: none; }
.cvx-tl-mark {
  position: absolute; top: -6px; width: 1px; height: 13px; margin-left: -0.5px;
  background: var(--muted); opacity: 0; transform: scaleY(0.4);
  transition: opacity 400ms ease, transform 400ms ease;
}
.cvx-tl-year {
  position: absolute; bottom: 15px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 0.6rem; color: var(--muted); white-space: nowrap;
}
.cvx-timeline.is-held .cvx-tl-mark {
  opacity: 0.75; transform: none;
  transition: opacity 2s cubic-bezier(.25,.6,.3,1), transform 1.4s cubic-bezier(.25,.6,.3,1);
}
.cvx-tl-tip {
  position: absolute; top: calc(50% + 9px); transform: translateX(-50%);
  max-width: 92%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 0 0.45rem; background: var(--bg);
  font-family: var(--sans); font-size: 0.72rem; color: var(--head);
  opacity: 0; pointer-events: none; transition: opacity 160ms ease, left 220ms cubic-bezier(.3,.7,.2,1);
}
.cvx-timeline.is-held .cvx-tl-tip { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .cvx-tl-seg, .cvx-tl-tip { transition: none; }
  .cvx-timeline.is-held .cvx-tl-mark { transition: opacity 300ms ease; }
}

/* ─── Notes ───────────────────────────────────────────────────────────
 * Laid out like the CV: a top-level group is a section under the small
 * heading every section of the site has; its sub-groups are rows between
 * hairlines, the name in the left column (where the CV has its years) and
 * the entries on the right. Single notes are rows with their years on the
 * left. Links are quiet sans-serif lines, as on the paper pages. */
.nt { max-width: var(--max-w); }
.nt-sec { margin-top: 2.8rem; }
.nt > :first-child { margin-top: 1.6rem; }
.nt-loose + .nt-sec, .nt h2.nt-loose-h { margin-top: 2.8rem; }
.nt-h { display: flex; align-items: baseline; gap: 0.8rem; margin: 0 0 1rem; }
.nt-h .note-title-link { color: inherit; }
.nt-h .note-title-link:hover { color: var(--link); }
.nt-h-date { margin-left: auto; font-family: var(--mono); font-weight: 400; letter-spacing: 0; text-transform: none; }
.nt-intro { font-size: 0.93rem; line-height: 1.65; color: var(--body); margin: -0.1rem 0 1rem; }
.nt-sec > .nt-related { margin: -0.2rem 0 1rem; }

.nt-row {
  display: grid; grid-template-columns: 100px 1fr; gap: 0 1.4rem; align-items: start;
  padding: 0.7rem 0; border-bottom: 1px solid var(--rule); font-size: 0.9rem;
}
.nt-list > .nt-row:first-child { border-top: 1px solid var(--rule); }
.nt-when, .nt-k-date { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); padding-top: 0.18rem; line-height: 1.4; }
.nt-k-date { padding-top: 0.1rem; }
.nt-k { padding-top: 0.12rem; line-height: 1.4; }
.nt-k-title { font-family: var(--sans); font-size: 0.8rem; letter-spacing: 0.01em; color: var(--body); line-height: 1.45; }
.nt-v { min-width: 0; line-height: 1.5; }

.nt-title, .nt-name, .nt-sub-title { font-family: var(--serif); color: var(--head); }
.nt-title { font-size: 0.97rem; line-height: 1.45; }
.nt-name { font-size: 0.95rem; }
.nt-inline { font-size: 0.95rem; line-height: 1.6; overflow: hidden; }
.nt-inline-in { margin-left: -1.2em; }
.nt-chip { white-space: nowrap; }
.nt-dot { display: inline-block; width: 1.2em; text-align: center; color: var(--muted); opacity: 0.7; }
.nt-v > * + *, .nt-sub-body > * + * { margin-top: 0.35rem; }
.nt-v > .nt-related, .nt-sub-body > .nt-related { margin-top: 0.5rem; }
.nt-line { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0.75rem; }
.nt-desc { font-size: 0.84rem; color: var(--muted); }
.nt-date { margin-left: auto; font-family: var(--mono); font-size: 0.7rem; color: var(--muted); white-space: nowrap; }
.nt-sub-desc, .nt-gdesc { display: block; margin-top: 0.15rem; font-size: 0.84rem; color: var(--muted); line-height: 1.5; }
.nt-gdesc { margin: 0 0 0.35rem; color: var(--body); }

.nt-sub { margin-top: 0.15rem; }
.nt-sub-head { display: flex; align-items: baseline; gap: 0.75rem; }
.nt-sub-title { font-size: 0.9rem; font-style: italic; color: var(--body); }
.nt-sub-body { margin: 0.2rem 0 0 0.15rem; padding-left: 0.85rem; border-left: 1px solid var(--rule); }

.nt-links { font-family: var(--sans); font-size: 0.74rem; line-height: 1.6; color: var(--muted); margin-top: 0.1rem; }
.nt-related { display: flex; align-items: baseline; gap: 0.7rem; margin-top: 0.45rem; }
.nt-related .nt-links { margin-top: 0; }
.nt-related-k {
  flex: none; font-family: var(--sans); font-size: 0.6rem; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted);
}

.nref { color: var(--link); text-decoration: none; border-bottom: 1px solid transparent; transition: color var(--t-fast), border-color var(--t-fast); }
.nref:hover { color: var(--head); border-bottom-color: var(--rule); }
.nref-text, .nref-text:hover { color: var(--muted); border-bottom-color: transparent; }
.nref-sep { margin: 0 0.45rem; color: var(--muted); opacity: 0.7; }
.nref-ext { font-size: 0.85em; margin-left: 0.12em; color: var(--muted); }
.note-title-link { color: var(--link); text-decoration: none; transition: color var(--t-fast); }
.note-title-link:hover { color: var(--head); }
.note-flash { animation: note-flash 1.8s ease; border-radius: 3px; }
@keyframes note-flash {
  0%, 35% { background: color-mix(in srgb, var(--accent) 16%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
  100% { background: transparent; box-shadow: 0 0 0 4px transparent; }
}
@media (prefers-reduced-motion: reduce) { .note-flash { animation-duration: 0.9s; } }
@media (max-width: 720px) {
  .nt-row { grid-template-columns: 72px 1fr; gap: 0 0.9rem; }
}

/* Notes and research directions on a CV entry's page */
/* Research directions: the field names get a column as wide as the
 * longest of them (up to a limit), so each stays on one line. */
.nt-list-fit { display: grid; grid-template-columns: fit-content(17rem) 1fr; column-gap: 1.4rem; }
.nt-list-fit > .nt-row { grid-column: 1 / -1; grid-template-columns: subgrid; }
.nt-list-fit .nt-k-title { white-space: normal; }
@media (max-width: 720px) {
  .nt-list-fit { grid-template-columns: 1fr; }
  .nt-list-fit > .nt-row { row-gap: 0.15rem; }
}
.cvx .nt-sec { margin-top: 0; }
.cvx .nt-sec > .nt-h { margin-top: 0; }

/* ─── "?": keyboard shortcuts ─── */
.keys-overlay {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  -webkit-backdrop-filter: blur(6px) saturate(1.1); backdrop-filter: blur(6px) saturate(1.1);
  opacity: 0; transition: opacity 160ms ease;
}
.keys-overlay[hidden] { display: none; }
.keys-overlay.is-open { opacity: 1; }
.keys-card {
  width: min(44rem, 100%); max-height: calc(100vh - 3rem); overflow-y: auto; scrollbar-width: thin;
  padding: 1.4rem 1.6rem 1.6rem; outline: none;
  background: var(--bg); color: var(--body);
  border: 1px solid var(--rule); border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.16), 0 3px 10px rgba(0,0,0,0.07);
  transform: translateY(6px) scale(0.985); transition: transform 200ms cubic-bezier(.2,.7,.2,1);
}
.keys-overlay.is-open .keys-card { transform: none; }
.keys-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.1rem; }
.keys-title { margin: 0; font-family: var(--sans); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.keys-close {
  display: grid; place-items: center; width: 1.8rem; height: 1.8rem; margin: -0.3rem -0.5rem -0.3rem 0;
  background: none; border: 0; border-radius: 999px; cursor: pointer; color: var(--muted);
  transition: background var(--t-fast), color var(--t-fast);
}
.keys-close:hover { background: color-mix(in srgb, var(--surface) 80%, var(--rule)); color: var(--head); }
.keys-close svg { width: 10px; height: 10px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; fill: none; }
.keys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1.3rem 2.2rem; }
.keys-group-title {
  font-family: var(--serif); font-style: italic; font-size: 0.95rem; color: var(--head);
  margin: 0 0 0.45rem; padding-bottom: 0.35rem; border-bottom: 1px solid var(--rule);
}
.keys-row { display: grid; grid-template-columns: 9.4rem 1fr; gap: 0 0.9rem; align-items: baseline; padding: 0.28rem 0; }
.keys-keys { display: flex; flex-wrap: wrap; align-items: baseline; row-gap: 0.3rem; }
.keys-what { font-size: 0.84rem; line-height: 1.45; color: var(--body); }
.keys-card kbd {
  display: inline-block; min-width: 1.5em; padding: 0.05rem 0.38rem; text-align: center;
  font-family: var(--mono); font-size: 0.7rem; line-height: 1.5; color: var(--head);
  background: var(--surface); border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 5px;
}
.kb-seq { display: inline-flex; align-items: baseline; gap: 0.15rem; white-space: nowrap; }
.kb-plus { font-family: var(--sans); font-size: 0.68rem; color: var(--muted); margin: 0 0.05rem; }
.kb-or { font-family: var(--sans); font-size: 0.75rem; color: var(--muted); opacity: 0.8; margin: 0 0.3rem; }
@media (prefers-reduced-motion: reduce) { .keys-overlay, .keys-card { transition: none; } }

/* ─── Right-click: the ring menu ───
 * A frosted disc that grows with the rings, quiet tinted sectors, the way
 * to where you are marked in the heading colour, and a thin selector arc
 * under the entry pointed at. The centre names what is pointed at. */
.ring { position: fixed; inset: 0; z-index: 450; opacity: 0; transition: opacity 160ms ease; -webkit-user-select: none; user-select: none; }
.ring.is-open { opacity: 1; }
.ring-glass, .ring-svg, .ring-centre {
  position: absolute; left: var(--cx); top: var(--cy);
  transition: left 240ms cubic-bezier(.2,.75,.25,1), top 240ms cubic-bezier(.2,.75,.25,1),
              width 240ms cubic-bezier(.2,.75,.25,1), height 240ms cubic-bezier(.2,.75,.25,1), transform 220ms cubic-bezier(.2,.75,.25,1);
}
.ring-glass {
  width: var(--glass); height: var(--glass); border-radius: 50%;
  transform: translate(-50%, -50%) scale(calc(var(--s) * 0.94));
  background: color-mix(in srgb, var(--bg) 52%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.35); backdrop-filter: blur(18px) saturate(1.35);
  border: 1px solid color-mix(in srgb, var(--rule) 70%, transparent);
  box-shadow: 0 24px 70px rgba(0,0,0,0.16), 0 2px 10px rgba(0,0,0,0.06);
}
.ring.is-open .ring-glass { transform: translate(-50%, -50%) scale(var(--s)); }
.ring-svg { transform: translate(-50%, -50%) scale(var(--s)); overflow: visible; pointer-events: none; }
.ring-band { opacity: 0; transform: scale(0.94); transform-origin: 0 0; transition: opacity 170ms ease, transform 220ms cubic-bezier(.2,.75,.25,1); }
.ring-band.is-in { opacity: 1; transform: none; }
.ring-sec {
  fill: color-mix(in srgb, var(--rule) 34%, transparent);
  stroke: none; transition: fill 120ms ease;
}
.ring-sec.is-way { fill: color-mix(in srgb, var(--head) 13%, color-mix(in srgb, var(--rule) 30%, transparent)); }
.ring-sec.is-hover { fill: color-mix(in srgb, var(--head) 24%, color-mix(in srgb, var(--bg) 70%, transparent)); }
.ring-sec.is-dots { fill: color-mix(in srgb, var(--rule) 18%, transparent); }
.ring-label {
  font-family: var(--sans); font-size: 11px; letter-spacing: 0.01em; fill: var(--body);
  text-anchor: middle; dominant-baseline: central; pointer-events: none;
}
.ring-sec.is-way + .ring-label { fill: var(--head); }
.ring-sec.is-here + .ring-label { fill: var(--head); font-weight: 600; }
.ring-label.is-hover { fill: var(--head); }
.ring-label.is-dots { fill: var(--muted); letter-spacing: 0.15em; }
.ring-more { fill: var(--muted); opacity: 0.6; pointer-events: none; }
.ring-selector { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; pointer-events: none; }
.ring-centre {
  width: 118px; height: 118px; border-radius: 50%;
  transform: translate(-50%, -50%) scale(var(--s));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.18rem;
  padding: 0.6rem; text-align: center; pointer-events: none;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border: 1px solid color-mix(in srgb, var(--rule) 80%, transparent);
}
.ring-kicker { font-family: var(--sans); font-size: 0.56rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); line-height: 1.25; }
.ring-name {
  font-family: var(--serif); font-size: 0.8rem; line-height: 1.22; color: var(--head);
  display: -webkit-box; -webkit-line-clamp: 4; line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.ring-sub { font-family: var(--sans); font-size: 0.6rem; color: var(--muted); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ring-kicker:empty, .ring-sub:empty { display: none; }
@media (prefers-reduced-motion: reduce) { .ring, .ring-glass, .ring-svg, .ring-centre, .ring-band, .ring-sec { transition: none; } }

/* ─── Page not found (404.html) ─── */
.nf { max-width: calc(var(--max-w) + 3.5rem); margin: 0 auto; }
.nf-box { margin-top: 3.2rem; }
.nf-box h2 { margin-bottom: 0.7rem; }
.nf-title { font-size: 1.7rem; margin-bottom: 0.5rem; }
.nf-path { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); word-break: break-all; }
.nf-search {
  display: flex; align-items: center; gap: 0.5rem; margin: 2.4rem 0 0; max-width: 32rem;
  border-bottom: 1px solid var(--rule); transition: border-color var(--t-fast);
}
.nf-search:focus-within { border-bottom-color: var(--muted); }
.nf-search input {
  flex: 1; min-width: 0; font-family: var(--serif); font-size: 1.15rem; color: var(--head);
  background: none; border: 0; outline: none; padding: 0.45rem 0;
}
.nf-search input::placeholder { color: var(--muted); font-style: italic; }
.nf-search button { background: none; border: 0; padding: 0.3rem; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.nf-search button:hover { color: var(--head); }
.nf-search svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.nf-random { margin-top: 2.6rem; padding-top: 1.4rem; border-top: 1px solid var(--rule); max-width: 32rem; }
.nf-kicker { font-family: var(--sans); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.45rem; }
.nf-pick { display: inline-block; font-family: var(--serif); font-size: 1.05rem; line-height: 1.4; text-decoration: none; color: var(--link); }
.nf-pick:hover { color: var(--head); }
.nf-sub { font-size: 0.82rem; color: var(--muted); font-style: italic; margin-top: 0.2rem; }
.nf-again {
  margin-top: 0.9rem; background: none; border: 0; padding: 0; cursor: pointer;
  font-family: var(--sans); font-size: 0.73rem; letter-spacing: 0.03em; color: var(--muted);
  border-bottom: 1px solid transparent; transition: color var(--t-fast), border-color var(--t-fast);
}
.nf-again:hover { color: var(--body); border-bottom-color: var(--rule); }

/* ─── CV: title line with the print button ─── */
.cv-titlebar { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; max-width: var(--max-w); margin-bottom: 1rem; }
.cv-titlebar h2 { margin: 0; }
.cv-print-btn {
  background: none; border: 0; padding: 0.1rem 0; cursor: pointer;
  font-family: var(--sans); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid transparent; transition: color var(--t-fast), border-color var(--t-fast);
}
.cv-print-btn:hover { color: var(--body); border-bottom-color: var(--rule); }
.cv-print-btn:focus-visible { outline: 1px solid var(--muted); outline-offset: 3px; }
.cv-titlebar + .cv-section > h2 { margin-top: 1.6rem; }
.cvx-bar { margin-bottom: 2rem; }
.cvx-bar .paper-back { margin-bottom: 0; }

/* ─── The printed CV (built off-screen; shown only on paper) ─── */
/* Fixed, with no height of its own: Firefox counts the height of anything
 * placed absolutely, even far off to the left, as page that can be scrolled
 * to, and this document is several pages long. */
#cv-print {
  position: fixed; left: 0; top: 0; width: 176mm; height: 0; overflow: hidden;
  visibility: hidden; pointer-events: none; contain: layout style; z-index: -1;
}
.cvp { font-family: var(--serif); font-size: 10pt; line-height: 1.42; color: #161616; }
.cvp a { color: inherit; text-decoration: none; }
.cvp-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 8mm; padding-bottom: 3.5mm; border-bottom: 0.6pt solid #222; margin-bottom: 5mm; }
.cvp-head h1 { font-family: var(--serif); font-weight: 400; font-size: 21pt; letter-spacing: -0.01em; line-height: 1.1; margin: 0 0 1.5mm; color: #000; }
.cvp-aff { font-size: 9.5pt; color: #333; }
.cvp-contact { font-family: var(--sans); font-size: 8.3pt; color: #444; margin-top: 1mm; }
.cvp-sep { margin: 0 0.5em; color: #999; }
.cvp-doc { display: flex; flex-direction: column; align-items: flex-end; font-family: var(--sans); font-size: 7.6pt; letter-spacing: 0.1em; text-transform: uppercase; color: #666; white-space: nowrap; }
.cvp-sec { margin: 0 0 4.2mm; }
.cvp-sec h2 {
  font-family: var(--sans); font-size: 7.8pt; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: #333; margin: 0 0 1.6mm; padding-bottom: 0.8mm; border-bottom: 0.4pt solid #bbb;
  break-after: avoid; page-break-after: avoid;
}
.cvp-subhead { font-style: italic; font-size: 9pt; color: #555; margin: 1.6mm 0 0.6mm 24mm; break-after: avoid; page-break-after: avoid; }
.cvp-row { display: grid; grid-template-columns: 21mm 1fr; gap: 0 3mm; padding: 0.55mm 0; break-inside: avoid; page-break-inside: avoid; }
.cvp-when, .cvp-k { font-family: var(--sans); font-size: 8.2pt; color: #555; padding-top: 0.35mm; font-variant-numeric: tabular-nums; }
.cvp-k { font-family: var(--serif); font-size: 9.5pt; color: #222; font-style: italic; padding-top: 0; }
.cvp-num .cvp-when { text-align: right; padding-right: 1mm; }
.cvp-t { color: #000; }
.cvp-note, .cvp-with { font-size: 8.8pt; color: #555; }
.cvp-code { font-family: var(--sans); font-size: 7.8pt; color: #666; margin-left: 0.3em; }
.cvp-p { margin: 0; font-size: 9.6pt; color: #222; }
.cvp mjx-container { color: inherit; }
.cvp-entry { margin: 0 0 5mm; break-after: avoid; page-break-after: avoid; }
.cvp-kicker { font-family: var(--sans); font-size: 7.6pt; letter-spacing: 0.1em; text-transform: uppercase; color: #666; margin-bottom: 1mm; }
.cvp-entry-title { font-size: 15pt; line-height: 1.2; color: #000; }
.cvp-entry-note { font-style: italic; font-size: 9.6pt; color: #333; margin-top: 0.6mm; }
.cvp-counts { font-family: var(--sans); font-size: 8pt; color: #555; margin-top: 1.4mm; }
.cvp-url { font-family: var(--sans); font-size: 7.8pt; color: #666; word-break: break-all; }

@media print {
  #cv-print { display: none; }
  html.print-cv, html.print-cv body { background: #fff !important; }
  html.print-cv body > *:not(#cv-print) { display: none !important; }
  html.print-cv #cv-print { display: block; position: static; width: auto; height: auto; overflow: visible; visibility: visible; contain: none; z-index: auto; }
  html.print-cv * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ── Modules taught in the current, interactive format ("highlight" in
 *    site.js): a quiet line under the term, and a small star in the ring. ── */
.teaching-hl {
  display: flex; align-items: baseline; gap: 0.3em; margin-top: 0.35rem;
  font-family: var(--sans); font-size: 0.64rem; line-height: 1.3; letter-spacing: 0.02em;
  color: var(--accent);
}
.teaching-hl-mark { font-size: 0.7em; opacity: 0.85; }
.teaching-entry.is-highlight .teaching-term { color: var(--body); }
.ring-label.is-feature { fill: var(--accent); }
.ring-sec.is-way + .ring-label.is-feature, .ring-label.is-feature.is-hover { fill: var(--accent); }
.ring-star { fill: var(--accent); opacity: 0.8; pointer-events: none; }

/* ── Acknowledgements: a quiet link under the controls, opening a card ── */
.nav-ack { margin-top: -0.3rem; line-height: 1; }
.nav-ack-btn {
  padding: 0; border: 0; background: none; cursor: pointer;
  font-family: var(--sans); font-size: 0.68rem; letter-spacing: 0.02em; color: var(--muted);
  transition: color var(--t-fast);
}
.nav-ack-btn:hover, .nav-ack-btn:focus-visible, .nav-ack.is-open .nav-ack-btn { color: var(--head); }
.nav-ack-card {
  position: fixed; z-index: 60; width: min(16.5rem, calc(100vw - 16px));
  padding: 0.75rem 0.85rem 0.7rem;
  background: var(--bg); border: 1px solid var(--rule); border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.06);
  font-family: var(--sans); font-size: 0.74rem; line-height: 1.5; color: var(--body);
}
.nav-ack-card { text-align: left; }
.nav-ack-card[hidden] { display: none; }
.nav-ack-title { font-size: 0.64rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.nav-ack-intro { margin: 0.3rem 0 0.45rem; color: var(--muted); font-size: 0.72rem; }
.nav-ack-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.12rem; }
.nav-ack-who { color: var(--muted); }
.nav-ack-who a { color: var(--link, var(--accent)); text-decoration: none; }
.nav-ack-who a:hover, .nav-ack-who a:focus-visible { text-decoration: underline; }
@media (max-width: 720px) { .nav-ack { margin-top: 0; align-self: center; } }
.nav-ack-group-btn {
  padding: 0; border: 0; background: none; cursor: pointer; font: inherit; color: inherit; text-align: left;
}
.nav-ack-n { font-family: var(--mono); font-size: 0.62rem; color: var(--muted); margin-left: 0.2em; }
.nav-ack-group-btn::after { content: "›"; display: inline-block; margin-left: 0.35em; color: var(--muted); transition: transform var(--t-fast); }
.nav-ack-group.is-open .nav-ack-group-btn::after { transform: rotate(90deg); }
.nav-ack-sub {
  list-style: none; margin: 0; padding: 0 0 0 0.8rem; overflow: hidden;
  max-height: 0; opacity: 0; transition: max-height 220ms ease, opacity 160ms ease, margin 160ms ease;
}
.nav-ack-group.is-open .nav-ack-sub { max-height: 12rem; opacity: 1; margin: 0.1rem 0 0.2rem; }

/* ── Research profiles and journal quartiles: present, never loud ── */
.profiles-line {
  font-family: var(--sans); font-size: 0.74rem; color: var(--muted);
  margin: -0.4rem 0 1.1rem; letter-spacing: 0.01em;
}
.profiles-line a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 2px; }
.profiles-line a:hover, .profiles-line a:focus-visible { color: var(--head); text-decoration-color: currentColor; }
.profiles-sep { margin: 0 0.5em; opacity: 0.6; }
.profiles-n { font-variant-numeric: tabular-nums; }
.pub-q {
  font-family: var(--mono); font-size: 0.68em; color: var(--muted); letter-spacing: 0.03em;
  margin-left: 0.35em; opacity: 0.8; font-style: normal;
}

/* ── Phones (portrait and small tablets) ────────────────────────────────
 * Laptop layout untouched; this only re-arranges the sidebar as a header.
 * Picture and name centred, the pages as one row that scrolls sideways
 * (centred when they fit), and the switches behind a small round button
 * at the top right, opening downwards. */
.nav-ctrl-toggle { display: none; }
@media (max-width: 720px) {
  .site-wrap { grid-template-columns: minmax(0, 1fr); }
  #site-nav {
    min-width: 0; max-width: 100vw;
    position: relative; height: auto; overflow: visible;
    padding: 1.4rem 0 0.8rem; gap: 0.8rem;
    flex-direction: column; flex-wrap: nowrap; align-items: center;
    border-right: none; border-bottom: 1px solid var(--rule);
  }
  .nav-image { width: 72px; height: 72px; margin: 0 auto 0.1rem; }
  .nav-name { margin: 0; text-align: center; }
  .nav-links {
    flex-direction: row; flex-wrap: nowrap; gap: 1.15rem;
    width: 100%; overflow-x: auto; overflow-y: hidden; padding: 0.15rem 1.5rem;
    scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 1.2rem, #000 calc(100% - 1.2rem), transparent 100%);
            mask-image: linear-gradient(to right, transparent 0, #000 1.2rem, #000 calc(100% - 1.2rem), transparent 100%);
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links li { flex: none; }
  /* Centred while they fit, from the left edge once they do not. */
  .nav-links li:first-child { margin-left: auto; }
  .nav-links li:last-child { margin-right: auto; }
  .nav-links a { font-size: 0.86rem; padding: 0.3rem 0; }

  .nav-ctrl-toggle {
    display: grid; place-items: center; position: absolute; top: 0.9rem; right: 0.9rem;
    width: 2.4rem; height: 2.4rem; padding: 0; border-radius: 50%; cursor: pointer;
    color: var(--body); background: color-mix(in srgb, var(--bg) 70%, transparent);
    border: 1px solid var(--rule); box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    opacity: 0.8; transition: opacity 140ms ease, color 140ms ease;
  }
  .nav-ctrl-toggle svg { width: 1.2rem; height: 1.2rem; display: block; }
  .nav-ctrl-toggle:focus-visible { outline: 2px solid var(--head); outline-offset: 2px; }
  #site-nav.ctrl-open .nav-ctrl-toggle { opacity: 1; color: var(--head); }
  .nav-controls {
    display: none; position: absolute; z-index: 60; top: 3.8rem; right: 0.9rem;
    flex-direction: column; align-items: stretch; gap: 0.75rem;
    margin: 0; padding: 0.9rem 1rem 0.8rem; min-width: 12.5rem;
    /* Solid, without a backdrop filter: a filter would trap the theme list
       (which is placed against the window) inside this panel. */
    background: var(--bg);
    border: 1px solid var(--rule); border-radius: 12px;
    box-shadow: 0 14px 40px rgba(0,0,0,0.14), 0 2px 6px rgba(0,0,0,0.06);
    text-align: left;
  }
  #site-nav.ctrl-open .nav-controls { display: flex; }
  .nav-controls .nav-ctrl-label { font-size: 0.7rem; }
  .nav-ack { margin-top: 0.1rem; align-self: flex-start; }

  /* An opened module uses the width of the year column too. */
  .teaching-entry .teaching-detail { margin-left: calc(-72px - 1.4rem); }
}

/* ── Touch screens: the pages of the site as a sheet from the bottom ──
 * (js/app.js, sheetOpen). The button only exists where there is no mouse
 * or touchpad at all; laptops, touch screen or not, keep the ring. */
.sheet-btn { display: none; }
@media not all and (any-pointer: fine) {
  .sheet-btn {
    display: grid; place-items: center; position: fixed; left: 1rem; bottom: 1rem; z-index: 380;
    width: 2.4rem; height: 2.4rem; padding: 0; border-radius: 50%; cursor: pointer; color: var(--body);
    background: color-mix(in srgb, var(--bg) 70%, transparent);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border: 1px solid var(--rule); box-shadow: 0 4px 16px rgba(0,0,0,0.08); opacity: 0.8;
  }
  .sheet-btn svg { width: 1.3rem; height: 1.3rem; display: block; }
  .sheet-btn[aria-expanded="true"] { opacity: 1; color: var(--head); }
  html.pdfr-open .sheet-btn { display: none; }
}
/* Only while open. Never set overflow on body for good: the interactive
   pages rely on that (their SITE-REQUESTS.md, request 3). */
html.sheet-open, html.sheet-open body { overflow: hidden; }
.sheet { position: fixed; inset: 0; z-index: 440; pointer-events: none; }
.sheet.is-open { pointer-events: auto; }
.sheet-shade {
  position: absolute; inset: 0; background: rgba(0,0,0,0.28);
  opacity: 0; transition: opacity 220ms ease;
}
.sheet.is-open .sheet-shade { opacity: 1; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto;
  width: min(100%, 34rem); max-height: 78vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--body);
  border: 1px solid var(--rule); border-bottom: 0; border-radius: 16px 16px 0 0;
  box-shadow: 0 -12px 40px rgba(0,0,0,0.16);
  transform: translateY(102%); transition: transform 260ms cubic-bezier(.2,.8,.25,1);
  padding-bottom: env(safe-area-inset-bottom);
  font-family: var(--sans);
}
.sheet.is-open .sheet-panel { transform: none; }
.sheet-bar { flex: none; padding: 0.45rem 0.6rem 0.35rem; touch-action: none; border-bottom: 1px solid var(--rule); }
.sheet-grip { display: block; width: 2.4rem; height: 4px; margin: 0 auto 0.35rem; border-radius: 4px; background: var(--rule); }
.sheet-head { display: flex; align-items: center; gap: 0.4rem; }
.sheet-back, .sheet-close {
  flex: none; width: 2.4rem; height: 2.4rem; border: 0; border-radius: 50%; background: none; cursor: pointer;
  font-size: 1.5rem; line-height: 1; color: var(--muted);
}
.sheet-back[hidden] { visibility: hidden; display: block; }
.sheet-back:active, .sheet-close:active { background: color-mix(in srgb, var(--rule) 50%, transparent); }
.sheet-titles { flex: 1; min-width: 0; text-align: center; }
.sheet-kicker {
  font-size: 0.6rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sheet-kicker:empty { display: none; }
.sheet-title { font-size: 0.95rem; font-weight: 600; color: var(--head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet-list { padding: 0.3rem 0 0.8rem; }
.sheet-list.from-right { animation: sheet-in-r 220ms cubic-bezier(.2,.8,.25,1); }
.sheet-list.from-left { animation: sheet-in-l 220ms cubic-bezier(.2,.8,.25,1); }
@keyframes sheet-in-r { from { opacity: 0; transform: translateX(14%); } to { opacity: 1; transform: none; } }
@keyframes sheet-in-l { from { opacity: 0; transform: translateX(-14%); } to { opacity: 1; transform: none; } }
.sheet-row {
  display: flex; align-items: center; gap: 0.6rem; width: 100%; min-height: 3rem;
  padding: 0.55rem 1.1rem; border: 0; background: none; cursor: pointer; text-align: left;
  font: inherit; color: var(--body);
}
.sheet-row + .sheet-row { border-top: 1px solid color-mix(in srgb, var(--rule) 55%, transparent); }
.sheet-row:active { background: color-mix(in srgb, var(--rule) 35%, transparent); }
.sheet-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.sheet-row-label { font-size: 0.92rem; line-height: 1.3; color: var(--body); }
.sheet-row-sub { font-size: 0.72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-row-go { flex: none; width: 1rem; text-align: right; color: var(--muted); font-size: 1.1rem; }
.sheet-row.is-open-row .sheet-row-label { color: var(--head); font-weight: 500; }
.sheet-row.is-way .sheet-row-label { color: var(--head); }
.sheet-row.is-here { background: color-mix(in srgb, var(--head) 8%, transparent); }
.sheet-row.is-here .sheet-row-label { font-weight: 600; }
.sheet-row.is-feature .sheet-row-label { color: var(--accent); }
.sheet-star { flex: none; font-size: 0.6rem; color: var(--accent); opacity: 0.85; }
.sheet-wait { padding: 0.8rem 1.1rem; font-size: 0.8rem; color: var(--muted); font-style: italic; }
html[data-a11y-motion="reduce"] .sheet-panel, html[data-a11y-motion="reduce"] .sheet-list { transition: none; animation: none; }
@media (prefers-reduced-motion: reduce) { .sheet-panel, .sheet-list { transition: none; animation: none; } }
@media print { .sheet, .sheet-btn { display: none !important; } }

/* The plain summary for search engines (tools/make-seo.mjs); js/app.js
   replaces it, and with JavaScript on it is never shown. */
html.js .seo-summary { display: none; }

/* The reader's "zoom to the content" button (key c); on a narrow phone the
   key alone, like the zoom buttons. */
.pdfr-trim { font-size: 0.85rem; }
@media (max-width: 560px) { .pdfr-trim { display: none; } }

/* ─── Projects (js/projects.js) ─── */
.projects { --proj-bar-h: 22px; }
.proj-intro { font-size: 0.95rem; color: var(--body); margin-bottom: 1.6rem; max-width: 34rem; }
/* The time range, drawn like the CV's timeline (js/projects.js, rangeLine) */
.proj-tl { margin: 1.5rem 0 1.6rem; padding-bottom: 1.3rem; border-bottom: 1px solid var(--rule); }
.proj-tl .cvx-tl-seg { background: var(--head); animation: none; }
.proj-tl .cvx-tl-seg.is-dragging { transition: height 160ms ease, top 160ms ease; }
.proj-tl-labels { position: relative; height: 1.1rem; margin-top: 0.55rem; }
.proj-tl-label, .proj-tl-now {
  position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap;
  font-family: var(--sans); font-size: 0.7rem; letter-spacing: 0.03em; color: var(--muted);
}
.proj-tl-label { background: none; border: none; padding: 0 0.2rem 1px; cursor: pointer; border-bottom: 1px solid transparent; transition: color var(--t-fast), border-color var(--t-fast); }
.proj-tl-label:first-child { transform: none; padding-left: 0; }
.proj-tl-label:hover { color: var(--body); }
.proj-tl-label.active { color: var(--head); border-bottom-color: var(--body); }
.proj-tl-now { right: 0; transform: none; font-family: var(--mono); font-size: 0.62rem; opacity: 0.8; }
.proj-tl .cvx-tl-tip { top: auto; bottom: calc(50% + 10px); }
.proj-range { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 1rem; margin: 0 0 1.4rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--rule); }
.proj-range-label { font-family: var(--sans); font-size: 0.73rem; color: var(--muted); letter-spacing: 0.03em; }
.proj-range-btn {
  font-family: var(--sans); font-size: 0.73rem; letter-spacing: 0.04em;
  background: none; border: none; padding: 0 0 1px; color: var(--muted); cursor: pointer;
  border-bottom: 1px solid transparent; transition: color var(--t-fast), border-color var(--t-fast);
}
.proj-range-btn:hover { color: var(--body); }
.proj-range-btn.active { color: var(--head); border-bottom-color: var(--body); }
.proj-sum { font-size: 1.02rem; color: var(--head); margin: 0 0 0.4rem; }

.proj-section { margin-top: 2.6rem; }
.proj-h, .proj-h4 { font-family: var(--sans); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.9rem; }
.proj-h4 { font-weight: 500; margin-top: 1.6rem; }
.proj-note, .proj-legend, .proj-empty { font-family: var(--sans); font-size: 0.72rem; color: var(--muted); line-height: 1.5; margin: 0.8rem 0 0; }
.proj-empty { font-family: var(--serif); font-size: 0.9rem; font-style: italic; }
.proj-more { font-family: var(--sans); font-size: 0.72rem; color: var(--muted); background: none; border: none; padding: 0.5rem 0 0; cursor: pointer; letter-spacing: 0.03em; }
.proj-more:hover { color: var(--body); }

/* Activity rows: title and latest change on the left, the weeks on the right */
.proj-list, .proj-entries, .proj-plans, .proj-parts, .proj-all ul { list-style: none; margin: 0; padding: 0; }
.proj-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.3rem 1.4rem; align-items: center;
  padding: 0.85rem 0; border-top: 1px solid var(--rule); cursor: pointer;
}
.proj-row:first-child { border-top: none; padding-top: 0.2rem; }
.proj-row-main { min-width: 0; }
.proj-row-title, .proj-entry-project, .proj-all-link {
  font: inherit; background: none; border: none; padding: 0; cursor: pointer; text-align: left;
}
.proj-row-title { font-family: var(--serif); font-size: 1rem; color: var(--link); }
.proj-row:hover .proj-row-title, .proj-row-title:focus-visible { color: var(--head); }
.proj-row-tags { display: inline-flex; gap: 0.5rem; align-items: baseline; margin-left: 0.6rem; vertical-align: baseline; }
.proj-kind, .proj-new, .proj-state, .proj-kind-word, .proj-part, .proj-when, .proj-date {
  font-family: var(--sans); font-size: 0.62rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
.proj-new { color: var(--accent); }
.proj-row-sub { display: flex; gap: 0.6rem; align-items: baseline; margin-top: 0.15rem; min-width: 0; }
.proj-row-last { font-size: 0.85rem; color: var(--body); opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.proj-row-ago { font-family: var(--sans); font-size: 0.68rem; color: var(--muted); white-space: nowrap; }
.proj-row-right { display: flex; align-items: flex-end; gap: 0.9rem; }
.proj-state { min-width: 4.2rem; text-align: right; }
.proj-state.is-active { color: var(--accent); font-weight: 600; }
.proj-state.is-ongoing { color: var(--body); }

/* The weeks: thin bars on a hairline */
/* The bars fill a fixed width whatever the range: 7 days or 52 weeks */
.proj-bars {
  display: flex; align-items: flex-end; justify-content: flex-end; gap: 2px;
  width: 9.5rem; height: var(--proj-bar-h); border-bottom: 1px solid var(--rule);
}
.proj-bar { flex: 1 1 0; max-width: 7px; min-width: 1px; height: 0; background: var(--accent); border-radius: 1px 1px 0 0; opacity: 0.85; }
.proj-bars.is-dense { gap: 1px; }
.proj-bar.is-empty { height: 0; }
.proj-bars.is-big { --proj-bar-h: 56px; gap: 3px; width: 100%; justify-content: space-between; }
.proj-bars.is-big.is-dense { gap: 1px; }
.proj-bars.is-big .proj-bar { max-width: 22px; min-width: 2px; }
.proj-ticks { display: flex; justify-content: space-between; margin-top: 0.3rem; font-family: var(--sans); font-size: 0.62rem; color: var(--muted); }

/* News and logs */
.proj-entry { padding: 0.55rem 0; border-top: 1px solid color-mix(in srgb, var(--rule) 60%, transparent); }
.proj-entry:first-child { border-top: none; }
.proj-entry.has-detail { cursor: pointer; }
.proj-entry.has-detail:focus-visible { outline: 1px dotted var(--muted); outline-offset: 3px; }
.proj-entry-head { display: grid; grid-template-columns: 4.6rem minmax(0, 1fr); gap: 0.8rem; align-items: baseline; }
.proj-date { letter-spacing: 0.04em; }
.proj-entry-line { font-size: 0.92rem; color: var(--body); line-height: 1.5; }
.proj-entry-project { font-family: var(--sans); font-size: 0.66rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--accent); margin-right: 0.55rem; }
.proj-entry-project:hover { color: var(--head); }
.proj-entry-meta { display: flex; flex-wrap: wrap; gap: 0.3rem 0.7rem; align-items: center; margin-top: 0.2rem; }
.proj-entry-detail, .proj-plan-detail { font-size: 0.86rem; color: var(--body); opacity: 0.85; margin-top: 0.35rem; line-height: 1.6; }
.proj-entry.has-detail .proj-entry-title::after { content: " +"; color: var(--muted); font-family: var(--sans); font-size: 0.75em; }
.proj-entry.has-detail[aria-expanded="true"] .proj-entry-title::after { content: " −"; }
.proj-size { display: inline-flex; gap: 2px; align-items: center; }
.proj-size i { width: 4px; height: 4px; border-radius: 50%; background: var(--rule); }
.proj-size i.on { background: var(--accent); }
.proj-part { text-transform: none; letter-spacing: 0.02em; font-size: 0.68rem; }
.proj-part::before { content: "· "; }

/* Plans: a ring for planned, half for under way, full for done */
.proj-plan { padding: 0.55rem 0; border-top: 1px solid color-mix(in srgb, var(--rule) 60%, transparent); }
.proj-plan:first-child { border-top: none; }
.proj-plan-line { display: flex; align-items: baseline; gap: 0.55rem; font-size: 0.92rem; color: var(--body); line-height: 1.5; }
.proj-plan-line .proj-entry-project { margin-right: 0; }
.proj-plan-mark { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--accent); transform: translateY(-1px); }
.proj-plan.is-underway .proj-plan-mark { background: linear-gradient(90deg, var(--accent) 50%, transparent 50%); }
.proj-plan.is-done .proj-plan-mark { background: var(--accent); }
.proj-plan.is-dropped .proj-plan-mark { border-color: var(--muted); }
.proj-plan.is-dropped .proj-entry-title { text-decoration: line-through; color: var(--muted); }
.proj-plan .proj-entry-meta, .proj-plan .proj-plan-detail { margin-left: calc(8px + 0.55rem); }
.proj-kind-word.is-underway { color: var(--accent); }

/* A project on its own */
.proj-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.2rem; }
.proj-title { font-size: 1.45rem; font-weight: 400; line-height: 1.3; }
.proj-head .proj-row-tags { margin-left: 0.8rem; }
.proj-summary { font-size: 0.95rem; margin: 0.7rem 0 0; }
.proj-links { display: flex; flex-wrap: wrap; gap: 1.2rem; margin-top: 1rem; }
.proj-link { font-family: var(--sans); font-size: 0.75rem; letter-spacing: 0.03em; }
.proj-parts li { display: grid; grid-template-columns: minmax(7rem, 11rem) 1fr; gap: 0.8rem; align-items: center; padding: 0.2rem 0; }
.proj-part-name { font-size: 0.86rem; color: var(--body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-part-bar { height: 4px; background: var(--accent); opacity: 0.7; border-radius: 2px; }
.proj-section .proj-range { margin-bottom: 1rem; border-bottom: none; padding-bottom: 0; }

/* All projects, titles only */
.proj-all { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1.2rem 2rem; }
.proj-all .proj-kind { display: block; margin-bottom: 0.4rem; }
.proj-all li { padding: 0.12rem 0; }
.proj-all-link { font-family: var(--serif); font-size: 0.88rem; color: var(--link); }
.proj-all-link:hover { color: var(--head); }

@media (max-width: 560px) {
  .proj-row { grid-template-columns: 1fr; }
  .proj-row-right { justify-content: space-between; }
  .proj-state { min-width: 0; }
  .proj-entry-head { grid-template-columns: 1fr; gap: 0.1rem; }
  .proj-row-tags { margin-left: 0.4rem; }
}
.proj-head .proj-state { min-width: 0; }
.proj-title-link { color: inherit; text-decoration: none; border-bottom: 1px solid transparent; transition: border-color var(--t-fast), color var(--t-fast); }
.proj-title-link:hover, .proj-title-link:focus-visible { color: var(--link); border-bottom-color: currentColor; }
.proj-tl-label .is-short { display: none; }
@media (max-width: 480px) {
  .proj-tl-label .is-long { display: none; }
  .proj-tl-label .is-short { display: inline; }
}
