/* One stylesheet for every page. No build step: edit and reload. */

:root {
  color-scheme: light;

  --bg: #fdfdfb;
  --text: #1c1c1a;
  --muted: #6b6b66;
  --rule: #e4e4de;
  --link: #1a4f8b;

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

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

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

body {
  margin: 0;
  padding: 4rem 1.25rem 3rem;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

/* The narrow text column. Header, main and footer all share it. */
.page {
  max-width: 720px;
  margin: 0 auto;
}

/* ---------- Text ---------- */

h1,
h2 {
  font-weight: 600;
  line-height: 1.25;
  text-wrap: balance;
}

h1 {
  font-size: 1.9rem;
  margin: 0 0 1.25rem;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.25rem;
  margin: 0 0 0.75rem;
}

p {
  margin: 0 0 1rem;
}

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

a:hover {
  text-decoration-thickness: 2px;
}

a:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
  border-radius: 2px;
}

section {
  margin-top: 3.5rem;
}

/* ---------- Homepage ---------- */

/* Intro: text on the left, photo on the right. */
.intro {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2.25rem;
  align-items: start;
}

.intro-text > :last-child {
  margin-bottom: 0;
}

/* Shown whole, at its own aspect ratio: never cropped. It comes first in
   the HTML so it leads on small screens. */
.photo {
  order: 2;
  display: block;
  width: 100%;
  height: auto;
}

.links {
  list-style: none;
  margin: 3rem 0 0;
  padding: 1.5rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  columns: 2;
  column-gap: 2rem;
}

.links li {
  padding: 0.2rem 0;
  break-inside: avoid;
}

/* ---------- Inner pages ---------- */

.home-link {
  display: inline-block;
  margin-bottom: 2.5rem;
  color: var(--muted);
  font-size: 1rem;
}

.muted {
  color: var(--muted);
}

/* ---------- Best Reads page ---------- */

.books {
  margin: 2rem 0 0;
  padding-left: 1.25rem;
}

.books li {
  padding: 0.3rem 0;
}


/* Pages that should have no dividing lines at all. */
.no-rules footer {
  border-top: 0;
}

/* ---------- Footer ---------- */

footer {
  margin-top: 4.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.95rem;
}

footer a {
  color: var(--muted);
  margin-right: 1.25rem;
}

/* ---------- Small screens ---------- */

/* Below the full column width there is no room for text beside the photo:
   stack them, photo first. */
@media (max-width: 760px) {
  .intro {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }

  .photo {
    order: 0;
    width: 220px;
    max-width: 60%;
  }
}

@media (max-width: 480px) {
  body {
    padding-top: 2.5rem;
    font-size: 1.0625rem;
  }

  h1 {
    font-size: 1.65rem;
  }
}
