/* Book Animation Kit: book-kit.css
   Styles for the spinning 3D book (home page), the Look Inside button, the page-turning reader,
   the full-screen reading view and the flying book. Add it to the page after your own stylesheet,
   or paste it into the end of your stylesheet.
   Per book, change only the settings in :root below (sizes, colours, spin speed). Everything else
   has been tested frame by frame; see START-HERE.md before changing it. */

:root {
  /* the 3D book on the home page, desktop: width, height, and thickness (spine depth).
     The Wisdom Forge, 6 x 9 in, 405 pages on cream paper, spine 1.0125 in (cut_cover.py, 2026-11-25):
     at 320 wide that is 320 x 480 x 54. This site shows it larger, at 400 wide: 400 x 600 x 68. */
  --bk-w: 400px; --bk-h: 600px; --bk-d: 68px;
  /* the same on phones */
  --bk-phone-w: 250px; --bk-phone-h: 375px; --bk-phone-d: 42px;
  --bk-spin: 24s;              /* one full turn; book.js reads it from here */
  --bk-ratio: 1.5;             /* page height / width for the reader (6 x 9 in = 1.5); match pageRatio in book-config.js */
  /* colours: The Wisdom Forge brand on black (v47). Gold is retired; tan takes the accent role, red is in book-kit-wf.css */
  --bk-accent: #E3D8C2;        /* tan */
  --bk-accent-deep: #E3D8C2;
  --bk-accent-light: #F0ECE1;  /* cream */
  --bk-ink: #000000;
  --bk-stage: #0D0D0D;
  --bk-text-light: #F0ECE1;
  --bk-text-soft: #E3D8C2;
  --bk-muted: #A29E96;
  --bk-cream: #F0ECE1;
  --bk-text-dark: #000000;
  --bk-label: #5A5A5A;
}

/* small pieces the reader borrows from the site's own styles; harmless if your site already has them */
.reader-overlay .eyebrow, .look-head .eyebrow, .endin .eyebrow { font-size: 13px; letter-spacing: .32em; text-transform: uppercase; color: var(--bk-accent-deep); }
.endin .order { display: inline-block; background: var(--bk-ink); color: var(--bk-accent); border: 1px solid var(--bk-accent-deep);
  font: inherit; letter-spacing: .2em; text-transform: uppercase; text-decoration: none; cursor: pointer; transition: background .2s, color .2s; }
.endin .order:hover, .endin .order:focus-visible { background: var(--bk-accent); color: var(--bk-ink); }
.look-head { background: var(--bk-ink); color: var(--bk-text-light); text-align: center; }
.look-head h1 { margin: 0; font-weight: 400; color: var(--bk-accent); line-height: 1.05; letter-spacing: .08em; text-transform: uppercase; }
.look-end { background: var(--bk-ink); color: var(--bk-text-light); text-align: center; padding: 48px 24px 56px; }

/* ---------- 3D book: CSS spin (--bk-spin a turn), pauses on hover, still for reduced motion; book.js adds drag-to-turn ---------- */
.cover { --bw: var(--bk-w); --bh: var(--bk-h); --bd: var(--bk-d); padding: 10px 0 10px; }
.scene { display: block; position: relative; width: var(--bw); height: var(--bh); margin: 0 auto; perspective: 2000px; text-decoration: none; }
.book { display: block; position: relative; width: 100%; height: 100%; transform-style: preserve-3d; animation: bk-spin-turn var(--bk-spin) linear infinite; }
.face { position: absolute; top: 0; left: 0; display: block; background-color: #0b0b0b; background-position: center; background-size: 100% 100%; background-repeat: no-repeat; }
.front { width: var(--bw); height: var(--bh); transform: translateZ(calc(var(--bd) / 2));
  background-image: url("/cover-front.jpg"); background-image: image-set(url("/cover-front.webp") type("image/webp"), url("/cover-front.jpg") type("image/jpeg"));
  box-shadow: inset 4px 0 6px rgba(0,0,0,.35); }   /* square corners, trimmed flush with the pages like a real paperback */
.back { width: var(--bw); height: var(--bh); transform: rotateY(180deg) translateZ(calc(var(--bd) / 2));
  background-image: url("/cover-back.jpg"); background-image: image-set(url("/cover-back.webp") type("image/webp"), url("/cover-back.jpg") type("image/jpeg"));
}
.spine { width: var(--bd); height: var(--bh); transform: rotateY(-90deg) translateZ(calc(var(--bd) / 2));
  background-image: url("/cover-spine.jpg"); background-image: image-set(url("/cover-spine.webp") type("image/webp"), url("/cover-spine.jpg") type("image/jpeg")); }
/* the page block: fore-edge, head and tail all meet square at the corners, cream to cream, the way
   a trimmed paperback does; only a hairline of cover card shows along each edge */
.edge { width: var(--bd); height: var(--bh); top: 0; transform: rotateY(90deg) translateZ(calc(var(--bw) - var(--bd) / 2));
  background:
    linear-gradient(to right, #2b2620 0 1px, transparent 1px calc(100% - 1px), #2b2620 calc(100% - 1px)),
    linear-gradient(to bottom, rgba(0,0,0,.10), rgba(0,0,0,0) 6%, rgba(0,0,0,0) 94%, rgba(0,0,0,.10)),
    repeating-linear-gradient(to right, #f3ecdb 0, #f3ecdb 1px, #e6dcc6 1px, #e6dcc6 3px); }
.face.top, .face.bottom { width: var(--bw); height: var(--bd);
  background:
    linear-gradient(to bottom, #2b2620 0 1px, transparent 1px calc(100% - 1px), #2b2620 calc(100% - 1px)),
    linear-gradient(to right, rgba(0,0,0,.18), rgba(0,0,0,0) 5%, rgba(0,0,0,0) 96%, rgba(0,0,0,.06)),
    repeating-linear-gradient(to bottom, #f3ecdb 0, #f3ecdb 1px, #e6dcc6 1px, #e6dcc6 3px); }
.face.top { top: calc(var(--bd) / -2); transform: rotateX(90deg); }
.face.bottom { top: calc(var(--bh) - var(--bd) / 2); transform: rotateX(-90deg); }
.pages { position: absolute; display: block; width: calc(var(--bw) - 4px); height: calc(var(--bh) - 6px); top: 3px; left: 0;
  transform: translateZ(calc(var(--bd) / -2 + 2px)); background: #efe7d4; }
.book-shadow { position: absolute; left: 50%; bottom: -60px; width: calc(var(--bw) * 1.5); height: 50px; transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(0,0,0,.85) 0%, transparent 70%); filter: blur(12px); animation: bk-shadow-turn var(--bk-spin) linear infinite; }
.scene:hover .book, .scene:hover .book-shadow, .scene:focus-visible .book, .scene:focus-visible .book-shadow { animation-play-state: paused; }
.scene { cursor: grab; touch-action: pan-y; -webkit-user-select: none; user-select: none; }
.scene:active { cursor: grabbing; }
.scene.held .book, .scene.held .book-shadow { animation: none; }   /* book.js: visitor is turning it by hand */
@keyframes bk-spin-turn { from { transform: rotateY(0deg); } to { transform: rotateY(360deg); } }
@keyframes bk-shadow-turn { 0%, 50%, 100% { transform: translateX(-50%) scaleX(1); opacity: .9; } 25%, 75% { transform: translateX(-50%) scaleX(.55); opacity: .6; } }
@media (prefers-reduced-motion: reduce) {
  .book { animation: none; transform: rotateY(-24deg); }
  .book-shadow { animation: none; }
}
/* "Look inside" sits under the spinning book; book.js flies the book forward and opens it */
.look-under { margin: 64px 0 0; text-align: center; }
.look-link { display: inline-block; padding: 17px 40px; background: var(--bk-accent); color: var(--bk-ink); border: 1px solid var(--bk-accent);
  font-size: 16px; letter-spacing: .2em; text-transform: uppercase; text-decoration: none; transition: background .2s, border-color .2s; }
.look-link:hover, .look-link:focus-visible { background: var(--bk-accent-light); border-color: var(--bk-accent-light); color: var(--bk-ink); }
.look-note { margin: 12px 0 0; font-size: 15px; font-style: italic; color: var(--bk-muted); }
@media (max-width: 760px) {
  .cover { --bw: var(--bk-phone-w); --bh: var(--bk-phone-h); --bd: var(--bk-phone-d); padding: 0 0 6px; }
  .look-under { margin-top: 56px; }
  .look-link { display: block; padding: 17px 20px; }
}

/* ---------- look inside: sample pages ---------- */
.reader { background: var(--bk-stage); padding: 48px 0 56px; }
.sheets { max-width: 620px; margin: 0 auto; padding: 0 20px; display: grid; gap: 28px; }
.sheet { margin: 0; background: #fff; box-shadow: 0 10px 34px rgba(0,0,0,.55); }
.sheet img { width: 100%; }
.page .end-title { margin: 10px 0 0; font-weight: 400; font-size: clamp(30px, 4.4vw, 42px); color: var(--bk-accent); }
@media (max-width: 760px) { .reader { padding: 28px 0 36px; } .sheets { gap: 18px; padding: 0 12px; } }

/* ---------- look inside: book reader (reader.js); the list above is the no-script fallback ---------- */
.js .sheets { display: none; }
.look-head { min-height: 0; padding-bottom: 8px; }
.js .look-head { padding: 20px 0 8px; position: relative; z-index: 5; }   /* a lifted page passes behind the title, not over it */
.js .look-head h1 { font-size: clamp(24px, 2.6vw, 32px); margin-top: 4px; }
.js .reader { padding: 40px 0 40px; min-height: calc(100vh - 87px); display: flex; flex-direction: column; justify-content: center; }   /* book sits centred in the space under the title */
.reader-app { padding: 0 12px; }
.rstage { display: flex; align-items: center; justify-content: center; gap: 22px; }
.bookview { position: relative; flex: none; perspective: calc(var(--pw) * 7); transition: transform .9s cubic-bezier(.42,0,.28,1); cursor: pointer;
  -webkit-user-select: none; user-select: none; touch-action: pan-y; }
/* desktop: as large as the screen allows with the whole spread in view */
.bookview.two { --pw: min(640px, calc((100vw - 200px) / 2), calc((100vh - 242px) / var(--bk-ratio))); width: calc(var(--pw) * 2); height: calc(var(--pw) * var(--bk-ratio)); }
.bookview.one { --pw: min(560px, calc(100vw - 24px)); width: var(--pw); height: calc(var(--pw) * var(--bk-ratio)); }
.bookview.closed { transform: translateX(-25%); }
.bookview .side { position: absolute; top: 0; height: 100%; }
.bookview .side.left { left: 0; width: 50%; }
.bookview .side.right { left: 50%; width: 50%; }
.bookview .side.single { left: 0; width: 100%; }
.pg { position: relative; width: 100%; height: 100%; background: #fff; overflow: hidden; }
.pg img { width: 100%; height: 100%; pointer-events: none; -webkit-user-drag: none; }
.side.left .pg { box-shadow: -6px 8px 24px rgba(0,0,0,.45); }
.side.right .pg, .side.single .pg { box-shadow: 6px 8px 24px rgba(0,0,0,.45); }
/* each page's drop shadow falls outward only, never across the fold, so a page that has just
   turned looks exactly the same once it lands */
.side.left .pg { clip-path: inset(-60px 0 -60px -60px); }
.side.right .pg { clip-path: inset(-60px -60px -60px 0); }
.pg.none { background: transparent; box-shadow: none !important; }
.pg.inside { background: #f3eee2; }
.pg.cover-pg { background: #0b0b0b; border-radius: 0 3px 3px 0; }
/* gutter: each page carries its own fold shading, so it moves with the paper */
.pg.verso::after, .pg.recto::after { content: ""; position: absolute; top: 0; bottom: 0; width: 9%; pointer-events: none; z-index: 1; }
.pg.verso::after { right: 0; background: linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,.07) 50%, rgba(0,0,0,.30)); }
.pg.recto::after { left: 0; background: linear-gradient(to left, rgba(0,0,0,0), rgba(0,0,0,.07) 50%, rgba(0,0,0,.30)); }
.pg.none::after, .pg.cover-pg::after { display: none; }
.leaf { position: absolute; top: 0; height: 100%; z-index: 3; transform-style: preserve-3d; }
.leaf.on-right { left: 50%; width: 50%; transform-origin: left center; }
.leaf.on-left { left: 0; width: 50%; transform-origin: right center; }
.leaf.on-single { left: 0; width: 100%; transform-origin: left center; }
.leaf .pg { position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; box-shadow: none; }
.leaf .face-back { transform: rotateY(180deg); }
.shade, .cast { position: absolute; inset: 0; pointer-events: none; z-index: 2; opacity: 0; }
.face-front.recto .shade, .face-front.cover-pg .shade { background: linear-gradient(to right, rgba(0,0,0,.55), rgba(0,0,0,.15)); }
.face-back.verso .shade, .face-front.verso .shade { background: linear-gradient(to left, rgba(0,0,0,.55), rgba(0,0,0,.15)); }
.face-back.recto .shade { background: linear-gradient(to right, rgba(0,0,0,.55), rgba(0,0,0,.15)); }
.recto .cast { background: linear-gradient(to right, rgba(0,0,0,.6), rgba(0,0,0,0) 70%); }
.verso .cast { background: linear-gradient(to left, rgba(0,0,0,.6), rgba(0,0,0,0) 70%); }
.pg.endpg { background: var(--bk-cream); display: flex; align-items: center; justify-content: center; text-align: center; color: var(--bk-text-dark); }
.endin { padding: 0 12%; position: relative; z-index: 3; }
.endin .eyebrow { color: var(--bk-label); }
.endin .endtitle { margin: 12px 0 10px; font-size: clamp(22px, 2.6vw, 30px); line-height: 1.2; color: var(--bk-text-dark); }
.endin p { margin: 0; font-size: 17px; line-height: 1.5; }
.endin .order { margin-top: 22px; padding: 14px 22px; font-size: 14px; }
.turnbtn { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; color: var(--bk-accent); background: transparent;
  border: 1px solid var(--bk-accent-deep); cursor: pointer; transition: background .2s, color .2s, opacity .2s; }
.turnbtn:hover:not(:disabled), .turnbtn:focus-visible { background: var(--bk-accent); color: var(--bk-ink); }
.turnbtn:disabled { opacity: .25; cursor: default; }
.rmeta { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 18px auto 0; }
.where { text-align: center; font-size: 15px; letter-spacing: .08em; color: var(--bk-text-soft); }
.hint { margin: 10px 0 0; text-align: center; font-size: 15px; font-style: italic; color: var(--bk-muted); }
@media (min-width: 900px) {
  /* big round arrows either side of the book */
  .turnbtn { width: 64px; height: 64px; border-radius: 50%; padding: 0; }
  .turnbtn .btntext { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .arrowglyph { font-size: 40px; line-height: 1; margin-top: -6px; }
}
@media (max-width: 899px) {
  .rstage { flex-wrap: wrap; gap: 10px; }
  .bookview { order: -1; flex: 0 0 auto; }
  .rstage .turnbtn { flex: 1 1 40%; padding: 12px 8px; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; margin-top: 12px; }
  .arrowglyph { font-size: 22px; line-height: 1; }
  .rmeta { margin-top: 12px; }
}
@media (prefers-reduced-motion: reduce) { .bookview { transition: none; } }

/* ---------- close (×), the home-page reading view, and the flying book ---------- */
.rclose { position: fixed; top: 14px; right: 18px; z-index: 1003; width: 50px; height: 50px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font: inherit; font-size: 34px; line-height: 1; text-decoration: none;
  color: var(--bk-accent); background: rgba(11,11,11,.85); border: 1px solid var(--bk-accent-deep); cursor: pointer; transition: background .2s, color .2s; }
.rclose span { margin-top: -4px; }
.rclose:hover, .rclose:focus-visible { background: var(--bk-accent); color: var(--bk-ink); }
html.reading { overflow: hidden; }
.reader-overlay { position: fixed; inset: 0; z-index: 1000; overflow-y: auto; background: var(--bk-stage); color: var(--bk-text-light); display: flex; flex-direction: column; }
.ov-head { flex: none; position: relative; z-index: 5; background: var(--bk-ink); text-align: center; padding: 20px 0 8px; }
.ov-title { margin: 4px 0 0; font-weight: 400; color: var(--bk-accent); font-size: clamp(24px, 2.6vw, 32px); line-height: 1.05; letter-spacing: .08em; text-transform: uppercase; }
.reader-overlay .reader-app { flex: 1 0 auto; display: flex; flex-direction: column; justify-content: center; padding-top: 40px; padding-bottom: 40px; }   /* equal room above and below */
.flyer { position: fixed; z-index: 1001; perspective: 1800px; transform-origin: center center; pointer-events: none; will-change: transform; }
.flyer-book { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.flyer-front { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 0 3px 3px 0; box-shadow: 0 30px 70px rgba(0,0,0,.6); }
.flyer-edge { position: absolute; top: 1%; right: 0; height: 98%; transform-origin: right center; transform: rotateY(-90deg);
  background: repeating-linear-gradient(to right, #f3ecdb 0, #f3ecdb 1px, #e6dcc6 1px, #e6dcc6 3px); }
@media (max-width: 899px) {
  .rclose { top: 10px; right: 10px; width: 44px; height: 44px; font-size: 30px; }
  .ov-head, .js .look-head .wrap { padding-left: 58px; padding-right: 58px; }   /* keep the title clear of the × */
}
