:root {
  --ink: #1c1a17;
  --paper: #faf6f0;
  --paper-2: #f3ece1;
  --accent: #b4622d;
  --accent-deep: #8a4a20;
  --muted: #6f6557;
  --line: #e3d8c8;
  --shadow: 0 12px 40px rgba(60, 40, 20, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 560px; }

h1, h2, h3 { font-family: "Fraunces", Georgia, serif; font-weight: 600; line-height: 1.15; }

a { color: inherit; text-decoration: none; }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: rgba(250, 246, 240, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; position: relative; }
.brand { font-family: "Fraunces", serif; font-size: 26px; font-weight: 600; letter-spacing: -0.5px; display: inline-flex; align-items: center; }
.brand img { height: 34px; display: block; }
.nav nav { display: flex; gap: 24px; align-items: center; }
.nav nav a { color: var(--muted); font-weight: 500; }
.nav nav a:hover { color: var(--ink); }

/* Mobile hamburger — a real <button> with an inline onclick that toggles the
   `.open` class on the nav. Plain JS so it can't be defeated by checkbox /
   label / display quirks across mobile browsers (the earlier checkbox-hack
   left a visible box and didn't fire on touch). Hidden on desktop. */
.nav-burger {
  display: none;
  cursor: pointer;
  width: 44px; height: 44px;
  align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 10px;
  background: transparent; color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}
.nav-burger svg { display: block; }

/* Buttons */
.btn {
  display: inline-block; padding: 12px 22px; border-radius: 999px;
  font-weight: 600; font-size: 15px; cursor: pointer; border: none;
  transition: transform 0.08s ease, box-shadow 0.2s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--accent-deep); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-block { width: 100%; }

/* Hero */
.hero { padding: 96px 0 80px; background: linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%); }
.hero h1 { font-size: 56px; letter-spacing: -1.5px; margin: 0 0 20px; max-width: 14ch; }
.hero h1 span { color: var(--accent); }
.lede { font-size: 20px; color: var(--muted); max-width: 56ch; margin: 0 0 32px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.trust { margin-top: 28px; color: var(--muted); font-size: 14px; letter-spacing: 0.3px; }

/* How */
.how { padding: 80px 0; }
.how h2 { font-size: 36px; text-align: center; margin: 0 0 48px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.step { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.step .num {
  width: 40px; height: 40px; border-radius: 50%; background: var(--paper-2);
  display: grid; place-items: center; font-weight: 700; color: var(--accent); margin-bottom: 14px;
}
.step h3 { font-size: 21px; margin: 0 0 8px; }
.step p { color: var(--muted); margin: 0; }

/* Pricing */
.pricing { padding: 80px 0; background: var(--paper-2); }
.pricing h2 { font-size: 36px; text-align: center; margin: 0 0 8px; }
.pricing .sub { text-align: center; color: var(--muted); margin: 0 0 48px; }
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; align-items: stretch; }
.tier {
  background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 32px 26px;
  display: flex; flex-direction: column;
}
.tier.featured { border-color: var(--accent); box-shadow: var(--shadow); position: relative; }
.tier.featured::before {
  content: "Most popular"; position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 999px;
}
.tier h3 { font-size: 24px; margin: 0 0 4px; }
.tier .price { font-family: "Fraunces", serif; font-size: 40px; font-weight: 600; margin: 8px 0; }
.tier .blurb { color: var(--muted); min-height: 48px; }
.tier ul { list-style: none; padding: 0; margin: 18px 0; flex: 1; }
.tier li { padding: 7px 0 7px 26px; position: relative; color: var(--ink); }
.tier li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.tier .delivery { color: var(--muted); font-size: 14px; margin-bottom: 16px; }

/* Start form */
.start { padding: 80px 0; }
.start h2 { font-size: 36px; text-align: center; margin: 0 0 8px; }
.start .sub { text-align: center; color: var(--muted); margin: 0 0 36px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 32px; box-shadow: var(--shadow); }
.form label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 18px; }
.form input, .form select, .form textarea {
  width: 100%; margin-top: 7px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 16px; font-family: inherit; background: var(--paper);
}
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.fineprint { color: var(--muted); font-size: 13px; text-align: center; margin: 14px 0 0; }
.form-msg { text-align: center; margin-top: 16px; font-weight: 500; min-height: 24px; }
.form-msg.error { color: #b22; }
.form-msg.ok { color: var(--accent-deep); }

/* Why / trust band */
.why { padding: 72px 0; background: var(--paper-2); }
.why h2 { font-size: 34px; text-align: center; margin: 0 0 12px; }
.why .sub { text-align: center; color: var(--muted); margin: 0 auto 44px; max-width: 60ch; }
.why-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.why-card { text-align: center; }
.why-card .ic { font-size: 28px; margin-bottom: 10px; }
.why-card h3 { font-size: 18px; margin: 0 0 6px; }
.why-card p { color: var(--muted); margin: 0; font-size: 15px; }

/* FAQ */
.faq { padding: 72px 0; }
.faq h2 { font-size: 34px; text-align: center; margin: 0 0 40px; }
.faq-item { border-bottom: 1px solid var(--line); padding: 20px 0; max-width: 760px; margin: 0 auto; }
.faq-item h3 { font-size: 19px; margin: 0 0 8px; }
.faq-item p { color: var(--muted); margin: 0; }

/* Footer (professional, multi-column) */
.footer { background: var(--ink); color: #d9cfc0; padding: 56px 0 28px; border-top: none; text-align: left; }
.footer a { color: #d9cfc0; }
.footer a:hover { color: #fff; }
.footer-top { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
.footer-brand .brand { color: #fff; font-size: 26px; display: inline-block; margin-bottom: 10px; }
.footer-brand p { color: #a99e8d; max-width: 32ch; margin: 0; font-size: 14px; }
.footer-col h4 { font-family: "Inter", sans-serif; font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px; color: #a99e8d; margin: 0 0 14px; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin: 0 0 10px; }
.footer-col a { font-size: 15px; }
.footer-bottom {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
  margin-top: 40px; padding-top: 22px; border-top: 1px solid rgba(255,255,255,0.12);
  color: #a99e8d; font-size: 13px;
}
.footer-bottom .pay { color: #a99e8d; }

/* Legal / content pages */
.page { padding: 64px 0 40px; }
.page h1 { font-size: 40px; margin: 0 0 8px; }
.page .updated { color: var(--muted); margin: 0 0 36px; }
.page h2 { font-size: 24px; margin: 36px 0 12px; }
.page p, .page li { color: var(--ink); }
.page ul { padding-left: 22px; }
.page li { margin: 6px 0; }
/* Body links inside a .page section are accent-coloured — but NOT button
   links: `.page a` would otherwise override .btn-primary's white text and
   render brown-on-brown (the invisible "Start your book" button in the blog
   post paywall). Exclude .btn so buttons keep their own colours. */
.page a:not(.btn) { color: var(--accent); }
.page a.btn-primary { color: #fff; }
.page a.btn-ghost { color: var(--ink); }
.page a.btn-ghost:hover { color: var(--accent); }

/* Library / books */
.book-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; margin-top: 24px; }
.book-card { display: block; transition: transform 0.12s ease; }
.book-card:hover { transform: translateY(-4px); }
.book-cover { aspect-ratio: 2/3; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); background: var(--paper-2); border: 1px solid var(--line); }
.book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-fallback { width: 100%; height: 100%; display: grid; place-items: center; text-align: center; padding: 18px; font-family: "Fraunces", serif; font-size: 20px; color: var(--accent-deep); }
.cover-fallback.big { font-size: 30px; }
.book-meta h3 { font-size: 18px; margin: 12px 0 2px; }
.book-meta .byline { color: var(--muted); font-size: 13px; margin: 0; }
.book-price { color: var(--accent); font-weight: 700; margin: 6px 0 0; }

.book-detail { display: grid; grid-template-columns: 300px 1fr; gap: 40px; margin-top: 20px; align-items: start; }
.book-detail-cover { position: sticky; top: 84px; }
.book-detail-cover img, .book-detail-cover .cover-fallback { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 14px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.buy-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-top: 16px; text-align: center; box-shadow: var(--shadow); }
.buy-price { font-family: "Fraunces", serif; font-size: 30px; font-weight: 600; margin: 0 0 12px; }
.book-detail-body h1 { font-size: 38px; margin: 0 0 4px; }
.byline { color: var(--muted); margin: 0 0 16px; }
.blurb-lg { font-size: 18px; color: var(--ink); }
.book-detail-body hr { border: none; border-top: 1px solid var(--line); margin: 24px 0; }
.free-tag { font-family: "Inter", sans-serif; font-size: 12px; background: var(--paper-2); color: var(--accent-deep); padding: 3px 10px; border-radius: 999px; vertical-align: middle; margin-left: 8px; }
.chapter { font-size: 17px; line-height: 1.8; max-width: 64ch; }
.chapter p { margin: 0 0 18px; }
.paywall { margin-top: 28px; padding: 28px; border-radius: 16px; background: linear-gradient(180deg, rgba(180,98,45,0.06), rgba(180,98,45,0.12)); border: 1px solid var(--line); text-align: center; }
.paywall h3 { font-size: 24px; margin: 0 0 8px; }
.paywall p { color: var(--muted); margin: 0 0 18px; }

.muted { color: var(--muted); }
.loading { text-align: center; color: var(--muted); grid-column: 1 / -1; padding: 40px 0; }

@media (max-width: 820px) {
  .hero h1 { font-size: 40px; }
  .steps, .pricing-grid, .why-grid { grid-template-columns: 1fr; }
  .book-grid { grid-template-columns: 1fr 1fr; }
  .book-detail { grid-template-columns: 1fr; }
  .book-detail-cover { position: static; max-width: 260px; }
  .footer-top { grid-template-columns: 1fr 1fr; }

  /* Show the hamburger (pinned far-right); collapse the links into a dropdown
     panel that appears when the button adds `.open` to the nav. */
  .nav-burger { display: inline-flex; margin-left: auto; }
  .nav nav {
    display: none;
    position: absolute; left: 0; right: 0; top: 64px;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
    padding: 8px 0;
  }
  .nav nav.open { display: flex; }
  .nav nav a {
    padding: 14px 24px;
    border-top: 1px solid var(--line);
    color: var(--ink);
  }
  .nav nav a:first-child { border-top: none; }
  .nav nav a.btn { margin: 10px 24px 4px; text-align: center; }
}
