/* =========================================================================
   Papoutsakis Lab — Design System
   Plain CSS. Light/dark via [data-theme]. UD Blue + Gold identity.
   ========================================================================= */

/* ----- Design tokens ----- */
:root {
  /* Brand */
  --ud-blue: #00539f;
  --ud-blue-700: #013e78;
  --ud-blue-300: #4d8fc9;
  --ud-gold: #ffd200;
  --ud-gold-600: #e0b800;

  /* Team accent colors */
  --team-mic: #1f8f68; /* Microbial team */
  --team-mam: #7b5cc4; /* Mammalian team */

  /* Light theme surfaces & text */
  --bg: #ffffff;
  --bg-alt: #f4f6fa;
  --bg-elevated: #ffffff;
  --surface-border: #e5e9f0;
  --text: #10233b;
  --text-muted: #51607a;
  --text-faint: #7a889f;

  --primary: var(--ud-blue);
  --primary-strong: var(--ud-blue-700);
  --accent: var(--ud-gold);
  --on-primary: #ffffff;

  --ring: rgba(0, 83, 159, 0.35);
  --shadow-sm: 0 1px 2px rgba(16, 35, 59, 0.06), 0 1px 3px rgba(16, 35, 59, 0.08);
  --shadow-md: 0 6px 20px rgba(16, 35, 59, 0.10);
  --shadow-lg: 0 18px 48px rgba(16, 35, 59, 0.16);

  /* Type */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Source Serif 4", "Newsreader", Georgia, "Times New Roman", serif;

  /* Layout */
  --maxw: 1140px;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 66px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

:root[data-theme="dark"] {
  --bg: #0c1420;
  --bg-alt: #111c2c;
  --bg-elevated: #16233a;
  --surface-border: #24344d;
  --text: #eaf1fb;
  --text-muted: #a9b8d0;
  --text-faint: #7e8fab;

  --primary: #4d94d6;
  --primary-strong: #7fb4e6;
  --accent: var(--ud-gold);
  --on-primary: #06182c;

  --team-mic: #37c495;
  --team-mam: #a98ceb;

  --ring: rgba(120, 180, 230, 0.45);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 22px 55px rgba(0, 0, 0, 0.55);
}

/* ----- Reset / base ----- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-serif); line-height: 1.15; color: var(--text); font-weight: 600; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.1rem, 1.4rem + 3vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem); }
h3 { font-size: 1.28rem; }
p { margin: 0 0 1rem; }
::selection { background: var(--accent); color: #10233b; }

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

/* ----- Layout helpers ----- */
.container { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(48px, 7vw, 96px); }
.section--alt { background: var(--bg-alt); }
.section__head { max-width: 720px; margin-bottom: 2.5rem; }
.eyebrow {
  font-family: var(--font-sans); font-weight: 700; font-size: 0.78rem;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--primary);
  margin: 0 0 0.7rem;
}
.lead { font-size: 1.16rem; color: var(--text-muted); }
.muted { color: var(--text-muted); }
.center { text-align: center; }
.mx-auto { margin-inline: auto; }
[hidden] { display: none !important; }

/* ----- Skip link ----- */
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--primary); color: var(--on-primary);
  padding: 10px 16px; border-radius: 8px; transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }

/* ----- Header / nav ----- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--surface-border);
}
.nav {
  display: flex; align-items: center; gap: 1rem;
  height: var(--header-h);
}
.brand { display: flex; align-items: center; gap: 0.65rem; margin-right: auto; font-weight: 700; color: var(--text); flex: none; }
.brand:hover { text-decoration: none; }
.brand__logo { width: 40px; height: 40px; flex: none; overflow: visible; }
.brand__rod rect { fill: var(--team-mic); }
.brand__cell > circle:first-child { fill: var(--team-mam); }
.brand__nucleus { fill: var(--bg); }
.brand__ev { fill: var(--ud-gold); }
.brand__logo > * { transform-box: fill-box; transform-origin: center; transition: transform 0.45s var(--ease); }
.brand:hover .brand__rod--a, .brand:focus-visible .brand__rod--a { transform: rotate(18deg); }
.brand:hover .brand__rod--b, .brand:focus-visible .brand__rod--b { transform: rotate(-18deg); }
.brand:hover .brand__cell--a, .brand:focus-visible .brand__cell--a { transform: translate(1.5px, -1.5px); }
.brand:hover .brand__cell--b, .brand:focus-visible .brand__cell--b { transform: translate(-1.5px, 1.5px); }
.brand:hover .brand__ev, .brand:focus-visible .brand__ev { transform: scale(1.35); }

/* Footer: "Mammalian × Microbial" unfolds inside the name while hovered. */
.brand__m2 { display: inline-flex; align-items: baseline; white-space: nowrap; }
.brand__m2-long {
  display: inline-block; max-width: 0; opacity: 0; overflow: hidden; vertical-align: bottom;
  transition: max-width 0.5s var(--ease), opacity 0.35s var(--ease) 0.08s;
}
.brand:hover .brand__m2-long, .brand:focus-visible .brand__m2-long { max-width: 13em; opacity: 1; }
/* Header: the subtitle swaps to "Mammalian × Microbial". */
.brand--header .brand__sub { display: grid; overflow: hidden; }
.brand--header .brand__sub > span { grid-area: 1 / 1; transition: transform 0.4s var(--ease), opacity 0.3s var(--ease); }
.brand--header .brand__sub-m2 { transform: translateY(100%); opacity: 0; font-weight: 600; }
.brand--header:hover .brand__sub-default, .brand--header:focus-visible .brand__sub-default { transform: translateY(-100%); opacity: 0; }
.brand--header:hover .brand__sub-m2, .brand--header:focus-visible .brand__sub-m2 { transform: none; opacity: 1; }
.m2-mam { color: var(--team-mam); }
.m2-mic { color: var(--team-mic); }
.m2-x { color: var(--ud-gold-600); font-weight: 600; }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__name { font-size: 1.02rem; white-space: nowrap; }
.brand__sub { font-size: 0.72rem; font-weight: 500; color: var(--text-faint); letter-spacing: 0.02em; white-space: nowrap; }
/* Very narrow phones: drop the subtitle so the name never crowds the toggles. */
@media (max-width: 400px) { .brand__sub { display: none; } }

.nav__links { display: flex; align-items: center; gap: 0.15rem; list-style: none; margin: 0; padding: 0; }
.nav__links a {
  display: inline-block; padding: 0.5rem 0.8rem; border-radius: var(--radius-pill);
  color: var(--text-muted); font-weight: 500; font-size: 0.96rem; white-space: nowrap;
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.nav__links a:hover { color: var(--text); background: var(--bg-alt); text-decoration: none; }
.nav__links a.is-active { color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }

.nav__tools { display: flex; align-items: center; gap: 0.4rem; }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--radius-pill);
  display: grid; place-items: center; cursor: pointer;
  background: transparent; border: 1px solid var(--surface-border); color: var(--text-muted);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--primary); }
.icon-btn svg { width: 19px; height: 19px; }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }

.nav__burger { display: none; }

/* ----- Buttons ----- */
.btn {
  --bg-btn: var(--primary);
  display: inline-flex; align-items: center; gap: 0.5rem;
  font: inherit; font-weight: 600; font-size: 0.98rem;
  padding: 0.72rem 1.35rem; border-radius: var(--radius-pill);
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  background: var(--bg-btn); color: var(--on-primary);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s var(--ease), box-shadow 0.2s var(--ease), background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); text-decoration: none; background: var(--primary-strong); }
.btn:active { transform: translateY(0); }
.btn--ghost {
  background: transparent; color: var(--text); border-color: var(--surface-border);
  box-shadow: none;
}
.btn--ghost:hover { background: var(--bg-alt); border-color: var(--primary); color: var(--primary); }
.btn--gold { background: var(--accent); color: #10233b; }
.btn--gold:hover { background: var(--ud-gold-600); }
.btn--sm { padding: 0.5rem 1rem; font-size: 0.9rem; }
.btn svg { width: 18px; height: 18px; }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.8rem; }

/* ----- Hero ----- */
.hero {
  position: relative; overflow: hidden;
  padding-block: clamp(64px, 10vw, 128px);
  background:
    radial-gradient(1100px 520px at 82% -12%, color-mix(in srgb, var(--ud-blue) 26%, transparent), transparent 60%),
    radial-gradient(760px 460px at 6% 108%, color-mix(in srgb, var(--ud-gold) 20%, transparent), transparent 55%),
    var(--bg-alt);
  border-bottom: 1px solid var(--surface-border);
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background-image: radial-gradient(currentColor 1px, transparent 1px);
  background-size: 26px 26px; color: color-mix(in srgb, var(--text) 6%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 40%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 40%, transparent);
}
.hero__inner { position: relative; max-width: 780px; }
/* Animated header art (inner pages): a stirred-bioreactor flow field. */
.hero__art { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; animation: hero-art-in 1.2s var(--ease) both; }
@keyframes hero-art-in { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 720px) { .hero__art { opacity: 0.55; } }
.hero .badge { margin-bottom: 1.3rem; }
.hero h1 { margin-bottom: 1rem; }
.hero__pi { font-size: 1.05rem; color: var(--text-muted); margin-bottom: 1.7rem; }
.hero__pi strong { color: var(--text); }

/* Hero variant: group-photo background (home page).
   Uses a fixed dark treatment so text stays legible in both themes.
   Drop the photo at assets/img/group/group-photo.jpg — until then the
   solid navy fallback keeps the hero looking intentional. */
.hero--photo {
  min-height: min(86vh, 820px);
  display: flex;
  align-items: flex-end;              /* text sits low, faces stay up top */
  padding-block: clamp(2rem, 5vw, 3.5rem) clamp(1.25rem, 3vw, 2.25rem);
  border-bottom: 1px solid var(--surface-border);
  /* One top-to-bottom gradient over the whole photo: clear at the top (faces
     visible), darkening toward the bottom where the text sits. */
  background:
    linear-gradient(to top,
      rgba(6, 18, 36, 0.95) 0%,
      rgba(6, 18, 36, 0.88) 22%,
      rgba(6, 18, 36, 0.66) 40%,
      rgba(6, 18, 36, 0.34) 54%,
      rgba(6, 18, 36, 0.08) 72%,
      rgba(6, 18, 36, 0) 88%),
    #0a1a30 url("../img/group/group-photo.jpg") center 32% / cover no-repeat;
}
.hero--photo::after { display: none; } /* remove the dot pattern over the photo */
.hero--photo .hero__inner { max-width: 900px; }  /* wider so the block is shorter/lower */
.hero--photo h1,
.hero--photo .hero__pi strong { color: #fff; }
.hero--photo .lead,
.hero--photo .hero__pi { color: rgba(255, 255, 255, 0.94); }
/* Legibility on the lighter mid-band: a tight shadow for crisp edges plus a
   soft halo, so the text stays sharp without darkening the whole photo. */
.hero--photo h1 { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6), 0 2px 24px rgba(6, 18, 36, 0.6); }
.hero--photo .lead,
.hero--photo .hero__pi { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55), 0 1px 16px rgba(6, 18, 36, 0.55); }
.hero--photo .badge {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.hero--photo .btn--ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.08);
}
.hero--photo .btn--ghost:hover { background: rgba(255, 255, 255, 0.18); border-color: #fff; color: #fff; }
@media (max-width: 720px) {
  .hero--photo { min-height: 0; padding-block: clamp(64px, 14vw, 104px); }
}

.badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.9rem; border-radius: var(--radius-pill);
  background: var(--bg-elevated); border: 1px solid var(--surface-border);
  font-size: 0.83rem; font-weight: 600; color: var(--text-muted); box-shadow: var(--shadow-sm);
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }

/* ----- Cards & grids ----- */
.grid { display: grid; gap: 1.4rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.card {
  background: var(--bg-elevated); border: 1px solid var(--surface-border);
  border-radius: var(--radius); padding: 1.6rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease);
}
.card--link:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--primary) 45%, var(--surface-border)); }
.card h3 { margin-bottom: 0.5rem; }
.card p:last-child { margin-bottom: 0; }
.card__icon {
  width: 48px; height: 48px; border-radius: 12px; margin-bottom: 1rem;
  display: grid; place-items: center; color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}
.card__icon svg { width: 26px; height: 26px; }
.card__more { display: inline-flex; align-items: center; gap: 0.35rem; margin-top: 0.9rem; font-weight: 600; font-size: 0.95rem; }
.card__more svg { width: 16px; height: 16px; transition: transform 0.2s var(--ease); }
.card--link:hover .card__more svg { transform: translateX(4px); }

/* ----- Research detail sections ----- */
.research-block { padding-block: clamp(36px, 6vw, 72px); border-bottom: 1px solid var(--surface-border); }
.research-block:last-child { border-bottom: none; }
.research-block__grid { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; }
.research-block ul { margin: 0; padding-left: 1.15rem; }
.research-block li { margin-bottom: 0.6rem; }

/* ----- Stats ----- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.stat { text-align: center; padding: 1.4rem 1rem; border-radius: var(--radius); background: var(--bg-elevated); border: 1px solid var(--surface-border); }
.stat__num { font-family: var(--font-serif); font-size: 2.4rem; font-weight: 700; color: var(--primary); line-height: 1; }
.stat__label { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.4rem; }

/* ----- Publications ----- */
.pub-toolbar {
  display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center;
  margin-bottom: 1.4rem;
}
.search-field { position: relative; flex: 1 1 260px; }
.search-field svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-faint); pointer-events: none; }
.search-field input {
  width: 100%; font: inherit; padding: 0.7rem 1rem 0.7rem 2.6rem;
  border-radius: var(--radius-pill); border: 1px solid var(--surface-border);
  background: var(--bg-elevated); color: var(--text);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.search-field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.select {
  font: inherit; padding: 0.7rem 2.2rem 0.7rem 1rem; color: var(--text);
  border-radius: var(--radius-pill); border: 1px solid var(--surface-border);
  background: var(--bg-elevated); cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2351607a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.85rem center;
}
.pub-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; align-items: center; font-size: 0.88rem; color: var(--text-muted); margin-bottom: 2rem; }
.pub-meta .status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); display: inline-block; margin-right: 0.4rem; }
.pub-meta .status-dot.is-live { background: #2fbf71; box-shadow: 0 0 0 4px color-mix(in srgb, #2fbf71 25%, transparent); }

.pub-year-group { margin-bottom: 2.4rem; }
.pub-year-group__label {
  font-family: var(--font-serif); font-size: 1.5rem; font-weight: 700; color: var(--text);
  display: flex; align-items: baseline; gap: 0.7rem;
  padding-bottom: 0.5rem; margin-bottom: 1rem; border-bottom: 2px solid var(--surface-border);
}
.pub-year-group__count { font-family: var(--font-sans); font-size: 0.82rem; font-weight: 600; color: var(--text-faint); }

.pub-item {
  display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 1rem;
  padding: 1.05rem 0.4rem 1.05rem 0; border-bottom: 1px solid var(--surface-border);
}
.pub-item:last-child { border-bottom: none; }
.pub-item__tag {
  grid-column: 1; grid-row: 1 / span 3; align-self: start; justify-self: start; margin-top: 0.3rem;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent);
  padding: 0.25rem 0.55rem; border-radius: 6px; white-space: nowrap;
}
.pub-item__title { font-weight: 600; color: var(--text); font-size: 1.05rem; margin: 0; }
.pub-item__title a:hover { color: var(--primary); }
.pub-item__authors { font-size: 0.94rem; color: var(--text-muted); margin: 0.2rem 0 0; }
.pub-item__authors .me { color: var(--text); font-weight: 700; }
.pub-item__venue { font-size: 0.9rem; color: var(--text-faint); margin: 0.15rem 0 0; }
.pub-item__venue em { color: var(--text-muted); font-style: italic; }
.pub-item__links { grid-column: 2; display: flex; gap: 0.5rem; margin-top: 0.5rem; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.8rem; font-weight: 600; padding: 0.28rem 0.7rem; border-radius: var(--radius-pill);
  border: 1px solid var(--surface-border); color: var(--text-muted); background: var(--bg);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.chip:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.chip svg { width: 13px; height: 13px; }

.state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.spinner {
  width: 34px; height: 34px; border-radius: 50%; margin: 0 auto 1rem;
  border: 3px solid var(--surface-border); border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- People ----- */
.pi-card { display: grid; grid-template-columns: 200px 1fr; gap: clamp(1.2rem, 3vw, 2.4rem); align-items: start; position: relative; }
/* Stretched link: makes an entire card clickable while inner links still work.
   The overlay link sits above the card body (z-index 1); genuinely clickable
   inner controls opt back on top with z-index 2. */
.stretched-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
/* Keep genuinely-clickable inner controls above the overlay link. */
.pi-card .btn-row { position: relative; z-index: 2; }
.pi-card__hint { display: inline-flex; align-items: center; gap: 0.35rem; margin-top: 1rem; color: var(--primary); font-weight: 600; font-size: 0.95rem; }
.pi-card__hint svg { width: 16px; height: 16px; transition: transform 0.2s var(--ease); }
.card--link.pi-card:hover .pi-card__hint svg { transform: translateX(4px); }
.pi-card__photo { width: 100%; aspect-ratio: 1; border-radius: var(--radius); object-fit: cover; box-shadow: var(--shadow-md); background: var(--bg-alt); }
.person { text-align: center; display: flex; flex-direction: column; align-items: center; }
.person__photo { width: 130px; height: 130px; border-radius: 50%; object-fit: cover; margin: 0 auto 0.9rem; box-shadow: var(--shadow-sm); background: var(--bg-alt); border: 3px solid var(--bg-elevated); }
.person__name { font-family: var(--font-serif); font-weight: 600; font-size: 1.1rem; margin: 0; }
.person__name a { color: inherit; }
.person__name a:hover { color: var(--primary); }
/* Cards with a profile link are clickable anywhere: the name link stretches
   over the whole card, while the action icons (email etc.) sit above it. */
.person { position: relative; }
.person__name a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.person__name a:focus-visible { outline: none; }
.person__name a:focus-visible::after { outline: 3px solid var(--ring); outline-offset: 2px; }
.person__actions { position: relative; z-index: 1; pointer-events: none; }
.person__actions a { pointer-events: auto; }
.person:has(.person__name a) { transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease); }
.person:has(.person__name a):hover {
  transform: translateY(-4px); box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--primary) 45%, var(--surface-border));
}
.person:has(.person__name a):hover .person__name a { color: var(--primary); }
.person__role { font-size: 0.88rem; color: var(--primary); font-weight: 600; margin: 0.15rem 0 0.5rem; }
.person__interests { font-size: 0.9rem; color: var(--text-muted); margin: 0; }
.person__teams { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: center; margin: 0 0 0.6rem; }
.person__actions { display: flex; gap: 0.5rem; justify-content: center; margin-top: auto; padding-top: 0.9rem; }

/* Team tags */
.team-tag {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.01em;
  padding: 0.25rem 0.65rem; border-radius: var(--radius-pill); border: 1px solid transparent;
}
.team-tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.team-tag--microbial { color: var(--team-mic); background: color-mix(in srgb, var(--team-mic) 14%, transparent); border-color: color-mix(in srgb, var(--team-mic) 32%, transparent); }
.team-tag--mammalian { color: var(--team-mam); background: color-mix(in srgb, var(--team-mam) 14%, transparent); border-color: color-mix(in srgb, var(--team-mam) 32%, transparent); }

/* Small circular icon links (email, profile) on member cards */
.icon-link {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--surface-border); color: var(--text-muted); background: var(--bg);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.icon-link:hover { color: var(--primary); border-color: var(--primary); background: var(--bg-alt); text-decoration: none; }
.icon-link svg { width: 17px; height: 17px; }

/* Team filter bar */
.team-filter { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.2rem 0 1.8rem; }
.team-filter button {
  font: inherit; font-weight: 600; font-size: 0.9rem; cursor: pointer;
  padding: 0.5rem 1rem; border-radius: var(--radius-pill);
  border: 1px solid var(--surface-border); background: var(--bg-elevated); color: var(--text-muted);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.team-filter button:hover { border-color: var(--primary); color: var(--primary); }
.team-filter button.is-active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.team-filter .team-filter__dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.45rem; vertical-align: middle; }
.person.is-hidden, .patent.is-hidden { display: none; }
/* People: one grid, slightly smaller cards. */
.people-grid { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 1.1rem; }
.people-grid .person { padding: 1.15rem 1rem; }
.people-grid .person__photo { width: 104px; height: 104px; margin-bottom: 0.75rem; }
.people-grid .person__name { font-size: 1.02rem; }
.people-grid .person__interests { font-size: 0.85rem; }

/* Individual profile pages (people/*.html) */
.profile { display: grid; grid-template-columns: 240px 1fr; gap: clamp(1.4rem, 4vw, 3rem); align-items: start; }
.profile__photo { width: 100%; aspect-ratio: 1; border-radius: var(--radius); object-fit: cover; box-shadow: var(--shadow-md); background: var(--bg-alt); }
.profile__name { margin: 0 0 0.15rem; }
.profile__role { color: var(--primary); font-weight: 600; margin: 0 0 1rem; }
.profile__teams { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 1.1rem; }
.profile__contact { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1.4rem; }
.profile__section { margin-top: 2rem; }
.profile__section h2 { font-size: 1.3rem; }
.profile__keywords { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; margin: 1rem 0 0; padding: 0; }
.profile__keywords li {
  font-size: 0.82rem; font-weight: 500; padding: 0.25rem 0.7rem; border-radius: var(--radius-pill);
  background: var(--bg-alt); border: 1px solid var(--surface-border); color: var(--text-muted);
}
.backlink { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; font-size: 0.92rem; margin-bottom: 1.4rem; }
.backlink svg { width: 16px; height: 16px; }
@media (max-width: 720px) {
  .profile { grid-template-columns: 1fr; }
  .profile__photo { max-width: 220px; }
}
.alumni-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.7rem; }
.alumni-list li { padding: 0.8rem 1rem; background: var(--bg-elevated); border: 1px solid var(--surface-border); border-radius: var(--radius-sm); }
.alumni-list b { color: var(--text); display: block; }
.alumni-list .yr { display: block; font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--primary); font-weight: 700; margin-bottom: 0.15rem; }
.alumni-list .now { display: block; font-size: 0.88rem; color: var(--text-muted); margin-top: 0.15rem; }

/* ----- News ----- */
.news-list { display: grid; gap: 1.1rem; }
.news-item { display: grid; grid-template-columns: 120px 1fr; gap: 1.4rem; padding: 1.3rem 1.5rem; background: var(--bg-elevated); border: 1px solid var(--surface-border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.news-item time { font-weight: 600; color: var(--primary); font-size: 0.9rem; }
.news-item h3 { font-size: 1.12rem; margin-bottom: 0.35rem; }
.news-item p { margin: 0; color: var(--text-muted); }

/* ----- Teaching ----- */
.course { border-left: 4px solid var(--primary); padding: 0.3rem 0 0.3rem 1.3rem; }
.course__code { font-family: var(--font-sans); font-weight: 700; color: var(--primary); font-size: 0.9rem; letter-spacing: 0.03em; }
.course h3 { margin: 0.2rem 0 0.4rem; }

/* ----- Patents ----- */
.patent-list { border-top: 1px solid var(--surface-border); }
.patent {
  display: grid;
  grid-template-columns: minmax(150px, auto) 1fr;
  gap: 0.35rem 1.3rem;
  align-items: start;
  padding: 1.1rem 0.2rem;
  border-bottom: 1px solid var(--surface-border);
}
.patent__side { grid-row: 1 / span 3; display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start; }
.patent__num {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.82rem; font-weight: 600;
}
.patent__num--plain { color: var(--text-muted); }
.patent__status {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.72rem; font-weight: 700; padding: 0.22rem 0.6rem; border-radius: var(--radius-pill);
  border: 1px solid transparent;
}
.patent__status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.patent__status--issued { color: var(--team-mic); background: color-mix(in srgb, var(--team-mic) 14%, transparent); border-color: color-mix(in srgb, var(--team-mic) 30%, transparent); }
.patent__status--pending { color: var(--ud-gold-600); background: color-mix(in srgb, var(--ud-gold) 18%, transparent); border-color: color-mix(in srgb, var(--ud-gold) 40%, transparent); }
:root[data-theme="dark"] .patent__status--pending { color: var(--ud-gold); }
.patent__status--provisional { color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.patent__title { font-weight: 600; color: var(--text); font-size: 1.03rem; margin: 0; }
.patent__title a { color: inherit; }
.patent__title a:hover { color: var(--primary); }
.patent__inventors { font-size: 0.9rem; color: var(--text-muted); margin: 0.2rem 0 0; }
.patent__inventors .me { color: var(--text); font-weight: 700; }
.patent__meta { font-size: 0.86rem; color: var(--text-faint); margin: 0.15rem 0 0; }
@media (max-width: 640px) {
  .patent { grid-template-columns: 1fr; }
  .patent__side { grid-row: auto; flex-direction: row; align-items: center; gap: 0.6rem; }
}

/* ----- Gallery ----- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.gallery figure { margin: 0; position: relative; border-radius: var(--radius); overflow: hidden; cursor: pointer; box-shadow: var(--shadow-sm); background: var(--bg-alt); aspect-ratio: 4 / 3; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s var(--ease); }
.gallery .gallery__feature { grid-column: 1 / -1; aspect-ratio: 21 / 9; }
@media (max-width: 720px) { .gallery .gallery__feature { aspect-ratio: 4 / 3; } }
.gallery figure:hover img { transform: scale(1.06); }
.gallery figcaption {
  position: absolute; inset: auto 0 0 0; padding: 1.4rem 1rem 0.8rem;
  color: #fff; font-size: 0.9rem; font-weight: 500;
  background: linear-gradient(to top, rgba(6, 20, 40, 0.85), transparent);
}
.ph-tile { display: grid; place-items: center; height: 100%; color: #fff; font-family: var(--font-serif); font-size: 1.1rem; }
.g1 { background: linear-gradient(135deg, #00539f, #013e78); }
.g2 { background: linear-gradient(135deg, #0a6ea8, #00539f); }
.g3 { background: linear-gradient(135deg, #013e78, #0a2f57); }
.g4 { background: linear-gradient(135deg, #1f7a5c, #0a5e63); }
.g5 { background: linear-gradient(135deg, #b58a00, #7a5c00); }
.g6 { background: linear-gradient(135deg, #4d8fc9, #00539f); }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 5vmin; background: rgba(6, 12, 22, 0.9); backdrop-filter: blur(4px); }
.lightbox img { max-width: 92vw; max-height: 86vh; border-radius: 10px; box-shadow: var(--shadow-lg); }
.lightbox__cap { position: absolute; bottom: 4vmin; left: 0; right: 0; text-align: center; color: #e7eefb; font-size: 0.95rem; }
.lightbox__close { position: absolute; top: 3vmin; right: 4vmin; width: 46px; height: 46px; border-radius: 50%; border: none; background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 1.5rem; cursor: pointer; }
.lightbox__close:hover { background: rgba(255, 255, 255, 0.28); }
.lightbox__nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%;
  border: none; background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 2rem; line-height: 1; cursor: pointer;
}
.lightbox__nav:hover { background: rgba(255, 255, 255, 0.28); }
.lightbox__nav--prev { left: 3vmin; }
.lightbox__nav--next { right: 3vmin; }

/* Profile photo strip: small thumbnails in a horizontal, swipeable row.
   Each thumbnail opens the lightbox above. */
.photo-strip {
  display: flex; gap: 0.75rem; overflow-x: auto; scroll-snap-type: x proximity;
  padding: 0.25rem 0.1rem 0.9rem; margin-top: 1rem; overscroll-behavior-x: contain;
  scrollbar-width: thin; scrollbar-color: var(--surface-border) transparent;
}
.photo-strip__item {
  flex: 0 0 auto; scroll-snap-align: start; padding: 0; border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-alt); cursor: zoom-in;
  box-shadow: var(--shadow-sm); transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.photo-strip__item:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.photo-strip__item img { height: 150px; width: auto; max-width: 260px; object-fit: cover; }
@media (max-width: 720px) { .photo-strip__item img { height: 120px; max-width: 200px; } }

/* ----- Contact / join ----- */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.2rem; }
.contact-item { display: flex; gap: 0.9rem; align-items: flex-start; }
.contact-item svg { width: 22px; height: 22px; color: var(--primary); flex: none; margin-top: 2px; }
.contact-item a { word-break: break-word; }
.map-embed {
  margin-top: 1.6rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--surface-border);
  box-shadow: var(--shadow-sm);
  aspect-ratio: 16 / 9;
  max-height: 420px;
  background: var(--bg-alt);
}
.map-embed iframe { width: 100%; height: 100%; border: 0; display: block; }

.callout {
  border-radius: var(--radius); padding: clamp(1.6rem, 4vw, 2.6rem);
  background: linear-gradient(135deg, color-mix(in srgb, var(--ud-blue) 92%, #000), var(--ud-blue-700));
  color: #fff; box-shadow: var(--shadow-md);
}
.callout h2, .callout h3 { color: #fff; }
.callout p { color: rgba(255, 255, 255, 0.85); }
.callout .btn--ghost { color: #fff; border-color: rgba(255, 255, 255, 0.5); }
.callout .btn--ghost:hover { background: rgba(255, 255, 255, 0.14); border-color: #fff; color: #fff; }

/* ----- Footer ----- */
.site-footer { background: var(--bg-alt); border-top: 1px solid var(--surface-border); padding-block: 2.6rem 2rem; margin-top: auto; }
.site-footer__grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.site-footer h4 { font-family: var(--font-sans); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-faint); margin-bottom: 0.9rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.site-footer a { color: var(--text-muted); font-size: 0.94rem; }
.site-footer a:hover { color: var(--primary); }
.site-footer__bottom { border-top: 1px solid var(--surface-border); padding-top: 1.4rem; display: flex; flex-wrap: wrap; gap: 0.6rem 1.5rem; justify-content: space-between; font-size: 0.86rem; color: var(--text-faint); }

.page-body { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; }

/* ----- Reveal on scroll ----- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

/* ----- Responsive ----- */
/* ----- 404 page: a pathway with a knocked-out step ----- */
.notfound { --ko: #c2410c; }
:root[data-theme="dark"] .notfound { --ko: #fb923c; }
.notfound__path { color: var(--text-muted); font-size: 0.95rem; }
.notfound__path code {
  font-size: 0.9em; padding: 0.15em 0.5em; border-radius: 6px; word-break: break-all;
  background: var(--bg-elevated); border: 1px solid var(--surface-border); color: var(--text);
}
.notfound__pathway { margin: 1.6rem 0 2rem; max-width: 560px; }
.notfound__pathway svg { width: 100%; height: auto; display: block; overflow: visible; }
.nf-node { fill: var(--bg-elevated); stroke: var(--primary); stroke-width: 2; }
.nf-node--missing { stroke: var(--text-faint); stroke-dasharray: 6 6; fill: transparent; }
.nf-label { font: 600 17px var(--font-sans); fill: var(--text); text-anchor: middle; }
.nf-label--missing { fill: var(--text-faint); font-style: italic; font-weight: 500; }
.nf-head { fill: var(--primary); }
.nf-flux { stroke: var(--primary); stroke-width: 3; stroke-dasharray: 8 6; animation: nf-flow 1.1s linear infinite; }
.nf-broken { stroke: var(--text-faint); stroke-width: 3; stroke-dasharray: 3 7; }
.nf-ko circle { fill: var(--bg-alt); stroke: var(--ko); stroke-width: 2.5; }
.nf-ko path { stroke: var(--ko); stroke-width: 3; stroke-linecap: round; }
.nf-enzyme { font: 700 14px var(--font-sans); fill: var(--ko); text-anchor: middle; letter-spacing: 0.04em; }
@keyframes nf-flow { to { stroke-dashoffset: -28; } }

@media (max-width: 860px) {
  .research-block__grid { grid-template-columns: 1fr; }
  .pi-card { grid-template-columns: 1fr; text-align: center; }
  .pi-card__photo { max-width: 220px; margin-inline: auto; }
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
}
/* Collapse the primary nav to the hamburger menu before the full row would
   wrap (the 9-item bar fits on one line only above ~1160px). */
@media (max-width: 1160px) {
  .nav__links {
    position: fixed; inset: var(--header-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0.2rem;
    background: var(--bg); border-bottom: 1px solid var(--surface-border);
    padding: 0.8rem var(--gutter) 1.2rem; box-shadow: var(--shadow-md);
    transform: translateY(-140%); transition: transform 0.3s var(--ease); z-index: -1;
  }
  .nav__links.is-open { transform: translateY(0); }
  .nav__links a { padding: 0.75rem 0.9rem; font-size: 1.05rem; }
  .nav__burger { display: grid; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .news-item { grid-template-columns: 1fr; gap: 0.4rem; }
  .site-footer__grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
