:root {
  color-scheme: light;
  --paper: #f2eedf;
  --ink: #272522;
  --muted: rgba(39, 37, 34, 0.58);
  --line: rgba(39, 37, 34, 0.18);
  --panel: rgba(247, 243, 231, 0.62);
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
  --sans: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--paper);
}

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  overflow-x: hidden;
}

a,
button {
  color: inherit;
  font: inherit;
}

button {
  border: 0;
}

#book-watercolor {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.paper-grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.22;
  mix-blend-mode: multiply;
  background-image:
    repeating-radial-gradient(circle at 17% 23%, rgba(63, 55, 41, 0.12) 0 0.4px, transparent 0.6px 3px),
    repeating-radial-gradient(circle at 73% 64%, rgba(255, 255, 255, 0.34) 0 0.5px, transparent 0.7px 4px);
  background-size: 10px 11px, 13px 15px;
}

.book-header,
.books-page {
  position: relative;
  z-index: 2;
}

.book-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.55rem clamp(1.1rem, 2.7vw, 2.7rem);
  font: 560 0.68rem/1 var(--sans);
  letter-spacing: 0.08em;
}

.book-header p {
  margin: 0;
  color: var(--muted);
}

.text-button {
  width: fit-content;
  padding: 0;
  background: transparent;
  text-decoration: none;
}

.text-button::after {
  content: "";
  display: block;
  width: 0;
  height: 1px;
  margin-top: 0.2rem;
  background: currentColor;
  transition: width 220ms ease;
}

.text-button:hover::after {
  width: 100%;
}

.books-page {
  width: min(1180px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: clamp(6rem, 11vh, 8.5rem) 0 5.5rem;
}

.books-hero {
  max-width: 760px;
  margin-bottom: clamp(2rem, 5vw, 4.4rem);
}

.books-kicker {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font: 650 0.62rem/1 var(--sans);
  letter-spacing: 0.22em;
}

.books-hero h1 {
  margin: 0;
  font: 400 clamp(4rem, 10vw, 9rem) / 0.92 var(--serif);
  letter-spacing: -0.09em;
}

.books-hero p:last-child {
  max-width: 38rem;
  margin: 1.25rem 0 0;
  color: var(--muted);
  font: 400 0.9rem/1.8 var(--serif);
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(0.9rem, 2vw, 1.4rem);
  align-items: start;
}

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

.book-cover {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  height: auto;
  border: 1px solid rgba(39, 37, 34, 0.14);
  padding: 0;
  overflow: hidden;
  background: rgba(247, 243, 231, 0.32);
  box-shadow: none;
  cursor: pointer;
  transition: border-color 200ms ease, background-color 200ms ease, opacity 200ms ease;
}

.book-cover:hover,
.book-card.is-open .book-cover {
  border-color: rgba(102, 78, 122, 0.38);
  background: rgba(255, 255, 255, 0.28);
  opacity: 0.92;
}

.book-cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}

.book-cover-fallback {
  display: none;
  height: 100%;
  place-items: center;
  padding: 1rem;
  font: 400 1.15rem/1.35 var(--serif);
  text-align: center;
}

.book-cover.is-missing img {
  display: none;
}

.book-cover.is-missing .book-cover-fallback {
  display: grid;
}

.book-title {
  margin: 0.9rem 0 0.25rem;
  font: 500 1.05rem/1.35 var(--serif);
}

.book-date {
  margin: 0;
  color: var(--muted);
  font-size: 0.63rem;
  letter-spacing: 0.09em;
}

.book-detail {
  margin-top: 0.85rem;
  border: 1px solid rgba(39, 37, 34, 0.14);
  padding: 0.95rem 1rem;
  background: var(--panel);
  backdrop-filter: blur(20px) saturate(0.82);
  color: rgba(39, 37, 34, 0.76);
  font: 400 0.78rem/1.75 var(--serif);
}

.book-detail[hidden] {
  display: none;
}

.book-detail p {
  margin: 0;
}

.book-source {
  display: inline-block;
  margin-top: 0.72rem;
  color: rgba(39, 37, 34, 0.58);
  font: 560 0.58rem/1 var(--sans);
  letter-spacing: 0.1em;
  text-decoration: none;
}

.book-source:hover {
  color: var(--ink);
}

@media (max-width: 980px) {
  .books-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .book-header {
    padding: 1.1rem;
  }

  .book-header p {
    display: none;
  }

  .books-page {
    padding-top: 5.4rem;
  }

  .books-hero h1 {
    font-size: clamp(3.2rem, 17vw, 5.6rem);
  }

  .books-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .book-cover {
    height: auto;
  }
}
