/* USP Brain Research Dashboard — Utrecht University house style.
   Light, academic, confident: white surfaces, black ink, the iconic UU
   yellow as the signature accent, and the UU secondary palette for data. */
:root {
  --white: #ffffff;
  --black: #000000;
  --yellow: #ffcd00;   /* UU primary / signature */
  --red: #c00a35;      /* UU accent */
  --creme: #ffe6ab;

  /* secondary palette (data + theme coding) */
  --green: #24a793;
  --blue: #5287c6;
  --purple: #5b2182;
  --orange: #f3965e;
  --bordeaux: #aa1555;
  --darkblue: #001240;
  --brown: #6e3b23;

  --ink: #000000;
  --muted: #595959;
  --line: #e3e1da;
  --surface: #ffffff;
  --surface-2: #faf8f2;

  --radius: 14px;
  --shadow: 0 10px 28px -20px rgba(0, 0, 0, 0.4);
  --font-head: "Merriweather", Georgia, "Times New Roman", serif;
  --font-body: "Open Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--white);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* faint warm UU tint, nothing more */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(48% 40% at 100% 0%, rgba(255, 205, 0, 0.10), transparent 70%),
    radial-gradient(42% 38% at 0% 4%, rgba(255, 230, 171, 0.22), transparent 72%);
}

/* ---------- Masthead ---------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.masthead__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  color: inherit;
  text-decoration: none;
}
.brand:hover .brand__mark { transform: rotate(-3deg); }
.brand__mark {
  color: var(--black);
  display: grid;
  place-items: center;
  width: 54px; height: 54px;
  border-radius: 12px;
  background: var(--yellow);
  transition: transform 0.18s ease;
}
.brand__text h1 {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.4rem;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--black);
}
.brand__text p { margin: 3px 0 0; color: var(--muted); font-size: 0.86rem; }
.masthead__status {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.masthead__status[data-state="error"] { color: var(--red); border-color: var(--red); }
.masthead__status[data-state="ready"] { color: var(--green); border-color: rgba(36, 167, 147, 0.5); }

/* ---------- Theme nav (chip grid) ---------- */
.tabs {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 24px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}
.tabs[hidden] { display: none; }
.tab {
  flex: 0 0 auto;
  background: var(--white);
  border: 1.5px solid var(--black);
  border-radius: 999px;
  color: var(--black);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease;
}
.tab:hover { background: var(--creme); }
.tab:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }
.tab.is-active {
  background: var(--yellow);
  border-color: var(--black);
  color: var(--black);
  font-weight: 700;
}
.tab.is-active:hover { background: var(--yellow); }

/* ---------- Layout ---------- */
.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px 60px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* shared heading + yellow signature underline */
.intro h2, .theme-head h2, .results__head h2 {
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--black);
  margin: 0;
}
.intro h2::after, .theme-head h2::after {
  content: "";
  display: block;
  width: 48px;
  height: 4px;
  margin-top: 10px;
  background: var(--yellow);
  border-radius: 2px;
}

/* ---------- KPIs ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--yellow);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.kpi__value { font-family: var(--font-head); font-size: 2.1rem; font-weight: 900; line-height: 1; color: var(--black); }
.kpi__label { color: var(--muted); font-size: 0.82rem; margin-top: 10px; }

/* ---------- Intro / theme header ---------- */
.intro p { color: var(--muted); margin: 12px 0 0; max-width: 70ch; }
.theme-head__eyebrow {
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--red);
}
.theme-head h2 { font-size: 2rem; letter-spacing: -0.01em; margin-top: 6px; }
.theme-head p { color: var(--muted); margin: 14px 0 0; }

/* ---------- Home follow-up ---------- */
.brain-note {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 22px;
  margin-top: -12px;
}
.overview-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--black);
  background: var(--yellow);
  border: 1.5px solid var(--black);
  border-radius: 999px;
  padding: 10px 17px;
  font: 800 0.78rem var(--font-body);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.overview-link:hover { transform: translateY(-2px); box-shadow: 0 8px 20px -10px rgba(0, 0, 0, 0.65); }
.overview-link:focus-visible { outline: 2px solid var(--black); outline-offset: 3px; }

/* ---------- Project team ---------- */
.project-team {
  display: grid;
  grid-template-columns: minmax(250px, 0.8fr) minmax(360px, 1.2fr);
  gap: 52px;
  align-items: end;
  margin-top: 18px;
  padding: 38px 40px;
  background: var(--surface-2);
  border-top: 4px solid var(--yellow);
  border-radius: var(--radius);
}
.project-team__eyebrow {
  color: var(--red);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.project-team__intro h2 {
  margin: 8px 0 0;
  font-family: var(--font-head);
  font-size: clamp(1.45rem, 2.4vw, 2.15rem);
  line-height: 1.15;
}
.project-team__intro p { margin: 12px 0 0; color: var(--muted); font-size: 0.86rem; }
.project-team__members {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 24px;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}
.project-team__members li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-head);
  font-size: 0.88rem;
  font-weight: 700;
}
/* ---------- Charts ---------- */
.charts {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 16px;
}
.chart-card {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.chart-card figcaption {
  font-family: var(--font-head);
  font-size: 0.98rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--black);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.chart-hint {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.66rem;
  letter-spacing: 0.02em;
  color: #6e5a12;
  background: var(--creme);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.chart-wrap { position: relative; height: 240px; }
.chart-wrap--tall { height: 440px; }

/* ---------- Theme tiles (overview) ---------- */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.theme-tile {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--yellow);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  font-family: var(--font-body);
  box-shadow: var(--shadow);
}
.theme-tile:hover { transform: translateY(-3px); box-shadow: 0 16px 32px -20px rgba(0, 0, 0, 0.5); }
.theme-tile:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }
.theme-tile__count { font-family: var(--font-head); font-size: 2rem; font-weight: 900; color: var(--black); line-height: 1; }
.theme-tile__name { font-family: var(--font-head); font-weight: 700; color: var(--black); }
.theme-tile__go { color: var(--red); font-size: 0.78rem; font-weight: 600; margin-top: 6px; }

/* ---------- Controls ---------- */
.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.controls__search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--muted);
}
.controls__search:focus-within { border-color: var(--black); }
.controls__search input {
  flex: 1;
  background: none;
  border: none;
  color: var(--ink);
  font-size: 0.95rem;
  outline: none;
  font-family: var(--font-body);
}
/* One tidy grid of equal-width filters — calm and aligned regardless of label length. */
.controls__facets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}
.facet {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-width: 0;
  background-color: var(--white);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 34px 10px 12px;
  font-size: 0.86rem;
  font-family: var(--font-body);
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23595959' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}
.facet:hover { border-color: #c9c6bd; }
.facet:focus-visible { outline: 2px solid var(--black); outline-offset: 1px; }
.facet--on { border-color: var(--black); background-color: #fcfbf6; font-weight: 600; }
.btn-clear {
  background: var(--white);
  color: var(--red);
  border: 1.5px solid var(--red);
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
}
.btn-clear:hover { background: var(--red); color: var(--white); }

/* ---------- Active filter chips ---------- */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}
.active-filters__label {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--muted);
  margin-right: 2px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--creme);
  border: 1px solid #f0d98a;
  color: var(--black);
  border-radius: 999px;
  padding: 5px 12px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.pill__k { color: var(--muted); font-weight: 700; }
.pill__x { font-size: 1.1rem; line-height: 1; color: var(--muted); }
.pill:hover { border-color: var(--red); color: var(--red); }
.pill:hover .pill__k, .pill:hover .pill__x { color: var(--red); }
.pill:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }
.pill--clear {
  background: var(--white);
  border: 1.5px solid var(--red);
  color: var(--red);
  font-weight: 700;
}
.pill--clear:hover { background: var(--red); color: var(--white); }

/* ---------- Results / cards ---------- */
.results__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.results__head h2 { font-size: 1.3rem; }
.results__count { color: var(--muted); font-size: 0.88rem; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.card--link { cursor: pointer; }
.card--link:hover,
.card--link:focus-within {
  transform: translateY(-4px);
  box-shadow: 0 20px 38px -20px rgba(0, 0, 0, 0.55);
  border-color: rgba(192, 10, 53, 0.45);
}
/* Persistent corner cue that the whole card opens a detail page (visible on touch). */
.card--link::after {
  content: "↗";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fbe9ee;
  color: var(--red);
  font-size: 0.86rem;
  font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.card--link:hover::after,
.card--link:focus-within::after { background: var(--red); color: #fff; transform: scale(1.08); }
.card__badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--black);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--white);
  white-space: nowrap;
}
.badge__dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.badge--stage { color: #333333; }
.badge--collab { background: #eaf7f4; border-color: #bfe6df; }
.badge--solo { background: #f4f4f4; border-color: #e2e2e2; color: #595959; }
.badge--type { background: #fff6d9; border-color: #f4e3a6; color: #6b5300; text-transform: capitalize; }
.card__detail { display: flex; flex-direction: column; gap: 3px; font-size: 0.78rem; color: var(--muted); }
.card__detail-k { font-weight: 700; color: #333333; }
.card__title { margin: 0; }
.card__open {
  font-family: var(--font-head); font-size: 1.05rem; font-weight: 700;
  color: var(--black); line-height: 1.25; text-align: left;
  background: none; border: 0; padding: 0; cursor: pointer;
}
.card__open:hover { color: var(--red); text-decoration: underline; }
.card__desc {
  color: var(--muted);
  font-size: 0.86rem;
  margin: 0;
}
.card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.tag {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--black);
  background: var(--creme);
  border: 1px solid #f0d98a;
  border-radius: 6px;
  padding: 3px 7px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.tag:hover { background: #ffe9a8; border-color: #e7c860; }
.tag.is-active { background: #ffcd00; border-color: #e0b400; color: #2a2200; font-weight: 700; }
.card--link .card__badges { padding-right: 30px; }
.card__more {
  margin-top: auto;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  color: var(--red); font-size: 0.84rem; font-weight: 700;
  background: #fff5f7; border: 1px solid #f3d6de;
  border-radius: 8px; padding: 9px 12px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.card--link:hover .card__more,
.card--link:focus-within .card__more { background: var(--red); color: #fff; border-color: var(--red); }
.card__more-arrow { transition: transform 0.15s ease; }
.card--link:hover .card__more-arrow,
.card--link:focus-within .card__more-arrow { transform: translateX(4px); }
.empty { color: var(--muted); text-align: center; padding: 40px; }

/* ---------- Project detail page ---------- */
.project-detail { max-width: 900px; margin: 0 auto; }
.project-detail__back {
  background: none; border: 0; cursor: pointer; padding: 6px 0;
  color: var(--red); font-weight: 700; font-size: 0.9rem; margin-bottom: 12px;
}
.project-detail__back:hover { text-decoration: underline; }
.project-detail__head { border-bottom: 1px solid var(--line); padding-bottom: 18px; margin-bottom: 20px; }
.project-detail__eyebrow {
  font-family: var(--font-mono, monospace); font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: #8a6d00;
}
.project-detail__head h2 {
  font-family: var(--font-head); font-size: 1.9rem; line-height: 1.18;
  margin: 8px 0 14px; color: var(--black);
}
.project-detail__themes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.project-detail__badges { margin-top: 4px; }
.project-detail__desc { font-size: 1rem; line-height: 1.65; color: #333333; margin: 0 0 24px; }
.project-detail__grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 28px; margin: 0;
}
.pdl dt { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: #6e5a12; margin-bottom: 5px; }
.pdl dd { margin: 0; font-size: 0.9rem; line-height: 1.5; color: #1f1f1f; display: flex; flex-wrap: wrap; gap: 6px; }
.pdl dd a { color: var(--red); font-weight: 600; text-decoration: none; word-break: break-all; }
.pdl dd a:hover { text-decoration: underline; }
.pchip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.78rem; color: #1f1f1f; background: #f6f6f3;
  border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px;
}
.pchip--theme { cursor: pointer; font-weight: 700; }
.pchip--theme:hover { background: #fff; border-color: #bbb; }
.pchip__dot { width: 8px; height: 8px; border-radius: 50%; }
.project-detail__tags { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 18px; }
.project-detail__tags-label { display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: #6e5a12; margin-bottom: 10px; }

/* ---------- Load error panel ---------- */
.loaderr {
  background: var(--surface);
  border: 1px solid var(--red);
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 640px;
}
.loaderr h2 { font-family: var(--font-head); margin: 0 0 12px; color: var(--red); }
.loaderr p { color: var(--muted); margin: 0 0 12px; }
.loaderr code { background: var(--creme); padding: 2px 6px; border-radius: 6px; color: var(--black); }
.loaderr pre {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  color: var(--black);
  overflow-x: auto;
}
.loaderr a { color: var(--red); }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 880px) {
  .charts { grid-template-columns: 1fr; }
  .brain-note { align-items: flex-start; flex-direction: column; margin-top: -8px; }
  .project-team { grid-template-columns: 1fr; gap: 26px; align-items: start; }
  .project-detail__grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .masthead__status { display: none; }
  .masthead__inner { flex-wrap: nowrap; }
  .brand { min-width: 0; flex: 1; }
  .brand__text { min-width: 0; }
  .brand__text h1 {
    font-size: 1.05rem;
    line-height: 1.2;
    white-space: normal;
  }
  .brand__text p { display: none; }
  .layout { padding: 24px 16px 48px; }
  .overview-link { width: 100%; justify-content: center; }
  .project-team { padding: 28px 22px; }
  .project-team__members { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .card:hover, .theme-tile:hover { transform: none; }
}
