:root {
  --purple: #6625b4;
  --purple-dark: #4e1a8c;
  --bg: #faf8fc;
  --surface: #ffffff;
  --text: #1c1c1e;
  --muted: #6b6b72;
  --border: #e8e2f1;
  --neon: #cdff3a;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
}

a { color: var(--purple); }

/* ---------- Header / nav ---------- */
.site-header {
  background: var(--purple);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
}
.searchbar { order: 1; }   /* visually below the nav, though first in the DOM */
.nav {
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px 22px;
}
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  color: #fff;
  text-decoration: none;
  margin-right: auto;
}
.nav a:not(.brand) {
  color: #e9def9;
  text-decoration: none;
  font-size: 0.95rem;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}
.nav a:not(.brand):hover { color: #fff; }
.nav a[aria-current="page"] {
  color: #fff;
  border-bottom-color: #fff;
}

/* ---------- Layout ---------- */
main {
  max-width: 1060px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}
.hero {
  max-width: 1060px;
  margin: 0 auto;
  padding: 56px 20px 8px;
}
.hero h1 {
  color: var(--purple);
  font-size: 2.2rem;
  margin: 0 0 0.4em;
  line-height: 1.15;
}
.lead {
  font-size: 1.15rem;
  color: var(--text);
}

h2 {
  color: var(--purple);
  font-size: 1.4rem;
  margin: 2.4em 0 0.8em;
}
section:first-of-type h2 { margin-top: 1.1em; }

/* Fake highlighter marker behind section headings */
h2 {
  position: relative;
  z-index: 0;
  display: inline-block;
}
h2::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: -0.18em;
  right: -0.18em;
  bottom: 0.18em;
  height: 1em;
  background: var(--neon);
  transform: rotate(-1.4deg);
}

/* ---------- News / item lists ---------- */
.items { list-style: none; margin: 0; padding: 0; }
.items li {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--purple);
  border-radius: 6px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.thumb {
  width: 120px;
  height: 100px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.thumb.avatar {        /* square headshots, shown as round portraits */
  width: 100px;
  height: 100px;
  border-radius: 50%;
}
.item-body { flex: 1; min-width: 0; }
.item-body > :first-child { margin-top: 0; }

/* Clickable tiles */
.items li.card {
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.items li.card:hover {
  border-left-color: var(--purple-dark);
  box-shadow: 0 2px 12px rgba(102, 37, 180, 0.1);
}
/* Tiles without a detail URL: not a link, so no pointer/hover affordance */
.items li.card:not([data-href]) { cursor: default; }
.items li.card:not([data-href]):hover {
  border-left-color: var(--purple);
  box-shadow: none;
}

/* Excerpt: collapsed to one line, click to reveal the rest */
.excerpt {
  margin: 6px 0 0;
  cursor: pointer;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.excerpt.expanded {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}
.items h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}
.items h3 a { color: inherit; text-decoration: none; }
.items h3 a:hover { text-decoration: underline; }
.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #fff;
  background: var(--purple);
  border-radius: 3px;
  padding: 2px 7px;
  vertical-align: middle;
}
.meta { color: var(--muted); font-size: 0.85rem; margin: 0 0 6px; }
.items p { margin: 4px 0 0; color: var(--text); }

/* ---------- Institution logo grid ---------- */
.logos {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  align-items: center;
}
.logos li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  text-align: center;
}
.logos a {
  display: flex;
  align-items: center;
  justify-content: center;
}
.logos img {
  max-width: 100%;
  max-height: 170px;
  width: auto;
  height: auto;
}

/* ---------- Search ---------- */
[hidden] { display: none !important; }   /* let `hidden` win over flex/grid */

.searchbar {
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 20px 14px;
}
#search-input {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);   /* slightly lighter purple at rest */
  color: #fff;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
#search-input::placeholder { color: rgba(255, 255, 255, 0.7); }
.search-field { position: relative; }
/* "engaged" = has text, or focus is within the bar (JS toggles .active) → light purple */
.searchbar.active #search-input,
#search-input:focus {
  outline: none;
  background: #e3d4fa;
  color: var(--text);
  border-color: #e3d4fa;
}
.searchbar.active #search-input::placeholder,
#search-input:focus::placeholder { color: var(--muted); }

.results-inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 40px 20px 64px;
}
.results-inner h2 { margin-top: 0; }

/* Scope checkboxes overlaid on the right of the search field; revealed once the
   field is engaged (see .searchbar.active), and they stay while you use it. */
.scopes {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  display: none;
  flex-wrap: nowrap;
  gap: 0 14px;
  font-size: 0.8rem;
  color: var(--muted);
}
.searchbar.active .scopes { display: flex; }
.scopes label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
}
.scopes input { accent-color: var(--neon); }
.results-status { color: var(--muted); margin: 0 0 14px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 28px 20px 40px;
}

@media (max-width: 520px) {
  .hero h1 { font-size: 1.7rem; }
  .nav { gap: 8px 16px; }
  .items li { flex-direction: column; }
  .thumb { width: 100%; height: 140px; }
}

/* Narrow screens: drop the scope checkboxes below the field instead of
   overlaying them, and let them wrap onto multiple lines. */
@media (max-width: 640px) {
  .scopes {
    position: static;
    transform: none;
    margin-top: 8px;
    flex-wrap: wrap;
    gap: 6px 16px;
  }
}
