/* ==========================================================================
   Microbes & Ecosystems Lab — Design System
   Bioluminescent dark theme. Deep-sea black with glowing plankton accents.
   ========================================================================== */

:root {
  /* Core palette */
  --bg: #050b14;
  --bg-alt: #081420;
  --bg-elevated: #0d1c2c;
  --bg-elevated-2: #112436;

  --text: #eaf6f4;
  --text-muted: #9fb8bc;
  --text-dim: #6b8489;

  /* Bioluminescent accents */
  --cyan: #3ee8d0;
  --cyan-dim: #1f8f82;
  --magenta: #ff5fd1;
  --violet: #a78bfa;
  --green: #7cffb2;
  --amber: #ffd166;

  --border: rgba(160, 220, 215, 0.14);
  --border-strong: rgba(160, 220, 215, 0.28);

  --shadow-glow-cyan: 0 0 24px rgba(62, 232, 208, 0.35);
  --shadow-glow-magenta: 0 0 24px rgba(255, 95, 209, 0.3);

  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 24px;

  --max-width: 1180px;

  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 1em;
  color: var(--text-muted);
}

::selection {
  background: var(--cyan);
  color: var(--bg);
}

/* Scrollbar (webkit) */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-elevated-2);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--cyan-dim);
}

/* ---------------------------------------------------------------------- */
/* Background canvas (boids)                                              */
/* ---------------------------------------------------------------------- */
#boids-bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  /* Flat black — the canvas itself now draws pure black + white flow-field
     lines, so the CSS layer just needs to match at the edges/before the
     first paint rather than adding its own color. */
  background: #000000;
  opacity: 0.9;
}

.page-content {
  position: relative;
  z-index: 1;
}

/* ---------------------------------------------------------------------- */
/* Layout helpers                                                         */
/* ---------------------------------------------------------------------- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 96px 0;
  border-bottom: 1px solid var(--border);
}

.section:last-of-type {
  border-bottom: none;
}

.section-alt {
  background: linear-gradient(180deg, rgba(8, 20, 32, 0.55), rgba(8, 20, 32, 0.15));
  backdrop-filter: blur(2px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 18px;
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--cyan);
  box-shadow: var(--shadow-glow-cyan);
}

.section-head {
  max-width: 720px;
  margin-bottom: 56px;
}

.section-head h2 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.section-head p {
  font-size: 1.08rem;
  max-width: 620px;
}

/* ---------------------------------------------------------------------- */
/* Nav                                                                     */
/* ---------------------------------------------------------------------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(5, 11, 20, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.nav-brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px 2px rgba(62, 232, 208, 0.7);
  flex-shrink: 0;
}

.nav-brand span.sub {
  display: block;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.68rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-links a {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.92rem;
  color: var(--text-muted);
  transition: color 0.2s ease, background 0.2s ease;
}

.nav-links a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-links a.active {
  color: var(--bg);
  background: var(--cyan);
  font-weight: 600;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-toggle svg {
  width: 20px;
  height: 20px;
}

@media (max-width: 860px) {
  .nav-toggle {
    display: flex;
  }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: rgba(5, 11, 20, 0.97);
    border-bottom: 1px solid var(--border);
    padding: 10px 20px 18px;
    display: none;
  }
  .nav-links.open {
    display: flex;
  }
  .nav-links a {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
  }
}

/* ---------------------------------------------------------------------- */
/* Buttons                                                                 */
/* ---------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), #29b8a6);
  color: #04141a;
  box-shadow: 0 6px 24px rgba(62, 232, 208, 0.28);
}

.btn-primary:hover {
  box-shadow: 0 10px 30px rgba(62, 232, 208, 0.4);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-ghost:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.btn-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------------- */
/* Cards                                                                   */
/* ---------------------------------------------------------------------- */
.card {
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg-alt));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.card-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  font-size: 22px;
  background: rgba(62, 232, 208, 0.1);
  border: 1px solid rgba(62, 232, 208, 0.25);
}

.card h3 {
  font-size: 1.15rem;
  margin-bottom: 10px;
}

.card p {
  font-size: 0.95rem;
  margin-bottom: 0;
}

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.12);
  color: var(--violet);
  border: 1px solid rgba(167, 139, 250, 0.3);
}

.tag.cyan {
  background: rgba(62, 232, 208, 0.1);
  color: var(--cyan);
  border-color: rgba(62, 232, 208, 0.28);
}

.tag.magenta {
  background: rgba(255, 95, 209, 0.1);
  color: var(--magenta);
  border-color: rgba(255, 95, 209, 0.28);
}

.tag.green {
  background: rgba(124, 255, 178, 0.1);
  color: var(--green);
  border-color: rgba(124, 255, 178, 0.28);
}

/* ---------------------------------------------------------------------- */
/* Grids                                                                   */
/* ---------------------------------------------------------------------- */
.grid {
  display: grid;
  gap: 24px;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 900px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------------- */
/* Hero                                                                    */
/* ---------------------------------------------------------------------- */
.hero {
  padding: 150px 0 120px;
  text-align: center;
  position: relative;
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  margin: 0 auto 22px;
  max-width: 920px;
  background: linear-gradient(120deg, #ffffff 10%, var(--cyan) 55%, var(--violet) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .lede {
  font-size: 1.2rem;
  max-width: 640px;
  margin: 0 auto 40px;
  color: var(--text-muted);
}

.hero-badges {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 36px;
}

.scroll-cue {
  margin-top: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.scroll-cue .line {
  width: 1px;
  height: 34px;
  background: linear-gradient(180deg, var(--cyan), transparent);
  animation: pulse-line 2.2s ease-in-out infinite;
}

@keyframes pulse-line {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* ---------------------------------------------------------------------- */
/* Page header (non-home pages)                                           */
/* ---------------------------------------------------------------------- */
.page-header {
  padding: 130px 0 70px;
}

.page-header h1 {
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  max-width: 760px;
}

.page-header p {
  font-size: 1.08rem;
  max-width: 640px;
}

/* ---------------------------------------------------------------------- */
/* People                                                                  */
/* ---------------------------------------------------------------------- */
.pi-card {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 36px;
  align-items: start;
  padding: 36px;
}

.avatar {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--bg-elevated-2), var(--bg-alt));
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--cyan);
  position: relative;
  overflow: hidden;
}

.avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(62, 232, 208, 0.25), transparent 60%);
}

.avatar.sm {
  font-size: 1.5rem;
}

@media (max-width: 640px) {
  .pi-card {
    grid-template-columns: 1fr;
  }
  .pi-card .avatar {
    max-width: 160px;
  }
}

.person-card {
  padding: 24px;
}

.person-card .avatar {
  width: 68px;
  height: 68px;
  margin-bottom: 16px;
}

.person-card h3 {
  font-size: 1.02rem;
  margin-bottom: 2px;
}

.role {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--cyan);
  margin-bottom: 12px;
}

.alumni-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
}

.alumni-list li {
  font-size: 0.92rem;
  color: var(--text-muted);
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}

/* ---------------------------------------------------------------------- */
/* Publications                                                            */
/* ---------------------------------------------------------------------- */
.pub-year {
  font-family: var(--font-mono);
  color: var(--text-dim);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  margin: 48px 0 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.pub-year::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.pub-year:first-of-type {
  margin-top: 0;
}

.pub-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
}

.pub-item:last-child {
  border-bottom: none;
}

.pub-title {
  font-weight: 600;
  color: var(--text);
  font-size: 1.02rem;
  margin-bottom: 6px;
}

.pub-authors {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.pub-authors .pi {
  color: var(--cyan);
  font-weight: 600;
}

.pub-venue {
  font-size: 0.86rem;
  color: var(--text-dim);
  font-style: italic;
}

.pub-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------- */
/* News                                                                    */
/* ---------------------------------------------------------------------- */
.news-feed {
  position: relative;
  padding-left: 34px;
}

.news-feed::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: linear-gradient(180deg, var(--cyan), var(--violet), transparent);
}

.news-item {
  position: relative;
  padding-bottom: 44px;
}

.news-item:last-child {
  padding-bottom: 0;
}

.news-item::before {
  content: "";
  position: absolute;
  left: -34px;
  top: 5px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--cyan);
  box-shadow: 0 0 10px 1px rgba(62, 232, 208, 0.6);
}

.news-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  display: block;
}

.news-item h3 {
  font-size: 1.15rem;
  margin-bottom: 8px;
}

/* ---------------------------------------------------------------------- */
/* Contact / Join forms & info                                             */
/* ---------------------------------------------------------------------- */
.info-row {
  display: flex;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.info-row:last-child {
  border-bottom: none;
}

.info-row .icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(62, 232, 208, 0.1);
  border: 1px solid rgba(62, 232, 208, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 17px;
}

.info-row h4 {
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.info-row p {
  margin-bottom: 0;
  font-size: 0.92rem;
}

.map-placeholder {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  aspect-ratio: 16/10;
  background:
    radial-gradient(circle at 30% 40%, rgba(62, 232, 208, 0.12), transparent 60%),
    radial-gradient(circle at 70% 65%, rgba(255, 95, 209, 0.1), transparent 55%),
    var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-align: center;
  padding: 24px;
}

form.contact-form {
  display: grid;
  gap: 16px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}

.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.field input,
.field textarea {
  width: 100%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(62, 232, 208, 0.15);
}

/* ---------------------------------------------------------------------- */
/* Join Us — position list                                                 */
/* ---------------------------------------------------------------------- */
.position-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
}

.position-item:last-child {
  border-bottom: none;
}

.position-item h3 {
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.open {
  color: var(--green);
}
.status-dot.open::before {
  background: var(--green);
  box-shadow: 0 0 8px rgba(124, 255, 178, 0.7);
}

.status-dot.rolling {
  color: var(--amber);
}
.status-dot.rolling::before {
  background: var(--amber);
  box-shadow: 0 0 8px rgba(255, 209, 102, 0.7);
}

.step-list {
  counter-reset: step;
  display: grid;
  gap: 18px;
}

.step-list li {
  position: relative;
  padding-left: 48px;
  color: var(--text-muted);
}

.step-list li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  color: var(--cyan);
  font-size: 0.85rem;
}

.step-list strong {
  color: var(--text);
}

/* ---------------------------------------------------------------------- */
/* Stats strip                                                            */
/* ---------------------------------------------------------------------- */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  text-align: center;
}

.stat h3 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  color: var(--cyan);
  margin-bottom: 4px;
}

.stat span {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

@media (max-width: 700px) {
  .stats-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------------------------------------------------------------------- */
/* Callout / CTA band                                                     */
/* ---------------------------------------------------------------------- */
.cta-band {
  border-radius: var(--radius-lg);
  padding: 60px;
  background: linear-gradient(135deg, rgba(62, 232, 208, 0.1), rgba(167, 139, 250, 0.08));
  border: 1px solid var(--border-strong);
  text-align: center;
}

.cta-band h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin-bottom: 14px;
}

.cta-band p {
  max-width: 520px;
  margin: 0 auto 28px;
}

.cta-band .btn-row {
  justify-content: center;
}

@media (max-width: 700px) {
  .cta-band {
    padding: 40px 24px;
  }
}

/* ---------------------------------------------------------------------- */
/* Footer                                                                  */
/* ---------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 48px 0 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

.footer-grid h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.footer-grid a {
  display: block;
  padding: 5px 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  transition: color 0.2s ease;
}

.footer-grid a:hover {
  color: var(--cyan);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-dim);
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

@media (max-width: 700px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------------------------------------------------------------------- */
/* Utility                                                                 */
/* ---------------------------------------------------------------------- */
.text-center {
  text-align: center;
}

.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

.placeholder-note {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--amber);
  background: rgba(255, 209, 102, 0.08);
  border: 1px dashed rgba(255, 209, 102, 0.4);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 28px;
  display: inline-block;
}

@media (max-width: 640px) {
  .section {
    padding: 64px 0;
  }
  .hero {
    padding: 120px 0 80px;
  }
  .page-header {
    padding: 110px 0 50px;
  }
}

/* Respect reduced motion at the page-chrome level (canvas handles its own) */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .scroll-cue .line {
    animation: none;
  }
}
