/* ---------- design tokens ---------- */
:root {
  --max-width: 42rem;

  --serif: Charter, "Iowan Old Style", "Source Serif Pro", Georgia, Cambria, "Times New Roman", serif;
  --mono: "SFMono-Regular", "JetBrains Mono", "Fira Code", Menlo, Consolas, "Liberation Mono", monospace;

  --bg:        #fbfbf9;
  --fg:        #1a1a1a;
  --muted:     #6b6b6b;
  --faint:     #ededea;
  --rule:      #e2e2dd;
  --accent:    #b3541e;   /* warm rust */
  --accent-fg: #ffffff;
  --code-bg:   #f3f3ef;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #15161a;
    --fg:      #dcdcd6;
    --muted:   #8a8a86;
    --faint:   #20222a;
    --rule:    #2a2c35;
    --accent:  #e08a4f;
    --code-bg: #1e2027;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

/* ---------- header ---------- */
.site-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 1.75rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-title {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
}
.site-title::before { content: "~/"; color: var(--muted); }

.site-nav {
  font-family: var(--mono);
  font-size: 0.85rem;
  display: flex;
  gap: 1.1rem;
}
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--accent); }

/* ---------- links & typography ---------- */
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

h1, h2, h3, h4 {
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 2.2rem 0 0.8rem;
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

p, ul, ol, blockquote, pre, table { margin: 0 0 1.1rem; }

blockquote {
  margin-left: 0;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
  font-style: italic;
}

hr { border: none; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

/* ---------- code ---------- */
code, pre, kbd, samp { font-family: var(--mono); font-size: 0.86em; }

code {
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

pre {
  background: var(--code-bg);
  padding: 1rem 1.1rem;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.5;
}
pre code { background: none; padding: 0; }

/* ---------- intro / home ---------- */
.intro p {
  color: var(--muted);
  font-size: 1.05rem;
  margin-bottom: 2.5rem;
}

/* ---------- post list ---------- */
.post-list ul { list-style: none; padding: 0; margin: 0; }
.post-list li {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.45rem 0;
}
.post-list time {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  flex: 0 0 auto;
  min-width: 6.2rem;
}
.post-list a { color: var(--fg); }
.post-list a:hover { color: var(--accent); }
.empty { color: var(--muted); font-style: italic; }

/* title + subtitle stacked in each list entry */
.post-list .post-entry { display: flex; flex-direction: column; gap: 0.1rem; }
.post-list .post-subtitle-list {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--muted);
}

/* series: nest chapters as a secondary list under the overview */
.post-list li.series-head { display: block; }
.post-list li.series-head > .post-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}
.post-list .series-children { list-style: none; margin: 0; padding-left: 7.2rem; }
.post-list .series-children li { padding: 0.3rem 0; gap: 0.5rem; }
.post-list .series-children li::before {
  content: "\2022"; /* • chapter marker */
  color: var(--muted);
  flex: 0 0 auto;
}

/* ---------- post ---------- */
.post-title { margin-top: 0; margin-bottom: 0.3rem; }
.post-subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0 0 0.6rem;
}
.post-meta {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: -0.4rem;
}
.post-body { margin-top: 2rem; }
.post-body img { max-width: 100%; height: auto; border-radius: 6px; }

.tag {
  font-family: var(--mono);
  font-size: 0.75rem;
  background: var(--faint);
  color: var(--muted);
  padding: 0.1em 0.5em;
  border-radius: 4px;
  margin-right: 0.3rem;
}

.post-footer {
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.85rem;
}

/* ---------- footer ---------- */
.site-footer {
  max-width: var(--max-width);
  margin: 4rem auto 2.5rem;
  padding: 1.5rem 1.25rem 0;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.site-footer .dot { margin: 0 0.5rem; opacity: 0.5; }

/* ---------- tables ---------- */
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { border-bottom: 1px solid var(--rule); padding: 0.5rem 0.6rem; text-align: left; }
th { font-family: var(--mono); font-size: 0.8rem; }
