.chapter-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: .45rem .45rem .65rem;
  border: 1px solid #c4d0b9;
  border-radius: .7rem;
  background: #f6f6ea;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.chapter-card:hover {
  border-color: #7d987a;
  background: var(--paper);
}

.chapter-card img {
  height: auto;
  aspect-ratio: 3 / 2;
}

.chapter-card small, .chapter-card-title, .chapter-card-action {
  margin-inline: .35rem;
}

.chapter-card-title {
  margin-bottom: .45rem;
  font: 500 1.2rem/1.1 Georgia, serif;
}

.chapter-card-action {
  margin-top: auto;
  color: #315840;
  font-size: .86rem;
  font-weight: 700;
}

.chapter-card-action span {
  margin-right: .25em;
}

.chapter-preview {
  width: min(56rem, calc(100% - 1.25rem));
  max-height: calc(100vh - 1.25rem);
  max-height: calc(100dvh - 1.25rem);
  padding: clamp(.6rem, 2vw, 1.15rem);
  border: 1px solid #d9c38f;
  border-radius: .9rem;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 18px 70px #082a2673;
}

.chapter-preview::backdrop {
  background: #082a26d9;
}

.chapter-preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .7rem;
}

.chapter-preview-heading h2 {
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  letter-spacing: -.025em;
}

.chapter-preview-close {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #e3ebdc;
  color: var(--green);
  font: 25px/1 system-ui, sans-serif;
  cursor: pointer;
}

.chapter-preview-art {
  position: relative;
  container-type: inline-size;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  width: min(100%, 52rem);
  width: min(100%, clamp(13rem, calc(150dvh - 15rem), 52rem));
  aspect-ratio: 3 / 2;
  margin-inline: auto;
  overflow: hidden;
  border-radius: .6rem;
  background: #e2e8db;
}

.chapter-preview-art img {
  grid-area: 1 / 1;
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.chapter-preview-hotspot {
  position: absolute;
  z-index: 1;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 1rem;
  overflow: visible;
  background: transparent;
  transform: translate(-50%, -50%);
  cursor: pointer;
}

.chapter-preview-hotspot[aria-busy='true'] {
  z-index: 2;
  box-shadow: 0 0 .8rem #ffdb77;
}

.chapter-preview-layer,
.chapter-preview-hotspot {
  animation: chapter-bubble-reveal 250ms ease-out both;
}

.chapter-preview-first {
  animation-delay: 500ms;
}

@keyframes chapter-bubble-reveal {
  0% { visibility: hidden; opacity: 0; }
  1% { visibility: visible; opacity: 0; }
  100% { visibility: visible; opacity: 1; }
}

.chapter-preview-arrow {
  position: absolute;
  left: 50%;
  top: 65%;
  width: clamp(32px, 6vw, 60px);
  width: clamp(32px, 6cqw, 60px);
  line-height: 0;
  transform: translate(-75%, -12.5%);
}

.chapter-preview-arrow svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.chapter-preview-arrow path,
.chapter-preview-arrow circle {
  opacity: 0;
  animation: chapter-arrow-flight 2s ease-out 3.5s infinite;
}

.chapter-preview-arrow circle {
  transform-box: fill-box;
  transform-origin: center;
  animation-name: chapter-arrow-tap;
}

@keyframes chapter-arrow-flight {
  0% { opacity: 0; transform: translate(-10px, 24px); }
  12% { opacity: 1; }
  30%, 38% { opacity: 1; transform: translate(0); }
  50%, 100% { opacity: 0; transform: translate(0); }
}

@keyframes chapter-arrow-tap {
  0%, 30% { opacity: 0; transform: scale(.3); }
  34% { opacity: 1; }
  50%, 100% { opacity: 0; transform: scale(1.5); }
}

@media (prefers-reduced-motion: reduce) {
  .chapter-preview-layer,
  .chapter-preview-hotspot,
  .chapter-preview-arrow path,
  .chapter-preview-arrow circle {
    animation: none;
  }

  .chapter-preview-arrow path {
    opacity: 1;
  }
}

.chapter-preview-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .45rem .8rem;
  margin-top: .6rem;
}

.chapter-preview-back {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  min-height: 44px;
  padding: .5rem .9rem;
  border: 0;
  border-radius: 2rem;
  background: #e3ebdc;
  color: var(--green);
  font: inherit;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
}

.chapter-preview-instruction,
#chapter-preview-status {
  font-size: .9rem;
}

#chapter-preview-status {
  margin-top: .6rem;
  text-align: center;
  color: #6b372d;
}
