/* AI & the Brain — coral for neurons, indigo for machines. */
:root {
  --paper: #f6f3ec;
  --surface: #fffefa;
  --ink: #1c1d22;
  --muted: #6a6d76;
  --rule: #e3ded2;
  --brain: #c8553d;
  --ai: #3b4ec2;
  --width: 880px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111216;
    --surface: #181a20;
    --ink: #ecebe6;
    --muted: #9b9ea8;
    --rule: #2a2c33;
    --brain: #ef8a70;
    --ai: #8e9cff;
  }
}
:root[data-theme="dark"] {
  --paper: #111216;
  --surface: #181a20;
  --ink: #ecebe6;
  --muted: #9b9ea8;
  --rule: #2a2c33;
  --brain: #ef8a70;
  --ai: #8e9cff;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; background: var(--paper); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.65 "IBM Plex Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ai); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
img { display: block; max-width: 100%; }
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }

/* gradient stops shared by the SVGs */
.s-brain { stop-color: var(--brain); }
.s-ai { stop-color: var(--ai); }

/* ---- Nav ---- */
.topnav {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  max-width: var(--width); margin: 0 auto; padding: 14px 20px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
}
.brand { font: 500 22px/1 "Newsreader", Georgia, serif; color: var(--ink); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.navlinks { display: flex; gap: 26px; flex-wrap: wrap; }
.navlinks a { color: var(--muted); font: 14px "IBM Plex Mono", ui-monospace, monospace; }
.navlinks a:hover { color: var(--ink); text-decoration: none; }

/* ---- Theme toggle ---- */
.nav-right { display: flex; align-items: center; gap: 22px; }
.theme-toggle {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--rule); border-radius: 50%;
  background: var(--paper); color: var(--ink);
  cursor: pointer; padding: 0;
  transition: border-color .2s, color .2s;
}
.theme-toggle:hover { border-color: var(--ai); color: var(--ai); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .ico-ai { display: none; }
.theme-toggle .ico-brain { color: var(--brain); }
.theme-toggle .ico-ai { color: var(--ai); }
:root[data-theme="dark"] .theme-toggle .ico-brain { display: none; }
:root[data-theme="dark"] .theme-toggle .ico-ai { display: block; }

/* ---- Smooth colour change when the mode switches ---- */
.theme-anim, .theme-anim *, .theme-anim *::before, .theme-anim *::after {
  transition: background-color var(--tdur, 1s) ease, color var(--tdur, 1s) ease, border-color var(--tdur, 1s) ease, fill var(--tdur, 1s) ease, stroke var(--tdur, 1s) ease, box-shadow var(--tdur, 1s) ease, opacity var(--tdur, 1s) ease, filter var(--tdur, 1s) ease !important;
}

/* ---- Hero: full-width cover with the name set on it ---- */
.hero { max-width: var(--width); margin: 0 auto; padding: 18px 20px 0; }
.stage { height: clamp(300px, 36vw, 420px); }
.cover {
  flex: 1; min-width: 0;
  position: relative;
  height: 100%;
  border-radius: 18px;
  overflow: hidden;
}
.cover img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.cover img { object-position: 50% 40%; }
.cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(8, 8, 18, 0) 40%, rgba(8, 8, 18, .7) 100%);
  pointer-events: none;
}
.cover-text {
  position: absolute; z-index: 2;
  left: 32px; right: 32px; bottom: 26px;
  color: #fff;
}
.cover-text h1 {
  margin: 0;
  font: 500 clamp(48px, 6.2vw, 76px)/1 "Newsreader", Georgia, serif;
  letter-spacing: -.025em;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .35);
}
.cover-text .role { margin: 14px 0 0; font: 500 16px/1 "IBM Plex Mono", monospace; letter-spacing: .18em; text-transform: uppercase; color: rgba(255, 255, 255, .9); }
.cover-text .role a { color: #fff; text-decoration: underline; text-decoration-color: rgba(255,255,255,.45); text-underline-offset: 3px; }

:root[data-theme="dark"] .cover img { filter: saturate(.85) contrast(1.03) brightness(.92); }

/* Affiliation bar: the seal sits with the affiliation it stands for */
.affil-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px 28px; flex-wrap: wrap;
  margin: 16px 0 0; padding: 14px 14px;
  border-bottom: 1px solid var(--rule);
}
.affil { display: flex; align-items: center; gap: 14px; color: var(--ink); }
.affil:hover { text-decoration: none; }
.affil:hover .affil-lab { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.affil-seal { width: 46px; height: 46px; flex: none; }
.affil-text { display: flex; flex-direction: column; line-height: 1.3; }
.affil-lab { font: 500 17px/1.3 "Newsreader", Georgia, serif; }
.affil-uni { font-size: 13.5px; color: var(--muted); }
.links { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 15px; align-items: baseline; }
.links .mono { font-size: 13.5px; color: var(--muted); }

.signal { display: block; width: 100%; height: 56px; margin: 30px 0 0; }
.signal path { stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.sig-brain { stroke: var(--brain); }
.sig-ai { stroke: var(--ai); }
.signal .spark { fill: none; stroke: #fff; stroke-width: 2.6; pointer-events: none; opacity: 0; stroke-linecap: round; stroke-dasharray: 4 100; stroke-dashoffset: 4; }
/* Intro: the top signal draws itself in, then a spark of current runs along it */
@keyframes sig-draw { from { clip-path: inset(-20% 100% -20% 0); } to { clip-path: inset(-20% 0 -20% 0); } }
@keyframes spark-run { 0% { stroke-dashoffset: 4; opacity: 1; } 99% { opacity: 1; } 100% { stroke-dashoffset: -100; opacity: 0; } }
.intro .signal:not(.small) .sig-brain { clip-path: inset(-20% 100% -20% 0); animation: sig-draw 1.4s cubic-bezier(.45,0,.55,1) .25s forwards; }
.intro .signal:not(.small) .sig-ai { clip-path: inset(-20% 100% -20% 0); animation: sig-draw 1.2s cubic-bezier(.45,0,.55,1) 1.65s forwards; }
@keyframes spark-back { 0% { stroke-dashoffset: -100; opacity: 1; } 99% { opacity: 1; } 100% { stroke-dashoffset: 4; opacity: 0; } }
/* a small dot of current: left -> right across brain then digital, then back right -> left */
.intro .signal .spark-brain { animation: spark-run 1.2s ease-in 2.9s both, spark-back 1.2s ease-out 6.1s forwards; }
.intro .signal .spark-ai { animation: spark-run 1s linear 4.1s both, spark-back 1s linear 5.1s forwards; }
.signal .spark-brain { filter: drop-shadow(0 0 4px var(--brain)) drop-shadow(0 0 10px var(--brain)); }
.signal .spark-ai { filter: drop-shadow(0 0 4px var(--ai)) drop-shadow(0 0 10px var(--ai)); }
.signal.small { height: 34px; margin: 0 0 14px; opacity: .8; }

/* ---- Sections ---- */
main { max-width: var(--width); margin: 0 auto; padding: 0 20px; }
.sec { padding: 56px 12px 8px; }
.sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; }
.sec-head h2 { margin: 0; font: 500 28px/1.1 "IBM Plex Mono", ui-monospace, monospace; letter-spacing: -.02em; }
.spike { width: 46px; height: 28px; flex: none; overflow: visible; }
.sec-head h2 .path { font-weight: 500; margin-right: 1px; transition: text-shadow .25s ease, color .6s ease; }
.tone-brain .path { color: var(--brain); }
.tone-ai .path { color: var(--ai); }
.sec-head:hover .path { text-shadow: 0 0 10px currentColor, 0 0 2px currentColor; }
.spike path { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.tone-brain .spike path { stroke: var(--brain); }
.tone-ai .spike path { stroke: var(--ai); }
.content { padding-left: 46px; }
.content > :first-child { margin-top: 0; }
p { margin: 0 0 12px; }

/* ---- About ---- */
.about {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  gap: 0 48px;
  align-items: center;
  padding-top: 44px;
}
.lede { grid-column: 1 / -1; font: 400 26px/1.45 "Newsreader", Georgia, serif; letter-spacing: -.005em; margin: 0 0 30px; }
.about > .eyebrow, .about > .question-lead, .about > .question, .about > .aim { grid-column: 1 / -1; }
.about > .hyp { grid-column: 1; }
.about > .convergence { grid-column: 2; }
.lede a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--ink) 30%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
.lede a:hover { text-decoration-color: currentColor; }
.eyebrow {
  margin: 0 0 10px;
  font: 500 12.5px/1 "IBM Plex Mono", monospace;
  letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.question-lead { margin: 0 0 6px; font-size: 17px; color: var(--muted); }
.question {
  margin: 0 0 24px;
  font: italic 400 30px/1.3 "Newsreader", Georgia, serif;
  letter-spacing: -.01em;
}
.hyp { display: grid; grid-template-columns: 48px 1fr; gap: 14px 10px; margin: 0; }
.hyp dt { font: italic 500 25px/1.2 "Newsreader", Georgia, serif; }
.hyp dt sub { font-size: .6em; }
.hyp dd { margin: 0; font-size: 18px; line-height: 1.55; padding-top: 2px; }
.aim {
  margin: 26px 0 0; padding-top: 20px;
  border-top: 1px solid var(--rule);
  font-size: 18px; line-height: 1.7; color: var(--ink);
}
.aim strong { font-weight: 600; }
.h-brain { color: var(--brain); }
.term-brain { color: var(--brain); }
.term-ai { color: var(--ai); }
.h-ai { color: var(--ai); }


/* ---- Neuron (after Cajal) → artificial network ---- */
.convergence { margin: 0; }
.convergence svg { width: 100%; height: auto; display: block; overflow: visible; }
.neuron path { fill: none; stroke: var(--brain); stroke-linecap: round; }
.neuron .soma { fill: var(--brain); }
.myelin rect { fill: var(--paper); stroke: color-mix(in srgb, var(--brain) 50%, var(--ai)); stroke-width: 1.1; }
.terminals path { fill: none; stroke: var(--ai); stroke-width: 1.2; }
.edges line { stroke: var(--ai); stroke-opacity: .4; stroke-width: .9; }
.nodes circle { fill: var(--paper); stroke: var(--ai); stroke-width: 1.5; }
.stop-brain { stop-color: var(--brain); }
.stop-machine { stop-color: var(--ai); }
.fill-brain { fill: var(--brain); }
.fill-machine { fill: var(--ai); }
.arc { fill: none; stroke-width: 1.6; stroke-dasharray: 6 5; }
.arc-1 { stroke: var(--brain); }
.arc-2 { stroke: var(--ai); }
.hlabel { font: italic 36px "Newsreader", Georgia, serif; }
.hlabel.h1 { fill: var(--brain); }
.hlabel.h2 { fill: var(--ai); }
.tag { font: italic 26px "Newsreader", Georgia, serif; fill: var(--muted); }
.convergence { cursor: pointer; }
.convergence.firing .neuron, .convergence.firing .terminals,
.convergence.firing .edges, .convergence.firing .nodes { opacity: 1 !important; }
.nodes circle { transition: fill .45s ease, filter .45s ease; }
.nodes circle.lit { fill: var(--ai); filter: drop-shadow(0 0 6px var(--ai)); transition: fill .08s, filter .08s; }
.edges line { transition: stroke-opacity .45s ease, stroke-width .45s ease; }
.edges line.lit { stroke-opacity: 1; stroke-width: 1.8; transition: stroke-opacity .08s, stroke-width .08s; }
.soma { transition: filter .45s ease; }
.soma.lit { filter: drop-shadow(0 0 10px var(--brain)); transition: filter .08s; }
.spike-dot.d-brain { fill: var(--brain); filter: drop-shadow(0 0 6px var(--brain)); }
.spike-dot.d-ai { fill: var(--ai); filter: drop-shadow(0 0 6px var(--ai)); }



/* ---- Education / Experience: date column + details ---- */
.item {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  column-gap: 24px;
  padding: 16px 0;
  border-top: 1px solid var(--rule);
}
.item:last-child { border-bottom: 1px solid var(--rule); }
.item-head { display: contents; }
.when { grid-column: 1; grid-row: 1 / span 3; font: 400 13.5px/1.9 "IBM Plex Mono", monospace; color: var(--muted); }
.org { grid-column: 2; font: 500 21px/1.3 "Newsreader", Georgia, serif; }
.item-role { grid-column: 2; margin: 2px 0 0; color: var(--muted); font-size: 16px; }
.item p:not(.item-role) { grid-column: 2; margin: 6px 0 0; font-size: 16px; }

/* ---- AIMA ---- */
.aima-intro { font-size: 17px; max-width: 760px; margin-bottom: 22px; }
.aima-name { color: var(--ink); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--ink) 30%, transparent); text-underline-offset: 3px; }
.aima-name:hover { text-decoration-color: currentColor; }
.aima-more { white-space: nowrap; font-size: 15px; }
.team { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.member {
  --ring: var(--brain);
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px;
  padding: 22px 14px 18px; height: 100%;
  border: 1px solid var(--rule); border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 65%, var(--paper));
  color: var(--ink);
  transition: border-color .2s, transform .2s;
}
:root[data-theme="dark"] .member { --ring: var(--ai); }
.member:hover { text-decoration: none; border-color: var(--ring); transform: translateY(-2px); }
.member img {
  width: 92px; height: 92px; border-radius: 50%; object-fit: cover; margin-bottom: 12px;
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ring), 0 0 16px color-mix(in srgb, var(--ring) 40%, transparent);
  transition: box-shadow .6s ease;
}
.member:hover img { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ring), 0 0 24px color-mix(in srgb, var(--ring) 65%, transparent); }
.m-name { font: 500 17.5px/1.3 "Newsreader", Georgia, serif; }
.m-role { font-size: 13.5px; color: var(--ring); transition: color .6s ease; }
.m-aff { font-size: 13.5px; color: var(--muted); }

/* ---- Visitor map ---- */
.visitor-map { max-width: 560px; border-radius: 12px; overflow: hidden; border: 1px solid var(--rule); background: #1c1d22; line-height: 0; }
.visitor-map img, .visitor-map canvas, .visitor-map > div { max-width: 100% !important; height: auto; }

/* ---- Publications ---- */
.note { font-size: 14.5px; color: var(--muted); }
.content h3 {
  margin: 30px 0 6px;
  font: 500 14px/1 "IBM Plex Mono", monospace;
  letter-spacing: .12em;
  color: var(--muted);
}
.pubs { list-style: none; margin: 0; padding: 0; }
.pubs li { padding: 16px 0; border-top: 1px solid var(--rule); }
.pubs li.pub { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 22px; align-items: start; }
.pthumb {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--rule);
}
.pthumb img { width: 100%; height: 100%; object-fit: contain; padding: 8px; transition: transform .35s ease; }
.pub:hover .pthumb img { transform: scale(1.04); }
.pthumb-empty { display: grid; place-items: center; background: color-mix(in srgb, var(--paper) 70%, var(--rule)); }
.pthumb-empty .spike { width: 54px; height: 34px; opacity: .5; }
.pthumb-empty .spike path { stroke: var(--muted); }
.pbadge {
  position: absolute; top: 7px; left: 7px;
  font: 600 10.5px/1 "IBM Plex Mono", monospace; letter-spacing: .04em;
  padding: 4px 7px; border-radius: 5px;
  color: #fff; background: var(--ai);
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.pub[data-key^="j"] .pbadge { background: var(--brain); }
.pubs p { margin: 0; }
.ptitle { font: 500 19px/1.35 "Newsreader", Georgia, serif; letter-spacing: -.005em; }
.pauthors { margin-top: 4px !important; font-size: 15px; color: var(--muted); }
.pauthors u { color: var(--ink); font-weight: 500; text-decoration: underline; text-decoration-color: var(--brain); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.pvenue { font-size: 15px; }
.pvenue i { font-style: italic; }
.pvenue a { font: 500 12px "IBM Plex Mono", monospace; letter-spacing: .06em; text-transform: uppercase; padding: 1px 7px; border: 1px solid color-mix(in srgb, var(--ai) 40%, transparent); border-radius: 4px; }
.pvenue a:hover { text-decoration: none; background: color-mix(in srgb, var(--ai) 10%, transparent); }

/* ---- Honors ---- */
.honors { list-style: none; margin: 0; padding: 0; }
.honors li { position: relative; padding: 12px 0 12px 22px; border-top: 1px solid var(--rule); font-size: 16.5px; }
.honors li:last-child { border-bottom: 1px solid var(--rule); }
.honors li::before {
  content: ""; position: absolute; left: 2px; top: 19px;
  width: 7px; height: 7px; border-radius: 50%;
  border: 1.5px solid var(--ai); background: var(--paper);
}

/* ---- Small details ---- */
::selection { background: color-mix(in srgb, var(--brain) 26%, transparent); }
:root[data-theme="dark"] ::selection { background: color-mix(in srgb, var(--ai) 34%, transparent); }
.brand { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 17px; font-weight: 500; letter-spacing: -.01em; }
.prompt { margin-left: 8px; color: var(--brain); transition: color .6s ease; }
:root[data-theme="dark"] .prompt { color: var(--ai); }
.caret {
  display: inline-block; width: .55em; height: 1.05em; margin-left: 6px; vertical-align: -3px;
  background: var(--brain); animation: caret-blink 1.1s steps(1) infinite; transition: background-color .6s ease;
}
:root[data-theme="dark"] .caret { background: var(--ai); }
@keyframes caret-blink { 50% { opacity: 0; } }


/* ---- Footer ---- */
footer { max-width: var(--width); margin: 64px auto 0; padding: 0 20px 44px; text-align: center; color: var(--muted); font-size: 14px; }
footer p { margin: 0; }

/* ---- Brain mode (light) lights up the brain; AI mode (dark) lights up the machine ---- */
.sig-brain, .sig-ai, .neuron, .terminals, .edges, .nodes {
  filter: drop-shadow(0 0 0 transparent) drop-shadow(0 0 0 transparent);
}
.question .term-brain, .question .term-ai { transition: opacity .6s ease, text-shadow .6s ease; }
:root[data-theme="light"] .question .term-brain { text-shadow: 0 0 14px color-mix(in srgb, var(--brain) 45%, transparent); }
:root[data-theme="light"] .question .term-ai { opacity: .4; }
:root[data-theme="dark"] .question .term-ai { text-shadow: 0 0 14px color-mix(in srgb, var(--ai) 70%, transparent); }
:root[data-theme="dark"] .question .term-brain { opacity: .4; }
.sig-brain, .sig-ai, .neuron, .terminals, .edges, .nodes, .arc, .hlabel, .hyp dt, .hyp dd {
  transition: opacity .6s ease, filter .6s ease;
}
:root[data-theme="light"] .sig-ai,
:root[data-theme="light"] .terminals,
:root[data-theme="light"] .edges,
:root[data-theme="light"] .nodes,
:root[data-theme="light"] .arc-2,
:root[data-theme="light"] .hlabel.h2 { opacity: .3; }
:root[data-theme="light"] .h-ai, :root[data-theme="light"] .h-ai + dd { opacity: .45; }
:root[data-theme="light"] .sig-brain,
:root[data-theme="light"] .neuron { filter: drop-shadow(0 0 3px color-mix(in srgb, var(--brain) 55%, transparent)) drop-shadow(0 0 0 transparent); }

:root[data-theme="dark"] .sig-brain,
:root[data-theme="dark"] .neuron,
:root[data-theme="dark"] .arc-1,
:root[data-theme="dark"] .hlabel.h1 { opacity: .28; }
:root[data-theme="dark"] .h-brain, :root[data-theme="dark"] .h-brain + dd { opacity: .45; }
:root[data-theme="dark"] .sig-ai,
:root[data-theme="dark"] .terminals,
:root[data-theme="dark"] .edges,
:root[data-theme="dark"] .nodes { filter: drop-shadow(0 0 4px var(--ai)) drop-shadow(0 0 10px color-mix(in srgb, var(--ai) 60%, transparent)); }
:root[data-theme="dark"] .edges line { stroke-opacity: .85; }

/* ---- Narrow screens ---- */
@media (max-width: 860px) {
  .team { grid-template-columns: 1fr 1fr; }
  .about { grid-template-columns: 1fr; gap: 0; }
  .about > .hyp, .about > .convergence { grid-column: 1; }
  .about > .convergence { margin-top: 26px; }
}
@media (max-width: 680px) {
  body { font-size: 16px; }
  .navlinks { display: none; }
  .hero { padding-top: 6px; }
  .stage { height: 320px; }
  .cover { border-radius: 14px; }
  .cover img { object-position: 16% 40%; }
  .cover-text { left: 18px; right: 18px; bottom: 18px; }
  .cover-text h1 { font-size: 48px; }
  .cover-text .role { font-size: 14.5px; }
  .affil-bar { padding: 14px 2px; }
  .affil-seal { width: 40px; height: 40px; }
  .affil-lab { font-size: 16px; }
  .role { font-size: 15.5px; }
  .sec { padding: 44px 0 4px; }
  .content { padding-left: 0; }
  .sec-head h2 { font-size: 23px; }
  .lede { font-size: 21px; }
  .question { font-size: 24px; }
  .item { grid-template-columns: 1fr; }
  .pubs li.pub { grid-template-columns: 1fr; gap: 12px; }
  .team { grid-template-columns: 1fr 1fr; }
  .pthumb { max-width: 340px; }
  .when { grid-row: auto; }
  .org, .item-role, .item p:not(.item-role) { grid-column: 1; }
  .signal { height: 40px; margin-top: 24px; }
}
