/* greek */
@font-face {
  font-family: 'Roboto';
  font-style: italic;
  font-weight: 100 900;
  font-stretch: 100%;
  src: url(fonts/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkBXkaSTbQWt4N.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* math */
@font-face {
  font-family: 'Roboto';
  font-style: italic;
  font-weight: 100 900;
  font-stretch: 100%;
  src: url(fonts/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkenkaSTbQWt4N.woff2) format('woff2');
  unicode-range: U+0302-0303, U+0305, U+0307-0308, U+0310, U+0312, U+0315, U+031A, U+0326-0327, U+032C, U+032F-0330, U+0332-0333, U+0338, U+033A, U+0346, U+034D, U+0391-03A1, U+03A3-03A9, U+03B1-03C9, U+03D1, U+03D5-03D6, U+03F0-03F1, U+03F4-03F5, U+2016-2017, U+2034-2038, U+203C, U+2040, U+2043, U+2047, U+2050, U+2057, U+205F, U+2070-2071, U+2074-208E, U+2090-209C, U+20D0-20DC, U+20E1, U+20E5-20EF, U+2100-2112, U+2114-2115, U+2117-2121, U+2123-214F, U+2190, U+2192, U+2194-21AE, U+21B0-21E5, U+21F1-21F2, U+21F4-2211, U+2213-2214, U+2216-22FF, U+2308-230B, U+2310, U+2319, U+231C-2321, U+2336-237A, U+237C, U+2395, U+239B-23B7, U+23D0, U+23DC-23E1, U+2474-2475, U+25AF, U+25B3, U+25B7, U+25BD, U+25C1, U+25CA, U+25CC, U+25FB, U+266D-266F, U+27C0-27FF, U+2900-2AFF, U+2B0E-2B11, U+2B30-2B4C, U+2BFE, U+3030, U+FF5B, U+FF5D, U+1D400-1D7FF, U+1EE00-1EEFF;
}
/* symbols */
@font-face {
  font-family: 'Roboto';
  font-style: italic;
  font-weight: 100 900;
  font-stretch: 100%;
  src: url(fonts/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkaHkaSTbQWt4N.woff2) format('woff2');
  unicode-range: U+0001-000C, U+000E-001F, U+007F-009F, U+20DD-20E0, U+20E2-20E4, U+2150-218F, U+2190, U+2192, U+2194-2199, U+21AF, U+21E6-21F0, U+21F3, U+2218-2219, U+2299, U+22C4-22C6, U+2300-243F, U+2440-244A, U+2460-24FF, U+25A0-27BF, U+2800-28FF, U+2921-2922, U+2981, U+29BF, U+29EB, U+2B00-2BFF, U+4DC0-4DFF, U+FFF9-FFFB, U+10140-1018E, U+10190-1019C, U+101A0, U+101D0-101FD, U+102E0-102FB, U+10E60-10E7E, U+1D2C0-1D2D3, U+1D2E0-1D37F, U+1F000-1F0FF, U+1F100-1F1AD, U+1F1E6-1F1FF, U+1F30D-1F30F, U+1F315, U+1F31C, U+1F31E, U+1F320-1F32C, U+1F336, U+1F378, U+1F37D, U+1F382, U+1F393-1F39F, U+1F3A7-1F3A8, U+1F3AC-1F3AF, U+1F3C2, U+1F3C4-1F3C6, U+1F3CA-1F3CE, U+1F3D4-1F3E0, U+1F3ED, U+1F3F1-1F3F3, U+1F3F5-1F3F7, U+1F408, U+1F415, U+1F41F, U+1F426, U+1F43F, U+1F441-1F442, U+1F444, U+1F446-1F449, U+1F44C-1F44E, U+1F453, U+1F46A, U+1F47D, U+1F4A3, U+1F4B0, U+1F4B3, U+1F4B9, U+1F4BB, U+1F4BF, U+1F4C8-1F4CB, U+1F4D6, U+1F4DA, U+1F4DF, U+1F4E3-1F4E6, U+1F4EA-1F4ED, U+1F4F7, U+1F4F9-1F4FB, U+1F4FD-1F4FE, U+1F503, U+1F507-1F50B, U+1F50D, U+1F512-1F513, U+1F53E-1F54A, U+1F54F-1F5FA, U+1F610, U+1F650-1F67F, U+1F687, U+1F68D, U+1F691, U+1F694, U+1F698, U+1F6AD, U+1F6B2, U+1F6B9-1F6BA, U+1F6BC, U+1F6C6-1F6CF, U+1F6D3-1F6D7, U+1F6E0-1F6EA, U+1F6F0-1F6F3, U+1F6F7-1F6FC, U+1F700-1F7FF, U+1F800-1F80B, U+1F810-1F847, U+1F850-1F859, U+1F860-1F887, U+1F890-1F8AD, U+1F8B0-1F8BB, U+1F8C0-1F8C1, U+1F900-1F90B, U+1F93B, U+1F946, U+1F984, U+1F996, U+1F9E9, U+1FA00-1FA6F, U+1FA70-1FA7C, U+1FA80-1FA89, U+1FA8F-1FAC6, U+1FACE-1FADC, U+1FADF-1FAE9, U+1FAF0-1FAF8, U+1FB00-1FBFF;
}
/* latin-ext */
@font-face {
  font-family: 'Roboto';
  font-style: italic;
  font-weight: 100 900;
  font-stretch: 100%;
  src: url(fonts/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkCHkaSTbQWt4N.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Roboto';
  font-style: italic;
  font-weight: 100 900;
  font-stretch: 100%;
  src: url(fonts/roboto/v51/KFO5CnqEu92Fr1Mu53ZEC9_Vu3r1gIhOszmkBnkaSTbQWg.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* greek */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 100%;
  src: url(fonts/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3-UBHMdazTgWw.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* math */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 100%;
  src: url(fonts/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMawCUBHMdazTgWw.woff2) format('woff2');
  unicode-range: U+0302-0303, U+0305, U+0307-0308, U+0310, U+0312, U+0315, U+031A, U+0326-0327, U+032C, U+032F-0330, U+0332-0333, U+0338, U+033A, U+0346, U+034D, U+0391-03A1, U+03A3-03A9, U+03B1-03C9, U+03D1, U+03D5-03D6, U+03F0-03F1, U+03F4-03F5, U+2016-2017, U+2034-2038, U+203C, U+2040, U+2043, U+2047, U+2050, U+2057, U+205F, U+2070-2071, U+2074-208E, U+2090-209C, U+20D0-20DC, U+20E1, U+20E5-20EF, U+2100-2112, U+2114-2115, U+2117-2121, U+2123-214F, U+2190, U+2192, U+2194-21AE, U+21B0-21E5, U+21F1-21F2, U+21F4-2211, U+2213-2214, U+2216-22FF, U+2308-230B, U+2310, U+2319, U+231C-2321, U+2336-237A, U+237C, U+2395, U+239B-23B7, U+23D0, U+23DC-23E1, U+2474-2475, U+25AF, U+25B3, U+25B7, U+25BD, U+25C1, U+25CA, U+25CC, U+25FB, U+266D-266F, U+27C0-27FF, U+2900-2AFF, U+2B0E-2B11, U+2B30-2B4C, U+2BFE, U+3030, U+FF5B, U+FF5D, U+1D400-1D7FF, U+1EE00-1EEFF;
}
/* symbols */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 100%;
  src: url(fonts/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMaxKUBHMdazTgWw.woff2) format('woff2');
  unicode-range: U+0001-000C, U+000E-001F, U+007F-009F, U+20DD-20E0, U+20E2-20E4, U+2150-218F, U+2190, U+2192, U+2194-2199, U+21AF, U+21E6-21F0, U+21F3, U+2218-2219, U+2299, U+22C4-22C6, U+2300-243F, U+2440-244A, U+2460-24FF, U+25A0-27BF, U+2800-28FF, U+2921-2922, U+2981, U+29BF, U+29EB, U+2B00-2BFF, U+4DC0-4DFF, U+FFF9-FFFB, U+10140-1018E, U+10190-1019C, U+101A0, U+101D0-101FD, U+102E0-102FB, U+10E60-10E7E, U+1D2C0-1D2D3, U+1D2E0-1D37F, U+1F000-1F0FF, U+1F100-1F1AD, U+1F1E6-1F1FF, U+1F30D-1F30F, U+1F315, U+1F31C, U+1F31E, U+1F320-1F32C, U+1F336, U+1F378, U+1F37D, U+1F382, U+1F393-1F39F, U+1F3A7-1F3A8, U+1F3AC-1F3AF, U+1F3C2, U+1F3C4-1F3C6, U+1F3CA-1F3CE, U+1F3D4-1F3E0, U+1F3ED, U+1F3F1-1F3F3, U+1F3F5-1F3F7, U+1F408, U+1F415, U+1F41F, U+1F426, U+1F43F, U+1F441-1F442, U+1F444, U+1F446-1F449, U+1F44C-1F44E, U+1F453, U+1F46A, U+1F47D, U+1F4A3, U+1F4B0, U+1F4B3, U+1F4B9, U+1F4BB, U+1F4BF, U+1F4C8-1F4CB, U+1F4D6, U+1F4DA, U+1F4DF, U+1F4E3-1F4E6, U+1F4EA-1F4ED, U+1F4F7, U+1F4F9-1F4FB, U+1F4FD-1F4FE, U+1F503, U+1F507-1F50B, U+1F50D, U+1F512-1F513, U+1F53E-1F54A, U+1F54F-1F5FA, U+1F610, U+1F650-1F67F, U+1F687, U+1F68D, U+1F691, U+1F694, U+1F698, U+1F6AD, U+1F6B2, U+1F6B9-1F6BA, U+1F6BC, U+1F6C6-1F6CF, U+1F6D3-1F6D7, U+1F6E0-1F6EA, U+1F6F0-1F6F3, U+1F6F7-1F6FC, U+1F700-1F7FF, U+1F800-1F80B, U+1F810-1F847, U+1F850-1F859, U+1F860-1F887, U+1F890-1F8AD, U+1F8B0-1F8BB, U+1F8C0-1F8C1, U+1F900-1F90B, U+1F93B, U+1F946, U+1F984, U+1F996, U+1F9E9, U+1FA00-1FA6F, U+1FA70-1FA7C, U+1FA80-1FA89, U+1FA8F-1FAC6, U+1FACE-1FADC, U+1FADF-1FAE9, U+1FAF0-1FAF8, U+1FB00-1FBFF;
}
/* latin-ext */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 100%;
  src: url(fonts/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3KUBHMdazTgWw.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 100%;
  src: url(fonts/roboto/v51/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3yUBHMdazQ.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}


@font-face {
  font-family: 'Source Code Pro';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/source_code_pro-latin_ext.woff2) format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Source Code Pro';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/source_code_pro-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

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


html {
  --color-page-bg: #ffffff;
  --color-text: #222730;
  /* white for text/shadows on dark backgrounds (header nav, funding logo) */
  --color-on-dark: #ffffff;
  /* header level0 (top) background */
  --color-header-level0-bg: #a10018;
  /* header level0 nav link text */
  --color-header-level0-link: #eee;
  /* header level0 active nav item text */
  --color-header-level0-active: #fff;
  /* level1 section menu: solid strip below the header, one shade darker */
  --color-header-level1-bg: #7f0a19;
  --color-header-level1-link: #eee;
  --color-header-level1-active: #fff;
  /* site title text (h1 in header) */
  --color-header-title: #e6002e;
  /* nav item underline / menu separator */
  --color-menu-border: #aaa;
  --color-link: #3b5683;
  --color-link-hover: #819aca;
  /* button bg: crimson in light mode */
  --color-btn-bg: #C0392B;
  --color-btn-bg-hover: #922B21;

  --color-footer-bg: #eee;
  --color-footer-text: #222730;

  /* shared border for code blocks, abstracts, etc. */
  --color-box-border: #ccc;
  /* list separator border (news items) */
  --color-border: #ddd;
  /* accent color (crimson), e.g. thesis highlights */
  --color-secondary: #e6002e;
  /* code / pre background */
  --color-code-bg: #f4f4f8;
  /* box / card shadow */
  --color-shadow: rgba(0,0,0,0.3);
  box-sizing: border-box;

  /* avoid long words from messing up the layout */
  overflow-wrap: break-word;
}

html[data-theme="dark"] {
  --color-page-bg: #1a1f27;
  --color-text: #d9dbe0;
  --color-on-dark: #ffffff;
  --color-header-level0-bg: #8B1A2B;
  --color-header-level0-link: #eee;
  --color-header-level0-active: #fff;
  --color-header-level1-bg: #6f1421;
  --color-header-level1-link: #eee;
  --color-header-level1-active: #fff;
  --color-header-title: #ff4050;
  --color-menu-border: #aaa;
  --color-link: #819aca;
  --color-link-hover: #a6d0ed;
  /* button bg: crimson in dark mode */
  --color-btn-bg: #A93226;
  --color-btn-bg-hover: #C0392B;
  --color-footer-bg: #222730;
  --color-footer-text: #d9dbe0;
  --color-box-border: #444;
  --color-border: #3a4150;
  --color-secondary: #ff4050;
  --color-code-bg: #2a3040;
  --color-shadow: rgba(0,0,0,0.6);
}

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

/* Never let images blow out the layout on small screens */
img {
    max-width: 100%;
    height: auto;
}

body {
    font-family: 'Roboto', system-ui, sans-serif;
    line-height: 1.5;
    background: var(--color-page-bg);
    color: var(--color-text);
    padding: 0 0;
    margin: 0 0;

    position: relative;
    min-height: 100vh; /* to move footer to bottom */
    /* scrollbar-gutter: stable both-edges;*/
    display: flex;
    flex-direction: column;
    transition: background 200ms ease, color 200ms ease;
}

/* main's horizontal padding feeds the `sizes` attribute of responsive
   images (templates/macros/image.html + publication-list.html).
   Keep in sync if changed. */
header, footer, main {
    display: block;
    width: 100%;
    margin: 0 0;
    padding: 1em 1em;
}

header {
    padding-right: 2em;
}

header, footer{
    flex: 0 0 auto;
}
/* Max image column width: also hardcoded in the `sizes` attribute of
   responsive images. Keep in sync if changed. */
.content {
    max-width: 60rem;
    margin: auto;
}

header .content {
    max-width: 40rem;
}
main {
    flex: 1 0 auto;
    /*padding: 2rem;*/
    padding-bottom: 2rem;
}


header {
    box-shadow: 0px .15rem .15rem var(--color-shadow);
}
/* ── Top header (level0) ──────────────────────────────────────────
   Mobile-first, three tiers:
   • narrow  (<48rem)  : [cgg logo][funding logos] … spacer … [toggle ⊥ hamburger];
                         menu is a CSS-only <details> dropdown below the bar
   • medium  (≥48rem)  : logo left, inline nav in the middle (wraps to two
                         rows), dark-mode toggle + funding logos at the right;
                         logo & funding logos vertically centered
   • wide    (≥76rem)  : everything on a single row
   .header-bar reproduces the .content column (60rem centered, plus
   main's 1em = 1.2rem horizontal padding), so the CGG logo starts
   exactly at the horizontal start of the page body and the right-hand
   cluster (toggle + funding logos / hamburger) ends exactly at the
   horizontal end of the page body. */
header.level0 {
    background: var(--color-header-level0-bg);
    position: relative;
    z-index: 3;
    padding: 0;
    /* shared height of CGG logo and funding logos — constant at every
       viewport width */
    --logo-h: 4rem;
}
/* Same horizontal geometry as .content (max-width: 60rem; margin: auto)
   inside main (padding: 1em = 1.2rem): the bar is 60rem + 2×1.2rem wide
   with 1.2rem padding, so its inner column edges up exactly with the
   page body's left and right edges. */
.header-bar {
    position: relative;
    max-width: calc(60rem + 2.4rem);
    margin: 0 auto;
    display: flex;
    align-items: center;
    column-gap: 0.75rem;
    padding: 0.625rem 1.2rem;
}

/* Narrow screens: logo | funding | (nav spacer) | actions at far right */
header.level0 .logo    { order: 1; }
header.level0 .funding { order: 2; }
header.level0 .main-nav { order: 3; }
header.level0 .actions { order: 4; }

/* Logos: CGG logo + funding logos, always the same height */
header.level0 .logo,
header.level0 .funding {
    display: inline-flex;
    flex: 0 0 auto;
}
img.cgg_logo_img,
img.funding_logo_img {
    height: var(--logo-h);
    width: auto;
}

/* Right-hand actions: on narrow screens the dark-mode toggle is stacked
   directly above the hamburger, both centered at the end of the body column.
   (No gap here: in the row layout at ≥41rem the gap is set there.) */
header.level0 .actions {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Nav */
header.level0 .main-nav {
    flex: 1 1 auto; /* spacer on narrow screens; holds the menu otherwise */
    min-width: 0;
}
header h1 a {
    color: var(--color-on-dark);
}
header a { text-decoration: none; }

header.level0 a       { color: var(--color-header-level0-link); }
header.level0 a:hover { color: var(--color-on-dark); }

/* ── Menu bars, shared by both levels ─────────────────────────────────
   Both bars come from templates/macros/nav.html:
   <nav class="main-nav|submenu"><ul class="menubar"><li><a class="menuitem">.
   The current item carries aria-current="page", so there is no second
   "active" class that could drift away from the markup. */
.menubar {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap; /* two rows instead of a horizontal scroll */
    column-gap: 1.5rem;
    row-gap: 0.25rem;
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: 1.2rem;
}
.menubar li {
    margin: 0;
}
.menubar .menuitem {
    text-decoration: none;
    transition: color 300ms ease;
}
/* Hover gets a thin dim underline, the current item a slightly thicker bright
   one. Both are real text decorations rather than borders or shadows: they hug
   the label (also in the full-width rows of the narrow dropdown), and adding
   them never shifts a neighbouring item by a pixel.
   The [aria-current] selector is as specific as :hover above and comes later,
   so hovering the current item keeps its underline. */
.menubar .menuitem:hover {
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 0.2rem;
    text-decoration-color: var(--color-menu-border);
}
.menubar .menuitem[aria-current="page"] {
    font-weight: bold;
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 0.2rem;
    text-decoration-color: var(--color-on-dark);
}
.main-nav [aria-current="page"] {
    color: var(--color-header-level0-active);
}

/* Level-1 section bar: solid strip below the header, items aligned with the
   text column (.content is 60rem centered plus main's 1.2rem side padding). */
.submenu {
    background: var(--color-header-level1-bg);
}
.submenu .menubar {
    max-width: calc(60rem + 2.4rem);
    margin: 0 auto;
    padding: 0.4rem 1.2rem 0.5rem;
}
.submenu a                   { color: var(--color-header-level1-link); }
.submenu a:hover             { color: var(--color-on-dark); }
.submenu [aria-current="page"] { color: var(--color-header-level1-active); }

/* ── CSS-only tabs ───────────────────────────────────────────────────
   A tab bar (nav.submenu.tabs, macros/nav.html) links to fragments, and all
   panels live in the same page:

     <nav class="submenu tabs"> → #current / #archive
     <div class="tabpanels"><section class="tabpanel" id="…">…

   The panel whose id is the URL fragment wins; with no fragment the first one
   shows, so a plain /teaching/ load looks like before. Nothing to toggle in
   JS: :target picks the panel, :has() picks the tab that points at it.

   Hiding needs :has(), so everything is wrapped in @supports: without it all
   panels simply stack and stay readable — tabs are an enhancement, never a way
   to make content disappear. */
@supports selector(:has(*)) {
    /* Panels share one grid cell, so they start at the same y and switching
       them cannot move anything below the tab bar. */
    .tabpanels { display: grid; }
    .tabpanels > .tabpanel {
        grid-area: 1 / 1;
        display: none;
        /* "Already in view" from any scroll position, so the browser's scroll
           to the fragment has nothing left to do and the page never jumps. */
        scroll-margin-top: 9999px;
    }
    .tabpanels > .tabpanel:target,
    .tabpanels:not(:has(.tabpanel:target)) > .tabpanel:first-child { display: block; }
}

/* Active look of [aria-current="page"] above, but derived from the fragment.
   Specificity beats the :hover rule, so hovering the active tab keeps it. */
:root:not(:has(.tabpanel:target)) .tabs .menubar li:first-child .menuitem,
:root:has(#current:target)          .tabs [href="#current"],
:root:has(#archive:target)          .tabs [href="#archive"] {
    font-weight: bold;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.2rem;
    text-decoration-color: var(--color-on-dark);
    color: var(--color-header-level1-active);
}

/* Narrow screens: the level-0 menu turns into a dropdown panel hanging below
   the header, CSS-only (open <details>, no JS). Everything that differs from
   the inline row above lives in here, so nothing has to be reset again at
   wider viewports. */
@media (max-width: 43.99rem) {
    header.level0 .menubar {
        display: block; /* one item per line */
        position: absolute;
        top: 100%;
        right: 1.2rem;
        min-width: 12rem;
        padding: 0.5rem 0;
        background: var(--color-header-level0-bg);
        box-shadow: 0 0.25rem 0.5rem var(--color-shadow);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-0.25rem);
        transition: opacity 150ms ease, transform 150ms ease, visibility 0s 150ms;
    }
    .header-bar:has(.nav-toggle[open]) .menubar {
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: opacity 150ms ease, transform 150ms ease;
    }
    /* full-width rows for a comfortable touch target; the underline still only
       covers the label because it is a text decoration */
    header.level0 .menubar .menuitem {
        display: block;
        padding: 0.5rem 1rem;
    }
}

/* Hamburger: 44px touch target, shown on narrow screens only */
.hamburger {
    display: flex;
    width: 2.75rem;
    height: 2.75rem;
    /* Stacked layout: toggle (1.5rem) + hamburger (2.75rem) would make the
       actions column 4.25rem, 0.25rem taller than --logo-h and thus the
       header bar. Pull the bottom up by that amount so the bar keeps its
       normal height (the hamburger only ever shows in the narrow layout). */
    margin-bottom: -0.5rem;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}
.hamburger span {
    display: block;
    width: 1.75rem;
    height: 3px;
    margin: 0 auto;
    background: var(--color-on-dark);
    border-radius: 2px;
    transition: transform 200ms ease, opacity 200ms ease;
    transform-origin: center center;
}
.hamburger::-webkit-details-marker { display: none; }
summary.hamburger { list-style: none; }
/* Animate hamburger into X */
details[open] > .hamburger span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
details[open] > .hamburger span:nth-child(2) { opacity: 0; }
details[open] > .hamburger span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* Medium screens (tablet / narrowed desktop): inline nav that may wrap
   to two rows; logo & funding logos stay on the sides, vertically centered
   (header-bar is align-items: center). */
@media (min-width: 44rem) {
    .header-bar {
        column-gap: 1.5rem;
        /* vertical padding stays at the base 0.625rem so the bar height
           (4rem logo + 2×0.625rem = 5.25rem) is constant at all widths */
    }
    /* logo | nav | toggle | funding logos (at the end of the body column) */
    header.level0 .main-nav { order: 2; }
    header.level0 .actions {
        order: 3;
        flex-direction: row;
        align-items: center;
        gap: 1rem;
    }
    header.level0 .funding { order: 4; }
    header.level0 .nav-toggle { display: none; }
}


a {
    color: var(--color-link);
}

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


footer {
    box-shadow: 0px -.15rem .2rem var(--color-shadow);
    background: var(--color-footer-bg);
    color: var(--color-footer-text);
    bottom: 0;
    font-size: .8rem;
}

.shadow {
    box-shadow: .15rem .15rem .15rem var(--color-shadow);
}

pre.bibtex {
    overflow-x: auto;
    margin: 0.1em;
    white-space: pre-wrap;
    border: 1px solid var(--color-box-border);
    background: var(--color-code-bg);
    padding: .5em;
    font-family: 'Source Code Pro', monospace;
    font-size: .9em;

    transition: 200ms ease;
}
div.abstract {
    transition: 200ms ease;
}

.abstract {
    border: 1px solid var(--color-box-border);
    padding: .5em;
}

/* ── Publication details toggle (no-JS, sibling trick like hamburger) ── */

/* Hide the native <summary> marker */
.pub-details > summary {
    list-style: none;
    margin: 0;
    padding: 0;
    display: inline-block;
    cursor: pointer;
}
.pub-details > summary::-webkit-details-marker {
    display: none;
}
/* Links inside <summary> must not eat the click — let it reach the <summary> so <details> toggles */
.pub-details > summary a {
    pointer-events: none;
}

/* Copy BibTeX button — proper button on individual pub page */
.copy-bibtex-btn {
    background: var(--color-btn-bg);
    color: var(--color-on-dark);
    border: none;
    border-radius: 0.25em;
    padding: 0.2em 0.6em;
    font-size: 0.7em;
    cursor: pointer;
}
.copy-bibtex-btn:hover {
    background: var(--color-btn-bg-hover);
}
/* Individual pub page: heading and copy button share one line */
.bibtex-header {
    display: flex;
    align-items: baseline;
    gap: 0.5em;
}
.bibtex-header h2 {
    margin-bottom: 0;
}

/* In the publication list, style it as inline text instead */
.publication-info .copy-bibtex-btn {
    background: none;
    color: var(--color-link);
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
    text-decoration: none;
}

/* Abstract / BibTeX hidden by default inside publication list items,
   revealed when their own <details> is open. Scoped to .publication-info so
   the individual publication page always shows them. */
.publication-info .abstract,
.publication-info .bibtex {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    padding: 0 .5em;
    transition: max-height 200ms ease-out,
                opacity 200ms ease-out,
                padding 200ms ease-out;
}

.publication-files:has(.pub-details-abstract[open]) ~ .abstract {
    max-height: 10000px;
    opacity: 1;
    padding: .5em;
    transition: max-height 200ms ease-out,
                opacity 200ms ease-out,
                padding 200ms ease-out;
}

.publication-files:has(.pub-details-bibtex[open]) ~ .bibtex {
    max-height: 3000px;
    opacity: 1;
    padding: .5em;
    transition: max-height 200ms ease-out,
                opacity 200ms ease-out,
                padding 200ms ease-out;
}
.abstract > p {
    margin: 0;
}



ul.publication-list,
ul.team,
ul.news
{
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* margin + padding-right shrink the teaser row width; also hardcoded in
   the publist `sizes` attribute (macros/publication-list.html). Keep in
   sync if changed. */
ul.team > li,
ul.publication-list > li,
ul.news > li
{
    display: inline-block;
    list-style: none;
    margin: .5rem;
    padding-left: 0em;
    padding-right: 1em;
}

ul.team li {
    min-height: 2rem;
}
ul.publication-list > li {
    min-height: 8rem;
    display: flex;
    flex-direction: row;
}

ul.publication-files {
    padding: 0em;
}

ul.publication-files >li
{
    list-style: none;
    display: inline-block;
    padding-right: 1em;
}

.profile {
    display: flex;
    flex-direction: row;
}

.team li:first-of-type {
    margin-top: 0;
}

div.mugshot {
    width: 15rem;
}
div.mugshot img {
    display: block;
    max-width: 90%;
    height: auto;
}
.person-info {
    /*
    margin-top: 1em;
    */
}

.person-info a {
    text-decoration: none;
}

figure {
    margin: 1rem;
    max-width: 100%;
}
figure img {
    max-width: 100%;
    height: auto;
}
figure figcaption {
    font-style: italic;
}
figure.right { float: right; }




/* 1:2 teaser:text ratio (with .publication-info's flex: 2 2) determines
   the wide-screen teaser width = row/3; also hardcoded in the publist
   `sizes` attribute. Keep in sync if changed. */
div.publication-teaser {
    flex: 1 1;
    /* Allow the column to shrink below the image's intrinsic width so the
       1:2 ratio holds and all rows' text columns stay aligned. */
    min-width: 0;
    max-width: 100%;
    padding-bottom: .4rem;
    padding-top: 0.6rem;
}

.publication-info {
    flex: 2 2; /* see div.publication-teaser: part of the 1:2 sizes ratio */
    /* Same: hidden .bibtex/.abstract lines must not widen this column. */
    min-width: 0;
    display: flex;
    flex-direction: column;
}

h1 a { text-decoration: none }
h2 a { text-decoration: none }
h3 a { text-decoration: none }


.publication-list h3,
.person-info h3,
.news h3
{
    margin-top: 0px;
    margin-bottom: 0px;
}

.person-info h2, .person-info h3
{
    margin-top: 0px;
    margin-bottom: 0px;
}


/* The 1rem right padding shrinks the image below its column; also
   hardcoded in the publist `sizes` attribute. Keep in sync if changed.
   It sits on the anchor (not the img) so border-radius hugs the image. */
div.publication-teaser a {
    display: block;
    padding: 0rem 1rem 0rem 0rem;
}
div.publication-teaser img {
    display: block;
    max-width: 100%;
    /* Right-align against the text column (narrow/tall images). */
    margin-left: auto;
    height: auto;
    /* Match the research-area teaser corners on the homepage. */
    border-radius: 8px;
}
.teaser img {
    max-width: 100%;
    height: auto;
}
img.selected-figure {
    max-width: 100%;
    height: auto;
}

.publication-venue {
    font-style: italic;
}

a::before {
    display: inline-block;
    height: 1.2em;
    vertical-align: text-bottom;
    background-repeat: no-repeat;
    background-size: 1.2em;
    background-position: left center;
}
a[href^="http"]::before {
    content: "";
    background-image: url('icons/link.svg');
    width: 1.2em;
    margin-right: 0.2em;
}
a.no-external-icon::before { display: none; }
a[href^="https://orcid.org/"]::before {
    content: "";
    background-image: url('icons/orcid.svg');
    width: 1.2em;
    margin-right: 0.2em;
}
a[href^="tel:"]::before {
    content: "";
    background-image: url('icons/phone-call.svg');
    width: 1.2em;
    margin-right: 0.2em;
}
a[href^="mailto:"]::before {
    content: "";
    background-image: url('icons/envelope.svg');
    width: 1.2em;
    margin-right: 0.2em;
}
a[href$='.zip']::before, a[href$='.tar.gz']::before, a[href$='.tar.bz2']::before, a[href$='.tar.zst']::before {
    content: "";
    background-image: url('icons/package.svg');
    width: 1.2em;
    margin-right: 0.2em;
}
a[href$='.ppt']::before, a[href$='.key']::before {
    content: "";
    background-image: url('icons/slides.svg');
    width: 1.2em;
    margin-right: 0.2em;
}
a.bibtex-link::before, a.abstract-link::before {
    content: "";
    background-image: url('icons/file-text.svg');
    width: 1.2em;
    margin-right: 0.2em;
}
a[href$='.pdf']::before {
    content: "";
    background-image: url('icons/file-pdf.svg');
    width: 1.2em;
    margin-right: 0.2em;
}
a.a-project-page::before {
    content: "";
    background-image: url('icons/info.svg');
    width: 1.2em;
    margin-right: 0.2em;
}

a {
    padding-left: 0;
}

.blog-post {
    padding: .2rem .5rem .1rem .5rem;
    width: 100%;
    justify-content: space-between;
}

/* News post images: capped on desktop, still fluid on phones */
.blog-post img {
    max-width: min(100%, 40rem);
}

/* Contact page: cap the campus map */
.contact-body img {
    display: block;
    max-width: min(100%, 40rem);
}


span.pub_date {
    font-style: italic;
}
span.pub_date::before {
    content: "";
    display: inline-block;
    width: 1.2em;
    height: 1.2em;
    margin-right: 0.2em;
    vertical-align: text-bottom;
    background-image: url('icons/date.svg');
    background-repeat: no-repeat;
    background-size: 1.2em;
    background-position: left center;
}

.content div.meta {
    margin-bottom: 1em;
}



/* Stacks the publist rows (teaser full width). This 40rem breakpoint is
   also a media condition in the publist `sizes` attribute. Keep in sync
   if changed. */
@media screen and (max-width: 40rem) {
  .profile     { flex-direction: column; }
  ul.publication-list li { flex-direction: column; }
  /* Stacked view: image above the text, keep it left-aligned. */
  div.publication-teaser img { margin-left: 0; }
}

/* Dark mode toggle */
.dark-mode-toggle {
    display: block;
    font-size: 1.3rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
    z-index: 10;
    transition: transform 200ms ease;
    /* always sits on the dark header background */
    color: var(--color-on-dark);
}




.dark-mode-toggle:hover {
    transform: scale(1.2);
}
.dark-mode-toggle .icon-sun,
.dark-mode-toggle .icon-moon {
    display: block;
}
/* Show moon in light mode, sun in dark mode (the icon represents the action) */
.dark-mode-toggle .icon-sun {
    display: none;
}
.dark-mode-toggle .icon-moon {
    color: var(--color-on-dark);
}
html[data-theme="dark"] .dark-mode-toggle .icon-moon {
    display: none;
}
html[data-theme="dark"] .dark-mode-toggle .icon-sun {
    display: block;
    color: var(--color-on-dark);
}

html[data-theme="dark"] a::before,
html[data-theme="dark"] span.pub_date::before {
    filter: invert(1);
}
/* The ORCID iD mark is a full-colour logo, not a monochrome icon.
   Inverting it would turn the green purple, so keep its original colours. */
html[data-theme="dark"] a[href^="https://orcid.org/"]::before {
    filter: none;
}

/* Move Lektor edit link down */
#lektor-edit-link {
    margin-top: 3em !important;
}

/* Research area block layout - image floated left, text wraps around it */
.research-area-content {
    margin-bottom: 2rem;
}
.research-area-content h4 {
    margin-top: 0;
}
/* contain the float so a short description can't collide with the next section */
.research-area-text {
    display: flow-root;
}
.research-area-text > :first-child {
    margin-top: 0rem;
}
/* pull the text up so the visible top of the first line meets the image top:
   font half-leading (~2.9px) + ascent-to-cap gap (~5px) at 19.2px font ≈ 0.35em */
.research-area-text > img + p {
    margin-top: -0.2em;
}
.research-area-text img {
    float: left;
    width: 12rem;
    height: auto;
    border-radius: 8px;
    margin: 0 1rem 0.1rem 0;
}
/* Very narrow screens: stack the image above the text. */
@media screen and (max-width: 30rem) {
    .research-area-text img { float: none; margin: 0 0 0rem 0; }
}

/* Teaching overview & course pages */
.intro {
    margin-bottom: 2rem;
}
.course-meta {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}
.course-lecturers,
.course-links {
    margin-bottom: 1rem;
}
.course-body {
    line-height: 1.6;
}

/* Teaching overview - compact semester grouping */
.course-overview {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}
.course-overview td {
    padding: 0.3rem 0;
    vertical-align: bottom;
}
.course-overview td.type {
    width: 8rem;
    text-transform: uppercase;
    font-size: 0.85em;
}
.course-overview td a {
    font-weight: 500;
}

/* Homepage news section */
/*h1 { margin-bottom: 1rem; }*/
h1 { font-size: 1.6rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.2rem; }
main { font-size: 1.0rem; }

.home-news h3 {
    margin: 0rem 0 0 0;
}
.home-news p {
    margin: 0.5rem 0 0 0;
    padding: 0.5rem 0 0 0;
}
.news-item {
    padding: 0.75rem 0;
}
.news-item .pub_date {
    font-size: 0.85rem;
    float: left;
}

/* === Talk List Page === */
.talk-item {
    margin-bottom: 0.4rem;
}
.talk-item h2 {
    margin-bottom: 0.3rem;
}
.talk-speaker-list {
    font-size: 1.05rem;
    color: var(--color-text);
    margin: 0.2rem 0 0.3rem 0;
    font-weight: 500;
}
.talk-meta {
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.6;
}

/* Talk abstract — hidden by default, shown on expand */
.talk-item .abstract {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    padding: 0 .5em;
    transition: max-height 200ms ease-out,
                opacity 200ms ease-out,
                padding 200ms ease-out;
}
.talk-item .publication-files:has(.pub-details-abstract[open]) ~ .abstract {
    max-height: 10000px;
    opacity: 1;
    padding: .5em;
}

/* ── Thesis Pages ── */
.thesis-list-page h2 {
    margin-top: 2rem;
}

.thesis-item {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.thesis-title {
    font-weight: bold;
}

.thesis-detail h1 {
    margin-bottom: 0.5rem;
}

.thesis-meta p {
    margin: 0.3rem 0;
}

.thesis-body {
    margin-top: 1.5rem;
    line-height: 1.6;
}

/* ── Recent Theses (Teaching Overview) ── */
.recent-theses {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.recent-theses .thesis-item {
    padding-left: 1em;
    border-left: 2px solid var(--color-secondary);
    margin-bottom: 0; /* spacing comes from .recent-theses gap */
}

address {
    font-style: normal;
}
