:root {
  --bg: #fbfaf7;
  --text: #222;
  --muted: #666;
  --accent: #8a2c1d;
  --rule: #e4e0d8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 "Open Sans", system-ui, sans-serif;
}

a { color: var(--accent); }

header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  max-width: 58rem;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  border-bottom: 1px solid var(--rule);
}

.site-name {
  font: 700 1.5rem "Playfair Display", Georgia, serif;
  color: var(--text);
  text-decoration: none;
}

nav { display: flex; gap: 1.25rem; }
nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
nav a:hover, nav a[aria-current] { color: var(--accent); }

main {
  max-width: 58rem;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

h1, h2 { font-family: "Playfair Display", Georgia, serif; line-height: 1.2; }
h1 { font-size: 2.25rem; margin-top: 0; }

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

/* Home: photo floats beside the bio on wide screens. */
.page-index main > p:first-child {
  float: right;
  width: min(20rem, 40%);
  margin: 0 0 1rem 2rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.page-index main > p:first-child img { display: block; margin-bottom: 0.25rem; }

@media (max-width: 36rem) {
  .page-index main > p:first-child { float: none; width: 100%; margin: 0 0 1.5rem; }
}

/* Books: build.py wraps each "##" section in <section>; show them as a grid. */
.page-books main {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 2rem 1.25rem;
}
.page-books h1 { grid-column: 1 / -1; margin-bottom: 0; }
.page-books section { display: flex; flex-direction: column; }
.page-books section h2 { order: 1; font-size: 1.05rem; text-wrap: balance; margin: 0.75rem 0 0.25rem; }
.page-books section p { order: 2; margin: 0; }
.page-books section p:has(img) { order: 0; }
.page-books section img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; box-shadow: 0 2px 8px rgb(0 0 0 / 0.15); }
