/* ============================================================
   PRIME Lab — stylesheet v2
   Palette inspired by the lab logo: deep blue + vibrant green,
   with an orange accent reserved for small highlights.
   Typography: Poppins (Google Fonts).
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
  /* Palette — derived from logo */
  --color-bg: #ffffff;
  --color-surface: #f6f9fc;
  --color-text: #141826;
  --color-muted: #5f6475;
  --color-border: #e3e7ef;

  --color-primary: #1E5FAA;        /* logo blue */
  --color-primary-dark: #164a85;
  --color-primary-soft: #e8f0fb;

  --color-accent: #3FAE63;         /* logo green */
  --color-accent-dark: #2f8d4d;

  --color-highlight: #F08C1F;      /* logo orange — used sparingly */

  /* Typography */
  --font-sans: "Poppins", "Helvetica Neue", Arial, sans-serif;

  /* Layout */
  --max-width: 1200px;
  --gutter: 1.5rem;
  --radius: 10px;
  --transition: 180ms ease;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

/* Sticky-footer layout: body fills the viewport and main grows to push footer down */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}
/* The last section inside main absorbs any leftover vertical space
   so the footer sits flush at the bottom of the viewport on short pages. */
main > section:last-child {
  flex: 1 0 auto;
}
.site-footer {
  flex-shrink: 0;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-primary); text-decoration: none; transition: color var(--transition); }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.5em;
  color: var(--color-text);
  letter-spacing: -0.01em;
}
h1 { font-size: 3rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.25rem; }

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.section { padding: 5rem 0; }
.section--tight-bottom { padding-bottom: 2.5rem; }
.section--tight-top { padding-top: 2.5rem; }
.section--tight { padding: 3rem 0; }
.section--surface { background: var(--color-surface); }
.text-center { text-align: center; }
.text-primary { color: var(--color-primary); }

/* ---------- Header / Nav ---------- */
.site-header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 128px;
  gap: 2rem;
}
.site-title a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}
.site-logo {
  height: 96px;
  width: 96px;
  object-fit: contain;
  display: block;
}
.site-title__text { display: flex; flex-direction: column; line-height: 1.15; }
.site-title__name {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--color-text);
}
.site-title__affil {
  font-size: 0.8rem;
  color: var(--color-primary);
  font-weight: 500;
  margin-top: 2px;
}

.nav {
  display: flex;
  gap: 1.75rem;
  align-items: center;
}
.nav a {
  color: var(--color-text);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover,
.nav a.is-active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text);
}

/* ---------- Hero ---------- */
.hero {
  padding: 4rem 0 3rem;
  text-align: center;
  position: relative;
}
.hero--banner {
  /* Banner image as background with a soft white overlay for text legibility.
     The gradient fades from near-opaque at the top (keeps eyebrow/title crisp)
     to more transparent at the bottom (banner shows through). */
  background-image:
    linear-gradient(180deg, rgba(255,255,255,0.92) 0%, rgba(255,255,255,0.70) 100%),
    url('../images/banner.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 9rem 0 10rem;
}
.hero__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: 1.75rem;
}
.hero__title {
  font-size: 3.25rem;
  color: var(--color-primary);
  max-width: 30ch;
  margin: 0 auto;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.005em;
}
.hero__lede {
  max-width: 60ch;
  color: var(--color-muted);
  font-size: 1.1rem;
  margin: 1.5rem auto 0;
}
.vision {
  max-width: 60ch;
  margin: 0 auto;
  color: var(--color-text);
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -0.005em;
}
.bridge {
  text-align: center;
  color: var(--color-primary);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 2.5rem;
}

/* ---------- Accent band (mission strip) ---------- */
.accent-band {
  background: var(--color-primary);
  color: #fff;
  text-align: center;
  padding: 5rem 0;
}
.accent-band p {
  max-width: 60ch;
  margin: 0 auto;
  font-size: 1.45rem;
  line-height: 1.7;
  letter-spacing: 0.005em;
  color: #fff;
}
.accent-band .btn { margin-top: 2.5rem; }

/* ---------- Cards / Grid ---------- */
.grid { display: grid; gap: 2rem; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--5 { grid-template-columns: repeat(5, 1fr); }

.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(16, 32, 72, 0.08);
}
.card__title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--color-primary);
}
.card__meta { color: var(--color-muted); font-size: 0.9rem; }

/* ---------- Research area tiles ---------- */
.area {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}
.area__thumb {
  width: 220px;
  height: 220px;
  border-radius: 12px;
  background: var(--color-primary-soft);
  margin: 0 auto 1.75rem;
  object-fit: cover;
  display: block;
  border: 4px solid var(--color-primary-soft);
  transition: transform var(--transition), border-color var(--transition);
}
.area:hover .area__thumb {
  transform: scale(1.03);
  border-color: var(--color-accent);
}
/* Title — reserves space for up to 2 wrapped lines so all three tiles
   align their body text at the same vertical position. */
.area__title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-primary);
  line-height: 1.3;
  min-height: calc(1.25rem * 1.3 * 2);
  margin: 0 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.area__body {
  text-align: left;
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1.7;
  margin: 0 0 1.75rem;
}
.area .btn {
  margin-top: auto;
  align-self: center;
}

/* ---------- Research area detail page: hero with figure + title ---------- */
.area-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3rem;
  align-items: center;
}
.area-hero__thumb {
  width: 320px;
  height: 320px;
  border-radius: 12px;
  object-fit: cover;
  border: 4px solid var(--color-primary-soft);
  display: block;
}
.area-hero__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-accent);
  margin: 0 0 0.75rem;
}
.area-hero__title {
  font-size: 2.5rem;
  color: var(--color-primary);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 1rem;
}
.area-hero__lede {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--color-text);
  margin: 0;
}

/* ---------- Publications-related-to-area block ---------- */
.section--publications { background: var(--color-primary-soft); }
.pub-area-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: grid;
  gap: 0.65rem;
}
.pub-area-item {
  background: #fff;
  border-radius: var(--radius);
  padding: 1rem 1.35rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  box-shadow: 0 2px 10px rgba(16, 32, 72, 0.04);
}
.pub-area-item__citation {
  flex: 1 1 0;
  min-width: 260px;
  color: var(--color-text);
  line-height: 1.5;
}
.pub-area-item .btn {
  flex: 0 0 auto;
}
.pub-area-item__figure {
  flex: 0 0 auto;
  display: block;
  line-height: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--color-primary-soft);
  border: 2px solid transparent;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.pub-area-item__figure img {
  display: block;
  width: auto;
  height: auto;
  max-width: 400px;
  max-height: 280px;
}
.pub-area-item__figure:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 32, 72, 0.10);
}

/* ---------- People grid ---------- */
.person { text-align: center; }
.person__photo {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--color-primary-soft);
  margin: 0 auto 0.75rem;
  object-fit: cover;
}
.person__name { font-weight: 600; }
.person__role { color: var(--color-muted); font-size: 0.9rem; }

/* Clickable person card (People page → bio page) */
.person-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: inherit;
  text-decoration: none;
  padding: 1.25rem 1rem;
  border-radius: var(--radius);
  transition: transform var(--transition), box-shadow var(--transition);
}
.person-card:hover {
  text-decoration: none;
  color: inherit;
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(16, 32, 72, 0.08);
}
.person-card__photo {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: var(--color-primary-soft);
  margin: 0 auto 1rem;
  object-fit: cover;
  display: block;
  border: 4px solid var(--color-primary-soft);
  transition: border-color var(--transition);
}
.person-card:hover .person-card__photo {
  border-color: var(--color-accent);
}
.person-card__name {
  font-weight: 600;
  color: var(--color-primary);
  font-size: 1.05rem;
  margin-bottom: 0.2rem;
}
.person-card__role {
  color: var(--color-muted);
  font-size: 0.95rem;
}

/* Alumni list */
.alumni-list {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  display: grid;
  gap: 1rem;
}
.alumni-list li {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.15rem 1.4rem;
}
.alumni-name {
  font-weight: 600;
  color: var(--color-primary);
  font-size: 1.05rem;
}
.alumni-role {
  color: var(--color-text);
  font-size: 0.95rem;
  margin-top: 0.15rem;
}
.alumni-info {
  color: var(--color-muted);
  font-size: 0.9rem;
  margin-top: 0.35rem;
  font-style: italic;
}

/* Contact links row on bio pages */
.person-links {
  margin: 1.25rem 0 0;
  color: var(--color-muted);
  font-size: 0.95rem;
}
.person-links a { margin-right: 0.5rem; }
.person-links a + a { margin-left: 0.5rem; }

/* ---------- Publication list ---------- */
.pub-list { list-style: none; padding: 0; margin: 0; }
.pub-list li {
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--color-border);
}
.pub-list li:last-child { border-bottom: 0; }
.pub-title { font-weight: 600; }
.pub-authors { color: var(--color-muted); font-size: 0.95rem; }
.pub-venue { font-style: italic; color: var(--color-muted); font-size: 0.9rem; }

/* ---------- News list ---------- */
.news-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1rem;
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--color-border);
}
.news-item__date {
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
}
.news-item:last-child { border-bottom: 0; }

/* ---------- Positions ---------- */
.position {
  padding: 1.75rem;
  background: var(--color-surface);
  border-radius: var(--radius);
  border-left: 4px solid var(--color-primary);
  margin-bottom: 1rem;
}

/* ---------- Funder grid ---------- */
.funder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 195px;
  padding: 0.5rem;
}
.funder img {
  max-height: 165px;
  max-width: 100%;
  width: auto;
  object-fit: contain;
  display: block;
  /* Hides the solid white background on JPG logos by blending with the
     section's light surface. PNGs with transparent backgrounds are unaffected. */
  mix-blend-mode: multiply;
  transition: transform var(--transition);
}
.funder:hover img { transform: scale(1.04); }
.funder__placeholder {
  height: 90px;
  width: 100%;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
  font-size: 0.85rem;
  background: var(--color-bg);
}
.funder__name {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--color-muted);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 0.75rem 1.75rem;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 500;
  border: 0;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.btn:hover {
  background: var(--color-primary-dark);
  text-decoration: none;
  color: #fff;
  transform: translateY(-1px);
}
.btn--ghost {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}
.btn--ghost:hover { background: var(--color-primary); color: #fff; }

.btn--white-ghost {
  background: transparent;
  color: #fff;
  border: 2px solid #fff;
}
.btn--white-ghost:hover { background: #fff; color: var(--color-primary-dark); }

.btn--highlight {
  background: var(--color-highlight);
  color: #fff;
  font-weight: 600;
  padding: 0.85rem 2rem;
  box-shadow: 0 6px 20px rgba(240, 140, 31, 0.35);
}
.btn--highlight:hover {
  background: #d87715;
  color: #fff;
  box-shadow: 0 8px 24px rgba(240, 140, 31, 0.45);
}

.btn--lg {
  padding: 1.3rem 3.25rem;
  font-size: 1.15rem;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 3rem 0;
  color: var(--color-muted);
  font-size: 0.9rem;
  margin-top: 0;
  background: var(--color-surface);
}
.site-footer__inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ============================================================
   Responsive
   - 960px  → tablet / narrow laptop: switch to hamburger nav
              (7 nav items don't fit comfortably above this size)
   - 640px  → phone: tighten padding, collapse grids to 1 column,
              scale down hero/display text
   - 380px  → small phones: final typography trim
   ============================================================ */

/* ----- Tablet & narrow laptop ----- */
@media (max-width: 960px) {
  h1, .hero__title { font-size: 2.2rem; }
  h2 { font-size: 1.6rem; }

  /* Shrink header so sticky nav doesn't dominate the viewport */
  .site-header__inner { min-height: 80px; }
  .site-logo { height: 56px; width: 56px; }
  .site-title__name { font-size: 1.1rem; }

  /* Hamburger nav from tablet width down */
  .nav-toggle { display: block; }
  .nav {
    display: none;
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem var(--gutter);
    gap: 0.75rem;
    box-shadow: 0 8px 20px rgba(16, 32, 72, 0.08);
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 0.5rem 0; }

  /* Grid collapses */
  .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--5 { grid-template-columns: repeat(3, 1fr); }

  /* Section padding */
  .section { padding: 3.5rem 0; }
  .section--tight-bottom { padding-bottom: 1.75rem; }
  .section--tight-top { padding-top: 1.75rem; }

  /* Heroes */
  .hero { padding: 3rem 0 2rem; }
  .hero--banner { padding: 5rem 0 5.5rem; }

  /* Accent band */
  .accent-band { padding: 3.5rem 0; }
  .accent-band p { font-size: 1.2rem; line-height: 1.6; }
  .accent-band .btn { margin-top: 2rem; }

  /* Buttons */
  .btn--lg { padding: 1rem 2.25rem; font-size: 1rem; }

  /* Research index page */
  .vision { font-size: 1.2rem; }
  .bridge { font-size: 1.2rem; margin-bottom: 1.75rem; }
  .area__thumb { width: 180px; height: 180px; }

  /* Research detail page — stack figure above text */
  .area-hero {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    text-align: center;
  }
  .area-hero__thumb {
    margin: 0 auto;
    width: 240px;
    height: 240px;
  }
  .area-hero__title { font-size: 1.9rem; }

  /* Publications list — stack citation above button */
  .pub-area-item {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.25rem 1.35rem;
  }
  .pub-area-item .btn { align-self: flex-start; }
  .pub-area-item__figure { width: 100%; }
  .pub-area-item__figure img { width: 100%; max-width: none; height: auto; max-height: 420px; }

  /* Funders */
  .funder { min-height: 140px; }
  .funder img { max-height: 110px; }
}

/* ----- Phone ----- */
@media (max-width: 640px) {
  :root { --gutter: 1.1rem; }

  h1, .hero__title { font-size: 1.75rem; }
  h2 { font-size: 1.35rem; }
  body { font-size: 15px; }

  /* Compact header */
  .site-header__inner { min-height: 64px; }
  .site-logo { height: 44px; width: 44px; }
  .site-title__name { font-size: 1rem; }
  .site-title__affil { display: none; }
  .site-title a { gap: 0.55rem; }
  .nav { top: 64px; }

  /* Grids → single column (funders remain 2-up for brand recognition) */
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .grid--5 { grid-template-columns: repeat(2, 1fr); }

  /* Sections */
  .section { padding: 2.5rem 0; }
  .section--tight-bottom { padding-bottom: 1.25rem; }
  .section--tight-top { padding-top: 1.25rem; }

  /* Heroes */
  .hero { padding: 2rem 0 1rem; }
  .hero--banner { padding: 3.5rem 0 4rem; }
  .hero__eyebrow { font-size: 0.85rem; letter-spacing: 0.15em; margin-bottom: 1rem; }

  /* Accent band */
  .accent-band { padding: 2.5rem 0; }
  .accent-band p { font-size: 1.05rem; line-height: 1.55; }
  .accent-band .btn { margin-top: 1.5rem; }

  /* Buttons */
  .btn { padding: 0.65rem 1.4rem; font-size: 0.9rem; }
  .btn--lg { padding: 0.85rem 1.75rem; font-size: 0.95rem; }

  /* Research index page */
  .vision { font-size: 1.08rem; line-height: 1.5; }
  .bridge { font-size: 1.1rem; margin-bottom: 1.5rem; }
  .area__thumb { width: 180px; height: 180px; }
  .area__title { font-size: 1.1rem; min-height: 0; }
  .area__body { font-size: 0.95rem; }

  /* Research detail page */
  .area-hero__thumb { width: 200px; height: 200px; }
  .area-hero__title { font-size: 1.6rem; }
  .area-hero__lede { font-size: 1rem; }

  /* Publications */
  .pub-area-item { padding: 1.05rem 1.15rem; gap: 0.9rem; }
  .pub-area-item__citation { font-size: 0.95rem; line-height: 1.55; }

  /* Funders */
  .funder { min-height: 110px; }
  .funder img { max-height: 85px; }

  /* News + footer */
  .news-item { grid-template-columns: 1fr; gap: 0.25rem; }
  .site-footer { padding: 2rem 0; font-size: 0.85rem; }
  .site-footer__inner { flex-direction: column; text-align: center; gap: 0.3rem; }
}

/* ----- Small phones ----- */
@media (max-width: 380px) {
  h1, .hero__title { font-size: 1.55rem; }
  .area-hero__title { font-size: 1.4rem; }
  .grid--5 { grid-template-columns: 1fr; }
  .btn--lg { padding: 0.75rem 1.5rem; }
}
