/* CABIP website styles.
   Brand colors come from the original site: navy masthead, Harvard crimson.
   The one decorative element is the visible-spectrum line under the header. */

:root {
  --navy: #19226e;
  --navy-deep: #111851;
  --crimson: #a51c30;
  --ink: #1d2030;
  --muted: #5a6075;
  --rule: #dfe3ec;
  --tint: #f3f5f9;
  --paper: #ffffff;

  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.1rem;
  --step-4: 2.6rem;

  --wrap: 72rem;
  --measure: 68ch;
  --gap: clamp(1.25rem, 3vw, 2.5rem);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--serif);
  font-size: var(--step-0);
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  font-optical-sizing: auto;
}

img { max-width: 100%; height: auto; }

a { color: var(--navy); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--crimson); }
:focus-visible { outline: 3px solid #4d7cff; outline-offset: 2px; border-radius: 2px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 0.6em; }
h1 { font-size: var(--step-4); letter-spacing: -0.01em; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gap); }

.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 10;
  background: var(--paper); padding: 0.5rem 1rem; font-family: var(--sans);
}
.skip-link:focus { top: 1rem; }

/* ---------------------------------------------------------------- masthead */
/* The navy band spans the whole window; the banner and menu stay aligned with the
   page content. overflow: hidden keeps the white strip below inside the window. */
.masthead-inner { background: var(--navy); overflow: hidden; }
.masthead-band {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  /* No left padding: the banner's white bar must run flush from the block's left edge. */
  padding: 1rem 1.5rem 0.15rem 0;
}
.brand { display: block; line-height: 0; position: relative; }
/* The banner's white "HARVARD UNIVERSITY" bar continues to the left edge of the window.
   banner-wide.svg is the same artwork with that bar extended 2400 units to the left inside
   the SVG, so the bar is one shape and has no seam. It is drawn right-aligned over the space
   reserved by the (invisible) normal banner; .masthead-inner's overflow: hidden trims it. */
.brand { flex: 0 1 942px; min-width: 0; }        /* up to 942px wide (88px tall), shrinks with the window */
.brand-size { display: block; visibility: hidden; }
.brand-size img { display: block; width: 100%; height: auto; }
.brand-wide { position: absolute; top: 0; right: 0; height: 100%; }
.brand-wide img { display: block; height: 100%; width: auto; max-width: none; }

.nav-toggle {
  display: none;
  font: 500 var(--step--1) var(--sans);
  color: #fff; background: transparent;
  border: 1px solid rgba(255,255,255,0.55); border-radius: 4px;
  padding: 0.45rem 0.8rem; cursor: pointer;
}

.site-nav ul {
  list-style: none; margin: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 2.25rem;
  padding: 0.3rem 1.5rem 0.55rem;
}
.site-nav a {
  font: 500 1rem/1 var(--sans);
  color: rgba(255,255,255,0.86); text-decoration: none;
  display: inline-block; padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: #fff; border-bottom-color: rgba(255,255,255,0.45); }
.site-nav a[aria-current="page"] { color: #fff; border-bottom-color: #fff; }

/* The visible spectrum, ~400 nm to ~700 nm. */
.spectrum {
  height: 4px;
  background: linear-gradient(90deg,
    #6a00c9 0%, #3420ff 11%, #0083ff 24%, #00b8d4 36%, #1fcf5c 48%,
    #b8e000 58%, #ffd000 68%, #ff8a00 80%, #f03a00 90%, #c4001b 100%);
}

/* ---------------------------------------------------------------- page structure */
main { min-height: 50vh; }
.page-head { padding-top: clamp(1.5rem, 3vw, 2.25rem); padding-bottom: 0.75rem; }
.page-head h1 { margin-bottom: 0.25em; }
.crumb { font: 500 var(--step--1) var(--sans); margin-bottom: 0.75rem; }
.crumb a { text-decoration: none; }
.crumb a::before { content: "‹ "; }

.band { padding-block: clamp(2.5rem, 6vw, 4rem); }
.band-tint { background: var(--tint); }

.section-title { font-size: var(--step-2); margin-bottom: 1.25rem; }
.section-title a { color: inherit; text-decoration: none; }
.section-title a:hover { color: var(--crimson); }

.meta {
  font: 400 var(--step--1)/1.45 var(--sans); color: var(--muted);
  margin-bottom: 0.35rem;
}
.text-link { font: 600 var(--step--1) var(--sans); }

.prose { max-width: var(--measure); }
.prose p:last-child { margin-bottom: 0; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose h5, .prose h6 { font: 600 var(--step-1) var(--serif); margin: 1.6em 0 0.5em; }

/* Figures inside research and news articles */
.article { max-width: var(--measure); }
.article::after { content: ""; display: block; clear: both; }
.article figure { margin: 0.4em 0 1.4em; }
.article figure img { display: block; border-radius: 3px; }
.article figcaption {
  font: 400 var(--step--1)/1.5 var(--sans); color: var(--muted); margin-top: 0.6rem;
}
@media (min-width: 900px) {
  .article { max-width: 56rem; }
  .article > p, .article > h5, .article > h6 { max-width: var(--measure); }
  .article figure { float: right; clear: right; width: 40%; margin: 0.4em 0 1.2em 2.5rem; }
}

/* ---------------------------------------------------------------- home */
.hero { padding-block: clamp(2rem, 5vw, 3.5rem) clamp(2.5rem, 6vw, 4rem); }
.hero-grid { display: grid; gap: 2rem var(--gap); align-items: center; }
@media (min-width: 960px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3.5rem; }
}
.hero-text { max-width: 36rem; }
.hero-title {
  font-size: clamp(2rem, 3.6vw, 2.85rem); font-weight: 600; line-height: 1.12;
  letter-spacing: -0.015em; color: var(--navy); margin-bottom: 1.1rem;
}
.hero-lead { font-size: 1.2rem; line-height: 1.55; }
.hero-links { display: flex; flex-wrap: wrap; gap: 0.75rem 1.75rem; margin-top: 1.5rem; }
.hero-links a { font: 600 0.95rem var(--sans); }

.focus-intro { margin-bottom: 0.5rem; }
.focus-list { padding-left: 1.1em; margin: 0 0 2rem; max-width: 60rem; }
@media (min-width: 900px) { .focus-list { columns: 2; column-gap: 3rem; } }
.focus-list li { margin-bottom: 0.5em; break-inside: avoid; }
.focus-list li::marker { color: var(--crimson); }

.carousel { position: relative; }
.carousel-track { display: grid; }
.carousel-slide {
  grid-area: 1 / 1; margin: 0; opacity: 0; visibility: hidden;
  transition: opacity 600ms ease, visibility 0s linear 600ms;
}
.carousel-slide.is-active { opacity: 1; visibility: visible; transition: opacity 600ms ease; }
/* Show each image whole (no cropping). All slides share one grid cell, so the carousel
   is as tall as its tallest image and shorter images are centred in that space. */
.carousel-slide { align-self: center; }
.carousel-slide img { display: block; width: 100%; height: auto; border-radius: 4px; }
.carousel-slide figcaption { font: var(--step--1) var(--sans); color: var(--muted); margin-top: 0.5rem; }
.carousel-dots { display: flex; justify-content: center; gap: 0.6rem; margin-top: 0.9rem; }
.carousel-dots button {
  width: 0.6rem; height: 0.6rem; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--rule);
}
.carousel-dots button[aria-current="true"] { background: var(--navy); }
.carousel-dots button:hover { background: var(--muted); }

.area-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}
.area-link { display: block; text-decoration: none; color: var(--ink); }
.area-link img {
  display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover;
  border-radius: 3px; background: #fff; margin-bottom: 0.75rem;
}
.area-link span { font: 600 var(--step-0)/1.35 var(--serif); }
.area-link:hover span { color: var(--crimson); text-decoration: underline; text-underline-offset: 0.18em; }

.two-col { display: grid; gap: 3rem; }
@media (min-width: 960px) { .two-col { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 4rem; } }

.callout {
  border-left: 4px solid var(--crimson); padding: 0.25rem 0 0.25rem 1.25rem; margin-bottom: 2.5rem;
}
.callout h2 { font-size: var(--step-1); margin-bottom: 0.4rem; }
.callout ul { padding-left: 1.1em; margin: 0; }
.callout li { margin-bottom: 0.3em; }

.news-mini { list-style: none; padding: 0; margin: 0; }
.news-mini li { padding: 0.9rem 0; border-top: 1px solid var(--rule); line-height: 1.4; }
.news-mini a { text-decoration: none; font-weight: 600; }
.news-mini a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- publications */
.pub-list { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.pub {
  display: grid; grid-template-columns: 12.5rem minmax(0, 1fr); gap: 1.75rem; align-items: start;
  padding: 1.5rem 0; border-top: 1px solid var(--rule);
}
.pub:first-child { border-top: 0; padding-top: 0; }
/* Every cover/logo is the same width; its height follows the image. */
.pub-thumb { display: block; width: 100%; height: auto; box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15); }
/* Placeholder for publications without an image: keeps alignment, no shadow. */
.pub-thumb-empty { display: block; box-shadow: none; }
/* Journal logos saved as white SVGs need a dark backdrop */
.pub-thumb[src$=".svg"] { background: var(--navy); padding: 6px; }
.pub p { margin: 0; }
.pub-title { font-weight: 600; line-height: 1.4; margin-bottom: 0.3rem !important; max-width: 62ch; }
.pub-title a { text-decoration: none; }
.pub-title a:hover { text-decoration: underline; }
.pub-authors { font: 400 0.95rem/1.5 var(--serif); color: var(--muted); max-width: 75ch; }
.pub-citation { font-size: 0.95rem; color: var(--ink); margin-top: 0.2rem !important; }
.pub-list-compact .pub-authors { display: none; }
.pub-list-compact .pub { grid-template-columns: 5.5rem minmax(0, 1fr); gap: 1.25rem; }

.year-block { display: grid; gap: 0.5rem 2rem; padding: 1.75rem 0; border-top: 2px solid var(--navy); }
.year-block:first-child { border-top: 0; padding-top: 0; }
.year { font-size: var(--step-3); font-weight: 400; color: var(--navy); margin: 0; font-variant-numeric: lining-nums; }
@media (min-width: 900px) {
  .year-block { grid-template-columns: 7rem minmax(0, 1fr); }
  .year { position: sticky; top: 1rem; align-self: start; }
}

/* ---------------------------------------------------------------- people */
.people-group { padding-bottom: 3rem; }
.group-title {
  font-size: var(--step-2); padding-bottom: 0.6rem; margin-bottom: 1.75rem;
  border-bottom: 2px solid var(--navy);
}
.person-photo {
  display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: center 20%;
  border-radius: 3px; background: var(--tint); margin-bottom: 0.9rem;
}
.person-photo-empty {
  display: flex; align-items: center; justify-content: center;
  font: 600 2rem var(--sans); color: var(--navy); opacity: 0.6;
}
.person-name { font-size: var(--step-1); margin-bottom: 0.3rem; }
.person-name a { text-decoration: none; }
.person-name a:hover { text-decoration: underline; }
.person-role { font: 400 0.95rem/1.45 var(--serif); color: var(--muted); margin-bottom: 0.6rem; }

/* One row per person, full bio visible (as on the original site). */
.person-row {
  display: grid; gap: 1rem 2.5rem; align-items: start;
  padding: 2rem 0; border-top: 1px solid var(--rule);
}
.person-row:first-child { border-top: 0; padding-top: 0; }
.person-row .person-photo { margin-bottom: 0; }
.person-text .prose { max-width: 76ch; }
.person-email { font: 400 0.95rem var(--sans); margin-top: 0.75rem; }
@media (min-width: 760px) {
  .person-row { grid-template-columns: 10rem minmax(0, 1fr); }
  .people-list-single .person-row { grid-template-columns: 13rem minmax(0, 1fr); }
}
@media (max-width: 759px) {
  /* On phones the text wraps under the photo instead of staying in a narrow column. */
  .person-row { display: block; }
  .person-row::after { content: ""; display: block; clear: both; }
  .person-row .person-photo { float: left; width: 6.5rem; margin: 0.3rem 1rem 0.5rem 0; }
  .person-text .prose { font-size: 0.97rem; }
}

.people-grid {
  display: grid; gap: 2.5rem 2rem; align-items: start;
  grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
}

.person-feature { display: grid; gap: 1.5rem 2.5rem; align-items: start; }
.person-feature .prose { max-width: 76ch; }
.person-feature .person-photo { max-width: 18rem; }
/* Narrower photo column: the source photos are small, and the bio gets more room. */
@media (min-width: 760px) { .person-feature { grid-template-columns: 13rem minmax(0, 1fr); } }

.bio summary {
  font: 600 var(--step--1) var(--sans); color: var(--navy); cursor: pointer;
  list-style: none; display: inline-flex; align-items: center; gap: 0.35rem;
}
.bio summary::-webkit-details-marker { display: none; }
.bio summary::after { content: "+"; font-weight: 400; font-size: 1.1em; }
.bio[open] summary::after { content: "–"; }
.bio summary:hover { color: var(--crimson); }
.bio .prose { font-size: 0.97rem; margin-top: 0.75rem; }

/* ---------------------------------------------------------------- research list */
.area-row {
  display: grid; gap: 1.25rem 3rem; padding: 2.25rem 0; border-top: 1px solid var(--rule);
}
.area-row:first-child { border-top: 0; padding-top: 0.5rem; }
.area-row-img img {
  display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: contain;
  background: var(--tint); border-radius: 3px;
}
.area-row h2 { font-size: var(--step-2); }
.area-row h2 a { text-decoration: none; color: var(--ink); }
.area-row h2 a:hover { color: var(--crimson); }
.area-row-text { max-width: var(--measure); }
@media (min-width: 860px) { .area-row { grid-template-columns: 22rem minmax(0, 1fr); } }

.related { margin-top: 3.5rem; padding-top: 1.5rem; border-top: 2px solid var(--navy); max-width: var(--measure); }
.related h2 { font-size: var(--step-1); }
.related ul { padding-left: 1.1em; }

/* ---------------------------------------------------------------- positions */
.position-list { list-style: none; padding: 0; margin: 2rem 0 0; max-width: var(--measure); }
.position-list li { border-top: 1px solid var(--rule); }
.position-list li:last-child { border-bottom: 1px solid var(--rule); }
.position-list a {
  display: block; padding: 1.1rem 0; font-size: var(--step-1); font-weight: 600; text-decoration: none;
}
.position-list a:hover { text-decoration: underline; }
.empty { color: var(--muted); }

/* ---------------------------------------------------------------- news */
.news-item {
  display: grid; gap: 1.25rem 2.5rem; padding: 2.5rem 0; border-top: 1px solid var(--rule);
  align-items: start;
}
.news-item:first-child { border-top: 0; padding-top: 0.5rem; }
/* Every news image is the same width; its height follows the image. */
.news-media { max-width: 26rem; }
.news-media img { display: block; width: 100%; height: auto; }
.news-text { max-width: var(--measure); }
.news-text h2 { font-size: var(--step-2); }
.news-text h2 a { color: var(--ink); text-decoration: none; }
.news-text h2 a:hover { color: var(--crimson); text-decoration: underline; }
.news-text .prose { margin-bottom: 1rem; }
@media (min-width: 860px) { .news-item { grid-template-columns: 26rem minmax(0, 1fr); } }

.video { position: relative; aspect-ratio: 16 / 9; max-width: 40rem; margin: 1rem 0 1.25rem; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 3px; }

/* ---------------------------------------------------------------- contact */
.contact-form { max-width: 36rem; font-family: var(--sans); }
.field { margin-bottom: 1.25rem; }
.field label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 0.35rem; }
.optional { font-weight: 400; color: var(--muted); }
.field input, .field textarea {
  width: 100%; font: 400 1rem/1.5 var(--sans); color: var(--ink);
  padding: 0.65rem 0.75rem; border: 1px solid #b9bfcc; border-radius: 4px; background: #fff;
}
.field input:focus, .field textarea:focus { border-color: var(--navy); outline: 3px solid rgba(25, 34, 110, 0.18); outline-offset: 0; }
.has-error input, .has-error textarea { border-color: var(--crimson); }
.error { color: var(--crimson); font-size: 0.9rem; margin: 0.35rem 0 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.button {
  font: 600 1rem var(--sans); color: #fff; background: var(--navy);
  border: 0; border-radius: 4px; padding: 0.75rem 1.4rem; cursor: pointer;
}
.button:hover { background: var(--navy-deep); }
.notice { border-left: 4px solid var(--navy); padding: 0.5rem 0 0.5rem 1.25rem; max-width: var(--measure); }

/* ---------------------------------------------------------------- footer */
.site-footer {
  margin-top: 4rem; background: var(--navy-deep); color: rgba(255,255,255,0.8);
  font: 400 0.92rem/1.6 var(--sans); padding-top: 2.5rem;
}
.site-footer a { color: rgba(255,255,255,0.85); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-grid { display: grid; gap: 1.5rem 3rem; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: minmax(0, 1fr) auto; } }
.footer-name { font: 600 1.05rem var(--serif); color: #fff; margin-bottom: 0.35rem; }
.footer-links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; align-content: start; }
.footer-copy { padding-block: 1.5rem; margin: 1.5rem auto 0; border-top: 1px solid rgba(255,255,255,0.15); font-size: 0.85rem; }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 760px) {
  body { font-size: 1rem; }
  h1 { font-size: var(--step-3); }
  .masthead-band { padding: 0.75rem 0.9rem 0.75rem 0; }
  .site-nav ul { padding-inline: 0.9rem; }
  .brand { flex-basis: 385px; } /* phone banner: 60px tall */
  .nav-toggle { display: inline-block; flex-shrink: 0; }
  .js .site-nav { display: none; }
  .js .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; padding-top: 0; padding-bottom: 0.5rem; }
  .site-nav a { display: block; padding: 0.8rem 0; border-bottom: 1px solid rgba(255,255,255,0.14); }
  .site-nav a[aria-current="page"] { border-bottom-color: rgba(255,255,255,0.14); box-shadow: inset 3px 0 0 #fff; padding-left: 0.75rem; }
  .people-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem 1rem; }
  .pub { grid-template-columns: 7.5rem minmax(0, 1fr); gap: 1rem; }
  .pub-list-compact .pub { grid-template-columns: 5.5rem minmax(0, 1fr); gap: 1rem; }
}
@media (max-width: 760px) {
  .person-feature .person-photo { max-width: 12rem; }
  .person-name { font-size: 1.05rem; }
  .person-role { font-size: 0.9rem; }
}
@media (max-width: 340px) {
  .people-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .carousel-slide, .carousel-slide.is-active { transition: none; }
}

@media print {
  .masthead, .site-footer, .carousel-dots, .nav-toggle { display: none; }
  .bio[open], .bio { display: block; }
}
