/* Verdigris. --accent and --accent-dark come from the theme settings. */
:root {
  color-scheme: light dark;
  --paper: light-dark(#fafcfb, #101615);
  --ink: light-dark(#15201d, #e3ebe8);
  --soft: light-dark(#566460, #98a8a3);
  --rule: light-dark(#d5dfdb, #2a3633);
  --tint: light-dark(#edf3f0, #18211f);
  --link: light-dark(var(--accent), var(--accent-dark));
  --cjk: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC";
  --sans: "Avenir Next", "Segoe UI Variable Display", "Segoe UI", Inter, Roboto, "Helvetica Neue", var(--cjk), sans-serif;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, "Source Serif 4", Georgia, var(--cjk), serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --aside: 8.5rem;
}
:root[data-scheme="light"] { color-scheme: light; }
:root[data-scheme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.6 var(--sans);
  -webkit-text-size-adjust: 100%;
}
.wrap { width: 100%; max-width: 64rem; margin-inline: auto; padding-inline: var(--gutter); }
main { flex: 1; padding-block: clamp(2.5rem, 7vw, 5rem) 5rem; }
h1, h2, h3, p, ol, ul { margin: 0; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; overflow-wrap: anywhere; }
a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 2px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); padding: 0.5rem 1rem; z-index: 1; }
.quiet { color: var(--soft); }

/* Header and footer */
.site-header, .site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
}
.site-header { padding-block: 1.75rem; }
.site-title { color: var(--ink); font-weight: 700; font-size: 1.125rem; text-decoration: none; }
.site-header nav, .site-footer nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.site-header nav a, .site-footer a { color: var(--soft); text-decoration: none; }
.site-header nav a:hover, .site-footer a:hover { color: var(--link); text-decoration: underline; }
.site-header nav a[aria-current] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--link); text-decoration-thickness: 2px; text-underline-offset: 0.4em; }
.site-footer { padding-block: 1.5rem 2.5rem; color: var(--soft); font-size: 0.9375rem; }

/* Home and lists */
.headline {
  max-width: 22ch;
  font-size: clamp(2.125rem, 6.2vw, 4rem);
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin-bottom: 1.5rem;
}
.headline:lang(zh), .headline:lang(ja), .headline:lang(ko) { letter-spacing: 0; line-height: 1.25; max-width: 18em; }
.page-title { font-size: clamp(1.875rem, 4.5vw, 2.75rem); letter-spacing: -0.02em; margin-bottom: 2.5rem; }
section { margin-top: clamp(3rem, 8vw, 5.5rem); }
.page-title + section { margin-top: 0; }
.section-title { font-size: 1.0625rem; font-weight: 650; color: var(--link); margin-bottom: 1rem; }

.cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: 2.5rem 3rem; }
.cards li { border-top: 2px solid var(--ink); padding-top: 1rem; }
.cards h3 { font-size: 1.5rem; letter-spacing: -0.015em; margin-bottom: 0.5rem; }
.cards p { color: var(--soft); max-width: 44ch; }
.cards img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 4px; margin-bottom: 1rem; }

.ledger { list-style: none; padding: 0; border-bottom: 1px solid var(--rule); }
.ledger li { display: grid; grid-template-columns: var(--aside) 1fr; gap: 0 1.5rem; padding-block: 1.375rem; border-top: 1px solid var(--rule); }
.ledger time { color: var(--soft); font-variant-numeric: tabular-nums; line-height: 1.75rem; }
.ledger h3 { font-size: 1.3125rem; line-height: 1.75rem; letter-spacing: -0.01em; }
.ledger p { color: var(--soft); margin-top: 0.3rem; max-width: 62ch; overflow-wrap: anywhere; }
.ledger h3 a, .cards h3 a { color: inherit; text-decoration: none; }
.ledger h3 a:hover, .cards h3 a:hover { color: var(--link); text-decoration: underline; }

.pager { display: grid; grid-template-columns: 1fr auto 1fr; margin-top: 2rem; color: var(--soft); }
.pager > :last-child { text-align: right; }

/* Post */
.post > header, .prose, .more, .fields { max-width: 42rem; margin-inline: auto; }
.post > header { margin-bottom: 2.5rem; }
.post h1 { font-size: clamp(2rem, 5.4vw, 3.25rem); line-height: 1.12; letter-spacing: -0.022em; }
.meta { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; margin-top: 1.125rem; color: var(--soft); font-variant-numeric: tabular-nums; }
.lede { margin-top: 1rem; font-size: 1.25rem; color: var(--soft); max-width: 38ch; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin-top: 1.75rem; }
.button { background: var(--link); color: var(--paper); padding: 0.6rem 1.1rem; border-radius: 5px; font-weight: 600; text-decoration: none; }
.button:hover { text-decoration: underline; }
.cover { display: block; width: 100%; max-width: 56rem; height: auto; margin: 0 auto 3rem; border-radius: 6px; }
.fields { margin-block: 0 2.5rem; border-bottom: 1px solid var(--rule); }
.fields div { display: grid; grid-template-columns: var(--aside) 1fr; gap: 0 1.5rem; padding-block: 0.7rem; border-top: 1px solid var(--rule); }
.fields dt { color: var(--soft); }
.fields dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.fields img { display: block; max-width: 100%; height: auto; border-radius: 4px; }
.more { margin-top: 4.5rem; padding-top: 1.5rem; border-top: 2px solid var(--ink); }
.more ul { list-style: none; padding: 0; }
.more li { padding-block: 0.3rem; font-size: 1.125rem; }

.prose { font: 1.1875rem/1.7 var(--serif); overflow-wrap: break-word; }
:root[data-font="sans"] .prose { font: 1.0938rem/1.7 var(--sans); }
.prose > * { margin-block: 0 1.25em; }
.prose > :last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: var(--sans); letter-spacing: -0.012em; margin-block: 2em 0.6em; }
.prose h1 { font-size: 1.75rem; }
.prose h2 { font-size: 1.5rem; }
.prose h3 { font-size: 1.25rem; }
.prose h4 { font-size: 1.0625rem; }
.prose > :first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.35em; }
.prose li::marker { color: var(--soft); }
.prose li:has(> input) { list-style: none; margin-left: -1.4em; }
.prose blockquote { margin-inline: 0; padding-left: 1.25rem; border-left: 2px solid var(--link); color: var(--soft); }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose img { display: block; max-width: 100%; height: auto; border-radius: 4px; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin-block: 2.5em; }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; font: 0.9375rem/1.5 var(--sans); }
.prose th, .prose td { padding: 0.5rem 1.25rem 0.5rem 0; border-bottom: 1px solid var(--rule); text-align: left; }
.prose code { font: 0.85em/1.5 var(--mono); background: var(--tint); padding: 0.15em 0.35em; border-radius: 3px; }
.prose pre { background: var(--tint); padding: 1.125rem 1.25rem; border-radius: 6px; overflow-x: auto; }
.prose pre code { display: block; width: max-content; min-width: 100%; padding: 0; background: none; font-size: 0.875rem; line-height: 1.65; }

/* Code highlighting. Scope names come from syntect. */
.hl-comment { color: var(--soft); font-style: italic; }
.hl-string, .hl-string .hl-punctuation { color: light-dark(#8a4b08, #e5b478); }
.hl-keyword, .hl-storage { color: light-dark(#8b2f6b, #e29bc9); }
.hl-constant { color: light-dark(#1f5fa8, #8fbdf0); }
.hl-entity.hl-name, .hl-support { color: var(--link); }
.hl-comment .hl-punctuation { color: inherit; }

@media (max-width: 40rem) {
  .ledger li { grid-template-columns: 1fr; }
  .ledger time { font-size: 0.9375rem; line-height: 1.5; }
  .prose { font-size: 1.125rem; }
}
@media print {
  .site-header nav, .site-footer, .more { display: none; }
}
