/* Rinn AI Expertise Finder. Palette from rinn-ai.ie, via the prototype. */
:root {
  --navy: #072a52;
  --navy-dark: #04162a;
  --hero-blue: #3b6fc4;
  --blue: #0b5fae;
  --blue-bright: #1571cf;
  --sky: #7ec1f2;
  --pale: #eaf3fc;
  --ink: #16324f;
  --muted: #526c86;
  --line: #dfeaf6;
  --line-strong: #c5d7e8;
  --bg: #f6fafe;
  --surface: #fff;
  --ok-ink: #215d4b; --ok-bg: #edf8f3; --ok-line: #c5e4d5;
  --draft-ink: #6b531b; --draft-bg: #fff9e9; --draft-line: #ecdfba;
  --danger: #b42318;
  --radius: 10px;
  --gutter: max(16px, calc((100vw - 1224px) / 2));
  --font: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--ink); background: var(--bg); }
h1, h2, h3 { color: var(--navy); line-height: 1.2; margin: 0; font-weight: 650; }
p { margin: 0; }
a { color: var(--blue); }
a:hover { color: var(--navy); }
img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 2px solid var(--blue-bright); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

/* ---------- chrome ---------- */
.utility-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--blue); color: #fff; font-size: 12px; letter-spacing: .2px; padding: 7px var(--gutter);
}
.utility-user { display: flex; align-items: center; gap: 14px; }
.utility-user a, .utility-user button { color: #fff; font: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.utility-user form { margin: 0; }

.site-header {
  display: flex; align-items: center; gap: 24px; background: var(--surface);
  padding: 14px var(--gutter); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 22px; text-decoration: none; min-width: 0; flex: 1; }
.rinn-logo { width: 96px; height: 76px; object-fit: contain; flex-shrink: 0; }
.product-name {
  border-left: 1px solid var(--line); padding-left: 22px; font-size: 23px; font-weight: 700;
  color: var(--navy); letter-spacing: -.4px; line-height: 1.2;
}
.product-name small { display: block; font-size: 12px; font-weight: 400; letter-spacing: 0; margin-top: 6px; color: var(--muted); }
.header-support { display: flex; flex-direction: column; gap: 6px; margin-left: auto; }
.header-support span { font-size: 11px; color: var(--muted); }
.header-support img { width: 140px; height: 44px; object-fit: contain; object-position: left center; }

.page { padding: 28px var(--gutter) 56px; }
.site-footer {
  background: var(--navy-dark); color: #c9dff6; padding: 28px var(--gutter);
  display: flex; gap: 24px; align-items: center; font-size: 12px;
}
.site-footer img { width: 130px; flex-shrink: 0; }

/* ---------- controls ---------- */
button, .primary, .secondary, .ghost { font: inherit; cursor: pointer; }
.primary, .secondary, .ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 7px; padding: 9px 16px; font-weight: 600; font-size: 14px; text-decoration: none;
  border: 1px solid transparent; transition: background-color .15s, border-color .15s, color .15s;
}
.primary { background: var(--blue); color: #fff; }
.primary:hover { background: var(--navy); color: #fff; }
.secondary { background: var(--surface); color: var(--blue); border-color: #c2d6eb; }
.secondary:hover { background: var(--pale); }
.ghost { background: none; color: var(--muted); padding-inline: 10px; }
.ghost:hover { color: var(--blue); background: var(--pale); }
.ghost.danger:hover { color: var(--danger); background: #fdf0ef; }
.small { padding: 5px 10px; font-size: 13px; }
button[disabled], .htmx-request button { opacity: .6; cursor: progress; }

input[type=text], input[type=email], input[type=search], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 7px; padding: 9px 12px; width: 100%; min-width: 0;
}
textarea { resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue-bright); box-shadow: 0 0 0 3px #1571cf22; }
label { font-size: 13px; font-weight: 600; color: #355b80; }
.hint { font-size: 12px; color: var(--muted); }
.field-error { font-size: 13px; color: var(--danger); flex-basis: 100%; }

.status-pill {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600;
  border: 1px solid; border-radius: 999px; padding: 2px 9px; white-space: nowrap;
}
.status-pill.ok { color: var(--ok-ink); background: var(--ok-bg); border-color: var(--ok-line); }
.staff-preview { margin: 0 0 16px; padding: 10px 14px; border-radius: 8px; font-size: 13px;
  color: var(--draft-ink); background: var(--draft-bg); border: 1px solid var(--draft-line); }
.unconfirmed-mark { font-size: 11px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase;
  color: var(--draft-ink); background: var(--draft-bg); border: 1px solid var(--draft-line); border-radius: 999px; padding: 0 7px; vertical-align: middle; }
.tags li.unconfirmed, .tags li.unconfirmed a { border-style: dashed; }
.status-pill.draft { color: var(--draft-ink); background: var(--draft-bg); border-color: var(--draft-line); }

.eyebrow { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase; color: #486887; }
.eyebrow > span { width: 18px; height: 2px; background: var(--blue); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: 0 3px 12px #072a5205; }
.card-head { margin-bottom: 16px; }
.card-head h2 { font-size: 18px; letter-spacing: -.2px; }
.card-head p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- auth ---------- */
.auth-wrap {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 48px; align-items: center;
  background: linear-gradient(120deg, var(--navy) 20%, #123f74 72%, var(--hero-blue)); color: #fff;
  margin: -28px calc(-1 * var(--gutter)) 0; padding: 64px var(--gutter);
}
.auth-wrap.single { grid-template-columns: minmax(0, 460px); justify-content: center; }
.auth-intro .eyebrow { color: #c5e4ff; }
.auth-intro .eyebrow > span { background: var(--sky); }
.auth-intro h1 { color: #fff; font-size: clamp(32px, 5vw, 46px); font-weight: 750; letter-spacing: -1.4px; margin: 16px 0; }
.auth-intro h1 em { font-style: normal; color: #9ed5ff; }
.auth-intro p { color: #e0edfc; max-width: 560px; }
.auth-card { color: var(--ink); padding: 28px; display: grid; gap: 14px; }
.auth-card h2 { font-size: 20px; }
.auth-card p { color: var(--muted); }
#login-form { display: grid; gap: 10px; }
#login-form .primary { margin-top: 4px; }
.link-sent { text-align: left; }
.link-sent .secondary { justify-self: start; }
.notice-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #dcecff; color: var(--blue); font-size: 18px; }

/* ---------- profile ---------- */
.profile-hero {
  display: flex; gap: 24px; align-items: flex-start;
  background: linear-gradient(120deg, var(--navy) 20%, #123f74 72%, var(--hero-blue)); color: #fff;
  margin: -28px calc(-1 * var(--gutter)) 24px; padding: 36px var(--gutter) 32px;
  border-bottom: 4px solid var(--cluster-color);
}
.avatar { display: grid; place-items: center; border-radius: 50%; font-weight: 600; background: var(--pale); color: #215b91; border: 1px solid #d3e4f5; flex-shrink: 0; }
.avatar-lg { width: 76px; height: 76px; font-size: 26px; }
.profile-title .eyebrow { color: #c5e4ff; }
.profile-title .eyebrow > span { background: var(--sky); }
.profile-title h1 { color: #fff; font-size: clamp(28px, 4.5vw, 40px); letter-spacing: -1px; margin: 10px 0 12px; }
.profile-metadata { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.profile-metadata li { font-size: 13px; color: #e0edfc; border: 1px solid #ffffff35; border-radius: 999px; padding: 3px 12px; }
.cluster-chip { display: inline-flex; align-items: center; gap: 7px; }
.cluster-chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--cluster-color); }
.roster-note { font-size: 12px; color: #aedcff; margin-top: 12px; }
.lead-badges { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.lead-badge { font-size: 12px; font-weight: 600; letter-spacing: .2px; border-radius: 999px; padding: 4px 12px;
  color: #13324f; background: #ffffff; }
.lead-badge span { color: #c98a00; }
.lead-badge.director { background: #13324f; color: #fff; box-shadow: inset 0 0 0 1px #ffffff55; }
.lead-badge.director span { color: #ffd257; }
.lead-badge.cluster_lead { background: #ffe9a8; }
.lead-badge.theme_lead { background: #d7ecff; }
.lead-badge.institution_lead { background: #dff3e8; }

.review-banner {
  display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--draft-bg); border: 1px solid var(--draft-line);
  border-radius: var(--radius); padding: 18px 22px; margin-bottom: 24px;
}
.review-banner h2 { font-size: 17px; }
.review-banner p { font-size: 14px; color: #5e4a1c; margin-top: 4px; max-width: 640px; }
.review-banner.is-done { background: var(--ok-bg); border-color: var(--ok-line); }
.review-banner.is-done p { color: var(--ok-ink); }
.review-banner.is-updated { background: var(--pale); border-color: #d9e8f6; }
.review-banner.is-updated p { color: #405e7d; }
.review-action { display: flex; gap: 8px; flex: 0 1 460px; }
.review-action input { flex: 1; }
.review-action .primary { white-space: nowrap; }

.profile-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.profile-main, .profile-side { display: grid; gap: 24px; min-width: 0; }

.summary-block { display: grid; gap: 12px; }
.summary-text { font-size: 15px; line-height: 1.75; color: #2c4a68; }

.exp-group + .exp-group { margin-top: 18px; }
.exp-group h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #4d6c89; margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.exp-group h3 span { background: var(--pale); color: var(--blue); border-radius: 999px; padding: 0 7px; font-size: 11px; letter-spacing: 0; }
.exp-list, .ident-list, .source-list, .pub-list { list-style: none; margin: 0; padding: 0; }
.exp-row {
  display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: #fbfdff; transition: opacity .2s;
}
.exp-row + .exp-row { margin-top: 6px; }
.exp-row.confirmed { background: var(--surface); }
.exp-row.htmx-swapping { opacity: 0; }
.exp-row.editing { background: var(--pale); }
.exp-body { flex: 1; min-width: 0; padding-top: 3px; }
.exp-label { font-weight: 600; color: var(--navy); }
.exp-empty { padding: 4px 2px; font-size: 13px; }
.star-toggle { background: none; border: 0; font-size: 18px; line-height: 1; padding: 4px 2px; color: #c3d3e3; }
.star-toggle:hover { color: #e3a92b; }
.star-toggle.on { color: #e3a92b; }
.star { color: #e3a92b; }
details summary { cursor: pointer; font-size: 12px; color: var(--muted); }
details blockquote { margin: 6px 0; padding: 8px 12px; border-radius: 6px; font-size: 13px; font-style: italic; color: #4b6a87; background: var(--bg); }
details blockquote::before { content: "“"; } details blockquote::after { content: "”"; }
.exp-evidence a { font-size: 12px; }
.exp-edit { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }
.exp-edit input { flex: 1 1 220px; }
.exp-edit select { flex: 0 1 160px; width: auto; }

.inline-add { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line-strong); }
.inline-add input { flex: 1 1 200px; }
.inline-add select { flex: 0 1 160px; width: auto; }

.ident-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ident-row:first-child { padding-top: 0; }
.ident-row > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.ident-row small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.ident-row.editing form { display: grid; gap: 8px; width: 100%; }

.source-list li, .pub-list li { padding: 10px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.source-list li:first-child, .pub-list li:first-child { padding-top: 0; }
.source-list a { font-weight: 600; font-size: 14px; }
.source-list small, .pub-list small { display: block; font-size: 12px; color: var(--muted); }
.pub-list b { font-size: 14px; color: var(--navy); }
.pub-list a { font-size: 12px; margin-right: 8px; }

.messages { margin-bottom: 16px; }
.message { padding: 10px 14px; border-radius: 8px; background: var(--pale); border: 1px solid var(--line); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .profile-grid { grid-template-columns: minmax(0, 1fr); }
  .auth-wrap { grid-template-columns: minmax(0, 1fr); gap: 28px; padding-block: 40px; }
}
@media (max-width: 640px) {
  .site-header { flex-wrap: wrap; gap: 12px; }
  .rinn-logo { width: 64px; height: 52px; }
  .product-name { font-size: 18px; padding-left: 14px; }
  .product-name small { display: none; }
  .header-support { margin-left: 0; flex-direction: row; align-items: center; }
  .header-support img { width: 110px; height: 34px; }
  .profile-hero { flex-direction: column; gap: 14px; }
  .avatar-lg { width: 56px; height: 56px; font-size: 20px; }
  .review-action { flex-basis: 100%; flex-wrap: wrap; }
  .exp-row { flex-wrap: wrap; }
  .exp-row .row-actions { width: 100%; justify-content: flex-end; }
  .site-footer { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ================= public site ================= */
.site-nav {
  display: flex; align-items: stretch; gap: 4px; background: var(--surface);
  padding: 0 var(--gutter); border-bottom: 1px solid var(--line); overflow-x: auto;
}
.site-nav a {
  display: flex; align-items: center; height: 50px; padding: 0 14px; font-size: 14px; font-weight: 600;
  color: var(--muted); text-decoration: none; white-space: nowrap; position: relative;
}
.site-nav a:hover { color: var(--blue); }
.site-nav a[aria-current="page"] { color: var(--blue); }
.site-nav a[aria-current="page"]::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--blue); }
.nav-spacer { flex: 1; }

.hero {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px;
  background: linear-gradient(120deg, var(--navy) 20%, #123f74 72%, var(--hero-blue)); color: #fff;
  margin: -28px calc(-1 * var(--gutter)) 36px; padding: 44px var(--gutter) 0;
}
.hero .eyebrow { color: #c5e4ff; }
.hero .eyebrow > span { background: var(--sky); }
.hero h1 { color: #fff; font-size: clamp(32px, 5vw, 48px); font-weight: 750; letter-spacing: -1.6px; margin: 16px 0 14px; max-width: 820px; }
.hero h1 em { font-style: normal; color: #9ed5ff; }
.hero-content > p { color: #e0edfc; max-width: 640px; margin-bottom: 24px; }
.hero-search {
  display: flex; align-items: center; gap: 10px; max-width: 760px; background: var(--surface);
  border-radius: 12px; padding: 6px 6px 6px 16px; box-shadow: 0 12px 40px #04162a40; color: var(--blue);
}
.hero-search svg { flex-shrink: 0; }
.hero-search input { flex: 1; border: 0; padding: 10px 4px; font-size: 16px; }
.hero-search .primary { flex-shrink: 0; }
.hero-search input:focus { box-shadow: none; }
.hero-search:focus-within { box-shadow: 0 0 0 3px #7ec1f288, 0 12px 40px #04162a40; }
.metrics { display: flex; flex-wrap: wrap; gap: 12px 40px; margin: 0; padding: 18px 0 22px; border-top: 1px solid #ffffff30; }
.metrics div { display: flex; flex-direction: column-reverse; }
.metrics dt { font-size: 12px; color: #d7e9fc; }
.metrics dd { margin: 0; font-size: 28px; font-weight: 650; color: #fff; line-height: 1.2; font-variant-numeric: tabular-nums; }

.section-heading h2 { font-size: 24px; letter-spacing: -.5px; margin: 8px 0 6px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.section-heading .count { font-size: 13px; font-weight: 600; background: #e1edf9; color: var(--blue); border-radius: 999px; padding: 1px 10px; letter-spacing: 0; }
.section-caption { font-size: 13px; color: var(--muted); }
.programme { margin-bottom: 40px; }
.cluster-group h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #4d6c89; margin: 20px 0 10px; }
.cluster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.cluster-card {
  display: grid; gap: 6px; padding: 16px 18px; text-decoration: none; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px;
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.cluster-card b { color: var(--navy); font-size: 15px; display: flex; align-items: center; gap: 8px; }
.cluster-card b::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--cluster-color); flex-shrink: 0; }
.cluster-card span { color: var(--muted); font-size: 12px; }
.cluster-card:hover { box-shadow: 0 8px 24px #072a5212; transform: translateY(-1px); border-color: #9fc7eb; }

.results { scroll-margin-top: 16px; }
.results-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.results.htmx-request .result-list { opacity: .5; transition: opacity .2s; }
.results-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; }
.filter-panel {
  display: grid; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; position: sticky; top: 16px;
}
.filter-panel h3 { font-size: 15px; margin-bottom: 6px; }
.filter-panel label:not(.check) { margin-top: 8px; font-size: 12px; }
.filter-panel select { font-size: 13px; padding: 7px 10px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-weight: 500; color: var(--ink); }
.check input { accent-color: var(--blue); width: 16px; height: 16px; }
.filter-note { margin-top: 10px; font-size: 12px; color: #405e7d; background: var(--pale); border-radius: 7px; padding: 8px 10px; }
.filter-chip { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; background: var(--pale); color: var(--blue); border-radius: 7px; padding: 6px 10px; }
.filter-chip a { text-decoration: none; font-weight: 700; }

.result-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.researcher-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; display: grid; gap: 10px; box-shadow: 0 3px 12px #072a5205;
}
.card-top { display: flex; align-items: center; gap: 12px; }
.card-top .avatar { width: 42px; height: 42px; font-size: 14px; }
.card-name { flex: 1; min-width: 0; }
.card-name h3 { font-size: 17px; }
.card-name h3 a { color: var(--navy); text-decoration: none; }
.card-name h3 a:hover { color: var(--blue); text-decoration: underline; }
.card-name span { font-size: 13px; color: var(--muted); }
.card-summary { font-size: 14px; line-height: 1.7; color: #46627e; }
.tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { font-size: 12px; background: #f0f6fc; color: #2a5b88; border: 1px solid #dce9f5; border-radius: 6px; padding: 2px 9px; }
.tags li.primary-tag { background: #e3effb; border-color: #c6dcf2; font-weight: 600; }
.tags li.more { background: none; border-style: dashed; }
.tags-lg li { font-size: 13px; padding: 0; }
.tags-lg li a { display: inline-flex; gap: 6px; align-items: center; padding: 4px 11px; text-decoration: none; color: inherit; border-radius: 6px; }
.tags-lg li a:hover { background: #dcebfa; }
.tags-lg li b { font-size: 11px; color: var(--blue); background: var(--surface); border-radius: 999px; padding: 0 6px; }
.match-explanation { font-size: 13px; color: var(--blue); background: #f0f6fd; border-radius: 7px; padding: 6px 10px; }
.match-explanation.name { color: var(--muted); background: var(--bg); }
.card-bottom { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid #e2ecf6; font-size: 12px; }
.cluster-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--navy); }
.cluster-label i { width: 8px; height: 8px; border-radius: 50%; background: var(--cluster-color); }
.theme-label { color: var(--muted); }
.profile-link { margin-left: auto; font-weight: 600; text-decoration: none; }
.empty-state { background: var(--surface); border: 1px dashed #bad2e9; border-radius: var(--radius); padding: 32px; text-align: center; }
.empty-state h3 { font-size: 17px; margin-bottom: 6px; }
.empty-state p { color: var(--muted); max-width: 480px; margin: 0 auto; font-size: 14px; }
.load-more { display: flex; justify-content: center; padding-top: 6px; }
.load-more.htmx-request a { opacity: .6; }

.back-link { margin: -8px 0 20px; font-size: 14px; }
.back-link a { text-decoration: none; font-weight: 600; }
.hero-link { color: #fff; font-weight: 600; }
.hero-link:hover { color: #c5e4ff; }
.profile-metadata a { color: inherit; text-decoration: none; }
.profile-metadata a:hover { text-decoration: underline; }
.notice-card h2 { font-size: 18px; margin-bottom: 6px; }
.notice-card p { color: var(--muted); }

.page-intro { margin-bottom: 24px; }
.page-intro h1 { font-size: clamp(28px, 4vw, 36px); letter-spacing: -1px; margin: 10px 0 8px; }
.page-intro p { color: var(--muted); max-width: 680px; }
.themes-card { margin-top: 24px; }
.theme-cluster + .theme-cluster { margin-top: 20px; }
.theme-cluster h3 { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 10px; }
.theme-cluster h3 i { width: 10px; height: 10px; border-radius: 50%; background: var(--cluster-color); }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.theme-grid a {
  display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; color: var(--navy); text-decoration: none; font-size: 14px;
}
.theme-grid a:hover { background: #edf5fd; border-color: #9fc7eb; }
.theme-grid a span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.leads { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.leads a { color: var(--blue); font-weight: 600; }
.theme-cluster .leads { margin: -4px 0 10px 18px; }

@media (max-width: 900px) {
  .results-layout { grid-template-columns: minmax(0, 1fr); }
  .filter-panel { position: static; grid-template-columns: 1fr 1fr; column-gap: 12px; }
  .filter-panel h3, .filter-panel .filter-note, .filter-panel .check, .filter-panel .filter-chip { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .hero-search { flex-wrap: wrap; padding: 8px; }
  .hero-search input { flex: 1 1 200px; }
  .hero-search .primary { width: 100%; }
  .metrics { gap: 10px 24px; }
  .metrics dd { font-size: 22px; }
  .filter-panel { grid-template-columns: minmax(0, 1fr); }
  .card-top { flex-wrap: wrap; }
  .profile-link { margin-left: 0; }
}

/* "did you mean to browse…" suggestions above search results */
.suggestions { background: var(--pale); border: 1px solid #d9e8f6; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.suggestions > p { font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 10px; }
.suggestions ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.suggestions a {
  display: grid; gap: 1px; padding: 8px 12px; background: var(--surface); border: 1px solid #c6dcf2;
  border-radius: 8px; text-decoration: none; transition: border-color .15s, box-shadow .15s;
}
.suggestions a:hover { border-color: var(--blue); box-shadow: 0 4px 12px #072a5210; }
.suggestions small { font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.suggestions b { font-size: 14px; color: var(--blue); }
.suggestions span { font-size: 12px; color: var(--muted); }

/* publications */
.count-inline { font-size: 12px; font-weight: 600; background: var(--pale); color: var(--blue); border-radius: 999px; padding: 1px 8px; vertical-align: middle; }
.pub-card { margin-top: 24px; position: relative; }
.pub-card .card-head { padding-right: 300px; }
.pub-filter { position: absolute; top: 22px; right: 22px; width: 270px; }
.pub-filter input { padding: 8px 12px; font-size: 14px; }
.pub-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: #2a5b88;
  background: var(--surface); border: 1px solid #c6dcf2; border-radius: 999px; padding: 4px 12px;
  transition: background-color .15s, border-color .15s, color .15s;
}
.chip b { font-size: 11px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip:hover { background: var(--pale); }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip.on b { color: #d7e9fc; }
.pub-results.htmx-request .pub-table { opacity: .55; transition: opacity .2s; }

.pub-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.pub-table th {
  text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line-strong);
}
.pub-table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.pub-table tbody tr:hover { background: #f8fbff; }
.pub-table .c-year { width: 64px; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--navy); white-space: nowrap; }
.pub-table .c-type { width: 150px; }
.pub-table .c-src { width: 190px; font-size: 13px; color: var(--muted); }
.pub-table .c-src em { display: block; font-style: normal; font-weight: 600; color: var(--draft-ink); margin-top: 2px; }
.pub-table .c-links { width: 130px; text-align: right; white-space: nowrap; }
.pub-table .c-links a { font-size: 13px; font-weight: 600; text-decoration: none; margin-left: 10px; }
.pub-table .c-links a:hover { text-decoration: underline; }
.pub-table tr.is-hidden .pub-title { color: #6b7f94; }
.pub-table .c-src .pub-hide { margin: 6px 0 0 -10px; }
.pub-title { display: block; font-weight: 600; color: var(--navy); line-height: 1.45; }
.pub-venue { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; font-style: italic; }
/* Click a paper to expand its abstract (native <details>: keyboard + screen-reader friendly) */
.pub-details > summary { display: block; list-style: none; cursor: pointer; font-size: inherit; color: inherit; border-radius: 4px; }
.pub-details > summary::-webkit-details-marker { display: none; }
.pub-details > summary:hover .pub-title { color: var(--blue); }
.pub-toggle { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--blue); }
.pub-toggle::after {
  content: ""; width: 6px; height: 6px; margin-top: -3px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg); transition: transform .15s;
}
.pub-details[open] .pub-toggle::after { transform: rotate(-135deg); margin-top: 3px; }
.pub-abstract {
  margin: 10px 0 2px; padding: 12px 14px; max-width: 72ch;
  font-size: 14px; line-height: 1.7; color: #2c4a68;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
}
.type-badge { display: inline-block; font-size: 12px; color: #2a5b88; background: #f0f6fc; border: 1px solid #dce9f5; border-radius: 6px; padding: 1px 8px; white-space: nowrap; }
.type-badge.t-conference-paper { color: #5b3f8a; background: #f4f0fb; border-color: #e2d8f3; }
.type-badge.t-book-chapter, .type-badge.t-book { color: #7a4a12; background: #fdf5ea; border-color: #f1e0c6; }
.type-badge.t-preprint, .type-badge.t-other { color: var(--muted); background: var(--bg); border-color: var(--line); }
.pub-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 14px; font-size: 13px; color: var(--muted); }
.pub-empty { padding: 20px 0; }

@media (max-width: 760px) {
  .pub-card .card-head { padding-right: 0; }
  .pub-filter { position: static; width: auto; margin-bottom: 12px; }
  .pub-table thead { display: none; }
  .pub-table, .pub-table tbody, .pub-table tr, .pub-table td { display: block; width: auto; }
  .pub-table tr { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .pub-table td { padding: 0; border: 0; }
  .pub-table .c-year { grid-row: span 3; width: auto; }
  .pub-table .c-type, .pub-table .c-src, .pub-table .c-links { width: auto; text-align: left; }
  .pub-table .c-links a { margin: 0 12px 0 0; }
}
.match-explanation.pub { color: #405e7d; background: var(--bg); }
