/* mehditmimi.com — home page only.
   Standalone on purpose: css/style.css and js/main.js stay with the courses, so neither can move this page.
   Brand shared with TMIMI Explains (explains/explains.css): the MT logo's pink → violet → blue as a thin "wire",
   dark navy #0f1017, Playfair Display for display type, Inter for text, JetBrains Mono for labels.

   Motion has a reason each time: a slow living aurora that changes colour when a new section takes the stage;
   the portal intro once per visit and the contact outro at the end, like a film's opening and closing; entrances
   as sections scroll in; set pieces (Vivace's logo, the Explains card) when they are well in view; the theme iris;
   light that follows the pointer. The header's pause switch and prefers-reduced-motion stop all of it; ambient
   loops freeze where they are rather than jumping. */

/* ---------- Tokens ---------- */
@property --au1 { syntax: '<color>'; inherits: true; initial-value: transparent; }
@property --au2 { syntax: '<color>'; inherits: true; initial-value: transparent; }
@property --au3 { syntax: '<color>'; inherits: true; initial-value: transparent; }

:root {
  color-scheme: light;
  --bg: #fbfaf7;
  --bg-glass: rgba(251, 250, 247, .78);
  --surface: #ffffff;
  --surface-2: #f4f2ed;
  --ink: #16161f;
  --ink-2: #474756;
  --ink-3: #5c5c6a;
  --rule: #e4e1d9;
  --rule-strong: #cfcbc1;
  /* A border that identifies a control: 3:1 against the page (WCAG 1.4.11). */
  --control: #8f8a7f;
  --accent: #4f46e5;
  --accent-hover: #3730a3;
  --accent-soft: rgba(79, 70, 229, .08);
  --on-ink: #fbfaf7;
  --wire: linear-gradient(90deg, #ff3d8b 0%, #7a5cff 55%, #2f7dff 100%);
  /* Text in the brand gradient: darker stops in light, so each keeps 4.5:1 on the page. */
  --text-grad: linear-gradient(95deg, #d6246e 0%, #6a4cf0 52%, #1f66e0 100%);
  --shadow-sm: 0 1px 2px rgba(22, 22, 31, .04), 0 6px 18px -12px rgba(22, 22, 31, .12);
  --shadow: 0 1px 2px rgba(22, 22, 31, .05), 0 18px 40px -22px rgba(22, 22, 31, .28);
  --shadow-lift: 0 2px 6px rgba(22, 22, 31, .05), 0 28px 56px -26px rgba(74, 52, 190, .38);
  --spot: rgba(122, 92, 255, .09);
  --dot: rgba(22, 22, 31, .075);
  --vignette: transparent;
  --spark: #7a5cff;
  --burst: rgba(122, 92, 255, .7);
  --streak-head: #7a5cff;
  --portrait-shadow: 0 34px 70px -34px rgba(22, 22, 31, .55);

  /* Aurora: three colours per scene, alpha per theme. */
  --s1: 255 61 139; --s2: 122 92 255; --s3: 47 125 255;
  --a1: .15; --a2: .14; --a3: .13;

  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 22px;
  --gutter: clamp(20px, 4vw, 40px);
  --header-h: 72px;
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  /* The intro's streaks, reused by the outro. */
  --ease-streak: cubic-bezier(.55, 0, .85, .35);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1017;
  --bg-glass: rgba(15, 16, 23, .74);
  --surface: #151722;
  --surface-2: #1c1f2d;
  --ink: #ecebf3;
  --ink-2: #b9b9c8;
  --ink-3: #a3a3b5;
  --rule: #242736;
  --rule-strong: #353a4e;
  --control: #6b6f86;
  --accent: #a8a3ff;
  --accent-hover: #c9c6ff;
  --accent-soft: rgba(168, 163, 255, .12);
  --on-ink: #0f1017;
  --text-grad: linear-gradient(95deg, #ff6aa9 0%, #a08bff 52%, #6ea8ff 100%);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 22px -14px rgba(0, 0, 0, .6);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 22px 44px -22px rgba(0, 0, 0, .7);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, .35), 0 30px 64px -26px rgba(122, 92, 255, .42);
  --spot: rgba(168, 163, 255, .11);
  --dot: rgba(255, 255, 255, .055);
  --vignette: rgba(6, 7, 11, .5);
  --spark: #ffffff;
  --burst: rgba(255, 255, 255, .75);
  --streak-head: #ffffff;
  --portrait-shadow: 0 34px 80px -30px rgba(0, 0, 0, .9);
  --a1: .21; --a2: .22; --a3: .21;
}

/* No saved choice: follow the system. Same values as the block above. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0f1017; --bg-glass: rgba(15, 16, 23, .74); --surface: #151722; --surface-2: #1c1f2d;
    --ink: #ecebf3; --ink-2: #b9b9c8; --ink-3: #a3a3b5;
    --rule: #242736; --rule-strong: #353a4e; --control: #6b6f86;
    --accent: #a8a3ff; --accent-hover: #c9c6ff; --accent-soft: rgba(168, 163, 255, .12); --on-ink: #0f1017;
    --text-grad: linear-gradient(95deg, #ff6aa9 0%, #a08bff 52%, #6ea8ff 100%);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 22px -14px rgba(0, 0, 0, .6);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 22px 44px -22px rgba(0, 0, 0, .7);
    --shadow-lift: 0 2px 6px rgba(0, 0, 0, .35), 0 30px 64px -26px rgba(122, 92, 255, .42);
    --spot: rgba(168, 163, 255, .11); --dot: rgba(255, 255, 255, .055); --vignette: rgba(6, 7, 11, .5);
    --spark: #ffffff; --burst: rgba(255, 255, 255, .75); --streak-head: #ffffff;
    --portrait-shadow: 0 34px 80px -30px rgba(0, 0, 0, .9);
    --a1: .21; --a2: .22; --a3: .21;
  }
}

/* Scenes: the aurora takes the colours of the section on stage. Hues and alphas are chosen so that muted text
   (--ink-3) keeps 4.5:1 even at the centre of a blob. */
:root[data-scene="teaching"] { --s1: 122 92 255; --s2: 47 125 255; --s3: 255 61 139; }
:root[data-scene="research"] { --s1: 79 70 229; --s2: 47 125 255; --s3: 122 92 255; }
:root[data-scene="tools"]    { --s1: 47 125 255; --s2: 56 152 236; --s3: 122 92 255; }
:root[data-scene="vivace"]   { --s1: 255 122 26; --s2: 255 61 139; --s3: 13 148 136; }
:root[data-scene="contact"]  { --s1: 255 61 139; --s2: 122 92 255; --s3: 47 125 255; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}
[data-motion="on"] { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font: 400 1rem/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
  overflow-x: clip;
  font-variant-numeric: lining-nums;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { color: var(--accent-hover); }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: rgba(122, 92, 255, .22); }
h1, h2, h3, h4 { text-wrap: balance; }
p { text-wrap: pretty; }

.container { width: min(100% - 2 * var(--gutter), 1200px); margin-inline: auto; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.nowrap { white-space: nowrap; }
.visually-hidden, .icon-btn__label {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip-link {
  position: fixed; left: 12px; top: -80px; z-index: 100;
  padding: 10px 16px; border-radius: 10px;
  background: var(--ink); color: var(--on-ink); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; color: var(--on-ink); }

/* ---------- Aurora (fixed, behind everything) ---------- */
.aurora {
  --au1: rgb(var(--s1) / var(--a1));
  --au2: rgb(var(--s2) / var(--a2));
  --au3: rgb(var(--s3) / var(--a3));
  position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  transition: --au1 2.6s ease, --au2 2.6s ease, --au3 2.6s ease;
}
.aurora::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(130% 95% at 50% 35%, transparent 55%, var(--vignette) 100%);
}
.aurora__blob {
  position: absolute; width: 74vmax; height: 74vmax; border-radius: 50%;
  background: radial-gradient(closest-side, var(--c), transparent 74%);
  animation: 60s ease-in-out infinite alternate paused;
  will-change: transform;
}
.aurora__blob--1 { --c: var(--au1); top: -34vmax; left: -24vmax; animation-name: drift-1; animation-duration: 52s; }
.aurora__blob--2 { --c: var(--au2); top: -10vmax; right: -34vmax; animation-name: drift-2; animation-duration: 64s; }
.aurora__blob--3 { --c: var(--au3); bottom: -44vmax; left: 8vmax; animation-name: drift-3; animation-duration: 58s; }
[data-motion="on"] .aurora__blob { animation-play-state: running; }
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion]) .aurora__blob { animation-play-state: running; }
}
@keyframes drift-1 {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(16vw, 12vh, 0) scale(1.14); }
  100% { transform: translate3d(6vw, 26vh, 0) scale(.94); }
}
@keyframes drift-2 {
  0%   { transform: translate3d(0, 0, 0) scale(1.05); }
  50%  { transform: translate3d(-18vw, 16vh, 0) scale(.92); }
  100% { transform: translate3d(-8vw, -6vh, 0) scale(1.12); }
}
@keyframes drift-3 {
  0%   { transform: translate3d(0, 0, 0) scale(.96); }
  50%  { transform: translate3d(22vw, -14vh, 0) scale(1.1); }
  100% { transform: translate3d(38vw, -4vh, 0) scale(1); }
}
.aurora__grain {
  position: absolute; inset: 0;
  background-image: radial-gradient(var(--dot) 1px, transparent 1.4px);
  background-size: 30px 30px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .35) 60%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .35) 60%, transparent 100%);
}

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 50;
  transition: background-color .35s ease, box-shadow .35s ease;
}
.site-header.is-scrolled, .site-header.is-open {
  background: var(--bg-glass);
  -webkit-backdrop-filter: saturate(1.5) blur(16px);
  backdrop-filter: saturate(1.5) blur(16px);
  box-shadow: 0 1px 0 var(--rule);
}
.site-header__bar { display: flex; align-items: center; gap: 20px; height: var(--header-h); }
/* Reading progress: the brand wire fills as the page scrolls. */
.site-header__wire {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--wire);
  transform-origin: 0 50%; transform: scaleX(var(--progress, 0));
  opacity: 0; transition: opacity .35s ease;
}
.site-header.is-scrolled .site-header__wire { opacity: 1; }

.brand { display: inline-flex; align-items: center; gap: 12px; margin-right: auto; color: var(--ink); text-decoration: none; border-radius: 10px; }
.brand:hover { color: var(--ink); }
.brand img { width: 44px; height: auto; }
.brand__name { font: 600 1.2rem/1 var(--font-display); letter-spacing: -.005em; white-space: nowrap; font-variant-numeric: lining-nums; }

.site-menu { display: flex; align-items: center; gap: 16px; }
.site-nav ul { display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
.site-nav a {
  position: relative; display: inline-flex; align-items: baseline; gap: 8px;
  padding: 10px 12px; border-radius: 999px;
  color: var(--ink-2); font: 500 .94rem/1 var(--font-body); text-decoration: none; white-space: nowrap;
  transition: color .2s ease, background-color .2s ease;
}
.site-nav a:hover { color: var(--ink); background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.site-nav a[aria-current="true"] { color: var(--ink); }
.site-nav a::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px; height: 2px; border-radius: 2px;
  background: var(--wire); transform: scaleX(0); transform-origin: 0 50%;
  transition: transform .45s var(--ease-io);
}
.site-nav a[aria-current="true"]::after { transform: scaleX(1); }
.site-nav__num { display: none; font: 500 .75rem/1 var(--font-mono); letter-spacing: .08em; color: var(--ink-3); }
/* The series is another page: set apart by a hairline, with an arrow. */
.site-nav__page { margin-left: 6px; padding-left: 8px; border-left: 1px solid var(--rule-strong); }
.site-nav__page a { align-items: center; color: var(--ink); }
.site-nav__arrow { width: 14px; height: 14px; flex: none; transition: transform .3s var(--ease-out); }
.site-nav__page a:hover .site-nav__arrow { transform: translateX(3px); }

.site-header__controls { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 999px; border: 1px solid var(--rule-strong);
  background: color-mix(in srgb, var(--surface) 55%, transparent); color: var(--ink);
  cursor: pointer; transition: border-color .2s ease, background-color .2s ease, color .2s ease;
}
.icon-btn:hover { border-color: var(--control); background: var(--surface); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle__sun { display: none; }
:root[data-theme="dark"] .theme-toggle__sun { display: block; }
:root[data-theme="dark"] .theme-toggle__moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle__sun { display: block; }
  :root:not([data-theme]) .theme-toggle__moon { display: none; }
}
/* Pause switch: pause while things move, play once paused (aria-pressed = paused). */
.motion-toggle__play { display: none; }
.motion-toggle[aria-pressed="true"] .motion-toggle__pause { display: none; }
.motion-toggle[aria-pressed="true"] .motion-toggle__play { display: block; }
.motion-toggle svg { width: 16px; height: 16px; }
.menu-toggle { display: none; }
.menu-toggle path { transition: transform .35s var(--ease-io); transform-box: fill-box; transform-origin: center; }
.site-header.is-open .menu-toggle__top { transform: translateY(4px) rotate(45deg); }
.site-header.is-open .menu-toggle__bottom { transform: translateY(-4px) rotate(-45deg); }
/* The switches need script; without it they would do nothing. */
html:not(.js) .site-header__controls { display: none; }

/* Theme change: the new theme opens as an iris from the switch, and a thin gradient ring rides its edge
   (home.js), as the portal ring does in the films. No cross-fade underneath. */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
.iris-ring { position: fixed; inset: 0; z-index: 90; width: 100vw; height: 100vh; pointer-events: none; overflow: visible; view-transition-name: iris-ring; }
.iris-ring circle { fill: none; stroke: url(#brand-g); }
.iris-ring__line { stroke-width: 2; }
.iris-ring__glow { stroke-width: 12; opacity: .22; }
::view-transition-group(iris-ring), ::view-transition-new(iris-ring) { animation: none; }
::view-transition-old(iris-ring) { display: none; }

/* ---------- Buttons and links ---------- */
.btn {
  --h: 52px;
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--h); padding: 0 26px; border-radius: 999px;
  font: 600 .98rem/1 var(--font-body); letter-spacing: .005em; text-decoration: none; white-space: nowrap;
  transition: transform .3s var(--ease-out), box-shadow .3s ease, background-color .3s ease, color .3s ease, border-color .3s ease;
}
.btn svg { width: 18px; height: 18px; flex: none; transition: transform .3s var(--ease-out); }
.btn:hover svg { transform: translateX(3px); }
.btn--primary { background: var(--ink); color: var(--on-ink); box-shadow: 0 12px 30px -16px rgba(122, 92, 255, .8); }
.btn--primary::before {
  content: ""; position: absolute; inset: -2px; z-index: -1; border-radius: inherit;
  background: var(--wire); filter: blur(10px); opacity: 0; transition: opacity .35s ease;
}
.btn--primary:hover { color: var(--on-ink); transform: translateY(-2px); }
.btn--primary:hover::before { opacity: .75; }
.btn--ghost { color: var(--ink); border: 1px solid var(--control); background: color-mix(in srgb, var(--surface) 45%, transparent); }
.btn--ghost:hover { color: var(--ink); border-color: var(--ink-2); background: var(--surface); transform: translateY(-2px); }
.btn--sm { --h: 46px; padding: 0 20px; font-size: .92rem; }

.link-arrow {
  display: inline-flex; align-items: center; gap: 10px; padding-bottom: 6px;
  color: var(--ink); font-weight: 600; text-decoration: none;
  background:
    linear-gradient(90deg, #ff3d8b, #7a5cff 55%, #2f7dff) no-repeat 0 100% / 0 2px,
    linear-gradient(var(--rule-strong), var(--rule-strong)) no-repeat 0 100% / 100% 1px;
  transition: background-size .5s var(--ease-io);
}
.link-arrow:hover { color: var(--ink); background-size: 100% 2px, 100% 1px; }
.link-arrow svg { width: 16px; height: 16px; flex: none; transition: transform .3s var(--ease-out); }
.link-arrow:hover svg { transform: translateX(3px); }

/* ---------- Sections ---------- */
.section { position: relative; padding-block: clamp(88px, 5vw + 60px, 156px); }
.section-head { max-width: 780px; margin-bottom: clamp(40px, 2.5vw + 28px, 64px); }
#tools .section-head { margin-bottom: clamp(32px, 2vw + 20px, 48px); }
.eyebrow {
  display: flex; align-items: center; gap: 12px; margin: 0 0 22px;
  font: 500 .78rem/1 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3);
}
.eyebrow--center { justify-content: center; }
.eyebrow__num { font-weight: 600; color: var(--ink); }
.eyebrow__wire { width: 44px; height: 2px; flex: none; border-radius: 2px; background: var(--wire); transform-origin: 0 50%; }
.section-title {
  margin: 0 0 20px;
  font: 500 clamp(2.4rem, 1.45rem + 3.3vw, 4.25rem)/1.04 var(--font-display);
  letter-spacing: -.022em; font-variant-numeric: lining-nums;
}
.section-title em, .hero__title em {
  font-style: italic; padding-right: .06em;
  background: var(--text-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.section-lede { margin: 0; max-width: 56ch; color: var(--ink-2); font-size: clamp(1.06rem, 1rem + .3vw, 1.22rem); line-height: 1.6; }

/* ---------- Hero ---------- */
.hero {
  position: relative; display: grid; align-items: center;
  min-height: max(660px, 100svh);
  padding: calc(var(--header-h) + 40px) 0 72px;
  overflow: clip;
}
.hero__grid {
  display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
  align-items: center; gap: clamp(32px, 5vw, 88px);
}
.hero__news {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%;
  margin-bottom: 30px; padding: 5px 14px 5px 5px; border-radius: 999px;
  border: 1px solid var(--rule-strong);
  background: color-mix(in srgb, var(--surface) 65%, transparent);
  color: var(--ink-2); font: 500 .88rem/1.25 var(--font-body); text-decoration: none;
  transition: border-color .25s ease, color .25s ease, background-color .25s ease;
}
.hero__news:hover { color: var(--ink); border-color: var(--control); background: var(--surface); }
.hero__news-tag {
  flex: none; padding: 6px 10px 5px; border-radius: 999px;
  background: linear-gradient(90deg, #d6246e, #5b3fe0 55%, #1d5fd6); color: #fff;
  font: 600 .75rem/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase;
}
.hero__news-text { min-width: 0; }
.hero__news-arrow { width: 15px; height: 15px; flex: none; transition: transform .3s var(--ease-out); }
.hero__news:hover .hero__news-arrow { transform: translateX(3px); }
.hero__title {
  position: relative; margin: 0 0 30px; padding-bottom: 24px;
  font: 500 clamp(3.4rem, 1.3rem + 6.6vw, 7.4rem)/.92 var(--font-display);
  letter-spacing: -.035em; font-variant-numeric: lining-nums;
}
/* Two lines whenever the hero has two columns, whatever the width. */
.hero__first, .hero__last { display: block; }
.hero__title::after {
  content: ""; position: absolute; left: .05em; bottom: 0;
  width: min(40%, 250px); height: 3px; border-radius: 3px;
  background: var(--wire); transform-origin: 0 50%;
}
/* Position and institution, verbatim from cv.html (French, so marked lang="fr"), then the roles. */
.hero__cred, .hero__roles { display: flex; flex-wrap: wrap; row-gap: 6px; margin: 0; }
.hero__cred { margin-bottom: 8px; font: 600 1.05rem/1.4 var(--font-body); color: var(--ink); }
.hero__roles { margin-bottom: 20px; font: 500 1rem/1.4 var(--font-body); color: var(--ink-2); }
.hero__cred span + span::before, .hero__roles span + span::before {
  content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 12px; border-radius: 50%;
  vertical-align: .2em; background: var(--wire);
}
.hero__lede { max-width: 34em; margin: 0 0 38px; color: var(--ink-2); font-size: clamp(1.08rem, 1rem + .45vw, 1.28rem); line-height: 1.6; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* The portal */
.hero__visual { display: grid; place-items: center; }
.portal { --px: 0; --py: 0; position: relative; width: min(100%, 460px); aspect-ratio: 1; }
/* Depth that follows the pointer (home.js sets --px/--py from -.5 to .5): the glow drifts most, the portrait least. */
.portal__glow { translate: calc(var(--px) * -40px) calc(var(--py) * -40px); transition: translate 1s var(--ease-out); }
.portal__ring, .portal__burst { translate: calc(var(--px) * 16px) calc(var(--py) * 16px); transition: translate .9s var(--ease-out); }
.portal__img { translate: calc(var(--px) * 7px) calc(var(--py) * 7px); transition: translate .9s var(--ease-out); }
[data-motion="off"] .portal > * { translate: none; }
.portal__glow {
  position: absolute; inset: -16%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(122, 92, 255, .34), rgba(255, 61, 139, .12) 52%, transparent 74%);
}
.portal__img {
  position: absolute; inset: 7.5%; width: 85%; height: 85%;
  border-radius: 50%; object-fit: cover; background: #102040;
  box-shadow: var(--portrait-shadow);
}
.portal__ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.portal__orbit { fill: none; stroke: var(--control); stroke-width: 1; stroke-dasharray: 1.5 7; opacity: .55; }
.portal__stroke {
  fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 100 100; stroke-dashoffset: 0;
  transform: rotate(-90deg); transform-box: fill-box; transform-origin: center;
}
/* A light that travels the ring, slowly: the portal is alive, not busy. */
.portal__spark {
  fill: none; stroke: var(--spark); stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: .1 99.9;
  transform-box: fill-box; transform-origin: center;
  animation: orbit 26s linear infinite paused;
  filter: drop-shadow(0 0 5px rgba(168, 163, 255, .95));
}
[data-motion="on"] .portal__spark { animation-play-state: running; }
@media (prefers-reduced-motion: no-preference) { :root:not([data-motion]) .portal__spark { animation-play-state: running; } }
@keyframes orbit { from { transform: rotate(-90deg); } to { transform: rotate(270deg); } }
/* On the visit that plays the intro, the spark waits for the ring to finish drawing at 12 o'clock. */
.spark-late .portal__spark { animation: orbit 26s linear 2.5s infinite paused, appear .5s ease 2.5s both; }
[data-motion="on"].spark-late .portal__spark { animation-play-state: running; }
@keyframes appear { from { opacity: 0; } }
.portal__streaks {
  position: absolute; inset: 0; pointer-events: none;
  /* Streaks never cross the header: they show from just above the portal. */
  clip-path: inset(-56px -3000px -3000px -3000px);
}
.portal__streaks i {
  position: absolute; left: 50%; top: 50%; width: 36%; height: 2px; margin-top: -1px;
  border-radius: 2px; transform-origin: 0 50%; opacity: 0;
  background: linear-gradient(90deg, var(--streak-head) 0%, var(--c) 20%, transparent 100%);
}
/* Desktop: every streak arrives from the right half-plane (within ±110°), so none crosses the text. */
.portal__streaks i:nth-child(1) { --a: -104deg; --c: #ff3d8b; --d: 0s; }
.portal__streaks i:nth-child(2) { --a: -70deg;  --c: #b04dff; --d: .07s; }
.portal__streaks i:nth-child(3) { --a: -36deg;  --c: #7a5cff; --d: .03s; }
.portal__streaks i:nth-child(4) { --a: -4deg;   --c: #2f7dff; --d: .1s; }
.portal__streaks i:nth-child(5) { --a: 30deg;   --c: #a8a3ff; --d: .05s; }
.portal__streaks i:nth-child(6) { --a: 66deg;   --c: #ff3d8b; --d: .12s; }
.portal__streaks i:nth-child(7) { --a: 100deg;  --c: #5a6bff; --d: .02s; }
.portal__burst {
  position: absolute; inset: 3.6%; border-radius: 50%;
  border: 2px solid var(--burst); opacity: 0; pointer-events: none;
}

/* The intro: once per visit, from first paint (class set in the page head when motion is on).
   Nothing shows before its moment: fill "both" only where the first frame is meant to be hidden. */
/* Streaks converge in the 120 ms before the burst (arrival at 1.08 s minus their offset). */
.intro .portal__streaks i { animation: streak .95s var(--ease-streak) calc(.13s - var(--d)) both; }
.intro .portal__burst { animation: burst 1.2s var(--ease-out) 1.08s forwards; }
.intro .portal__glow { animation: glow 1.8s var(--ease-out) .9s both; }
.intro .portal__stroke { animation: draw 1.5s var(--ease-io) 1s both; }
.intro .portal__img { animation: land 1.4s var(--ease-out) .95s both; }
.intro .portal__orbit { animation: fade-in 1.6s ease 1.4s both; }
.intro .hero__text > * { animation: rise 1s var(--ease-out) both; }
.intro .hero__text > :nth-child(1) { animation-delay: .2s; }
.intro .hero__text > :nth-child(2) { animation-delay: .3s; }
.intro .hero__text > :nth-child(3) { animation-delay: .42s; }
.intro .hero__text > :nth-child(4) { animation-delay: .5s; }
.intro .hero__text > :nth-child(5) { animation-delay: .58s; }
.intro .hero__text > :nth-child(6) { animation-delay: .66s; }
.intro .hero__title::after { animation: wire-draw 1.2s var(--ease-io) 1.15s both; }
@keyframes streak {
  0%   { opacity: 0; transform: rotate(var(--a)) translateX(280%); }
  14%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--a)) translateX(129%); }
}
@keyframes burst { 0% { opacity: .95; transform: scale(1); } 100% { opacity: 0; transform: scale(1.55); } }
@keyframes glow { 0% { opacity: 0; transform: scale(.7); } 35% { opacity: 1; transform: scale(1.08); } 100% { opacity: 1; transform: scale(1); } }
@keyframes draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
/* The portrait is there from the first frame, dark and out of focus, and resolves as the ring ignites. */
@keyframes land {
  from { opacity: 1; transform: scale(1.07); filter: blur(12px) brightness(.3) saturate(.6); }
  to   { opacity: 1; transform: none; filter: none; }
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes wire-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- Cards (courses) ---------- */
.card {
  position: relative; isolation: isolate;
  display: flex; flex-direction: column;
  padding: 28px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--rule);
  box-shadow: var(--shadow-sm);
  transition: transform .35s var(--ease-out), box-shadow .35s ease, border-color .35s ease;
}
/* Light that follows the pointer: a soft glow inside, and the border lit where the pointer is. */
.card::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  background: radial-gradient(520px circle at var(--mx, 50%) var(--my, -30%), var(--spot), transparent 44%);
  opacity: 0; transition: opacity .45s ease; pointer-events: none;
}
.card::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px;
  background: radial-gradient(300px circle at var(--mx, 50%) var(--my, -30%), rgba(255, 61, 139, .95), rgba(122, 92, 255, .8) 34%, rgba(47, 125, 255, .45) 58%, transparent 76%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .45s ease; pointer-events: none;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.card:hover::before, .card:hover::after { opacity: 1; }
/* The title link covers the card, so the whole card is one target and one tab stop. */
.card-link { color: var(--ink); text-decoration: none; }
.card-link:hover { color: var(--ink); }
.card-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
@supports selector(:has(*)) {
  .card-link:focus-visible { outline: none; }
  .card:has(.card-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
}
.card-icon {
  display: inline-grid; place-items: center; width: 46px; height: 46px; flex: none;
  border-radius: 14px; background: var(--accent-soft); color: var(--accent);
  transition: background .35s ease, color .35s ease;
}
.card-icon svg { width: 24px; height: 24px; }
.card:hover .card-icon { background: var(--wire); color: #fff; }
.card-title { margin: 22px 0 6px; font: 600 1.34rem/1.22 var(--font-display); letter-spacing: -.008em; font-variant-numeric: lining-nums; }
.card-sub { margin: 0 0 14px; font: 500 .78rem/1.45 var(--font-mono); color: var(--accent); }
.card-desc { margin: 0 0 26px; color: var(--ink-2); font-size: .96rem; line-height: 1.62; }
.card-cta {
  margin-top: auto; display: inline-flex; align-items: center; gap: 8px;
  color: var(--ink); font-size: .92rem; font-weight: 600;
}
.card-cta svg { width: 16px; height: 16px; transition: transform .3s var(--ease-out); }
.card:hover .card-cta svg { transform: translateX(4px); }

/* ---------- Teaching ---------- */
.courses { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 0; padding: 0; list-style: none; }
.course__top { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.course__meta { font: 500 .76rem/1.35 var(--font-mono); letter-spacing: .01em; color: var(--ink-3); text-align: right; }

/* TMIMI Explains: dark in both themes, like the films */
.explains {
  --spot: rgba(168, 163, 255, .16);
  color: #ecebf3; border-color: #2a2d3c; overflow: hidden;
  background:
    radial-gradient(120% 70% at 0% 0%, rgba(255, 61, 139, .22), transparent 58%),
    radial-gradient(90% 80% at 100% 100%, rgba(47, 125, 255, .26), transparent 60%),
    radial-gradient(70% 60% at 75% 25%, rgba(122, 92, 255, .2), transparent 65%),
    #0f1017;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 22px 50px -26px rgba(15, 16, 23, .8);
}
.explains :focus-visible { outline-color: #a8a3ff; }
.explains__wire {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  height: 30px; margin: 0 0 30px;
}
.explains__wire::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px;
  border-radius: 2px; background: var(--wire); opacity: .85;
}
.explains__pkt {
  position: relative; padding: 6px 9px; border-radius: 7px; white-space: nowrap;
  background: #12141d; border: 1px solid #2a2e3e;
  font: 600 .75rem/1 var(--font-mono); letter-spacing: .01em;
}
.explains__pkt--out { margin-left: 6%; color: #7dd3fc; }
.explains__pkt--out::after { content: " →"; color: #8d93a8; }
.explains__pkt--back { margin-right: 6%; color: #5fd3a0; }
.explains__pkt--back::before { content: "← "; color: #8d93a8; }
.explains__kicker { margin: 0 0 12px; font: 600 .75rem/1 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: #9a9aad; }
.explains__title { margin: 0 0 12px; font: 700 2rem/1.05 var(--font-display); letter-spacing: .01em; font-variant-numeric: lining-nums; }
.explains__title a { color: #ecebf3; text-decoration: none; }
.explains__title a:hover { color: #fff; }
.explains__title em {
  font-style: italic; font-weight: 600; padding-right: .08em;
  background: linear-gradient(90deg, #ff6aa9, #b04dff 38%, #8f7bff 60%, #6ea8ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.explains__tagline { margin: 0 0 10px; font: italic 500 1.12rem/1.4 var(--font-display); color: #ecebf3; }
.explains__desc { margin: 0 0 26px; color: #b9b9c8; font-size: .95rem; line-height: 1.6; }
.explains__links { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; position: relative; z-index: 2; }
.explains__link { display: inline-flex; align-items: center; gap: 8px; color: #c9c6ff; font-size: .92rem; font-weight: 600; text-decoration: none; }
.explains__link:hover { color: #fff; }
.explains__link svg { width: 16px; height: 16px; flex: none; transition: transform .3s var(--ease-out); }
.explains__link:hover svg { transform: translateX(3px); }
.explains__link--yt svg { width: 20px; height: 20px; color: #ff4e45; }
.explains__link--yt:hover svg { transform: none; }
/* Set piece, when the card is well in view: the request goes out, the answer comes back. */
.reveal-ready .explains:not(.is-live) .explains__pkt { opacity: 0; }
.reveal-ready .explains.is-live .explains__pkt--out { animation: pkt-out 1.3s var(--ease-io) .2s both; }
.reveal-ready .explains.is-live .explains__pkt--back { animation: pkt-back 1.3s var(--ease-io) 1s both; }
@keyframes pkt-out { from { opacity: 0; transform: translateX(-40%); } to { opacity: 1; transform: none; } }
@keyframes pkt-back { from { opacity: 0; transform: translateX(40%); } to { opacity: 1; transform: none; } }

/* ---------- Research ---------- */
/* One line of facts, with the hero's gradient dots. Each dot sits in the gap before its item, so a dot that would
   start a wrapped line falls outside the box and is clipped. */
.research-facts { display: flex; flex-wrap: wrap; gap: 4px 30px; overflow: hidden; margin: 22px 0 0; font: 500 1.05rem/1.5 var(--font-body); color: var(--ink); }
.research-facts span + span::before {
  content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 12.5px 0 -17.5px; border-radius: 50%;
  vertical-align: .2em; background: var(--wire);
}
.pub-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; }
html:not(.js) .pub-tools { display: none; }
.segmented { display: inline-flex; padding: 4px; border-radius: 999px; border: 1px solid var(--control); background: var(--surface); }
.segmented button {
  min-height: 40px; padding: 0 18px; border: 0; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--ink-2); font: 500 .92rem/1 var(--font-body);
  transition: background-color .25s ease, color .25s ease;
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.pubs { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.pub {
  display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 24px;
  padding: 26px 0; border-bottom: 1px solid var(--rule);
}
.pub[hidden] { display: none; }
.pub__year { margin: 0; font: 500 1.5rem/1.2 var(--font-display); font-variant-numeric: lining-nums; color: var(--ink); }
.pub__title { margin: 0 0 8px; font: 500 1.22rem/1.38 var(--font-display); letter-spacing: -.005em; font-variant-numeric: lining-nums; }
.pub__title a {
  color: var(--ink); text-decoration: none;
  background: linear-gradient(90deg, #ff3d8b, #7a5cff 55%, #2f7dff) no-repeat 0 100% / 0 1.5px;
  transition: background-size .5s var(--ease-io);
}
.pub__title a:hover { color: var(--ink); background-size: 100% 1.5px; }
.pub__title svg { display: inline-block; width: 14px; height: 14px; margin-left: 7px; vertical-align: .02em; color: var(--ink-3); }
/* The kind of paper is a quiet label; only a real venue is set as one, in italics. */
.pub__meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 0 6px; }
.pub__type { font: 500 .75rem/1.4 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.pub__venue { color: var(--ink-2); font-size: .95rem; font-style: italic; }
.pub__authors { margin: 0; color: var(--ink-3); font-size: .9rem; }
.pub__authors strong { color: var(--ink); font-weight: 600; }
.pub__doi { margin: 10px 0 0; font: 500 .78rem/1.3 var(--font-mono); }
.pub__doi a { color: var(--accent); }
/* Six at first, the rest one click away (the filters always look through all of them). */
.pubs.is-collapsed > .pub:nth-child(n + 7) { display: none; }
.pub-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 28px; margin-top: 36px; }
.pub-more[hidden] { display: none; }

/* ---------- Tools: three groups, one row pattern ---------- */
.toolset {
  display: grid; grid-template-columns: minmax(220px, 290px) minmax(0, 1fr); gap: 20px 48px;
  padding: 30px 0; border-top: 1px solid var(--rule);
}
.toolset:last-child { border-bottom: 1px solid var(--rule); }
.toolset__title { display: flex; align-items: baseline; gap: 10px; margin: 0 0 10px; font: 600 1.5rem/1.15 var(--font-display); letter-spacing: -.01em; font-variant-numeric: lining-nums; }
.toolset__count { font: 500 .75rem/1 var(--font-mono); letter-spacing: .06em; color: var(--accent); }
.toolset__desc { margin: 0 0 16px; color: var(--ink-2); font-size: .95rem; line-height: 1.6; }
.toolset__list {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 10px;
  align-content: start; margin: 0; padding: 0; list-style: none;
}
.tool-link {
  display: flex; align-items: flex-start; gap: 12px; height: 100%;
  padding: 8px 12px; border-radius: 12px; color: var(--ink); text-decoration: none;
  transition: background-color .25s ease;
}
.tool-link:hover { color: var(--ink); background: color-mix(in srgb, var(--surface) 80%, transparent); }
.tool-link__icon {
  display: grid; place-items: center; width: 30px; height: 30px; flex: none; margin-top: 1px;
  border-radius: 9px; color: var(--ink-3); transition: background .3s ease, color .3s ease;
}
.tool-link:hover .tool-link__icon { background: var(--wire); color: #fff; }
.tool-link__icon svg { width: 18px; height: 18px; }
.tool-link__text { display: grid; gap: 1px; min-width: 0; }
.tool-link__name { font-size: .95rem; font-weight: 600; line-height: 1.35; }
.tool-link__desc { color: var(--ink-3); font-size: .84rem; line-height: 1.45; }

/* ---------- Vivace Music ---------- */
.spotlight { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); align-items: center; gap: clamp(40px, 6vw, 96px); }
.spotlight__role { margin: -4px 0 26px; font: 500 .78rem/1.3 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.spotlight__tagline { margin: 0 0 20px; max-width: 30ch; font: italic 500 clamp(1.25rem, 1.08rem + .6vw, 1.6rem)/1.4 var(--font-display); color: var(--ink); font-variant-numeric: lining-nums; }
.spotlight__desc { margin: 0 0 34px; max-width: 54ch; color: var(--ink-2); font-size: 1.04rem; line-height: 1.7; }
.spotlight__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.spotlight__visual { display: grid; place-items: center; }
/* The stage: a dark disc in both themes, lit warm, where the logo assembles as on vivace-music.org. */
.stage {
  position: relative; width: min(100%, 460px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #241b2c 0%, #16131e 52%, #0f1017 100%);
  /* The warm light is all box-shadow: a glow drawn with a larger box would widen the page on phones. */
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), 0 40px 90px -40px rgba(255, 96, 40, .6), 0 0 120px -28px rgba(255, 61, 139, .5), 0 0 60px -20px rgba(255, 122, 26, .35);
}
.stage__ring { position: absolute; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .07); pointer-events: none; }
.stage__ring--1 { inset: 7%; }
.stage__ring--2 { inset: 15%; border-color: rgba(255, 255, 255, .05); }
.stage__ring--3 { inset: 23%; border-color: rgba(255, 255, 255, .04); }
.stage__wave, .stage__clef { position: absolute; inset: 5%; width: 90%; height: 90%; }
/* Set piece, when the stage is well in view (not when its edge first shows). */
.reveal-ready .stage:not(.is-live) .stage__wave, .reveal-ready .stage:not(.is-live) .stage__clef { opacity: 0; }
.reveal-ready .stage.is-live .stage__wave { animation: vv-wave 2.3s ease .1s both; }
.reveal-ready .stage.is-live .stage__clef { animation: vv-clef 2.5s ease .6s both; }
.reveal-ready .stage.is-live .stage__ring { animation: ripple 2.2s var(--ease-out) both; }
.reveal-ready .stage.is-live .stage__ring--1 { animation-delay: 1.2s; }
.reveal-ready .stage.is-live .stage__ring--2 { animation-delay: 1.35s; }
.reveal-ready .stage.is-live .stage__ring--3 { animation-delay: 1.5s; }
@keyframes vv-wave { 0% { opacity: 0; transform: scale(1.5); } 100% { opacity: 1; transform: scale(1); } }
@keyframes vv-clef { 0% { opacity: 0; transform: scale(.2) rotate(-90deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes ripple { 0% { opacity: 0; transform: scale(.7); } 45% { opacity: 1; } 100% { opacity: 1; transform: scale(1); } }

.spotlight__details {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px;
  margin-top: clamp(56px, 4vw + 32px, 96px); padding-top: 40px; border-top: 1px solid var(--rule);
}
.detail__title { margin: 0 0 18px; font: 500 .76rem/1.3 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.features { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.features li { display: flex; align-items: center; gap: 12px; font-weight: 500; }
.features svg { width: 20px; height: 20px; flex: none; color: var(--accent); }
.credits { display: grid; gap: 18px; margin: 0; }
.credits dt { margin-bottom: 3px; font-weight: 600; }
.credits dd { margin: 0; color: var(--ink-2); font-size: .95rem; line-height: 1.55; }
.detail__text { margin: 0 0 18px; color: var(--ink-2); font-size: .95rem; line-height: 1.6; }
.link-arrow--yt .yt { width: 20px; height: 20px; color: #ff0033; }
.link-arrow--yt:hover .yt { transform: none; }

/* ---------- Contact: the outro ---------- */
.section--contact { padding-bottom: clamp(104px, 6vw + 64px, 168px); overflow: clip; }
.contact { display: grid; justify-items: center; text-align: center; }
.contact__mark { position: relative; display: grid; place-items: center; width: 140px; height: 140px; margin-bottom: 40px; }
.contact__glow {
  position: absolute; inset: -40%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(122, 92, 255, .3), rgba(255, 61, 139, .1) 55%, transparent 75%);
}
.contact__ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.contact__stroke {
  fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 100 100; stroke-dashoffset: 0;
  transform: rotate(-90deg); transform-box: fill-box; transform-origin: center;
}
.contact__logo { position: relative; width: 76px; height: auto; }
.contact__burst { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--burst); opacity: 0; pointer-events: none; }
/* Five streaks from the upper half, so none crosses the words below the mark. */
.contact__streaks { position: absolute; inset: -150%; pointer-events: none; }
.contact__streaks i {
  position: absolute; left: 50%; top: 50%; width: 36%; height: 2px; margin-top: -1px;
  border-radius: 2px; transform-origin: 0 50%; opacity: 0;
  background: linear-gradient(90deg, var(--streak-head) 0%, var(--c) 20%, transparent 100%);
}
.contact__streaks i:nth-child(1) { --a: -164deg; --c: #ff3d8b; --d: 0s; }
.contact__streaks i:nth-child(2) { --a: -126deg; --c: #b04dff; --d: .06s; }
.contact__streaks i:nth-child(3) { --a: -90deg;  --c: #7a5cff; --d: .02s; }
.contact__streaks i:nth-child(4) { --a: -54deg;  --c: #2f7dff; --d: .08s; }
.contact__streaks i:nth-child(5) { --a: -16deg;  --c: #a8a3ff; --d: .04s; }
/* Waiting for the outro (home.js adds .outro-ready when motion is on): nothing shows yet, so a half-seen mark
   never reads as a smudge below the previous section. */
.outro-ready .contact:not(.is-live) .contact__stroke { stroke-dashoffset: 100; }
.outro-ready .contact:not(.is-live) .contact__logo,
.outro-ready .contact:not(.is-live) .contact__glow,
.outro-ready .contact:not(.is-live) > :not(.contact__mark) { opacity: 0; }
/* The outro, once Contact is 60% on screen: streaks converge (0.9 s), burst at 0.95 s, the ring draws over
   1.2 s, then "Let's connect" rises and the rest follows. */
.outro-ready .contact.is-live .contact__streaks i { animation: streak-in .9s var(--ease-streak) var(--d) both; }
.outro-ready .contact.is-live .contact__burst { animation: burst 1.2s var(--ease-out) .95s forwards; }
.outro-ready .contact.is-live .contact__glow { animation: glow 1.6s var(--ease-out) .85s both; }
.outro-ready .contact.is-live .contact__stroke { animation: draw 1.2s var(--ease-io) .95s both; }
.outro-ready .contact.is-live .contact__logo { animation: land-mark 1.1s var(--ease-out) .9s both; }
.outro-ready .contact.is-live > .eyebrow { animation: rise .9s var(--ease-out) 1.6s both; }
.outro-ready .contact.is-live > .contact__title { animation: rise 1s var(--ease-out) 1.7s both; }
.outro-ready .contact.is-live > .contact__lede { animation: rise 1s var(--ease-out) 1.85s both; }
.outro-ready .contact.is-live > .contact__email { animation: rise 1s var(--ease-out) 1.95s both; }
.outro-ready .contact.is-live > .socials { animation: rise 1s var(--ease-out) 2.05s both; }
@keyframes streak-in {
  0%   { opacity: 0; transform: rotate(var(--a)) translateX(330%); }
  14%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--a)) translateX(33%); }
}
@keyframes land-mark {
  0%   { opacity: 0; transform: scale(1.1); filter: blur(10px) brightness(.35); }
  25%  { opacity: 1; }
  100% { opacity: 1; transform: none; filter: none; }
}
.contact__title { font-size: clamp(3rem, 1.8rem + 5vw, 6.2rem); line-height: .98; margin-bottom: 24px; }
.contact__lede { margin-inline: auto; max-width: 46ch; }
.contact__email {
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; gap: 14px; max-width: 100%;
  margin: 44px 0 34px; padding: 18px 30px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--rule-strong); box-shadow: var(--shadow);
  color: var(--ink); text-decoration: none;
  font: 500 clamp(1.1rem, .95rem + .8vw, 1.5rem)/1.2 var(--font-display);
  transition: transform .3s var(--ease-out), box-shadow .3s ease, border-color .3s ease;
}
.contact__email::before {
  content: ""; position: absolute; inset: -2px; z-index: -1; border-radius: inherit;
  background: var(--wire); opacity: 0; transition: opacity .35s ease;
}
.contact__email:hover { color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: transparent; }
.contact__email:hover::before { opacity: 1; }
.contact__email::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--surface);
}
.contact__email svg { width: 22px; height: 22px; flex: none; color: var(--accent); }
.contact__email span { min-width: 0; overflow-wrap: anywhere; }
/* Each link names what it is: two YouTube channels could not be told apart by their icons. */
.socials { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 0; padding: 0; list-style: none; }
.social {
  display: inline-flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 16px 0 13px; border-radius: 999px;
  border: 1px solid var(--rule-strong); background: color-mix(in srgb, var(--surface) 55%, transparent);
  color: var(--ink-2); font-size: .9rem; font-weight: 500; text-decoration: none;
  transition: color .25s ease, border-color .25s ease, transform .3s var(--ease-out), background-color .25s ease;
}
.social:hover { color: var(--ink); border-color: var(--control); background: var(--surface); transform: translateY(-2px); }
.social svg { width: 18px; height: 18px; flex: none; }

/* ---------- Footer ---------- */
.site-footer { position: relative; padding: 48px 0 40px; }
.site-footer__wire { position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--wire); opacity: .55; }
.site-footer__top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 28px;
  padding-bottom: 20px; border-bottom: 1px solid var(--rule);
}
.site-footer__brand { display: flex; align-items: center; gap: 14px; }
.site-footer__brand img { width: 44px; height: auto; }
.site-footer__name { margin: 0 0 4px; font: 600 1.2rem/1.1 var(--font-display); }
.site-footer__tagline { margin: 0; color: var(--ink-3); font-size: .92rem; font-style: italic; }
.site-footer__nav ul { display: flex; flex-wrap: wrap; column-gap: 22px; margin: 0; padding: 0; list-style: none; }
.site-footer__nav a { display: inline-block; padding-block: 12px; color: var(--ink-2); font-size: .94rem; text-decoration: none; }
.site-footer__nav a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule-strong); }
.site-footer__bottom { padding-top: 20px; color: var(--ink-3); font-size: .86rem; }
.site-footer__bottom p { margin: 0; }

/* ---------- Reveal on scroll (only when motion is on; home.js adds .reveal-ready) ---------- */
.reveal-ready [data-reveal] {
  opacity: 0; translate: 0 26px;
  transition:
    opacity .95s var(--ease-out) var(--delay, 0s),
    translate .95s var(--ease-out) var(--delay, 0s),
    transform .35s var(--ease-out), box-shadow .35s ease, border-color .35s ease;
}
.reveal-ready [data-reveal].is-in { opacity: 1; translate: none; }
.reveal-ready [data-reveal] .eyebrow__wire, .reveal-ready [data-reveal].eyebrow__wire { transform: scaleX(0); transition: transform 1.2s var(--ease-io) calc(var(--delay, 0s) + .3s); }
.reveal-ready .is-in .eyebrow__wire { transform: scaleX(1); }

/* ---------- Pause: one-shots jump to their end, ambient loops freeze where they are ---------- */
[data-motion="off"] *:not(.aurora__blob):not(.portal__spark),
[data-motion="off"] *::before, [data-motion="off"] *::after { animation: none !important; }
[data-motion="off"] .aurora__blob, [data-motion="off"] .portal__spark { animation-play-state: paused !important; }
[data-motion="off"] [data-reveal] { opacity: 1 !important; translate: none !important; }
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion]) *, :root:not([data-motion]) *::before, :root:not([data-motion]) *::after {
    animation: none !important; transition-duration: .01ms !important;
  }
}

/* ---------- Print: everything at rest, no background art, no fixed header ---------- */
@media print {
  .aurora, .site-header, .portal__streaks, .portal__burst, .pub-tools, .pub-actions, .contact__streaks { display: none !important; }
  [data-reveal], .contact > * { opacity: 1 !important; translate: none !important; }
  .pubs.is-collapsed > .pub { display: grid !important; }
  .hero { min-height: 0; padding-top: 24px; }
}

/* ---------- Forced colours: gradients cannot carry text there ---------- */
@media (forced-colors: active) {
  .section-title em, .hero__title em, .explains__title em {
    background: none; color: CanvasText; -webkit-text-fill-color: CanvasText;
  }
  .card-icon, .tool-link__icon { forced-color-adjust: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .site-nav a { padding-inline: 10px; }
  .site-nav a::after { left: 10px; right: 10px; }
  .toolset { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .toolset__desc { max-width: 62ch; }
}

@media (max-width: 1023px) {
  :root { --header-h: 64px; }
  .courses { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spotlight { grid-template-columns: minmax(0, 1fr); }
  .stage { width: min(100%, 380px); }
  .spotlight__details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spotlight__details .detail:last-child { grid-column: 1 / -1; }

  /* The menu: a sheet under the bar with the numbered sections, then the two switches, labelled. */
  .menu-toggle { display: inline-grid; }
  .brand img { width: 40px; }
  .brand__name { font-size: 1.08rem; }
  .js .site-menu {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 1;
    display: block; max-height: calc(100svh - var(--header-h)); overflow-y: auto;
    padding: 6px var(--gutter) 22px;
    background: var(--bg); border-bottom: 1px solid var(--rule);
    box-shadow: 0 24px 40px -24px rgba(0, 0, 0, .35);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity .3s ease, transform .35s var(--ease-out), visibility 0s linear .35s;
  }
  .js .site-header.is-open .site-menu { opacity: 1; visibility: visible; transform: none; transition: opacity .3s ease, transform .35s var(--ease-out); }
  .js .site-nav ul { flex-direction: column; align-items: stretch; gap: 0; }
  .js .site-nav a {
    display: flex; width: 100%; gap: 14px; padding: 15px 2px; border-radius: 0;
    border-bottom: 1px solid var(--rule);
    color: var(--ink); font: 500 1.45rem/1.1 var(--font-display);
  }
  .js .site-nav a:hover { background: none; }
  .js .site-nav a::after { left: 2px; right: auto; width: 32px; bottom: -1px; }
  .js .site-nav__num { display: inline; min-width: 1.6em; }
  .js .site-nav__page { margin: 0; padding: 0; border: 0; }
  .js .site-nav__page a::before { content: ""; min-width: 1.6em; }
  .js .site-nav__arrow { width: 18px; height: 18px; }
  .js .site-header__controls { gap: 10px; padding-top: 18px; }
  .js .site-header__controls .icon-btn { width: auto; height: 44px; padding: 0 16px 0 14px; display: inline-flex; gap: 10px; font-size: .92rem; font-weight: 500; }
  .js .site-header__controls .icon-btn__label { position: static !important; width: auto; height: auto; overflow: visible; clip: auto; clip-path: none; }
  /* No script: the links wrap into a second row instead. */
  html:not(.js) .site-header__bar { flex-wrap: wrap; height: auto; padding-block: 12px; row-gap: 6px; }
  html:not(.js) .site-menu { order: 3; width: 100%; overflow-x: auto; }
  html:not(.js) .site-nav__page { border-left: 0; margin-left: 0; }
  html:not(.js) .menu-toggle { display: none; }
}

@media (max-width: 899px) {
  .hero { min-height: 0; padding: calc(var(--header-h) + 36px) 0 64px; }
  .hero__grid { grid-template-columns: minmax(0, 1fr); gap: 36px; justify-items: center; text-align: center; }
  .hero__visual { order: -1; }
  .portal { width: min(64vw, 300px); }
  .hero__text { display: grid; justify-items: center; }
  .hero__first, .hero__last { display: inline; }
  .hero__title::after { left: 50%; margin-left: max(-20%, -125px); transform-origin: 50% 50%; }
  /* Centred lines: the position over the institution, each on its own line, without separators. */
  .hero__cred { flex-direction: column; align-items: center; }
  .hero__cred span + span::before { display: none; }
  .hero__roles, .hero__actions { justify-content: center; }
  .hero__lede { margin-inline: auto; }
  /* Phones: the text is below the portrait, so the streaks come from the upper half only (−180…0°). */
  .portal__streaks { clip-path: inset(-36px -3000px -3000px -3000px); }
  .portal__streaks i:nth-child(1) { --a: -172deg; }
  .portal__streaks i:nth-child(2) { --a: -148deg; }
  .portal__streaks i:nth-child(3) { --a: -122deg; }
  .portal__streaks i:nth-child(4) { --a: -90deg; }
  .portal__streaks i:nth-child(5) { --a: -58deg; }
  .portal__streaks i:nth-child(6) { --a: -32deg; }
  .portal__streaks i:nth-child(7) { --a: -8deg; }
}

@media (max-width: 720px) {
  .toolset { padding: 30px 0; }
  .toolset__list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 6px; }
  .tool-link { align-items: center; gap: 10px; padding: 8px; }
  .tool-link__desc { display: none; }
  .tool-link__icon { margin-top: 0; }
  .tool-link__name { font-size: .9rem; }
  .pub { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 22px 0; }
  .pub__year { font-size: 1.25rem; }
  .pub__title { font-size: 1.12rem; }
}

@media (max-width: 639px) {
  .courses { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 24px 22px; }
  /* Three lines per course on a phone; the course page has the rest. */
  .course .card-desc { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
  .spotlight__details { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .research-facts { font-size: 1rem; }
  .pub-actions { flex-direction: column; align-items: flex-start; }
  .site-footer__top { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 479px) {
  .hero__news-more { display: none; }
  .hero__cred { font-size: 1rem; }
  .hero__roles { font-size: .95rem; }
  .hero__actions { width: 100%; }
  .hero__actions .btn { flex: 1 1 100%; }
  .btn { padding: 0 22px; }
  .brand__name { font-size: 1.02rem; }
  .contact__email { padding: 16px 22px; gap: 10px; }
  .explains__title { font-size: 1.8rem; }
}

@media (max-width: 359px) {
  .brand__name { display: none; }
}
