:root {
  color-scheme: light dark;
  --bg: #fbfbfd;
  --surface: #ffffff;
  --fg: #1b1f27;
  --muted: #5b6472;
  --border: #d9dde5;
  --accent: #1f5fbf;
  --accent-soft: #e3edfb;
  --frame: #000000;
  --note-bg: #fff6d6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b;
    --surface: #181c24;
    --fg: #e6e9ef;
    --muted: #9aa3b2;
    --border: #2c3340;
    --accent: #7ab0ff;
    --accent-soft: #1d2a40;
    --frame: #ffffff;
    --note-bg: #3a3314;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-underline-offset: 0.15em; }
a:focus-visible, input:focus-visible, th:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 76rem; margin-inline: auto; padding-inline: 1rem; }
main { padding-block: 1.5rem 3rem; }

h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.15; margin: 0 0 0.5rem; }
h2 { font-size: 1.35rem; margin: 2.2rem 0 0.5rem; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 52rem; }
.muted { color: var(--muted); font-size: 0.9rem; }
.eyebrow { margin: 0 0 0.25rem; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8rem; }
.prose { max-width: 52rem; }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; }
.prose th, .prose td { border: 1px solid var(--border); padding: 0.35rem 0.6rem; text-align: left; vertical-align: top; }
.prose code, pre { font-family: ui-monospace, "Cascadia Code", Menlo, monospace; font-size: 0.88em; }
pre { overflow-x: auto; padding: 0.8rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 0.5rem; }

/* the citation note: a thick frame on every page, the essential phrases in bold */
.citation-note {
  padding: 0.8rem 1rem;
  background: var(--note-bg);
  border: 5px solid var(--frame);
  font-size: 1.05rem;
  text-align: center;
}

.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1.5rem; padding-block: 0.6rem; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--fg); text-decoration: none; }
nav ul { display: flex; flex-wrap: wrap; gap: 0.1rem 0.4rem; margin: 0; padding: 0; list-style: none; }
nav a { display: block; padding: 0.25rem 0.6rem; border-radius: 0.4rem; text-decoration: none; }
nav a:hover { background: var(--accent-soft); }
nav a[aria-current] { background: var(--accent-soft); font-weight: 600; }

.hero { padding-block: 1rem 0.5rem; }
.byline { color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.8rem; margin: 1.2rem 0 2rem; padding: 0; list-style: none; }
.stats li { background: var(--surface); border: 1px solid var(--border); border-radius: 0.6rem; }
.stats a { display: block; padding: 0.8rem 1rem; text-decoration: none; color: var(--fg); }
.stats a:hover { background: var(--accent-soft); }
.stats strong { font-size: 1.8rem; display: block; line-height: 1.1; }

.cloud { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 0.2rem 1rem; padding: 0; list-style: none; }
.cloud a { font-size: calc(0.95rem + var(--w) * 1.7rem); opacity: calc(0.6 + var(--w) * 0.4); text-decoration: none; font-weight: 600; }
.cloud a:hover { text-decoration: underline; opacity: 1; }
.footnote { max-width: 52rem; font-size: 0.9rem; color: var(--muted); }

.terms { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr)); gap: 1rem; padding: 0; list-style: none; }
.terms li { background: var(--surface); border: 1px solid var(--border); border-radius: 0.6rem; padding: 0.2rem 1.1rem 0.8rem; }
.terms h2 { margin-top: 0.8rem; display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.terms p { margin: 0.4rem 0 0; font-size: 0.95rem; }
.n { color: var(--muted); font-size: 0.9rem; font-weight: 400; font-variant-numeric: tabular-nums; }
.group-description { color: var(--muted); font-size: 0.95rem; margin-top: 0; max-width: 60rem; }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: 1.5rem 2.5rem; margin-block: 1.2rem; }
.chart { margin: 0; }
.chart figcaption { font-weight: 600; margin-bottom: 0.4rem; }
.bars, .years { margin: 0; padding: 0; list-style: none; }
.bars li { display: grid; grid-template-columns: minmax(7rem, 13rem) 1fr 2.5rem; align-items: center; gap: 0.6rem; font-size: 0.9rem; padding-block: 0.12rem; }
.bars .label a { color: var(--fg); text-decoration: none; }
.bars .label a:hover { text-decoration: underline; }
.bars .bar { height: 0.8rem; width: calc(var(--v) * 100%); background: var(--accent); border-radius: 0.2rem; }
.bars .n { text-align: right; }
.years { display: flex; align-items: stretch; gap: 2px; height: 9rem; }
.years li { position: relative; flex: 1; min-width: 0; }
.years .bar { position: absolute; left: 0; right: 0; bottom: 1.2rem; height: calc((100% - 1.2rem) * var(--v)); min-height: 1px; background: var(--accent); border-radius: 2px 2px 0 0; }
.years .yr { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); font-size: 0.65rem; color: var(--muted); }

.filter { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.filter input { flex: 1 1 18rem; max-width: 30rem; padding: 0.45rem 0.7rem; font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--border); border-radius: 0.4rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 0.6rem; background: var(--surface); }
table.entries { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.entries th { text-align: left; padding: 0.55rem 0.7rem; background: var(--accent-soft); white-space: nowrap; }
.entries th[data-sort] { cursor: pointer; user-select: none; }
.entries th[aria-sort="ascending"]::after { content: " \25B2"; font-size: 0.7em; }
.entries th[aria-sort="descending"]::after { content: " \25BC"; font-size: 0.7em; }
.entries td { padding: 0.5rem 0.7rem; vertical-align: top; border-top: 1px solid var(--border); }
.entries tbody tr:hover { background: var(--accent-soft); }
.entries .key { min-width: 10.5rem; font-family: ui-monospace, Menlo, monospace; font-size: 0.78rem; overflow-wrap: anywhere; }
.entries .title { min-width: 16rem; font-weight: 600; }
.entries .title a { font-weight: 600; }
.entries .venue { display: block; font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.entries .links a { margin-right: 0.7rem; font-size: 0.8rem; font-weight: 400; }
.entries .authors { min-width: 12rem; color: var(--muted); }
.entries .year { font-variant-numeric: tabular-nums; }
.entries tr:target td { background: var(--accent-soft); }
.unknown { color: var(--muted); font-style: italic; }
tr[hidden] { display: none; }

footer { border-top: 1px solid var(--border); padding-block: 1.5rem 3rem; font-size: 0.9rem; color: var(--muted); }
footer pre { font-size: 0.8rem; }
