/* ==========================================================
   Alan Huckerby — shared styles
   Each page sets a theme on <body>: theme-home, theme-kids,
   theme-mystery, theme-scifi, theme-historical, theme-life
   ========================================================== */
:root {
  --ink: #1f1a17;
  --paper: #fbf6ee;
  --paper-2: #f3eadb;
  --cream: #fffdf8;
  --text: #2b231d;
  --muted: #6e6056;
  --line: rgba(43, 35, 29, .12);
  --amber: #f0932b;
  --rust: #c4501f;
  --gold: #ffc93c;
  --on-dark: #f6ecdc;
  --on-dark-muted: #bba998;

  --accent: var(--rust);
  --accent-2: var(--amber);
  --bg: var(--paper);
  --bg-2: var(--paper-2);
  --card: var(--cream);
  --nav-bg: rgba(251, 246, 238, .97);
  --nav-fg: var(--ink);

  --shadow: 0 30px 60px -25px rgba(40, 20, 5, .35);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Manrope", system-ui, sans-serif;
  --display: var(--serif);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; line-height: 1.05; margin: 0; letter-spacing: -.015em; }
p { margin: 0; }
.wrap { width: min(1200px, 100% - 40px); margin-inline: auto; }
section { padding: clamp(72px, 10vw, 130px) 0; position: relative; overflow-x: clip; }
main > section ~ section, main > div ~ section { content-visibility: auto; contain-intrinsic-size: auto 900px; }
.eyebrow { font: 700 12px/1 var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--accent); display: inline-flex; align-items: center; gap: 10px; }
.eyebrow::before { content: ""; width: 28px; height: 1.5px; background: currentColor; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 48px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(36px, 4.6vw, 60px); margin-top: 14px; }
.section-head h2 em { color: var(--accent); font-weight: 400; }
.section-head p { max-width: 440px; color: var(--muted); }
:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 14px 24px; border-radius: 999px;
  font: 700 15px/1 var(--sans); text-decoration: none; border: 1.5px solid transparent; cursor: pointer;
  transition: transform .25s, background .25s, color .25s, border-color .25s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--ink); color: var(--cream); }
.btn-primary:hover { background: var(--accent); }
.btn-ghost { border-color: currentColor; background: transparent; }
.btn-ghost:hover { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.btn-soon { background: var(--bg-2); color: var(--muted); border: 1.5px dashed rgba(128,128,128,.45); cursor: default; }
.btn-soon:hover { transform: none; }
.btn .arrow { transition: transform .25s; }
.btn:hover .arrow { transform: translateX(4px); }

/* ---------- HEADER ---------- */
.site-header { position: fixed; inset: 0 0 auto 0; z-index: 60; padding: 16px 0; color: var(--nav-fg); transition: background .35s, padding .35s, box-shadow .35s; }
.site-header.scrolled, .site-header.solid { background: var(--nav-bg); padding: 10px 0; box-shadow: 0 1px 0 rgba(128,128,128,.18); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.logo { font: 600 21px/1 var(--serif); text-decoration: none; display: flex; align-items: center; gap: 11px; white-space: nowrap; }
.logo-mark { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--amber); color: var(--cream); font: italic 600 19px/1 var(--serif); flex-shrink: 0; }
.main-nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; align-items: center; }
.main-nav a { display: block; text-decoration: none; font: 600 14px/1 var(--sans); padding: 10px 12px; border-radius: 999px; opacity: .8; transition: opacity .2s, background .2s; white-space: nowrap; }
.main-nav a:hover { opacity: 1; background: rgba(128,128,128,.12); }
.main-nav a[aria-current="page"] { opacity: 1; background: var(--accent); color: #fff; }
.main-nav .nav-cta { background: var(--ink); color: var(--cream); opacity: 1; margin-left: 6px; }
.theme-mystery .main-nav .nav-cta, .theme-scifi .main-nav .nav-cta { background: var(--accent); color: #fff; }
.main-nav .nav-cta:hover { background: var(--accent); }
.nav-sep { width: 1px; height: 20px; background: currentColor; opacity: .2; margin: 0 6px; }
.menu-btn { display: none; background: none; border: 0; color: inherit; cursor: pointer; padding: 8px; }

/* ---------- PAGE HERO (category pages) ---------- */
.page-hero { padding: 150px 0 80px; position: relative; overflow: hidden; }
.page-hero .wrap { position: relative; z-index: 1; }
.page-hero h1 { font-size: clamp(48px, 7.5vw, 104px); letter-spacing: -.03em; margin: 18px 0 20px; line-height: .98; }
.page-hero .lede { font-size: clamp(17px, 1.5vw, 20px); max-width: 620px; opacity: .85; }
.hero-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px; }
.hero-meta span { font: 600 13px/1 var(--sans); padding: 10px 16px; border-radius: 999px; border: 1px solid rgba(128,128,128,.35); }
.breadcrumb { font: 600 13px/1 var(--sans); opacity: .7; }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ---------- BOOK GRID ---------- */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 40px 26px; }
/* Cards are <button>s, which centre their content vertically — force top alignment so covers and titles line up across a row */
.book { text-decoration: none; display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; width: 100%; height: 100%; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.book > * { width: 100%; }
.book .jacket-wrap { position: relative; }
.book .jacket {
  position: relative; aspect-ratio: 2/3; border-radius: 4px 10px 10px 4px; overflow: hidden; background: var(--bg-2);
  box-shadow: 0 22px 34px -18px rgba(0,0,0,.55); transition: transform .45s cubic-bezier(.2,.8,.2,1), box-shadow .45s; transform-origin: left center;
}
.book .jacket::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 9px; z-index: 2; background: linear-gradient(90deg, rgba(0,0,0,.3), rgba(255,255,255,.14), transparent); }
.book .jacket::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, rgba(255,255,255,.18), transparent 40%); pointer-events: none; }
.book .jacket img { width: 100%; height: 100%; object-fit: cover; }
.book .jacket.mockup { background: none; box-shadow: none; border-radius: 0; overflow: visible; }
.book .jacket.mockup::before, .book .jacket.mockup::after { display: none; }
/* 3D mockup (front + back cover): shown whole, standing on the same baseline as the flat covers */
.book .jacket.mockup img { object-fit: contain; object-position: 50% 100%; transform-origin: 53% 95%; transform: translateX(-3%) scale(1.9); }
.book:hover .jacket.mockup, .book:focus-visible .jacket.mockup { transform: translateY(-6px); box-shadow: none; }
.book:hover .jacket, .book:focus-visible .jacket { transform: perspective(900px) rotateY(-12deg) translateY(-6px); box-shadow: 16px 28px 38px -18px rgba(0,0,0,.65); }
.book .num {
  position: absolute; top: 10px; right: 10px; z-index: 3; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 999px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font: 700 13px/1 var(--sans); box-shadow: 0 4px 10px rgba(0,0,0,.3);
}
.book .info { padding-top: 16px; }
.book .series { font: 700 11px/1.3 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book h3 { font-size: 21px; margin: 6px 0 4px; line-height: 1.15; overflow-wrap: anywhere; }
.book .sub { font-size: 14px; opacity: .72; line-height: 1.4; }
.book .yr { font-size: 12.5px; opacity: .6; margin-top: 6px; font-weight: 600; }
.gen-cover {
  width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: space-between; padding: 22px 18px 20px 24px; color: #fff;
  background: radial-gradient(circle at 70% 25%, #3e5bb0, #0b1233 70%);
}
.gen-cover b { font: 600 22px/1.1 var(--display); }
.gen-cover small { font: 700 10px/1 var(--sans); letter-spacing: .22em; text-transform: uppercase; opacity: .8; }

.group + .group { margin-top: 80px; }
.group-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 30px; padding-bottom: 16px; border-bottom: 1px solid rgba(128,128,128,.25); }
.group-head h2 { font-size: clamp(28px, 3.2vw, 40px); }
.group-head p { opacity: .7; font-size: 15px; flex: 1; min-width: 240px; }
.group-head .count { font: 700 12px/1 var(--sans); letter-spacing: .15em; text-transform: uppercase; color: var(--accent); }

/* ---------- BOOK PAGE ---------- */
.bp { padding: 130px 0 70px; }
.bp-crumbs { margin-bottom: 34px; display: flex; flex-wrap: wrap; gap: 6px; }
.bp-crumbs [aria-current] { opacity: .75; }
.bp-grid { display: grid; grid-template-columns: minmax(220px, 360px) 1fr; gap: clamp(32px, 6vw, 80px); align-items: start; }
.bp-art { position: sticky; top: 100px; }
.bp-cover { aspect-ratio: 2/3; border-radius: 6px 14px 14px 6px; overflow: hidden; background: var(--bg-2); box-shadow: 0 40px 60px -26px rgba(0,0,0,.6); view-transition-name: book-cover; position: relative; }
.bp-cover::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 12px; z-index: 2; background: linear-gradient(90deg, rgba(0,0,0,.3), rgba(255,255,255,.14), transparent); }
.bp-cover img { width: 100%; height: 100%; object-fit: cover; }
.bp-cover.mockup { aspect-ratio: 1; background: none; box-shadow: none; border-radius: 0; }
.bp-cover.mockup::before { display: none; }
.bp-cover.mockup img { object-position: 53% 50%; transform: scale(1.3); }
.bp-series { font: 700 12px/1.3 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.bp-title { font-size: clamp(40px, 5.6vw, 76px); letter-spacing: -.025em; }
.bp-sub { font: italic 400 clamp(19px, 2vw, 24px)/1.35 var(--serif); opacity: .8; margin-top: 12px; }
.bp-by { margin-top: 14px; font-weight: 600; opacity: .8; }
.bp-by a { color: var(--accent); }
.bp-facts { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.bp-facts li { font: 600 12.5px/1 var(--sans); padding: 9px 13px; border-radius: 999px; background: var(--bg-2); }
.bp-blurb { margin-top: 28px; font-size: 17px; line-height: 1.75; color: var(--muted); max-width: 68ch; }
.bp-blurb p + p { margin-top: 14px; }
.bp-buy { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 30px; }
.bp-seriesnav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 34px; padding-top: 26px; border-top: 1px solid rgba(128,128,128,.25); }
.bp-seriesnav a { text-decoration: none; padding: 16px 18px; border-radius: 16px; background: var(--bg-2); font: 600 17px/1.3 var(--display); transition: transform .25s, background .25s; }
.bp-seriesnav a:hover { transform: translateY(-3px); }
.bp-seriesnav a small { display: block; font: 700 11px/1 var(--sans); letter-spacing: .15em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.bp-seriesnav .nx { text-align: right; }
.bp-related { padding-top: 40px; }
.bp-related .group-head { justify-content: space-between; align-items: center; }
.bp-all { font-weight: 700; font-size: 14px; color: var(--accent); text-decoration: none; }
.theme-kids.book-page { background: #fff8e8; }
.theme-kids .bp-title { font-family: var(--kid); font-weight: 700; letter-spacing: 0; color: #d0611e; }
.theme-mystery .bp-series, .theme-mystery .bp-seriesnav small { font-family: "Special Elite", monospace; letter-spacing: .1em; color: var(--accent-2); }
.theme-scifi .bp-title { font-weight: 700; letter-spacing: 0; font-size: clamp(32px, 4.4vw, 60px); }
.theme-scifi .bp-seriesnav a, .theme-scifi .bp-facts li { background: rgba(79,209,255,.08); border: 1px solid rgba(79,209,255,.2); }
.theme-historical .bp-title { font-weight: 600; }

/* ---------- 404 ---------- */
.nf { padding: 180px 0 120px; min-height: 70vh; }
.nf h1 { font-size: clamp(44px, 7vw, 96px); margin: 18px 0 20px; }
.nf h1 em { color: var(--accent); font-weight: 300; }
.nf .lede { font-size: 19px; color: var(--muted); }
.nf-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }

/* ---------- PAGE TRANSITIONS ---------- */
@view-transition { navigation: auto; }
/* No page fade: the new page appears as soon as it is ready. Only the book cover morphs. */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-group(book-cover) { animation-duration: .45s; animation-timing-function: cubic-bezier(.2,.8,.2,1); }
.site-header { view-transition-name: site-header; }

/* ---------- FOOTER ---------- */
.site-footer { background: #15110f; color: var(--on-dark-muted); padding: 90px 0 36px; font-size: 14px; }
.foot-top { display: grid; grid-template-columns: 1.3fr repeat(3, 1fr); gap: 40px; }
.foot-name { font: 400 clamp(44px, 6vw, 76px)/.92 var(--serif); color: var(--on-dark); letter-spacing: -.03em; }
.foot-name em { color: var(--amber); }
.foot-tag { margin-top: 18px; max-width: 320px; }
.site-footer .foot-h { font: 700 12px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--on-dark); margin: 8px 0 18px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--gold); }
.foot-credit { margin-top: 18px; text-align: center; font-size: 13px; opacity: .8; }
.foot-credit a { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.foot-bottom {margin-top: 60px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,.08); display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* ---------- NEWSLETTER ---------- */
.newsletter-band { padding: 0 0 80px; }
.nl-card { border-radius: 30px; padding: clamp(32px, 5vw, 60px); display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: center; background: linear-gradient(120deg, var(--amber), var(--rust)); color: var(--ink); position: relative; overflow: hidden; }
.nl-card h2 { font-size: clamp(30px, 3.8vw, 48px); }
.nl-card p { margin-top: 8px; font-weight: 600; opacity: .8; }
.nl-form { display: flex; gap: 8px; background: var(--cream); padding: 7px; border-radius: 999px; }
.nl-form input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0 16px; font: 500 15px var(--sans); color: var(--text); }
.nl-form input:focus { outline: none; }
.nl-form .btn { background: var(--ink); color: var(--cream); }
.nl-msg { grid-column: 2; font-weight: 700; font-size: 14px; margin-top: -12px; padding-left: 18px; min-height: 1em; }

/* ---------- REVEAL ---------- */
.js .reveal { opacity: 0; transform: translateY(36px); transition: opacity .9s cubic-bezier(.2,.8,.2,1), transform .9s cubic-bezier(.2,.8,.2,1); }
.js .reveal.in { opacity: 1; transform: none; }
.d1 { transition-delay: .1s; } .d2 { transition-delay: .2s; } .d3 { transition-delay: .3s; }

/* ==========================================================
   THEMES
   ========================================================== */

/* Mystery — noir case files */
.theme-mystery {
  --bg: #121212; --bg-2: #1c1c1c; --card: #1a1a1a; --text: #e8e4dc; --muted: #a8a196; --accent: #d33a2c; --accent-2: #e8c35a;
  --nav-bg: rgba(18,18,18, .97); --nav-fg: #e8e4dc; --display: "Fraunces", Georgia, serif;
}
.theme-mystery .page-hero { background: radial-gradient(800px 500px at 80% 20%, rgba(211,58,44,.22), transparent 60%), repeating-linear-gradient(90deg, rgba(255,255,255,.025) 0 2px, transparent 2px 90px), #121212; }
.theme-mystery .type { font-family: "Special Elite", "Courier New", monospace; }
.theme-mystery .eyebrow { color: var(--accent-2); font-family: "Special Elite", monospace; letter-spacing: .15em; }
.theme-mystery .book .series { font-family: "Special Elite", monospace; letter-spacing: .08em; color: var(--accent-2); }
.theme-mystery .book .jacket { border-radius: 2px; }
.theme-mystery .btn-primary { background: var(--accent); }
.theme-mystery .btn-ghost:hover { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Science fiction — deep space */
.theme-scifi {
  --bg: #070b1d; --bg-2: #0f1733; --card: #0d1430; --text: #e3ecff; --muted: #9eb0d8; --accent: #4fd1ff; --accent-2: #b28cff;
  --nav-bg: rgba(7,11,29, .97); --nav-fg: #e3ecff; --display: "Orbitron", "Manrope", sans-serif;
}
.theme-scifi h1, .theme-scifi h2 { letter-spacing: .01em; }
.theme-scifi .book h3 { font-family: "Manrope", sans-serif; font-weight: 700; letter-spacing: -.01em; }
.theme-scifi .main-nav a[aria-current="page"] { color: #06122a; }
.theme-scifi .book .num { color: #06122a; }
.theme-scifi .btn-primary { background: var(--accent); color: #06122a; }
.theme-scifi .btn-ghost:hover { background: var(--text); color: var(--bg); border-color: var(--text); }
.theme-scifi .book .jacket { box-shadow: 0 0 0 1px rgba(79,209,255,.25), 0 22px 40px -16px rgba(79,209,255,.35); }
#stars { position: fixed; left: 0; top: 0; width: 100%; height: 200vh; z-index: 0; pointer-events: none; will-change: transform; animation: stars-drift 160s linear infinite; }
@keyframes stars-drift { to { transform: translateY(-50%); } }
.theme-scifi main, .theme-scifi .site-footer { position: relative; z-index: 1; }

/* Historical & romance — parchment and ink */
.theme-historical {
  --bg: #f4ead6; --bg-2: #eadcc0; --card: #fbf4e6; --text: #3a2418; --muted: #6f5646; --accent: #8c2d3a; --accent-2: #b8893a;
  --nav-bg: rgba(244,234,214, .97); --nav-fg: #3a2418; --display: "Cormorant Garamond", Georgia, serif;
}
.theme-historical h1, .theme-historical h2, .theme-historical .book h3 { font-weight: 600; }
.theme-historical .book h3 { font-size: 24px; }
.theme-historical .page-hero { background: radial-gradient(900px 500px at 50% 0%, rgba(184,137,58,.25), transparent 70%), #f4ead6; text-align: center; }
.theme-historical .page-hero .lede { margin-inline: auto; }
.theme-historical .hero-meta { justify-content: center; }
.theme-historical .page-hero .eyebrow::after { content: ""; width: 28px; height: 1.5px; background: currentColor; }

/* Life stories — warm, soft, contemporary */
.theme-life {
  --bg: #f7f3ec; --bg-2: #ece4d6; --card: #fffdf9; --text: #26302b; --muted: #5d6a63; --accent: #3f7a62; --accent-2: #e38b5b;
  --nav-bg: rgba(247,243,236, .97); --nav-fg: #26302b;
}
.theme-life .page-hero { background: radial-gradient(700px 480px at 85% 30%, rgba(227,139,91,.25), transparent 65%), radial-gradient(600px 460px at 0% 100%, rgba(63,122,98,.18), transparent 60%), #f7f3ec; }

/* Children's — handled mostly in page, base tokens here */
.theme-kids { --accent: #ff7a59; --accent-2: #3aa0f0; --nav-bg: rgba(255,255,255, .97); --kid: "Fredoka", "Manrope", system-ui, sans-serif; }
.theme-kids .main-nav a { font-family: var(--kid); font-weight: 500; font-size: 15px; }



/* ---------- BLOG ---------- */
.blog-hero { padding: 150px 0 50px; background: radial-gradient(700px 420px at 85% 20%, rgba(255,201,60,.3), transparent 65%), var(--paper); }
.blog-hero h1 { font-size: clamp(52px, 8vw, 110px); font-weight: 400; letter-spacing: -.03em; margin: 16px 0 14px; line-height: .95; }
.blog-hero h1 em { color: var(--rust); font-weight: 300; }
.blog-hero .lede { font-size: 19px; color: var(--muted); max-width: 560px; }
.blog-list-sec { padding-top: 30px; }
.blog-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px 26px; }
.post-card { display: flex; flex-direction: column; text-decoration: none; color: inherit; background: var(--cream); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; transition: transform .3s, box-shadow .3s; }
.post-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.post-card.featured { grid-column: 1 / -1; flex-direction: row; }
.post-card.featured .post-cover { flex: 1.2; aspect-ratio: auto; min-height: 340px; }
.post-card.featured .post-meta { flex: 1; padding: clamp(24px, 3vw, 44px); justify-content: center; }
.post-card.featured h2 { font-size: clamp(30px, 3.4vw, 44px); }
.post-cover { aspect-ratio: 16/10; background: var(--paper-2); position: relative; overflow: hidden; display: grid; place-items: center; }
.post-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.post-cover-blank { font-size: 46px; color: var(--amber); }
.post-meta { padding: 22px 24px 26px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.post-meta time { font: 700 12px/1 var(--sans); letter-spacing: .15em; text-transform: uppercase; color: var(--rust); }
.post-meta h2 { font-size: 25px; line-height: 1.15; }
.post-meta p { color: var(--muted); font-size: 16px; }
.post-meta .read-more { margin-top: auto; font-weight: 700; color: var(--rust); font-size: 15px; }
.blog-empty { text-align: center; padding: 70px 20px; border: 1px dashed var(--line); border-radius: 24px; background: var(--cream); }
.blog-empty h2 { font-size: clamp(28px, 3vw, 38px); margin-bottom: 10px; }
.blog-empty p { color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 50px; font-weight: 700; }
.pager a { color: var(--rust); text-decoration: none; }

.post-head { padding: 140px 0 30px; }
.wrap.narrow { width: min(780px, 100% - 40px); }
.post-head h1 { font-size: clamp(38px, 5.4vw, 68px); letter-spacing: -.02em; margin: 18px 0 16px; }
.post-byline { color: var(--muted); font-weight: 600; }
.post-byline a { color: var(--rust); }
.draft-flag { display: inline-block; background: #fbe4e2; color: #b3261e; font-weight: 700; font-size: 14px; padding: 8px 14px; border-radius: 999px; margin-bottom: 14px; }
.post-cover-wrap { margin-bottom: 40px; }
.post-cover-img { width: 100%; max-height: 560px; object-fit: cover; border-radius: 26px; box-shadow: var(--shadow); }
.post-body { font-size: 19px; line-height: 1.8; color: #3a2f27; }
.post-body > * + * { margin-top: 1.1em; }
.post-body h2 { font-size: 34px; margin-top: 1.6em; }
.post-body h3 { font-size: 26px; margin-top: 1.4em; }
.post-body a { color: var(--rust); }
.post-body img, .post-body video { max-width: 100%; height: auto; border-radius: 16px; display: block; margin-inline: auto; }
.post-body video { width: 100%; background: #000; }
.post-body iframe { display: block; width: 100%; aspect-ratio: 16/9; height: auto; border: 0; border-radius: 16px; }
.post-body blockquote { margin-left: 0; padding: 6px 0 6px 24px; border-left: 4px solid var(--amber); font: italic 400 23px/1.5 var(--serif); color: var(--ink); }
.post-body ul, .post-body ol { padding-left: 1.4em; }
.post-body .ql-align-center { text-align: center; }
.post-body .ql-align-right { text-align: right; }
.post-body .ql-align-justify { text-align: justify; }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 60px; padding-top: 30px; border-top: 1px solid var(--line); }
.post-nav a { text-decoration: none; padding: 18px 20px; border-radius: 16px; background: var(--paper-2); font: 600 18px/1.3 var(--serif); }
.post-nav a small { display: block; font: 700 11px/1 var(--sans); letter-spacing: .15em; text-transform: uppercase; color: var(--rust); margin-bottom: 8px; }
.post-nav .nx { text-align: right; }
.back-to-blog { margin: 30px 0 80px; font-weight: 700; }
.back-to-blog a { color: var(--rust); text-decoration: none; }

/* ---------- READER REVIEWS (book pages) ---------- */
.bp-reviews { padding-top: 30px; padding-bottom: 30px; }
.bp-reviews .group-head { justify-content: space-between; align-items: center; }
.rv-summary { font-size: 17px; opacity: 1 !important; }
.rv-avg-stars, .rv-stars-show { color: #f0a92b; letter-spacing: 2px; }
.theme-historical .rv-avg-stars, .theme-historical .rv-stars-show { color: #b8893a; }
.rv-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(24px, 4vw, 50px); align-items: start; }
.rv-list { display: grid; gap: 14px; }
.rv-empty { padding: 26px; border: 1px dashed rgba(128,128,128,.4); border-radius: 18px; text-align: center; opacity: .85; }
.rv-card { padding: 20px 22px; border-radius: 18px; background: var(--card); border: 1px solid rgba(128,128,128,.22); }
.rv-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.rv-head strong { font-size: 17px; }
.rv-body { margin-top: 8px; line-height: 1.65; white-space: pre-line; }
.rv-by { margin-top: 10px; font-size: 14px; opacity: .75; font-weight: 600; }
.rv-form { padding: 24px; border-radius: 22px; background: var(--card); border: 1px solid rgba(128,128,128,.22); display: grid; gap: 14px; position: relative; }
.rv-form h3 { font-size: 24px; }
.rv-form label { display: grid; gap: 6px; font-weight: 700; font-size: 14px; }
.rv-form label small { font-weight: 500; opacity: .7; }
.rv-form input:not([type=radio]), .rv-form textarea { font: 500 16px/1.4 var(--sans); padding: 12px 14px; border: 1.5px solid rgba(128,128,128,.35); border-radius: 12px; background: #fff; color: #2b231d; width: 100%; }
.rv-form input:focus, .rv-form textarea:focus { outline: none; border-color: #f0932b; box-shadow: 0 0 0 4px rgba(240,147,43,.2); }
.rv-form .btn { justify-content: center; }
.rv-stars { border: 0; padding: 0; margin: 0; display: flex; flex-direction: row-reverse; justify-content: flex-end; flex-wrap: wrap; gap: 4px; }
.rv-stars legend { font-weight: 700; font-size: 14px; margin-bottom: 6px; width: 100%; }
.rv-stars input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rv-stars label { display: inline-block; font-size: 34px; line-height: 1; color: rgba(128,128,128,.4); cursor: pointer; transition: color .15s, transform .15s; }
.rv-stars label:hover, .rv-stars label:hover ~ label, .rv-stars input:checked ~ label { color: #f0a92b; }
.rv-stars label:hover { transform: scale(1.15); }
.rv-stars input:focus-visible + label { outline: 3px solid #f0932b; border-radius: 4px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.rv-note { font-size: 14px; opacity: .85; }
.rv-note.ok { color: #2f7a4f; opacity: 1; font-weight: 700; }
.rv-note.err { color: #c0392b; opacity: 1; font-weight: 700; }
.theme-mystery .rv-note.ok, .theme-scifi .rv-note.ok { color: #7fe0a6; }
.theme-mystery .rv-note.err, .theme-scifi .rv-note.err { color: #ff8a7a; }
@media (max-width: 900px) {
  .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .post-card.featured { flex-direction: column; }
  .post-card.featured .post-cover { min-height: 0; aspect-ratio: 16/10; flex: none; }
  .rv-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .blog-grid { grid-template-columns: 1fr; }
  .post-nav { grid-template-columns: 1fr; }
  .post-body { font-size: 17.5px; }
}


/* ---------- SHOP: buy buttons, purchase window, order confirmation ---------- */
.btn-buy { background: #2f8f4f; color: #fff; border-color: #2f8f4f; }
.btn-buy:hover { background: #247a40; border-color: #247a40; }
.btn-buy .buy-price { font-weight: 800; opacity: .95; }
.theme-kids .bp-buy .btn-buy { font-family: var(--kid); }
.bcard .face .actions .buy-btn { flex: 0 0 auto; padding-inline: 16px; background: #2f8f4f; box-shadow: 0 5px 0 #1f6b37; }
dialog.buy-dialog { width: min(720px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 24px; background: #fffdf8; color: #2b231d; box-shadow: 0 40px 100px -20px rgba(0,0,0,.6); overflow: auto; max-height: calc(100vh - 32px); font-family: var(--sans); }
dialog.buy-dialog::backdrop { background: rgba(10, 8, 6, .6); }
dialog.buy-dialog[open] { animation: bdIn .3s cubic-bezier(.2,.8,.2,1); }
@keyframes bdIn { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.bd-close { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #f3eadb; color: #2b231d; font-size: 22px; cursor: pointer; z-index: 2; }
.bd-close:hover { background: #c4501f; color: #fff; }
.bd-body { display: grid; grid-template-columns: 210px 1fr; gap: 28px; padding: 30px; margin: 0; }
.bd-cover { background: #fff; border-radius: 12px; overflow: hidden; align-self: start; aspect-ratio: 2/3; box-shadow: 0 24px 30px -18px rgba(0,0,0,.5); }
.bd-cover img { width: 100%; height: 100%; object-fit: cover; }
.bd-kicker { font: 700 12px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: #c4501f; }
.bd-main h2 { font: 600 32px/1.1 var(--serif); margin: 8px 0 4px; color: #1f1a17; }
.bd-each { color: #6e6056; font-weight: 600; }
.bd-qty { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 20px 0 6px; font-weight: 700; }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid #e2d8c8; border-radius: 999px; overflow: hidden; background: #fff; }
.stepper button { width: 44px; height: 44px; border: 0; background: none; font-size: 22px; cursor: pointer; color: #2b231d; }
.stepper button:hover { background: #f3eadb; }
.stepper input { width: 56px; height: 44px; border: 0; text-align: center; font: 700 18px var(--sans); background: none; color: #2b231d; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.bd-sum { margin: 14px 0; padding: 12px 0; border-top: 1px solid #ece3d3; border-bottom: 1px solid #ece3d3; }
.bd-sum div { display: flex; justify-content: space-between; padding: 4px 0; }
.bd-sum dt { color: #6e6056; } .bd-sum dd { margin: 0; font-weight: 600; }
.bd-sum .tot dt, .bd-sum .tot dd { color: #1f1a17; font-weight: 800; font-size: 19px; }
.bd-note { font-size: 14.5px; color: #5c4f45; line-height: 1.5; }
.bd-go { width: 100%; justify-content: center; margin-top: 14px; background: #2f8f4f; }
.bd-go:hover { background: #247a40; }
.bd-go:disabled { opacity: .7; cursor: wait; }
.bd-err { color: #c0392b; font-weight: 700; font-size: 14px; margin-top: 10px; min-height: 1em; }
.bd-secure { font-size: 13px; color: #6e6056; text-align: center; margin-top: 4px; }
.bd-addr, .bd-rates { border: 0; padding: 0; margin: 18px 0 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; min-width: 0; }
.bd-addr legend, .bd-rates legend { font-weight: 800; font-size: 16px; color: #1f1a17; margin-bottom: 10px; padding: 0; }
.bd-addr label { display: grid; gap: 4px; font-size: 13.5px; font-weight: 700; color: #5c4f45; min-width: 0; }
.bd-addr label.full { grid-column: 1 / -1; }
.bd-addr small { font-weight: 500; color: #8a7d72; }
.bd-addr input, .bd-addr select { width: 100%; height: 44px; padding: 0 12px; border: 1.5px solid #e2d8c8; border-radius: 10px; background: #fff; color: #2b231d; font: 500 16px var(--sans); }
.bd-addr input:focus, .bd-addr select:focus { outline: none; border-color: #2f8f4f; box-shadow: 0 0 0 3px rgba(47,143,79,.18); }
.bd-sum .muted-dd { color: #8a7d72; font-weight: 600; font-style: italic; }
.bd-to { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 18px 0 0; padding: 12px 14px; background: #f6f0e4; border-radius: 12px; font-size: 14.5px; line-height: 1.45; }
.bd-to small { display: block; font-weight: 800; color: #6e6056; text-transform: uppercase; letter-spacing: .08em; font-size: 11px; margin-bottom: 2px; }
.bd-back { flex: none; border: 0; background: none; color: #c4501f; font: 700 14px var(--sans); text-decoration: underline; cursor: pointer; padding: 2px; }
.bd-rates { grid-template-columns: 1fr; gap: 8px; }
.bd-rates > div { display: grid; gap: 8px; }
.bd-rate { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid #e2d8c8; border-radius: 12px; background: #fff; cursor: pointer; }
.bd-rate:has(input:checked) { border-color: #2f8f4f; background: #f1f8f2; }
.bd-rate input { accent-color: #2f8f4f; width: 18px; height: 18px; flex: none; }
.bd-rate-name { flex: 1; font-weight: 700; color: #2b231d; min-width: 0; }
.bd-rate-name small { display: block; font-weight: 500; color: #6e6056; font-size: 13px; }
.bd-rate b { color: #1f1a17; }
.shop-toast { position: fixed; left: 50%; bottom: 22px; translate: -50% 0; z-index: 90; background: #1f1a17; color: #fff; padding: 14px 20px; border-radius: 999px; font-weight: 700; box-shadow: 0 16px 30px -10px rgba(0,0,0,.5); }
.order-done { padding: 150px 0 110px; min-height: 70vh; text-align: center; }
.order-done .lede { font-size: 19px; color: var(--muted); max-width: 560px; margin: 0 auto; }
.order-done h1 { font-size: clamp(40px, 6vw, 72px); margin: 14px 0 18px; }
.od-badge { width: 84px; height: 84px; border-radius: 50%; background: #2f8f4f; color: #fff; display: grid; place-items: center; font-size: 42px; margin: 0 auto 18px; box-shadow: 0 16px 30px -12px rgba(47,143,79,.7); }
.od-card { max-width: 480px; margin: 34px auto 30px; text-align: left; background: var(--cream); border: 1px solid var(--line); border-radius: 20px; padding: 22px 24px; }
.od-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); }
.od-row.total { font-weight: 800; font-size: 18px; border-bottom: 0; }
.od-ship { margin-top: 14px; line-height: 1.6; color: var(--muted); }
.od-ship small { display: block; font: 700 11px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--rust); margin-bottom: 8px; }
.order-done .nf-links { justify-content: center; }
@media (max-width: 620px) {
  .bd-body { grid-template-columns: 1fr; padding: 22px; gap: 18px; }
  .bd-cover { width: 130px; }
  .bd-main h2 { font-size: 26px; }
}

/* ==========================================================
   READABILITY ON DARK BACKGROUNDS
   Brighter text and larger sizes wherever the background is dark.
   ========================================================== */
:root { --on-dark: #fffaf0; --on-dark-muted: #efe6d8; }
.theme-mystery { --text: #f8f5ef; --muted: #e6e0d4; }
.theme-scifi { --text: #f4f8ff; --muted: #dde7fb; }
body.theme-mystery, body.theme-scifi { font-size: 17.5px; }
body.theme-mystery .page-hero .lede, body.theme-scifi .page-hero .lede { font-size: clamp(19px, 1.9vw, 23px); line-height: 1.6; opacity: 1; color: var(--text); }
body.theme-mystery .breadcrumb, body.theme-scifi .breadcrumb { font-size: 15px; opacity: 1; }
body.theme-mystery .eyebrow, body.theme-scifi .eyebrow { font-size: 14px; }
body.theme-mystery .section-head p, body.theme-scifi .section-head p,
body.theme-mystery .group-head p, body.theme-scifi .group-head p { font-size: 18.5px; line-height: 1.6; opacity: 1; color: var(--muted); }
body.theme-mystery .book h3, body.theme-scifi .book h3 { font-size: 23px; color: #fff; }
body.theme-mystery .book .sub, body.theme-scifi .book .sub { font-size: 16.5px; opacity: 1; color: var(--muted); }
body.theme-mystery .book .yr, body.theme-scifi .book .yr { font-size: 15px; opacity: 1; color: var(--muted); }
body.theme-mystery .book .series, body.theme-scifi .book .series { font-size: 13px; }
body.theme-mystery .bp-blurb, body.theme-scifi .bp-blurb { font-size: 19px; line-height: 1.75; color: var(--text); }
body.theme-mystery .bp-sub, body.theme-scifi .bp-sub, body.theme-mystery .bp-by, body.theme-scifi .bp-by { opacity: 1; color: var(--muted); }
body.theme-mystery .bp-facts li, body.theme-scifi .bp-facts li { font-size: 14px; color: #fff; }
body.theme-mystery .bp-crumbs [aria-current], body.theme-scifi .bp-crumbs [aria-current] { opacity: 1; }
body.theme-mystery .btn-soon, body.theme-scifi .btn-soon { color: #ece6dc; border-color: rgba(255,255,255,.55); }
body.theme-mystery .main-nav a, body.theme-scifi .main-nav a { opacity: 1; font-size: 15px; }
body.theme-mystery .nl-card p, body.theme-scifi .nl-card p { font-size: 18px; opacity: 1; }
.site-footer { font-size: 16px; color: var(--on-dark-muted); }
.site-footer .foot-tag { font-size: 16.5px; line-height: 1.6; }
.site-footer .foot-h { font-size: 13px; }
.site-footer ul { gap: 12px; }
.foot-credit { font-size: 15px; opacity: 1; }
@media (max-width: 560px) {
  body.theme-mystery .book h3, body.theme-scifi .book h3 { font-size: 19px; }
  body.theme-mystery .book .sub, body.theme-scifi .book .sub { font-size: 15px; }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1180px) {
  .main-nav { display: none; }
  .site-header:has(.main-nav.open) { background: var(--bg); }
  .main-nav.open { display: block; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg); padding: 12px 20px 22px; box-shadow: 0 20px 30px -20px rgba(0,0,0,.4); max-height: calc(100vh - 70px); overflow: auto; }
  .main-nav.open ul { flex-direction: column; align-items: stretch; gap: 2px; }
  .main-nav.open a { font-size: 17px; padding: 14px 14px; }
  .main-nav.open .nav-sep { display: none; }
  .main-nav.open .nav-cta { margin: 8px 0 0; text-align: center; }
  .menu-btn { display: block; }
}
@media (max-width: 900px) {
  .foot-top { grid-template-columns: 1fr 1fr; }
  .foot-top > :first-child { grid-column: 1 / -1; }
  .nl-card { grid-template-columns: 1fr; }
  .nl-msg { grid-column: 1; margin-top: -10px; }
  .bp-grid { grid-template-columns: 1fr; }
  .bp-art { position: static; width: min(260px, 70%); }
  .bp { padding-top: 110px; }
}
@media (max-width: 560px) {
  .wrap { width: calc(100% - 32px); }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px 16px; }
  .book h3 { font-size: 17px; }
  .book .sub { font-size: 13px; }
  .nl-form { flex-direction: column; border-radius: 20px; }
  .nl-form input { padding: 12px 14px; }
  .page-hero { padding: 120px 0 60px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  .js .reveal { opacity: 1; transform: none; }
  @view-transition { navigation: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Video trailer (home + children's page) ---------- */
.trailer { position: relative; aspect-ratio: 16 / 9; border-radius: 22px; overflow: hidden; background: #0e1a33; box-shadow: 0 30px 60px -28px rgba(0,0,0,.55); }
.trailer video { display: block; width: 100%; height: 100%; object-fit: cover; background: #0e1a33; }
.trailer-play { position: absolute; inset: 0; margin: auto; width: 92px; height: 92px; border: 0; border-radius: 50%; cursor: pointer; display: grid; place-items: center;
  background: rgba(255,255,255,.94); color: #e8661d; box-shadow: 0 14px 34px -8px rgba(0,0,0,.5), 0 0 0 10px rgba(255,255,255,.28); transition: transform .2s, box-shadow .2s; }
.trailer-play svg { width: 34px; height: 34px; margin-left: 6px; }
.trailer-play:hover, .trailer-play:focus-visible { transform: scale(1.08); box-shadow: 0 18px 40px -8px rgba(0,0,0,.55), 0 0 0 14px rgba(255,255,255,.35); }
.trailer-badge { position: absolute; left: 16px; bottom: 16px; background: rgba(15,20,40,.72); color: #fff; font: 700 13px/1 var(--sans); padding: 8px 12px; border-radius: 999px; letter-spacing: .02em; pointer-events: none; }
.trailer.playing .trailer-play, .trailer.playing .trailer-badge { display: none; }
@media (max-width: 620px) { .trailer { border-radius: 16px; } .trailer-play { width: 72px; height: 72px; } .trailer-play svg { width: 26px; height: 26px; } }
.trailer-sound { position: absolute; right: 14px; bottom: 14px; z-index: 2; border: 0; cursor: pointer; background: rgba(255,255,255,.95); color: #1f1a17;
  font: 700 14px/1 var(--sans); padding: 11px 16px; border-radius: 999px; box-shadow: 0 8px 20px -6px rgba(0,0,0,.45); animation: trailerPulse 2.2s ease-in-out infinite; }
.trailer-sound:hover, .trailer-sound:focus-visible { background: #fff; transform: scale(1.04); }
.trailer.playing video:not([controls]) { cursor: pointer; }
@keyframes trailerPulse { 0%, 100% { box-shadow: 0 8px 20px -6px rgba(0,0,0,.45), 0 0 0 0 rgba(255,255,255,.55); } 50% { box-shadow: 0 8px 20px -6px rgba(0,0,0,.45), 0 0 0 10px rgba(255,255,255,0); } }
@media (prefers-reduced-motion: reduce) { .trailer-sound { animation: none; } }
