.page-header {
  background: var(--navy);
  color: var(--ivory);
  padding: var(--page-top-pad) 0 var(--section-pad-mobile);
  text-align: center;
}

.page-header h1 {
  margin: 0 0 1rem;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 5vw, 4rem);
  letter-spacing: -0.03em;
  color: var(--ivory);
}

.page-header p {
  max-width: 60ch;
  margin: 0 auto;
  font-size: 1.1rem;
  color: var(--muted);
}

.spotlight {
  background: var(--navy);
  color: var(--ivory);
  padding: var(--section-pad) 0;
}

.spotlight-inner {
  width: var(--container);
  margin-inline: auto;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: clamp(3rem, 6vw, 6rem);
  align-items: center;
}

.book-visual {
  display: flex;
  justify-content: center;
  align-items: center;
}

.book-cover-img {
  width: 100%;
  max-width: 400px;
  border-radius: 4px;
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  transform: rotateY(-5deg) rotateX(5deg);
  transition: transform 0.4s ease;
}

.book-cover-img:hover {
  transform: rotateY(0deg) rotateX(0deg) scale(1.02);
}

.spotlight-content h2 {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  line-height: 1.1;
  color: var(--ivory);
}

.spotlight-content .subtitle {
  margin: 0 0 1.5rem;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--gold-light);
}

.spotlight-content p {
  max-width: 55ch;
  margin: 0 0 2.5rem;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--muted);
}

.spotlight-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.library {
  background: var(--ivory-soft);
  padding: var(--section-pad) 0;
}

.library-inner {
  width: var(--container);
  margin-inline: auto;
}

.library-header {
  text-align: center;
  margin-bottom: clamp(3rem, 6vw, 5rem);
}

.library-header h2 {
  margin: 0 0 1rem;
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--navy);
}

.library-header p {
  max-width: 60ch;
  margin: 0 auto;
  font-size: 1.1rem;
  color: var(--text-soft);
}

.book-shelf-hint {
  margin: 0 0 1rem;
  color: var(--gold-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.book-shelf-hint.is-visible {
  opacity: 1;
}

.book-shelf-carousel {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) 3rem;
  align-items: center;
  gap: 0.5rem;
}

.book-shelf-button {
  display: inline-flex;
  width: 3rem;
  min-width: 48px;
  height: 3rem;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  color: var(--navy);
  background: transparent;
  border: 0;
  padding: 0;
  font: 500 3rem/1 var(--sans);
  cursor: pointer;
  transition: color 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
}

.book-shelf-button:disabled {
  color: #8a929e;
  opacity: 0.42;
  filter: grayscale(1);
  cursor: default;
}

.book-shelf-button:hover:not(:disabled) {
  color: var(--gold-dark);
}

.book-shelf-button:active:not(:disabled) {
  transform: scale(0.94);
}

.book-shelf-button:focus-visible {
  outline: 2px solid var(--gold-dark);
  outline-offset: 2px;
}

.book-shelf-chevron {
  display: block;
  width: 1.75rem;
  height: 1.75rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  pointer-events: none;
}

.book-grid {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 2rem;
  width: 100%;
  padding: 0.5rem 0.25rem 1.25rem;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 0.25rem;
  scroll-behavior: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.book-grid::-webkit-scrollbar {
  display: none;
}

.book-card {
  flex: 0 0 clamp(280px, 30vw, 360px);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  overflow: hidden;
  transition:
    transform 0.28s ease,
    box-shadow 0.28s ease,
    border-color 0.28s ease;
}

@media (hover: hover) and (pointer: fine) {
  .book-card:hover {
    transform: translateY(-5px);
    border-color: var(--gold);
    box-shadow: 0 18px 36px rgba(6, 21, 43, 0.16);
  }
}

.book-card-image {
  aspect-ratio: 4/5;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 1.5rem;
}

.book-card-image a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  outline-offset: 4px;
}

.book-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4px;
  padding: 0.5rem;
}

.book-card-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  padding: 2rem;
}

.book-card-content h3 {
  margin: 0 0 0.75rem;
  font-family: var(--serif);
  font-size: 1.4rem;
  line-height: 1.2;
  color: var(--navy);
}

.book-title-link {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

.book-title-link:hover,
.book-title-link:focus-visible {
  color: var(--gold-dark);
  text-decoration: underline;
}

.book-card-content .book-subtitle {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-style: italic;
  color: var(--gold-dark);
}

.book-summary-mobile {
  margin: 0 0 1.5rem;
  flex-grow: 1;
}

.book-summary-mobile > summary {
  display: none;
  list-style: none;
}

.book-summary-mobile > p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-soft);
}

.book-card-content > .button {
  align-self: flex-start;
}

.book-card-buy {
  display: none;
}

.book-dialog {
  position: absolute;
  z-index: 30;
  top: 0;
  left: 50%;
  margin: 0;
  transform: translateX(-50%);
  border: none;
  border-radius: 18px;
  padding: 0;
  background: var(--surface);
  width: min(90vw, 1000px);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.42);
}

.book-dialog[open] {
  animation: bookDialogIn 0.28s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.book-dialog[open] + .books-page-wrapper {
  position: fixed;
  z-index: 20;
  top: var(--books-scroll-offset, 0px);
  right: 0;
  bottom: auto;
  left: 0;
}

.book-dialog-inner {
  position: relative;
}

.book-dialog-close {
  position: sticky;
  top: 1rem;
  z-index: 10;
  display: flex;
  margin: 1rem 1rem -36px auto;
  background: rgba(25, 27, 28, 0.08);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--ink);
  transition: background 0.2s ease;
}

.book-dialog-close:hover {
  background: rgba(25, 27, 28, 0.15);
}

.book-dialog-content {
  display: grid;
  grid-template-columns: minmax(230px, 0.75fr) minmax(0, 1.25fr);
  align-items: center;
  gap: clamp(2rem, 4vw, 3.25rem);
  padding: clamp(2.25rem, 4.5vw, 3.5rem);
}

.book-dialog-visual {
  display: grid;
  place-items: center;
  min-height: 25rem;
  padding: 1.5rem;
  border-radius: 12px;
  background: var(--ivory-soft);
}

.book-dialog-visual img {
  display: block;
  width: auto;
  max-width: min(100%, 18rem);
  max-height: 22rem;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.book-dialog-details {
  display: grid;
  gap: 1.1rem;
}

.book-dialog-details h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 3.5vw, 2.5rem);
  line-height: 1.1;
  color: var(--navy);
}

.book-dialog-details .book-subtitle {
  margin: -0.75rem 0 0;
  font-weight: 600;
  font-size: 1.08rem;
  line-height: 1.55;
  color: var(--gold-dark);
  transform: scale(1.12);
}

.book-dialog-details p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-soft);
}

.book-dialog-fit,
.book-dialog-takeaways {
  display: grid;
  gap: 0.55rem;
}

.book-dialog-fit h3,
.book-dialog-takeaways h3 {
  margin: 0;
  color: var(--navy);
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  font-weight: 700;
}

.book-dialog-takeaways ul {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text-soft);
  line-height: 1.65;
}

.book-dialog-actions {
  display: flex;
  margin-top: 0.5rem;
}

.book-dialog-backdrop:not([hidden]) {
  position: fixed;
  z-index: 25;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  background: rgba(6, 21, 43, 0.8);
  backdrop-filter: blur(4px);
  cursor: default;
  animation: fadeIn 0.2s ease both;
}

@keyframes bookDialogIn {
  from {
    opacity: 0;
    transform: translate(-50%, 0) translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) translateY(0) scale(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .page-header h1 {
    font-size: 2.5rem;
  }

  .page-header p {
    font-size: 1rem;
  }

  .spotlight {
    padding: var(--section-pad-mobile) 0;
  }

  .spotlight-inner {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2rem;
  }

  .book-cover-img {
    max-width: 220px;
    transform: none;
    margin-inline: auto;
  }

  .spotlight-content h2 {
    font-size: 2rem;
  }

  .spotlight-content p {
    margin-inline: auto;
  }

  .spotlight-actions {
    flex-direction: column;
  }

  .spotlight-actions .button {
    width: 100%;
  }

  .library {
    padding: var(--section-pad-mobile) 0;
  }

  .book-shelf-hint {
    display: block;
    margin: 0 auto 0.75rem;
    text-align: center;
  }

  .book-shelf-carousel {
    display: block;
  }

  .book-shelf-button {
    display: none;
  }

  .book-grid {
    align-items: flex-start;
    gap: 1rem;
    scroll-padding-inline: 0;
  }

  .book-card {
    flex: 0 0 min(100%, 26rem);
    gap: 0;
    display: grid;
    grid-template-columns: minmax(112px, 0.68fr) minmax(0, 1fr);
    align-self: start;
    border-radius: 8px;
  }

  .book-card-image {
    aspect-ratio: auto;
    min-height: 100%;
    padding: 0.75rem;
  }

  .book-card-image img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    padding: 0;
  }

  .book-card:has(details[open]) {
    grid-template-columns: minmax(0, 1fr);
  }

  .book-card:has(details[open]) .book-card-image {
    height: clamp(9rem, 42vw, 12rem);
    min-height: 0;
  }

  .book-card-content {
    min-width: 0;
    padding: 1rem;
  }

  .book-card-content h3 {
    font-size: 1.15rem;
  }

  .book-card-content .book-subtitle {
    font-size: 0.84rem;
  }

  .book-card-content > .button {
    display: none;
  }

  .book-card-content > .book-card-buy {
    display: inline-flex;
    align-self: stretch;
    width: 100%;
    margin-top: 0.75rem;
  }

  .book-summary-mobile {
    display: block;
    min-width: 0;
    margin-top: auto;
    margin-bottom: 0;
  }

  .book-summary-mobile > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 0.65rem 0.1rem;
    cursor: pointer;
    list-style: none;
    color: var(--gold-dark);
    border-top: 1px solid rgba(6, 21, 43, 0.12);
    font: 700 0.82rem/1.3 var(--sans);
  }

  .book-summary-mobile > summary span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .book-summary-mobile > summary::after {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    content: "+";
    flex: 0 0 1.5rem;
    width: 1.5rem;
    height: 1.5rem;
    border: 1px solid currentColor;
    border-radius: 50%;
    font: 500 1.1rem/1 var(--sans);
  }

  .book-summary-mobile[open] > summary::after {
    content: "\2212";
  }

  .book-summary-mobile > summary::-webkit-details-marker {
    display: none;
  }

  .book-summary-mobile > summary .summary-close {
    display: none;
  }

  .book-summary-mobile[open] > summary .summary-open {
    display: none;
  }

  .book-summary-mobile[open] > summary .summary-close {
    display: inline;
  }

  .book-summary-mobile > p {
    margin: 0 0 0.75rem;
    padding: 0.75rem;
    border-radius: 6px;
    background: rgba(6, 21, 43, 0.04);
    font-size: 0.9rem;
    line-height: 1.6;
  }

  .book-dialog {
    width: min(94vw, 600px);
    border-radius: 14px;
  }

  .book-dialog-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: clamp(1.5rem, 5vw, 2rem);
  }

  .book-dialog-visual {
    min-height: 12rem;
    padding: 1rem;
  }

  .book-dialog-visual img {
    max-height: 11rem;
  }

  .book-dialog-details {
    gap: 1rem;
  }

  .book-dialog-details h2 {
    font-size: clamp(1.8rem, 7vw, 2.4rem);
  }

  .book-dialog-actions {
    padding-top: 0.75rem;
    background: var(--surface);
  }

  .book-dialog-actions .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .book-card,
  .book-shelf-button,
  .book-shelf-hint {
    transition: none;
  }

  .book-dialog[open],
  .book-dialog-backdrop:not([hidden]) {
    animation: none;
  }
}