/* Shared styles for the home page and the section pages (publications.html has its own, from build_pubs.py) */
:root {
  --maroon: #500000;
  --accent: #6d0f0f;
  --bg: #fbfaf8;
  --band: #f3eee7;
  --surface: #ffffff;
  --text: #1e1b18;
  --muted: #625a53;
  --line: #e6e1db;
  --chip: #f4eeea;
  --sky-bg: #14100f; --sky-gold: #ecc062; --sky-text: #f3ede6; --sky-muted: #a89f97;
  --sky-comms: #9e3535; --sky-sense: #3f9a93; --sky-iot: #6f9a5c; --sky-moon: #9a948d;
  --logo-plate: #ffffff;
  --radius: 14px;
  --serif: "EB Garamond", Georgia, serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
/* Dark: follows the system unless the theme picker forces light or dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --maroon: #e7a3a3;
    --accent: #f0b9b9;
    --bg: #151312;
    --band: #1c1917;
    --surface: #1e1b19;
    --text: #ece7e2;
    --muted: #a89f97;
    --line: #322d29;
    --chip: #2a2421;
  }
}
:root[data-theme="dark"] {
  --maroon: #e7a3a3;
  --accent: #f0b9b9;
  --bg: #151312;
  --band: #1c1917;
  --surface: #1e1b19;
  --text: #ece7e2;
  --muted: #a89f97;
  --line: #322d29;
  --chip: #2a2421;
}
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.65 var(--sans);
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--maroon); outline-offset: 3px; border-radius: 4px; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* Navigation */
header.nav {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 76px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 1.35rem; font-weight: 600; color: var(--maroon); text-decoration: none; letter-spacing: .02em; white-space: nowrap; }
.brand img { display: block; width: 30px; height: 30px; border-radius: 7px; flex: none; }
.brand picture { display: block; line-height: 0; }
.brand img.brand-name { width: auto; height: 58px; border-radius: 0; }
.nav ul { display: flex; gap: 22px; list-style: none; margin: 0; padding: 0; overflow-x: auto; min-width: 0; scrollbar-width: none; }
.nav .wrap > nav { min-width: 0; margin-left: auto; }
@media (max-width: 1040px) { .nav ul { gap: 14px; } .nav ul a { font-size: .86rem; } }
@media (max-width: 860px) { .nav ul { gap: 8px; } .nav ul a { font-size: .8rem; } }
.nav ul a { color: var(--muted); text-decoration: none; font-size: .92rem; font-weight: 500; white-space: nowrap; }
.nav ul a:hover { color: var(--maroon); }
/* current section (scroll-spy below): maroon with a short underline; the ul's padding keeps the underline
   inside its scroll box */
.nav ul { padding: 8px 0; }
.nav ul a { position: relative; transition: color .2s; }
.nav ul a.active { color: var(--maroon); }
.nav ul a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -5px; height: 2px; border-radius: 2px; background: var(--maroon); }
.menu-btn { display: none; align-items: center; gap: 8px; font: 600 .9rem var(--sans); color: var(--maroon); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; cursor: pointer; }
.menu-btn::before { content: ""; width: 14px; height: 10px; background: linear-gradient(currentColor 0 0) 0 0/100% 2px no-repeat, linear-gradient(currentColor 0 0) 0 50%/100% 2px no-repeat, linear-gradient(currentColor 0 0) 0 100%/100% 2px no-repeat; }
header.nav.open .menu-btn::before { background: linear-gradient(45deg, transparent 44%, currentColor 44% 56%, transparent 56%), linear-gradient(-45deg, transparent 44%, currentColor 44% 56%, transparent 56%); height: 14px; }

/* Light/dark switch (assets/theme.js); its look comes from the theme alone, so it is right before the script runs */
.theme { position: relative; flex: none; }
.theme-toggle { position: relative; display: block; width: 56px; height: 30px; padding: 0; border-radius: 999px; border: 1px solid var(--line); background: var(--chip); color: var(--muted); cursor: pointer; }
.theme-toggle:hover { border-color: var(--maroon); }
.theme svg { display: block; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tt-ic { position: absolute; inset: 0 8px; display: flex; align-items: center; justify-content: space-between; opacity: .7; }
.tt-knob { position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--maroon); box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s ease; }
.tt-knob .i-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tt-knob { transform: translateX(26px); } :root:not([data-theme="light"]) .tt-knob .i-light { display: none; } :root:not([data-theme="light"]) .tt-knob .i-dark { display: block; } }
:root[data-theme="dark"] .tt-knob { transform: translateX(26px); } :root[data-theme="dark"] .tt-knob .i-light { display: none; } :root[data-theme="dark"] .tt-knob .i-dark { display: block; }
@media (prefers-reduced-motion: reduce) { .tt-knob { transition: none; } }
/* wide screens: the switch sits in the window's top-right corner, outside the 1040 px content column */
@media (min-width: 1200px) { .theme { position: absolute; right: 24px; top: 50%; transform: translateY(-50%); } }

/* Hero */
.hero { padding: 72px 0 48px; display: grid; grid-template-columns: 220px 1fr; gap: 40px; align-items: center; }
.portrait {
  width: 220px; height: 220px; border-radius: 50%; overflow: hidden;
  background: var(--maroon); color: var(--bg);
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 4rem; font-weight: 500; letter-spacing: .04em;
  /* frame: a thin accent ring with a gap of page background */
  box-shadow: 0 0 0 6px var(--bg), 0 0 0 8px var(--maroon);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(2.6rem, 6vw, 3.6rem); line-height: 1.05; margin: 0 0 8px; color: var(--maroon); }
.fellow { font-family: var(--serif); font-style: italic; font-size: 1.2rem; color: var(--muted); margin: 0 0 14px; }
.roles { list-style: none; padding: 0; margin: 0 0 20px; color: var(--text); }
.roles li { margin: 2px 0; }
.roles .inst { color: var(--muted); }
.links { display: flex; flex-wrap: wrap; gap: 6px; }  /* sized so all five fit one line at full width */
.links a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); text-decoration: none; font-size: .9rem; font-weight: 500;
}
.links svg {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.links a:hover { border-color: var(--maroon); color: var(--maroon); }

/* Sections */
section { padding: 44px 0; }
/* Every other section sits on a full-width band, so the change of color marks where a section starts.
   The border-image outset paints past .wrap to the window edges without clipping or widening the page. */
main > .wrap > section:nth-of-type(odd) { border-image: conic-gradient(var(--band) 0 0) fill 0 // 0 100vmax; }
h2 { font-family: var(--serif); font-weight: 500; font-size: 2rem; margin: 0 0 6px; color: var(--maroon); }
.lede { color: var(--muted); margin: 0 0 26px; max-width: 70ch; }
#glance-h + .lede { max-width: 92ch; }
h3 { font-size: 1.05rem; margin: 0 0 6px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-align: center; }
.stat b { display: block; font-family: var(--serif); font-size: 2rem; font-weight: 600; color: var(--maroon); line-height: 1.1; }
.stat > span { color: var(--muted); font-size: .9rem; }
.stat small { display: block; margin-top: 4px; color: var(--muted); font-size: .78rem; }
.path { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.path li { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-left: 3px solid var(--maroon); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }
.path li:not(:last-child)::after { content: "→"; position: absolute; right: -12px; top: 50%; transform: translateY(-50%); color: var(--maroon); font-weight: 600; }
.path time { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; color: var(--maroon); }
.path b { font-size: .9rem; font-weight: 600; }
.path span { color: var(--muted); font-size: .85rem; }
/* The steps come in one by one, each followed by its arrow, when scrolled into view (script near the end) */
@media screen and (prefers-reduced-motion: no-preference) {
  .io .path li { opacity: 0; transform: translateX(-24px);
    transition: opacity .6s ease var(--d, 0s), transform .6s cubic-bezier(.2, .7, .2, 1) var(--d, 0s); }
  .io .path li::after { opacity: 0; transform: translate(-8px, -50%);
    transition: opacity .3s ease calc(var(--d, 0s) + .24s), transform .3s ease calc(var(--d, 0s) + .24s); }
  .io .path li.in { opacity: 1; transform: none; }
  .io .path li.in::after { opacity: 1; transform: translateY(-50%); }
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card p { margin: 0; color: var(--muted); }
.card.area { display: grid; grid-template-columns: 88px 1fr; gap: 18px; align-items: start; }
.card.area .afig { margin: 0; width: 88px; height: 88px; border-radius: 18px; background: var(--chip); }
.card.area .afig img { display: block; width: 100%; height: 100%; object-fit: contain; }
.card.area .abody { align-self: center; }

/* Research banner: AI at the center of a small universe (canvas, script at the end). Always a night sky. */
.sky { margin: 6px 0 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sky-bg); overflow: hidden; }
.sky canvas { display: block; width: 100%; height: 380px; touch-action: pan-y; }
.sky figcaption { padding: 10px 16px 12px; border-top: 1px solid var(--line); background: var(--surface); font-size: .8rem; color: var(--muted); }
@media (max-width: 640px) { .sky canvas { height: 300px; } }

/* Courses */
.courses { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.course { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.course .code { font-weight: 600; color: var(--maroon); letter-spacing: .03em; font-size: .85rem; }
.course h3 { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; line-height: 1.25; }
.course .school { display: flex; align-items: center; gap: 8px; margin-top: -2px; font-weight: 600; font-size: .85rem; letter-spacing: .02em; color: var(--text); }
.course .school::before { content: ""; width: 18px; height: 2px; border-radius: 2px; background: var(--maroon); flex: none; }
.course p { margin: 0; color: var(--muted); font-size: .92rem; flex: 1; }
.tag { align-self: flex-start; font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--chip); color: var(--muted); }
.tag.soon { color: var(--maroon); }
.course a.go { font-weight: 600; text-decoration: none; }
.note { margin-top: 18px; font-size: .9rem; color: var(--muted); }
.courses.past { gap: 14px; }
.courses.past .course { padding: 18px; gap: 6px; }
.course h4 { font-family: var(--serif); font-weight: 500; font-size: 1.12rem; line-height: 1.25; margin: 0; }
.courses.past .course p { font-size: .88rem; }

.roles a, .card.bio a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.roles a:hover, .card.bio a:hover { text-decoration-color: currentColor; }
.honors .timeline li { grid-template-columns: 82px 1fr; font-size: .92rem; }
.honors .timeline time { font-size: .85rem; }
.honors .timeline span { color: var(--muted); }
.honors .timeline b { color: var(--text); font-weight: 600; }
/* Highlights */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 70px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline time { font-weight: 600; color: var(--maroon); }

.contact { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
address { font-style: normal; }


h3.sub { font-family: var(--serif); font-weight: 500; font-size: 1.45rem; color: var(--maroon); margin: 36px 0 14px; }
h3.sub2 { margin-top: 20px; }
.projects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.projects.four { grid-template-columns: repeat(4, 1fr); gap: 16px; }
.project { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.pfig { margin: 0; aspect-ratio: 4 / 3; position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.pfig img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pbody { display: grid; gap: 4px; padding: 14px 16px 16px; align-content: start; min-width: 0; }
.project b { font-weight: 600; }
.project span { color: var(--muted); font-size: .9rem; line-height: 1.5; }
.project em { font-style: normal; font-size: .78rem; font-weight: 600; color: var(--maroon); letter-spacing: .02em; overflow-wrap: anywhere; }
.project:not(:has(.pfig)) .pbody { padding-top: 18px; }
.project b a { color: inherit; text-decoration-color: var(--maroon); }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.gallery figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.gallery img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.gallery figcaption { padding: 10px 14px; font-size: .85rem; color: var(--muted); }
details.allprojects { margin-top: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 20px; }
details.allprojects summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; padding: 14px 0; font-weight: 600; color: var(--maroon); }
details.allprojects summary small { color: var(--muted); font-weight: 500; }
details.allprojects summary { list-style: none; align-items: center; }
details.allprojects summary::-webkit-details-marker { display: none; }
details.allprojects summary::after { content: "Show list"; margin-left: auto; font: 600 .82rem var(--sans); color: var(--maroon); padding: 5px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--chip); }
details.allprojects[open] summary::after { content: "Hide list"; }
details.allprojects summary:hover::after { border-color: var(--maroon); }
details.allprojects summary:focus-visible { outline: 2px solid var(--maroon); outline-offset: 4px; border-radius: 8px; }
details.allprojects h4 { margin: 14px 0 4px; font-family: var(--serif); font-weight: 500; font-size: 1.15rem; color: var(--maroon); }
ul.awards { list-style: none; margin: 0 0 12px; padding: 0; }
ul.awards li { display: grid; grid-template-columns: 1fr auto; gap: 2px 14px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
ul.awards li:last-child { border-bottom: 0; }
.aw-t { font-weight: 500; }
.aw-m { grid-column: 1; color: var(--muted); font-size: .86rem; }
.aw-r { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: .75rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--chip); color: var(--muted); }
.aw-r.pi { color: var(--maroon); }
.sponsors { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.sponsors li { display: flex; flex-direction: column; justify-content: flex-start; align-items: center; gap: 2px; min-height: 76px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-align: center; }
.sponsors b { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; color: var(--maroon); line-height: 1.15; }
.sponsors span { color: var(--muted); font-size: .78rem; }
.sponsors span:empty { display: none; }
.sponsors .logo { display: flex; align-items: center; justify-content: center; height: 86px; margin-bottom: 8px; padding: 6px 4px; align-self: stretch; background: var(--logo-plate); border-radius: 10px; }
.sponsors .logo img.lg { transform: scale(1.15); }
.sponsors .logo img.sm { max-width: 70%; max-height: 44px; }
.sponsors .logo img { max-height: 74px; max-width: 100%; width: auto; height: auto; object-fit: contain; }
img.logo { display: block; height: 60px; width: auto; margin-bottom: 12px; background: #fff; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); }
.stack { display: grid; gap: 16px; }
.stack > h3.team-sub { margin: 20px 0 -2px; }
.stack > h3.team-sub:first-child { margin-top: 4px; }
.lede.one-line { max-width: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .lede.one-line { white-space: normal; } }
ul.people.current { columns: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 44px 40px; margin-bottom: 12px; }
ul.people.alumni { columns: 2; column-gap: 28px; }
ul.people.current li { display: flex; align-items: center; gap: 16px; padding: 0; }
.av { flex: none; width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center;
      background: radial-gradient(circle at 30% 25%, hsl(var(--h) 90% 96%), hsl(var(--h) 70% 84%));
      border: 2px solid hsl(var(--h) 55% 70%);
      font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 2.35rem !important; line-height: 1;
      transition: transform .2s ease; }
ul.people.current li { position: relative; border-radius: 10px; cursor: default; }
ul.people.current li::after {
  content: attr(data-why); position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 4;
  width: max-content; max-width: 240px; padding: 8px 12px; border-radius: 10px;
  background: var(--text); color: var(--bg); font-size: .8rem; line-height: 1.4;
  box-shadow: 0 6px 20px rgb(0 0 0 / .18);
  opacity: 0; transform: translateY(4px); pointer-events: none; transition: opacity .15s ease, transform .15s ease;
}
ul.people.current li:hover::after, ul.people.current li:focus::after, ul.people.current li:focus-visible::after { opacity: 1; transform: none; }
ul.people.current li:focus .av { transform: scale(1.12) rotate(-6deg); }
ul.people.current li:hover .av { transform: scale(1.12) rotate(-6deg); }
@media (prefers-reduced-motion: reduce) { .av { transition: none; } ul.people.current li:hover .av { transform: none; } }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .av { background: radial-gradient(circle at 30% 25%, hsl(var(--h) 35% 34%), hsl(var(--h) 40% 20%)); border-color: hsl(var(--h) 40% 45%); }
}
:root[data-theme="dark"] .av { background: radial-gradient(circle at 30% 25%, hsl(var(--h) 35% 34%), hsl(var(--h) 40% 20%)); border-color: hsl(var(--h) 40% 45%); }
.subnote { margin: -2px 0 14px !important; font-size: .88rem; }  /* small muted line under a card heading */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.who { color: var(--text) !important; font-size: 1rem !important; font-weight: 600; line-height: 1.3; }
.li-link { display: inline-block; vertical-align: 2px; margin-left: 2px; font: 700 .64rem/1 var(--sans); letter-spacing: .02em; text-decoration: none; color: var(--surface); background: var(--maroon); padding: 3px 4px 2px; border-radius: 4px; }
.li-link:hover, .li-link:focus-visible { background: var(--accent); }
.who small { display: block; margin-top: 1px; color: var(--muted); font-family: var(--serif); font-style: italic; font-weight: 400; font-size: .98rem; line-height: 1.25; }
ul.people { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 20px; }
ul.people li { break-inside: avoid; padding: 2px 0; }
ul.people li span { color: var(--muted); font-size: .85rem; }
ul.people.alumni li { padding: 14px 0; color: var(--text); font-size: 1rem; font-weight: 600; line-height: 1.3; }
ul.people.alumni li span { display: block; }
ul.people.alumni li span:not(.edu) { margin: 1px 0 4px; color: var(--muted); font-family: var(--serif); font-style: italic; font-weight: 400; font-size: .98rem; line-height: 1.25; }
.edu { display: block; color: var(--muted); font-weight: 400; font-size: .76rem; line-height: 1.4; }
.who .edu.now { margin-top: 6px; }
.who .edu:not(.now) { padding-left: 8px; border-left: 2px solid var(--line); }
.who .edu.now + .edu { margin-top: 3px; }
.edu.now { color: var(--maroon) !important; font-weight: 600; font-size: .7rem !important; letter-spacing: .06em; text-transform: uppercase; }
.edu.todo { font-style: italic; opacity: .8; }
ul.people li span.edu { font-size: .76rem; }
ul.people.alumni li span.edu { font-size: .78rem; font-weight: 400; padding-left: 8px; border-left: 2px solid var(--line); }
ul.people.alumni li > .edu:first-of-type { margin-top: 4px; }
ul.people.current li { align-items: flex-start; }
ul.people.current .av { margin-top: 2px; }
.card.join { margin-top: 16px; }
.card.join p + p, .card.bio p + p { margin-top: 10px; }
.card.bio p { color: var(--text); }
blockquote.motto { margin: 0 0 10px; font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: var(--text); }

footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: .85rem; }
footer p { margin: 4px 0; }
footer .sig { display: block; margin: 0 0 18px; }
footer .sig img { display: block; width: 320px; max-width: 100%; height: auto; }

@media (max-width: 980px) { .projects, .projects.four { grid-template-columns: repeat(2, 1fr); } .gallery { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 820px) {
  .courses { grid-template-columns: 1fr; }
  .courses.past, .path, ul.people.current { grid-template-columns: repeat(2, 1fr); }
  .path li::after { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
/* below 800 px the nav (plus the theme button) no longer fits: use the Menu button */
@media (max-width: 800px) {
  .nav ul { display: none; }
  .menu-btn { display: inline-flex; }
  header.nav.open ul { display: flex; flex-direction: column; gap: 0; position: absolute; top: 70px; left: 16px; right: 16px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 30px rgba(0,0,0,.12); max-height: calc(100vh - 80px); overflow-y: auto; }
  header.nav.open ul a { display: block; padding: 12px 14px; font-size: 1rem; border-radius: 10px; }
  header.nav.open ul a:hover, header.nav.open ul a:focus-visible { background: var(--chip); }
  header.nav.open ul a.active { background: var(--chip); }
  header.nav.open ul a.active::after { display: none; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .hero { grid-template-columns: 1fr; gap: 24px; padding: 40px 0 32px; text-align: left; }
  .portrait { width: 140px; height: 140px; font-size: 2.6rem; }
  .grid2, .contact { grid-template-columns: 1fr; }
  .card.area { grid-template-columns: 64px 1fr; gap: 14px; }
  .card.area .afig { width: 64px; height: 64px; border-radius: 14px; }
  .projects, .projects.four, .gallery { grid-template-columns: 1fr; }
  ul.people.alumni { columns: 1; }
  .courses.past, .path, ul.people.current { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
}

/* Section pages (body.subpage): each page is one section with its headings one level up (h2 -> h1, h3 -> h2,
   h4 -> h3), so its heading order starts at h1. These rules give the shifted headings their home-page look.
   Their background stays plain (no band). */
.subpage h1 { font-size: clamp(2.3rem, 5vw, 3rem); line-height: 1.1; margin: 0 0 10px; }
/* The title and intro sit on the animated page banner (assets/banner.js), so they get more room. */
.subpage main > .wrap > section:first-of-type { padding-top: 76px; }
.subpage h1 + .lede { margin-bottom: 76px; }
.subpage h2 { font-family: inherit; font-weight: bold; font-size: 1.05rem; color: inherit; margin: 0 0 6px; }
.subpage h3 { font-size: 1em; margin: 1.33em 0; }
.subpage h2.sub { font-family: var(--serif); font-weight: 500; font-size: 1.45rem; color: var(--maroon); margin: 36px 0 14px; }
.subpage h2.sub2 { margin-top: 20px; }
.subpage .course h2 { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; line-height: 1.25; }
.subpage .course h3 { font-family: var(--serif); font-weight: 500; font-size: 1.12rem; line-height: 1.25; margin: 0; }
.subpage details.allprojects h3 { margin: 14px 0 4px; font-family: var(--serif); font-weight: 500; font-size: 1.15rem; color: var(--maroon); }
.subpage .stack > h2.team-sub { margin: 20px 0 -2px; }
.subpage .stack > h2.team-sub:first-child { margin-top: 4px; }
.subpage main > .wrap > section { border-image: none; }

/* Home: Explore, one card per section page */
.explore { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.explore a { display: flex; flex-direction: column; gap: 6px; color: var(--text); text-decoration: none; }
.explore a:hover { border-color: var(--maroon); }
.explore h3 { font-family: var(--serif); font-weight: 500; font-size: 1.35rem; color: var(--maroon); margin: 0; }
.explore .ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--chip); color: var(--maroon); margin-bottom: 6px; transition: transform .2s; }
.explore .ic svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.explore a:hover .ic { transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .explore .ic { transition: none; } }
.explore .go { margin-top: auto; padding-top: 8px; font-size: .9rem; font-weight: 500; color: var(--accent); }
@media (max-width: 820px) { .explore { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .explore { grid-template-columns: 1fr; } }
