:root {
  --paper: #fbfaf7;
  --ink: #1f1e1c;
  --muted: #6c675f;
  --rule: #e4e0d8;
  --accent: #c8281f;      /* the red from the Nils All Alone title */
  --accent-ink: #a01f18;
  --blue: #2346a8;        /* Niels's blue highlight text, a little softer */
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.125rem/1.65 var(--serif);
}

img { max-width: 100%; height: auto; }

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

.wrap { max-width: 62rem; margin: 0 auto; padding: 0 1rem; }
.wrap.narrow { max-width: 42rem; }

/* Header */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.25rem 1.5rem; padding-top: 1.25rem; padding-bottom: 1rem;
}
.site-title {
  color: var(--ink); text-decoration: none;
  font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em;
}
.site-title:hover { color: var(--ink); }
.tagline {
  margin-left: 0.6rem; font: 400 0.95rem var(--serif); font-style: italic; color: var(--muted);
}
.site-nav { display: flex; gap: 1.25rem; font: 500 0.95rem var(--sans); }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--accent); }

/* Front page */
.banner { margin-top: 2rem; }
.banner img { display: block; width: 100%; border: 1px solid var(--rule); }

.section-title {
  font: 600 0.8rem var(--sans); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin: 3rem 0 1.25rem; padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}

.shelf {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 2rem 1.5rem; align-items: end;
}
.book { display: block; text-decoration: none; color: var(--ink); }
.book .cover { display: flex; align-items: flex-end; height: 15rem; }
.book img {
  display: block; max-height: 100%; width: auto; margin: 0 auto;
  box-shadow: 0 1px 2px rgba(0,0,0,.18), 0 6px 18px rgba(0,0,0,.12);
  transition: transform .2s ease, box-shadow .2s ease;
}
.book:hover img { transform: translateY(-4px); box-shadow: 0 2px 4px rgba(0,0,0,.18), 0 12px 26px rgba(0,0,0,.16); }
.book-title { display: block; margin-top: 0.85rem; font-size: 0.98rem; line-height: 1.35; text-align: center; }
.book:hover .book-title { color: var(--accent-ink); }

.entries { list-style: none; margin: 0; padding: 0; }
.entries li + li { border-top: 1px solid var(--rule); }
.entries a { display: block; padding: 1.1rem 0; color: var(--ink); text-decoration: none; }
.entries time { display: block; font: 0.82rem var(--sans); color: var(--muted); }
.entry-title { display: block; font-size: 1.3rem; font-weight: 700; line-height: 1.3; margin: 0.15rem 0 0.3rem; }
.entries a:hover .entry-title { color: var(--accent-ink); }
.entry-excerpt { display: block; color: var(--muted); font-size: 1rem; line-height: 1.55; }

/* Articles */
article.wrap { padding-top: 2.75rem; }
.entry-header { margin-bottom: 2rem; }
h1 { font-size: clamp(1.8rem, 5vw, 2.5rem); line-height: 1.15; letter-spacing: -0.015em; margin: 0 0 0.5rem; }
.entry-header time { font: 0.88rem var(--sans); color: var(--muted); }

.prose { overflow-wrap: break-word; }
.prose p, .prose ul, .prose ol, .prose figure, .prose div { margin: 0 0 1.1em; }
.prose h2, .prose h3 { line-height: 1.25; margin: 1.8em 0 0.5em; }
.prose figure img, .prose p > a > img, .prose p > img { display: block; }
.prose figcaption { font: italic 0.92rem var(--serif); color: var(--muted); margin-top: 0.5rem; }
.prose figure { margin-left: 0; margin-right: 0; }
.prose [style*="#0000ff"] { color: var(--blue) !important; }
.prose [style*="#000000"] { color: var(--ink) !important; }

/* Book page */
.book-page { display: grid; grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.book-cover img { display: block; width: 100%; box-shadow: 0 2px 4px rgba(0,0,0,.18), 0 14px 32px rgba(0,0,0,.16); }
.book-info h1 { margin-top: 0.25rem; }
.byline { font-style: italic; color: var(--muted); margin: 0 0 1.5rem; }
.facts { font: 0.92rem var(--sans); color: var(--muted); margin: 0 0 1.25rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0 0 1rem; }
.button {
  display: inline-block; padding: 0.7rem 1.4rem; border-radius: 6px;
  background: var(--accent); color: #fff; text-decoration: none;
  font: 600 1rem var(--sans);
}
.button:hover { background: var(--accent-ink); color: #fff; }
.button.secondary { background: transparent; color: var(--accent-ink); box-shadow: inset 0 0 0 1.5px currentColor; }
.button.secondary:hover { color: var(--accent); background: transparent; }
.hint { font: 0.85rem/1.5 var(--sans); color: var(--muted); max-width: 30rem; }

/* Prev / next */
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.pager a { text-decoration: none; color: var(--ink); max-width: 48%; line-height: 1.35; }
.pager a:hover { color: var(--accent-ink); }
.pager span { display: block; font: 600 0.75rem var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.2rem; }
.pager .next { margin-left: auto; text-align: right; }

.not-found { padding-bottom: 4rem; }

/* Footer */
.site-footer { margin-top: 4rem; border-top: 1px solid var(--rule); }
.site-footer .wrap { padding-top: 1.5rem; padding-bottom: 2.5rem; font: 0.85rem var(--sans); color: var(--muted); }

@media (max-width: 40rem) {
  body { font-size: 1.0625rem; }
  .tagline { display: block; margin: 0.1rem 0 0; }
  .banner { margin-top: 1.25rem; }
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.75rem 1rem; }
  .book .cover { height: 12rem; }
  .book-page { grid-template-columns: 1fr; gap: 1.75rem; }
  .book-cover { max-width: 16rem; margin: 0 auto; }
  .book-info { text-align: center; }
  .actions { justify-content: center; }
  .hint { margin: 0 auto; }
}
