:root {
  color-scheme: light;
  font-family: "Fredoka", sans-serif;
  color: #173d4c;
  background: #f7f0df;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --ink: #173d4c;
  --cream: #fff9eb;
  --coral: #e97d62;
}

* { box-sizing: border-box; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(ellipse at 12% 44%, rgba(228,176,105,.13), transparent 31rem), radial-gradient(ellipse at 90% 28%, rgba(88,151,147,.12), transparent 28rem), #f7f0df;
}
button { font: inherit; }
.site-shell { width: min(100% - 48px, 2000px); min-height: 100vh; margin: 0 auto; display: flex; flex-direction: column; }
.site-shell { position: relative; z-index: 1; }
.corner-decoration { position: fixed; z-index: 0; width: clamp(132px, 22vw, 310px); aspect-ratio: 1; background-repeat: no-repeat; background-size: contain; opacity: .88; pointer-events: none; }
.corner-decoration--top-left { top: 0; left: 0; background-image: url("./public/site-top-corner.png"); }
.corner-decoration--top-right { top: 0; right: 0; background-image: url("./public/site-top-corner.png"); transform: scaleX(-1); }
.corner-decoration--bottom-left { bottom: 0; left: 0; background-image: url("./public/site-bottom-corner.png"); transform: scaleX(-1); }
.corner-decoration--bottom-right { right: 0; bottom: 0; background-image: url("./public/site-bottom-corner.png"); }
.masthead { min-height: 92px; display: flex; align-items: center; justify-content: center; }
.wordmark { display: inline-flex; align-items: center; justify-content: center; gap: 0; color: #073b2b; text-decoration: none; font: 700 clamp(30px,3.5vw,44px)/1 "Fredoka", sans-serif; letter-spacing: -.035em; text-align: center; white-space: nowrap; }
.wordmark-question { color: var(--coral); }
.reader-intro { text-align: center; padding: 20px 0 22px; }
.eyebrow { margin: 0; color: #073b2b; font: 600 clamp(19px,2.2vw,27px)/1.2 "Fredoka",sans-serif; letter-spacing: -.02em; }
h1 { margin: 0; font: 600 clamp(30px,3vw,44px)/1.1 "Fredoka",sans-serif; letter-spacing: -.035em; }
.instructions { margin: 7px 0 0; color: #617880; font-size: 15px; }
.reader { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.book-surround { width: 100%; padding: 0; position: relative; }
.book-scene { position: relative; width: 100%; height: min(60vh, 760px, calc((100vw - 96px) / 3)); min-height: 220px; perspective: 2200px; }
#book-window { position: absolute; top: 50%; left: 50%; height: 100%; width: var(--page-width); overflow: hidden; transform: translate(-50%,-50%); transition: width 320ms cubic-bezier(.2,.75,.25,1); }
#book { position: absolute; top: 0; left: 0; margin: 0; box-shadow: 0 28px 55px rgba(32,47,43,.16), 0 7px 16px rgba(32,47,43,.13); transition: left 320ms cubic-bezier(.2,.75,.25,1); }
.book-scene.no-layout-transition #book-window, .book-scene.no-layout-transition #book { transition: none !important; }
#book .turn-page { background: var(--cream); background-position: center; background-size: cover; overflow: hidden; }
#book .turn-page img { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
#book .turn-page.blank-page { background: #fff9eb url("./public/book/blank-page.svg") center / cover no-repeat; }
.book-controls { width: min(100%,1500px); display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 20px; padding: 20px clamp(50px,14vw,235px) 0; }
.turn-button { display: inline-flex; justify-self: start; align-items: center; gap: 9px; min-height: 42px; padding: 0 16px; border: 1px solid rgba(23,61,76,.2); border-radius: 999px; color: var(--ink); background: rgba(255,249,235,.78); cursor: pointer; font-size: 14px; font-weight: 800; transition: background .18s ease, transform .18s ease, opacity .18s ease; }
#previous { grid-column: 1; justify-self: start; }
#next { grid-column: 2; justify-self: end; }
.turn-button span[aria-hidden] { font-size: 20px; line-height: .8; }
.turn-button:hover:not(:disabled) { transform: translateY(-2px); background: #fffdf7; }
.turn-button:focus-visible,.text-button:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
.turn-button:disabled { opacity: .42; cursor: default; }
.reader-footer { display: flex; justify-content: center; align-items: center; padding: 18px 0 24px; }
.download-button { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 20px; border: 1px solid rgba(23,61,76,.2); border-radius: 999px; color: var(--ink); background: rgba(255,249,235,.88); box-shadow: 0 5px 14px rgba(32,47,43,.08); font-size: 15px; font-weight: 700; text-decoration: none; transition: transform .18s ease, background .18s ease; }
.download-button:hover { transform: translateY(-2px); background: #fffdf7; }
.download-button:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
.text-button { padding: 5px 0; border: 0; color: #ba624e; background: transparent; cursor: pointer; font-weight: 800; }
.text-button:hover { text-decoration: underline; }
.load-error { padding: 32px; text-align: center; color: var(--ink); font-weight: 700; }
@media (max-width: 800px) {
  .site-shell { width: min(100% - 28px, 650px); }
  .corner-decoration { width: 128px; opacity: .58; }
  .masthead { min-height: 72px; }
  .wordmark { font-size: clamp(22px,7vw,32px); }
  .reader-intro { padding: 26px 0 20px; }
  .instructions { max-width: 360px; margin: 8px auto 0; font-size: 14px; }
  .book-scene { height: auto; min-height: 0; aspect-ratio: 3/2; }
  #book-window { transition-duration: 0ms; }
  #book { transition-duration: 0ms; }
  .book-controls { padding: 16px clamp(42px,12vw,100px) 0; gap: 6px; }
  .turn-button { min-height: 40px; padding: 0 12px; }
  .button-label { display: none; }
  .reader-footer { padding-top: 17px; }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
