:root {
  --bg: #faf8f4;
  --ink: #1a1a1a;
  --muted: #57524a;
  --accent: #8a2f2f;
  --rule: #e3ddd2;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans CJK SC", sans-serif;
  --serif: ui-serif, Georgia, "Noto Serif CJK SC", serif;
  --mono: ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --ink: #e6e3dc;
    --muted: #aba69d;
    --accent: #e08a72;
    --rule: #2b2f36;
  }
}
* {
  box-sizing: border-box;
}
html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}
@media (min-width: 700px) {
  html {
    font-size: 18px;
  }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.65;
}
a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}
a:hover {
  text-decoration-thickness: 2px;
}
main {
  max-width: 68ch;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}
h1,
h2,
h3 {
  font-family: var(--serif);
  line-height: 1.25;
  font-weight: 600;
  margin: 1.6em 0 0.5em;
}
h1 {
  font-size: 1.9rem;
  margin-top: 0.8em;
}
h2 {
  font-size: 1.35rem;
}
h3 {
  font-size: 1.1rem;
}
code {
  font-family: var(--mono);
  font-size: 0.88em;
}

/* header / footer */
header.site {
  border-bottom: 1px solid var(--rule);
  padding: 0.5rem 1rem 0;
}
header.site .brand {
  display: block;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
  padding: 0.6rem 0 0.2rem;
}
header.site nav {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  margin: 0 -1rem;
  padding: 0 0.5rem;
}
header.site nav::-webkit-scrollbar {
  display: none;
}
header.site nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.6rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
}
header.site nav a:hover {
  color: var(--accent);
}
footer.site {
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1rem;
  text-align: center;
}

/* lists */
.meta,
.count,
.excerpt,
.pager {
  color: var(--muted);
  font-size: 0.9rem;
}
.zh {
  font-family: var(--serif);
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0.1em 0 0.3em;
}
ol.articles {
  list-style: none;
  padding: 0;
  margin: 0;
}
ol.articles li {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--rule);
}
ol.articles h2 {
  font-size: 1.2rem;
  margin: 0;
}
ol.articles h2 a {
  color: var(--ink);
  text-decoration: none;
}
ol.articles h2 a:hover {
  color: var(--accent);
}
ol.articles p {
  margin: 0.25em 0;
}
.more,
.pager {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}
.more a,
.pager a {
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
}
ul.categories {
  list-style: none;
  padding: 0;
}
ul.categories li {
  border-bottom: 1px solid var(--rule);
}
ul.categories a {
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
}
ul.categories .count {
  margin-left: 0.5rem;
}

/* article */
article .subtitle {
  font-size: 1.1rem;
  margin: 0 0 0.6em;
}
article .body {
  font-family: var(--serif);
}
article .body p {
  margin: 0 0 1.25em;
}
.note-ref,
.back {
  padding: 12px 8px;
  margin: 0 -4px;
}
.note-ref {
  text-decoration: none;
  font-size: 0.8em;
  vertical-align: super;
  line-height: 0;
}
.sidenote {
  display: none;
}
.endnotes,
.provenance {
  border-top: 1px solid var(--rule);
  margin-top: 2.5rem;
  padding-top: 0.5rem;
  font-size: 0.9rem;
}
.notes li {
  margin-bottom: 0.6em;
}
.notes li:target {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.provenance {
  color: var(--muted);
}
.provenance a {
  overflow-wrap: anywhere;
}
.warn {
  color: var(--accent);
  font-weight: 600;
}

/* sidenotes: article column stays left, notes float into a 20rem right gutter */
@media (min-width: 1100px) {
  main.article {
    max-width: calc(68ch + 20rem);
  }
  main.article > article {
    max-width: 68ch;
    margin-right: 20rem;
  }
  .sidenote {
    display: block;
    float: right;
    clear: right;
    width: 18rem;
    margin: 0 -20rem 0.8em 0;
    font-family: var(--sans);
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--muted);
  }
  .sidenote b {
    color: var(--accent);
    margin-right: 0.3em;
  }
}

/* tables */
.scroll {
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  font-size: 0.9rem;
  width: 100%;
}
th,
td {
  text-align: left;
  padding: 0.35em 0.6em;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
th {
  font-weight: 600;
}

/* pagefind */
#search {
  --pagefind-ui-scale: 0.9;
  --pagefind-ui-primary: var(--accent);
  --pagefind-ui-text: var(--ink);
  --pagefind-ui-background: var(--bg);
  --pagefind-ui-border: var(--rule);
  --pagefind-ui-font: var(--sans);
  --pagefind-ui-tag: var(--rule);
}
#search mark {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
  color: inherit;
}
