:root {
  --bg: #fbfbf9;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --accent: #9a3b2e;
  --rule: #e4e2dc;
  --code-bg: #f1efe9;
  --max: 42rem;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Newsreader", Georgia, "Times New Roman", serif;
  font-size: 19px;
  line-height: 1.7;
  font-optical-sizing: auto;
}

main { max-width: var(--max); margin: 0 auto; padding: 9vh 1.5rem 6rem; }

a { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(154, 59, 46, 0.25); }
a:hover { border-bottom-color: var(--accent); }

/* ---------- home ---------- */
.site-head { margin-bottom: 3rem; }
.site-head h1 { font-size: 2.2rem; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 0.4rem; }
.subtitle { color: var(--muted); margin: 0 0 0.6rem; }
.site-links { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.8rem; color: var(--muted); margin: 0; }
.site-links .dot { margin: 0 0.4rem; opacity: 0.6; }

.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { padding: 1.4rem 0; border-top: 1px solid var(--rule); }
.post-list li.empty { color: var(--muted); }
.entry { display: block; border: none; }
.entry time {
  display: block;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 0.2rem;
}
.entry-title { font-size: 1.3rem; font-weight: 500; color: var(--fg); }
.entry:hover .entry-title { color: var(--accent); }
.entry-summary { margin: 0.4rem 0 0; color: #3a3a3a; font-size: 0.98rem; }

/* ---------- post ---------- */
.post .back { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.78rem; margin: 0 0 2.5rem; }
.post-head { margin-bottom: 2.5rem; }
.post-head time {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted);
}
.post-head h1 { font-size: 2.1rem; font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; margin: 0.5rem 0 0.8rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tags span {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.68rem; color: var(--muted); background: var(--code-bg);
  padding: 0.12rem 0.5rem; border-radius: 999px;
}

article h1, article h2, article h3 { line-height: 1.25; letter-spacing: -0.01em; font-weight: 600; }
article h1 { font-size: 1.7rem; margin: 2.6rem 0 1rem; }
article h2 { font-size: 1.4rem; margin: 2.4rem 0 0.9rem; padding-top: 1.2rem; border-top: 1px solid var(--rule); }
article h3 { font-size: 1.15rem; margin: 1.8rem 0 0.6rem; }
article p { margin: 0 0 1.1rem; }
article ul, article ol { margin: 0 0 1.1rem; padding-left: 1.4rem; }
article li { margin-bottom: 0.35rem; }
article strong { font-weight: 600; }
article blockquote {
  margin: 1.2rem 0; padding: 0.2rem 0 0.2rem 1.1rem;
  border-left: 3px solid var(--rule); color: #3a3a3a;
}
article hr { border: none; border-top: 1px solid var(--rule); margin: 2.2rem 0; }

/* code */
article code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.84em; background: var(--code-bg);
  padding: 0.12em 0.36em; border-radius: 4px;
}
article pre {
  background: var(--code-bg); border: 1px solid var(--rule); border-radius: 8px;
  padding: 1rem 1.1rem; overflow-x: auto; font-size: 0.82rem; line-height: 1.5;
  margin: 0 0 1.3rem;
}
article pre code { background: none; padding: 0; font-size: inherit; }

/* tables */
article table { border-collapse: collapse; width: 100%; margin: 0 0 1.4rem; font-size: 0.92rem; }
article th, article td { border: 1px solid var(--rule); padding: 0.5rem 0.7rem; text-align: left; vertical-align: top; }
article th { background: var(--code-bg); font-weight: 600; }

/* math: let display equations scroll on small screens */
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 0.3rem 0; }

.post-foot { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.78rem; }

@media (max-width: 480px) {
  body { font-size: 18px; }
  main { padding-top: 6vh; }
  .post-head h1 { font-size: 1.7rem; }
  article h1 { font-size: 1.45rem; }
}
