/* Layout: one centred column. Hero = headline beside a cluster of story pebbles joined by a dotted "plot" path;
   then the books (each cover resting on its own pebble), a sign-up block and the author note. */
:root {
  --paper: #FFFDFA;
  --card: #FFFFFF;
  --ink: #1E1B33;
  --ink-soft: #56526E;
  --line: #E6E1EF;
  --chip: #F2EFF8;
  --tomato: #F2502E;
  --sun: #FFC23D;
  --sea: #13A086;
  --cobalt: #3159E8;
  --blush: #FF93B3;
  --on-bright: #1E1B33;
  --btn-bg: #1E1B33;
  --btn-fg: #FFFDFA;
  --dots: rgba(30, 27, 51, 0.11);
  --signup-bg: #3159E8;
  --signup-fg: #FFFFFF;
  --shadow: rgba(24, 20, 48, 0.42);

  --font-display: "Bagel Fat One", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Figtree", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-hand: "Gochi Hand", "Segoe Print", "Comic Sans MS", cursive;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: clamp(2rem, 4.5vw, 3rem);
  --step-4: clamp(2.6rem, 6.4vw, 4.5rem);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15132A; --card: #1E1B36; --ink: #F6F2EA; --ink-soft: #BBB6D1; --line: #2F2B4B; --chip: #29254A;
    --tomato: #FF7556; --sun: #FFCB55; --sea: #2EC2A4; --cobalt: #7491FF; --blush: #FF9FBF;
    --on-bright: #1E1B33; --btn-bg: #F6F2EA; --btn-fg: #15132A; --dots: rgba(246, 242, 234, 0.09);
    --signup-bg: #2840B0; --signup-fg: #FFFFFF; --shadow: rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #15132A; --card: #1E1B36; --ink: #F6F2EA; --ink-soft: #BBB6D1; --line: #2F2B4B; --chip: #29254A;
  --tomato: #FF7556; --sun: #FFCB55; --sea: #2EC2A4; --cobalt: #7491FF; --blush: #FF9FBF;
  --on-bright: #1E1B33; --btn-bg: #F6F2EA; --btn-fg: #15132A; --dots: rgba(246, 242, 234, 0.09);
  --signup-bg: #2840B0; --signup-fg: #FFFFFF; --shadow: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--tomato); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: 1120px; margin-inline: auto; padding-inline: clamp(16px, 4vw, 32px); }

/* ---------- Header ---------- */
.site-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px 28px; padding-block: 20px;
}
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-size: 1.55rem; line-height: 1;
  text-decoration: none; color: var(--ink);
}
.logo svg { width: 40px; height: 34px; flex: none; }
.amp { color: var(--tomato); }
.head-right { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 28px; }
.site-nav ul { display: flex; gap: 22px; list-style: none; margin: 0; padding: 0; }
.site-nav a { text-decoration: none; font-weight: 600; }
.site-nav a:hover { text-decoration: underline; text-decoration-color: var(--tomato); text-decoration-thickness: 3px; text-underline-offset: 5px; }
.store { display: inline-flex; align-items: center; gap: 8px; font-size: var(--step--1); color: var(--ink-soft); font-weight: 600; }
.store-toggle { display: inline-flex; background: var(--chip); border-radius: 999px; padding: 4px; }
.store-toggle button {
  border: 0; background: transparent; font: inherit; font-weight: 700; color: var(--ink-soft);
  padding: 5px 14px; border-radius: 999px; cursor: pointer;
}
.store-toggle button[aria-pressed="true"] { background: var(--sun); color: var(--on-bright); }

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.05fr 0.95fr; align-items: center;
  gap: clamp(20px, 5vw, 64px); padding-block: clamp(20px, 5vw, 56px) clamp(36px, 6vw, 80px);
}
.hero > * { min-width: 0; }
.hero h1 {
  font-family: var(--font-display); font-weight: 400; font-size: var(--step-4);
  line-height: 1.03; letter-spacing: -0.01em; margin: 0 0 22px; text-wrap: balance;
}
.hero h1 .w1 { color: var(--tomato); }
.hero h1 .w2 { color: var(--cobalt); }
.hero h1 .w3 { color: var(--sea); }
.lede { font-size: var(--step-1); color: var(--ink-soft); max-width: 36ch; margin: 0 0 30px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--btn-bg); color: var(--btn-fg); border: 2px solid var(--btn-bg);
  font: inherit; font-weight: 700; text-decoration: none; line-height: 1.2;
  padding: 12px 22px; border-radius: 999px; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 -2px var(--tomato); }
.btn.ghost { background: transparent; color: var(--ink); }
.hero-art { width: 100%; max-width: 480px; justify-self: center; }
.hero-art svg { width: 100%; height: auto; overflow: visible; }
.bob { animation: bob 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.bob.d1 { animation-delay: -1.5s; } .bob.d2 { animation-delay: -3s; } .bob.d3 { animation-delay: -4.5s; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-7px) rotate(1.5deg); } }

/* ---------- Sections ---------- */
.section { padding-block: clamp(40px, 7vw, 88px); }
.section-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 16px 24px; margin-bottom: 32px;
}
.section-head > div { min-width: 0; }
h2 {
  font-family: var(--font-display); font-weight: 400; font-size: var(--step-3);
  line-height: 1.05; margin: 0; text-wrap: balance;
}
.hand {
  display: inline-block; font-family: var(--font-hand); font-size: 1.35rem; line-height: 1.2;
  color: var(--tomato); transform: rotate(-2deg); margin: 0 0 6px;
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters button {
  font: inherit; font-size: var(--step--1); font-weight: 700; cursor: pointer;
  background: transparent; color: var(--ink); border: 2px solid var(--line);
  padding: 7px 16px; border-radius: 999px;
}
.filters button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- Books ---------- */
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 40px 28px; }
.book { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.book-art { position: relative; aspect-ratio: 1 / 1; max-width: 100%; display: grid; place-items: center; }
.book-art .pebble { position: absolute; inset: 0; width: 100%; height: 100%; }
.book-art .pebble use { fill: var(--pebble); }
.cover {
  position: relative; width: auto; height: auto; max-width: 64%; max-height: 80%;
  border-radius: 3px 7px 7px 3px;
  box-shadow: 0 18px 26px -14px var(--shadow), 0 3px 6px -2px var(--shadow);
  transform: rotate(-3deg); transition: transform 0.25s ease;
}
.book:hover .cover, .book:focus-within .cover { transform: rotate(0deg) translateY(-6px); }
.cover-fallback {
  position: relative; width: 58%; aspect-ratio: 3 / 4; display: grid; place-items: center; text-align: center;
  background: var(--card); color: var(--ink); border: 3px solid var(--ink); border-radius: 4px 10px 10px 4px;
  padding: 14px; font-family: var(--font-display); font-size: 1.3rem; line-height: 1.1;
  box-shadow: 0 18px 26px -14px var(--shadow); transform: rotate(-3deg); transition: transform 0.25s ease;
}
.book:hover .cover-fallback { transform: rotate(0deg) translateY(-6px); }
.sticker {
  position: absolute; top: 4%; right: 4%; width: 68px; height: 68px; border-radius: 50%;
  display: grid; place-items: center; background: var(--tomato); color: #FFFFFF;
  font-family: var(--font-display); font-size: 1.05rem; transform: rotate(12deg);
  box-shadow: 0 6px 12px -6px var(--shadow);
}
.book-body { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--chip); color: var(--ink-soft); padding: 4px 10px; border-radius: 999px;
}
.book h3 { font-family: var(--font-display); font-weight: 400; font-size: var(--step-2); line-height: 1.08; margin: 0; text-wrap: balance; }
.book .sub { margin: 2px 0 0; font-weight: 600; color: var(--ink-soft); line-height: 1.35; }
.blurb { margin: 0; color: var(--ink-soft); font-size: 1rem; }
.book-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: auto; padding-top: 6px; }
.alt-link { font-size: var(--step--1); font-weight: 600; color: var(--ink-soft); }
.empty { color: var(--ink-soft); }

/* ---------- Sign-up ---------- */
.signup {
  position: relative; overflow: hidden; border-radius: 36px;
  background: var(--signup-bg); color: var(--signup-fg);
  padding: clamp(28px, 5vw, 56px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px 48px; align-items: center;
}
.signup h2 { color: var(--signup-fg); }
.signup p { margin: 12px 0 0; opacity: 0.92; max-width: 44ch; }
.signup .deco { position: absolute; right: -40px; top: -50px; width: 220px; opacity: 0.16; pointer-events: none; }
.signup .deco path { fill: #FFFFFF; }
.signup form { position: relative; display: grid; gap: 10px; }
.signup label { font-weight: 700; }
.field-row { display: flex; flex-wrap: wrap; gap: 10px; }
.field-row input {
  flex: 1 1 220px; min-width: 0; font: inherit; padding: 13px 18px; border-radius: 999px;
  border: 2px solid transparent; background: #FFFFFF; color: #1E1B33;
}
.field-row input::placeholder { color: #6E6A86; }
.field-row input:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.btn.sun { background: var(--sun); border-color: var(--sun); color: var(--on-bright); }
.btn.sun:hover { box-shadow: 0 6px 0 -2px #FFFFFF; }
.form-note { font-size: var(--step--1); opacity: 0.88; margin: 0; min-height: 1.4em; }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: clamp(24px, 5vw, 56px); align-items: center; }
.portrait { position: relative; aspect-ratio: 1 / 1; max-width: 240px; display: grid; place-items: center; }
.portrait svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.portrait svg path { fill: var(--blush); }
.portrait span { position: relative; font-family: var(--font-display); font-size: 3.4rem; color: var(--on-bright); }
.about p { max-width: 60ch; color: var(--ink-soft); margin: 14px 0 0; }

/* ---------- Footer ---------- */
.site-foot { border-top: 3px dashed var(--line); padding-block: 28px 40px; margin-top: clamp(24px, 5vw, 56px); }
.foot-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; font-size: var(--step--1); color: var(--ink-soft); }
.foot-inner p { margin: 0; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { max-width: 380px; order: -1; }
  .signup { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .about { grid-template-columns: 1fr; }
  .portrait { max-width: 180px; }
  .site-nav ul { gap: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bob { animation: none; }
  .cover, .cover-fallback, .btn { transition: none; }
}

/* ---------- Links on cards ---------- */
a.book-art { text-decoration: none; }
.book h3 a { text-decoration: none; }
.book h3 a:hover { text-decoration: underline; text-decoration-color: var(--tomato); text-decoration-thickness: 3px; text-underline-offset: 4px; }
.foot-books { display: flex; flex-wrap: wrap; gap: 6px 16px; list-style: none; margin: 0; padding: 0; }
.foot-books a { color: var(--ink-soft); }
.foot-inner { align-items: baseline; }

/* ---------- Book page ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: var(--step--1); color: var(--ink-soft); padding-block: 4px 0; }
.crumbs a { color: var(--ink-soft); }
.book-page {
  display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); align-items: start;
  gap: clamp(24px, 5vw, 64px); padding-block: clamp(16px, 4vw, 44px) clamp(32px, 5vw, 64px);
}
.book-page > * { min-width: 0; }
.book-page .book-art { width: 100%; max-width: 460px; justify-self: center; }
.book-page h1 {
  font-family: var(--font-display); font-weight: 400; font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.04; margin: 14px 0 0; text-wrap: balance;
}
.book-page .sub { font-size: var(--step-1); font-weight: 600; color: var(--ink-soft); margin: 8px 0 0; line-height: 1.35; }
.lead { max-width: 58ch; margin: 22px 0 0; }
.lead p { margin: 0 0 14px; }
.lead p:first-child { font-size: var(--step-1); }
.book-page .book-actions { margin-top: 12px; }
.h-small { font-family: var(--font-display); font-weight: 400; font-size: var(--step-2); line-height: 1.1; margin: 40px 0 14px; }
.for-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-width: 58ch; }
.for-list li { position: relative; padding-left: 30px; color: var(--ink-soft); }
.for-list li::before {
  content: ""; position: absolute; left: 0; top: 0.45em; width: 17px; height: 13px;
  border-radius: 52% 48% 55% 45% / 55% 50% 50% 45%; background: var(--pebble);
}
.facts {
  display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 24px;
  margin: 32px 0 0; padding-top: 22px; border-top: 3px dashed var(--line); max-width: 58ch;
}
.facts dt { font-weight: 700; }
.facts dd { margin: 0; color: var(--ink-soft); }
@media (max-width: 760px) {
  .book-page { grid-template-columns: 1fr; }
  .book-page .book-art { max-width: 320px; }
}

