/* BE Puzzle Books — shared stylesheet
   Plain CSS, mobile first. One layout, per-book accent via body theme classes. */

:root {
  --cream: #FBF7EE;
  --cream-2: #F4EDDD;
  --ink: #1F2A24;
  --muted: #4A524D;
  --line: #E6DFCF;
  --field-border: #8F877A;
  --white: #FFFFFF;
  --gold: #E8AE3C;
  --gold-soft: #F6DFA8;
  --rust: #B0452A;

  /* Theme defaults (free pack / brand) */
  --deep: #1E3046;
  --accent: #A8401F;
  --button: #A8401F;
  --button-hover: #8A3318;
  --tint: #F1E2CF;
  --footer-link: #F4C96A;
  --disc: var(--tint);

  --radius: 20px;
  --shadow-card: 0 1px 2px rgba(31, 42, 36, .05), 0 10px 30px rgba(31, 42, 36, .09);
  --font-body: "Nunito", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --font-head: "Zilla Slab", "Rockwell", Georgia, serif;
}

/* Per-book themes, picked from each cover */
.theme-garden  { --deep: #1F3D2B; --accent: #A8441F; --button: #1F3D2B; --button-hover: #15291D; --tint: #E3ECDF; --footer-link: #F4C96A; }
.theme-birds   { --deep: #15263D; --accent: #A3302A; --button: #A3302A; --button-hover: #82241F; --tint: #E1E8F1; --footer-link: #F4C96A; }
.theme-golf    { --deep: #1D4A2B; --accent: #A8441F; --button: #1D4A2B; --button-hover: #133520; --tint: #F1E7CF; --disc: #D6E5C6; --footer-link: #F4C96A; }
.theme-fishing { --deep: #1B2F45; --accent: #136168; --button: #136168; --button-hover: #0D4A50; --tint: #DDEBEA; --footer-link: #F4C96A; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.25rem;          /* 20px */
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 3px; }
p { margin: 0 0 1em; text-wrap: pretty; }
.eyebrow, .gift, .lede { text-wrap: balance; }
h1, h2, h3 { text-wrap: balance; font-family: var(--font-head); color: var(--deep); line-height: 1.15; margin: 0; font-weight: 700; }

:focus-visible {
  outline: 3px solid var(--deep);
  outline-offset: 3px;
  box-shadow: 0 0 0 7px var(--gold-soft);
  border-radius: 6px;
}

.skip-link {
  position: absolute; left: 12px; top: -100px;
  background: var(--deep); color: #fff; padding: 12px 18px; border-radius: 10px;
  font-weight: 700; z-index: 10; text-decoration: none;
}
.skip-link:focus { top: 12px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 18px; }
.narrow { max-width: 640px; margin: 0 auto; }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--line); background: var(--cream); }
.site-header .wrap { display: flex; align-items: center; justify-content: center; min-height: 76px; }
.wordmark {
  display: inline-flex; align-items: center; gap: 12px;
  color: var(--deep); text-decoration: none; padding: 6px 4px;
}
.wordmark-badge {
  display: inline-grid; place-items: center;
  font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; letter-spacing: .04em;
  color: #1E2A3A; background: var(--gold);
  border: 2px solid #1E2A3A; border-radius: 9px;
  padding: 2px 9px 1px; line-height: 1.3;
  box-shadow: inset 0 0 0 2px var(--gold), inset 0 0 0 3px rgba(30, 42, 58, .55), 2px 2px 0 rgba(30, 42, 58, .25);
}
.wordmark-text { font-family: var(--font-head); font-weight: 700; font-size: 1.5rem; letter-spacing: .005em; }
.header-tag { display: none; color: var(--muted); font-size: 1.0625rem; font-weight: 600; }

/* ---------- Hero ---------- */
.hero { padding: 52px 0 10px; overflow-x: clip; }
.hero-grid { display: grid; gap: 30px; justify-items: center; }
.hero-cover { position: relative; width: 190px; }
.hero-cover::before {          /* crisp tinted disc behind the book */
  content: ""; position: absolute; z-index: 0;
  left: 50%; top: 52%; width: 150%; aspect-ratio: 1; transform: translate(-50%, -50%);
  background: var(--disc, var(--tint)); border-radius: 50%;
}
.book {
  position: relative; z-index: 1; display: block;
  border-radius: 3px 7px 7px 3px; overflow: hidden;
  box-shadow: 0 2px 4px rgba(20, 25, 20, .18), 0 14px 28px rgba(20, 25, 20, .22), 0 30px 50px -18px rgba(20, 25, 20, .35);
}
.book::after {                 /* spine highlight so it reads as a real book */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.22) 0, rgba(255,255,255,.18) 1.6%, rgba(0,0,0,.08) 3.2%, rgba(0,0,0,0) 6%);
  pointer-events: none;
}
.book img { width: 100%; }

.hero-text { text-align: center; max-width: 600px; }
.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-weight: 800; font-size: 1.0625rem; letter-spacing: .09em; text-transform: uppercase;
  line-height: 1.4;
}
.hero h1 { font-size: clamp(2.15rem, 1.3rem + 3.6vw, 3.25rem); letter-spacing: -.01em; margin-bottom: 18px; }
.lede { font-size: 1.3125rem; color: var(--ink); margin: 0; }

/* ---------- Benefits ---------- */
.benefits { margin: 30px 0 0; text-align: left; }
.benefits h2 { font-size: 1.5rem; margin-bottom: 14px; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.checklist li { position: relative; padding-left: 46px; min-height: 32px; }
.checklist li::before {
  content: ""; position: absolute; left: 0; top: .1em;
  width: 32px; height: 32px; border-radius: 50%; background: var(--tint);
}
/* Tint the tick in the theme colour */
.checklist li::after {
  content: ""; position: absolute; left: 0; top: .1em; width: 32px; height: 32px;
  background: var(--deep);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.2 4.2L19 7' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 18px no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.2 4.2L19 7' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 18px no-repeat;
}

/* ---------- Sign-up card ---------- */
.signup { padding: 30px 0 18px; }
.card {
  position: relative;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 34px 22px 28px;
  overflow: hidden;
}
.card::before {               /* slim accent bar along the top */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 7px;
  background: linear-gradient(90deg, var(--deep), var(--accent));
}
.card h2 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2rem); margin-bottom: 22px; }

.signup-embed { margin: 0; }

.after-button { margin: 18px 0 0; font-size: 1.125rem; color: var(--ink); }
.after-button strong { font-weight: 700; white-space: nowrap; }
.after-button.after-button-next { margin-top: 10px; }
.signup-embed.is-live ~ .after-button.after-button-next { margin-top: 10px; }
.consent {
  margin: 20px 0 0; padding-top: 18px; border-top: 1px solid var(--line);
  font-size: 1rem; line-height: 1.6; color: var(--muted);
}
.consent a { color: var(--muted); font-weight: 700; }
.gift { text-align: center; font-style: italic; color: var(--muted); font-size: 1.1875rem; margin: 26px 0 0; }

/* ---------- Buttons (404 page, form fallback; the Sender form copies this look) ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; min-height: 66px; margin: 6px 0 0;
  font-family: var(--font-body); font-weight: 800; font-size: 1.375rem; letter-spacing: .01em;
  color: #fff; background: var(--button);
  border: 0; border-radius: 14px; cursor: pointer;
  box-shadow: 0 2px 0 rgba(0,0,0,.18), 0 8px 18px -6px rgba(0,0,0,.35);
  transition: background-color .15s, transform .1s;
  text-decoration: none;
}
.btn:hover { background: var(--button-hover); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 24px; height: 24px; flex: none; }

/* ---------- Sender.net embedded form (live pages) ----------
   Sender renders the form in a same-origin iframe inside <div class="sender-form-field">.
   The form's inner styling lives in /css/sender-form.css, injected into that iframe by
   /js/sender-embed.js. Here we only size the iframe and avoid a flash of Sender's
   default look while it loads. Everything is scoped to .signup-embed. */
.signup-embed.is-live { min-height: 861px; position: relative; }      /* reserve space: no layout jump */
.signup-embed.is-live.is-ready { min-height: 0; }
.signup-embed .sender-form-field { display: block; width: 100%; text-align: left; }
.signup-embed .sender-form-field > div { display: block !important; width: 100% !important; }
.signup-embed .sender-form-field iframe {
  display: block; width: calc(100% + 16px) !important; max-width: none !important; margin: 0 -8px -4px;
  border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
  background: transparent; color-scheme: light;
}
.signup-embed.is-live .sender-form-field { opacity: 0; transition: opacity .25s ease-out; }
.signup-embed.is-live.is-ready .sender-form-field { opacity: 1; }
.signup-fallback { display: none; margin: 0; font-size: 1.1875rem; }
.signup-embed.is-failed { min-height: 0; }
.signup-embed.is-failed .signup-fallback { display: block; }
.signup-embed.is-failed ~ .after-button { margin-top: 18px; }
.signup-fallback .btn { margin-top: 16px; }
.signup-embed.is-live ~ .after-button { margin-top: 0; }
/* After a successful sign-up, Sender shows its "Nearly there!" panel; drop the now-redundant
   card heading and the "we'll email you" line (sender-embed.js adds .is-done). */
.card:has(.signup-embed.is-done) > h2,
.card:has(.signup-embed.is-done) .after-button { display: none; }
.card:has(.signup-embed.is-done) .consent { margin-top: 0; }

/* ---------- Fanned covers (free pack hero) ---------- */
.fan { position: relative; width: min(84vw, 340px); aspect-ratio: 1.38; margin: 0 auto; }
.fan .book { position: absolute; width: 37%; }
.fan .book:nth-child(1) { left: 1%;  top: 15%; transform: rotate(-12deg); }
.fan .book:nth-child(2) { left: 21%; top: 5%;  transform: rotate(-4deg); }
.fan .book:nth-child(3) { left: 42%; top: 5%;  transform: rotate(4deg); }
.fan .book:nth-child(4) { left: 62%; top: 15%; transform: rotate(12deg); }
.hero-cover.is-fan { width: auto; }
.hero-cover.is-fan::before {   /* soft "table" shadow under the fanned books */
  width: 96%; aspect-ratio: auto; height: 20%; top: 88%;
  background: radial-gradient(closest-side, rgba(120, 90, 40, .16), rgba(120, 90, 40, 0));
}

/* ---------- Our books ---------- */
.our-books { padding: 46px 0 14px; }
.our-books h2 { text-align: center; font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.25rem); margin-bottom: 8px; }
.our-books .intro { text-align: center; color: var(--muted); margin: 0 auto 28px; max-width: 34em; }
.book-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 30px 20px; }
.book-tile { text-align: center; display: flex; flex-direction: column; align-items: center; }
.book-tile .store { margin-top: auto; }
.book-tile a.cover-link { display: block; margin: 0 auto 14px; max-width: 170px; border-radius: 4px 8px 8px 4px; }
.book-tile a.cover-link:hover .book { transform: translateY(-3px); }
.book-tile .book { transition: transform .2s; }
.book-tile h3 {
  font-family: var(--font-body); font-weight: 800; font-size: 1.1875rem; color: var(--ink); line-height: 1.3; margin: 0 0 6px;
  min-height: 2.6em; display: flex; align-items: center; justify-content: center;   /* two lines reserved so links line up */
}
.book-tile .store { font-weight: 700; font-size: 1.0625rem; display: inline-block; padding: 6px 4px; }

/* ---------- Simple content pages (privacy, 404) ---------- */
.page { padding: 44px 0 30px; }
.page h1 { font-size: clamp(2.1rem, 1.4rem + 3vw, 3rem); margin-bottom: 26px; }
.prose-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 10px 22px; }
.prose-card section { padding: 20px 0; border-bottom: 1px solid var(--line); }
.prose-card section:last-child { border-bottom: 0; }
.prose-card h2 { font-size: 1.5rem; margin-bottom: 8px; }
.prose-card p { margin: 0; }
.updated { color: var(--muted); font-size: 1.0625rem; margin-top: 20px; text-align: center; }
.notfound { text-align: center; }
.notfound .big { font-family: var(--font-head); font-weight: 700; color: var(--accent); font-size: 1.125rem; letter-spacing: .09em; text-transform: uppercase; margin-bottom: 10px; }
.notfound .lede { margin-bottom: 30px; }
.notfound .btn { max-width: 420px; margin: 0 auto; }
.mini-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; width: 190px; margin: 0 auto 28px; }
.mini-grid span {
  display: grid; place-items: center; aspect-ratio: 1; font-family: var(--font-head); font-weight: 700;
  font-size: 1.25rem; color: var(--deep); background: #fff; border: 1px solid var(--line); border-radius: 6px;
}
.mini-grid span.hit { background: var(--gold-soft); border-color: var(--gold); }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 56px; background: var(--deep); color: #EFE8D8;
  padding: 36px 0 40px; font-size: 1.0625rem; line-height: 1.7; text-align: center;
}
.site-footer a { color: var(--footer-link); }
.footer-brand { font-family: var(--font-head); font-weight: 700; font-size: 1.375rem; color: #fff; margin-bottom: 6px; }
.footer-lines { margin: 0; }
.footer-lines span { display: block; }
.footer-more { margin: 16px 0 0; font-size: 1rem; }
.footer-more a { color: #D9D1C0; }

/* ---------- Larger screens ---------- */
@media (min-width: 560px) {
  .signup-embed.is-live { min-height: 698px; }
  .card { padding: 44px 40px 34px; }
  .prose-card { padding: 14px 40px; }
  .book-grid { gap: 34px 28px; }
}

@media (min-width: 640px) {
  .footer-lines span { display: inline; }
  .footer-lines span + span::before { content: " · "; color: #A9A190; }
}

@media (min-width: 880px) {
  body { font-size: 1.25rem; }
  .site-header .wrap { justify-content: space-between; min-height: 84px; }
  .header-tag { display: block; }
  .hero { padding: 64px 0 24px; }
  .hero-grid { grid-template-columns: 330px 1fr; gap: 72px; align-items: center; justify-items: stretch; }
  .hero-cover { width: 300px; justify-self: center; }
  .hero-cover.is-fan { width: auto; }
  .fan { width: 500px; }
  .hero-text { text-align: left; max-width: none; }
  .benefits { margin-top: 32px; }
  .signup { padding-top: 44px; }
  .book-grid { grid-template-columns: repeat(4, 1fr); }
  .our-books .wrap { max-width: 980px; }
  .hero-grid.has-fan { grid-template-columns: 500px 1fr; gap: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
