/* The archive and the book routes use the same paper covers and navigation controls. */
.archive {
  --cover-size: clamp(145px, 45vw, 255px);
  padding: var(--section-space) var(--page-gutter);
  color: white;
  background: var(--neo-night);
  text-align: center;
  overflow: clip;
}

.archive .shelf {
  width: min(100%, 810px);
  padding-block: .875rem 1.5rem;
}

/* The coverflow wrapper sits in front of receding covers in 3D hit testing. */
.shelf .swiper-wrapper { pointer-events: none; }
.shelf .swiper-slide {
  pointer-events: auto;
  width: var(--cover-size);
  aspect-ratio: 1;
  background: white;
  opacity: .45;
  transition: opacity .3s;
  box-shadow: 0 10px 20px #0b0d263d;
}

.shelf .swiper-slide-active { opacity: 1; }
.shelf .swiper-slide > a, .shelf picture, .shelf img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.shelf a:focus-visible { outline-offset: -4px; }
.archive[data-effect="cards"] .shelf { max-width: var(--cover-size); overflow: visible; }

.chooser, .flip-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(.4rem, 2vw, 1.5rem);
}

.chooser { margin: .75rem auto; }
.chooser > button, .flip-controls button {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-width: var(--control-size, 44px);
  min-height: var(--control-size, 44px);
  padding: .25rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: inherit;
  background: transparent;
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
}

.chooser > button:hover, .flip-controls button:enabled:hover {
  background: white;
  color: var(--neo-night);
}

.archive .thumbs { margin: 0; width: min(68vw, 310px); }
.thumbs button {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: .38rem;
  padding: .4rem 0;
  border: 0;
  color: white;
  background: transparent;
  font-size: .9rem;
}
.thumbs button:focus-visible { outline-offset: -3px; }
.thumbs img {
  width: clamp(40px, 12vw, 60px);
  height: clamp(40px, 12vw, 60px);
  object-fit: contain;
  background: white;
  opacity: .7;
}
.thumbs [aria-pressed="true"] { color: var(--neo-amber); }
.thumbs [aria-pressed="true"] img {
  opacity: 1;
  outline: 2px solid var(--neo-amber);
  outline-offset: 2px;
}

.open-book { margin-top: .45rem; }
.archive-fallback { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }
.archive-fallback a { display: inline-flex; align-items: center; min-height: 44px; }

@keyframes book-nudge { 50% { transform: translateX(-10px); } }
@media (prefers-reduced-motion: no-preference) {
  .hint .swiper-slide-active picture { animation: book-nudge .62s ease-in-out; }
}
@media (prefers-reduced-motion: reduce) {
  .shelf .swiper-slide { transition: none; }
}
@media (min-width: 900px) {
  .archive { --cover-size: clamp(300px, 30vw, 430px); }
  .archive .shelf { width: min(100%, 1240px); }
}
@media (min-width: 900px) and (max-height: 740px) {
  .archive { --cover-size: min(36vw, 54svh); padding-block: 2svh; }
}
@media (orientation: landscape) and (max-height: 540px) {
  .archive {
    --cover-size: min(30vw, 68svh);
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) var(--control-size) minmax(6.2rem, 1fr) var(--control-size);
    align-content: center;
    align-items: center;
    gap: .3rem .25rem;
    min-height: 80svh;
    padding-block: .6rem;
  }
  .archive .shelf { grid-row: span 2; width: 100%; padding-block: .5rem; }
  .archive .chooser { display: contents; }
  .archive .thumbs { grid-column: 2 / 5; grid-row: 1; width: 100%; align-self: end; }
  .chooser .prev { grid-column: 2; grid-row: 2; align-self: start; }
  .chooser .next { grid-column: 4; grid-row: 2; align-self: start; }
  .thumbs img { width: min(6vw, 45px); height: min(6vw, 45px); }
  .thumbs button { font-size: .8rem; overflow-wrap: anywhere; }
  .open-book { grid-column: 3; grid-row: 2; margin: 0; padding-inline: .8rem; align-self: start; justify-self: center; }
}

/* Book routes */
.volume {
  --paper: #f6f5fa;
  --soft-rule: var(--neo-line);
  color: var(--neo-night);
  background: white;
}
.volume [hidden] { display: none; }
.volume section {
  padding: var(--section-space) var(--page-gutter);
}
.volume h1, .volume h2, .volume h3 { overflow-wrap: break-word; }
.volume h2 {
  margin: 0;
  font-size: var(--heading-size);
  line-height: 1.05;
  letter-spacing: -.035em;
}
.volume h3 { margin: 0; font-size: var(--subheading-size); }
.volume a:hover { text-decoration-color: currentColor; }
.volume-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: center;
  grid-template-rows: auto 1fr;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "nav nav" "caption art";
  gap: clamp(1.5rem, 5vh, 4rem) clamp(1rem, 4vw, 4rem);
  min-height: min(100svh, 53rem);
  padding: clamp(.85rem, 3.5vh, 2rem) var(--page-gutter) clamp(1.5rem, 5vh, 4rem);
  color: var(--neo-night);
  background: var(--paper);
}
.volume-nav {
  grid-area: nav;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem 1rem;
  flex-wrap: wrap;
  padding-bottom: .65rem;
  border-bottom: 1px solid var(--soft-rule);
}
.volume-nav a, .review-external {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.volume-brand {
  color: inherit;
  font: 900 1rem / 1 var(--neo-display);
  text-decoration: none;
}
.volume-nav .return { margin-left: auto; font-size: .95rem; }
.volume-caption { grid-area: caption; min-width: 0; }
.sold {
  display: inline-block;
  border: 1px solid currentColor;
  border-radius: var(--radius-pill, 3rem);
  padding: .24rem .7rem;
  color: var(--neo-blue);
  font-size: .875rem;
  line-height: 1.35;
}
.volume h1 {
  margin: .22em 0 .18em;
  font-size: clamp(2.7rem, 6.6vw, 6rem);
  line-height: .99;
  letter-spacing: -.04em;
}
.volume .volume-caption h2 { margin: 1.1em 0 .6em; font-size: var(--subheading-size); }
.volume .volume-caption dl { grid-template-columns: max-content minmax(0, 1fr); }
.volume-art {
  grid-area: art;
  width: min(100%, 69svh, 35rem);
  justify-self: center;
  mix-blend-mode: multiply;
}
.volume-art picture, .volume-art img { display: block; width: 100%; height: auto; }
.spin-trigger {
  display: block;
  margin: .45rem auto 0;
  padding: .5rem 1.25rem;
  min-height: 44px;
  border: 1px solid var(--neo-blue);
  border-radius: 3rem;
  background: transparent;
  color: var(--neo-blue);
  font: inherit;
  cursor: pointer;
}
.spin-trigger:hover, .spin-dialog button:hover { background: var(--neo-blue); color: white; }
html:has(.spin-dialog[open]) { overflow: hidden; }
.spin-dialog {
  width: min(94vw, 42rem);
  height: min(94svh, 49rem);
  box-sizing: border-box;
  margin: auto;
  padding: clamp(.75rem, 2vw, 1.4rem);
  border: 0;
  border-radius: 1rem;
  background: white;
  color: var(--neo-blue);
}
.spin-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; gap: .4rem; }
.spin-dialog::backdrop { background: rgb(19 23 55 / 76%); }
.spin-dialog header, .spin-controls { display: flex; align-items: center; gap: .75rem; }
.spin-dialog header { justify-content: space-between; }
.spin-dialog #spin-title { margin: 0; font-size: clamp(1.2rem, 3vw, 2rem); }
.spin-dialog button {
  width: 44px; height: 44px; flex: none;
  border: 1px solid currentColor; border-radius: 50%;
  background: white; color: inherit; font: inherit; font-size: 1.35rem; cursor: pointer;
}
.spin-stage { min-height: 0; touch-action: none; user-select: none; cursor: grab; }
.spin-stage:active { cursor: grabbing; }
.spin-stage img { width: 100%; height: 100%; display: block; object-fit: contain; }
.spin-dialog p { text-align: center; font-size: .95rem; margin: 0; }
.spin-controls { justify-content: center; }
.spin-controls output { min-width: 5em; text-align: center; font-variant-numeric: tabular-nums; }
.spin-trigger:focus-visible, .spin-dialog :focus-visible { outline: 2px solid var(--neo-blue); outline-offset: 2px; }

.colophon {
  display: grid;
  align-items: start;
  grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr);
  gap: clamp(1.1rem, 3vw, 3rem) clamp(1.5rem, 6vw, 6rem);
}
.reading h2, .colophon h2, .preface h3 { color: var(--neo-blue); }
.reading p { margin: 0 0 .8em; }
.description h3 { margin-bottom: .8em; }
.reading p:last-child { margin-bottom: 0; }
.volume dl {
  display: grid;
  grid-template-columns: minmax(6rem, .56fr) minmax(0, 1fr);
  gap: .5rem 1rem;
  margin: 0;
}
.volume dt { color: var(--neo-blue); }
.volume dd { margin: 0; overflow-wrap: anywhere; }
.reading {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: clamp(1rem, 2.5vw, 2rem);
}
.reading dl, .preface {
  border-top: 1px solid var(--soft-rule);
  padding-top: clamp(1rem, 2vw, 1.6rem);
}
.reading dl { grid-template-columns: fit-content(40%) minmax(0, 1fr); }
.preface-text { text-align: justify; hyphens: auto; }
@media (min-width: 721px) {
  .reading {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    column-gap: clamp(1.5rem, 5vw, 5rem);
    align-items: start;
  }
  .reading h2, .preface { grid-column: 1 / -1; }
  .reading dl { border: 0; padding-top: 0; }
}
.preface h3 { margin-block: 0 .8rem; }

.viewer {
  display: grid;
  grid-template-columns: minmax(0, .73fr) minmax(0, 1.27fr);
  grid-template-areas: "title photo" "info photo";
  align-content: center;
  align-items: center;
  gap: 1rem clamp(1.5rem, 5vw, 5rem);
  color: white;
  background: var(--neo-blue);
}
.viewer h2 { grid-area: title; align-self: end; color: inherit; }
@media (min-width: 721px), (orientation: landscape) and (max-height: 540px) {
  .viewer { container-type: inline-size; }
  .viewer h2 { font-size: clamp(1.5rem, 4.1cqi, 3.35rem); }
}
.photo-info { grid-area: info; align-self: start; }
.flip-host {
  grid-area: photo;
  justify-self: center;
  width: min(100%, 70svh, 740px);
  aspect-ratio: 1;
  min-width: 0;
  background: white;
}
.flip, .flip > picture, .flip > picture img, .leaf picture, .leaf img { display: block; width: 100%; height: 100%; }
.flip { position: relative; touch-action: pan-y; }
.flip > .photo-loading { position: absolute; inset: 0; opacity: 0; }
.flip img { object-fit: contain; }
.leaf { background: white; }
.flip-controls { justify-content: flex-start; gap: .75rem; }
.flip-controls output { min-width: 3.6rem; text-align: center; font-variant-numeric: tabular-nums; }
.flip-controls button:disabled { opacity: .42; cursor: default; }

.book-reviews { background: var(--paper); }
.book-reviews h2 { color: var(--neo-blue); margin-bottom: clamp(1.3rem, 3vw, 2.6rem); }
.review-layout {
  display: grid;
  align-items: start;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 3rem);
}
.review-player { position: relative; aspect-ratio: 16 / 9; color: white; background: var(--neo-night); }
.review-player > video, .review-player > iframe, .review-player > .review-play { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.review-play {
  display: grid;
  place-items: center;
  padding: 0;
  background: white;
  overflow: hidden;
}
.review-play picture, .review-play img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.review-play span {
  position: absolute;
  display: grid;
  place-items: center;
  width: clamp(48px, 10vw, 72px);
  aspect-ratio: 1;
  padding-left: .12em;
  border-radius: 50%;
  color: var(--neo-night);
  background: var(--neo-amber);
  font-size: 1.6rem;
}
.review-external { color: var(--neo-blue); }
.review-list { border-top: 1px solid var(--soft-rule); }
.review-list h3 { font: inherit; }
.review-list button {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: .8rem .7rem;
  border: 0;
  border-bottom: 1px solid var(--soft-rule);
  text-align: left;
  font: inherit;
  line-height: 1.35;
  background: transparent;
  color: var(--neo-night);
}
.review-list button:hover { color: var(--neo-blue); text-decoration: underline; }
.review-list button[aria-pressed="true"] { background: var(--neo-blue); color: white; }
.colophon { background: var(--neo-night); color: white; }
.other-books {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(.35rem, 2vw, 1rem);
  padding-top: 1rem;
  border-top: 1px solid #ffffff55;
}
.other-books a { justify-self: start; text-decoration: none; }
.other-books a:last-child { justify-self: end; text-align: right; }
.other-books span { display: block; font-size: .9rem; }
.other-books strong { display: block; color: var(--neo-amber); font: 900 clamp(1.2rem, 3vw, 2.35rem)/1.2 var(--neo-display); }
.other-books a:hover strong { text-decoration: underline; }
.other-books .books-home { justify-self: center; padding-block: .75rem; text-decoration: underline; }
@media (max-width: 380px) {
  .other-books strong { font-size: 1rem; }
  .other-books .books-home { font-size: .875rem; }
}
.book-message { margin: 0; padding: 1rem var(--page-gutter); color: var(--neo-night); background: var(--paper); }
@media (prefers-reduced-motion: reduce) {
  .flip .stf__block { pointer-events: none; }
}
@media (max-width: 720px) {
  .volume-hero {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "nav" "art" "caption";
    grid-template-rows: auto auto auto;
    align-content: start;
    min-height: auto;
    gap: clamp(.65rem, 2.5svh, 1.75rem);
  }
  .volume-art { width: min(95%, 52svh, 25rem); margin-block: clamp(.75rem, 3svh, 2rem); }
  .volume h1 { font-size: clamp(2.6rem, 10vw, 4.4rem); }
  .volume-nav { column-gap: .65rem; }
  .volume-nav .return { font-size: .875rem; }
  .colophon, .review-layout { grid-template-columns: minmax(0, 1fr); }
  .viewer { grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "photo" "info"; }
  .photo-info { display: grid; gap: .5rem; }
  .flip-controls { justify-content: center; }
  .review-layout { gap: .65rem; }
}
@media (min-width: 721px) and (max-width: 900px) and (orientation: portrait) {
  .volume-hero {
    min-height: 100svh;
    grid-template-areas: "nav" "art" "caption";
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr auto;
    gap: 1.2rem;
  }
  .volume-art { width: min(85%, 55svh); }
}
@media (orientation: landscape) and (max-height: 540px) {
  .volume-hero {
    min-height: 100svh;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "nav nav" "caption art";
    grid-template-rows: auto 1fr;
    gap: .4rem 1rem;
    padding-block: .4rem;
  }
  .volume-nav { padding-bottom: 0; }
  .volume-art { width: min(100%, 68svh); }
  .volume h1 { font-size: clamp(2.35rem, 6vw, 3.8rem); }
  .viewer { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); grid-template-areas: "title photo" "info photo"; }
  .volume .viewer { padding-block: .75rem; }
  .flip-host { width: min(100%, 88svh); }
  .flip-controls { justify-content: flex-start; }
}
