/* B5 Book hero: the real paperback opens into a two-page spread, and the hero copy lives on the pages.
   Desktop: cover swings open, the half-title page turns (with a curl shade), the spread settles flat,
   a gold light crosses the paper. Phone (<= 900 px): the cover swings open onto one page holding all the copy.
   The copy is real HTML in .bo-spread; the moving parts (.bo-rig) are removed when the book is open, so the
   final text is flat, crisp and selectable. Reduced motion: the open spread, no movement.
   Typography follows the book interior (.tmp/sample-chapter/sample.html): DM Serif Display, EB Garamond, Inter. */

.epi-bookopen {
  --pw: min(460px, 44vw);            /* one page width */
  --ph: calc(var(--pw) * 1.4667);    /* the cover's ratio, 1056 / 720 */
  --paper: #faf6ee; --paper2: #f1e8d6; --ink: #23262e; --ink-soft: #4a4f5a; --muted: #6a6054;
  --gold: #b3893f; --gold-deep: #7a5d1e; --gold-lt: #e3c074;
  position: relative; width: calc(var(--pw) * 2); max-width: 100%; margin: 0 auto;
  perspective: 2800px; perspective-origin: 50% 55%;
}
.bo-glow {
  position: absolute; left: 50%; top: 50%; width: 150%; height: 130%; transform: translate(-50%, -50%);
  /* R3-6c a key light from the top left plus a warm bounce under the book (was a flat symmetric ellipse) */
  background: radial-gradient(40% 45% at 36% 28%, rgba(255,232,180,.20), rgba(255,232,180,.06) 45%, transparent 70%),
              radial-gradient(50% 20% at 50% 100%, rgba(212,168,76,.12), transparent 70%);
  pointer-events: none; opacity: .35;
}
.epi-bookopen.is-open .bo-glow { opacity: 1; }
.epi-bookopen.is-opening .bo-glow { animation: boGlow 1.2s ease .2s both; }
@keyframes boGlow { from { opacity: .35; } to { opacity: 1; } }
.bo-book { position: relative; transform-style: preserve-3d; }

/* ---------- the real, final spread (flat HTML) ---------- */
.bo-spread {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; min-height: var(--ph);
  border-radius: 4px 4px 4px 4px; box-shadow: 0 40px 90px rgba(0,0,0,.55), 0 0 0 1px rgba(0,0,0,.25);
  /* page block edges under the spread */
  background: #e6dcc6;
}
.bo-spread::after {                                     /* stacked page edges, bottom and sides */
  content: ""; position: absolute; left: 6px; right: 6px; bottom: -6px; height: 6px; border-radius: 0 0 4px 4px;
  background: repeating-linear-gradient(180deg, #e9e0cc 0 1px, #cfc4ab 1px 2px); z-index: -1;
}
.bo-page {
  position: relative; display: flex; flex-direction: column; padding: 48px 44px 56px; color: var(--ink);
  font-family: 'EB Garamond', Georgia, serif; font-size: 17.5px; line-height: 1.5;
  background-color: var(--paper);
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45  0 0 0 0 .38  0 0 0 0 .28  0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  overflow: hidden;
}
.bo-page--left { border-radius: 4px 0 0 4px; }
.bo-page--right { border-radius: 0 4px 4px 0; }
/* gutter: the paper curves into the spine */
.bo-page--left::after, .bo-page--right::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 64px; pointer-events: none;
}
.bo-page--left::after { right: 0; background: linear-gradient(90deg, rgba(60,40,10,0) 0%, rgba(60,40,10,.10) 70%, rgba(40,25,5,.22) 100%); }
.bo-page--right::after { left: 0; background: linear-gradient(270deg, rgba(60,40,10,0) 0%, rgba(60,40,10,.08) 70%, rgba(40,25,5,.20) 100%); }
/* outer page edge highlight */
.bo-page--left::before, .bo-page--right::before { content: ""; position: absolute; top: 0; bottom: 0; width: 3px; background: linear-gradient(180deg, rgba(255,255,255,.6), rgba(255,255,255,.2)); }
.bo-page--left::before { left: 0; } .bo-page--right::before { right: 0; }
.bo-folio { position: absolute; bottom: 18px; font: 600 10px/1 Inter, system-ui, sans-serif; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); }
.bo-page--left .bo-folio { left: 44px; } .bo-page--right .bo-folio { right: 44px; }

/* ---------- typography inside the pages (overrides the dark-hero site styles) ---------- */
.epi-bookopen .bo-kicker, .epi-bookopen .section-label, .epi-bookopen .book-hero__get {
  display: block; font: 600 11px/1.3 Inter, system-ui, sans-serif !important; letter-spacing: .24em !important; text-transform: uppercase;
  color: var(--gold-deep) !important; margin: 0 0 14px !important;
}
.epi-bookopen .section-label::before { display: none !important; }
.epi-bookopen h1, .epi-bookopen .book-hero__headline {
  font-family: 'DM Serif Display', Georgia, serif !important; font-weight: 400 !important; color: #1b1e25 !important;
  font-size: clamp(30px, 3.1vw, 44px) !important; line-height: 1.08 !important; margin: 0 0 18px !important; letter-spacing: 0 !important;
}
.epi-bookopen h1 .accent { display: block; margin-top: 10px; font-family: 'EB Garamond', Georgia, serif !important; font-style: italic; font-size: .6em; line-height: 1.2; color: var(--gold-deep) !important; -webkit-text-fill-color: currentColor !important; background: none !important; }
.epi-bookopen .book-hero__sub, .epi-bookopen p { color: var(--ink-soft) !important; font-family: 'EB Garamond', Georgia, serif !important; font-size: 18px !important; line-height: 1.55 !important; margin: 0 0 14px !important; max-width: none !important; }
.epi-bookopen .bo-drop::first-letter { font-family: 'DM Serif Display', Georgia, serif; float: left; font-size: 3.4em; line-height: .8; padding: 6px 10px 0 0; color: var(--gold); }
.epi-bookopen .book-hero__facts { list-style: none; margin: 0 0 22px !important; padding: 0; display: flex; flex-direction: column; gap: 9px !important; }
.epi-bookopen .book-hero__facts li { display: flex; gap: 10px; align-items: flex-start !important; color: var(--ink) !important; font-family: 'EB Garamond', Georgia, serif !important; font-size: 17px !important; line-height: 1.4 !important; }
.epi-bookopen .book-hero__facts li svg { color: var(--gold) !important; stroke: var(--gold) !important; margin-top: 4px; flex: none; }
.epi-bookopen .book-hero__cta-group { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 0 0 14px; }
.epi-bookopen .book-hero__peek { color: var(--ink) !important; opacity: 1 !important; font: 600 14px/1.2 Inter, system-ui, sans-serif !important; border-bottom: 1px solid rgba(35,38,46,.3); text-decoration: none; }
.epi-bookopen .book-hero__price { font: 500 13px/1.4 Inter, system-ui, sans-serif !important; color: var(--muted) !important; margin: 0 !important; }
.epi-bookopen .bo-rule { width: 56px; height: 1px; background: var(--gold); margin: auto 0 16px; opacity: .7; }   /* pushes the price to the foot of the page */

/* ---------- the moving parts (desktop) ---------- */
.bo-rig { position: absolute; top: 0; right: 0; width: 50%; height: 100%; transform-style: preserve-3d; pointer-events: none; }
.bo-cover, .bo-leaf { position: absolute; inset: 0; transform-origin: 0 50%; transform-style: preserve-3d; }
.bo-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.bo-face--back { transform: rotateY(180deg); }
.bo-cover { z-index: 3; transform: rotateY(0) translateZ(4px); }   /* R3-6a closed: cover (z 4) above the leaf (z 1) */
.bo-cover .bo-face--front { border-radius: 2px 5px 5px 2px; box-shadow: inset 5px 0 8px -4px rgba(0,0,0,.6); background: #0c1a3a; }
.bo-cover .bo-face--front img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* R3-6d a sheen crosses the cover as it swings; a rim of light on its open edge */
.bo-cover .bo-face--front::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(255,240,200,.30) 45%, transparent 60%); background-size: 250% 100%; background-position: 100% 0;
  mix-blend-mode: screen; box-shadow: inset -1px 0 0 rgba(255,236,190,.35); }
.epi-bookopen.is-opening .bo-cover .bo-face--front::after { animation: boSheen 1.1s ease-in-out .35s both; }
@keyframes boSheen { from { background-position: 100% 0; } to { background-position: 0% 0; } }
/* R3-6e the page block: 14 px of paper on the fore-edge, visible while the closed book is turned -12deg */
.bo-block { position: absolute; top: 3px; bottom: 3px; right: -14px; width: 14px; transform-origin: left; transform: rotateY(90deg);
  background: repeating-linear-gradient(90deg, #efe6d2 0 1px, #d6cab0 1px 2px); }
.epi-bookopen.is-opening .bo-block { animation: boBlock .4s ease .4s both; }
@keyframes boBlock { from { opacity: 1; } to { opacity: 0; } }
/* R3-6f contact shadow: the book rests on something (a static blur, painted once) */
.bo-floor { position: absolute; left: 8%; right: 8%; bottom: -30px; height: 44px; pointer-events: none;
  background: radial-gradient(50% 50% at 50% 50%, rgba(0,0,0,.7), transparent 70%); filter: blur(6px); transform: scaleX(.55); }
.epi-bookopen.is-open .bo-floor { transform: scaleX(1); }
.epi-bookopen.is-opening .bo-floor { animation: boFloor 2s cubic-bezier(.45,.05,.25,1) .2s both; }
@keyframes boFloor { from { transform: scaleX(.55); } to { transform: scaleX(1); } }
/* R3-6h a ribbon bookmark, the one detail of care; it stays on the open spread */
.bo-ribbon { position: absolute; top: -6px; left: calc(50% + 28px); width: 10px; height: 132px; z-index: 5; pointer-events: none;
  background: linear-gradient(90deg, #9c7630, #e3c074 45%, #b8892f); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 88%, 0 100%);
  box-shadow: 0 2px 4px rgba(0,0,0,.25); transform-origin: top; }
.epi-bookopen.bo-js:not(.is-open):not(.is-opening) .bo-ribbon { opacity: 0; }
.epi-bookopen.is-opening .bo-ribbon { animation: boRibbon 1.2s ease-out 2.2s both; }
@keyframes boRibbon { from { opacity: 0; transform: rotate(4deg); } to { opacity: 1; transform: none; } }
/* R3-6k fore-edge of the open book: 6 px of stacked pages on the outer edge */
.bo-page--right { box-shadow: 2px 0 0 #ebe2ce, 4px 0 0 #d9cdb4, 6px 0 0 #cbbfa4; }
/* R3-6b the real left page appears under the finished leaf, never fades */
.bo-spread > .bo-page--left { transition: none; }
.bo-cover .bo-face--back {                               /* endpaper: navy with a quiet gold mark */
  border-radius: 5px 2px 2px 5px; background: radial-gradient(ellipse at 50% 45%, #13224a, #0a1431 70%);
  box-shadow: inset -6px 0 10px -6px rgba(0,0,0,.7);
}
.bo-cover .bo-face--back::after { content: "A.L.I.G.N.E.D."; position: absolute; left: 0; right: 0; top: 46%; text-align: center; font: 400 18px/1 'DM Serif Display', Georgia, serif; letter-spacing: .3em; color: rgba(227,192,116,.55); }
.bo-leaf { z-index: 2; transform: translateZ(1px) rotateY(0); }
.bo-leaf .bo-face { background-color: var(--paper); }
.bo-leaf .bo-face--front { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.bo-half { font: 400 clamp(26px, 2.6vw, 36px)/1 'DM Serif Display', Georgia, serif; letter-spacing: .14em; color: #1b1e25; }
.bo-half-sub { margin-top: 14px; font: italic 400 17px/1.3 'EB Garamond', Georgia, serif; color: var(--gold-deep); }
.bo-leaf .bo-face--back .bo-page { position: absolute; inset: 0; }
.bo-shade { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.bo-leaf .bo-face--front .bo-shade { background: linear-gradient(90deg, rgba(40,25,5,.35) 0%, rgba(40,25,5,0) 45%, rgba(255,255,255,.25) 80%, rgba(40,25,5,.25) 100%); }
.bo-leaf .bo-face--back .bo-shade { background: linear-gradient(270deg, rgba(40,25,5,.35) 0%, rgba(40,25,5,0) 50%, rgba(255,255,255,.3) 85%, rgba(40,25,5,.2) 100%); }
.bo-sweep { position: absolute; inset: 0; pointer-events: none; overflow: hidden; border-radius: 4px; z-index: 4; }
.bo-sweep::before { content: ""; position: absolute; top: -10%; bottom: -10%; width: 30%; left: -40%;
  background: linear-gradient(100deg, rgba(255,236,190,0) 0%, rgba(255,236,190,.38) 50%, rgba(255,236,190,0) 100%); transform: skewX(-12deg); opacity: 0; }

/* closed state (before the visitor sees it open) */
.epi-bookopen.bo-js:not(.is-open) .bo-book { transform: translateX(-25%) rotateY(-12deg) rotateX(6deg); }
.epi-bookopen.bo-js:not(.is-open) .bo-spread > .bo-page--left { opacity: 0; }
.epi-bookopen.bo-js:not(.is-open) .bo-spread { background: transparent; box-shadow: none; }
.epi-bookopen.bo-js:not(.is-open) .bo-spread::after { opacity: 0; }
.epi-bookopen.bo-js:not(.is-open) .bo-page--right > * { opacity: 0; }
.epi-bookopen.bo-js:not(.is-open) .bo-page--right { box-shadow: 18px 30px 60px rgba(0,0,0,.5); }

/* the opening, 3.4 s (R3-6i): hold closed .35 s; cover .35-1.55 s with a settle; leaf 1.35-2.45 s (overlaps the settle);
   book flattens .2-2.2 s; right-page lines from 2.2 s, 90 ms apart; light sweep 2.5-3.4 s */
.epi-bookopen.is-opening .bo-book { animation: boBook 2s cubic-bezier(.45,.05,.25,1) .2s both; }
.epi-bookopen.is-opening .bo-cover { animation: boCover 1.2s cubic-bezier(.6,.02,.3,1) .35s both; }
.epi-bookopen.is-opening .bo-leaf { animation: boLeaf 1.1s linear 1.35s both; }
.epi-bookopen.is-opening .bo-leaf .bo-shade { animation: boShade 1.1s ease-in-out 1.35s both; }
/* the spread's paper fills in only once the leaf has landed, so the endpaper shows on the left while the leaf turns */
.epi-bookopen.is-opening .bo-spread { animation: boSpread .35s ease 2.3s both; }
.epi-bookopen.is-opening .bo-spread::after { animation: boFade .5s ease 2.2s both; }
.epi-bookopen.is-opening .bo-page--right > * { animation: boLine .6s cubic-bezier(.2,.7,.2,1) both; }
.epi-bookopen.is-opening .bo-page--right > *:nth-child(1) { animation-delay: 2.2s; }
.epi-bookopen.is-opening .bo-page--right > *:nth-child(2) { animation-delay: 2.29s; }
.epi-bookopen.is-opening .bo-page--right > *:nth-child(3) { animation-delay: 2.38s; }
.epi-bookopen.is-opening .bo-page--right > *:nth-child(4) { animation-delay: 2.47s; }
.epi-bookopen.is-opening .bo-page--right > *:nth-child(5) { animation-delay: 2.56s; }
.epi-bookopen.is-opening .bo-page--right > *:nth-child(6) { animation-delay: 2.65s; }
.epi-bookopen.is-opening .bo-page--right > *:nth-child(n+7) { animation-delay: 2.74s; }
.epi-bookopen.is-opening .bo-sweep::before { animation: boSweep .9s ease-in-out 2.5s both; }
/* R3-6g the page underneath darkens as the leaf passes over it */
.epi-bookopen.is-opening .bo-page--right::before { right: auto; left: 0; width: 0; z-index: 1; background: linear-gradient(90deg, rgba(30,20,5,.28), transparent); animation: boCast 1.1s ease-in-out 1.35s both; }
@keyframes boCast { 0% { width: 0; } 50% { width: 60%; } 100% { width: 0; } }
@keyframes boBook {
  0%   { transform: translateX(-25%) rotateY(-12deg) rotateX(6deg); }
  100% { transform: translateX(0) rotateY(0) rotateX(0); }
}
/* R3-6a rotate THEN push: the cover's 4 px of depth turns with it, so it ends at z -4, under the leaf and the spread.
   Before: translateZ(2px) rotateY(-178deg) left the cover's far edge about 16 px IN FRONT of the turned page, so the endpaper covered it.
   (DESIGN-R3 6a wrote translateZ(4px) rotateY(-180deg); in CSS that keeps the cover at z +4, in front of the leaf, so the order is reversed here.) */
@keyframes boCover {
  0%   { transform: rotateY(0) translateZ(4px); }
  85%  { transform: rotateY(-182deg) translateZ(4px); }
  100% { transform: rotateY(-180deg) translateZ(4px); }
}
/* R3-6g the leaf bends as it turns (skewY) instead of swinging like a board; it stays at z +1, in front of the spread */
@keyframes boLeaf {
  0%   { transform: translateZ(1px) rotateY(0) skewY(0); animation-timing-function: cubic-bezier(.5,0,.8,.6); }
  40%  { transform: translateZ(1px) rotateY(-62deg) skewY(-2deg); animation-timing-function: linear; }
  60%  { transform: translateZ(1px) rotateY(-118deg) skewY(1.5deg); animation-timing-function: cubic-bezier(.2,.4,.25,1); }
  100% { transform: translateZ(1px) rotateY(-180deg) skewY(0); }
}
@keyframes boShade { 0% { opacity: 0; } 45% { opacity: 1; } 100% { opacity: 0; } }
@keyframes boSpread { from { box-shadow: none; background: transparent; } to { box-shadow: 0 40px 90px rgba(0,0,0,.55), 0 0 0 1px rgba(0,0,0,.25); background: #e6dcc6; } }
@keyframes boFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes boLine { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes boSweep { 0% { left: -40%; opacity: 0; } 15% { opacity: 1; } 100% { left: 115%; opacity: 0; } }

/* open = flat, crisp, selectable; the rig is removed two frames after is-open (bookopen.js, R3-6b) */
.epi-bookopen.is-open .bo-book { transform: none; }

/* ---------- phone: one page, the cover swings open onto it ---------- */
@media (max-width: 900px) {
  .epi-bookopen { --pw: min(92vw, 440px); width: var(--pw); perspective: 1400px; }
  .bo-spread { grid-template-columns: 1fr; min-height: calc(var(--pw) * 1.4667); }
  .bo-page { padding: 34px 26px 44px; }
  .bo-page--left { border-radius: 4px 4px 0 0; padding-bottom: 6px; }
  .bo-page--right { border-radius: 0 0 4px 4px; padding-top: 6px; }
  .bo-page--left::after, .bo-page--right::after, .bo-page--left .bo-folio { display: none; }
  .bo-rig { width: 100%; height: calc(var(--pw) * 1.4667); bottom: auto; }   /* the cover keeps its own ratio */
  .bo-leaf { display: none; }
  .bo-page { display: block; }
  .epi-bookopen .bo-rule { margin: 18px 0; }
  /* closed: only the cover's height shows; opening: the page grows to its copy */
  .epi-bookopen.bo-js:not(.is-open) .bo-spread { max-height: calc(var(--pw) * 1.4667); min-height: 0; overflow: hidden; }
  .epi-bookopen.is-opening .bo-spread { animation: boSpread .6s ease .9s both, boGrow 1.1s cubic-bezier(.4,0,.2,1) 1.1s both; }
  @keyframes boGrow { from { max-height: calc(var(--pw) * 1.4667); } to { max-height: 1600px; } }
  .epi-bookopen.bo-js:not(.is-open) .bo-book { transform: rotateY(-8deg) rotateX(4deg); }
  .epi-bookopen.bo-js:not(.is-open) .bo-spread > .bo-page--left { opacity: 1; }
  .epi-bookopen.bo-js:not(.is-open) .bo-spread > .bo-page--left > *, .epi-bookopen.bo-js:not(.is-open) .bo-page--right > * { opacity: 0; }
  .epi-bookopen.is-opening .bo-book { animation: boBookM 1.9s cubic-bezier(.45,.05,.25,1) .2s both; }
  .epi-bookopen.is-opening .bo-cover { animation: boCoverM 1.6s cubic-bezier(.55,.05,.3,1) .3s both; }
  .epi-bookopen.is-opening .bo-spread > .bo-page--left > *, .epi-bookopen.is-opening .bo-page--right > * { animation: boLine .6s cubic-bezier(.2,.7,.2,1) 1.3s both; }
  .epi-bookopen.is-opening .bo-page--right > * { animation-delay: 1.55s !important; }
  @keyframes boBookM { from { transform: rotateY(-8deg) rotateX(4deg); } to { transform: none; } }
  @keyframes boCoverM { 0% { transform: rotateY(0) translateZ(4px); opacity: 1; } 75% { opacity: 1; } 100% { transform: rotateY(-150deg) translateZ(4px); opacity: 0; } }
  .bo-ribbon { left: auto; right: 12px; height: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  .epi-bookopen *, .epi-bookopen *::before, .epi-bookopen *::after { animation: none !important; transition: none !important; }
}

/* ---- build additions, Round 2 (COPY-DECK R2.5 spread text) ---- */
.epi-bookopen .bo-sec { font-family: 'DM Serif Display', Georgia, serif !important; font-weight: 400 !important; font-size: 26px !important; line-height: 1.15 !important; color: var(--ink) !important; margin: 6px 0 14px !important; }
.epi-bookopen .bo-close { font-style: italic; color: var(--ink) !important; margin-top: 4px !important; }
.epi-bookopen .bo-specs { font: 500 13px/1.45 Inter, system-ui, sans-serif !important; color: var(--muted) !important; margin: 0 0 16px !important; }
.epi-bookopen .bo-phone-quote { display: none; }
@media (max-width: 900px) {
  /* phone: one page, the offer, with the book's closing line set above the headline (COPY-DECK R2.5) */
  .epi-bookopen .bo-spread > .bo-page--left { display: none !important; }
  .epi-bookopen .bo-page--right { border-radius: 4px !important; padding-top: 30px !important; }
  .epi-bookopen .bo-phone-quote { display: block; margin: 0 0 18px !important; padding: 0 0 0 14px !important; border-left: 2px solid var(--gold); font-family: 'EB Garamond', Georgia, serif; font-style: italic; font-size: 18px; line-height: 1.45; color: var(--ink); }
  .epi-bookopen .bo-phone-quote cite { display: block; margin-top: 6px; font: 600 10px/1.2 Inter, system-ui, sans-serif; letter-spacing: .2em; text-transform: uppercase; font-style: normal; color: var(--muted); }
}
