/* ==========================================================================
   QBICON — Quantum Biosciences Consortium
   Clean white layout: logo + lowercase nav in the header, then a fixed
   full-screen stage where scrolling crossfades image (left) and
   headline (right) together.

   Quick knobs:
     --accent      coral used for the active nav link and <em class="accent">
     --header-h    header height
   ========================================================================== */

:root {
  --ink: #1c1c1c;
  --ink-soft: #555;
  --paper: #ffffff;
  --accent: #f18a7f;
  --header-h: 96px;
  --font: "Montserrat", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

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

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  background: var(--paper);
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 36px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.brand img { height: 64px; width: auto; }

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: clamp(20px, 3vw, 44px);
  margin: 0;
  padding: 0;
}

.nav-links a {
  font-size: 1.05rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink);
  transition: color 0.15s ease;
}

.nav-links a:hover { color: var(--accent); }

.nav-links a.is-current { color: var(--accent); }

.nav-toggle { display: none; }

/* --------------------------------------------------------------------------
   Scroll story
   --------------------------------------------------------------------------
   .story        tall scroll track (height set by js/main.js)
   .story-stage  sticky, fills the screen below the header
   .slide        one image + one headline, stacked and crossfaded
   -------------------------------------------------------------------------- */

.story { position: relative; }

.story-stage {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow: hidden;
}

.slide {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: center;
  gap: clamp(24px, 4vw, 64px);
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 36px 48px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.slide.is-active {
  opacity: 1;
  visibility: visible;
}

.slide-figure {
  height: 100%;
  display: flex;
  align-items: center;
}

.slide-figure img {
  width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.slide-text {
  text-align: center;
  padding: 0 clamp(0px, 2vw, 48px);
}

.slide-text h1,
.slide-text h2 {
  font-size: clamp(1.9rem, 4.4vw, 4rem);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0;
}

.slide-text .accent {
  color: var(--accent);
  font-style: italic;
}

.slide-text .sub {
  font-size: clamp(1rem, 1.5vw, 1.3rem);
  color: var(--ink-soft);
  max-width: 44ch;
  margin: 1.6em auto 0;
}

/* --------------------------------------------------------------------------
   Content pages (mission, etc.)
   -------------------------------------------------------------------------- */

.page {
  max-width: 820px;
  margin: 0 auto;
  padding: calc(var(--header-h) + clamp(40px, 8vh, 88px)) 28px clamp(72px, 12vh, 140px);
}

.eyebrow {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1.6em;
}

.statement {
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 0 0 1.4em;
}

.statement .accent,
.prose .accent {
  color: var(--accent);
  font-style: italic;
}

.prose p {
  font-size: 1.08rem;
  font-weight: 400;
  line-height: 1.85;
  color: var(--ink-soft);
  margin: 0 0 1.6em;
}

.callout {
  border-left: 3px solid var(--accent);
  padding: 0.4em 0 0.4em 1.6em;
  margin: 2.4em 0;
}

.callout p {
  font-size: clamp(1.2rem, 1.8vw, 1.45rem);
  line-height: 1.6;
  color: var(--ink);
  margin: 0;
}

.prose .closing {
  font-size: clamp(1.15rem, 1.7vw, 1.35rem);
  line-height: 1.7;
  color: var(--ink);
  margin-bottom: 0;
}

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

.pub-list {
  list-style: none;
  margin: 3em 0 0;
  padding: 0;
}

.pub {
  border-top: 1px solid #e8e8e8;
  padding: 2.2em 0;
}

.pub:last-child { border-bottom: 1px solid #e8e8e8; }

.pub-tags {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 1em;
}

.pub-tag {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  padding: 4px 12px;
}

.pub-date {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.pub-title {
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  font-weight: 500;
  line-height: 1.4;
  margin: 0 0 0.7em;
}

.pub-title a {
  color: var(--ink);
  text-decoration: none;
  transition: color 0.15s ease;
}

.pub-title a:hover { color: var(--accent); }

.pub-authors {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink-soft);
  margin: 0 0 0.6em;
}

.pub-meta {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin: 0;
}

.pub-meta a {
  color: var(--accent);
  text-decoration: none;
}

.pub-meta a:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   Research themes
   -------------------------------------------------------------------------- */

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin: 3em 0;
}

.theme-card {
  border: 1px solid #e8e8e8;
  border-radius: 16px;
  padding: 30px 28px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.theme-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.theme-index {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 1.6em;
}

.theme-card h2 {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 0.7em;
}

.theme-card p {
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--ink-soft);
  margin: 0;
}

.research-note p,
.involve-note p { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Get involved
   -------------------------------------------------------------------------- */

.involve-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin: 3em 0;
}

.involve-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid #e8e8e8;
  border-radius: 16px;
  padding: 34px 30px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.involve-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.involve-card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.7em;
}

.involve-card p {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink-soft);
  margin: 0 0 1.6em;
}

.involve-card .btn-apply { margin-top: auto; }

/* --------------------------------------------------------------------------
   Openings
   -------------------------------------------------------------------------- */

.inline-link {
  color: var(--accent);
  text-decoration: none;
}

.inline-link:hover { text-decoration: underline; }

.openings-list { margin-top: 3em; }

.opening {
  border-top: 1px solid #e8e8e8;
}

.opening:last-child { border-bottom: 1px solid #e8e8e8; }

.opening summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 44px 26px 4px;
  cursor: pointer;
  position: relative;
}

.opening summary::-webkit-details-marker { display: none; }

/* chevron */
.opening summary::after {
  content: "";
  position: absolute;
  right: 12px;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  transform: rotate(45deg);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.opening[open] summary::after {
  transform: rotate(-135deg);
}

.opening summary:hover .opening-title,
.opening summary:hover::after {
  color: var(--accent);
  border-color: var(--accent);
}

.opening-title {
  font-size: clamp(1.1rem, 1.8vw, 1.35rem);
  font-weight: 500;
  color: var(--ink);
  transition: color 0.15s ease;
}

.opening-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.opening-meta span {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border: 1.5px solid #ddd;
  border-radius: 999px;
  padding: 5px 13px;
  white-space: nowrap;
}

.opening-body {
  padding: 4px 4px 34px;
  max-width: 680px;
}

.opening-body p {
  font-size: 1.02rem;
  line-height: 1.8;
  color: var(--ink-soft);
  margin: 0 0 1.3em;
}

.opening-body h3 {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 1.8em 0 0.8em;
}

.opening-body ul {
  margin: 0 0 1.3em;
  padding-left: 1.2em;
}

.opening-body li {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink-soft);
  margin-bottom: 0.5em;
}

.opening-body li::marker { color: var(--accent); }

.opening-apply { margin-top: 2em !important; }

.btn-apply {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 13px 26px;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease;
}

.btn-apply:hover {
  background: #e0705f;
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   People
   -------------------------------------------------------------------------- */

.page--wide { max-width: 1100px; }

.people-section { margin-top: 3.4em; }

.people-section-title {
  font-size: clamp(1.2rem, 2vw, 1.7rem);
  font-weight: 300;
  margin: 0 0 1.4em;
  padding-bottom: 0.6em;
  border-bottom: 1px solid #e8e8e8;
}

.people-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 40px 24px;
}

.person-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font);
  cursor: pointer;
  text-align: center;
}

.person-card img {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid transparent;
  transition: border-color 0.2s ease, transform 0.2s ease;
  margin-bottom: 12px;
}

.person-card:hover img,
.person-card:focus-visible img {
  border-color: var(--accent);
  transform: scale(1.1);
}

.person-name {
  font-size: 1.05rem;
  font-weight: 300;
  color: var(--ink);
}

.person-role {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-soft);
}

/* --- Bio overlay --- */

.person-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.person-modal[hidden] { display: none; }

.person-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 20, 0.45);
}

.person-modal-card {
  position: relative;
  background: var(--paper);
  border-radius: 18px;
  max-width: 520px;
  width: 100%;
  max-height: min(84vh, 720px);
  overflow-y: auto;
  padding: 48px 40px 40px;
  text-align: center;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.25);
}

.person-modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 6px;
}

.person-modal-close:hover { color: var(--ink); }

.person-modal-photo {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 20px;
  border: 3px solid var(--accent);
}

.person-modal-card h3 {
  font-size: 1.0rem;
  font-weight: 300;
  margin: 0 0 0.3em;
}

.person-modal-role {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  margin: 0 0 1.4em;
}

.person-modal-body { text-align: left; }

.person-modal-body .person-affil {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 1.2em;
}

.person-modal-body p {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink-soft);
  margin: 0 0 1.2em;
}

.person-modal-body .person-links {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin: 1.6em 0 0;
}

.person-modal-body .person-links a {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  padding: 8px 18px;
  transition: background 0.15s ease, color 0.15s ease;
}

.person-modal-body .person-links a:hover {
  background: var(--accent);
  color: #fff;
}

/* --------------------------------------------------------------------------
   QBi² page
   --------------------------------------------------------------------------
   Same scroll mechanics as the home story, but the cell illustration
   (.qbi2-figure) stays fixed on the right while the left panels change.
   -------------------------------------------------------------------------- */

.qbi2-figure {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 44%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 48px 48px 0;
}

.qbi2-figure img {
  max-width: 100%;
  max-height: 88%;
  object-fit: contain;
}

/* Panels sit in the left half, over the same scroll track */
.story--qbi2 .slide {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  grid-template-columns: none;
  gap: 0;
  padding: 24px 46% 48px clamp(28px, 6vw, 96px);
}

/* Centered variant for partner / sponsor panels */
.story--qbi2 .qbi2-panel {
  align-items: center;
  text-align: center;
  padding-left: clamp(28px, 4vw, 64px);
}

/* --- Hero panel --- */

.qbi2-hero p { margin: 0; }

.qbi2-kicker {
  font-size: clamp(1rem, 1.4vw, 1.25rem);
  margin-bottom: 0.6em !important;
}

.qbi2-wordmark {
  font-size: clamp(4rem, 8.5vw, 7.5rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0 0 0.35em;
}

.qbi2-wordmark sup {
  font-size: 55%;
  vertical-align: super;
  line-height: 0;
}

.qbi2-subtitle {
  font-size: clamp(1.15rem, 1.8vw, 1.55rem);
  line-height: 1.4;
  max-width: 24ch;
  margin-bottom: 1.4em !important;
}

.qbi2-theme {
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  line-height: 1.5;
  margin-bottom: 1.6em !important;
}

.qbi2-theme .accent {
  font-size: clamp(1.2rem, 1.8vw, 1.5rem);
  color: var(--accent);
  font-style: normal;
}

.qbi2-when {
  font-size: clamp(1.05rem, 1.5vw, 1.3rem);
  margin-bottom: 1.8em !important;
}

.qbi2-site a {
  font-size: clamp(1.05rem, 1.5vw, 1.3rem);
  color: var(--accent);
  text-decoration: none;
}

.qbi2-site a:hover { text-decoration: underline; }

/* --- Partner / sponsor panels --- */

.partner-label {
  font-size: clamp(1.1rem, 1.6vw, 1.4rem);
  font-weight: 500;
  margin: 0 0 0.7em;
}

.partner-logo {
  max-width: min(70%, 560px);
  /* scales up with the window instead of staying pinned at 160px */
  max-height: clamp(160px, 28vh, 320px);
  width: auto;
  height: auto;
}

.sponsor-logos {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(24px, 4vh, 44px);
}

.sponsor-logos img {
  max-width: min(420px, 80vw);
  max-height: 74px;
  width: auto;
  height: auto;
}

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

@media (max-width: 960px) {

  :root { --header-h: 76px; }

  .header-inner { padding: 0 20px; }

  .brand img { height: 46px; }

  .nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
  }

  .nav-toggle-bar {
    width: 24px; height: 2px;
    background: var(--ink);
    transition: transform 0.2s ease;
  }

  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:first-child { transform: translateY(4px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:last-child { transform: translateY(-4px) rotate(-45deg); }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--paper);
    border-bottom: 1px solid #e5e5e5;
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 24px 24px;
    gap: 16px;
  }

  .nav-links.is-open { display: flex; }

  /* Slides stack: image above, text below */
  .slide {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    align-content: center;
    gap: 20px;
    padding: 16px 24px 40px;
  }

  .slide-figure { justify-content: center; min-height: 0; }

  .slide-figure img { max-height: 46vh; }

  /* QBi²: fixed illustration shrinks to a banner above the panels */
  .qbi2-figure {
    right: 0; left: 0;
    bottom: auto;
    width: auto;
    height: 34vh;
    padding: 12px 24px 0;
  }

  .qbi2-figure img { max-height: 100%; }

  .story--qbi2 .slide,
  .story--qbi2 .qbi2-panel {
    padding: calc(34vh + 24px) 24px 40px;
    align-items: center;
    text-align: center;
  }

  /* Openings: stack title above the tags */
  .opening summary {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding-right: 36px;
  }
}

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