:root {
  --bg: #0e1726;
  --surface: #15233a;
  --surface-hover: #1b2d49;
  --line: #24385a;
  --text: #dde3ec;
  --text-soft: #b4bfcf;
  --muted: #7f8ea6;
  --accent: #6fa8ff;
  --accent-soft: rgba(111, 168, 255, 0.14);
  --measure: 38rem;
  --wide: 60rem;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Literata', Georgia, serif;
  font-optical-sizing: auto;
  font-size: 1.125rem;
  line-height: 1.7;
}

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

main, .site-footer {
  max-width: calc(var(--measure) + 2rem);
  margin: 0 auto;
  padding: 0 1rem;
}

/* ── Header / footer ─────────────────────────────────────────── */

/* Logo sits in the page's top-left corner, not the reading column */
.site-header { padding: 1.25rem 1.5rem 2.5rem; }

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}
.wordmark:hover { color: var(--accent); text-decoration: none; }
.wordmark img { width: 36px; height: 36px; border-radius: 8px; display: block; }

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 5rem;
  padding-top: 1.5rem;
  padding-bottom: 3rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}

/* ── Shared bits ─────────────────────────────────────────────── */

h1, h2 { font-weight: 600; line-height: 1.25; margin: 0; }
h1 { font-size: 2rem; }

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.9rem;
  color: var(--muted);
  font-size: 0.875rem;
}
.dates { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); }

.status {
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.05rem 0.6rem;
}

.blurb { color: var(--text-soft); font-style: italic; margin: 0.5rem 0 0.75rem; }
/* Emphasis inside an italic blurb flips back to upright, the way books do it */
.blurb em { font-style: normal; }
.blurb strong { color: var(--text); }

/* ── Home ────────────────────────────────────────────────────── */

.bio { margin-bottom: 3rem; }
.bio h1 { margin-bottom: 0.75rem; }
.bio p { color: var(--text-soft); margin: 0; }

.works {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.work-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  transition: background 120ms, border-color 120ms, transform 120ms;
}
.work-card:hover {
  text-decoration: none;
  background: var(--surface-hover);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.work-card h2 { font-size: 1.3rem; }
.work-card .blurb { margin-bottom: 0.6rem; }
.more {
  grid-column: 1 / -1;
  justify-self: center;
  padding: 0.6rem 1.2rem;
  color: var(--muted);
}

.work-card .meta { margin-top: auto; padding-top: 0.6rem; }

/* ── Work page / table of contents ───────────────────────────── */

.work h1 { margin-bottom: 0.25rem; }
.work .meta { margin-bottom: 2rem; }

.toc { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.toc li { border-bottom: 1px solid var(--line); }
.toc a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.85rem 0.75rem;
  color: var(--text);
  border-left: 3px solid transparent;
}
.toc a:hover { background: var(--surface); text-decoration: none; }
.toc-date { color: var(--muted); font-size: 0.875rem; white-space: nowrap; }
.toc .has-new a { border-left-color: var(--accent); background: var(--accent-soft); }

/* ── Reading ─────────────────────────────────────────────────── */

.reading-head { margin-bottom: 2.5rem; }
.reading-head h1 { margin-bottom: 0.5rem; }
.crumb { display: inline-block; margin-bottom: 0.4rem; font-size: 0.95rem; }

.prose p { margin: 0 0 1.15em; }
.prose h2, .prose h3, .prose h4 { font-weight: 600; line-height: 1.3; margin: 2.2em 0 0.8em; }
.prose h2 { font-size: 1.5rem; }
.prose h3 { font-size: 1.25rem; }
.prose h4 { font-size: 1.1rem; }
.prose blockquote {
  margin: 1.5em 0;
  padding-left: 1.2em;
  border-left: 3px solid var(--line);
  color: var(--text-soft);
}
.prose hr {
  border: 0;
  margin: 2.4em 0;
  text-align: center;
  color: var(--muted);
}
.prose hr::after { content: '\2217  \2217  \2217'; letter-spacing: 0.6em; }

/* Formatting from the editor: centered blocks and palette colors */
.prose .center { text-align: center; }
.prose span[class*="hl-"] { border-radius: 3px; padding: 0.05em 0.15em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.hl-blue   { background: rgba(111, 168, 255, 0.28); }
.hl-gold   { background: rgba(236, 189, 92, 0.30); }
.hl-rose   { background: rgba(240, 112, 146, 0.30); }
.hl-green  { background: rgba(108, 208, 150, 0.26); }
.hl-violet { background: rgba(168, 132, 255, 0.30); }
.tc-blue   { color: #8fbcff; }
.tc-gold   { color: #f0c674; }
.tc-rose   { color: #f49ab1; }
.tc-green  { color: #8fdaa9; }
.tc-violet { color: #c4a8ff; }
.prose ul, .prose ol { margin: 0 0 1.15em; padding-left: 1.4em; }
.prose li { margin-bottom: 0.3em; }

/* Where the latest published additions begin */
.new-marker {
  height: 2px;
  margin: 2.2em 0 1.6em;
  background: linear-gradient(90deg, var(--accent), transparent);
  border-radius: 2px;
  scroll-margin-top: 2rem;
}

.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 4rem;
}
.chapter-nav a {
  flex: 1;
  max-width: 48%;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
}
.chapter-nav a:hover { border-color: var(--accent); text-decoration: none; }
.chapter-nav small { display: block; color: var(--muted); font-size: 0.8rem; }
.chapter-nav .next { text-align: right; margin-left: auto; }

.newsletter {
  margin-top: 4rem;
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.newsletter h2 { font-size: 1.3rem; margin-bottom: 1.1rem; }
.newsletter-form { display: flex; gap: 0.6rem; }
.newsletter-form input {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 0.9rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}
.newsletter-form input:focus { outline: none; border-color: var(--accent); }
.newsletter-form button {
  padding: 0.7rem 1.3rem;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  color: #0b1422;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.newsletter-form button:hover { filter: brightness(1.1); }

.empty { padding: 3rem 0; }
.empty h1 { margin-bottom: 0.75rem; }

/* The home page gets a wider column so the cards can sit two across */
body.home main, body.home .site-footer { max-width: calc(var(--wide) + 2rem); }
body.home .bio { max-width: 44rem; margin-left: auto; margin-right: auto; text-align: center; }

@media (max-width: 640px) {
  .works { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .newsletter-form { flex-direction: column; }
  body { font-size: 1.0625rem; }
  h1 { font-size: 1.65rem; }
  .work-card { padding: 1.1rem 1.1rem; }
}
