/* Papers site. No web fonts, no scripts; light and dark follow the reader's system setting. */

:root {
  --bg: #fbfaf7;
  --fg: #1d1f23;
  --muted: #5d6470;
  --rule: #dcd8cf;
  --link: #0b5f8a;
  --accent: #0b5f8a;
  --panel: #f2efe8;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", "Noto Serif CJK SC", serif;
  --sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --width: 46rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --fg: #e6e4df;
    --muted: #9aa2ad;
    --rule: #2e343d;
    --link: #7cc8f0;
    --accent: #38bdf8;
    --panel: #1b2027;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.65 var(--sans);
}

a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

header.top, main, footer {
  max-width: var(--width);
  margin: 0 auto;
  padding: 0 1rem;
}

header.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--fg);
  font-family: var(--serif);
  font-size: 1.15rem;
  text-decoration: none;
}

nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; font-size: 0.95rem; }
nav a { color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--fg); }
nav .lang { padding-left: 1.1rem; border-left: 1px solid var(--rule); }

main { padding-top: 2rem; padding-bottom: 3rem; }

h1, h2 { font-family: var(--serif); font-weight: 600; line-height: 1.25; }
h1 { font-size: 2rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.25rem; margin: 2.25rem 0 0.75rem; }

.tagline { color: var(--muted); margin-top: 0; }

ol.papers { list-style: none; padding: 0; margin: 2rem 0 0; }
ol.papers li { padding: 1.25rem 0; border-top: 1px solid var(--rule); }
ol.papers li:last-child { border-bottom: 1px solid var(--rule); }
ol.papers h2 { margin: 0 0 0.35rem; font-size: 1.35rem; }
ol.papers h2 a { color: var(--fg); text-decoration: none; }
ol.papers h2 a:hover { color: var(--link); }
.meta, .files { margin: 0.2rem 0; font-size: 0.95rem; }
.meta { color: var(--muted); }

.kicker { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.95rem; }
.alt-title { margin: 0 0 0.5rem; font-family: var(--serif); font-size: 1.15rem; color: var(--muted); }
.authors { margin: 0.5rem 0 0; font-size: 1.05rem; }

.read ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.75rem; padding: 0; margin: 0; }
.read a {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
}
.read a:hover { background: var(--panel); }
.size { color: var(--muted); font-size: 0.85rem; }

.abstract p { margin: 0 0 1rem; text-align: justify; hyphens: auto; }
.abstract:lang(zh) p { text-align: justify; hyphens: manual; }
.math {
  margin: 0 0 1rem;
  padding: 0.6rem 0.8rem;
  overflow-x: auto;
  text-align: center;
  font-family: var(--serif);
  background: var(--panel);
  border-radius: 6px;
}
.abstract i, .math i { font-family: var(--serif); }

dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.25rem; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }

.note { color: var(--muted); font-size: 0.9rem; }
code { font-family: var(--mono); font-size: 0.9em; }

ul.history { list-style: none; padding: 0; margin: 0; }
ul.history li { display: grid; grid-template-columns: 10rem 1fr; gap: 0.75rem; padding: 0.5rem 0; border-top: 1px solid var(--rule); }
ul.history time { color: var(--muted); font-variant-numeric: tabular-nums; }

footer { padding-bottom: 2rem; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--rule); }
footer p { margin: 1rem 0 0; }

@media (max-width: 34rem) {
  body { font-size: 16px; }
  h1 { font-size: 1.6rem; }
  ul.history li { grid-template-columns: 1fr; }
  ul.history time { grid-column: 1 / -1; }
  dl { grid-template-columns: 1fr; }
  dt { margin-top: 0.5rem; }
  nav .lang { padding-left: 0; border-left: 0; }
}
