:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1c1b19;
  --muted: #6f6a61;
  --faint: #98928a;
  --border: #e4e0d7;
  --border-strong: #cfc9bd;
  --accent: #a8431f;
  --accent-soft: #f4e8e2;
  --ok: #2e7d4f;
  --warn: #9a6400;
  --danger: #a83232;
  --radius: 10px;
  --font-body: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "DejaVu Sans", "Liberation Sans", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141311;
    --surface: #1b1a17;
    --text: #ece8e0;
    --muted: #a49e93;
    --faint: #7d776d;
    --border: #2c2a25;
    --border-strong: #403d36;
    --accent: #e07a52;
    --accent-soft: #2a1f1a;
    --ok: #6cc08a;
    --warn: #d6a04a;
    --danger: #e07b7b;
  }
}

html[data-theme="light"] {
  --bg: #fbfaf7; --surface: #ffffff; --text: #1c1b19; --muted: #6f6a61;
  --faint: #98928a; --border: #e4e0d7; --border-strong: #cfc9bd;
  --accent: #a8431f; --accent-soft: #f4e8e2; --ok: #2e7d4f; --warn: #9a6400; --danger: #a83232;
}

html[data-theme="dark"] {
  --bg: #141311; --surface: #1b1a17; --text: #ece8e0; --muted: #a49e93;
  --faint: #7d776d; --border: #2c2a25; --border-strong: #403d36;
  --accent: #e07a52; --accent-soft: #2a1f1a; --ok: #6cc08a; --warn: #d6a04a; --danger: #e07b7b;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a:hover { color: var(--accent); text-decoration-color: var(--accent); }

.site-header {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 820px;
  margin: 0 auto;
  padding: 22px 24px 8px;
}

.brand {
  font-family: var(--font-display);
  font-size: 20px;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand span { color: var(--accent); }

.date-nav { margin-left: auto; display: flex; gap: 16px; font-size: 14px; color: var(--muted); }
.date-nav a { text-decoration: none; }

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 15px;
}
.theme-toggle:hover { border-color: var(--border-strong); color: var(--text); }

main { max-width: 820px; margin: 0 auto; padding: 0 24px 80px; }

.hero { padding: 46px 0 34px; border-bottom: 1px solid var(--border); }
.kicker {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
.hero h1 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(38px, 7vw, 58px);
  line-height: 1.05;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.dek { margin: 0 0 8px; color: var(--muted); font-size: 17px; }
.meta { margin: 0; color: var(--faint); font-size: 13px; }
.notice {
  margin: 18px 0 0;
  padding: 10px 14px;
  border-left: 3px solid var(--warn);
  background: var(--surface);
  color: var(--warn);
  font-size: 14px;
}

h2 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
}

section { padding: 40px 0 0; }

.top-list { margin: 0; padding-left: 22px; }
.top-list li { margin-bottom: 14px; padding-left: 6px; font-size: 18px; line-height: 1.45; }
.top-list li::marker { color: var(--accent); font-family: var(--font-display); }

.brief { padding-top: 34px; }
.overview {
  margin: 0;
  max-width: 46em;
  font-family: var(--font-display);
  font-size: clamp(20px, 3.2vw, 24px);
  line-height: 1.5;
  letter-spacing: -0.005em;
}

.terms { padding-top: 44px; }
.term-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px 28px;
  margin: 0;
}
.term {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.term dt {
  margin: 0 0 4px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.term dd {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.ref {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--faint);
  margin-left: 6px;
  white-space: nowrap;
}
.ref-link {
  color: var(--accent);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.92em;
}
.ref-link:hover { text-decoration: underline; }

.paper, .news { scroll-margin-top: 24px; }
.paper.is-target, .news.is-target {
  background: var(--accent-soft);
  transition: background 0.4s ease;
}

.section-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 14px; }
.section-head h2 { margin: 0; }

#search {
  margin-left: auto;
  width: 200px;
  max-width: 45vw;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
#search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.result-count { min-height: 20px; margin: 4px 0 8px; font-size: 12px; color: var(--faint); }

.theme-group { margin-top: 20px; }
.theme-title {
  margin: 26px 0 6px;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}

.paper { padding: 20px 0 18px; border-bottom: 1px solid var(--border); }
.paper:last-child { border-bottom: 0; }
.paper-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 7px; }
.cat {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 7px;
  border-radius: 4px;
}
.authors { font-size: 12px; color: var(--faint); }
.paper h4 { margin: 0 0 8px; font-size: 19px; line-height: 1.35; font-weight: 600; }
.paper h4 a { text-decoration: none; }
.paper h4 a:hover { text-decoration: underline; }
.summary { margin: 0 0 8px; }

.why {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--muted);
  border-left: 2px solid var(--border-strong);
  padding-left: 12px;
}
.why span {
  display: block;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}

details { margin: 6px 0 10px; }
summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  width: fit-content;
}
summary:hover { color: var(--accent); }
details p { margin: 10px 0 0; font-size: 15px; color: var(--muted); }

.paper-links { display: flex; gap: 16px; font-size: 13px; }
.paper-links a { color: var(--muted); }
.paper-links .ref { margin-left: auto; }

.news { padding: 18px 0; border-bottom: 1px solid var(--border); }
.news:last-child { border-bottom: 0; }
.news-meta { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.points { font-size: 11px; color: var(--faint); }
.news h3 { margin: 0 0 6px; font-size: 18px; line-height: 1.35; }
.news h3 a { text-decoration: none; }
.news h3 a:hover { text-decoration: underline; }
.news p { margin: 0; color: var(--muted); font-size: 15px; }

.watchlist ul { margin: 0; padding-left: 20px; }
.watchlist li { margin-bottom: 8px; color: var(--muted); }

.source-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 16px;
  font-size: 13px;
}
.source-grid li { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; }
.source-grid .ok .dot { background: var(--ok); }
.source-grid .fail .dot { background: var(--danger); }
.source-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--faint); }

.empty { padding: 20px 0; color: var(--muted); }

.archive-list { padding-top: 12px; }
.archive-row {
  display: flex;
  gap: 16px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}
.archive-date { font-family: var(--font-mono); font-size: 14px; }
.archive-counts { color: var(--muted); font-size: 13px; }
.archive-arrow { margin-left: auto; color: var(--faint); }

.site-footer {
  border-top: 1px solid var(--border);
  max-width: 820px;
  margin: 0 auto;
  padding: 22px 24px 50px;
  color: var(--faint);
  font-size: 12px;
}

[hidden] { display: none !important; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .site-header { padding: 18px 18px 4px; }
  main { padding: 0 18px 60px; }
  .hero { padding: 32px 0 26px; }
  .section-head { flex-wrap: wrap; }
  #search { width: 100%; max-width: none; margin-left: 0; }
  .site-footer { padding: 18px 18px 40px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

