:root {
  color-scheme: light dark;
  --bg: #f3eee6;
  --panel: #f6f1e9;
  --ink: #3a2d22;
  --muted: #85705b;
  --line: #d7c8b2;
  --focus: #174ea6;
  --wood-light: #ca9556;
  --wood-mid: #a66f37;
  --wood-dark: #71461f;
  --max: 64rem;
  --header-height: 4.25rem;
  --footer-height: 7rem;
  --display-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Baskerville, "Times New Roman", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #241a13;
    --panel: #2f2219;
    --ink: #f5eada;
    --muted: #c9b69b;
    --line: #62462a;
    --focus: #8ab4f8;
    --wood-light: #9b6a3a;
    --wood-mid: #6b4322;
    --wood-dark: #432611;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--display-serif);
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-underline-offset: 0.18em;
}

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

.skip-link {
  background: var(--ink);
  color: var(--bg);
  left: 0.75rem;
  padding: 0.4rem 0.55rem;
  position: absolute;
  top: 0.75rem;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header,
.site-footer {
  margin: 0 auto;
  max-width: var(--max);
  padding: 1rem;
  width: 100%;
}

.site-header {
  align-items: flex-start;
  background: transparent;
  border-bottom: 0;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  min-height: var(--header-height);
  padding-top: 1.25rem;
  position: static;
}

.brand {
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
}

.tagline {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  margin: 0;
  text-align: right;
  white-space: nowrap;
}

main {
  margin: 0 auto;
  max-width: var(--max);
  overflow: visible;
  padding: 0 1rem;
  width: 100%;
}

.bookcase {
  padding: 1.75rem 0 3rem;
  overflow: hidden;
  width: 100%;
}

.home-intro {
  background:
    repeating-linear-gradient(
      180deg,
      transparent 0,
      transparent 2.95rem,
      color-mix(in srgb, var(--line) 34%, transparent 66%) 2.95rem,
      color-mix(in srgb, var(--line) 34%, transparent 66%) 3rem
    );
  margin: 0 0 2.5rem;
  padding: 2rem 0 2.75rem;
  text-align: center;
}

.home-eyebrow {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  margin: 0;
  text-transform: uppercase;
}

.home-title {
  color: color-mix(in srgb, var(--ink) 84%, var(--bg) 16%);
  font-family: var(--display-serif);
  font-size: clamp(2.5rem, 8vw, 4.9rem);
  font-weight: 200;
  letter-spacing: -0.025em;
  line-height: 1;
  margin: 1rem auto 0;
  max-width: 12ch;
}

.home-title span {
  display: block;
  white-space: nowrap;
}

.home-dek {
  color: var(--muted);
  font-family: var(--display-serif);
  font-size: clamp(1rem, 2.4vw, 1.3rem);
  font-style: italic;
  line-height: 1.45;
  margin: 1.5rem auto 0;
  max-width: 34rem;
}

.bookcase-shelf {
  margin: 0 0 5rem;
  position: relative;
}

.shelf-hit-area {
  inset: 0;
  position: absolute;
  z-index: 1;
}

.shelf-hit-area:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

.shelf-copy {
  align-items: flex-start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin: 0 0 1.6rem;
  pointer-events: none;
  position: relative;
  text-align: left;
  width: 100%;
  z-index: 2;
}

.shelf-copy a {
  pointer-events: auto;
  text-decoration: none;
}

.shelf-lede {
  max-width: 30rem;
}

.shelf-lede h1,
.home-title {
  font-family: var(--display-serif);
}

.shelf-lede p {
  font-family: var(--display-serif);
  font-size: 0.82rem;
  font-style: italic;
  margin-top: 0.45rem;
}

.shelf-action {
  margin: 0;
  padding-top: 0.1rem;
}

.shelf-action a {
  border: 1px solid var(--line);
  color: var(--muted);
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  padding: 0.7rem 1rem;
  text-transform: uppercase;
}

.book-spines {
  align-items: flex-end;
  display: flex;
  gap: 0.14rem;
  justify-content: center;
  list-style: none;
  margin: 0;
  min-height: 12.5rem;
  overflow: hidden;
  padding: 0 0 0.95rem;
  position: relative;
  z-index: 2;
}

.book-spines::after {
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--wood-light) 88%, white 12%) 0%,
      var(--wood-light) 14%,
      var(--wood-mid) 40%,
      var(--wood-dark) 100%
    );
  bottom: 0;
  content: "";
  border-radius: 1px;
  box-shadow:
    0 1px 0 color-mix(in srgb, var(--wood-light) 80%, white 20%),
    0 0.75rem 1rem rgba(61, 34, 12, 0.2);
  height: 1.08rem;
  left: 0;
  position: absolute;
  width: 100%;
}

.book-spine {
  align-items: center;
  background:
    linear-gradient(
      90deg,
      var(--spine-edge, #7a5232) 0%,
      var(--spine-bg, #915f3b) 18%,
      var(--spine-bg, #915f3b) 78%,
      var(--spine-shadow, #5d3b24) 100%
    );
  border: 0;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  box-shadow:
    inset 1px 0 0 rgba(255, 255, 255, 0.3),
    inset -1px 0 0 rgba(0, 0, 0, 0.08),
    0 0.3rem 0.45rem rgba(86, 63, 42, 0.16);
  display: flex;
  flex: 0 0 var(--spine-width);
  height: var(--spine-height);
  justify-content: center;
  min-height: 9.25rem;
  padding: 0;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease;
}

.book-spine:hover {
  box-shadow:
    inset 1px 0 0 rgba(255, 255, 255, 0.3),
    inset -1px 0 0 rgba(0, 0, 0, 0.08),
    0 0.6rem 0.85rem rgba(86, 63, 42, 0.2);
  transform: translateY(-0.35rem);
}

.book-spine-link {
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: center;
  padding: 0.45rem 0.12rem;
  text-decoration: none;
  width: 100%;
}

.book-spine-text {
  color: rgba(56, 41, 30, 0.72);
  display: block;
  font-weight: 400;
  letter-spacing: -0.02em;
  text-shadow: none;
  font-size: var(--title-scale);
  line-height: 0.82;
  max-height: calc(var(--spine-height) - 1rem);
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  writing-mode: vertical-lr;
  transform: rotate(180deg);
}

.book-spine-title,
.book-spine-author {
  display: block;
}

.book-spine-title {
  font-weight: 500;
  margin-block-start: 0.7rem;
}

.book-spine-author {
  font-weight: 400;
  opacity: 0.72;
}

.page {
  margin: 2.5rem 0 4rem;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 1.25rem;
}

h2 {
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.35;
  margin-top: 1.5rem;
}

.book-list h2 {
  margin-top: 0;
}

.book-list h2 a {
  text-decoration: none;
}

p {
  color: var(--muted);
  margin-top: 0.75rem;
}

.meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.score-button {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.score-popover {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: none;
  color: var(--muted);
  font: inherit;
  max-width: min(24rem, calc(100vw - 2rem));
  padding: 1rem;
}

.score-popover p + p {
  margin-top: 0.75rem;
}

.book-list {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
}

.book-list li {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 2rem minmax(0, 1fr);
  padding: 1rem 0;
}

.book-rank {
  color: var(--muted);
  font-size: 0.78rem;
  padding-top: 0.12rem;
}

.book-entry {
  display: grid;
  gap: 1rem;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  width: 100%;
}

.book-copy {
  min-width: 0;
}

.book-cover-link {
  display: block;
}

.book-cover {
  aspect-ratio: 2 / 3;
  border: 1px solid var(--line);
  display: block;
  object-fit: cover;
  width: 4.5rem;
}

.book-link {
  text-align: right;
}

.site-footer {
  background: transparent;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  min-height: var(--footer-height);
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
  text-align: center;
  position: static;
}

.site-footer p {
  margin: 0;
}

.site-footer .affiliate-disclaimer {
  margin: 0 auto 2rem;
  max-width: none;
}

.site-footer a {
  margin: 0 0.35rem;
}

@media (min-width: 700px) {
  body {
    font-size: 15px;
  }

  .site-header,
  main,
  .site-footer {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .book-spine {
    flex-basis: calc(var(--spine-width) * 1.3);
  }

  .book-spine-link {
    padding-left: 0.18rem;
    padding-right: 0.18rem;
  }

  .page {
    margin-top: 4rem;
  }
}

@media (max-width: 620px) {
  :root {
    --header-height: 6rem;
    --footer-height: 8rem;
  }

  .shelf-copy {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.85rem;
  }

  .home-intro {
    padding: 1.5rem 0 2.2rem;
  }

  .home-title {
    font-size: clamp(2.15rem, 12vw, 3.3rem);
    max-width: 12ch;
  }

  .home-dek {
    font-size: 0.98rem;
    max-width: 24rem;
  }

  .shelf-action {
    display: none;
  }

  .shelf-action a {
    font-size: 0.68rem;
    padding: 0.6rem 0.85rem;
  }

  .site-header {
    flex-direction: column;
  }

  .tagline {
    display: none;
  }

  .book-entry {
    grid-template-columns: 4rem minmax(0, 1fr);
  }

  .book-cover {
    width: 4rem;
  }

  .book-link {
    grid-column: 2;
    text-align: left;
  }

  .book-spines {
    gap: 0.12rem;
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }

  .book-spine {
    flex-basis: var(--spine-width);
    min-width: 1.15rem;
  }

  .book-spine span {
    font-size: 0.48rem;
  }
}
