:root {
  color-scheme: light dark;
  --bg: #fbf8f1;
  --fg: #22201c;
  --muted: #6f6a60;
  --rule: #e4ddcd;
  --accent: #c2410c;
  --code-bg: #f3eee2;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18171c;
    --fg: #e9e4da;
    --muted: #9c968a;
    --rule: #2f2d35;
    --accent: #fb923c;
    --code-bg: #232129;
  }
}

* { box-sizing: border-box; }

html { background: var(--bg); color: var(--fg); }

body {
  margin: 0 auto;
  max-width: 44rem;
  padding: 2rem 1.25rem 4rem;
  font: 1.125rem/1.65 var(--serif);
  overflow-wrap: break-word;
}

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

/* header / footer */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-bottom: 3rem;
  font-family: var(--mono);
  font-size: 0.95rem;
}
.site-title { color: var(--fg); font-weight: 700; text-decoration: none; }
.site-title::before { content: "~/"; color: var(--accent); }
.site-header nav { display: flex; gap: 1.25rem; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--accent); }

.site-footer {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font: 0.85rem var(--mono);
}
.site-footer a { color: var(--muted); }

/* headings */
h1, h2, h3 { font-family: var(--mono); line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.25rem; margin: 2.5rem 0 0.75rem; }
h3 { font-size: 1.05rem; margin: 2rem 0 0.5rem; }
h2 a { color: inherit; text-decoration: none; }
h2 a:hover { color: var(--accent); }

/* lists of posts */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  align-items: baseline;
  gap: 1rem;
  padding: 0.35rem 0;
}
.post-list time { font: 0.85rem var(--mono); color: var(--muted); }
.post-list a { text-decoration: none; }
.post-list a:hover { text-decoration: underline; }
.draft-badge {
  display: inline-block;
  margin-left: 0.5em;
  padding: 0.05em 0.4em;
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--muted);
  font: 0.7rem var(--mono);
  vertical-align: middle;
}
@media (max-width: 30rem) {
  .post-list li { grid-template-columns: 1fr; gap: 0; }
}

.intro { margin-bottom: 1rem; }
.empty { color: var(--muted); }

/* posts */
.post-header { margin-bottom: 2rem; }
.post-meta { margin: 0; font: 0.85rem var(--mono); color: var(--muted); }
.back { margin-top: 3rem; font: 0.9rem var(--mono); }

article img { max-width: 100%; height: auto; }
figure { margin: 2rem 0; text-align: center; }
figcaption { font-size: 0.9rem; color: var(--muted); }
blockquote { margin: 1.5rem 0; padding-left: 1rem; border-left: 3px solid var(--rule); color: var(--muted); }
.lost-image {
  padding: 0.75rem 1rem;
  border: 1px dashed var(--rule);
  border-radius: 6px;
  font: 0.85rem var(--mono);
  color: var(--muted);
  text-align: center;
}

/* code */
code { font-family: var(--mono); font-size: 0.85em; font-variant-ligatures: none; }
:not(pre) > code { background: var(--code-bg); padding: 0.1em 0.3em; border-radius: 4px; }
pre {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--rule);
  font-size: 0.95rem;
  line-height: 1.5;
}
pre code { font-size: 0.85rem; background: none; padding: 0; }
/* line numbers from ```lang,linenos */
.giallo-ln { display: inline-block; min-width: 2ch; margin-right: 1.25em; text-align: right; user-select: none; }

/* math */
.math-display { margin: 1.5rem 0; overflow-x: auto; overflow-y: hidden; }
