:root {
  color-scheme: light;
  --paper: #f9f5e8;
  --ink: #203d2e;
  --muted: #4d5e50;
  --line: #d9d8c1;
  --gold: #edc85f;
  --forest: #315543;
  --serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", SimSun, serif;
  --sans: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, summary { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #ad4b2e; outline-offset: 4px; }
h1:focus { outline: none; }
.shell { width: min(100% - 64px, 1140px); margin-inline: auto; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 86px;
  border-bottom: 1px solid var(--line);
}

.brand, .text-button { border: 0; background: transparent; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 4px 0;
  font: 800 23px var(--serif);
}
.text-button {
  min-height: 44px;
  padding: 6px 4px;
  font-weight: 650;
}
.text-button:hover { text-decoration: underline; text-underline-offset: 5px; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.87fr) minmax(0, 1.13fr);
  align-items: center;
  gap: clamp(28px, 5.6vw, 84px);
  padding: clamp(34px, 6vw, 88px) 0 48px;
}
.intro h1, .view h1 {
  margin: 0;
  font: 800 clamp(42px, 5.8vw, 80px) / 1.16 var(--serif);
  letter-spacing: -0.035em;
}
.intro p {
  margin: 22px 0 30px;
  font-size: clamp(16px, 1.7vw, 19px);
  line-height: 1.65;
  color: var(--muted);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.button {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 750;
  text-align: center;
}
.primary { background: var(--gold); color: #2b3827; }
.primary:hover { background: #f3d477; }
.secondary { border-color: #a8ad98; background: transparent; }
.secondary:hover { background: #eeeedd; }
.button:disabled { opacity: 0.5; }

.book-display {
  position: relative;
  isolation: isolate;
  min-height: clamp(360px, 45vw, 565px);
  display: grid;
  place-items: center;
  border-radius: 47% 47% 22px 22px / 32% 32% 22px 22px;
  background: radial-gradient(ellipse at 53% 10%, #54725a, var(--forest) 69%);
  overflow: hidden;
}
.book-display::after {
  position: absolute;
  inset: 12px;
  z-index: -1;
  border: 1px solid #ffffff23;
  border-radius: inherit;
  content: "";
}
.spark { position: absolute; color: #f4d47d; line-height: 1; }
.spark-top { top: 24%; right: 12%; font-size: 33px; }
.spark-bottom { bottom: 15%; left: 11%; font-size: 30px; }

.book-cover {
  position: relative;
  width: min(62%, 335px);
  aspect-ratio: 0.82;
  padding: 0;
  border: 4px solid #e7cd95;
  border-radius: 7px 16px 16px 7px;
  background: #e6d6ac;
  transform: rotate(-7deg);
  box-shadow: -5px 5px 0 #bbb17f, 7px 9px 0 #172f23a6, 14px 32px 55px #142f27a3;
  overflow: hidden;
  transition: transform 240ms cubic-bezier(.16,1,.3,1);
}
.book-cover:hover { transform: rotate(-3deg) translateY(-5px); }
.book-cover::after {
  position: absolute;
  inset: 0 auto 0 7px;
  width: 2px;
  content: "";
  background: #4d3c2d38;
}
.illustration {
  background-color: #e2d4a8;
  background-image: url("./assets/kindergarten.jpg");
  background-size: 300% 200%;
  background-position: var(--scene-x, 0%) var(--scene-y, 0%);
  background-repeat: no-repeat;
}
[data-scene="1"], [data-scene="4"] { --scene-x: 50%; }
[data-scene="2"], [data-scene="5"] { --scene-x: 100%; }
[data-scene="3"], [data-scene="4"], [data-scene="5"] { --scene-y: 100%; }
.cover-art { position: absolute; inset: 0 0 auto; aspect-ratio: 1; }
.book-title {
  position: absolute;
  inset: auto 0 0;
  padding: 19px 14px 20px;
  background: #f3e8c4;
  text-align: left;
  font: 800 clamp(23px, 3.5vw, 45px) / 1.04 var(--serif);
}

.view { max-width: 900px; margin: 0 auto; padding: 16px 0 40px; }
.view-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.view h1 {
  margin-block: 21px 24px;
  font-size: clamp(29px, 4.5vw, 48px);
  overflow-wrap: anywhere;
}
.spread {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: clamp(20px, 4.4vw, 58px);
  border-block: 1px solid var(--line);
  padding-block: 20px;
}
.page-art {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border: none;
  border-radius: 16px 26px 26px 16px;
  touch-action: pan-y;
}
.page-copy h2 { margin: 0; font: 800 clamp(26px, 3.7vw, 42px) / 1.2 var(--serif); }
.page-copy p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: clamp(17px, 2.15vw, 22px);
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.page-copy p.page-count { margin: 0 0 12px; font-size: 13px; font-variant-numeric: tabular-nums; }
.page-copy p.page-question { padding-block-start: 10px; color: var(--ink); font-size: 16px; font-weight: 650; }
.reader-controls { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }
.reader-tail { margin-block-start: 12px; text-align: center; }
.feedback { margin: 0; color: var(--muted); font-size: 14px; }

.maker-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(28px, 6vw, 72px);
  margin-top: 16px;
}
.cover-preview {
  overflow: hidden;
  border: 1px solid #d4c892;
  border-radius: 14px;
  background: #f3e8c4;
}
.cover-preview .illustration { aspect-ratio: 1; }
.cover-preview span {
  display: block;
  padding: 14px 15px 16px;
  font: 800 clamp(22px, 3.3vw, 32px) / 1.3 var(--serif);
  overflow-wrap: anywhere;
}
.maker h1 { margin-top: 0; margin-bottom: 10px; }
.maker-note { color: var(--muted); line-height: 1.6; margin: 0 0 20px; }
form label { display: block; margin: 0 0 6px; font-weight: 680; }
form input {
  display: block;
  width: 100%;
  min-height: 48px;
  border: 1px solid #a8ad98;
  border-radius: 12px;
  padding: 10px 13px;
  background: #fffcf3;
  color: var(--ink);
  font-size: 16px;
}
form details { margin: 10px 0 16px; }
form summary { min-height: 44px; padding: 11px 0; font-weight: 650; cursor: pointer; }
.details-fields { padding-top: 4px; }
.details-fields input { margin-bottom: 12px; }

@media (max-width: 750px) {
  .shell { width: min(100% - 36px, 540px); }
  .site-header { min-height: 64px; }
  .brand { font-size: 21px; }
  .brand img { width: 34px; height: 34px; }
  .hero { grid-template-columns: 1fr; grid-template-rows: auto auto; gap: 0; padding: 24px 0 30px; }
  .intro { display: contents; }
  .intro h1 { grid-row: 1; font-size: clamp(32px, 8.5vw, 50px); }
  .intro p { grid-row: 2; margin: 8px 0 18px; font-size: 15px; }
  .book-display { grid-row: 3; min-height: clamp(285px, 85vw, 410px); }
  .book-cover { width: min(61%, 255px); }
  .book-title { padding: 14px; font-size: clamp(26px, 7vw, 38px); }
  .hero-actions { grid-row: 4; margin-top: 16px; }
  .hero-actions .button { flex: 1; padding-inline: 10px; white-space: nowrap; }
  .spread { grid-template-columns: 1fr; gap: 16px; padding-block: 14px; }
  .page-art { width: min(100%, 430px); margin-inline: auto; }
  .page-copy p { margin-top: 8px; }
  .page-copy p.page-count { margin-bottom: 5px; }
  .maker-grid { grid-template-columns: 1fr; gap: 18px; margin-top: 7px; }
  .cover-preview { display: flex; align-items: center; }
  .cover-preview .illustration { width: 104px; flex: none; }
  .maker-note { margin-bottom: 12px; }
}

@media (max-width: 350px) {
  .shell { width: calc(100% - 24px); }
  .book-display { min-height: 260px; }
  .hero-actions .button { font-size: 14px; }
  .book-title { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .book-cover { transition: none; }
}
