:root {
  --bg: #f3f0e8;
  --ink: #1c1915;
  --muted: #6a6258;
  --faint: #8a8176;
  --rule: #ddd4c6;
  --accent: #8d3b2c;
  --accent-hover: #6d2b1f;
  --code: #efe8dc;
  --code-ink: #2a241e;
  --mark: #efe2c4;
  --max: 40.5rem;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: "Sarasa Mono SC", "Source Han Mono SC", "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent-hover); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--ink);
  color: var(--bg);
  padding: 0.4rem 0.7rem;
  z-index: 2;
}
.skip:focus { top: 0.6rem; color: var(--bg); }

.wrap {
  width: min(var(--max), calc(100% - 2.4rem));
  margin: 0 auto;
}

.masthead {
  border-bottom: 1px solid var(--rule);
  padding: 1.35rem 0 1.05rem;
}

.brand {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
}

.brand-name {
  font-family: var(--serif);
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.brand-sub {
  color: var(--faint);
  font-size: 0.92rem;
  letter-spacing: 0.08em;
}

.page { padding: 2.2rem 0 4rem; }

.lede {
  margin: 0 0 2rem;
  color: var(--muted);
  font-size: 1rem;
}

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

.post-list li + li { border-top: 1px solid var(--rule); }

.post-list a {
  display: block;
  padding: 1.15rem 0 1.2rem;
  text-decoration: none;
  color: inherit;
}

.post-list a:hover .post-list-title { color: var(--accent); }

.post-list-title {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.015em;
}

.post-list-meta,
.meta {
  margin: 0.35rem 0 0;
  color: var(--faint);
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}

.post-list-excerpt {
  margin: 0.45rem 0 0;
  color: var(--muted);
}

.meta { margin-bottom: 1.4rem; }

.article h1,
.article h2,
.article h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.article h1 { font-size: 2rem; margin: 0 0 1.1rem; }
.article h2 { font-size: 1.45rem; margin: 2.2rem 0 0.7rem; }
.article h3 { font-size: 1.15rem; margin: 1.6rem 0 0.45rem; }

.article p { margin: 0.85rem 0; }

.article .heading-anchor { color: inherit; text-decoration: none; }
.article .heading-anchor:hover { color: var(--accent); }

.article ul,
.article ol { padding-left: 1.25rem; }
.article li { margin: 0.28rem 0; }
.article li::marker { color: var(--faint); }

.article a { text-decoration-thickness: 1px; }

.article code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--code);
  padding: 0.08em 0.32em;
  border-radius: 3px;
}

.article pre {
  background: var(--code);
  padding: 0.9rem 1rem;
  overflow-x: auto;
  line-height: 1.55;
  font-size: 0.9rem;
  border-radius: 4px;
}

.article pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

.table-wrap {
  margin: 1.1rem 0 1.3rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
}

.article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
  line-height: 1.55;
}

.article th,
.article td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.7rem 0.55rem 0;
  border-bottom: 1px solid var(--rule);
  overflow-wrap: anywhere;
}

.article th {
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.article tr:last-child td { border-bottom: 0; }

.diagram {
  box-sizing: border-box;
  width: 100vw;
  max-width: 100vw;
  margin: 1.2rem calc(50% - 50vw) 1.4rem;
  padding: 0.4rem 1rem 0.2rem;
  overflow-x: auto;
  text-align: center;
}

.diagram .mermaid {
  display: inline-block;
  text-align: initial;
  background: transparent;
}

.diagram svg {
  max-width: none;
  height: auto;
}

.article blockquote {
  margin: 1.1rem 0;
  padding-left: 0.95rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}

.colophon {
  border-top: 1px solid var(--rule);
  padding: 1.2rem 0 2rem;
  color: var(--faint);
  font-size: 0.88rem;
}

.colophon a { color: var(--muted); }

.empty {
  border-top: 1px solid var(--rule);
  padding-top: 1.2rem;
  color: var(--muted);
}

::selection { background: var(--mark); }

@media (max-width: 640px) {
  body { font-size: 1.02rem; }
  .wrap { width: min(var(--max), calc(100% - 1.6rem)); }
  .article h1 { font-size: 1.65rem; }
  .post-list-title { font-size: 1.28rem; }
  .brand { align-items: flex-start; flex-direction: column; gap: 0.15rem; }
}
