/* =========================================================
   mathopo.ca — style v3
   Minimal and typographic. One image (a 3D fractal, home page);
   the logo is the lemniscate |z^3 - 1| = 1.
   Used by templates/base-v3.html  (python3 build.py v3).
   Same class names as style-v2.css, so the applications,
   seminars and research tables work unchanged.
   ========================================================= */

:root {
  --ink: #1d2b3a;          /* text, headings */
  --ink-2: #47576a;        /* secondary text */
  --muted: #6b7a86;        /* captions, meta */
  --paper: #ffffff;        /* page */
  --surface: #f4f7f5;      /* opened rows, code, quiet panels */
  --rule: #dde4e0;         /* hairlines */
  --accent: #0b7a57;       /* links, buttons, the lemniscate (UQTR green) */
  --accent-dark: #085e42;
  --accent-tint: #e6f2ec;

  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;

  --measure: 40em;         /* longest line of text, about 75 characters */
  --page: 72rem;           /* header, hero, content and footer share this width */
  --gutter: clamp(1.1rem, 4vw, 2rem);
  --header-h: 64px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.65;
  font-optical-sizing: auto;
}
img, svg, video, canvas { max-width: 100%; }
img { height: auto; }
[hidden] { display: none !important; }
[id] { scroll-margin-top: calc(var(--header-h) + 16px); }

/* ---------- Headings and text ---------- */
h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -0.005em;
}
/* h1 = the page title: one size on every page (the home page hero has its own) */
h1 { font-size: 1.65rem; margin: 0.4rem 0 0.8rem; }
h2 { font-size: 1.65rem; margin: 2.6rem 0 0.8rem; }
h3 { font-size: 1.3rem;  margin: 2.2rem 0 0.6rem; }
h4 { font-size: 1.1rem;  margin: 1.6rem 0 0.4rem; }
.centering > article:first-of-type > h1:first-child,
.centering > article:first-of-type > h2:first-child,
.centering > h1:first-child,
.centering > h2:first-child { margin-top: 0.4rem; }

p, li { font-size: inherit; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.3em; margin: 0 0 1em; }
li { margin: 0.2em 0; }
li::marker { color: var(--accent); }
strong { font-weight: 600; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: rgba(11, 122, 87, 0.35);
}
a:hover { color: var(--accent-dark); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

figure { margin: 1.5rem 0; }
figcaption { font-size: 0.92rem; color: var(--muted); margin-top: 0.4rem; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }

code, kbd, pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.9em; }
kbd {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 6px;
}

table { font-family: var(--sans); font-size: 1rem; }
button, input, select, textarea { font-family: var(--sans); }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 2000;
  background: var(--ink);
  color: #fff;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  font-family: var(--sans);
}
.skip-link:focus { top: 0.6rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
}
.site-header-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter);
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.site-name {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.12rem;
  white-space: nowrap;
}
.site-name:hover { color: var(--ink); }
.site-name .mark { width: 30px; height: 28px; flex: none; }
.mark .lemn-main { fill: none; stroke: var(--accent); stroke-width: 20; stroke-linejoin: round; }

.site-nav { display: flex; gap: 0.2rem; margin-left: auto; }
.site-nav a, .site-lang a { text-decoration: none; }
.site-nav a {
  color: var(--ink-2);
  font-size: 1rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
}
.site-nav a:hover { color: var(--ink); background: var(--surface); }
.site-nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--accent);
  border-radius: 0;
}

.site-lang {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 2px;
  font-size: 0.85rem;
  font-weight: 600;
}
.site-lang a { color: var(--muted); padding: 0.15rem 0.6rem; border-radius: 999px; }
.site-lang a:hover { color: var(--ink); }
.site-lang a[aria-current="true"] { background: var(--ink); color: #fff; }

/* ---------- Page body ---------- */
main { flex: 1 0 auto; }

.centering,
.centering-wide {
  margin: 0 auto;
  padding: 2.4rem var(--gutter) 4.5rem;
}
.centering { max-width: var(--page); }
.centering > * { max-width: 56rem; }               /* tables, cards, apps */
.centering p,
.centering > article > ul,
.centering > article > ol,
.centering > ul { max-width: var(--measure); }       /* lines of text */
.centering-wide { max-width: 84rem; }
/* research page (tables_larges: true): tables use the whole width of the page, text keeps its line length */
.tables-larges .centering > * { max-width: none; }

article + article { margin-top: 0.5rem; }
/* app pages (wide: true): header and footer follow the wider column */
.is-wide .site-header-inner,
.is-wide .site-footer-inner { max-width: 84rem; }

/* ---------- Home: hero ----------
   The text sits on the page column; the 3D fractal runs to the right edge
   of the window.  Columns: margin | text | gap | image | margin. */
.hero {
  --hero-text: 31rem;
  --hero-gap: clamp(2rem, 4vw, 4rem);
  display: grid;
  grid-template-columns:
    [full-start] minmax(var(--gutter), 1fr)
    [text-start] minmax(0, var(--hero-text)) [text-end]
    var(--hero-gap)
    [img-start] minmax(0, calc(var(--page) - 2 * var(--gutter) - var(--hero-text) - var(--hero-gap)))
    minmax(0, 1fr) [full-end];
  align-items: center;
  padding: clamp(1.5rem, 4vw, 3rem) 0 1rem;
}
.hero-text { grid-column: text-start / text-end; padding: 1rem 0; }
.hero h1 {
  font-size: clamp(2.4rem, 1.5rem + 3vw, 3.7rem);
  line-height: 1.04;
  letter-spacing: -0.015em;
  margin: 0 0 1rem;
}
.hero-role {
  font-family: var(--sans);
  font-size: 1.15rem;
  line-height: 1.45;
  color: var(--ink-2);
  margin: 0 0 1.3rem;
}
.hero-lede { font-size: 1.2rem; line-height: 1.55; margin: 0 0 1.6rem; }
.hero-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.4rem; font-family: var(--sans); }
.hero-link { font-weight: 600; }

.hero-figure { grid-column: img-start / full-end; margin: 0; }
.hero-figure img {
  display: block;
  width: 100%;
  height: clamp(340px, 40vw, 600px);
  object-fit: cover;
  object-position: 55% 35%;
  border-radius: 10px 0 0 10px;
  background: #0d1a0f;
}
.hero-figure figcaption { padding: 0 var(--gutter) 0 0; margin-top: 0.6rem; }

/* The one animation of the site: the fractal fades in once. */
@media (prefers-reduced-motion: no-preference) {
  .hero-figure img { animation: hero-in 1.1s cubic-bezier(.2, .7, .2, 1) both; }
}
@keyframes hero-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* Home: contact list and photo */
.contact-list { list-style: none; padding: 0; font-family: var(--sans); }
.contact-list li { display: flex; gap: 0.7rem; align-items: baseline; }
.contact-list li > span { width: 1.1em; color: var(--accent); text-align: center; flex: none; }
#PhotoDePresentation { max-width: 34rem; }
#PhotoDePresentation img { display: block; border-radius: 6px; }

/* ---------- Footer ---------- */
.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--muted);
}
.site-footer-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 1.8rem var(--gutter) 2.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 3rem;
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--ink-2); }
.site-updated { margin-left: auto !important; align-self: flex-end; }

/* ---------- Buttons (shared with the apps) ---------- */
.rd-bouton {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  font-family: var(--sans);
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
}
.rd-bouton:hover { background: var(--accent-dark); color: #fff; }

/* ---------- Seminars ---------- */
details > summary { cursor: pointer; }
.centering details > summary { font-family: var(--serif); }
.seminar-item {
  margin: 1.25rem 0;
  padding: 1rem 1.2rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
}
.seminar-date { margin-bottom: .25rem; font-family: var(--sans); color: var(--muted); }
.seminar-title { font-size: 1.15rem; font-weight: 600; margin: .25rem 0; }
.seminar-speaker { font-style: italic; margin: .25rem 0 .5rem; }
.seminar-abstract { margin: .5rem 0 1rem; }

.seminar-archive {
  margin: 1rem 0 2rem;
  padding: 1rem 1.2rem;
  border-left: 3px solid var(--accent);
  background: var(--surface);
}
.seminar-archive h2 { margin: 0 0 .5rem; font-size: 1.2rem; }
.seminar-archive ul { margin: 0; padding-left: 1.25rem; }

.seminars-table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
}
.seminars-table th {
  text-align: left;
  font-weight: 600;
  padding: 0.5em 0.75em;
  border-bottom: 1px solid var(--ink);
}
/* the build writes a grey/white background on every other row: keep it plain */
.seminar-row { background: transparent !important; }
.seminar-row td { border-bottom: 1px solid var(--rule) !important; }
.seminar-row:hover { background: var(--surface) !important; }
.seminar-row.seminar-row-open,
.seminar-row-open { background: var(--accent-tint) !important; }
.seminar-detail td { padding: 0; background: var(--surface); }
.seminar-detail td > div { background: var(--surface) !important; font-family: var(--serif); font-size: 1.05rem; }
.seminar-detail iframe { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; border-radius: 6px; }

.video-wrap { position: relative; width: 100%; padding-top: 56.25%; }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 8px; }

/* ---------- Publications & students (research page) ---------- */
.dd-section { margin: 2.4rem 0 0.8rem; }
/* closed sections (Divers starts with all of them closed): a compact list, one line each */
details.dd-section:not([open]) { margin: 0; padding: 0.75rem 0; border-bottom: 1px solid var(--rule); }
details.dd-section:not([open]) > .dd-summary { margin: 0; }
.dd-summary {
  display: list-item;
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}
.dd-summary::marker { color: var(--accent); }
.dd-count {
  display: inline-block;
  min-width: 1.7em;
  padding: 0 0.45em;
  margin-left: 0.25em;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent-dark);
  font-family: var(--sans);
  font-size: 0.72em;
  font-weight: 600;
  text-align: center;
  vertical-align: 0.15em;
}
.dd-intro { max-width: var(--measure); margin: 0 0 1rem; }
.misc-intro { max-width: var(--measure); }
.dd-tout-ouvrir {
  padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--accent);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.dd-tout-ouvrir:hover { color: var(--accent-dark); }
.dd-after { max-width: var(--measure); margin: 1rem 0 0; font-size: 0.95rem; color: var(--ink-2); }
.dd-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 0 0 0.5rem;
  font-family: var(--sans);
  font-size: 0.92rem;
  color: var(--muted);
}
.dd-expand {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.12rem 0.75rem;
  cursor: pointer;
}
.dd-expand:hover { border-color: var(--accent); }

.dd-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.dd-pubs th:nth-child(1) { width: 52%; }
.dd-pubs th:nth-child(2) { width: 28%; }
.dd-pubs th:nth-child(4) { width: 4.5rem; }
#PubArticles .dd-pubs th:nth-child(1) { width: 46%; }
#PubArticles .dd-pubs th:nth-child(2) { width: 24%; }
.dd-pubs .dd-c3 { font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
/* seminars: title, speaker, institution, date */
.dd-seminars th:nth-child(1) { width: 50%; }
.dd-seminars th:nth-child(4) { width: 5.5rem; }
.dd-seminars .dd-c3 { font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.dd-students th:nth-child(1) { width: 14%; }
.dd-students th:nth-child(2) { width: 24%; }
.dd-table thead th {
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
  padding: 0.4em 0.75em;
  border-bottom: 1px solid var(--ink);
}
.dd-table td { padding: 0.65em 0.75em; border-bottom: 1px solid var(--rule); vertical-align: top; line-height: 1.45; }
.dd-row { cursor: pointer; }
.dd-row:hover { background: var(--surface); }
.dd-row.seminar-row-open { background: var(--accent-tint); }
.dd-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.dd-row .dd-c0 { font-family: var(--serif); font-size: 1.05rem; font-weight: 600; color: var(--ink); }
.dd-students .dd-row .dd-c0 { font-family: var(--sans); font-size: 1rem; }
.dd-row .dd-c0::before {
  content: "";
  display: inline-block;
  width: 0.45em;
  height: 0.45em;
  margin: 0 0.55em 0.12em 0;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
  transition: transform .15s;
}
.dd-row.seminar-row-open .dd-c0::before { transform: rotate(45deg); }
@media (prefers-reduced-motion: reduce) { .dd-row .dd-c0::before { transition: none; } }

.dd-group th {
  text-align: left;
  padding: 1.3em 0.75em 0.35em;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent);
  border-bottom: 1px solid var(--rule);
}
.dd-detail td { background: var(--surface); padding: 0.9em 1.1em 1.1em 2.05em; }
.dd-body { font-family: var(--serif); font-size: 1.02rem; line-height: 1.6; }
.dd-body p { margin: 0 0 0.7em; max-width: none; }
.dd-body p:last-child { margin-bottom: 0; }
.dd-cite { color: var(--ink-2); }
.dd-note, .dd-muted { color: var(--muted); font-style: italic; }
.dd-links { display: flex; flex-wrap: wrap; gap: 0.5rem; font-family: var(--sans); }
.dd-link {
  display: inline-block;
  padding: 0.1rem 0.7rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}
.dd-link:hover { background: var(--accent); color: #fff; }
.dd-facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1.2rem; margin: 0 0 0.7em; }
.dd-facts dt { font-family: var(--sans); font-weight: 600; color: var(--ink-2); }
.dd-facts dd { margin: 0; }

/* ---------- Applications (same rules as style-v2) ---------- */
.subtitle { margin-top: 0; margin-bottom: 1rem; color: var(--ink-2); font-size: 1rem; }
.bottomCentering { margin-bottom: 2rem; }

.centering-wide, .is-wide .centering { font-family: var(--sans); font-size: 1.05rem; }
.centering-wide h1, .centering-wide h2 { font-family: var(--serif); }

.mr-panel {
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  background: #fff;
}
.mr-panel h2 { margin-top: 0; font-size: 1.25rem; }
.mr-controls-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.8rem; }
.mr-control {
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  background: #fff;
  display: grid;
  gap: 0.35rem;
}
.mr-control-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 1rem; }
.mr-control-head output { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 600; }
input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }
input[type="number"] {
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 1px solid #c9d2cd;
  border-radius: 6px;
  font-size: 0.93rem;
}
input[type="number"]:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.formula { font-family: var(--serif); color: var(--ink); font-size: 1rem; }
.mr-sim-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.mr-sim-head h2 { margin-bottom: 0; }
#playButton { padding: 0.45rem 1rem; font-size: 0.93rem; }   /* colours: see "Buttons of the in-page tools" */
#simInfo, #chartMeta { margin: 0 0 0.6rem; color: var(--muted); font-size: 0.88rem; }
.mr-viz-grid { display: grid; grid-template-columns: 1fr 1.6fr; gap: 1rem; }
.mr-viz-card { border: 1px solid var(--rule); border-radius: 8px; padding: 0.7rem; background: #fff; }
.mr-viz-card h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
#springScene { width: 100%; height: 440px; border: 1px solid var(--rule); border-radius: 8px; background: #fff; }
.mr-ceiling { fill: var(--ink-2); }
.mr-spring { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.mr-mass { fill: var(--accent); stroke: var(--accent-dark); stroke-width: 3; }
#chart { display: block; width: 100%; height: 400px; border: 1px solid var(--rule); border-radius: 8px; background: #fff; }
@media (max-width: 860px) {
  .mr-viz-grid { grid-template-columns: 1fr; }
  #springScene { height: 360px; }
  #chart { height: 320px; }
}

.level-full-width { grid-column: 1 / -1; margin-top: 10px; }
#level-slider { width: 100%; margin: 10px 0; }
.lem-plots { display: flex; flex-direction: row; justify-content: center; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.lem-plot-block { flex: 0 1 auto; text-align: center; }
canvas { height: auto; }

/* ---------- Buttons of the in-page tools (spring, lemniscates, Julia, IFS generator) ----------
   The site's two button styles: white with a hairline, like "Mode d'emploi" and "Plein écran",
   or green for the main action. */
.ifs-btn, .je-btn-action, .ifs-modal-close, .je-modal-close {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  font: 600 0.88rem/1.3 var(--sans);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .12s, border-color .12s, color .12s;
}
.ifs-btn:hover, .je-btn-action:hover, .ifs-modal-close:hover, .je-modal-close:hover {
  border-color: var(--accent); color: var(--accent-dark);
}
.ifs-btn:active, .je-btn-action:active { background: var(--accent-tint); }
.ifs-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.ifs-btn-primary, .ifs-btn-success, #playButton, .play-style-btn {
  font-family: var(--sans);
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
}
.ifs-btn-primary:hover, .ifs-btn-success:hover, #playButton:hover, .play-style-btn:hover {
  color: #fff; background: var(--accent-dark); border-color: var(--accent-dark);
}
.ifs-btn-primary:active, .ifs-btn-success:active { background: var(--accent-dark); }
.play-style-btn { padding: 0.45rem 1rem; font-size: 0.93rem; }
:is(.ifs-btn, .je-btn-action, #playButton, .play-style-btn):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* text fields and lists, same look as the number fields */
.mr-control input[type="text"], .je-res-select {
  width: 100%;
  padding: 0.35rem 0.5rem;
  font: 0.93rem/1.3 var(--sans);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid #c9d2cd;
  border-radius: 6px;
}
.mr-control input[type="text"]:focus, .je-res-select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.lem-actions { margin-top: 0.9rem; text-align: right; }
.lem-plot-title { margin-top: 0.4rem; font-family: var(--sans); font-size: 0.93rem; color: var(--ink-2); }
.lem-legende { font-family: var(--sans); font-size: 0.95rem; color: var(--ink-2); }

/* ---------- Julia set explorer (julia-explorer.html) ---------- */
.je-app { max-width: 1100px; margin: 0 auto; }
.je-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; margin-bottom: 0.9rem; }
.je-controls-label { font-weight: 600; white-space: nowrap; }
.je-controls .je-num { width: 5.5rem; }
.je-controls .je-range { width: 180px; }
.je-clabel {
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  white-space: nowrap;
}
.je-panels { display: flex; gap: 1rem; }
.je-panel { flex: 1; min-width: 0; }
.je-panel-header, .je-panel > .je-panel-title {
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  margin-bottom: 0.35rem; min-height: 1.9rem;
}
.je-panel-title { font-size: 0.93rem; font-weight: 600; color: var(--ink-2); }
.je-panel-header .je-res-select { width: auto; padding: 0.2rem 0.4rem; font-size: 0.85rem; cursor: pointer; }
.je-btn-action { padding: 0.2rem 0.6rem; font-size: 0.85rem; }
.je-canvas-wrap { width: 100%; aspect-ratio: 1 / 1; }
.je-canvas-wrap canvas {
  display: block; width: 100%; height: 100%; cursor: crosshair;
  image-rendering: pixelated; image-rendering: crisp-edges;
  border: 1px solid var(--rule); border-radius: 6px;
}
@media (max-width: 640px) { .je-panels { flex-direction: column; } }

/* ---------- IFS fractal generator, advanced version (ifs-fractales.html) ---------- */
.ifs-app-grid { display: grid; grid-template-columns: 420px 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) {
  .ifs-app-grid { grid-template-columns: 1fr; }
  .ifs-col-canvas { order: -1; }
  .ifs-col-controls { order: 1; }
}
.ifs-btn-sm { padding: 0.15rem 0.5rem; font-size: 0.8rem; }
.ifs-btn-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ifs-res-row { display: flex; align-items: center; gap: 8px; margin: 6px 0 4px; flex-wrap: wrap; }
.ifs-res-row label { font-size: 0.9rem; color: var(--ink-2); white-space: nowrap; }
.ifs-res-row input[type="number"] { width: 90px; padding: 0.25rem 0.45rem; font-size: 0.9rem; }
.ifs-hint { font-size: 0.85rem; color: var(--muted); line-height: 1.4; margin: 4px 0; }
.ifs-hint-bar { margin: 0; }
.ifs-iter-label { font-size: 0.95rem; font-weight: 700; color: var(--accent-dark); margin: 8px 0 0; }
.ifs-status { font-size: 0.85rem; color: var(--muted); min-height: 15px; margin: 2px 0 0; }
.ifs-computing { font-size: 0.85rem; font-weight: 700; color: var(--accent-dark); display: none; animation: ifs-clignote 0.9s ease-in-out infinite; }
@keyframes ifs-clignote { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .ifs-computing { animation: none; } }
.ifs-table-wrap { border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; margin-top: 6px; }
.ifs-tf-header, .ifs-tf-row { display: grid; grid-template-columns: 28px repeat(5, 1fr) 58px; align-items: center; }
.ifs-tf-header {
  background: var(--surface); border-bottom: 1px solid var(--rule); padding: 4px 5px;
  font-size: 0.8rem; font-weight: 700; color: var(--ink-2); text-align: center;
}
.ifs-tf-header span:first-child { text-align: right; }
.ifs-tf-scroll { max-height: 210px; overflow-y: auto; }
.ifs-tf-row { padding: 2px 5px; border-bottom: 1px solid var(--rule); }
.ifs-tf-row:last-child { border-bottom: none; }
.ifs-tf-row:hover { background: var(--surface); }
.ifs-tf-num { font-size: 0.8rem; font-weight: 700; color: var(--muted); text-align: right; padding-right: 4px; }
.ifs-tf-row input {
  width: 100%; min-width: 0; padding: 2px 4px; text-align: right;
  font: 0.85rem/1.3 var(--sans); font-variant-numeric: tabular-nums; color: var(--ink);
  border: 1px solid var(--rule); border-radius: 4px;
}
.ifs-tf-row input:focus { border-color: var(--accent); outline: none; }
.ifs-btn-del {
  margin-left: 4px; padding: 2px 6px; font: 600 0.78rem/1.3 var(--sans);
  color: #b42318; background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; cursor: pointer;
}
.ifs-btn-del:hover { color: #fff; background: #b42318; border-color: #b42318; }
.ifs-canvas-frame { display: block; overflow: hidden; line-height: 0; border: 1px solid var(--rule); border-radius: 6px; }
#ifs-preview-canvas, #ifs-modal-canvas { display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
#ifs-preview-canvas { width: 100%; height: auto; }

/* full-size image windows (IFS generator, Julia explorer) */
.ifs-modal-overlay, .je-modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 9000;
  align-items: center; justify-content: center;
  background: rgba(29, 43, 58, 0.7);
}
.ifs-modal-overlay.open, .je-modal-overlay.open { display: flex; }
.ifs-modal {
  display: flex; flex-direction: column; overflow: hidden;
  width: 96vw; height: 93vh; background: var(--paper); border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35); font-family: var(--sans);
}
.ifs-modal-header {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex-shrink: 0;
  padding: 8px 12px; border-bottom: 1px solid var(--rule); color: var(--ink);
}
.ifs-modal-title { font: 600 1.05rem/1.3 var(--serif); white-space: nowrap; }
.ifs-zoom-bar { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.ifs-zoom-pct { min-width: 46px; font-size: 0.95rem; font-weight: 700; color: var(--accent-dark); font-variant-numeric: tabular-nums; }
.ifs-modal-close { margin-left: auto; padding: 0.2rem 0.6rem; font-size: 1rem; line-height: 1.2; flex-shrink: 0; }
.ifs-modal-body { flex: 1; overflow: auto; background: var(--surface); }
.ifs-modal-footer { flex-shrink: 0; padding: 5px 12px; font-size: 0.85rem; color: var(--muted); border-top: 1px solid var(--rule); }
.je-modal-box {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  max-width: 96vw; max-height: 92vh; background: var(--paper); border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.je-modal-close { position: absolute; top: 8px; right: 8px; z-index: 1; padding: 0.2rem 0.6rem; font-size: 1rem; line-height: 1.2; }
.je-modal-scroll { overflow: auto; flex: 1; }
.je-modal-img { display: block; image-rendering: pixelated; image-rendering: crisp-edges; }

.rd-cadre {
  position: relative;
  width: 100%;
  height: min(78vh, 840px);
  margin: 1rem 0 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.rd-cadre iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.rd-actions { margin: 0.75rem 0 0; }
.rd-credit { color: var(--muted); font-size: 0.95rem; }
.retour-cours { margin: 0; font-size: 0.95rem; font-family: var(--sans); }
/* ---------- Application pages: the app is embedded in the page ----------
   (riemann-darboux, rearrangements, convergence-uniforme; script: app-integree.js)
   A thin bar holds "Mode d'emploi", which slides open, and "Plein écran".
   .app-cadre.ecran: the app fills the rest of the screen;
   .app-cadre.contenu: the app scrolls with the page and sets its own height. */
.app-barre {
  position: relative;
  margin: 1.1rem 0 1rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
}
.app-aide > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.55rem 0.2rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  list-style: none;
}
.app-aide > summary::-webkit-details-marker { display: none; }
.app-aide > summary::before {
  content: "";
  width: 0.45em;
  height: 0.45em;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
  transition: transform .2s;
}
.app-aide[open] > summary::before { transform: rotate(45deg); }
.app-aide > summary:hover { color: var(--accent-dark); }
.app-aide-contenu { overflow: hidden; }
.app-aide-contenu > * { max-width: var(--measure); }
.app-aide-contenu > :first-child { margin-top: 0.2rem; }
.app-aide-contenu > :last-child { margin-bottom: 1rem; }
.app-plein-ecran {
  position: absolute;
  top: 0.3rem;
  right: 0;
  padding: 0.3rem 0.75rem;
  font: 600 0.95rem/1.3 var(--sans);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
  cursor: pointer;
}
.app-plein-ecran:hover { border-color: var(--accent); color: var(--accent-dark); }
.app-cadre iframe { display: block; width: 100%; border: 0; background: var(--paper); }
.app-cadre.ecran iframe {
  height: 600px;
  height: max(34rem, calc(100vh - 18.75rem));
  height: max(34rem, calc(100svh - 18.75rem));
}
.app-cadre.contenu iframe { height: 1400px; }      /* until the app sends its height */
/* a short tip in the bar instead of "Mode d'emploi" (Verdelune) */
.app-astuce { margin: 0; padding: 0.55rem 16rem 0.55rem 0.2rem; font-size: 0.95rem; color: var(--ink-2); }
/* several buttons on the right of the bar (Verdelune: Sound, Full screen) */
.app-boutons { position: absolute; top: 0.3rem; right: 0; display: flex; gap: 0.4rem; }
.app-boutons .app-plein-ecran { position: static; }
.app-son {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.75rem;
  font: 600 0.95rem/1.3 var(--sans); color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule); border-radius: 6px; cursor: pointer;
}
.app-son:hover { border-color: var(--accent); color: var(--accent-dark); }
.app-son svg { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.app-son .son-off, .app-son.coupe .son-on { display: none; }
.app-son.coupe .son-off { display: inline; }
.app-son.coupe { color: var(--ink-2); background: var(--surface); }
/* "More details" below the app (Verdelune): same thin bar as above the app */
.app-plus { margin-top: 1.2rem; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); font-family: var(--sans); }
.app-plus .app-aide-contenu > * { max-width: none; }
.app-plus .app-aide-contenu > p, .app-plus .app-aide-contenu > h3 { max-width: var(--measure); }
.app-plus .app-aide-contenu > h3 { margin-top: 2rem; }
/* Verdelune on a touch screen alone: the game is loaded on request */
.vl-tactile {
  display: grid; place-items: center; align-content: center; gap: 1rem;
  min-height: 16rem; padding: 2rem 1.5rem; text-align: center;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 8px;
}
.vl-tactile[hidden] { display: none; }
.vl-tactile p { margin: 0; max-width: 30rem; }
@media (max-width: 600px) {
  /* phones: the tip on full width, the full-screen button under it */
  .app-astuce { padding-right: 0.2rem; }
  .app-astuce + .app-boutons { position: static; margin: 0 0 0.6rem; }
}
@media (max-width: 700px) {
  .app-cadre.ecran iframe { height: calc(100vh - var(--header-h) - 1rem); height: calc(100svh - var(--header-h) - 1rem); }
}
.retour-cours + h1,
.retour-cours + h2 { margin-top: 8px; }
.lang-switch { float: right; font-family: var(--sans); font-size: 0.95rem; }

mjx-container[jax="CHTML"][display="true"] { overflow-x: auto; overflow-y: hidden; max-width: 100%; padding-bottom: 6px; }
mjx-container { max-width: 100%; }

/* ---------- Short text blocks (home, research, teaching) ---------- */
/* "Background" list on the home page: the date or degree in a left column */
.cv-list { list-style: none; padding: 0; }
.cv-list li { position: relative; padding-left: 8.5rem; margin: 0 0 0.7rem; }
.cv-list li > strong:first-child {
  position: absolute;
  left: 0;
  width: 8rem;
  font-family: var(--sans);
  font-weight: 600;
  color: var(--accent);
}
/* "On this page" line and short hints */
.on-this-page { font-family: var(--sans); font-size: 0.98rem; color: var(--muted); }

/* Course lists (teaching page) */
.compact-table { width: 100%; border-collapse: collapse; margin: 0.4rem 0 1rem; }
.compact-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
  padding: 0.4em 0.75em;
  border-bottom: 1px solid var(--ink);
}
.compact-table td { padding: 0.45em 0.75em; vertical-align: top; line-height: 1.4; }
.compact-table tr.new-term td { border-top: 1px solid var(--rule); }
.compact-table tbody tr:first-child td { border-top: 0; }
.compact-table td:first-child { white-space: nowrap; color: var(--ink-2); width: 9.5rem; }
.compact-table th:last-child, .compact-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; width: 5.5rem; }
.compact-table .course-link { white-space: nowrap; width: 8rem; }

@media (max-width: 640px) {
  .cv-list li { padding-left: 0; }
  .cv-list li > strong:first-child { position: static; display: block; width: auto; }
  .compact-table td:first-child { width: auto; white-space: normal; }
  .compact-table th:last-child, .compact-table td:last-child { width: auto; }
  .compact-table .course-link { width: auto; }
  .compact-table th.course-link { white-space: normal; }
  .compact-table th, .compact-table td { padding-left: 0.35em; padding-right: 0.35em; }
  .compact-table th { font-size: 0.82rem; hyphens: auto; }
}

/* ---------- Projects (Miscellaneous page) ----------
   Rows built by build.py from content/data/projects.yml. */
.dd-projects th:nth-child(1) { width: 62%; }
.dd-projects th:nth-child(2) { width: 22%; }
.dd-projects .dd-row td { vertical-align: middle; }
.dd-proj { display: flex; align-items: center; gap: 0.9rem; }
/* the arrow moves inside the flex box, before the picture */
.dd-projects .dd-row .dd-c0::before { content: none; }
.dd-proj::before {
  content: "";
  flex: none;
  width: 0.45em;
  height: 0.45em;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
  transition: transform .15s;
}
.dd-row.seminar-row-open .dd-proj::before { transform: rotate(45deg); }
.dd-thumb {
  width: 96px;
  height: 54px;
  flex: none;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--rule);
  background: var(--surface);
}
.dd-projects .dd-detail td { padding: 1.1em 1.1em 1.3em; }

.misc-game {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1.4rem;
  align-items: center;
}
.misc-game img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; border: 1px solid var(--rule); }
.misc-game p { margin: 0 0 0.9rem; }
.misc-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.2rem; font-family: var(--sans); }
.misc-link { font-weight: 600; }
.misc-gallery { columns: 2 260px; column-gap: 14px; margin: 0.8rem 0 0.2rem; }
.misc-gallery figure { break-inside: avoid; margin: 0 0 14px; }
.misc-gallery img { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--rule); }
@media (max-width: 640px) {
  .misc-game { grid-template-columns: 1fr; }
  .dd-thumb { width: 72px; height: 40px; }
}

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
  .site-header-inner { flex-wrap: wrap; gap: 0 1rem; padding-top: 0.6rem; }
  .site-name { order: 1; }
  .site-lang { order: 2; margin-left: auto; }
  .site-nav {
    order: 3;
    width: 100%;
    margin: 0 calc(-1 * var(--gutter));
    padding: 0.2rem var(--gutter) 0.3rem;
    overflow-x: auto;
    scrollbar-width: none;
    width: calc(100% + 2 * var(--gutter));
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { white-space: nowrap; padding: 0.45rem 0.6rem; }
  :root { --header-h: 104px; }
  /* the header (two lines here) hides when scrolling down, comes back when scrolling up */
  .site-header { transition: transform 0.25s ease; }
  .site-header.header-cache { transform: translateY(-100%); }
}
@media (max-width: 900px) and (prefers-reduced-motion: reduce) { .site-header { transition: none; } }
@media (max-width: 760px) {
  body { font-size: 1.0625rem; }
  .hero { grid-template-columns: [full-start] var(--gutter) [text-start] minmax(0, 1fr) [text-end] var(--gutter) [full-end]; }
  .hero-text { grid-column: text-start / text-end; }
  .hero-figure { grid-column: full-start / full-end; margin-top: 0.5rem; }
  .hero-figure img { height: 44vw; border-radius: 0; }
  .hero-figure figcaption { padding: 0 var(--gutter); }
  .site-updated { margin-left: 0 !important; }
}
@media (max-width: 640px) {
  .dd-table { table-layout: auto; }
  .dd-table th { width: auto !important; }
  .dd-hide-sm { display: none; }
  .dd-tools .dd-hint { display: none; }
  .dd-facts { grid-template-columns: 1fr; }
  .dd-detail td { padding-left: 1em; }
}
