/* ==========================================================================
   SPIKE Lab — Johns Hopkins University
   One stylesheet for every page. Colors follow the JHU brand palette.
   ========================================================================== */

:root {
  --heritage: #002d72;      /* JHU Heritage Blue */
  --heritage-deep: #001a45;
  --spirit: #68ace5;        /* JHU Spirit Blue */
  --link: #0b5aa8;
  --ink: #111a2b;
  --text: #2c3545;
  --muted: #5d6778;
  --line: #e1e5ec;
  --rule: #c9d1dd;
  --soft: #f4f6f9;
  --tint: #e9f0fa;

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Type scale — every page uses these, nothing else */
  --fs-banner: clamp(42px, 5.6vw, 64px);   /* h1 in every banner */
  --fs-lead: clamp(18px, 1.8vw, 21px);     /* serif line under the h1 */
  --fs-h2: clamp(26px, 3vw, 32px);         /* section headings */
  --fs-h3: 21px;                           /* card / item titles */
  --fs-body: 17px;
  --fs-small: 16px;                        /* secondary text in cards and lists */
  --banner-pad: clamp(56px, 7vw, 88px);
  --banner-bg:
    radial-gradient(1100px 520px at 88% -10%, rgba(104, 172, 229, 0.3), transparent 62%),
    radial-gradient(900px 480px at -5% 120%, rgba(0, 12, 40, 0.55), transparent 60%),
    linear-gradient(120deg, #003685 0%, #002d72 48%, #00225a 100%);

  --container: 1120px;
  --gutter: clamp(16px, 4vw, 32px);
  --radius: 10px;
  --header-h: 76px;
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, video { display: block; max-width: 100%; height: auto; }

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

p { margin: 0 0 1em; }
h1, h2, h3, .hero-lead, .page-header .lead { text-wrap: balance; }
p:last-child { margin-bottom: 0; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible { outline: 2px solid var(--spirit); outline-offset: 3px; border-radius: 2px; }

.container {
  width: min(var(--container), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: var(--header-h);
}

.brand { display: flex; align-items: center; gap: 18px; min-width: 0; }
.brand a:hover { text-decoration: none; }
.brand-jhu img { height: 36px; width: auto; }
.brand-divider { width: 1px; height: 36px; background: var(--rule); flex: none; }

.brand-lab { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand-mark { height: 40px; width: auto; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong {
  color: var(--heritage);
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-text small { margin-top: 3px; color: var(--muted); font-size: 12.5px; letter-spacing: 0.01em; }

.site-nav { display: flex; align-items: stretch; height: 100%; }
.site-nav a {
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-top: 2px solid transparent;
  border-bottom: 2px solid transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
}
.site-nav a:hover { color: var(--heritage); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--heritage); border-bottom-color: var(--heritage); }

.nav-toggle {
  display: none;
  flex: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--heritage);
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Buttons & small pieces ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn-light { background: #fff; color: var(--heritage); }
.btn-light:hover { background: var(--tint); }
.btn-outline-light { border-color: rgba(255, 255, 255, 0.45); color: #fff; }
.btn-outline-light:hover { border-color: #fff; background: rgba(255, 255, 255, 0.08); }

.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.chip:hover { border-color: var(--heritage); color: var(--heritage); text-decoration: none; }
.chip svg { width: 13px; height: 13px; opacity: 0.6; }

.bullets { margin: 0; padding-left: 1.15em; }
.bullets li { margin-bottom: 6px; padding-left: 2px; }
.bullets li::marker { color: var(--heritage); }

/* ---------- Home hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  background: var(--banner-bg);
  color: rgba(255, 255, 255, 0.86);
}
/* Event-camera-style dots along the banner edges. js/main.js animates them on a canvas;
   the still SVG below shows when scripts are off. */
.hero::before,
.page-header::before,
.banner-canvas {
  content: "";
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  -webkit-mask-image: linear-gradient(90deg, transparent 25%, #000 65%);
  mask-image: linear-gradient(90deg, transparent 25%, #000 65%);
  pointer-events: none;
}
.hero::before,
.page-header::before { background: url("../images/banner-events.svg") right center / cover no-repeat; }
.is-animated::before { display: none; }

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  gap: clamp(40px, 5vw, 64px);
  align-items: center;
  padding-block: var(--banner-pad);
}

.hero-note {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
  padding: 6px 16px 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.hero-note:hover { border-color: rgba(255, 255, 255, 0.55); background: rgba(255, 255, 255, 0.1); text-decoration: none; }
.hero-note::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--spirit);
  box-shadow: 0 0 0 3px rgba(104, 172, 229, 0.28);
}

.hero h1,
.page-header h1 {
  color: #fff;
  font-size: var(--fs-banner);
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.hero h1 { margin-bottom: 16px; }

.acronym {
  margin-bottom: 26px;
  color: rgba(255, 255, 255, 0.8);
  font-size: clamp(16px, 1.4vw, 18px);
  letter-spacing: 0.01em;
}
.acronym .nowrap { white-space: nowrap; }
.acronym b { color: var(--spirit); font-weight: 700; }
.acronym .dot { margin-right: 0.15em; opacity: 0.45; }

.hero-lead,
.page-header .lead {
  max-width: 44em;
  color: rgba(255, 255, 255, 0.88);
  font-family: var(--serif);
  font-size: var(--fs-lead);
  line-height: 1.5;
}
.hero-lead { max-width: 30em; margin-bottom: 32px; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-media { margin: 0; }
.hero-media video {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: #000;
  box-shadow: 0 24px 60px rgba(0, 10, 30, 0.45);
}
.hero-media figcaption { margin-top: 12px; color: rgba(255, 255, 255, 0.62); font-size: 14px; }
.hero-media figcaption a { color: #fff; }

/* ---------- Inner-page banner (matches the home hero) ---------- */

.page-header {
  position: relative;
  overflow: hidden;
  background: var(--banner-bg);
  color: rgba(255, 255, 255, 0.86);
}
.page-header .container {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* same height on every inner page: room for the title plus a two-line lead */
  min-height: calc(2 * var(--banner-pad) + 1.05 * var(--fs-banner) + 16px + 3 * var(--fs-lead));
  padding-block: var(--banner-pad);
}
.page-header .lead { margin-top: 16px; }
.page-header .lead a {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.45);
  text-underline-offset: 3px;
}
.page-header .lead a:hover { text-decoration-color: #fff; }

/* ---------- Sections ---------- */

.section { padding-block: clamp(56px, 7vw, 88px); }
.section:not(.section-soft) + .section:not(.section-soft) { padding-top: 0; }
.section-soft { background: var(--soft); border-block: 1px solid var(--line); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: clamp(28px, 4vw, 40px);
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}
.section-head h2 { font-size: var(--fs-h2); }
.section-head a { flex: none; font-size: 15px; font-weight: 500; }
.section-intro { max-width: 44em; margin: -12px 0 36px; color: var(--muted); }

/* ---------- Principal investigator ---------- */

.profile {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 56px);
  align-items: start;
}
.profile-photo img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 30%;
  border-radius: var(--radius);
}
.profile h3 { font-size: 28px; letter-spacing: -0.015em; }
.profile .role { margin: 6px 0 22px; color: var(--muted); font-size: 17px; }
.profile .bio { max-width: 42em; }

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 24px;
  margin: 26px 0 26px;
  padding: 18px 0;
  border-block: 1px solid var(--line);
  font-size: 16px;
}
.facts dt { color: var(--muted); font-weight: 500; }
.facts dd { margin: 0; color: var(--ink); }

/* ---------- Lab members ---------- */

.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 36px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.person img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--soft);
}
.person h3 { margin-top: 16px; font-size: var(--fs-h3); }
.person h3 a { color: inherit; }
.person h3 a:hover { color: var(--heritage); }
.person-role { margin: 4px 0 0; color: var(--muted); font-size: 15px; }

/* ---------- News ---------- */

.news { margin: 0; padding: 0; list-style: none; }
.news li {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.news li:first-child { padding-top: 4px; }
.news time {
  padding-top: 2px;
  color: var(--muted);
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
}
.news p { font-size: var(--fs-small); }

.news-more summary {
  display: inline-block;
  padding: 16px 0 0;
  color: var(--link);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.news-more summary::-webkit-details-marker { display: none; }
.news-more summary:hover { text-decoration: underline; text-underline-offset: 3px; }
.news-more .when-open, .news-more[open] .when-closed { display: none; }
.news-more[open] .when-open { display: inline; }
.news-more .news li:first-child { padding-top: 22px; }

/* ---------- Research areas (S · P · I · K) ---------- */

.areas { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(20px, 2.5vw, 32px); }
.area-letter {
  display: block;
  margin-bottom: 14px;
  color: var(--heritage);
  font-family: var(--serif);
  font-size: 60px;
  font-weight: 600;
  line-height: 1;
}
.area h3 { margin-bottom: 8px; font-size: var(--fs-h3); }
.area p { color: var(--muted); font-size: var(--fs-small); }

/* ---------- Cards ---------- */

.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.card {
  display: flex;
  flex-direction: column;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.card h3 { margin-bottom: 10px; font-size: var(--fs-h3); }
.card p { color: var(--muted); font-size: var(--fs-small); }
.card .bullets { margin-top: 12px; font-size: var(--fs-small); }
.card .card-link { margin-top: auto; padding-top: 18px; font-size: 15px; font-weight: 600; }
.card .chips { margin-top: auto; padding-top: 20px; }

.card-media {
  margin: -28px -28px 24px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
  background: #0b0f17;
}
.card-media video { width: 100%; height: 100%; object-fit: contain; }
.card-meta {
  margin-bottom: 8px;
  color: var(--link);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.card-accent { border-color: var(--heritage); background: var(--heritage); color: rgba(255, 255, 255, 0.86); }
.card-accent h3 { color: #fff; }
.card-accent p { color: rgba(255, 255, 255, 0.86); }
.card-accent a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.card-accent .bullets li::marker { color: var(--spirit); }

/* ---------- Research page ---------- */

.research-item {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
  padding-block: clamp(48px, 6vw, 72px);
  border-bottom: 1px solid var(--line);
}
.research-item:first-child { padding-top: 0; }
.research-item:last-child { padding-bottom: 0; border-bottom: 0; }
.research-item:nth-child(even) .research-media { order: -1; }
.research-item h2 { margin-bottom: 16px; font-size: var(--fs-h2); }

.research-media { margin: 0; }
.research-media video {
  width: 100%;
  border-radius: var(--radius);
  background: #0b0f17;
}
.research-media figcaption { margin-top: 10px; color: var(--muted); font-size: 14px; }

.topics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 24px;
  margin: 24px 0 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
  font-size: var(--fs-small);
}
.topics li { position: relative; padding-left: 18px; color: var(--ink); }
.topics li::before {
  content: "";
  position: absolute;
  top: 0.66em;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 1px;
  background: var(--spirit);
}

/* ---------- Publications ---------- */

.pub-year {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 32px;
  padding-block: 36px;
  border-top: 1px solid var(--rule);
}
.pub-year:first-child { border-top: 0; padding-top: 0; }
.pub-year > h2 {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  align-self: start;
  color: var(--heritage);
  font-size: var(--fs-h2);
  font-variant-numeric: lining-nums;
}

.pub + .pub { margin-top: 30px; padding-top: 30px; border-top: 1px solid var(--line); }
.pub h3 { margin-bottom: 8px; font-size: var(--fs-h3); line-height: 1.35; }
.pub .authors { margin-bottom: 4px; font-size: var(--fs-small); }
.pub .authors strong { color: var(--ink); font-weight: 600; }
.pub .venue { margin-bottom: 14px; color: var(--muted); font-size: var(--fs-small); font-style: italic; }
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--heritage);
  font-size: 12.5px;
  font-style: normal;
  font-weight: 600;
  vertical-align: 1px;
}
.pub-note { color: var(--muted); font-size: 15px; }

/* ---------- Contact ---------- */

.card-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--tint);
  color: var(--heritage);
}
.card-icon svg { width: 20px; height: 20px; }
.contact-value { color: var(--ink); font-size: 18px; font-weight: 500; }
.card address { color: var(--text); font-size: var(--fs-small); font-style: normal; line-height: 1.7; }

.map {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}
.map iframe { display: block; width: 100%; height: 440px; border: 0; }

/* ---------- Footer ---------- */

.site-footer { background: var(--heritage-deep); color: rgba(255, 255, 255, 0.7); font-size: 15px; }
.site-footer a { color: #fff; }
.footer-main {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 40px;
  padding-block: 56px 44px;
}
.footer-logo { height: 34px; width: auto; margin-bottom: 20px; }
.footer-lab { margin-bottom: 2px; color: #fff; font-family: var(--serif); font-size: 20px; font-weight: 600; }
.site-footer h2 {
  margin-bottom: 14px;
  color: #fff;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.site-footer address { font-style: normal; line-height: 1.7; }
.footer-links { margin: 0; padding: 0; list-style: none; line-height: 2; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, 0.12); }
.footer-bottom .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 20px;
  font-size: 13.5px;
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .brand-text small { display: none; }
}

@media (max-width: 960px) {
  :root { --header-h: 64px; }

  .nav-toggle { display: block; }
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    height: auto;
    padding: 8px 0 12px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 24px rgba(17, 26, 43, 0.08);
  }
  .nav-open .site-nav { display: flex; }
  .site-nav a {
    padding: 12px var(--gutter);
    border: 0;
    border-left: 3px solid transparent;
    font-size: 16px;
  }
  .site-nav a[aria-current="page"] { border-left-color: var(--heritage); background: var(--soft); }

  .hero-inner { grid-template-columns: minmax(0, 1fr); }
  .hero-media { max-width: 640px; }

  .areas { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 40px; }
  .cards { grid-template-columns: minmax(0, 1fr); max-width: 640px; }
  .footer-main { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  body { font-size: 16.5px; }

  .brand { gap: 12px; }
  .brand-jhu img { height: 30px; }
  .brand-divider { height: 30px; }
  .brand-mark { height: 32px; }
  .brand-text strong { font-size: 20px; }
  .brand-text small { display: none; }

  .profile { grid-template-columns: minmax(0, 1fr); }
  .profile-photo { max-width: 240px; }

  .news li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .hero::before, .page-header::before, .banner-canvas {
    opacity: 0.6;
    -webkit-mask-image: linear-gradient(90deg, transparent 45%, #000 90%);
    mask-image: linear-gradient(90deg, transparent 45%, #000 90%);
  }
  .people-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; }

  .research-item { grid-template-columns: minmax(0, 1fr); }
  .research-item:nth-child(even) .research-media { order: 0; }

  .pub-year { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .pub-year > h2 { position: static; }

  .map iframe { height: 340px; }
}

@media (max-width: 480px) {
  .brand-jhu img { height: 26px; }
  .brand-divider { height: 26px; }
  .brand-lab { gap: 8px; }
  .brand-mark { height: 28px; }
  .brand-text strong { font-size: 18px; }
  .areas { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .area { display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: 14px; }
  .area-letter { grid-row: span 2; margin: 0; font-size: 44px; }
  .topics { grid-template-columns: minmax(0, 1fr); }
  .footer-main { grid-template-columns: minmax(0, 1fr); }
  .section-head { flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
