:root {
  --ink: #161616;
  --muted: #5c574e;
  --paper: #f4efe6;
  --sage: #4f6d4f;
  --sage-dark: #3a5439;
  --gold: #b8964a;
  --navy: #0e131c;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
}
.sans { font-family: Calibri, "Segoe UI", system-ui, sans-serif; }
a { color: var(--sage-dark); text-decoration: none; }
a:hover { color: var(--gold); }
.wrap { width: min(1080px, calc(100% - 40px)); margin: 0 auto; }
header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(244,239,230,.94);
  border-bottom: 1px solid #e0d8c8;
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; gap: 16px; flex-wrap: wrap;
}
.logo { letter-spacing: .22em; font-size: 14px; font-weight: 700; color: var(--sage-dark); }
nav { display: flex; flex-wrap: wrap; gap: 6px 14px; }
nav a { font-size: 13px; letter-spacing: .04em; }
.hero {
  padding: 56px 0 28px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 40px;
  align-items: center;
}
.kicker {
  font-family: Calibri, sans-serif;
  letter-spacing: .16em;
  font-size: 11px;
  color: var(--sage);
  text-transform: uppercase;
}
h1 { font-size: clamp(32px, 5vw, 50px); line-height: 1.08; margin: 10px 0 16px; color: var(--sage-dark); }
h2 { font-size: 30px; color: var(--sage-dark); margin: 8px 0 12px; }
.lead { font-size: 18px; color: var(--muted); max-width: 40em; }
.hero img, .card img { width: 100%; display: block; }
.hero img { border-radius: 8px; box-shadow: 0 16px 36px rgba(0,0,0,.18); max-height: 520px; object-fit: cover; }
.btns { margin-top: 26px; display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  font-family: Calibri, sans-serif;
  display: inline-block;
  padding: 11px 18px;
  border-radius: 3px;
  border: 1px solid var(--sage);
  background: var(--sage);
  color: #fff !important;
  letter-spacing: .04em;
  font-size: 14px;
}
.btn.ghost { background: transparent; color: var(--sage-dark) !important; }
section { padding: 52px 0; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
  margin-top: 24px;
}
.card {
  background: #fff;
  border: 1px solid #e3dccf;
  border-radius: 8px;
  overflow: hidden;
}
.card img { height: 280px; object-fit: cover; object-position: top; }
.card.portrait img { height: auto; max-height: none; object-fit: contain; background: #0c1410; }
.card .pad { padding: 14px 16px 18px; }
.card h3 { font-size: 17px; margin-bottom: 4px; }
.card p { font-size: 13px; color: var(--muted); font-family: Calibri, sans-serif; }
.price { color: var(--sage-dark); font-weight: 700; margin-top: 8px; font-family: Calibri, sans-serif; }
.split { display: grid; grid-template-columns: 1.1fr .9fr; gap: 36px; align-items: start; }
.box { background: #fff; border-left: 6px solid var(--gold); padding: 22px 24px; }
.navy { background: var(--navy); color: #ece7db; }
.navy h2, .navy .kicker { color: var(--gold); }
.navy p { color: #c4bba8; }
.navy a { color: var(--gold); }
.navy .card { background: #161b26; border-color: #2a3140; color: #ece7db; }
.navy .card h3 { color: #f3ead8; }
.navy .card p { color: #b7ae9d; }
.quote {
  margin-top: 18px;
  border-left: 4px solid var(--gold);
  padding: 8px 0 8px 16px;
  color: var(--ink);
  font-style: italic;
}
.soon { margin: 28px 0 8px; font-family: Calibri, sans-serif; color: var(--sage-dark); }
.page { padding: 48px 0 72px; }
.page h1 { font-size: 36px; }
.page p, .page li { margin: 10px 0; color: var(--muted); }
.page ul { padding-left: 18px; }
footer {
  background: var(--navy);
  color: #b7ae9d;
  padding: 36px 0 28px;
  font-family: Calibri, sans-serif;
  font-size: 14px;
}
footer a { color: #e6d7b0; }
footer strong { color: #fff; letter-spacing: .18em; }
.footgrid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 22px;
}
.footgrid a, .footgrid p { display: block; margin: 6px 0; }
.copy { margin-top: 22px; border-top: 1px solid #2a3140; padding-top: 14px; font-size: 13px; }
@media (max-width: 800px) {
  .hero, .split, .footgrid { grid-template-columns: 1fr; }
}

.bookcover { background: #f7f1e6; border: 1px solid #e3dccf; }
.bookcover img { height: 280px; width: 100%; object-fit: contain; object-position: center; background: #f7f1e6; }
.dropbtn {
  background: none; border: 0; color: #e6d7b0; font: inherit;
  padding: 6px 0; cursor: pointer; letter-spacing: .04em;
}
.drop { margin: 4px 0 10px; }
.drop a { display: inline-block; margin-right: 10px; }
.icons a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; margin: 6px 8px 0 0;
  border: 1px solid #e6d7b0; border-radius: 50%;
  color: #e6d7b0; font-size: 12px; font-family: Calibri, sans-serif;
}

.testimonial { margin: 18px 0 6px; padding: 14px 18px; border-left: 4px solid var(--gold); background: rgba(184,150,74,.08); font-style: italic; color: var(--ink); }
.testimonial p { margin: 0 0 6px; }
.testimonial cite { font-style: normal; font-size: 14px; color: var(--muted); }

/* ---------- v2: page helpers ---------- */
nav a[aria-current="page"] { color: var(--gold); }
.page h2 { font-size: 22px; margin: 26px 0 6px; }
.page code { font-size: 14px; background: rgba(184,150,74,.1); padding: 1px 5px; border-radius: 3px; }

/* ---------- v2: homepage hero (one screen) ----------
   To add a background picture later, set --hero-bg on .hero-screen
   (or in :root) and add the class "has-bg", e.g.
   .hero-screen { --hero-bg: url("img/hero.jpg"); }
   <section class="vision hero-screen has-bg">  */
body.home { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body.home main { flex: 1; display: flex; }
.hero-screen {
  --hero-bg: none;
  --hero-overlay: rgba(244,239,230,.72);
  flex: 1; position: relative;
  display: grid; place-items: center;
  padding: 32px 20px;
  background-color: var(--paper);
  background-image: var(--hero-bg);
  background-size: cover; background-position: center;
}
.hero-screen.has-bg::before { content: ""; position: absolute; inset: 0; background: var(--hero-overlay); }
.hero-screen > * { position: relative; }
.footbar { background: var(--navy); color: #b7ae9d; font-size: 13px; padding: 12px 0; }
.footbar-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 18px; }
.footbar-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.footbar a { color: #e6d7b0; }

/* ---------- v2: mobile menu ---------- */
.menu-toggle {
  display: none; background: none; border: 1px solid #d8cfbd; border-radius: 3px;
  width: 40px; height: 34px; padding: 8px 9px; cursor: pointer;
  flex-direction: column; justify-content: space-between;
}
.menu-toggle span { display: block; height: 2px; background: var(--sage-dark); border-radius: 1px; transition: transform .25s ease, opacity .2s ease; }
.nav.open .menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav.open .menu-toggle span:nth-child(2) { opacity: 0; }
.nav.open .menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
@media (max-width: 800px) {
  header .nav { position: relative; flex-wrap: nowrap; }
  .menu-toggle { display: flex; }
  header nav {
    position: absolute; top: 100%; left: -20px; right: -20px;
    flex-direction: column; gap: 0;
    background: var(--paper); border-bottom: 1px solid #e0d8c8;
    box-shadow: 0 10px 24px rgba(0,0,0,.08);
    max-height: 0; overflow: hidden; visibility: hidden;
    transition: max-height .3s ease, visibility .3s;
  }
  header .nav.open nav { max-height: 420px; visibility: visible; }
  header nav a { padding: 13px 20px; font-size: 15px; border-top: 1px solid #ebe4d6; }
  .hero-screen { padding: 28px 18px; }
  .vision p { font-size: 16px !important; }
}

/* ---------- v2: cookie consent ---------- */
.cookie-banner {
  position: fixed; left: 50%; bottom: 18px; z-index: 60;
  width: min(720px, calc(100% - 28px));
  transform: translate(-50%, 12px); opacity: 0;
  transition: opacity .45s ease, transform .45s ease;
  background: #fffdf8; color: var(--ink);
  border: 1px solid #e3dccf; border-top: 3px solid var(--gold); border-radius: 8px;
  box-shadow: 0 14px 34px rgba(0,0,0,.14);
  padding: 16px 18px; font-size: 14px; line-height: 1.5;
}
.cookie-banner.show { opacity: 1; transform: translate(-50%, 0); }
.cookie-banner[hidden] { display: none; }
.cookie-text { color: var(--muted); }
.cookie-text a { text-decoration: underline; }
.cookie-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cookie-banner .btn { padding: 8px 14px; font-size: 13px; cursor: pointer; }
.cookie-panel { margin-top: 12px; padding-top: 10px; border-top: 1px solid #ebe4d6; }
.cookie-panel[hidden] { display: none; }
.cookie-opt { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; color: var(--muted); cursor: pointer; }
.cookie-opt input { margin-top: 4px; accent-color: var(--sage); width: 16px; height: 16px; flex: none; }
.cookie-opt strong { color: var(--sage-dark); }
.cookie-link {
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
  color: #e6d7b0; letter-spacing: inherit; text-align: left;
}
.cookie-link:hover { color: var(--gold); }
.cookie-link.inline { color: var(--sage-dark); text-decoration: underline; }
@media (max-width: 520px) {
  .cookie-banner { bottom: 10px; padding: 14px; }
  .cookie-main .btn { flex: 1; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  .cookie-banner, header nav, .menu-toggle span { transition: none; }
}

/* ---------- v3: book shelf ---------- */
.grid.shelf { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.book-card { transition: transform .2s ease, box-shadow .2s ease; }
.book-card:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(0,0,0,.12); }
.book-open {
  display: flex; flex-direction: column; justify-content: flex-start;
  width: 100%; height: 100%; padding: 0; border: 0; background: none;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.book-open:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 8px; }
.grid.shelf { --cover-ratio: 2 / 3; }
.grid.shelf.tall { --cover-ratio: 616 / 1000; }
#shelf, #books { scroll-margin-top: 64px; }
.book-cover { display: block; aspect-ratio: var(--cover-ratio); overflow: hidden; background: #0c1410; }
.card .book-cover img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.book-card .pad { display: block; }
.book-title { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 17px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.book-sub { display: block; font-size: 13px; color: var(--muted); font-family: Calibri, sans-serif; letter-spacing: .04em; }
.type-cover {
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px;
  width: 100%; height: 100%; padding: 18px; text-align: center;
  background: var(--navy); color: var(--gold); border: 1px solid #2a3140;
}
.tc-title { font-family: Georgia, serif; font-size: 24px; line-height: 1.15; color: #e6d7b0; }
.tc-mark { font-family: Calibri, sans-serif; letter-spacing: .22em; font-size: 12px; font-weight: 700; }
.tc-soon { font-family: Calibri, sans-serif; letter-spacing: .12em; font-size: 11px; text-transform: uppercase; color: #b7ae9d; }

/* ---------- v3: book detail view ---------- */
html.dialog-open { overflow: hidden; }
.book-dialog {
  border: 0; padding: 0; margin: auto; background: transparent;
  width: min(880px, calc(100% - 32px)); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  overflow: visible;
}
.book-dialog::backdrop { background: rgba(14,19,28,.55); }
.book-dialog[open] { animation: bookIn .28s ease; }
@keyframes bookIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.book-dialog-inner {
  position: relative; display: grid; grid-template-columns: 300px 1fr; gap: 30px;
  background: var(--paper); color: var(--ink);
  border: 1px solid #e3dccf; border-top: 4px solid var(--gold); border-radius: 10px;
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
  padding: 30px; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); overflow-y: auto;
}
.book-dialog-cover { border-radius: 6px; overflow: hidden; box-shadow: 0 12px 28px rgba(0,0,0,.2); align-self: start; }
.book-dialog-cover img { width: 100%; height: auto; display: block; }
.book-dialog-cover .type-cover { aspect-ratio: 2 / 3; }
.book-dialog-text h2 { margin-top: 6px; }
.book-dialog-text .lead { font-size: 17px; }
.book-dialog .btns { margin-top: 22px; }
.book-dialog .btn { cursor: pointer; }
.book-close {
  position: absolute; top: 10px; right: 12px; width: 38px; height: 38px;
  border: 1px solid #d8cfbd; border-radius: 50%; background: #fffdf8;
  color: var(--sage-dark); font-size: 24px; line-height: 1; cursor: pointer;
}
.book-close:hover { color: var(--gold); border-color: var(--gold); }
.book-close:focus-visible, .book-dialog .btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
@media (max-width: 700px) {
  .book-dialog-inner { grid-template-columns: 1fr; gap: 18px; padding: 22px 18px; }
  .book-dialog-cover { width: 150px; }
  .book-dialog-text h2 { font-size: 25px; }
}
@media (max-width: 520px) {
  .grid.shelf { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .book-title { font-size: 15px; }
  .tc-title { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  .book-card, .book-dialog[open] { transition: none; animation: none; }
}

/* ---------- v4: accessibility ---------- */
.kicker { color: var(--sage-dark); }
:focus-visible { outline: 3px solid var(--sage-dark); outline-offset: 3px; }
footer :focus-visible, .footbar :focus-visible, .navy :focus-visible { outline-color: var(--gold); }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.page .btns { margin-top: 28px; }

/* ---------- v4: homepage sound control ---------- */
.sound-ctrl { position: absolute; right: 22px; bottom: 18px; display: flex; gap: 8px; }
.sound-btn {
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--sage); background: rgba(255,253,248,.85); color: var(--sage-dark);
  transition: background .2s ease, color .2s ease;
}
.sound-btn:hover { background: var(--sage); color: #fff; }
.sound-btn .i-pause, .sound-btn.is-playing .i-play { display: none; }
.sound-btn.is-playing .i-pause { display: inline; }
.sound-btn .i-off, .sound-btn.is-muted .i-on { display: none; }
.sound-btn.is-muted .i-off { display: inline; }
@media (max-width: 520px) { .sound-ctrl { right: 14px; bottom: 12px; } .sound-btn { width: 34px; height: 34px; } }

/* ---------- v4: hero background, ready for later ----------
   To switch on: add class "has-bg" to the homepage section and set the image:
   .hero-screen.has-bg { --hero-bg: url("img/hero-bg.jpg"); }
   The cream overlay is strongest behind the text so the green stays readable. */
.hero-screen.has-bg {
  --hero-overlay: radial-gradient(ellipse 70% 75% at 50% 50%, rgba(244,239,230,.9) 0%, rgba(244,239,230,.84) 55%, rgba(244,239,230,.62) 100%);
}
.hero-screen.has-bg .vision-inner p:not(.words) { color: var(--sage-dark); }

/* ---------- v5: homepage background photo ----------
   Default: img/hero-bg.* (Picture 2). One-line swap to Picture 1:
   in index.html add "bg-alt" to the section: class="vision hero-screen has-bg bg-alt"  */
.hero-screen.has-bg {
  --hero-bg: url("img/hero-bg.jpg");
  --hero-overlay: radial-gradient(ellipse 56% 60% at 50% 50%, rgba(244,239,230,.74) 0%, rgba(244,239,230,.70) 62%, rgba(244,239,230,.34) 84%, rgba(244,239,230,.06) 100%);
  background-position: 50% 55%;
}
.hero-screen.has-bg.bg-alt { --hero-bg: url("img/hero-bg-alt.jpg"); }
/* a soft cream halo right behind the letters keeps them crisp over the busier parts of the photo */
.hero-screen.has-bg .vision-inner p, .hero-screen.has-bg .vision-inner h1 {
  text-shadow: 0 0 2px rgba(244,239,230,1), 0 0 8px rgba(244,239,230,.95), 0 0 16px rgba(244,239,230,.85), 0 0 28px rgba(244,239,230,.6);
}
@supports (background-image: image-set(url("x.webp") type("image/webp"))) {
  .hero-screen.has-bg { --hero-bg: image-set(url("img/hero-bg.webp") type("image/webp"), url("img/hero-bg.jpg") type("image/jpeg")); }
  .hero-screen.has-bg.bg-alt { --hero-bg: image-set(url("img/hero-bg-alt.webp") type("image/webp"), url("img/hero-bg-alt.jpg") type("image/jpeg")); }
}
@media (max-width: 600px) {
  .hero-screen.has-bg {
    background-position: 32% 50%;
    --hero-overlay: radial-gradient(ellipse 105% 52% at 50% 50%, rgba(244,239,230,.76) 0%, rgba(244,239,230,.72) 62%, rgba(244,239,230,.42) 86%, rgba(244,239,230,.15) 100%);
  }
}
