/* Research Atlas — International Typographic Style.
   One typeface, a strict grid, hairline rules, black on white, a single red accent. */

:root {
  color-scheme: light;
  --paper: #ffffff;
  --paper-2: #f3f3f1;
  --paper-3: #e9e9e6;
  --ink: #0c0c0c;
  --ink-2: #333333;
  --muted: #6b6b6b;
  --faint: #9d9d9a;
  --hair: #e1e1dd;
  --line: #c9c9c4;
  --accent: #e3241b;
  --accent-soft: rgba(227, 36, 27, 0.12);
  --ok: #0a7a45;
  --warn: #b25e00;
  --scrim: rgba(12, 12, 12, 0.36);

  --font: "Inter", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --gutter: clamp(16px, 3.2vw, 48px);
  --col-gap: clamp(16px, 2vw, 32px);
  --bar-h: 68px;
  --rail-w: 252px;
  --detail-w: clamp(380px, 31vw, 480px);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0c0c0c;
    --paper-2: #171717;
    --paper-3: #222222;
    --ink: #f1f1ee;
    --ink-2: #d2d2ce;
    --muted: #9a9a96;
    --faint: #6c6c69;
    --hair: #262626;
    --line: #3a3a38;
    --accent: #ff3b30;
    --accent-soft: rgba(255, 59, 48, 0.2);
    --ok: #3ccf86;
    --warn: #f0a24a;
    --scrim: rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0c0c0c;
  --paper-2: #171717;
  --paper-3: #222222;
  --ink: #f1f1ee;
  --ink-2: #d2d2ce;
  --muted: #9a9a96;
  --faint: #6c6c69;
  --hair: #262626;
  --line: #3a3a38;
  --accent: #ff3b30;
  --accent-soft: rgba(255, 59, 48, 0.2);
  --ok: #3ccf86;
  --warn: #f0a24a;
  --scrim: rgba(0, 0, 0, 0.6);
}

/* ---------- Base ---------- */

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

html {
  min-width: 320px;
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  font-optical-sizing: auto;
  font-feature-settings: "cv11", "ss01", "tnum";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-locked {
  overflow: hidden;
}

h1,
h2,
h3,
p,
dl,
dd,
ol,
ul,
fieldset {
  margin: 0;
  padding: 0;
}

ol,
ul {
  list-style: none;
}

fieldset {
  border: 0;
  min-width: 0;
}

button,
input,
select {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

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

::selection {
  background: var(--accent);
  color: #fff;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

mark {
  background: var(--accent-soft);
  color: inherit;
  box-shadow: 0 1.5px 0 var(--accent);
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: square;
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: none;
}

/* ---------- Masthead ---------- */

.masthead {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--col-gap);
  padding: 18px var(--gutter);
  border-bottom: 1px solid var(--ink);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.wordmark-mark {
  position: relative;
  width: 18px;
  height: 18px;
  background: var(--accent);
}

.wordmark-mark::before,
.wordmark-mark::after {
  content: "";
  position: absolute;
  background: #fff;
}

.wordmark-mark::before {
  inset: 3px 7px;
}

.wordmark-mark::after {
  inset: 7px 3px;
}

.masthead-meta {
  display: flex;
  gap: 20px;
  color: var(--muted);
  font-size: 13px;
}

.masthead-nav {
  display: flex;
  gap: 22px;
  font-size: 13px;
  font-weight: 550;
}

.masthead-nav a {
  position: relative;
}

.masthead-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -3px;
  height: 1.5px;
  background: currentColor;
  transition: right 220ms var(--ease);
}

.masthead-nav a:hover::after {
  right: 0;
}

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--col-gap);
  padding: clamp(28px, 3.6vw, 56px) var(--gutter) 0;
}

.hero-kicker {
  grid-column: 1 / -1;
  margin-bottom: clamp(14px, 1.6vw, 22px);
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-title {
  grid-column: 1 / span 8;
  font-size: clamp(42px, 6vw, 100px);
  font-weight: 760;
  line-height: 0.92;
  letter-spacing: -0.048em;
}

.hero-lede {
  grid-column: 9 / -1;
  align-self: end;
  max-width: 36ch;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.5;
}

.hero-stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  column-gap: var(--col-gap);
  margin-top: clamp(28px, 3.2vw, 48px);
  border-top: 2px solid var(--ink);
}

.hero-stats > div {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 2px;
  padding: 12px 0 18px;
}

.hero-stats dt {
  color: var(--muted);
  font-size: 13px;
}

.hero-stats dd {
  font-size: clamp(28px, 2.9vw, 46px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

/* ---------- Search bar (sticky) ---------- */

.searchbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--col-gap);
  height: var(--bar-h);
  padding: 0 var(--gutter);
  background: var(--paper);
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
  min-width: 0;
  cursor: text;
}

.search-glyph {
  flex: none;
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

.search-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  font-size: clamp(17px, 1.7vw, 22px);
  font-weight: 500;
  letter-spacing: -0.015em;
  outline: none;
}

.search-field input::placeholder {
  color: var(--faint);
}

.search-field input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search-field:focus-within .search-glyph {
  color: var(--accent);
}

.search-field:focus-within .search-kbd {
  opacity: 0;
}

.searchbar-actions {
  display: flex;
  gap: 8px;
}

.bar-button,
.solid-button,
.line-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 140ms, color 140ms;
}

.bar-button:hover,
.line-button:hover,
.bar-button[aria-pressed="true"],
.bar-button[aria-expanded="true"] {
  background: var(--ink);
  color: var(--paper);
}

.solid-button {
  background: var(--ink);
  color: var(--paper);
}

.solid-button:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.bar-count {
  min-width: 18px;
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}

#filtersButton {
  display: none;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
}

.icon-button:hover {
  border-color: var(--ink);
}

.icon-button svg {
  width: 20px;
  height: 20px;
}

.text-button {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-button:hover {
  color: var(--accent);
}

/* ---------- Workspace grid ---------- */

.workspace {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--detail-w);
  align-items: start;
  padding: 0 var(--gutter);
  column-gap: var(--col-gap);
}

.section-label {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section-label span {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ---------- Filter rail ---------- */

.rail {
  position: sticky;
  top: var(--bar-h);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--bar-h));
  max-height: calc(100dvh - var(--bar-h));
  overflow: auto;
  overscroll-behavior: contain;
  padding-bottom: 32px;
  scrollbar-width: thin;
}

.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 0 14px;
  border-bottom: 2px solid var(--ink);
}

.rail-close,
.rail-foot {
  display: none;
}

.filter-group {
  padding: 16px 0 18px;
  border-bottom: 1px solid var(--hair);
}

.filter-group legend {
  float: left;
  width: 100%;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.filter-group legend + * {
  clear: left;
}

.rail select,
.rail input[type="number"],
.sort-field select {
  width: 100%;
  height: 40px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background-color: var(--paper);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink) 50%),
    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  font-size: 14px;
  appearance: none;
  transition: border-color 140ms;
}

.rail input[type="number"] {
  padding-right: 10px;
  background-image: none;
}

.rail select:hover,
.rail input[type="number"]:hover,
.sort-field select:hover {
  border-color: var(--ink);
}

.rail select:focus-visible,
.rail input[type="number"]:focus-visible,
.sort-field select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.rail select.is-set {
  border-color: var(--ink);
  font-weight: 600;
}

.type-list {
  display: flex;
  flex-direction: column;
}

.type-list button {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0 7px 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  transition: color 140ms;
}

.type-list button span {
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.type-list button::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--ink);
  transform: scaleY(0);
  transition: transform 240ms var(--ease);
}

.type-list button:hover,
.type-list button[aria-pressed="true"] {
  color: var(--ink);
}

.type-list button[aria-pressed="true"]::before {
  transform: scaleY(1);
}

.type-list button.is-empty {
  color: var(--faint);
}

.saved {
  padding: 18px 0;
  border-bottom: 1px solid var(--hair);
}

.saved-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.saved-list {
  display: grid;
}

.saved-item {
  display: grid;
  gap: 1px;
  padding: 8px 0;
  border-top: 1px solid var(--hair);
  text-align: left;
}

.saved-item strong {
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-item span {
  color: var(--muted);
  font-size: 12px;
}

.saved-item:hover strong {
  color: var(--accent);
}

.saved-empty {
  color: var(--faint);
  font-size: 13px;
}

.shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding-top: 18px;
  color: var(--muted);
  font-size: 12px;
}

.shortcuts span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ---------- Results ---------- */

.results {
  min-width: 0;
  padding-bottom: 64px;
}

.results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 14px;
  border-bottom: 2px solid var(--ink);
}

.results-count {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.results-count strong {
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.results-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 7px 0;
  border-bottom: 1px solid var(--hair);
}

.sort-field {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.sort-field select {
  width: auto;
  height: 32px;
  border-color: transparent;
  color: var(--ink);
  font-weight: 600;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hair);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 8px 0 10px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  font-weight: 600;
}

.chip small {
  font-weight: 450;
  opacity: 0.7;
}

.chip::after {
  content: "";
  width: 9px;
  height: 9px;
  background:
    linear-gradient(45deg, transparent 43%, currentColor 43%, currentColor 57%, transparent 57%),
    linear-gradient(-45deg, transparent 43%, currentColor 43%, currentColor 57%, transparent 57%);
}

.chip:hover {
  background: var(--accent);
  color: #fff;
}

.chip-clear {
  height: 28px;
  padding: 0 4px;
  font-size: 12px;
}

/* Result rows */

.result-list {
  counter-reset: row;
}

.row {
  position: relative;
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr) auto;
  column-gap: 14px;
  padding: 18px 14px 18px 0;
  border-bottom: 1px solid var(--hair);
  transition: background-color 120ms;
}

.row.is-entering {
  animation: row-in 420ms var(--ease) both;
  animation-delay: calc(var(--i, 0) * 22ms);
}

@keyframes row-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.row:hover {
  background: var(--paper-2);
}

.row.is-selected {
  background: var(--paper-2);
}

.row.is-selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: -1px;
  bottom: -1px;
  width: 3px;
  background: var(--accent);
}

.row-index {
  padding: 3px 0 0 12px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.row.is-selected .row-index {
  color: var(--accent);
}

.row-main {
  min-width: 0;
}

.row-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  margin-bottom: 3px;
  font-size: 12px;
}

.row-kind {
  flex: none;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.row-dept {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-flag {
  flex: none;
  color: var(--ok);
  font-weight: 700;
}

.row-flag.is-warn,
.detail-kind .is-warn {
  color: var(--warn);
}

.row-title {
  display: block;
  max-width: 100%;
  font-size: 19px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.018em;
  text-align: left;
}

.row-title::after {
  content: "";
  position: absolute;
  inset: 0;
}

.row-title:focus-visible {
  outline: none;
}

.row:has(.row-title:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.row-summary {
  display: -webkit-box;
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.row-tags {
  margin-top: 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-tags span + span::before {
  content: " / ";
  color: var(--faint);
}

.row-side {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.row-metrics {
  display: flex;
  gap: 18px;
  text-align: right;
}

.row-metric {
  display: flex;
  flex-direction: column-reverse;
  min-width: 52px;
}

.row-metric dt {
  color: var(--muted);
  font-size: 11px;
}

.row-metric dd {
  font-size: 18px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.row-metric.is-empty dd {
  color: var(--faint);
}

.save-toggle {
  position: relative;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: -4px 0 0;
  color: var(--faint);
  transition: color 140ms;
}

.save-toggle svg {
  width: 18px;
  height: 18px;
  stroke-linecap: butt;
  stroke-linejoin: miter;
}

.save-toggle:hover {
  color: var(--ink);
}

.save-toggle[aria-pressed="true"] {
  color: var(--accent);
}

.save-toggle[aria-pressed="true"] svg {
  fill: currentColor;
}

.row-skeleton {
  height: 112px;
  border-bottom: 1px solid var(--hair);
  background: linear-gradient(90deg, transparent 0%, var(--paper-2) 40%, transparent 80%) 0 0 / 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.load-more {
  width: 100%;
  height: 56px;
  margin-top: 24px;
  border: 1px solid var(--ink);
  font-size: 14px;
  font-weight: 600;
  transition: background-color 140ms, color 140ms;
}

.load-more:hover {
  background: var(--ink);
  color: var(--paper);
}

.empty {
  padding: 56px 0;
}

.empty-title {
  margin-bottom: 8px;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 720;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.empty p:not(.empty-title) {
  max-width: 44ch;
  margin-bottom: 20px;
  color: var(--muted);
}

/* ---------- Detail ---------- */

.detail {
  position: sticky;
  top: var(--bar-h);
  max-height: calc(100vh - var(--bar-h));
  max-height: calc(100dvh - var(--bar-h));
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  outline: none;
}

.detail-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 14px;
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
}

.detail-close {
  display: none;
}

.detail-content {
  padding-bottom: 48px;
}

.detail-empty {
  padding: 32px 0;
}

.detail-empty p:not(.empty-title) {
  color: var(--muted);
}

.detail-record.is-entering > * {
  animation: detail-in 360ms var(--ease) both;
}

.detail-record.is-entering > :nth-child(2) { animation-delay: 30ms; }
.detail-record.is-entering > :nth-child(3) { animation-delay: 60ms; }
.detail-record.is-entering > :nth-child(4) { animation-delay: 90ms; }
.detail-record.is-entering > :nth-child(n + 5) { animation-delay: 120ms; }

@keyframes detail-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.detail-head {
  padding: 26px 0 22px;
}

.detail-kind {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.detail-kind .is-recruiting {
  color: var(--ok);
}

.detail-kind .is-muted {
  color: var(--muted);
}

.detail-title {
  font-size: clamp(30px, 2.7vw, 42px);
  font-weight: 750;
  line-height: 1.02;
  letter-spacing: -0.038em;
  overflow-wrap: anywhere;
}

.detail-affiliation {
  margin-top: 12px;
  color: var(--ink-2);
  font-size: 14px;
}

.detail-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.line-button {
  height: 34px;
  padding: 0 12px;
}

.line-button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.detail-section {
  padding: 14px 0 26px;
  border-top: 1px solid var(--ink);
}

.detail-section h3 {
  margin-bottom: 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.detail-section > p {
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.55;
}

.detail-section .note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.link-list li {
  border-top: 1px solid var(--hair);
}

.link-list li:last-child {
  border-bottom: 1px solid var(--hair);
}

.link-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  font-size: 15px;
  font-weight: 600;
  transition: color 120ms, padding 200ms var(--ease);
}

.link-list a small {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 450;
}

.link-list a::after {
  content: "↗";
  flex: none;
  color: var(--muted);
  font-weight: 500;
}

.link-list a:hover {
  padding-left: 6px;
  color: var(--accent);
}

.link-list a:hover::after {
  color: var(--accent);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-grid > div {
  display: flex;
  flex-direction: column-reverse;
  padding-right: 8px;
}

.metric-grid > div + div {
  padding-left: 12px;
  border-left: 1px solid var(--hair);
}

.metric-grid dt {
  color: var(--muted);
  font-size: 12px;
}

.metric-grid dd {
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.metric-grid .is-empty dd {
  color: var(--faint);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.tag-list span {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 550;
}

.keyword-list {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  margin-top: 16px;
  font-size: 13px;
}

.keyword-label {
  width: 100%;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.keyword-list button {
  color: var(--ink-2);
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}

.keyword-list button:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.publication-list {
  counter-reset: pub;
}

.publication-list li {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 2px 0;
  padding: 12px 0;
  border-top: 1px solid var(--hair);
  counter-increment: pub;
}

.publication-list li::before {
  content: counter(pub, decimal-leading-zero);
  grid-row: span 3;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  padding-top: 2px;
}

.publication-list .paper-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.publication-list a.paper-title:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.publication-list span,
.publication-list small {
  color: var(--muted);
  font-size: 12px;
}

.publication-list .is-placeholder {
  display: block;
  color: var(--muted);
}

.publication-list .is-placeholder::before {
  content: none;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.field-grid div {
  min-width: 0;
}

.field-grid dt {
  color: var(--muted);
  font-size: 12px;
}

.field-grid dd {
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.field-grid dd.is-empty {
  color: var(--faint);
  font-weight: 450;
}

.inline-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.inline-link:hover {
  color: var(--accent);
}

.sub-heading {
  margin: 22px 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.evidence-list li {
  display: grid;
  gap: 3px;
  padding: 11px 0;
  border-top: 1px solid var(--hair);
}

.evidence-list li:last-child {
  border-bottom: 1px solid var(--hair);
}

.evidence-list strong {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
}

.evidence-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.evidence-quote {
  padding-left: 10px;
  border-left: 2px solid var(--line);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.evidence-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 12px;
  font-weight: 600;
}

.evidence-links a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.evidence-links a::after {
  content: " ↗";
  color: var(--muted);
}

.evidence-links a:hover {
  color: var(--accent);
}

.candidate-details {
  margin-top: 14px;
}

.candidate-details summary {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1px dashed var(--line);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  list-style: none;
}

.candidate-details summary::-webkit-details-marker {
  display: none;
}

.candidate-details summary::after {
  content: "+";
  font-weight: 500;
}

.candidate-details[open] summary::after {
  content: "−";
}

.candidate-details > .note {
  margin: 0 0 10px;
}

.rating-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}

.rating-panel {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding-top: 10px;
  border-top: 2px solid var(--ink);
}

.rating-panel.is-empty {
  border-top-color: var(--line);
}

.rating-panel h4 {
  font-size: 14px;
  font-weight: 700;
}

.rating-purpose {
  color: var(--muted);
  font-size: 12px;
}

.rating-score {
  margin-top: 10px;
  font-size: clamp(32px, 3vw, 44px);
  font-weight: 750;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.rating-score small {
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
}

.rating-count {
  font-size: 13px;
  font-weight: 600;
}

.rating-status {
  margin: 10px 0 2px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.rating-warn {
  color: var(--warn);
  font-size: 12px;
  font-weight: 600;
}

.rating-extra {
  color: var(--ink-2);
  font-size: 13px;
}

.rating-panel .evidence-meta {
  margin-top: 6px;
}

.rating-panel .inline-link {
  margin-top: 4px;
  font-size: 13px;
}

.source-details summary {
  display: flex;
  justify-content: space-between;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  list-style: none;
  text-transform: uppercase;
}

.source-details summary::-webkit-details-marker {
  display: none;
}

.source-details summary::after {
  content: "+";
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
}

.source-details[open] summary::after {
  content: "−";
}

.source-details summary span {
  margin-left: auto;
  margin-right: 12px;
  color: var(--muted);
  font-weight: 500;
}

.source-list {
  margin-top: 12px;
}

.source-list li {
  padding: 7px 0;
  border-top: 1px solid var(--hair);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.source-list a {
  color: var(--ink-2);
}

.source-list a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ---------- Overlays ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--scrim);
  animation: fade-in 200ms ease both;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 60;
  padding: 12px 18px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 200ms, transform 260ms var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Colophon ---------- */

.colophon {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--col-gap);
  margin-top: 48px;
  padding: 18px var(--gutter) 40px;
  border-top: 2px solid var(--ink);
  color: var(--muted);
  font-size: 12px;
}

.colophon p:last-child {
  text-align: right;
}

.colophon a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.colophon a:hover {
  color: var(--accent);
}

/* ---------- Responsive ---------- */

/* Tablet: detail becomes a slide-over sheet. */
@media (max-width: 1279px) {
  .workspace {
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
  }

  .detail {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    width: min(540px, 100vw);
    max-height: none;
    padding: 0 clamp(18px, 3vw, 32px);
    background: var(--paper);
    border-left: 1px solid var(--ink);
    transform: translateX(102%);
    visibility: hidden;
    transition: transform 320ms var(--ease), visibility 0s linear 320ms;
  }

  .detail.is-open {
    transform: none;
    visibility: visible;
    transition: transform 360ms var(--ease);
  }

  .detail-bar {
    padding-top: 16px;
  }

  .detail-close {
    display: inline-grid;
  }

  .hero-title {
    grid-column: 1 / span 9;
  }

  .hero-lede {
    grid-column: 1 / span 8;
    margin-top: 24px;
  }
}

/* Small tablet / phone: filters become a drawer. */
@media (max-width: 899px) {
  :root {
    --bar-h: 60px;
  }

  .masthead {
    grid-template-columns: 1fr auto;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .masthead-meta {
    display: none;
  }

  .masthead-nav {
    gap: 16px;
  }

  .hero-title {
    grid-column: 1 / -1;
  }

  .hero-lede {
    grid-column: 1 / -1;
  }

  .hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-stats > div {
    padding-bottom: 16px;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  #filtersButton {
    display: inline-flex;
  }

  .rail {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    width: min(360px, 88vw);
    max-height: none;
    padding: 0 20px;
    background: var(--paper);
    border-right: 1px solid var(--ink);
    transform: translateX(-102%);
    visibility: hidden;
    transition: transform 320ms var(--ease), visibility 0s linear 320ms;
  }

  .rail.is-open {
    transform: none;
    visibility: visible;
    transition: transform 360ms var(--ease);
  }

  .rail-head {
    padding-top: 14px;
  }

  .rail-head .text-button {
    margin-left: auto;
  }

  .rail-close {
    display: inline-grid;
  }

  .rail-body {
    flex: 1;
  }

  .rail-foot {
    position: sticky;
    bottom: 0;
    display: block;
    padding: 14px 0 max(14px, env(safe-area-inset-bottom));
    background: var(--paper);
    border-top: 1px solid var(--ink);
  }

  .rail-foot .solid-button {
    width: 100%;
    height: 48px;
    font-size: 15px;
  }

  .shortcuts {
    display: none;
  }

  .results-tools {
    justify-content: flex-start;
  }

  .colophon {
    grid-template-columns: 1fr;
  }

  .colophon p:last-child {
    text-align: left;
  }
}

@media (max-width: 639px) {
  body {
    font-size: 14px;
  }

  .masthead-nav a:not(:last-child) {
    display: none;
  }

  .hero-kicker {
    font-size: 12px;
  }

  .hero-lede {
    display: none;
  }

  .search-field input {
    font-size: 17px;
  }

  .hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-stats > div:last-child {
    display: none;
  }

  .searchbar {
    gap: 10px;
  }

  .search-field {
    gap: 10px;
  }

  .search-glyph {
    width: 19px;
    height: 19px;
  }

  .search-kbd {
    display: none;
  }

  .bar-button {
    height: 36px;
    padding: 0 10px;
  }

  .results-head {
    flex-wrap: wrap;
  }

  .results-count {
    white-space: normal;
    text-align: left;
  }

  .row {
    grid-template-columns: 2rem minmax(0, 1fr) auto;
    column-gap: 10px;
    padding-right: 4px;
  }

  .row-index {
    padding-left: 8px;
  }

  .row-title {
    font-size: 17px;
  }

  .row-side {
    display: contents;
  }

  .row-metrics {
    grid-column: 2;
    grid-row: 2;
    gap: 22px;
    margin-top: 10px;
    text-align: left;
  }

  .row-metric {
    min-width: 0;
  }

  .row-metric dd {
    font-size: 16px;
  }

  .save-toggle {
    grid-column: 3;
    grid-row: 1;
  }

  .detail {
    width: 100vw;
    border-left: 0;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 14px;
  }

  .metric-grid > div:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .rating-grid {
    grid-template-columns: 1fr;
    row-gap: 18px;
  }
}

@media (hover: none) {
  .row:hover {
    background: none;
  }

  .row.is-selected {
    background: var(--paper-2);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
