/* Book showcase — mirrored cinematic composition */
body .books {
  --book-tabs-height:clamp(58px,10svh,78px);
  position: relative;
  isolation: isolate;
  display: block;
  width: 100%;
  height: clamp(620px, 100dvh, 980px);
  min-height: 620px;
  padding: 0;
  overflow: hidden;
  background: #0b1219;
  color: #eee7da;
}

.books-art-stack,
.books-shade,
.books-art {
  position: absolute;
  inset: 0;
}

.books-art-stack { z-index: -3; background: #0b1219; }
.books-art {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  filter: saturate(.9) brightness(.92);
  transform: scale(1.025);
  transition: opacity 700ms cubic-bezier(.16,1,.3,1), transform 1100ms cubic-bezier(.16,1,.3,1);
}
.books-art.is-active { opacity: 1; transform: scale(1); }
.books-shade {
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(4,10,16,.03) 0%, rgba(5,12,20,.08) 27%, rgba(5,12,20,.28) 58%, rgba(5,10,16,.58) 100%),
    linear-gradient(0deg, rgba(4,9,14,.5) 0%, transparent 28%, rgba(4,9,14,.06) 72%, rgba(4,9,14,.18) 100%);
}
.books-shade::after {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 74% 44%, rgba(62,82,101,.13), transparent 38%);
  content: '';
}

.book-showcase {
  position: absolute;
  z-index: 2;
  inset:0 0 var(--book-tabs-height);
  display: flex;
  align-items: center;
  padding: clamp(38px,5vw,76px) 0;
}
.book-showcase-content {
  display: grid;
  grid-template-columns:minmax(320px,520px) max-content;
  width:min(1400px,80vw);
  min-height:80%;
  align-items:center;
  justify-content:end;
  gap:clamp(28px,3vw,52px);
  margin-left:auto;
  margin-right:clamp(70px,6vw,104px);
  transition:opacity 180ms ease-out;
}
.book-showcase-content.is-leaving {
  opacity:0;
}
.book-showcase-content.is-entering {
  opacity:0;
}

.book-copy { min-width: 0; text-align: left; }
.book-copy time {
  display: block;
  margin-bottom: 12px;
  color: #b0aa9f;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.book-copy h2 {
  max-width: 11ch;
  margin: 0;
  color: #f0eadf;
  font: 500 clamp(42px, 4.8vw, 72px)/.98 var(--display, Georgia, serif);
  letter-spacing: -.025em;
  text-wrap: balance;
  text-shadow: 0 3px 24px rgba(0,0,0,.56);
}
.book-copy-divider {
  width: min(290px, 100%);
  height: 1px;
  margin: 20px 0 18px;
  background: linear-gradient(90deg, rgba(208,167,103,.82), rgba(208,167,103,.06));
}
.book-copy p {
  max-width: 45ch;
  margin: 0;
  color: #d0cbc2;
  font-size: clamp(14px, 1.15vw, 17px);
  line-height: 1.68;
  text-wrap: pretty;
  text-shadow: 0 2px 14px rgba(0,0,0,.72);
}
.book-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.book-actions button {
  position: relative;
  min-width: 142px;
  padding: 12px 20px;
  background: rgba(17,25,32,.72);
  color: #e8ded0;
  border: 1px solid rgba(201,158,97,.62);
  border-radius: 0;
  font: 500 13px/1.2 Arial,sans-serif;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.025), 0 10px 28px rgba(0,0,0,.17);
  backdrop-filter: blur(4px);
  transition: color 180ms ease-out, background 180ms ease-out, border-color 180ms ease-out, transform 180ms ease-out;
}
.book-actions button:first-child { background: #714226; border-color: #c5965c; color: #fff5e7; }
.book-actions button:hover { background: #855332; color: #fff8ee; border-color: #e0b474; transform: translateY(-2px); }
.book-actions button:active { transform: translateY(0); }
.book-actions button:focus-visible { outline: 2px solid #e2b574; outline-offset: 3px; }

.book-object-frame {
  display: grid;
  width: 100%;
  max-height: min(80dvh, 680px);
  place-items:center end;
  perspective:none;
}
.book-object {
  display: grid;
  width:min(100%,620px);
  grid-template-columns:minmax(0,1fr) max-content;
  align-items: stretch;
  transform:none;
  transform-origin:60% 55%;
  transition: transform 500ms cubic-bezier(.16,1,.3,1), filter 500ms ease-out;
}
.book-object-frame:hover .book-object { transform:translateY(-7px); }
.book-front { position:relative;z-index:2;box-shadow:0 35px 42px rgba(0,0,0,.46); }
.book-front img { display: block; width: 100%; height: auto; max-height: min(78dvh,680px); object-fit: contain; }
.book-edge {
  position: relative;
  z-index: 1;
  width:clamp(16px,2.2vw,29px);
  margin:0 0 0 -1px;
  background-color:#c5bda9;
  background-image:repeating-linear-gradient(90deg,rgba(71,57,42,.22) 0 1px,rgba(237,226,202,.18) 1px 3px);
  background-position:center;
  background-size:cover;
  border:0;
  transform:none;
  transform-origin:left center;
  box-shadow:none;
}
.book-edge::after {
  position:absolute;
  inset:0;
  background:repeating-linear-gradient(90deg,transparent 0 4px,rgba(55,44,32,.12) 4px 5px);
  content:'';
}
.book-edge.has-image { width:auto;background:none; }
.book-edge.has-image::after { display:none; }
.book-edge img { display:block;width:auto;height:100%;max-width:clamp(32px,6vw,96px);object-fit:fill; }

.book-edge-nav {
  position: absolute;
  z-index: 4;
  top: 0;
  bottom:var(--book-tabs-height);
  width: clamp(48px,6vw,88px);
  padding: 0;
  background: transparent;
  border: 0;
  color: #dbb77d;
  cursor: pointer;
}
.book-edge-nav:hover { background: linear-gradient(90deg, rgba(205,159,94,.06), transparent); }
.book-edge-next { right: 0; }
.book-edge-previous { left: 0; }
.book-edge-next:hover { background: linear-gradient(-90deg, rgba(205,159,94,.06), transparent); }
.book-edge-nav span {
  position: absolute;
  top: 50%;
  width: 19px;
  height: 19px;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  opacity: .78;
  filter: drop-shadow(0 0 7px rgba(218,174,105,.45));
  animation: bookArrowNudge 1.8s ease-in-out infinite;
}
.book-edge-next span { right: clamp(15px,2.2vw,32px); transform: translateY(-50%) rotate(45deg); }
.book-edge-previous span { left: clamp(15px,2.2vw,32px); transform: translateY(-50%) rotate(-135deg); animation-direction: reverse; }
.book-edge-nav:focus-visible { outline: 1px solid rgba(226,181,116,.7); outline-offset: -5px; }
@keyframes bookArrowNudge { 50% { margin-inline: 4px -4px; opacity: 1; } }

.book-tabs-shell {
  position: absolute;
  z-index: 5;
  right: 0;
  bottom: 0;
  left: 0;
  height:var(--book-tabs-height);
  display: flex;
  align-items: center;
  padding: 0 clamp(52px, 7vw, 120px);
  background: rgba(5,10,15,.68);
  border-top: 1px solid rgba(188,151,98,.32);
  backdrop-filter: blur(7px);
}
.book-tabs {
  display: flex;
  width: 100%;
  min-width: 0;
  justify-content: center;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.book-tabs::-webkit-scrollbar { display: none; }
.book-tabs button {
  position: relative;
  flex: 0 0 auto;
  min-height: 48px;
  padding: 0 clamp(20px,2.4vw,38px);
  background: transparent;
  color: #9d988f;
  border: 0;
  border-left: 1px solid rgba(190,151,96,.18);
  border-radius: 0;
  font: 400 13px/1.2 Arial,sans-serif;
  white-space: nowrap;
  scroll-snap-align: center;
  transition: color 220ms ease-out, background 220ms ease-out;
}
.book-tabs button:last-child { border-right: 1px solid rgba(190,151,96,.18); }
.book-tabs button span { margin-right: 10px; color: #716e68; font-variant-numeric: tabular-nums; }
.book-tabs button::after {
  position: absolute;
  right:8px;
  bottom:0;
  left:8px;
  height:9px;
  background:url('/assets/ui/header-nav-chevron.svg') center / 100% 100% no-repeat;
  filter:drop-shadow(0 0 3px rgba(215,169,95,.34));
  content: '';
  opacity: 0;
  transform: scaleX(.35);
  transition: opacity 220ms ease-out, transform 320ms cubic-bezier(.16,1,.3,1);
}
.book-tabs button:hover { color: #e3d9cb; background: rgba(255,255,255,.025); }
.book-tabs button.is-active { color: #f0d9b4; }
.book-tabs button.is-active span { color: #d9aa63; }
.book-tabs button.is-active::after { opacity: 1; transform: scaleX(1); }
.book-tabs button:focus-visible { outline: 1px solid #d8aa65; outline-offset: -3px; }

/* Details and the final fragment page share one composition. */
.book-dialog,
.book-reader-dialog.is-offer {
  width: min(1080px, calc(100vw - 32px));
  max-height: min(820px, calc(100dvh - 32px));
  padding: 0;
  overflow: auto;
  background: #171b1d;
  color: #eee7dc;
  border: 1px solid #65503b;
}
.book-dialog[open],
.book-reader-dialog.is-offer[open] { display: grid; grid-template-columns: minmax(270px,390px) minmax(0,1fr); align-items: center; }
.book-dialog .dialog-cover,
.book-reader-dialog.is-offer .dialog-cover { display: block; width: 100%; height: 100%; max-height: min(818px,calc(100dvh - 34px)); object-fit: cover; background: #0d1112; }
.book-dialog .dialog-book-copy,
.book-reader-dialog.is-offer .dialog-book-copy { align-self: center; padding: clamp(34px,5vw,66px); }
.book-dialog .dialog-book-copy h2,
.book-reader-dialog.is-offer .dialog-book-copy h2 { margin: 10px 0 22px; color: #f0e8dc; font: 500 clamp(38px,5vw,68px)/1 var(--display,Georgia,serif); text-wrap: balance; }
.book-dialog .dialog-book-copy p,
.book-reader-dialog.is-offer .dialog-book-copy p { max-width: 56ch; margin: 0; color: #c1bbb1; font-size: 16px; line-height: 1.65; }
.book-dialog .dialog-book-copy h3,
.book-reader-dialog.is-offer .dialog-book-copy h3 { margin: 30px 0 11px; color: #d7b28f; font-size: 12px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; }
.book-dialog .dialog-close,
.book-reader-dialog .dialog-close { z-index: 4; width: 42px; height: 42px; color: #eee7dc; background: rgba(12,16,17,.82); line-height: 1; }
.book-description p + p { margin-top: 12px; }
.reader-return { margin-top: 26px; background: transparent; color: #d9b37c; border-color: #765b42; }

.book-reader-dialog:not(.is-offer) {
  width: min(860px,calc(100vw - 28px));
  height: min(720px,calc(100dvh - 28px));
  max-height: 900px;
  padding: 0;
  overflow: hidden;
  background: #171a19;
  color: #e8e1d5;
  border: 1px solid #62503d;
}
.book-reader-dialog:not(.is-offer)[open] { display: grid; grid-template-rows: auto minmax(0,1fr) auto; }
.reader-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; padding: 26px 34px 18px; border-bottom: 1px solid rgba(187,148,92,.3); }
.reader-heading span { color: #d7b985; font: 24px/1.1 var(--display,Georgia,serif); }
.reader-heading strong { color: #918a80; font-size: 10px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; }
.reader-page {
  min-height: 0;
  padding: clamp(32px,5vw,58px) clamp(30px,8vw,84px);
  overflow-y: auto;
  background: radial-gradient(circle at 50% 25%,rgba(65,61,50,.28),transparent 50%);
  color: #ddd6ca;
  font: clamp(17px,1.5vw,20px)/1.8 Georgia,serif;
  scrollbar-color: #735b40 transparent;
}
.reader-page p { max-width: 64ch; margin: 0 auto 1em; text-wrap: pretty; }
.reader-page h3 { max-width: 64ch; margin: 0 auto 1em; color: #eadfcf; font-size: 1.3em; }
.reader-controls { display: grid; grid-template-columns: 150px 1fr 190px; align-items: center; gap: 12px; min-height: 72px; padding: 12px 22px; background: #111514; border-top: 1px solid rgba(187,148,92,.3); }
.reader-controls span { color: #827b72; font-size: 11px; text-align: center; }
.reader-controls button { min-height: 42px; background: transparent; color: #dfd3c2; border-color: #65503b; }
.reader-controls .reader-next { background: #684128; border-color: #a5784c; }
.reader-controls button:disabled { visibility: hidden; }

@media (min-width:768px) {
  body .books {
    height:calc(100svh - 72px);
    min-height:0;
    max-height:calc(100svh - 72px);
  }
  .book-showcase { padding-block:clamp(14px,4.5svh,76px); }
  .book-copy time { margin-bottom:clamp(6px,1.6svh,12px); }
  .book-copy h2 { font-size:clamp(34px,min(4.8vw,9svh),72px); }
  .book-copy-divider { margin-block:clamp(10px,2.6svh,20px) clamp(9px,2.3svh,18px); }
  .book-copy p { font-size:clamp(12px,min(1.15vw,2.2svh),17px);line-height:1.6; }
  .book-actions { margin-top:clamp(12px,3.2svh,26px); }
  .book-actions button { padding-block:clamp(9px,1.6svh,12px); }
  .book-object {
    display:flex;
    width:auto;
    max-width:100%;
    height:min(760px,calc((100svh - 72px) * .73));
    align-items:stretch;
  }
  .book-front { min-width:0;height:100%; }
  .book-front img { width:auto;height:100%;max-width:100%;max-height:none;object-fit:contain; }
  .book-edge { flex:0 0 clamp(16px,2.2vw,29px);height:100%; }
  .book-edge.has-image { flex:0 0 auto;width:auto; }
}

@media (max-width: 900px) {
  body .books { --book-tabs-height:66px; }
  .book-showcase { bottom:var(--book-tabs-height);padding:42px 0 28px; }
  .book-showcase-content { grid-template-columns:minmax(0,1fr) minmax(170px,39vw);width:calc(100% - 108px);min-height:76%;justify-content:stretch;gap:18px;margin-right:54px; }
  .book-object-frame { width:100%;place-items:center end; }
  .book-copy h2 { font-size: clamp(34px,6.4vw,52px); }
  .book-copy p { display: -webkit-box; overflow: hidden; font-size: 14px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 7; }
  .book-actions { margin-top: 20px; }
  .book-actions button { min-width: 0; }
  .book-tabs-shell { height:var(--book-tabs-height);padding:0 42px; }
  .book-tabs { justify-content: flex-start; }
  .book-tabs button { min-height: 42px; padding-inline: 22px; font-size: 12px; }
  .book-tabs button::after { bottom:0; }
  .book-edge-nav { bottom:var(--book-tabs-height);width:44px; }
  .book-edge-next span { right: 14px; }
  .book-edge-previous span { left: 14px; }
}

@media (max-width:767px) {
  body .books { height:100dvh;min-height:0;max-height:100dvh; }
}

@media (max-width: 600px) {
  body .books { --book-tabs-height:60px; }
  .books-shade { background:linear-gradient(90deg,rgba(4,10,16,.07),rgba(5,11,18,.34) 48%,rgba(4,9,15,.68)),linear-gradient(0deg,rgba(4,9,14,.52),transparent 42%,rgba(4,9,14,.14)); }
  .book-showcase { bottom:var(--book-tabs-height);padding:28px 0 20px; }
  .book-showcase-content { grid-template-columns:minmax(0,1fr) minmax(126px,42vw);width:calc(100% - 84px);min-height:72%;gap:10px;margin-right:42px; }
  .book-copy time { margin-bottom: 7px; font-size: 8px; }
  .book-copy h2 { max-width:100%;font-size:clamp(21px,6.2vw,28px);line-height:1.02;overflow-wrap:normal;word-break:normal; }
  .book-copy-divider { margin: 12px 0; }
  .book-copy p { font-size: clamp(11px,3.2vw,13px); line-height: 1.45; -webkit-line-clamp: 6; }
  .book-actions { display: grid; gap: 7px; margin-top: 15px; }
  .book-actions button { width: 100%; padding: 9px 8px; font-size: 10px; backdrop-filter: none; }
  .book-object { grid-template-columns:minmax(0,1fr) max-content;transform:none; }
  .book-edge { width:12px; }
  .book-edge.has-image { width:auto; }
  .book-edge img { max-width:40px; }
  .book-object-frame:hover .book-object { transform:none; }
  .book-front img { max-height: 48dvh; }
  .book-tabs-shell { height:var(--book-tabs-height);padding:0 34px;backdrop-filter:none; }
  .book-tabs button { min-height: 38px; padding-inline: 17px; font-size: 10px; }
  .book-tabs button span { margin-right: 7px; }
  .book-tabs button::after { right:8px;bottom:0;left:8px; }
  .book-edge-nav { bottom:var(--book-tabs-height);width:34px; }
  .book-edge-nav span { width: 14px; height: 14px; }
  .book-edge-next span { right: 10px; }
  .book-edge-previous span { left: 10px; }
  .book-dialog,
  .book-reader-dialog.is-offer { width: calc(100vw - 12px); max-height: calc(100dvh - 12px); }
  .book-dialog[open],
  .book-reader-dialog.is-offer[open] { grid-template-columns: 110px minmax(0,1fr); align-items: start; padding: 52px 14px 18px; gap: 14px; }
  .book-dialog .dialog-cover,
  .book-reader-dialog.is-offer .dialog-cover { height: auto; max-height: 42dvh; object-fit: contain; }
  .book-dialog .dialog-book-copy,
  .book-reader-dialog.is-offer .dialog-book-copy { min-width: 0; padding: 0; }
  .book-dialog .dialog-book-copy h2,
  .book-reader-dialog.is-offer .dialog-book-copy h2 { margin: 6px 0 10px; font-size: clamp(24px,7.5vw,34px); overflow-wrap: anywhere; }
  .book-dialog .dialog-book-copy p,
  .book-reader-dialog.is-offer .dialog-book-copy p { display: -webkit-box; overflow: hidden; font-size: 12px; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 8; }
  .book-dialog .dialog-book-copy h3,
  .book-reader-dialog.is-offer .dialog-book-copy h3 { margin: 14px 0 7px; font-size: 9px; }
  .book-reader-dialog:not(.is-offer) { width: calc(100vw - 10px); height: calc(100dvh - 10px); }
  .reader-heading { align-items: start; flex-direction: column; gap: 5px; padding: 20px 46px 14px 18px; }
  .reader-heading span { font-size: 20px; }
  .reader-page { padding: 26px 21px; font-size: 16px; line-height: 1.7; }
  .reader-controls { grid-template-columns: 74px 1fr 112px; gap: 6px; min-height: 64px; padding: 9px; }
  .reader-controls button { min-width: 0; padding: 8px 5px; font-size: 10px; }
  .reader-controls span { font-size: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .books-art,
  .book-showcase-content,
  .book-object,
  .book-actions button,
  .book-tabs button,
  .book-tabs button::after { transition: none; }
  .book-edge-nav span { animation: none; }
  .book-showcase-content.is-leaving,
  .book-showcase-content.is-entering { filter: none; transform: none; }
  .book-object-frame:hover .book-object { transform:none; }
}
