:root {
  color-scheme: dark;
  --bg: #14120e;
  --bg-elevated: #1e1a14;
  --text: #e9e3d4;
  --muted: #a99c84;
  --accent: #e0b062;
  --accent-soft: #f3d9a0;
  --tag: #9db4cf;
  --border: #37301f;
  --reading: 44rem;
  --wide: 54rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 1.08rem;
  line-height: 1.75;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Header ---------- */
#preamble { border-bottom: 1px solid var(--border); }

header {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2rem;
  justify-content: space-between;
  margin: 0 auto;
  max-width: var(--wide);
  padding: 1.6rem 1.5rem;
}

.site-name {
  color: var(--accent);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: .01em;
  text-decoration: none;
}
.site-name:hover { color: var(--accent-soft); }

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: .95rem;
}
nav a { color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--accent-soft); }

/* ---------- Content ---------- */
#content {
  margin: 0 auto;
  max-width: var(--reading);
  padding: 2.75rem 1.5rem 1rem;
}
#content > .title { margin-top: 0; }

/* The archive page is wider than a normal article. */
#content.blog { max-width: var(--wide); }

h1, h2, h3, h4 {
  color: var(--accent-soft);
  font-weight: 600;
  line-height: 1.25;
}
h1.title { font-size: 2.4rem; margin: 0 0 1.75rem; }
h2 { font-size: 1.6rem; margin: 2.75rem 0 1rem; }
h3 { font-size: 1.28rem; margin: 2rem 0 .75rem; }

p { margin: 1.15rem 0; }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-soft); }

.lead {
  color: var(--text);
  font-size: 1.28rem;
  font-style: italic;
  margin: 2rem auto;
  max-width: 38rem;
  text-align: center;
}

/* ---------- Images ---------- */
img { display: block; height: auto; max-width: 100%; }

.figure, figure { margin: 2.25rem 0; }
.figure img, figure img {
  border: 1px solid var(--border);
  border-radius: .65rem;
  box-shadow: 0 22px 45px -24px rgba(0, 0, 0, .85);
  margin: 0 auto;
}
.hero-figure img {
  border-radius: .8rem;
  height: 24rem;
  object-fit: cover;
  width: 100%;
}

/* ---------- Quotes & rules ---------- */
blockquote {
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-style: italic;
  margin: 1.9rem 0;
  padding: .3rem 0 .3rem 1.4rem;
}
blockquote p { margin: .5rem 0; }

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

/* ---------- Definition lists ---------- */
dl { margin: 1.5rem 0; }
dt { color: var(--accent-soft); font-weight: 600; }
dd { color: var(--muted); margin: .15rem 0 0 0; }
dd + dt { margin-top: 1rem; }

/* ---------- Tags ---------- */
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 0 0 2rem;
}
.post-tags a {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: .8rem;
  padding: .2rem .75rem;
  text-decoration: none;
}
.post-tags a:hover { border-color: var(--accent); color: var(--accent-soft); }

.blog-subnav {
  color: var(--muted);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: .95rem;
  margin: -1rem 0 1.75rem;
}

.section-heading {
  border-top: 1px solid var(--border);
  font-size: 1.35rem;
  margin: 2.5rem 0 1rem;
  padding-top: 1.75rem;
}
.blog-subnav a { text-decoration: none; }
.blog-subnav a:hover { text-decoration: underline; }

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1.6rem;
  list-style: none;
  margin: 1.75rem 0;
  padding: 0;
}
.tag-cloud li { align-items: baseline; display: flex; gap: .5rem; }
.tag-cloud a { font-size: 1.1rem; text-decoration: none; }
.tag-cloud a:hover { color: var(--accent-soft); text-decoration: underline; }
.tag-count {
  color: var(--muted);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: .8rem;
}

/* ---------- Fill-in-the-blank exercises ---------- */
.blank {
  color: var(--muted);
  letter-spacing: .18em;
}

/* ---------- Monero QR ---------- */
.qr-figure img {
  border-radius: .6rem;
  margin: 0 auto;
  max-width: 17rem;
  width: 100%;
}

/* ---------- Monero address ---------- */
pre.address {
  color: var(--accent-soft);
  font-size: .82rem;
  text-align: center;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ---------- Code ---------- */
pre, code {
  font-family: "JetBrains Mono", "Fira Code", "SFMono-Regular", Consolas, monospace;
  font-size: .9em;
}
code {
  background: var(--bg-elevated);
  border-radius: .3rem;
  padding: .12em .38em;
}
pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: .55rem;
  overflow: auto;
  padding: 1rem 1.15rem;
}
pre code { background: none; padding: 0; }

/* ---------- Blog archive ---------- */
.post-list { list-style: none; margin: 1.75rem 0; padding: 0; }
.post-list li {
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 1.5rem;
  justify-content: space-between;
  padding: 1.05rem 0;
}
.post-entry { display: flex; flex-direction: column; gap: .45rem; }
.post-list .post-title { font-size: 1.16rem; text-decoration: none; }
.post-list .post-title:hover { color: var(--accent-soft); text-decoration: underline; }
.post-list time {
  color: var(--muted);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: .88rem;
  white-space: nowrap;
}
.post-heading { align-items: baseline; }
.entry-tags {
  color: var(--tag);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: .82rem;
  white-space: nowrap;
}
.entry-tags .tag-bar { color: var(--border); margin-right: .4rem; }
.entry-tags .tag { color: var(--tag); }

/* ---------- Footer ---------- */
#postamble {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}
footer {
  color: var(--muted);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: .9rem;
  margin: 0 auto;
  max-width: var(--wide);
  padding: 1.6rem 1.5rem;
  text-align: center;
}

/* ---------- Small screens ---------- */
@media (max-width: 40rem) {
  header { align-items: flex-start; flex-direction: column; }
  h1.title { font-size: 1.9rem; }
  .hero-figure img { height: 16rem; }
  .lead { font-size: 1.12rem; }
  .post-list li { flex-direction: column; gap: .3rem; }
}
