/* ==========================================================================
   Forth Lab — shared styles
   Colors and fonts live in :root. Change --accent to restyle the whole site.
   ========================================================================== */
:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --ink: #18191d;
  --ink-2: #474a52;
  --ink-3: #7b7f89;
  --rule: #e8e5e0;
  --accent: #b3122e;          /* RPI red */
  --accent-ink: #ffffff;
  --accent-soft: #fbeef0;
  --chip: #f2f0ec;
  --radius: 16px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max: 1160px;
  --nav-h: 68px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111215;
    --surface: #18191d;
    --ink: #ecebe8;
    --ink-2: #b8bac1;
    --ink-3: #858993;
    --rule: #2a2c32;
    --accent: #ff5a6e;
    --accent-ink: #111215;
    --accent-soft: #2a1a1e;
    --chip: #222429;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.6 var(--sans); -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100vh;
}
main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: inherit; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 28px; }
.narrow { max-width: 820px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; line-height: 1.12; margin: 0; }
.eyebrow {
  font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); font-weight: 650; margin: 0 0 14px;
}
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 100; background: var(--surface); padding: 8px 14px; border-radius: 8px; }

/* ---------- Navigation ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 50; height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(1.5) blur(14px); -webkit-backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--rule);
}
.site-nav .wrap { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex: none; color: var(--accent); }
.brand-text { font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: -.01em; }
.brand-text span { color: var(--ink-3); font-family: var(--sans); font-size: 13px; font-weight: 500; letter-spacing: .04em; margin-left: 8px; }
.nav-links { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: block; padding: 8px 14px; border-radius: 999px; text-decoration: none;
  font-size: 15px; font-weight: 500; color: var(--ink-2); transition: background .15s, color .15s;
}
.nav-links a:hover { background: var(--chip); color: var(--ink); }
.nav-links a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.nav-toggle {
  display: none; border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  width: 42px; height: 42px; border-radius: 12px; cursor: pointer; align-items: center; justify-content: center;
}
@media (max-width: 760px) {
  .brand-text span { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute; left: 0; right: 0; top: var(--nav-h);
    flex-direction: column; gap: 0; padding: 10px 16px 18px;
    background: var(--bg); border-bottom: 1px solid var(--rule);
    box-shadow: 0 18px 30px -18px rgba(0,0,0,.25);
    display: none;
  }
  .site-nav.open .nav-links { display: flex; }
  .nav-links a { padding: 13px 14px; font-size: 17px; border-radius: 12px; }
}

/* ---------- Page header (inner pages) ---------- */
.page-head { padding: 84px 0 48px; border-bottom: 1px solid var(--rule); }
.page-head h1 { font-size: clamp(40px, 6vw, 64px); margin-bottom: 18px; }
.page-head .lede { font-size: clamp(18px, 2vw, 21px); color: var(--ink-2); max-width: 720px; margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 13px 22px; border-radius: 999px;
  font-size: 15px; font-weight: 600; text-decoration: none; border: 1px solid transparent; transition: transform .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { border-color: rgba(255,255,255,.45); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.12); }
.btn svg { width: 16px; height: 16px; }

/* ---------- Home / hero ---------- */
.hero {
  position: relative; min-height: calc(100vh - var(--nav-h)); min-height: calc(100svh - var(--nav-h));
  display: flex; align-items: flex-end; color: #fff; overflow: hidden; isolation: isolate;
  /* SWAP THE IMAGE: replace images/hero.jpg with your own photo (any size; ~2400px wide is ideal).
     If the file is missing, the gradient behind it shows instead. */
  background:
    linear-gradient(180deg, rgba(10,10,14,.15) 0%, rgba(10,10,14,.35) 45%, rgba(10,10,14,.82) 100%),
    url("../images/hero.gif") center / cover no-repeat,
    radial-gradient(1200px 700px at 78% 18%, #5b1220 0%, transparent 60%),
    radial-gradient(900px 600px at 10% 90%, #1d2a44 0%, transparent 65%),
    #0e0f14;
}
.hero-art { position: absolute; inset: 0; z-index: -1; opacity: .5; }
.hero.has-photo .hero-art { display: none; }
.hero .wrap { width: 100%; padding-bottom: clamp(56px, 10vh, 110px); padding-top: 120px; }
.hero .eyebrow { color: #ffb3bd; }
.hero h1 { font-size: clamp(44px, 7.4vw, 92px); line-height: 1.02; max-width: 15ch; margin-bottom: 24px; }
.hero p.lede { font-size: clamp(18px, 2.1vw, 22px); color: rgba(255,255,255,.84); max-width: 640px; margin: 0 0 34px; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; }
.photo-credit { position: absolute; right: 20px; bottom: 16px; font-size: 12px; color: rgba(255,255,255,.55); }

.intro { padding: 96px 0; }
.intro-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 64px; align-items: start; }
.intro h2 { font-size: clamp(30px, 3.6vw, 42px); }
.intro p { color: var(--ink-2); margin: 0 0 18px; font-size: 18px; }
@media (max-width: 860px) { .intro-grid { grid-template-columns: 1fr; gap: 24px; } .intro { padding: 64px 0; } }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; padding-bottom: 104px; }
.tile {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 30px; text-decoration: none; display: flex; flex-direction: column; gap: 10px;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.tile:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 18px 40px -24px rgba(0,0,0,.3); }
.tile .num { font-family: var(--serif); color: var(--accent); font-size: 15px; font-weight: 600; }
.tile h3 { font-size: 23px; }
.tile p { margin: 0; color: var(--ink-2); font-size: 15.5px; }
.tile .more { margin-top: auto; padding-top: 8px; font-size: 14px; font-weight: 600; color: var(--accent); }
@media (max-width: 900px) { .tiles { grid-template-columns: 1fr; padding-bottom: 72px; } }

/* ---------- Research ---------- */
.subnav { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 32px; }
.subnav a {
  font-size: 14px; text-decoration: none; padding: 7px 14px; border-radius: 999px;
  background: var(--chip); color: var(--ink-2);
}
.subnav a:hover { background: var(--accent-soft); color: var(--accent); }
.theme { padding: 96px 0; border-bottom: 1px solid var(--rule); scroll-margin-top: var(--nav-h); }
.theme:last-of-type { border-bottom: 0; }
.theme-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 64px; align-items: center; }
.theme:nth-of-type(even) .theme-media { order: -1; }
.theme .num { font-family: var(--serif); font-size: 18px; color: var(--accent); font-weight: 600; margin-bottom: 10px; display: block; }
.theme h2 { font-size: clamp(30px, 3.6vw, 44px); margin-bottom: 22px; }
.theme p { color: var(--ink-2); margin: 0 0 16px; }
.key-papers { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--rule); }
.key-papers h3 { font-family: var(--sans); font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-3); margin-bottom: 10px; }
.key-papers ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.key-papers li { font-size: 14.5px; color: var(--ink-2); }
.key-papers li i { color: var(--ink-3); }
.figure {
  position: relative; aspect-ratio: 4 / 3; border-radius: calc(var(--radius) + 4px); overflow: hidden;
  background: var(--chip); border: 1px solid var(--rule);
}
.figure img { width: 100%; height: 100%; object-fit: cover; }
.figure .ph {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px;
  color: var(--ink-3); font-size: 13.5px;
}
.figure .ph svg { width: 100%; height: 100%; position: absolute; inset: 0; opacity: .9; }
.figure .ph span { position: relative; background: var(--surface); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--rule); }
.figure.has-img .ph { display: none; }
figcaption { font-size: 13.5px; color: var(--ink-3); margin-top: 12px; }
@media (max-width: 900px) {
  .theme { padding: 64px 0; }
  .theme-grid { grid-template-columns: 1fr; gap: 32px; }
  .theme:nth-of-type(even) .theme-media { order: 0; }
}

/* ---------- People ---------- */
.people-section { padding: 72px 0 24px; }
.people-section h2 { font-size: 32px; margin-bottom: 28px; display: flex; align-items: baseline; gap: 12px; }
.people-section h2 small { font-family: var(--sans); font-size: 14px; color: var(--ink-3); font-weight: 500; }
.pi-card {
  display: grid; grid-template-columns: 300px 1fr; gap: 48px; align-items: center;
  background: var(--surface); border: 1px solid var(--rule); border-radius: calc(var(--radius) + 6px);
  padding: 36px;
}
.pi-card .avatar { aspect-ratio: 4 / 5; border-radius: var(--radius); }
.pi-card h3 { font-size: clamp(30px, 3.4vw, 40px); margin-bottom: 6px; }
.pi-card .role { color: var(--accent); font-weight: 600; margin: 0 0 18px; }
.pi-card p { color: var(--ink-2); margin: 0 0 14px; }
.links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.links a { font-size: 14px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--rule); text-decoration: none; color: var(--ink-2); }
.links a:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 820px) { .pi-card { grid-template-columns: 1fr; gap: 24px; padding: 22px; } .pi-card .avatar { max-width: 320px; } }

.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }
.person {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
}
.person .avatar { aspect-ratio: 1 / 1; border-radius: 0; }
.person .body { padding: 20px 22px 24px; }
.person h3 { font-size: 21px; margin-bottom: 4px; }
.person .role { font-size: 14px; color: var(--accent); font-weight: 600; margin: 0 0 12px; }
.person .year { font-size: 13.5px; color: var(--ink-3); margin: -8px 0 12px; }
.alumni-list .person .year { margin: -2px 0 6px; }
.empty-note { color: var(--ink-3); font-size: 15px; margin: 0; }
.person p.bio { font-size: 15px; color: var(--ink-2); margin: 0; }
.person .now { font-size: 13.5px; color: var(--ink-3); margin: 12px 0 0; }

.avatar { position: relative; overflow: hidden; background: linear-gradient(135deg, var(--accent-soft), var(--chip)); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar .initials {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--serif); font-size: 54px; font-weight: 600; color: var(--accent); opacity: .75;
}
.avatar.has-img .initials { display: none; }

.people-grid.alumni-list { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.alumni-list .person { flex-direction: row; align-items: stretch; }
.alumni-list .person .avatar { width: 112px; flex: none; aspect-ratio: auto; }
.alumni-list .person .avatar .initials { font-size: 32px; }
.alumni-list .person .body { padding: 16px 18px; }
.alumni-list .person h3 { font-size: 18px; }
.alumni-list .person .role { margin-bottom: 6px; }
.alumni-list .person .year { font-size: 13.5px; color: var(--ink-3); margin: -8px 0 12px; }
.alumni-list .person .year { margin: -2px 0 6px; }
.empty-note { color: var(--ink-3); font-size: 15px; margin: 0; }
.person p.bio { font-size: 14px; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; padding: 72px 0 40px; }
.contact-card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 30px;
}
.contact-card .icon {
  width: 46px; height: 46px; border-radius: 14px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; margin-bottom: 18px;
}
.contact-card .icon svg { width: 22px; height: 22px; }
.contact-card h2 { font-family: var(--sans); font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-3); margin-bottom: 8px; }
.contact-card .value { font-size: 19px; font-weight: 500; margin: 0; word-break: break-word; }
.contact-card .value a { text-decoration: none; }
.contact-card .value a:hover { color: var(--accent); }
.contact-card address { font-style: normal; font-size: 17px; line-height: 1.55; }
.join {
  margin: 0 0 104px; padding: 44px; border-radius: calc(var(--radius) + 6px);
  background: var(--ink); color: var(--bg); display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: center;
}
.join h2 { font-size: clamp(28px, 3vw, 36px); margin-bottom: 10px; }
.join p { margin: 0; opacity: .78; }
.join .btn { justify-self: end; }
@media (max-width: 900px) {
  .contact-grid { grid-template-columns: 1fr; padding-top: 48px; }
  .join { grid-template-columns: 1fr; padding: 30px; margin-bottom: 72px; }
  .join .btn { justify-self: start; }
}

/* ---------- Publications ---------- */
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.stat { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 20px; min-width: 132px; }
.stat b { display: block; font-size: 27px; font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--ink-3); }
.scholar-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 22px; font-size: 14px; color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--rule); }
.scholar-link:hover { color: var(--accent); border-color: var(--accent); }
.toolbar {
  position: sticky; top: var(--nav-h); z-index: 5;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.toolbar .wrap { display: flex; gap: 12px; align-items: center; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }
.search { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--rule); border-radius: 999px; padding: 9px 16px; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { flex: none; color: var(--ink-3); }
.search input { border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 15px; width: 100%; }
.seg { display: flex; background: var(--chip); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: 14px; padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.count { font-size: 14px; color: var(--ink-3); white-space: nowrap; }
.years { display: flex; gap: 6px; flex-wrap: wrap; padding: 22px 0 4px; }
.years a { font-size: 13px; text-decoration: none; color: var(--ink-2); background: var(--chip); padding: 4px 10px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.years a:hover { background: var(--accent-soft); color: var(--accent); }
.publist { padding: 12px 0 88px; }
.year-group { display: grid; grid-template-columns: 96px 1fr; gap: 0 28px; padding-top: 28px; scroll-margin-top: calc(var(--nav-h) + 80px); }
.year-label { font-family: var(--serif); font-size: 28px; font-weight: 600; color: var(--ink-3); position: sticky; top: calc(var(--nav-h) + 86px); align-self: start; padding-top: 14px; }
.pubs { list-style: none; margin: 0; padding: 0; }
.pub { padding: 18px 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 1fr auto; gap: 4px 24px; }
.pub:last-child { border-bottom: 0; }
.pub-title { font-family: var(--serif); font-size: 19.5px; line-height: 1.32; font-weight: 600; margin: 0; grid-column: 1; }
.pub-title a { text-decoration: none; background-image: linear-gradient(var(--accent), var(--accent)); background-size: 0 1px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .25s; }
.pub-title a:hover { background-size: 100% 1px; color: var(--accent); }
.pub-authors { grid-column: 1; margin: 0; color: var(--ink-2); font-size: 14.5px; }
.pub-authors strong { color: var(--ink); font-weight: 650; }
.pub-venue { grid-column: 1; margin: 0; color: var(--ink-3); font-size: 14px; font-style: italic; }
.pub-cites { grid-column: 2; grid-row: 1 / span 3; align-self: start; margin-top: 3px; font-size: 12.5px; color: var(--ink-3); text-align: right; white-space: nowrap; text-decoration: none; font-variant-numeric: tabular-nums; }
.pub-cites b { display: block; font-size: 17px; color: var(--ink-2); font-weight: 600; }
a.pub-cites:hover, a.pub-cites:hover b { color: var(--accent); }
mark { background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 2px; }
.flat .year-group { grid-template-columns: 1fr; padding-top: 8px; }
.flat .year-label { display: none; }
.flat .pub-venue::after { content: attr(data-year); font-style: normal; margin-left: 6px; }
.empty { text-align: center; color: var(--ink-3); padding: 64px 0; }
@media (max-width: 640px) {
  .year-group { grid-template-columns: 1fr; }
  .year-label { position: static; padding: 0 0 2px; font-size: 23px; }
  .pub { grid-template-columns: 1fr; }
  .pub-cites { grid-column: 1; grid-row: 4; text-align: left; margin-top: 2px; }
  .pub-cites b { display: inline; font-size: 13px; margin-right: 4px; }
}

/* ---------- News ---------- */
.news-list { list-style: none; margin: 0; padding: 56px 0 104px; max-width: 860px; }
.news-item {
  display: grid; grid-template-columns: 150px 1fr; gap: 8px 36px;
  padding: 30px 0; border-bottom: 1px solid var(--rule);
}
.news-item:first-child { padding-top: 0; }
.news-item:last-child { border-bottom: 0; }
.news-date {
  font-size: 13px; letter-spacing: .12em; text-transform: uppercase; font-weight: 650;
  color: var(--accent); padding-top: 7px; font-variant-numeric: tabular-nums;
}
.news-date span { display: block; color: var(--ink-3); font-weight: 600; letter-spacing: .08em; margin-top: 2px; }
.news-text { font-family: var(--serif); font-size: clamp(21px, 2.3vw, 26px); line-height: 1.35; font-weight: 600; margin: 0; letter-spacing: -.005em; }
.news-text a { color: var(--accent); text-underline-offset: 3px; }
.news-empty { color: var(--ink-3); padding: 56px 0 104px; margin: 0; }
@media (max-width: 640px) {
  .news-item { grid-template-columns: 1fr; gap: 6px; padding: 24px 0; }
  .news-date { padding-top: 0; }
  .news-date span { display: inline; margin: 0 0 0 6px; }
}

/* ---------- Footer ---------- */
.site-foot { border-top: 1px solid var(--rule); padding: 36px 0 44px; color: var(--ink-3); font-size: 14px; }
.site-foot .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
.site-foot nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-foot a { text-decoration: none; }
.site-foot a:hover { color: var(--accent); }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .wrap { padding: 0 20px; }
  .page-head { padding: 56px 0 36px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
