/* Buy: the book as an object. A CSS 3D paperback (front, back, navy spine, ivory page edges) in true
   proportion (15.24 x 1.98 x 22.86 cm) turns from front to back as you scroll, inside a sticky stage. */
.buy { padding: 0; isolation: isolate; }
.buy__track { position: relative; }
.buy__stage {
  position: relative; display: flex; align-items: center;
  min-height: calc(100vh - 76px); min-height: calc(100svh - 76px);
  padding: clamp(56px, 6vw, 96px) 0;
}
/* the turn only gets its scroll length when it can play */
@media (min-width: 900px) and (prefers-reduced-motion: no-preference) {
  .js .buy__track { height: 250vh; }
  .js .buy__stage { position: sticky; top: 76px; height: calc(100vh - 76px); height: calc(100svh - 76px); padding: 0; }
}

/* night backdrop: the cover's blue halo, a gold baton arc, faint stars */
.buy__bg { position: absolute; inset: 0; z-index: -1; overflow: clip; pointer-events: none; }
.buy__glow { position: absolute; left: 50%; top: calc(var(--bh) / 2); width: 0; height: 0; z-index: -1; pointer-events: none; }
.buy__halo {
  position: absolute; left: 0; top: 0; width: calc(var(--bh) * 1.7); aspect-ratio: 1; translate: -50% -50%;
  background: radial-gradient(closest-side, rgba(59, 127, 224, .36), rgba(59, 127, 224, .12) 48%, transparent 74%);
  filter: blur(8px);
}
.buy__arc { position: absolute; left: 0; top: 0; width: min(calc(var(--bh) * 1.22), 80vh); max-width: none; height: auto; translate: -50% -50%; overflow: visible; }
.buy__arc circle { fill: none; stroke: rgba(226, 176, 98, .14); stroke-width: 1; }
.buy__arc path { fill: none; stroke: var(--gold); stroke-width: 1.6; stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(226, 176, 98, .8)); }
.buy__stars {
  position: absolute; inset: 0; opacity: .55;
  background-image:
    radial-gradient(1.2px 1.2px at 12% 18%, #cfe0ff, transparent 60%),
    radial-gradient(1px 1px at 28% 72%, #cfe0ff, transparent 60%),
    radial-gradient(1.4px 1.4px at 46% 12%, #fff3d6, transparent 60%),
    radial-gradient(1px 1px at 63% 84%, #cfe0ff, transparent 60%),
    radial-gradient(1.2px 1.2px at 78% 26%, #cfe0ff, transparent 60%),
    radial-gradient(1px 1px at 88% 64%, #fff3d6, transparent 60%),
    radial-gradient(1px 1px at 36% 40%, #cfe0ff, transparent 60%),
    radial-gradient(1.3px 1.3px at 6% 88%, #cfe0ff, transparent 60%);
  background-size: 420px 380px;
}

.buy__grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(40px, 5vw, 96px); align-items: center; width: 100%;
}

/* the book: height from the viewport (media cap), width from the real trim size, spine from the real thickness */
.buy__visual { --bh: min(76vh, 760px, calc(100vh - 250px)); position: relative; display: flex; flex-direction: column; align-items: center; gap: 26px; }
@supports (height: 100svh) { .buy__visual { --bh: min(76svh, 760px, calc(100svh - 250px)); } }
.buy__scene {
  --bw: calc(var(--bh) * 800 / 1199);
  --bd: calc(var(--bw) * 1.98 / 15.24);
  position: relative; width: var(--bw); height: var(--bh); perspective: 1800px;
}
.buy__tilt, .buy__book { position: absolute; inset: 0; transform-style: preserve-3d; }
.buy__face { position: absolute; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: clip; }
.buy__face--front, .buy__face--back { inset: 0; background: var(--night); }
.buy__face--front { transform: translateZ(calc(var(--bd) / 2)); box-shadow: inset 3px 0 6px rgba(0, 0, 0, .45); }
.buy__face--back { transform: rotateY(180deg) translateZ(calc(var(--bd) / 2)); box-shadow: inset -3px 0 6px rgba(0, 0, 0, .45); }
.buy__face img { width: 100%; height: 100%; object-fit: cover; }
.buy__face--spine {
  top: 0; height: 100%; width: var(--bd); left: calc((var(--bw) - var(--bd)) / 2);
  transform: rotateY(-90deg) translateZ(calc(var(--bw) / 2));
  background: linear-gradient(90deg, #08112A 0%, #13224A 48%, #0A1430 100%);
  box-shadow: inset 0 0 0 1px rgba(226, 176, 98, .25);
}
/* the spine lettering is part of the depicted book, drawn as SVG in the spine's true proportions */
.buy__spine-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.buy__spine-art text { font-family: var(--f-display); font-weight: 600; letter-spacing: 7px; }
.buy__spine-title { fill: var(--white); font-size: 46px; }
.buy__spine-author { fill: var(--gold); font-size: 54px; font-weight: 700; letter-spacing: 9px; }
.buy__spine-mark { fill: var(--gold); }
.buy__face--edge {
  top: 1%; height: 98%; width: calc(var(--bd) - 4px); left: calc((var(--bw) - var(--bd)) / 2 + 2px);
  transform: rotateY(90deg) translateZ(calc(var(--bw) / 2 - 3px));
  background: repeating-linear-gradient(90deg, #F3ECDD 0 1px, #E2D7BF 1px 2px), #EFE6D3;
}
.buy__face--top, .buy__face--bottom {
  left: 1%; width: 98%; height: calc(var(--bd) - 4px); top: calc((var(--bh) - var(--bd)) / 2 + 2px);
  background: repeating-linear-gradient(0deg, #F3ECDD 0 1px, #E2D7BF 1px 2px), #EFE6D3;
}
.buy__face--top { transform: rotateX(90deg) translateZ(calc(var(--bh) / 2 - 3px)); }
.buy__face--bottom { transform: rotateX(-90deg) translateZ(calc(var(--bh) / 2 - 3px)); }
.buy__shade { position: absolute; inset: 0; background: #02050D; opacity: 0; pointer-events: none; }
.buy__glint {
  position: absolute; top: -10%; bottom: -10%; left: 0; width: 34%; pointer-events: none; mix-blend-mode: screen;
  background: linear-gradient(100deg, transparent 0%, rgba(226, 176, 98, 0) 25%, rgba(255, 220, 150, .42) 50%, rgba(226, 176, 98, 0) 75%, transparent 100%);
  transform: translateX(-160%) skewX(-14deg);
}
.buy__shadow {
  position: absolute; left: 6%; right: 6%; bottom: -26px; height: 34px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .75), transparent); filter: blur(6px); pointer-events: none;
}

/* turn indicator: where you are in the turn, with the real spine thickness */
.buy__turn {
  position: relative; width: min(100%, 440px); display: grid; grid-template-columns: repeat(3, 1fr);
  font-size: .9rem; font-weight: 500; color: var(--mist); padding-bottom: 14px;
}
.buy__turn-label { transition: color .4s, opacity .4s; opacity: .7; }
.buy__turn-label:nth-child(2) { text-align: center; }
.buy__turn-label:nth-child(3) { text-align: right; }
.buy__turn-label.is-on { color: var(--gold); opacity: 1; }
.buy__turn-rail { position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: rgba(180, 191, 210, .25); }
.buy__turn-fill { position: absolute; left: 0; top: 0; height: 1px; width: 100%; background: var(--gold); transform: scaleX(0); transform-origin: left; }
.buy__turn-dot {
  position: absolute; left: 0; top: -4px; width: 9px; height: 9px; margin-left: -4px; background: var(--gold);
  transform: rotate(45deg); box-shadow: 0 0 12px rgba(226, 176, 98, .9);
}
/* without the scroll turn there is nothing to indicate */
.no-js .buy__turn, .reduced .buy__turn { display: none; }
@media (prefers-reduced-motion: reduce) { .buy__turn { display: none; } }

/* copy */
.buy__copy { display: flex; flex-direction: column; gap: clamp(18px, 2.4vh, 28px); }
.buy__lede { color: var(--white); }
.buy__facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; margin: 0; border-top: 1px solid rgba(226, 176, 98, .3); }
.buy__facts > div { padding: 12px 0; border-bottom: 1px solid rgba(226, 176, 98, .18); display: flex; flex-direction: column; gap: 2px; }
.buy__facts-wide { grid-column: 1 / -1; }
.buy__facts dt { font-size: .875rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.buy__facts dd { margin: 0; color: var(--white); font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.buy__ctas { display: flex; flex-wrap: wrap; gap: 14px; padding-top: 4px; }

@media (max-width: 899px) {
  .buy__stage { min-height: 0; padding: clamp(72px, 14vw, 110px) 0; }
  .buy__grid { grid-template-columns: 1fr; gap: 56px; }
  .buy__visual { --bh: min(60svh, 520px, calc((100vw - 2 * var(--gutter) - 60px) * 1199 / 800)); }
  .buy__arc { width: min(118vw, calc(var(--bh) * 1.22)); }
}
@media (max-width: 480px) {
  .buy__facts { grid-template-columns: 1fr; }
  .buy__ctas .btn { width: 100%; justify-content: center; }
}

/* keep the halo and arc inside the page width on phones (clip keeps the sticky stage working) */
.sec.buy { overflow-x: clip; }
