/* ---------- Colors and fonts, defined once ---------- */
:root {
  --ink: #2b2622;          /* main text */
  --muted: #6f655c;        /* secondary text */
  --paper: #fbf8f3;        /* page background */
  --card: #ffffff;         /* boxes */
  --line: #e6ddd0;         /* borders */
  --accent: #a4472b;       /* links and highlights */
  --gold: #b8892b;         /* medal color */
  --silver: #8a8f96;       /* honor color */
}

/* ---------- Page basics ---------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.6;
}

main {
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

h1, h2 { line-height: 1.2; }
h1 { font-size: 2.2rem; margin: 0 0 0.5rem; }
h2 {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 2.5rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.3rem;
}

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

/* ---------- Top navigation bar ---------- */
.site-header {
  background: var(--ink);
  padding: 0.8rem 1.25rem;
}
.site-header nav {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  align-items: baseline;
  font-family: system-ui, sans-serif;
  font-size: 0.95rem;
}
.site-header a { color: #f3ece2; }
.site-header .brand {
  font-family: Georgia, serif;
  font-size: 1.3rem;
  font-weight: bold;
  margin-right: auto;     /* pushes the other links to the right */
}

/* ---------- Home page headline ---------- */
.hero { padding: 1rem 0 0.5rem; }
.hero h1 { font-size: 2.8rem; }
.hero-stats {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0;
}
/* Keep multi-word links like "Caldecott Medal" together on one line. */
.hero-stats a { white-space: nowrap; }
@media (max-width: 600px) {
  .hero h1 { font-size: 2.1rem; }
  .hero-stats { font-size: 1.1rem; }
}

/* ---------- Lists of awards and books ---------- */
.list { list-style: none; padding: 0; margin: 0; }
.list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}
.year {
  display: inline-block;
  width: 3.5rem;
  font-weight: bold;
  color: var(--muted);
}
.by { color: var(--muted); }

/* Small colored label: "Medal", "Honor", "Finalist"... */
.badge {
  display: inline-block;
  font-family: system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  color: #fff;
  vertical-align: middle;
  margin-left: 0.4rem;
}
.badge-winner   { background: var(--gold); }
.badge-honor    { background: var(--silver); }
.badge-finalist { background: var(--silver); }

/* ---------- Book page: cover on the left, details on the right ---------- */
.book {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2rem;
  align-items: start;
}
.cover { width: 200px; }

/* The image keeps its own shape: full width, height follows automatically,
   so wide and tall covers both show completely, never cropped. */
.cover img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* The "No cover available" box only shows when there's no image. */
.cover span { display: none; }
.cover.missing span {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 2 / 3;
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

/* "Buy on Amazon" button under the cover */
.buy {
  display: block;
  margin-top: 0.8rem;
  padding: 0.55rem 0.8rem;
  text-align: center;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  font-family: system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
}
.buy:hover { text-decoration: none; filter: brightness(1.1); }
.meta { color: var(--muted); margin: 0; }

/* ---------- Decade pager on award pages ---------- */
.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1.5rem 0;
  font-family: system-ui, sans-serif;
  font-size: 0.9rem;
}
.pager a, .pager .current {
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.pager .current {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.pager a:hover { text-decoration: none; background: var(--card); }
/* "Most honored" sits at the far right of the letter buttons. */
.pager .pager-extra { margin-left: auto; }

/* Ranking table: a narrow rank column, and a line between rank groups */
.ranking .rank { width: 3.5rem; text-align: left; font-weight: bold; color: var(--muted); }

/* Honors in the same year sit closer together; a new year gets a stronger line. */
.list li.new-year { border-top: 2px solid var(--line); }

/* ---------- Authors & Illustrators directory ---------- */
.directory {
  width: 100%;
  border-collapse: collapse;
}
.directory th, .directory td {
  text-align: left;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--line);
}
.directory thead th {
  font-family: system-ui, sans-serif;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.directory .num { text-align: right; width: 5rem; font-variant-numeric: tabular-nums; }
.directory tr.letter th {
  padding-top: 1.5rem;
  font-size: 1.4rem;
  color: var(--accent);
  border-bottom: 2px solid var(--line);
}

/* ---------- Blog posts ---------- */
.post h1 { margin-top: 0.3rem; }
/* Headings inside a post read like normal headings, not the small
   uppercase section labels used elsewhere. */
.post-body h2 {
  font-size: 1.5rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  border-bottom: none;
  margin-top: 2rem;
}

/* ---------- Awards calendar on the home page ---------- */
.calendar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);   /* three months side by side */
  gap: 1rem;
}
.cal-month {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem;
}
.cal-month h3 {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
}
.cal-month ul { list-style: none; margin: 0; padding: 0; }
.cal-month p { margin: 0; font-size: 0.95rem; }
.cal-month li { margin-bottom: 0.9rem; font-size: 0.95rem; line-height: 1.45; }
.cal-month li > span, .cal-link { display: block; }
.cal-when {
  font-family: system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.cal-when.tentative { color: var(--muted); font-style: italic; }
.cal-link { font-family: system-ui, sans-serif; font-size: 0.85rem; margin-top: 0.2rem; }

/* On phones, stack the months */
@media (max-width: 700px) {
  .calendar { grid-template-columns: 1fr; }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 1.25rem 2.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}
.site-footer p { margin: 0.3rem 0; }

/* On narrow screens (phones), stack the cover above the details */
@media (max-width: 600px) {
  .book { grid-template-columns: 1fr; }
  .cover, .buy { width: 160px; }
}
