:root {
  --wall: #d6ebe2;
  --wall-deep: #c3e0d3;
  --ink: #3e2e22;
  --ink-soft: #6e5a48;
  --on-wall: #2c4439;
  --paper: #fffaf0;
  --wood: #b97a45;
  --wood-light: #d9a06a;
  --wood-dark: #7c4f2a;
  --carrot: #d9691a;
  --carrot-deep: #a94c0b;
  --kraft: #d2ae80;
  --twine: #b3404a;
  --focus: #2a6fb5;
  --display: "Grandstander", "Comic Sans MS", "Chalkboard SE", system-ui, sans-serif;
  --body: "Andika", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --page: min(1160px, 92vw);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --wall: #15302b; --wall-deep: #1c3c35; --on-wall: #dcefe6;
    --ink-soft: #6e5a48; --wood: #8e5a31; --wood-light: #a86d3f; --wood-dark: #55341b;
    --focus: #8cc6ff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --wall: #15302b; --wall-deep: #1c3c35; --on-wall: #dcefe6;
  --wood: #8e5a31; --wood-light: #a86d3f; --wood-dark: #55341b;
  --focus: #8cc6ff; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100svh; display: flex; flex-direction: column;
  background: var(--wall); color: var(--on-wall);
  font-family: var(--body); font-size: 1.125rem; line-height: 1.55;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: var(--page); margin: 0 auto; }
main { flex: 1; }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.site-head { width: var(--page); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 18px 0; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 1.3rem; }
.brand svg { width: 34px; height: 34px; flex: none; }
.site-nav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.site-nav a { display: block; text-decoration: none; font-family: var(--display); font-weight: 600; padding: 6px 14px; border-radius: 999px; }
.site-nav a:hover { background: var(--wall-deep); }
.site-nav a[aria-current="page"] { background: var(--on-wall); color: var(--wall); }

/* ---------- type ---------- */
h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.05; margin: 0; text-wrap: balance; }
.lede { max-width: 36em; margin: 0; font-size: clamp(1.1rem, 1.6vw, 1.3rem); }
.section { padding: clamp(40px, 6vw, 72px) 0 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.section-head h2 { font-size: clamp(1.8rem, 3.4vw, 2.5rem); }
.text-link { font-family: var(--display); font-weight: 600; text-underline-offset: 4px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none; cursor: pointer;
  font-family: var(--display); font-weight: 800; font-size: 1.15rem; line-height: 1;
  padding: 14px 24px; border-radius: 999px; border: 0;
  background: var(--carrot); color: #fffaf0; box-shadow: 0 4px 0 var(--carrot-deep);
}
.btn:hover { background: #e47624; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--carrot-deep); }
.btn svg { width: 22px; height: 22px; flex: none; }
.btn.quiet { background: var(--paper); color: var(--ink); box-shadow: 0 4px 0 rgba(62,46,34,.35); }

/* ---------- hero + shelf ---------- */
.hero { width: 100%; margin: 0 auto; padding: clamp(18px, 4vw, 48px) 0 0; display: grid; gap: 18px; }
.hero h1 { font-size: clamp(3rem, 9vw, 6.6rem); letter-spacing: -.01em; line-height: .92; }
.wordmark { display: grid; justify-items: center; gap: .12em; }
.wordmark-top {
  font-size: clamp(.95rem, 2.4vw, 1.6rem); font-weight: 800; line-height: 1;
  letter-spacing: .3em; text-indent: .3em; /* keeps the spaced text optically centred */
  text-transform: uppercase; color: var(--carrot-deep);
}
.wordmark-name { position: relative; font-size: clamp(3.4rem, 10vw, 7rem); line-height: .9; letter-spacing: -.015em; }
.wordmark-name::after {
  content: ""; display: block; height: .07em; margin: .12em auto 0; width: 78%;
  border-radius: 999px; background: var(--carrot); opacity: .85;
}

.hero-card { background: var(--paper); color: var(--ink); border-radius: 18px; padding: clamp(20px, 4vw, 44px); box-shadow: 0 12px 22px -12px rgba(40,22,8,.45); text-align: center; }
.hero-card .lede { margin: 12px auto 0; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; }
.hero-card .actions { justify-content: center; }  /* the card is centred, so the button is too */

.shelf { width: var(--page); margin: clamp(28px, 5vw, 56px) auto 0; }
.shelf-row {
  display: flex; align-items: flex-end; gap: clamp(14px, 2.4vw, 30px);
  overflow-x: auto; scroll-snap-type: x proximity; padding: 16px 12px 0; margin-bottom: -2px;
  scrollbar-width: thin;
}
.shelf .shelf-row > * { flex: none; width: clamp(132px, 16vw, 188px); scroll-snap-align: start; }
.shelf-plank {
  height: 24px; border-radius: 3px;
  background: linear-gradient(var(--wood-light) 0 5px, var(--wood) 5px 17px, var(--wood-dark) 17px);
  box-shadow: 0 18px 22px -14px rgba(40, 22, 8, .55);
}
.shelf a.cover-link { transition: transform .18s ease-out; }
.shelf a.cover-link:hover, .shelf a.cover-link:focus-visible { transform: translateY(-10px); }

/* ---------- covers ---------- */
.cover-link { display: block; text-decoration: none; border-radius: 4px 10px 10px 4px; }
.cover {
  container-type: inline-size; position: relative; width: 100%; aspect-ratio: 4 / 5;
  background: var(--c, #4f7f3f); color: #fffaf0;
  border-radius: 4px 10px 10px 4px; padding: 9% 9% 9% 14%;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 12px 18px -12px rgba(40, 22, 8, .7);
}
.cover::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 5.5cqi; background: rgba(0,0,0,.24); border-right: 1.2cqi solid rgba(255,255,255,.16); }
.cover-title { font-family: var(--display); font-weight: 800; font-size: 13.5cqi; line-height: .98; }
.cover-sub { display: block; margin-top: 2cqi; font-weight: 600; font-size: 7.6cqi; line-height: 1.12; opacity: .95; }
.cover-art { position: relative; flex: 1 1 auto; min-height: 0; margin-top: 6cqi; border-radius: 7cqi 7cqi 5cqi 5cqi; background: var(--paper); border: 1.6cqi solid rgba(255, 250, 240, .9); overflow: hidden; display: grid; place-items: center; }
.cover-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-emoji { font-size: 34cqi; line-height: 1; }
.cover-num {
  position: absolute; right: 6cqi; bottom: 6cqi; width: 23cqi; aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center; transform: rotate(-9deg);
  background: var(--carrot); color: #fffaf0; border: 1.8cqi solid #fffaf0;
  font-family: var(--display); font-weight: 800; font-size: 12cqi; line-height: 1;
}

/* wrapped parcel for books that are still being written */
.parcel {
  container-type: inline-size; position: relative; width: 100%; aspect-ratio: 4 / 5; border-radius: 6px;
  background:
    linear-gradient(90deg, transparent 45%, var(--twine) 45% 52%, transparent 52%),
    linear-gradient(0deg, transparent 58%, var(--twine) 58% 64%, transparent 64%),
    repeating-linear-gradient(118deg, rgba(90, 60, 25, .07) 0 3px, transparent 3px 11px),
    var(--kraft);
  box-shadow: inset 0 0 0 2px rgba(90, 60, 25, .18), 0 12px 18px -12px rgba(40, 22, 8, .7);
}
.parcel::before, .parcel::after {
  content: ""; position: absolute; top: 30%; width: 22cqi; height: 14cqi;
  border: 3cqi solid var(--twine); border-radius: 50%;
}
.parcel::before { left: 26cqi; transform: rotate(-18deg); }
.parcel::after { left: 51cqi; transform: rotate(18deg); }
.parcel-tag {
  position: absolute; left: 16%; right: 12%; bottom: 10%;
  background: var(--paper); color: var(--ink); border-radius: 4px 14px 14px 4px;
  padding: 5cqi 6cqi 5cqi 13cqi; transform: rotate(-5deg);
  font-family: var(--display); font-weight: 800; font-size: 10cqi; line-height: 1.05;
  box-shadow: 0 3px 6px rgba(40, 22, 8, .25);
}
.parcel-tag::before { content: ""; position: absolute; left: 4.5cqi; top: 50%; width: 5cqi; height: 5cqi; margin-top: -2.5cqi; border-radius: 50%; background: var(--kraft); box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }
.parcel-tag small { display: block; font-family: var(--body); font-weight: 400; font-size: 7.5cqi; color: var(--ink-soft); margin-top: 1cqi; }

/* ---------- featured story ---------- */
.feature {
  display: grid; grid-template-columns: minmax(180px, 280px) 1fr; gap: clamp(22px, 4vw, 56px); align-items: center;
  background: var(--paper); color: var(--ink); border-radius: 18px; padding: clamp(20px, 4vw, 44px);
}
.feature h2 { font-size: clamp(1.9rem, 3.8vw, 3rem); color: var(--ink); }
.feature h2 span { display: block; font-size: .55em; font-weight: 600; margin-top: .3em; line-height: 1.15; }
.feature p { margin: 0; max-width: 34em; }
.feature .from { font-family: var(--display); font-weight: 600; color: var(--ink-soft); margin: 14px 0 10px; }
.feature .from .published { display: block; margin-top: 2px; font-family: var(--body); font-weight: 400; font-size: 1rem; }
.feature .btn { margin-top: 22px; }

/* ---------- series band ---------- */
.series-list { display: grid; gap: clamp(22px, 3vw, 34px); }
.series-band { background: var(--paper); color: var(--ink); border-radius: 18px; padding: clamp(18px, 3vw, 32px); display: grid; gap: 18px; }
.series-top { display: flex; align-items: center; gap: 16px; }
.badge { flex: none; width: 76px; height: 76px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #fff 0 40%, #efe4cf 100%); border: 3px solid var(--ink); overflow: hidden; display: grid; place-items: center; }
.badge img { width: 100%; height: 100%; object-fit: contain; }
.badge .cover-emoji { font-size: 40px; }
.series-top h3 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.series-top h3 a { text-decoration: none; }
.series-top h3 a:hover { text-decoration: underline; text-underline-offset: 5px; }
.series-top p { margin: 4px 0 0; color: var(--ink-soft); max-width: 40em; }
.series-books { display: flex; gap: clamp(14px, 2vw, 24px); overflow-x: auto; padding: 8px 4px 6px; list-style: none; margin: 0; }
.series-books li { flex: none; width: clamp(118px, 14vw, 158px); }

/* ---------- tiles (grids) ---------- */
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(170px, 42vw), 1fr)); gap: clamp(22px, 3vw, 36px) clamp(14px, 2.4vw, 28px); }
.tile { display: grid; gap: 10px; align-content: start; }
.tile-meta strong { display: block; font-family: var(--display); font-weight: 800; font-size: 1.1rem; line-height: 1.15; }
.tile-meta span { display: block; font-size: .95rem; opacity: .85; line-height: 1.3; margin-top: 3px; }
.series-books .tile-meta strong { font-size: 1rem; }

/* ---------- filter chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 30px; padding: 0; list-style: none; }
.chip { font: inherit; font-family: var(--display); font-weight: 600; font-size: 1rem; cursor: pointer; padding: 8px 16px; border-radius: 999px; border: 2px solid currentColor; background: transparent; color: var(--on-wall); }
.chip[aria-pressed="true"] { background: var(--on-wall); color: var(--wall); border-color: var(--on-wall); }
.empty { background: var(--paper); color: var(--ink); border-radius: 14px; padding: 22px; }

/* ---------- series page ---------- */
.series-hero { display: grid; grid-template-columns: auto 1fr; gap: clamp(18px, 3vw, 36px); align-items: center; padding: clamp(18px, 4vw, 40px) 0 0; }
.series-hero .badge { width: clamp(110px, 16vw, 170px); height: clamp(110px, 16vw, 170px); border-width: 4px; }
.series-hero .badge .cover-emoji { font-size: clamp(56px, 8vw, 90px); }
.series-hero h1 { font-size: clamp(2.6rem, 7vw, 5rem); line-height: .95; }
.series-hero .lede { margin-top: 12px; }
.series-hero .btn { margin-top: 20px; }
.book-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.book-row { display: grid; grid-template-columns: clamp(110px, 16vw, 170px) 1fr; gap: clamp(16px, 3vw, 36px); align-items: center; background: var(--paper); color: var(--ink); border-radius: 18px; padding: clamp(16px, 2.6vw, 26px); }
.book-row h2 { font-size: clamp(1.5rem, 2.8vw, 2.1rem); }
.book-row h2 span { display: block; font-size: .6em; font-weight: 600; margin-top: .25em; line-height: 1.15; }
.book-row .num { font-family: var(--display); font-weight: 800; color: var(--carrot-deep); margin: 0 0 4px; }
.book-row p { margin: 10px 0 0; max-width: 36em; }
.book-row .published { margin-top: 6px; font-size: 1rem; color: var(--ink-soft); }
.book-row .btn { margin-top: 16px; font-size: 1.05rem; padding: 12px 20px; }
.soon-note { display: inline-block; margin-top: 14px; font-family: var(--display); font-weight: 600; color: var(--ink-soft); }
.series-index h1 { font-size: clamp(2.6rem, 7vw, 5rem); padding-top: clamp(18px, 4vw, 40px); }

/* ---------- kind note (copyright notice for children) ---------- */
.kind-note {
  position: relative; display: grid; grid-template-columns: auto 1fr; gap: clamp(14px, 3vw, 30px); align-items: start;
  background: var(--paper); color: var(--ink); border-radius: 18px; padding: clamp(26px, 4vw, 46px);
}
.kind-note::before { content: ""; position: absolute; inset: 10px; border: 2.5px dashed var(--wood-light); border-radius: 12px; pointer-events: none; }
.kind-note-icon {
  width: clamp(64px, 9vw, 88px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: #fbe3cf; border: 3px solid var(--ink); font-size: clamp(32px, 4.6vw, 46px); line-height: 1; transform: rotate(-6deg);
}
.kind-note h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); color: var(--carrot-deep); }
.kind-note p { margin: 10px 0 0; max-width: 38em; }
.kind-note .kind-note-hello { font-family: var(--display); font-weight: 800; font-size: 1.25rem; color: var(--carrot-deep); }
.kind-note .kind-note-thanks { font-family: var(--display); font-weight: 800; font-size: 1.2rem; }
.kind-note .fine { margin-top: 16px; font-size: .95rem; color: var(--ink-soft); }

/* ---------- footer ---------- */
.site-foot { margin-top: clamp(56px, 8vw, 96px); }
.site-foot .shelf-plank { border-radius: 0; }
.site-foot p { width: var(--page); margin: 0 auto; padding: 18px 0 28px; font-size: 1rem; }

@media (max-width: 720px) {
  .site-head { padding: 12px 0; }
  .site-nav { width: 100%; }
  .site-nav ul { justify-content: space-between; }
  .site-nav a { padding: 6px 12px; }
  .feature { grid-template-columns: 1fr; }
  .feature .cover-link { width: min(240px, 70%); }
  .series-hero { grid-template-columns: 1fr; }
  .book-row { grid-template-columns: 104px 1fr; align-items: start; }
  .kind-note { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
