/* ==========================================================
   Brain Dynamics & Control — site styles
   Colors are tokens; dark mode follows the visitor's system.
   ========================================================== */

:root {
  --bg: #f5f7f8;
  --bg-tint: #eaeef1;
  --surface: #ffffff;
  --ink: #13212c;
  --ink-soft: #4b5c69;
  --ink-faint: #7a8995;
  --rule: #d5dde3;
  --accent: #a51417;          /* WashU red, used sparingly */
  --accent-ink: #ffffff;
  --trace: #1f4e6b;           /* phase-plane trajectories */
  --trace-2: #a51417;

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

  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e151b;
    --bg-tint: #131d25;
    --surface: #17222b;
    --ink: #e4eaee;
    --ink-soft: #a9b6bf;
    --ink-faint: #7d8b95;
    --rule: #26343f;
    --accent: #e0625c;
    --accent-ink: #12090a;
    --trace: #7fb2d3;
    --trace-2: #e0625c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e151b; --bg-tint: #131d25; --surface: #17222b; --ink: #e4eaee;
  --ink-soft: #a9b6bf; --ink-faint: #7d8b95; --rule: #26343f;
  --accent: #e0625c; --accent-ink: #12090a; --trace: #7fb2d3; --trace-2: #e0625c;
  color-scheme: dark;
}

[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

h1, h2, h3 { font-weight: 400; margin: 0; text-wrap: balance; }
h2 { font-family: var(--serif); font-size: clamp(2.2rem, 4.5vw, 3.1rem); line-height: 1.05; letter-spacing: -0.01em; }
h3 { font-size: 1.08rem; font-weight: 600; line-height: 1.35; }
p { margin: 0; }

/* ---------- header ---------- */
.site-head {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.head-row { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 1rem; letter-spacing: -0.005em; }
.brand-mark { width: 28px; height: 28px; color: var(--ink); flex: none; }
.amp { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 1.15em; }
.nav { display: flex; gap: 4px; }
.nav a { text-decoration: none; font-size: 0.95rem; color: var(--ink-soft); padding: 8px 12px; border-radius: var(--radius); }
.nav a:hover { color: var(--ink); background: var(--bg-tint); }
.nav a.nav-join { color: var(--accent); font-weight: 600; }
.nav-toggle { display: none; }

@media (max-width: 820px) {
  .nav-toggle {
    display: block; background: none; border: 1px solid var(--rule); color: var(--ink);
    font: 500 0.9rem var(--sans); padding: 7px 12px; border-radius: var(--radius); cursor: pointer;
  }
  .nav {
    display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column;
    background: var(--bg); border-bottom: 1px solid var(--rule); padding: 8px var(--gutter) 16px;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 4px; font-size: 1.05rem; }
}

/* ---------- hero ---------- */
.hero { padding: clamp(40px, 7vw, 88px) 0 clamp(48px, 7vw, 96px); border-bottom: 1px solid var(--rule); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 64px); align-items: center; }
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(3.4rem, 9vw, 6.6rem);
  line-height: 0.92;
  letter-spacing: -0.025em;
  margin-bottom: 28px;
}
.lede { font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: var(--ink-soft); max-width: 34em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-figure { margin: 0; }
.plane {
  position: relative; width: 100%; aspect-ratio: 5 / 4;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
}
.plane canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-figure figcaption { font-size: 0.85rem; color: var(--ink-faint); margin-top: 10px; max-width: 40em; }

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-figure { order: 2; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 20px; border-radius: var(--radius);
  font: 600 0.95rem var(--sans); text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: background-color .15s, border-color .15s, color .15s;
}
.btn-solid { background: var(--ink); color: var(--bg); }
.btn-solid:hover { background: var(--accent); color: var(--accent-ink); }
.btn-line { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-line:hover { border-color: var(--ink); }

/* ---------- sections ---------- */
.section { padding: clamp(56px, 8vw, 104px) 0; }
.section-tint { background: var(--bg-tint); }
.section-head { display: grid; gap: 12px; margin-bottom: clamp(28px, 4vw, 48px); max-width: 44em; }
.section-head p { color: var(--ink-soft); }
.source-note { font-size: 0.9rem; color: var(--ink-faint) !important; }

/* research themes: a ruled list, not cards */
.themes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(24px, 5vw, 64px); }
.theme { padding: 24px 0 28px; border-top: 1px solid var(--rule); display: grid; gap: 10px; align-content: start; }
.theme h3 { font-size: 1.2rem; }
.theme p { color: var(--ink-soft); }
.theme .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag { font-size: 0.8rem; color: var(--ink-soft); border: 1px solid var(--rule); padding: 2px 9px; border-radius: 99px; }
@media (max-width: 720px) { .themes { grid-template-columns: 1fr; } }

/* people */
.people-group + .people-group { margin-top: 44px; }
.people-group > h3 { font-size: 0.95rem; color: var(--ink-faint); font-weight: 500; margin-bottom: 18px; padding-bottom: 10px; border-bottom: 1px solid var(--rule); }
.people { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 28px 24px; }
.person { display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: center; }
.person.lead { grid-template-columns: 112px 1fr; gap: 24px; }
.people.lead-list { grid-template-columns: 1fr; max-width: 46em; }
.avatar {
  width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--surface);
  border: 1px solid var(--rule); display: grid; place-items: center;
  font: 400 1.3rem var(--serif); color: var(--ink-soft);
}
.lead .avatar { width: 112px; height: 112px; font-size: 2.4rem; }
.person-name { font-weight: 600; line-height: 1.3; }
.person-name a { text-decoration: none; }
.person-name a:hover { text-decoration: underline; }
.person-role { font-size: 0.9rem; color: var(--ink-soft); line-height: 1.4; }
.person-bio { font-size: 0.95rem; color: var(--ink-soft); margin-top: 6px; }
.person-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.person-link {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 6px 12px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 500; text-decoration: none; color: var(--ink);
}
.person-link:hover { border-color: var(--ink); }
.person-link svg { width: 15px; height: 15px; flex: none; }
.alumni { list-style: none; margin: 0; padding: 0; columns: 2 260px; column-gap: 32px; }
.alumni li { break-inside: avoid; padding: 6px 0; font-size: 0.95rem; color: var(--ink-soft); }
.alumni li strong { color: var(--ink); font-weight: 600; }

/* publications */
.pub-tools { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.search input {
  width: min(420px, 100%); min-height: 44px; padding: 10px 14px;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); color: var(--ink);
  font: 400 1rem var(--sans);
}
.search { flex: 1 1 280px; }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.pub-links { display: flex; gap: 18px; font-size: 0.95rem; }
.pubs { display: grid; gap: 8px; }
.pub-year { display: grid; grid-template-columns: 88px 1fr; gap: 24px; padding-top: 18px; border-top: 1px solid var(--rule); }
.pub-year > h3 { font-family: var(--serif); font-weight: 400; font-size: 1.9rem; line-height: 1; color: var(--ink-faint); }
.pub-year ol { list-style: none; margin: 0; padding: 0 0 18px; display: grid; gap: 18px; }
.pub-title { font-weight: 600; line-height: 1.4; }
.pub-title a { text-decoration: none; }
.pub-title a:hover { text-decoration: underline; }
.pub-authors { font-size: 0.93rem; color: var(--ink-soft); margin-top: 2px; }
.pub-authors b { color: var(--ink); font-weight: 600; }
.pub-venue { font-size: 0.9rem; color: var(--ink-faint); font-style: italic; }
.pub-venue .oa { font-style: normal; color: var(--accent); margin-left: 8px; text-decoration: none; font-weight: 500; }
.more { margin-top: 24px; }
.empty { color: var(--ink-soft); padding: 20px 0; }
@media (max-width: 600px) {
  .pub-year { grid-template-columns: 1fr; gap: 10px; }
}

/* code */
.repos { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0 32px; }
.repo { border-top: 1px solid var(--rule); padding: 18px 0 20px; display: grid; gap: 6px; }
.repo a { text-decoration: none; font-weight: 600; word-break: break-word; }
.repo a:hover { text-decoration: underline; }
.repo p { color: var(--ink-soft); font-size: 0.95rem; }
.repo-meta { display: flex; gap: 16px; font-size: 0.85rem; color: var(--ink-faint); }
.lang-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--trace); margin-right: 6px; vertical-align: 0; }

/* alumni */
.alumni-link { margin-top: 40px; }
.crumb { font-size: 0.9rem; color: var(--ink-faint); margin-bottom: 18px; }
.crumb a { color: var(--ink-soft); }
.page-title { font-family: var(--serif); font-size: clamp(3rem, 8vw, 5rem); line-height: 0.95; letter-spacing: -0.02em; }
.year-num { font-family: var(--serif); font-weight: 400; font-size: 1.9rem; line-height: 1; color: var(--ink-faint); }
.alum-list { list-style: none; margin: 0; padding: 0 0 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px 28px; }
.alum-list li { display: grid; gap: 2px; min-width: 0; }
.alum-name { font-weight: 600; }
.alum-name a { text-decoration: none; }
.alum-name a:hover { text-decoration: underline; }
.alum-detail { font-size: 0.93rem; color: var(--ink-soft); }

/* join */
.join { background: var(--ink); color: var(--bg); }
.join .join-lede { color: color-mix(in srgb, var(--bg) 75%, transparent); margin-top: 16px; max-width: 30em; }
.join-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr); gap: clamp(24px, 5vw, 64px); }
.opening { padding: 22px 0; border-top: 1px solid color-mix(in srgb, var(--bg) 22%, transparent); }
.opening:first-child { border-top: 0; padding-top: 4px; }
.opening h3 { font-size: 1.15rem; }
.opening p { color: color-mix(in srgb, var(--bg) 78%, transparent); margin-top: 8px; }
.opening a { color: var(--bg); font-weight: 600; }
@media (max-width: 760px) { .join-grid { grid-template-columns: 1fr; } }

/* funders */
.funders { padding: 48px 0; border-bottom: 1px solid var(--rule); }
.small-head { font-family: var(--sans); font-size: 0.95rem; font-weight: 500; color: var(--ink-faint); margin-bottom: 14px; }
.funder-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 28px; color: var(--ink-soft); font-size: 0.98rem; }

/* footer */
.site-foot { padding: 48px 0 64px; font-size: 0.95rem; color: var(--ink-soft); }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.foot-name { color: var(--ink); font-weight: 600; margin-bottom: 6px; }
.foot-label { color: var(--ink-faint); margin-bottom: 6px; }
.foot-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr; } }

.empty code { font-size: 0.9em; background: var(--bg-tint); padding: 1px 5px; border-radius: 4px; }
