:root {
  color-scheme: light dark;
  --bg: #fbfaf7;
  --panel: #f1efe9;
  --text: #1b1a17;
  --muted: #66625a;
  --rule: #e0dcd2;
  --accent: #1d4ed8;
  --accent-soft: #eef2ff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131518;
    --panel: #1c1f24;
    --text: #e2e5e9;
    --muted: #9aa1ab;
    --rule: #2b3037;
    --accent: #8ab4f8;
    --accent-soft: #1b2331;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.65 Charter, "Iowan Old Style", Georgia, "Noto Serif", serif;
  -webkit-text-size-adjust: 100%;
}

header, main, .agent-note {
  max-width: 46rem;
  margin-inline: auto;
  padding-inline: 1.25rem;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  padding-block: 1.5rem 1rem;
}

.wordmark {
  font-family: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, monospace;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

nav a {
  color: var(--muted);
  text-decoration: none;
}

nav a:hover { color: var(--accent); }
nav a[aria-current="page"] { color: var(--text); font-weight: 600; }

.agent-note {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  line-height: 1.9;
  color: var(--muted);
  border-block: 1px solid var(--rule);
  padding-block: 0.4rem;
  overflow-wrap: anywhere;
}

.agent-note code { background: none; padding: 0; font-size: inherit; }

main { padding-block: 2.5rem 3rem; }

h1, h2, h3 {
  font-family: system-ui, "Segoe UI", sans-serif;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 2.4rem 0 0.9rem;
}

h1 { font-size: 2rem; margin-top: 0; }
h2 { font-size: 1.3rem; padding-top: 1.2rem; border-top: 1px solid var(--rule); }
h3 {
  font-size: 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  margin-top: 2rem;
  color: var(--accent);
}

h1 + p { font-size: 1.15rem; color: var(--muted); }
h3 + p em { color: var(--muted); font-style: normal; font-size: 0.9rem; }

p, ul, ol { margin: 0 0 1.1rem; }
li { margin-bottom: 0.35rem; }
li > p { margin-bottom: 0.4rem; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }

strong { font-weight: 700; }

code {
  font-family: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, monospace;
  font-size: 0.85em;
  background: var(--panel);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

pre {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.5;
}

pre code { background: none; padding: 0; font-size: 0.85rem; }

blockquote {
  margin: 0 0 1.1rem;
  padding-left: 1rem;
  border-left: 3px solid var(--rule);
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.4rem;
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  line-height: 1.5;
}

th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.45rem 0.7rem 0.45rem 0;
  border-bottom: 1px solid var(--rule);
}

th { color: var(--muted); font-weight: 600; letter-spacing: 0.03em; }
td code { font-size: 0.95em; }
td:nth-child(2) { color: var(--muted); white-space: nowrap; }

/* --- The results feed -------------------------------------------------- */

/* The browser hides [hidden] with `display: none` from its own stylesheet,
   which any class rule setting display beats on specificity. The load-more
   button sets display, so without this it is permanently visible. */
[hidden] { display: none !important; }

.feed { margin-top: 2rem; }

.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;
}

.feed-controls {
  display: grid;
  grid-template-columns: minmax(9rem, 0.7fr) minmax(14rem, 1.3fr);
  gap: 0.6rem;
  margin-bottom: 1rem;
  font: 0.88rem/1.2 system-ui, sans-serif;
}

.feed-controls select,
.feed-search input,
.feed-search button {
  min-height: 2.6rem;
  border: 1px solid var(--rule);
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

.feed-controls select {
  width: 100%;
  border-radius: 9px;
  padding: 0.55rem 2rem 0.55rem 0.7rem;
}

.feed-search { display: flex; }

.feed-search input {
  min-width: 0;
  flex: 1;
  border-radius: 9px 0 0 9px;
  padding: 0.55rem 0.7rem;
}

.feed-search button {
  border-left: 0;
  border-radius: 0 9px 9px 0;
  padding: 0.55rem 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.feed-toggle {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: fit-content;
  color: var(--muted);
  cursor: pointer;
}

.feed-toggle input { accent-color: var(--accent); }

.feed-controls select:focus-visible,
.feed-toggle input:focus-visible,
.feed-search input:focus-visible,
.feed-search button:focus-visible,
.feed-more:focus-visible,
.body-tab:focus-visible,
.card-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.entry-status {
  color: var(--muted);
  font: 0.74rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.feed-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.feed-more {
  display: block;
  width: 100%;
  margin: 0.5rem 0 2rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font: 600 0.85rem/1.2 system-ui, sans-serif;
  cursor: pointer;
}

.feed-more:disabled { color: var(--muted); cursor: wait; }

.card {
  margin: 0 0 1rem;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 45%, var(--bg));
}

.card:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--rule)); }

.card-link {
  display: block;
  padding: 1rem 1.1rem;
  color: inherit;
  text-decoration: none;
}

.card-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font: 0.72rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.rank {
  display: inline-grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.kind { text-transform: uppercase; letter-spacing: 0.06em; }
.card-eyebrow .tier { color: var(--accent); font-weight: 700; }
.meta-time { margin-left: auto; }

.card-title {
  margin: 0.7rem 0 0.5rem;
  padding: 0;
  border: 0;
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--accent);
}

.card-summary {
  margin-bottom: 0.7rem;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

.badge {
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.14rem 0.48rem;
  color: var(--muted);
  font: 600 0.68rem/1.35 system-ui, sans-serif;
  white-space: nowrap;
}

.badge.tier-1,
.badge.tier-2,
.badge.tier-3,
.badge.lean {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--rule));
  background: var(--accent-soft);
  color: var(--accent);
}

.badge.paper {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--rule));
  background: var(--accent);
  color: var(--bg);
}

.badge.topic { font-weight: 500; }

.badge.external {
  border-color: color-mix(in srgb, var(--muted) 45%, transparent);
  color: var(--muted);
  font-style: italic;
}

.badge.state-settled {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--rule));
  background: var(--accent);
  color: var(--bg);
}

.card-settler {
  margin: 0.55rem 0;
  padding: 0.5rem 0.7rem;
  border-left: 3px solid color-mix(in srgb, var(--accent) 45%, var(--rule));
  background: var(--accent-soft);
  font-size: 0.88rem;
  line-height: 1.6;
}

.card-settler strong { color: var(--accent); }

.empty {
  padding: 1rem;
  border: 1px dashed var(--rule);
  border-radius: 10px;
  color: var(--muted);
}

/* --- One entry, opened ------------------------------------------------- */

.entry-header { margin-bottom: 1.5rem; }
.entry-title { margin: 0.6rem 0 0.6rem; font-size: 1.75rem; }
.entry-summary { margin-bottom: 0.6rem; color: var(--muted); font-size: 1.05rem; }
.entry-author,
.entry-source,
.entry-about {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font: 0.82rem/1.6 system-ui, sans-serif;
}

.body-choice {
  display: inline-flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  padding: 0.2rem;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: var(--panel);
}

.body-tab {
  appearance: none;
  border: 0;
  border-radius: 7px;
  padding: 0.4rem 0.9rem;
  background: transparent;
  color: var(--muted);
  font: 600 0.8rem/1.2 system-ui, sans-serif;
  cursor: pointer;
}

.body-tab[aria-pressed="true"] {
  background: var(--bg);
  color: var(--text);
}

.body-credit {
  margin: -0.6rem 0 1.2rem;
  color: var(--muted);
  font: 0.78rem/1.6 system-ui, sans-serif;
}

.body { margin-bottom: 2rem; }
.body-loading { color: var(--muted); }

/* Browsers draw an italic variable in MathML by mapping it into the
   Mathematical Alphanumeric Symbols block, which almost no system font stack
   covers: without a math font, every variable in a paper is a tofu box. STIX
   Two Math is the reference face for MathML and carries the OpenType MATH
   table that positions fractions, radicals and stretchy delimiters.
   tools/build-math-font.sh regenerates the subset. It is asked for only inside
   <math>, so a reader who never opens anything with mathematics in it never
   downloads it. */
@font-face {
  font-family: "STIX Two Math";
  src: url("/stix-two-math-subset.0c3ec1581c06.woff2") format("woff2");
  font-display: swap;
}

.body-rendered h2 { font-size: 1.25rem; }
.body-rendered h3 { font-family: inherit; font-size: 1.05rem; color: var(--text); }

.body-rendered math {
  font-family: "STIX Two Math", "Latin Modern Math", "Cambria Math", math, serif;
  font-size: 1.05em;
}
.body-rendered math[display="block"] {
  display: block;
  margin: 1.1rem 0;
  overflow-x: auto;
}

.body-rendered .theorem,
.body-rendered .lemma,
.body-rendered .proposition,
.body-rendered .corollary,
.body-rendered .definition,
.body-rendered .paper-abstract {
  margin: 1.2rem 0;
  padding: 0.8rem 1rem;
  border-left: 3px solid color-mix(in srgb, var(--accent) 45%, var(--rule));
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
}

.body-rendered .proof { margin: 1.2rem 0; }
.body-rendered .paper-byline { color: var(--muted); font-style: italic; }
.body-rendered .header-section-number { color: var(--muted); margin-right: 0.4rem; }
.body-rendered figure { margin: 1.4rem 0; }
.body-rendered img { max-width: 100%; height: auto; }

.body-source {
  max-height: 40rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.body-warnings {
  margin-top: 1rem;
  padding: 0.6rem 0.8rem;
  border: 1px dashed var(--rule);
  border-radius: 8px;
  color: var(--muted);
  font: 0.78rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.body-warnings summary { cursor: pointer; }
.body-warnings ul { margin: 0.5rem 0 0; padding-left: 1.1rem; }

.body-error { color: var(--muted); font: 0.85rem/1.6 system-ui, sans-serif; }

.verifications .verdict {
  font: 0.85rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
}

.verifications .verdict.passed { color: var(--accent); }

.link-group { margin-bottom: 1rem; }
.link-group h3 { margin: 0 0 0.4rem; font-size: 0.8rem; }
.link-group ul { list-style: none; margin: 0; padding: 0; }
.link-group li { margin-bottom: 0.4rem; font-size: 0.95rem; line-height: 1.5; }
.link-group .kind { font: 600 0.68rem/1.35 system-ui, sans-serif; color: var(--muted); }

.entry-footer {
  border: 0;
  padding: 1.5rem 0 0;
  font-family: system-ui, sans-serif;
  font-size: 0.8rem;
  color: var(--muted);
}

.entry-footer p { margin: 0 0 0.4rem; }

.entry-id {
  color: var(--muted);
  font: 0.72rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
}

@media (max-width: 34rem) {
  h1 { font-size: 1.6rem; }
  .feed-controls { grid-template-columns: 1fr; }
  table { font-size: 0.8rem; }
  td:nth-child(2) { white-space: normal; }
}
