:root {
  color-scheme: light dark;
  --background: #fff;
  --foreground: #171717;
  --muted: #666;
  --border: #d8d8d8;
  --link: #0645ad;
  --code: #f3f3f3;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #111;
    --foreground: #eee;
    --muted: #aaa;
    --border: #444;
    --link: #8ab4f8;
    --code: #1d1d1d;
  }
}

* { box-sizing: border-box; }

html { font-size: 100%; }

body {
  max-width: 72ch;
  margin: 0 auto;
  padding: 1rem;
  background: var(--background);
  color: var(--foreground);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
  font-size: 1.05rem;
  line-height: 1.8;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--link);
  text-underline-offset: .16em;
}

a:hover { text-decoration-thickness: .12em; }

a:focus-visible {
  outline: .2rem solid currentColor;
  outline-offset: .2rem;
}

.skip-link {
  position: absolute;
  left: -10000px;
  top: auto;
}

.skip-link:focus {
  position: static;
  display: inline-block;
  margin-bottom: 1rem;
}

.site-header {
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.site-name {
  color: var(--foreground);
  font-size: 1.65rem;
  font-weight: 750;
  text-decoration: none;
}

.tagline,
.meta,
time { color: var(--muted); }

.tagline { margin: .2rem 0 .8rem; }

nav ul,
.plain-list {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

main { padding-block: 2rem; }

h1,
h2,
h3 {
  line-height: 1.3;
  text-wrap: balance;
}

h1 { font-size: clamp(1.9rem, 7vw, 2.6rem); }
h2 { margin-top: 1.8em; }

p,
li { overflow-wrap: anywhere; }

.page-header,
.article-header { margin-bottom: 2rem; }

.article-header h1,
.page-header h1 { margin-bottom: .35rem; }

.article-body > :first-child { margin-top: 0; }

.post-list,
.group-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-list > li {
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.post-list h2 { margin: 0 0 .25rem; }

.article-footer,
.site-footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.site-footer {
  padding-bottom: 1rem;
  color: var(--muted);
  font-size: .9rem;
}

blockquote {
  margin-inline: 0;
  padding-left: 1rem;
  border-left: .25rem solid var(--border);
}

pre,
code,
kbd {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

code,
kbd {
  padding: .08em .28em;
  background: var(--code);
}

pre {
  overflow-x: auto;
  padding: 1rem;
  background: var(--code);
  line-height: 1.55;
}

pre code { padding: 0; }

table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

th,
td {
  padding: .4rem .65rem;
  border: 1px solid var(--border);
  text-align: left;
}

.pagination,
.post-navigation {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .75rem 1rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

@media print {
  body { max-width: none; color: #000; background: #fff; }
  .site-header nav,
  .site-footer,
  .skip-link,
  .post-navigation { display: none; }
  a { color: inherit; }
  a[href]::after { content: " (" attr(href) ")"; font-size: .8em; }
}
