/* ==========================================================================
   SAFE group page — additions on top of main.css
   ========================================================================== */

/* Palette taken from the organisation logo: the chip blue is #004791 and the
   padlock badge is #ebe5e0. Overrides main.css, so it must restate the dark
   values too — a bare :root here would otherwise win in dark mode as well. */
:root {
  --accent: #004791;
  --accent-hover: #003468;
  --accent-soft: #e6eefa;
  --logo-plate: #ebe5e0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #7cabe8;
    --accent-hover: #a7c8f2;
    --accent-soft: #16263c;
    --logo-plate: #ebe5e0;
  }
}

/* The mark is a single dark blue, so it needs a light plate to stay legible
   on a dark background. The plate colour is the logo's own badge tone. */
.logo-plate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--logo-plate);
  border-radius: 14px;
  padding: .4rem;
  flex-shrink: 0;
}
.logo-plate img { display: block; width: 100%; height: auto; }

.brand-mark {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 7px;
  padding: .18rem;
}
.brand { display: inline-flex; align-items: center; gap: .55rem; }

/* --------------------------------------------------------------------------
   Masthead
   -------------------------------------------------------------------------- */

.masthead {
  padding: 2.5rem 0 .5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.25rem;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 1.15rem;
}
.wordmark .logo-plate { width: 5.5rem; height: 5.5rem; }
.wordmark-text {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  flex-wrap: wrap;
  min-width: 0;
}
@media (max-width: 40rem) {
  .wordmark { gap: .85rem; }
  .wordmark .logo-plate { width: 3.75rem; height: 3.75rem; border-radius: 11px; }
}
.wordmark .acronym {
  font-family: var(--font-serif);
  font-size: clamp(2.6rem, 7vw, 4rem);
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--heading);
  line-height: 1;
}
.wordmark .expansion {
  font-size: clamp(.95rem, 2vw, 1.1rem);
  color: var(--text-muted);
  font-weight: 500;
}
.wordmark .expansion b { color: var(--accent); font-weight: 600; }

.masthead .affil {
  margin: .6rem 0 0;
  color: var(--text-muted);
  font-size: .95rem;
}

/* No max-width: the paragraph must line up with the research-area grid
   directly beneath it, which spans the full container. */
.masthead .pitch {
  margin: 1.1rem 0 1.4rem;
  font-size: 1.05rem;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Research areas
   -------------------------------------------------------------------------- */

/* Fixed 2 x 2 so the four areas never break into an orphaned 3 + 1.
   For a single row of four instead, change this to repeat(4, 1fr). */
.area-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
@media (max-width: 47rem) { .area-grid { grid-template-columns: 1fr; } }

.area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}
.area h3 {
  font-family: var(--font-body);
  font-size: .95rem;
  font-weight: 700;
  margin: 0 0 .4rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.area h3 svg { width: 1.05em; height: 1.05em; fill: var(--accent); flex-shrink: 0; }
.area p { margin: 0; font-size: .89rem; color: var(--text-muted); line-height: 1.55; }

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

.people-heading {
  font-family: var(--font-body);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin: 2rem 0 .85rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.people-heading .count {
  font-size: .72rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: .05rem .5rem;
  letter-spacing: 0;
}
.people-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: .85rem;
}

.person {
  display: flex;
  gap: .85rem;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .85rem .95rem;
  transition: border-color .15s ease, transform .15s ease;
}
.person:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  transform: translateY(-1px);
}

/* the PI card spans the row and gets a little more presence */
.people-grid-lead { grid-template-columns: 1fr; }
.person-lead { padding: 1.1rem 1.25rem; }
.person-lead .p-photo { width: 4.5rem; height: 4.5rem; font-size: 1.3rem; }
.person-lead .p-name { font-size: 1.1rem; }

.p-photo {
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.p-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .02em;
}

.p-body { min-width: 0; }
.p-name { margin: 0; font-family: var(--font-body); font-size: .98rem; font-weight: 600; }
.p-title { margin: .1rem 0 0; font-size: .82rem; color: var(--accent); font-weight: 500; }
.p-topic { margin: .3rem 0 0; font-size: .84rem; color: var(--text-muted); line-height: 1.45; }

.p-links { display: flex; gap: .45rem; margin-top: .5rem; }
.p-link {
  display: inline-flex;
  width: 1.65rem;
  height: 1.65rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
}
.p-link svg { width: .8rem; height: .8rem; fill: currentColor; }
.p-link:hover { color: var(--accent); border-color: var(--accent); }

/* Alumni keep their title, topic and links, but sit in a lighter list rather
   than cards, so past members never outweigh current ones. */
.alumni-list {
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.alum {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1rem;
  flex-wrap: wrap;
  padding: .7rem .95rem;
  border-bottom: 1px solid var(--border);
}
.alum:last-child { border-bottom: 0; }
.alum-main { display: flex; align-items: baseline; flex-wrap: wrap; gap: .1rem .6rem; min-width: 0; }
.alum-name { font-weight: 600; font-size: .95rem; }
.alum-role { font-size: .82rem; color: var(--accent); }
.alum-topic { font-size: .84rem; color: var(--text-muted); flex-basis: 100%; }
.alum .p-links { margin-top: 0; }

/* --------------------------------------------------------------------------
   Projects
   -------------------------------------------------------------------------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: .9rem;
}

.project {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  transition: border-color .15s ease, transform .15s ease;
}
.project:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  transform: translateY(-1px);
}

.proj-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
}
.proj-head h4 {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
}
.proj-head h4 a { color: var(--heading); }
.proj-head h4 a:hover { color: var(--accent); }
.lang {
  font-size: .72rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.vis-badge {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  background: var(--award-soft); color: var(--award);
  border-radius: 999px; padding: .1rem .5rem; white-space: nowrap;
}
.vis-badge.vis-hidden { background: var(--border); color: var(--text-muted); }
.project-soon, .project-hidden { border-style: dashed; }
.project-hidden { opacity: .72; }
.preview-flag {
  background: var(--award-soft); color: var(--award);
  border-radius: 8px; padding: .5rem .8rem; font-size: .85rem; margin: 0 0 1rem;
}

.proj-tagline { margin: .3rem 0 0; font-size: .88rem; color: var(--accent); font-weight: 500; }
.proj-desc { margin: .4rem 0 0; font-size: .86rem; color: var(--text-muted); line-height: 1.5; }

.tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .65rem; }
.tag {
  font-size: .72rem;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .08rem .5rem;
}

.proj-links { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .8rem; padding-top: .1rem; }
.project .proj-links { margin-top: auto; padding-top: .8rem; }

/* --------------------------------------------------------------------------
   Join us
   -------------------------------------------------------------------------- */

.join {
  background: linear-gradient(135deg,
              color-mix(in srgb, var(--accent-soft) 85%, var(--surface)),
              var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
}
.join h3 { margin-top: 0; }
.join p { max-width: 44rem; }
.join .btn-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .5rem 1rem;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: .9rem;
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; text-decoration: none; }
.btn-primary svg { width: 1em; height: 1em; fill: currentColor; }
