/* ---------------------------------------------------------------------------
   MOSAIC website styles
   A small, dependency-free stylesheet. Light/dark aware, mobile-first.
   --------------------------------------------------------------------------- */

:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --surface-2: #eef1f5;
  --text: #1c2230;
  --muted: #5b6472;
  --border: #dce1e8;
  --brand: #1f5fa8;        /* MOSAIC blue */
  --brand-dark: #16457c;
  --accent: #d9822b;       /* warm accent */
  --upcoming: #1c7a4d;
  --radius: 10px;
  --maxw: 900px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161d;
    --surface: #1a2029;
    --surface-2: #222b36;
    --text: #e7ebf1;
    --muted: #9aa4b2;
    --border: #2c3644;
    --brand: #5aa0e6;
    --brand-dark: #3f83c9;
    --accent: #e8a45c;
    --upcoming: #4cbf87;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 20px;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; color: var(--text); }
h1 { font-size: 2rem; margin: 0.2em 0 0.4em; }
h2 { font-size: 1.35rem; margin: 1.6em 0 0.5em; }
h3 { font-size: 1.1rem; }

/* --- Mosaic brand gradient (Grand Challenges banner colours) ---------- */
:root {
  --mosaic-gradient: linear-gradient(
    90deg,
    #ff8c1f 0%,
    #ff3c42 18%,
    #c4244f 32%,
    #830374 48%,
    #1f5fa8 64%,
    #0bd78f 80%,
    #1ad9c9 100%
  );
}

.mosaic-bar {
  height: 5px;
  background: var(--mosaic-gradient);
}

/* --- Header ------------------------------------------------------------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding-block: 10px;
}
.brand {
  display: flex;
  align-items: center;
  line-height: 0;
}
.brand:hover { text-decoration: none; opacity: 0.92; }
.brand-logo {
  height: 48px;
  width: auto;
  max-width: min(280px, 58vw);
  display: block;
  object-fit: contain;
}
/* Light logo (black wordmark) by default; dark logo (white wordmark) in dark mode */
.brand-logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  .brand-logo-light { display: none; }
  .brand-logo-dark { display: block; }
}
.site-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.site-nav a {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text);
  font-weight: 500;
}
.site-nav a:hover { background: var(--surface-2); text-decoration: none; }

/* --- Main / footer ------------------------------------------------------ */
main.wrap { padding-block: 32px 56px; }

.site-footer {
  border-top: none;
  background: var(--mosaic-gradient);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.9rem;
  padding-block: 28px;
}
.site-footer p { margin: 6px 0; }
.site-footer strong { color: #fff; }
.footer-brand { margin-bottom: 10px; }
.footer-logo {
  height: 28px;
  width: auto;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-top: 10px;
}
.footer-links a {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.footer-links a:hover { color: #fff; }
.footer-links span { margin-inline: 6px; color: rgba(255, 255, 255, 0.55); }
.footer-social {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, 0.18);
  transition: background 0.15s ease, transform 0.15s ease;
}
.social-icon:hover {
  background: rgba(0, 0, 0, 0.32);
  text-decoration: none;
  transform: translateY(-1px);
}
.social-icon svg { display: block; }

/* --- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

/* --- Hero (home) -------------------------------------------------------- */
.hero { margin-bottom: 8px; }
.hero .tagline { color: var(--muted); font-size: 1.1rem; margin-top: 0; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0; }

/* --- Topics word cloud (home) ------------------------------------------- */
.topics {
  margin: 40px 0 8px;
  padding: 24px 22px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.topics h2 {
  margin: 0 0 6px;
  font-size: 1.35rem;
}
.topics-intro {
  margin: 0 0 12px;
  color: var(--muted);
}
.topics-cloud {
  position: relative;
  width: 100%;
  min-height: 220px;
  margin: 8px 0 16px;
  overflow: hidden;
  border-radius: 8px;
  background:
    radial-gradient(ellipse at 30% 40%, color-mix(in srgb, var(--brand) 8%, transparent), transparent 55%),
    radial-gradient(ellipse at 70% 60%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 50%),
    var(--bg);
  border: 1px solid var(--border);
}
.topics-word {
  position: absolute;
  white-space: nowrap;
  line-height: 1.15;
  letter-spacing: 0.01em;
  user-select: none;
  transition: transform 0.15s ease, opacity 0.15s ease;
  cursor: default;
}
.topics-word:hover {
  transform: scale(1.08);
  opacity: 1 !important;
  z-index: 2;
}
.topics-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.topics-years {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 4px 0 8px;
}
.topics-year-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.topics-year-btn:hover {
  background: var(--surface-2);
  border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
}
.topics-year-btn.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.topics-hint {
  margin: 0;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
}

/* --- Next-event banner -------------------------------------------------- */
.next-event {
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin: 24px 0;
}
.next-event .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--brand);
  margin: 0 0 6px;
}
.next-event h2 { margin: 0 0 8px; font-size: 1.4rem; }
.next-event .when { color: var(--muted); font-weight: 600; margin: 0 0 10px; }

/* --- Event lists -------------------------------------------------------- */
.event-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.event-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px 20px;
}
.event-card-date {
  margin: 0 0 4px;
  font-weight: 700;
  color: var(--brand);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
}
.event-card-time { font-weight: 500; color: var(--muted); font-size: 0.9rem; }
.event-card-title { margin: 2px 0 6px; }
.event-card-summary { margin: 6px 0; color: var(--text); }
.event-card-speakers { margin: 6px 0 0; color: var(--muted); font-size: 0.92rem; }
.event-card-more { margin: 10px 0 0; font-weight: 600; }

.section-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-top: 40px;
  font-weight: 700;
}

/* --- Event detail ------------------------------------------------------- */
.event-back { margin: 0 0 8px; }
.event-status {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 999px;
  margin: 0 0 6px;
}
.event-status.upcoming { background: color-mix(in srgb, var(--upcoming) 18%, transparent); color: var(--upcoming); }
.event-status.past { background: var(--surface-2); color: var(--muted); }
.event-when { font-weight: 600; color: var(--muted); margin: 0 0 14px; }
.event-tz { margin-left: 8px; font-weight: 500; }
.event-summary { font-size: 1.1rem; }
.event-people ul, .agenda-list { padding-left: 0; list-style: none; }
.event-people li { padding: 4px 0; border-bottom: 1px solid var(--border); }
.event-people li:last-child { border-bottom: 0; }
.talk-title { color: var(--muted); }
.agenda-list li {
  padding: 6px 0 6px 14px;
  border-left: 2px solid var(--border);
  margin-left: 2px;
  font-variant-numeric: tabular-nums;
}
.event-body { margin-top: 8px; }
.event-body h2 { font-size: 1.2rem; }

/* --- Join box / subscribe ---------------------------------------------- */
.join-box {
  margin-top: 32px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.join-box h2 { margin-top: 0; }
.join-actions, .subscribe-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

/* --- Calendar embed ----------------------------------------------------- */
.calendar-embed {
  position: relative;
  width: 100%;
  /* Aspect-ratio box keeps the iframe responsive on small screens. */
  aspect-ratio: 4 / 3;
  max-width: 800px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.calendar-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.help-note {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.95rem;
  color: var(--muted);
}

/* --- Team page ---------------------------------------------------------- */
.team-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 16px;
}
.team-card {
  display: flex;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px 18px;
}
.team-card-compact { padding: 12px 16px; }
.team-photo-ring {
  flex-shrink: 0;
  padding: 3px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff8c1f, #c4244f 40%, #1f5fa8 70%, #0bd78f);
  line-height: 0;
}
.team-photo-ring-sm {
  padding: 2px;
  background: var(--border);
}
.team-photo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  display: block;
  background: var(--surface-2);
}
.team-photo-sm {
  width: 56px;
  height: 56px;
}
video.team-photo {
  object-fit: cover;
  pointer-events: none;
}
.team-info { min-width: 0; }
.team-name {
  margin: 0 0 4px;
  font-size: 1.15rem;
}
.team-name a {
  color: var(--text);
  text-decoration: none;
}
.team-name a:hover {
  color: var(--brand);
  text-decoration: underline;
}
.team-role {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}
.team-list-alumni .team-name {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
}

/* Compact name grid for guest hosts (no photos) */
.host-name-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px 16px;
}
.host-name-list li {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 600;
  font-size: 0.95rem;
}

/* --- Recording archive (unlisted page) ---------------------------------- */
.archive-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 28px;
  display: grid;
  gap: 10px;
}
.archive-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.archive-item-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  min-width: 0;
  flex: 1 1 220px;
}
.archive-date {
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.archive-title {
  color: var(--text);
  font-weight: 600;
}
.archive-title:hover { color: var(--brand); }
.archive-recording {
  flex: 0 1 auto;
  text-align: right;
  font-size: 0.92rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.archive-rec-link { font-weight: 600; }
.archive-slides-link {
  font-weight: 600;
  font-size: 0.9rem;
}
.archive-rec-muted { color: var(--muted); }
.archive-rec-note {
  display: block;
  margin-top: 2px;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: right;
  max-width: 22em;
}
@media (max-width: 480px) {
  .archive-recording {
    text-align: left;
    width: 100%;
    align-items: flex-start;
  }
  .archive-rec-note { text-align: left; }
}

/* --- Members world map (About) ------------------------------------------ */
.members-map,
.members-map.leaflet-container {
  width: 100%;
  height: 420px;
  min-height: 420px;
  margin: 16px 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #dce4ec;
  z-index: 0;
  font: inherit;
}
.members-map-meta {
  margin: 0 0 8px;
  font-size: 0.88rem;
  color: var(--muted);
}
.map-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  margin: 0;
  color: var(--muted);
  padding: 24px;
  text-align: center;
}
.map-popup { font-size: 0.9rem; line-height: 1.4; min-width: 140px; }
.map-popup-total { margin: 4px 0 8px; color: #5b6472; }
.map-popup-inst {
  margin: 0;
  padding-left: 1.1em;
  max-height: 160px;
  overflow: auto;
}
.map-popup-inst .map-count { color: #5b6472; font-weight: 500; }
/* Ensure Leaflet panes fill the fixed-height box */
.members-map .leaflet-pane,
.members-map .leaflet-map-pane,
.members-map .leaflet-tile-pane {
  z-index: auto;
}
@media (max-width: 480px) {
  .members-map,
  .members-map.leaflet-container {
    height: 320px;
    min-height: 320px;
  }
}

/* --- Utility ------------------------------------------------------------ */
.lede { font-size: 1.15rem; color: var(--text); }
hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }

@media (max-width: 480px) {
  body { font-size: 16px; }
  h1 { font-size: 1.6rem; }
  .btn { width: 100%; text-align: center; }
  .brand-logo { height: 40px; }
  .team-card {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
  .team-photo { width: 112px; height: 112px; }
  .team-card-compact {
    flex-direction: row;
    text-align: left;
  }
  .team-card-compact .team-photo-placeholder {
    width: 48px;
    height: 48px;
  }
}


