:root {
  --bg: #fbfbfa;
  --fg: #1d1c1a;
  --muted: #6b6862;
  --line: #e3e0da;
  --accent: #2f5d50;
  --accent-soft: #e7efec;
  --warn: #8a5a12;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a;
    --fg: #eceae5;
    --muted: #9c988f;
    --line: #2c2e33;
    --accent: #7fbfab;
    --accent-soft: #22302c;
    --warn: #d6a45a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  max-width: 52rem;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

header h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.01em; }
.tagline { margin: 0.35rem 0 1.5rem; color: var(--muted); }

form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

input[type="search"] {
  flex: 1 1 20rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
}

select, button {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

button[type="submit"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button:disabled { opacity: 0.55; cursor: default; }

.meta, .warnings {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.warnings { color: var(--warn); }

ol#results { list-style: none; margin: 1.25rem 0 0; padding: 0; }

.result {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.result h2 {
  margin: 0 0 0.3rem;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.35;
}

.result h2 a { color: inherit; text-decoration: none; }
.result h2 a:hover { text-decoration: underline; }

.byline { color: var(--muted); font-size: 0.87rem; margin: 0 0 0.4rem; }
.snippet { margin: 0.4rem 0 0.6rem; font-size: 0.9rem; color: var(--muted); }

.badges { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }

.badge {
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.badge.both { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.badge.oa { border-color: var(--accent); color: var(--accent); }
.badge.no-source { border-color: var(--warn); color: var(--warn); }

.actions { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.6rem; }
.actions button, .actions select, .actions a.button {
  font-size: 0.82rem;
  padding: 0.35rem 0.6rem;
  text-decoration: none;
  color: inherit;
}

.assets { margin-top: 0.55rem; font-size: 0.82rem; color: var(--muted); }
.assets .kind { display: inline-block; margin-right: 0.9rem; }
.assets a { color: var(--accent); }
.status-failed { color: #b3453c; }
.status-skipped { text-decoration: line-through; }

pre.citation {
  margin: 0.6rem 0 0;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.pager { display: flex; gap: 0.75rem; align-items: center; margin-top: 1.5rem; }
.empty { color: var(--muted); padding: 2rem 0; }
