:root {
  --navy-900: #0f2036;
  --navy-800: #13263f;
  --navy-700: #1b3352;
  --ink: #0f172a;
  --ink-muted: #475569;
  --tagline: #bcd4ee;
  --caption: #dbe6f3;
  --page: #e9edf2;
  --surface: #ffffff;
  --line: #d8dee6;
  --link: #1d4f91;
  --focus: #7cc4ff;
  --green: #15803d;
  --radius-lg: 24px;
  --radius-md: 16px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--page);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- Search box (shared) ---------- */

.search {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius-md);
}

.search__icon {
  position: absolute;
  left: 1.1rem;
  color: var(--ink-muted);
  pointer-events: none;
}

.search__input {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--ink);
  padding: 1.05rem 1.25rem 1.05rem 3.4rem;
  border-radius: inherit;
}

.search__input::placeholder { color: #64748b; }
.search__input:focus { outline: none; }
.search:focus-within { box-shadow: 0 0 0 3px var(--focus); }

/* ---------- Landing page (full screen) ---------- */

.page-home {
  min-height: 100vh;
  min-height: 100dvh;
  color: #fff;
  /* The night-sky gradient that used to sit inside the hero card, now the whole page. */
  background:
    radial-gradient(ellipse 70% 80% at 45% 55%, #0d4a7d 0%, #082c4f 45%, #051526 100%) fixed,
    #051526;
}

.sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

.landing {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* A soft dark pool behind the text keeps it readable over the constellation. */
.landing::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse 46% 38% at 50% 50%, rgb(5 21 38 / 0.72) 0%, rgb(5 21 38 / 0) 100%);
}

.landing__top {
  display: flex;
  justify-content: flex-end;
  padding: 18px clamp(16px, 4vw, 40px);
}

.landing__main {
  align-self: center;
  justify-self: center;
  width: min(100% - 32px, 680px);
  text-align: center;
  padding: 24px 0 48px;
}

.landing__title {
  margin: 0;
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-shadow: 0 2px 24px rgb(5 21 38 / 0.6);
}

.landing__tagline {
  margin: 1rem 0 0;
  color: var(--tagline);
  font-size: clamp(1.05rem, 2.6vw, 1.4rem);
  font-weight: 400;
}

.search--hero {
  margin-top: clamp(28px, 5vw, 44px);
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  border-radius: 999px;
  box-shadow: 0 18px 50px -18px rgb(0 0 0 / 0.6);
}

.search--hero .search__input { padding-block: clamp(0.95rem, 2.2vw, 1.2rem); padding-left: 3.5rem; }
.search--hero .search__icon { left: 1.3rem; }

.landing__caption {
  margin: 1.4rem 0 0;
  color: rgb(219 230 243 / 0.75);
  font-size: 0.95rem;
}

.landing__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 16px clamp(16px, 4vw, 40px) 20px;
  color: rgb(219 230 243 / 0.7);
  font-size: 0.85rem;
}

.domain { display: inline-flex; align-items: center; gap: 0.5rem; letter-spacing: 0.01em; }
.domain svg { flex: none; opacity: 0.8; }
.stats { font-variant-numeric: tabular-nums; }

/* ---------- Search results ---------- */

.topbar { background: var(--navy-800); padding: 14px 16px; }

.topbar__inner {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}

.brand {
  color: #fff;
  font-weight: 700;
  font-size: 1.2rem;
  text-decoration: none;
  white-space: nowrap;
}

.search--compact { flex: 1 1 320px; border-radius: 12px; }
.search--compact .search__input { padding-block: 0.7rem; padding-left: 3rem; }
.search--compact .search__icon { left: 0.9rem; width: 20px; height: 20px; }

.results { max-width: 880px; margin: 0 auto; padding: 20px 16px 48px; }

.notice {
  margin: 0 0 20px;
  padding: 0.75rem 1rem;
  border-left: 4px solid #d97706;
  background: #fff7ed;
  border-radius: 8px;
  color: #7c2d12;
  font-size: 0.9rem;
}

.notice code { font-size: 0.85em; }

.results__summary { font-size: 1.05rem; font-weight: 500; color: var(--ink-muted); margin: 0 0 12px; }
.results__summary q { color: var(--ink); font-weight: 600; }

.result-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }

.result {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}

.result__title { margin: 0; font-size: 1.08rem; line-height: 1.35; font-weight: 600; }
.result__title a { color: var(--link); text-decoration: none; }
.result__title a:hover { text-decoration: underline; }
.result__authors { margin: 6px 0 0; font-size: 0.92rem; }
.result__meta { margin: 2px 0 0; font-size: 0.88rem; color: var(--green); }
.result__abstract { margin: 8px 0 0; font-size: 0.9rem; color: var(--ink-muted); }

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 24px;
  font-size: 0.95rem;
}

.pager a { color: var(--link); font-weight: 600; }

.empty { color: var(--ink-muted); }

.result__doi { color: var(--ink-muted); }

.result__links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 10px 0 0;
  font-size: 0.88rem;
}

.result__links a { color: var(--link); font-weight: 500; }

/* ---------- Article detail ---------- */

.article { max-width: 1080px; margin: 0 auto; padding: 16px 16px 56px; }
.article__back { margin: 0 0 14px; font-size: 0.92rem; }
.article__back a { color: var(--link); }

.article__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

@media (min-width: 880px) {
  .article__layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .article__aside { position: sticky; top: 16px; }
}

.article__main,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.article__main { padding: clamp(18px, 3vw, 28px); }

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }

.badge {
  font-size: 0.78rem;
  padding: 2px 10px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--ink-muted);
}

.badge--oa { background: #dcfce7; color: #166534; }

.article__title {
  margin: 0;
  font-size: clamp(1.3rem, 3vw, 1.75rem);
  line-height: 1.3;
  font-weight: 600;
}

.article__alt-title { margin: 6px 0 0; color: var(--ink-muted); font-style: italic; }

.authors {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  margin: 12px 0 0;
  padding: 0;
}

.authors li:not(:last-child)::after { content: ';'; margin-right: 0.5em; }

.article__source { margin: 10px 0 0; color: var(--ink-muted); }
.article__source strong { color: var(--green); font-weight: 600; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px 20px;
  margin: 18px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
}

.facts div { min-width: 0; }
.facts dt { font-size: 0.78rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.facts a { color: var(--link); }

.article__section { margin-top: 22px; }
.article__section h2 { font-size: 1.05rem; margin: 0 0 8px; }
.abstract { margin: 0 0 12px; line-height: 1.7; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }

.chips a {
  display: inline-block;
  padding: 3px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.88rem;
}

.chips a:hover { border-color: var(--link); color: var(--link); }

.provenance {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.provenance code { overflow-wrap: anywhere; }
.provenance summary { cursor: pointer; margin-top: 8px; color: var(--link); }

.provenance pre {
  max-height: 320px;
  overflow: auto;
  padding: 12px;
  background: #f6f8fa;
  border-radius: 8px;
  font-size: 0.78rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.article__aside { display: grid; gap: 16px; }
.panel { padding: 16px; display: grid; gap: 8px; align-content: start; }
.panel__title { font-size: 1rem; margin: 0 0 4px; }

.button {
  display: block;
  text-align: center;
  padding: 0.65rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}

.button:hover { border-color: var(--link); color: var(--link); }
.button--primary { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.button--primary:hover { background: var(--navy-700); color: #fff; }

.cite__label { margin: 6px 0 0; font-size: 0.78rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.cite { margin: 0; font-size: 0.88rem; overflow-wrap: anywhere; }
.cite__note { margin: 6px 0 0; font-size: 0.78rem; color: var(--ink-muted); }

.link-button {
  justify-self: start;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.85rem;
  color: var(--link);
  cursor: pointer;
}
.abstract__lang { margin: 14px 0 4px; font-size: 0.78rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.04em; }

.result__cited { color: var(--ink); font-weight: 500; }

.index-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.index-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.index-row:last-child { border-bottom: 0; }
.index-row__name { font-weight: 600; }
.index-row__state { text-align: right; font-size: 0.88rem; }
.index-row__state small { display: block; color: var(--ink-muted); font-size: 0.75rem; }
.index-row__state--found, .index-row__state--found a { color: #166534; }
.index-row__state--missing { color: #b45309; }
.index-row__state--unknown { color: var(--ink-muted); }
.index-row__count { grid-column: 1 / -1; font-size: 0.88rem; color: var(--ink-muted); }
.index-row__count strong { color: var(--ink); font-size: 1.05rem; }

/* ---------- Wide search layout with filters ---------- */

.topbar__inner--wide { max-width: 1440px; }

.query-form {
  flex: 1 1 520px;
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.query-form .search--compact { flex: 1 1 auto; }

.query-form__field,
.query-form__submit {
  border: 0;
  border-radius: 12px;
  font: inherit;
  padding: 0 0.9rem;
}

.query-form__field { background: #fff; color: var(--ink); }
.query-form__submit { background: #2f6fb3; color: #fff; font-weight: 600; cursor: pointer; }
.query-form__submit:hover { background: #255d98; }

.search-layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

@media (min-width: 960px) {
  .search-layout { grid-template-columns: 300px minmax(0, 1fr); }
  .filters { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
}

.results--wide { max-width: none; margin: 0; padding: 0; }

.filters__wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.filters__summary {
  padding: 14px 16px;
  font-weight: 700;
  cursor: pointer;
  list-style-position: inside;
}

.filters__form { padding: 0 16px 16px; }
.filters__hint { margin: 6px 0 4px; font-size: 0.8rem; color: var(--ink-muted); }

.filter-actions { display: flex; gap: 8px; }
.filter-actions--bottom { margin-top: 12px; }

.btn {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.btn:hover { border-color: var(--link); color: var(--link); }
.btn--primary { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.btn--primary:hover { background: var(--navy-700); color: #fff; }
.btn--small { flex: 0 0 auto; padding: 0.35rem 0.7rem; font-size: 0.85rem; }

.facet { border: 0; border-top: 1px solid var(--line); margin: 12px 0 0; padding: 12px 0 0; min-width: 0; }
.facet__title { padding: 0; font-weight: 700; font-size: 0.92rem; }
.facet__total { color: var(--ink-muted); font-weight: 400; font-size: 0.8rem; }

.facet__list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }

.facet__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  font-size: 0.88rem;
}

.facet__item label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; min-width: 0; }
.facet__item input { margin-top: 3px; flex: none; }
.facet__label { overflow-wrap: anywhere; }
.facet__count { color: var(--ink-muted); font-size: 0.8rem; }
.facet__item--included .facet__label { font-weight: 600; }
.facet__check { color: #166534; font-weight: 700; width: 13px; flex: none; }
.facet__more summary { margin-top: 6px; font-size: 0.85rem; color: var(--link); cursor: pointer; }

.year-range { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-top: 8px; }
.year-range label { display: grid; gap: 2px; font-size: 0.8rem; color: var(--ink-muted); }
.year-range input { width: 5.5rem; padding: 0.35rem 0.5rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; }

.results__head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.results__head .results__summary { margin: 0; color: var(--ink); }
.results__corpus { color: var(--ink-muted); font-weight: 400; font-size: 0.9rem; }

.sort-form { display: flex; gap: 8px; align-items: center; font-size: 0.9rem; }
.sort-form select { padding: 0.35rem 0.5rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }

.chips--active { margin-bottom: 12px; align-items: center; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  background: #e0ecfa;
  color: #1e3a5f;
}

.chip--exclude { background: #fde8e8; color: #7f1d1d; }
.chip a { color: inherit; text-decoration: none; font-weight: 700; padding: 0 6px; border-radius: 999px; }
.chip a:hover { background: rgb(0 0 0 / 0.08); }
.chips__clear { font-size: 0.85rem; color: var(--link); }

.search-string {
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.88rem;
}

.search-string summary { cursor: pointer; font-weight: 600; }
.search-string code { display: block; margin-top: 8px; padding: 8px 10px; background: #f6f8fa; border-radius: 6px; overflow-wrap: anywhere; }
.search-string__meta { margin: 6px 0 0; color: var(--ink-muted); font-size: 0.8rem; }

.notice--compact { padding: 0.5rem 0.9rem; font-size: 0.85rem; margin-bottom: 12px; }

@media (max-width: 600px) {
  .query-form { flex-wrap: wrap; }
  .query-form .search--compact { order: -1; flex-basis: 100%; }
  .query-form__field { flex: 1 1 auto; min-height: 42px; }
  .query-form__submit { flex: 0 0 auto; }
}

/* ---------- Accounts, tiers, export ---------- */

.user-nav { display: flex; align-items: center; gap: 12px; margin-left: auto; font-size: 0.9rem; }
.user-nav form { margin: 0; }
.user-nav__account { display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; }
.user-nav__name { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-nav__link { color: #dbe6f3; background: none; border: 0; font: inherit; cursor: pointer; padding: 0; text-decoration: none; white-space: nowrap; }
.user-nav__link:hover { color: #fff; text-decoration: underline; }
.user-nav__link--strong { color: #fff; font-weight: 600; border: 1px solid rgb(255 255 255 / 0.5); border-radius: 8px; padding: 0.3rem 0.7rem; }

.tier-badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em; }
.tier-badge--public { background: #e2e8f0; color: #334155; }
.tier-badge--academic { background: #dbeafe; color: #1e40af; }
.tier-badge--institution { background: #dcfce7; color: #166534; }

.flash { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.flash__item { padding: 0.6rem 0.9rem; border-radius: 8px; background: #e0ecfa; color: #1e3a5f; font-size: 0.9rem; }
.flash__item--success { background: #dcfce7; color: #14532d; }
.flash__item--error { background: #fde8e8; color: #7f1d1d; }
.flash__item--warning { background: #fff7ed; color: #7c2d12; }
.flash__item a { color: inherit; font-weight: 600; }

.export-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.9rem;
}

.export-panel__title { font-weight: 700; }
.export-panel select, .export-panel input { padding: 0.35rem 0.5rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
.export-panel input { width: 6.5rem; }
.export-panel__quota { flex-basis: 100%; margin: 0; color: var(--ink-muted); font-size: 0.82rem; }
.export-panel__quota a { color: var(--link); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn--danger { background: #b91c1c; border-color: #b91c1c; color: #fff; flex: 0 0 auto; }
.btn--danger:hover { background: #991b1b; color: #fff; }

.auth, .account { max-width: 1100px; margin: 0 auto; padding: 24px 16px 56px; }
.auth__card { max-width: 520px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: clamp(18px, 4vw, 32px); }
.auth__card h1 { margin-top: 0; font-size: 1.5rem; }
.auth__card a { color: var(--link); }
.auth__card form p, .stack-form > div { display: grid; gap: 4px; margin: 0 0 12px; }
.auth__card input:not([type=checkbox]):not([type=hidden]),
.stack-form input:not([type=checkbox]):not([type=hidden]) {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
.auth__card button[type=submit], .auth__card button:not([class]) {
  padding: 0.6rem 1.1rem;
  border: 0;
  border-radius: 8px;
  background: var(--navy-800);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.auth__card .helptext, .stack-form .helptext { font-size: 0.8rem; color: var(--ink-muted); }
.auth__card ul.errorlist, .stack-form ul.errorlist { margin: 0; padding-left: 1rem; color: #b91c1c; font-size: 0.85rem; }
.prose { max-width: 720px; }
.prose h2 { font-size: 1.1rem; margin-top: 1.5rem; }

.account__title { margin: 0 0 16px; }
.account__grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 880px) { .account__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.account__wide { grid-column: 1 / -1; }
.panel__subtitle { font-size: 0.92rem; margin: 14px 0 4px; }
.tier-line { margin: 0; font-size: 1rem; }
.tier-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin-top: 8px; }
.tier-table th, .tier-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tier-table code { overflow-wrap: anywhere; font-size: 0.8rem; }
.tier-table__current td { background: #f0f7ff; font-weight: 600; }
.tier-table a { color: var(--link); white-space: nowrap; }
.plain-list { margin: 4px 0 8px; padding-left: 1.1rem; font-size: 0.9rem; }
.plain-list a, .panel a { color: var(--link); }
.account__footer { margin-top: 20px; font-size: 0.88rem; }
.account__footer a { color: var(--link); }
.danger-link { color: #b91c1c !important; }

/* ---------- Collaboration network ---------- */

.authors a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.authors a:hover { color: var(--link); text-decoration-color: currentColor; }
.authors__org { color: var(--ink-muted); font-size: 0.72rem; }

.collab { margin-top: 26px; }
.collab h2 { font-size: 1.05rem; margin: 0 0 4px; }
.collab__lead { margin: 0 0 8px; color: var(--ink-muted); font-size: 0.88rem; }
.collab__lead strong { color: #7C3AED; }

.collab__canvas {
  width: 100%;
  height: clamp(320px, 55vw, 520px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
}

.collab__info { margin: 6px 0 0; min-height: 1.4em; font-size: 0.85rem; color: var(--ink); }
.collab__legend { display: grid; gap: 6px; margin-top: 10px; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; font-size: 0.82rem; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend--keys { color: var(--ink-muted); }
.legend__dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.legend__line { width: 22px; height: 0; border-top: 3px solid; flex: none; }
.legend__line--cross { border-color: #7C3AED; }
.legend__line--same { border-color: #9AA5B1; }
.legend__line--unknown { border-color: #D5DAE1; border-top-style: dashed; }
.collab__table { margin-top: 10px; font-size: 0.88rem; }
.collab__table summary { cursor: pointer; color: var(--link); }
@media (min-width: 880px) { .article__layout--single { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Search collaboration map ---------- */

.view-tabs { display: flex; gap: 4px; margin: 4px 0 12px; border-bottom: 1px solid var(--line); }
.view-tabs a {
  padding: 8px 14px;
  color: var(--ink-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}
.view-tabs a:hover { color: var(--ink); }
.view-tabs a[aria-current="page"] { color: var(--navy-800); border-bottom-color: var(--navy-800); }

.collab--search { margin-top: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.collab__canvas--large { height: clamp(420px, 62vh, 720px); }

.map-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}
.map-stats div { background: #f4f6f9; border-radius: 8px; padding: 8px 10px; }
.map-stats dt { font-size: 0.75rem; color: var(--ink-muted); }
.map-stats dd { margin: 2px 0 0; font-size: 1.2rem; font-weight: 700; }
.map-stats__cross { color: #7C3AED; }

.collab__info-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; align-items: baseline; }
.collab__actions { margin: 6px 0 0; display: flex; gap: 14px; font-size: 0.88rem; }
.collab__actions a { color: var(--link); font-weight: 600; }
.map-tables { display: grid; gap: 6px; margin-top: 10px; font-size: 0.88rem; }
.map-tables summary { cursor: pointer; color: var(--link); }
.legend__dot--inline { display: inline-block; margin-right: 6px; vertical-align: -1px; }
/* `hidden` must win over the flex display above. */
.collab__actions[hidden], .collab__actions a[hidden] { display: none; }

.spelling {
  margin: 0 0 12px;
  padding: 0.6rem 0.9rem;
  background: #f0f7ff;
  border: 1px solid #cfe2fb;
  border-radius: 8px;
  font-size: 0.92rem;
}
.spelling a { color: var(--link); font-weight: 600; }
.spelling a + a, .spelling strong + a { margin-left: 0.5rem; }

.query-form { flex-wrap: wrap; }
.query-form__expand {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #dbe6f3;
  font-size: 0.85rem;
  cursor: pointer;
}
.query-form__expand input { width: 16px; height: 16px; }

.expansion {
  margin: 0 0 12px;
  padding: 0.6rem 0.9rem;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  border-radius: 8px;
  font-size: 0.88rem;
}
.expansion__title { margin: 0 0 4px; font-weight: 600; color: #4c1d95; }
.expansion ul { margin: 0 0 6px; padding-left: 1.1rem; }
.expansion__alt { white-space: nowrap; }
.expansion a { color: var(--link); font-weight: 600; }
.expansion--none { background: #f8fafc; border-color: var(--line); color: var(--ink-muted); }

.query-form__mode { border: 0; border-radius: 12px; font: inherit; padding: 0 0.7rem; background: #fff; color: var(--ink); }
.query-note { margin: 0 0 12px; font-size: 0.85rem; color: var(--ink-muted); }
.result__partial {
  font-size: 0.78rem;
  padding: 1px 8px;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
}
@media (max-width: 600px) { .query-form__mode { flex: 1 1 auto; min-height: 42px; } }


/* Keyword map (search page) */
.kmap__locked { padding: 8px 4px; max-width: 62ch; }
.kmap__locked h3 { margin: 0 0 8px; font-size: 1.05rem; }
.kmap__locked p { color: var(--ink-muted); }
.kmap__toolbar { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; margin: 12px 0 10px; }
.kmap__modes { display: flex; flex-wrap: wrap; gap: 6px; }
.kmap__modes button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 0.85rem; cursor: pointer; }
.kmap__modes button[aria-checked="true"] { background: var(--navy-700); border-color: var(--navy-700); color: #fff; }
.kmap__options { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 0.85rem; color: var(--ink-muted); }
.kmap__options select { margin-left: 4px; font: inherit; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.kmap__canvas { position: relative; padding: 0; overflow: hidden; touch-action: none; background: #fbfcfd; }
.kmap__canvas canvas { display: block; cursor: grab; }
.kmap__zoom { position: absolute; right: 10px; top: 10px; display: grid; gap: 4px; }
.kmap__zoom button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, 0.92); color: var(--ink); font-size: 1rem; cursor: pointer; }
.kmap__scale { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--ink-muted); }
.kmap__scale small { flex-basis: 100%; }
.kmap__ramp { display: inline-block; width: min(260px, 50vw); height: 10px; border-radius: 5px; }
.kmap__ramp--overlay { background: linear-gradient(90deg, rgb(68, 1, 84), rgb(59, 82, 139), rgb(33, 145, 140), rgb(94, 201, 98), rgb(253, 231, 37)); }
.kmap__ramp--density { background: linear-gradient(90deg, rgb(22, 33, 92), rgb(32, 93, 160), rgb(43, 160, 148), rgb(140, 200, 80), rgb(250, 230, 60)); }
.kmap__method { font-size: 0.85rem; color: var(--ink-muted); max-width: 80ch; }
.kmap__downloads { margin: 10px 0 0; font-size: 0.88rem; }
.map-stats dd small { font-size: 0.75rem; font-weight: 500; color: var(--ink-muted); }
[data-kmap-legend][hidden] { display: none; }

.kmap__clean { flex-basis: 100%; }
.kmap__clean summary { cursor: pointer; color: var(--link); }
.kmap__clean label { display: grid; gap: 4px; margin-top: 8px; }
.kmap__clean textarea { width: 100%; font: inherit; font-size: 0.85rem; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); resize: vertical; }
.kmap__themes { position: absolute; inset: 0; width: 100%; height: 100%; background: #fbfcfd; }
.kmap__themes text { font-family: var(--font); fill: var(--ink); }
.kmap__themes .quadrant-name { fill: var(--ink-muted); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.kmap__themes .axis { fill: var(--ink-muted); font-size: 12px; }
.kmap__themes .theme { cursor: pointer; }
.kmap__themes .theme:focus { outline: none; }
.kmap__themes .theme:focus-visible circle, .kmap__themes .theme.is-selected circle { stroke: var(--ink); stroke-width: 2; }
.kmap__canvas canvas[hidden], .kmap__zoom[hidden] { display: none; }
[data-kmap-legend-keys][hidden] { display: none; }
.kmap__themes[hidden] { display: none; }
.kmap__options input[name="kw_cuts"] { margin-left: 4px; font: inherit; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; width: 8.5em; }

/* Journal directory and profile */
.journal__lead { color: var(--ink-muted); font-size: 0.92rem; max-width: 70ch; }
.journal__sort { margin: 10px 0; font-size: 0.9rem; color: var(--ink-muted); }
.journal__sort select { margin-left: 6px; font: inherit; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; }
.journal__table-wrap { overflow-x: auto; }
.journal__table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.journal__table td a { white-space: normal; }
.journal__table small, .muted { color: var(--ink-muted); }
.journal__years { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 6px; }
.journal__year { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.journal__bar { display: block; width: 100%; max-width: 26px; min-height: 2px; background: var(--navy-700); border-radius: 3px 3px 0 0; }
.journal__year small { font-size: 0.68rem; color: var(--ink-muted); margin-top: 3px; }
.journal__details { margin-top: 8px; font-size: 0.88rem; }
.journal__details summary { cursor: pointer; color: var(--link); }
.journal__group { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); margin: 18px 0 6px; }
.journal__indicators { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.journal__indicator-head { display: flex; justify-content: space-between; gap: 12px; font-size: 0.92rem; }
.journal__meter { position: relative; height: 8px; margin-top: 4px; border-radius: 4px; background: #eef2f7; }
.journal__fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--green); }
.journal__fill--below { background: #d97706; }
.journal__median { position: absolute; top: -3px; width: 2px; height: 14px; margin-left: -1px; background: var(--ink); }
.journal__def { margin: 4px 0 0; font-size: 0.8rem; color: var(--ink-muted); }
.journal__def code { font-size: 0.78rem; }
.badge--warn { background: #fef3c7; color: #92400e; }
.journal__panel { padding: 14px 16px; margin-bottom: 12px; }
.journal__panel h2 { font-size: 0.95rem; margin: 0 0 8px; }
.journal__dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0 0 10px; font-size: 0.86rem; }
.journal__dl dt { color: var(--ink-muted); }
.journal__dl dd { margin: 0; overflow-wrap: anywhere; }
.journal__list { margin: 0; padding-left: 20px; font-size: 0.88rem; display: grid; gap: 4px; }
.journal__list small { color: var(--ink-muted); }
.journal__keywords { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; }
.result__journal { color: inherit; text-decoration: none; }
.result__journal:hover { color: var(--link); text-decoration: underline; }
.article__source strong a { color: inherit; text-decoration: none; }
.article__source strong a:hover { text-decoration: underline; }
.landing__footer .stats a { color: inherit; text-decoration: none; border-bottom: 1px dotted currentColor; }

/* Tokens (ADR 0020) */
.user-nav__tokens { font-size: 0.8rem; font-weight: 600; color: #7c3aed; text-decoration: none; padding: 1px 9px; border: 1px solid #ddd6fe; border-radius: 999px; white-space: nowrap; }
.user-nav__tokens:hover { background: #f5f3ff; }
.token-balance { font-size: 2rem; font-weight: 700; margin: 0.25rem 0; }
.token-balance small { font-size: 1rem; font-weight: 400; color: #64748b; }
.token-plus { color: #166534; font-variant-numeric: tabular-nums; }
.token-minus { color: #b91c1c; font-variant-numeric: tabular-nums; }
.map-tokens { margin: 0.25rem 0 0.5rem; }

/* Source title grouped by SINTA rank */
.facet__groups { gap: 6px; }
.facet__group summary { list-style: none; cursor: pointer; }
.facet__group summary::-webkit-details-marker { display: none; }
.facet__group summary::before { content: '▸'; color: var(--ink-muted); font-size: 0.75rem; margin-right: 4px; }
.facet__group details[open] > summary::before { content: '▾'; }
.facet__group summary.facet__item { display: flex; align-items: flex-start; }
.facet__group summary label { flex: 1; }
.facet__label--group { font-weight: 600; }
.facet__sub { margin: 4px 0 4px 22px; padding-left: 8px; border-left: 2px solid var(--line); }

/* Search in progress (loading.js): moving bar at the top and a spinner in the search box */
.page-progress { position: fixed; inset: 0 0 auto; height: 3px; z-index: 1000; overflow: hidden; background: rgba(59, 130, 246, 0.18); }
.page-progress[hidden] { display: none; }
.page-progress span { position: absolute; inset: 0 auto 0 0; width: 40%; background: linear-gradient(90deg, #38bdf8, #3b82f6, #7c3aed); border-radius: 0 3px 3px 0; animation: page-progress 1.1s ease-in-out infinite; }
@keyframes page-progress { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
html.is-loading, html.is-loading * { cursor: progress; }
.search.is-loading .search__icon { visibility: hidden; }
.search.is-loading::after {
  content: ''; position: absolute; top: 50%; left: 1.3rem; width: 20px; height: 20px; margin-top: -10px;
  border: 2.5px solid rgba(59, 130, 246, 0.25); border-top-color: #3b82f6; border-radius: 50%;
  animation: search-spin 0.7s linear infinite; pointer-events: none;
}
.search--compact.is-loading::after { left: 0.9rem; }
@keyframes search-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .page-progress span { animation-duration: 3s; }
  .search.is-loading::after { animation-duration: 2s; }
}

/* Data sources and opt-out page (ADR 0021) */
.datasrc { padding: 24px 16px 48px; }
.datasrc__card { max-width: 760px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: clamp(18px, 4vw, 36px); }
.datasrc__card h1 { margin-top: 0; font-size: 1.6rem; }
.datasrc__card h2 { font-size: 1.1rem; margin-top: 1.6em; }
.datasrc__card a { color: var(--link); }
.datasrc__card li { margin-bottom: 0.35em; }
.table-scroll { overflow-x: auto; }
.facet__hint { margin: 4px 0 0; font-size: 0.78rem; color: var(--ink-muted); }

/* Library: saved searches and maps (ADR 0023) */
.save-search { margin: 0; }
.map-save { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.meter { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 6px 0; }
.meter span { display: block; height: 100%; background: #7c3aed; }
.library-table td form { margin: 0; }
.library-map .results__summary { margin: 4px 0; }
