:root {
  color-scheme: light;
  --paper: #faf5e9;
  --background: #eee9df;
  --ink: #393c30;
  --muted: #6f7163;
  --red: #a33f32;
  --green: #4c5b45;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  color: var(--ink);
  background: var(--background);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at 50% 35%, #f8f4eb 0%, var(--background) 75%);
}
button, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-underline-offset: 4px; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 5px; }
.visually-hidden, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link:focus { position: fixed; top: 12px; left: 12px; z-index: 10; padding: 12px; background: var(--paper); }
.enhanced-only { display: none; }
body[data-reader-ready] .enhanced-only { display: flex; }
.site-header {
  width: 100%;
  padding: 26px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.home-link { font-size: 17px; text-decoration: none; }
.home-link span { margin-right: 8px; color: var(--muted); }
.home-link:hover { color: var(--red); }
.header-note { color: var(--muted); font-size: 14px; font-style: italic; }
.reader {
  width: min(1200px, calc(100% - 64px));
  margin: auto;
  padding: 20px 0 12px;
}
.reader-heading {
  min-height: 44px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.eyebrow {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--green);
}
.page-picker { align-items: center; gap: 12px; font-size: 12px; color: var(--muted); }
.page-picker label { white-space: nowrap; font-style: italic; }
.page-picker select {
  max-width: 205px;
  min-height: 36px;
  padding: 5px 24px 5px 10px;
  color: var(--ink);
  background: transparent;
  border: 1px solid #cdcbbd;
  border-radius: 4px;
}
.book-stage {
  display: grid;
  align-items: center;
  justify-items: center;
  min-height: 500px;
  touch-action: pan-y pinch-zoom;
}
.book {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  margin: 0 0 40px;
  background: var(--paper);
  border-radius: 3px 6px 6px 3px;
  box-shadow: 0 24px 48px -20px #40382655, 0 4px 8px #40382615, 0 0 0 1px #635b3f18;
}
body[data-reader-ready] .book { margin-bottom: 0; }
.book:not(.book--cover)::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 30px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, #6c604710 45%, #6c60471c 50%, #6c604709 57%, transparent);
  pointer-events: none;
}
.book-page { position: relative; min-width: 0; }
.book-page--text {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 48px 13%;
  min-height: 100%;
}
.story-text { margin: 0; font-size: clamp(19px, 1.85vw, 25px); line-height: 1.6; text-wrap: pretty; }
.book-page--art { display: flex; align-items: center; }
.book-page--art img { display: block; width: 100%; height: auto; border-radius: 0 6px 6px 0; }
.page-number { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); font-size: 11px; color: #868575; }
.book--cover {
  width: min(400px, 100%);
  display: flex;
  flex-direction: column;
  border-left: 7px solid #667351;
  border-radius: 3px 6px 6px 3px;
  box-shadow: 9px 7px 0 -4px #e3dccb, 10px 7px 0 -3px #bab39e, 0 28px 46px -18px #40382666, 0 0 0 1px #635b3f22;
  transform: rotate(-1deg);
  transition: transform 200ms ease;
}
.book--cover:hover { transform: rotate(0); }
.cover-art img { display: block; width: 100%; height: auto; border-radius: 0 5px 0 0; }
.cover-title { text-align: center; padding: 23px 16px 39px; }
.cover-title h2, .title-page h2 { margin: 0; font-size: clamp(36px, 4vw, 47px); color: var(--red); letter-spacing: -0.04em; line-height: 1.1; }
.cover-title h2 span, .title-page h2 span { display: block; margin-top: 8px; font-size: 0.49em; letter-spacing: 0; color: #5c583c; }
.cover-title p, .title-page p { margin: 18px 0 0; font-size: 13px; font-style: italic; color: #645e4d; }
.cover-open { position: absolute; inset: 0; border: 0; background: transparent; border-radius: inherit; align-items: end; justify-content: center; padding: 0; }
.cover-open > span { position: absolute; bottom: -13px; padding: 8px 16px; border-radius: 2px; background: var(--green); color: #fffaf0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 11px; letter-spacing: 0.04em; box-shadow: 0 3px 8px #393c3020; }
.cover-open > span > span { margin-left: 8px; }
.title-page, .ending { text-align: center; }
.title-page h2 { font-size: clamp(30px, 3.8vw, 48px); }
.title-page p { margin-top: 36px; }
.dedication { font-style: italic; text-align: center; font-size: clamp(20px, 2.3vw, 29px); line-height: 1.6; }
.ending h2 { margin: 20px 0 26px; font-size: clamp(42px, 5vw, 64px); color: var(--red); font-weight: normal; }
.restart { align-items: center; justify-content: center; gap: 12px; margin: auto; padding: 10px 0; border: 0; border-bottom: 1px solid #b4b9a7; background: transparent; color: var(--green); font-size: 15px; }
.reader-controls { width: min(540px, 100%); margin: 32px auto 0; flex-direction: column; }
.turn-controls { display: grid; grid-template-columns: 1fr auto 1fr; gap: 24px; align-items: center; }
.turn-button {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: start;
  gap: 12px;
  padding: 8px 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  white-space: nowrap;
  transition: background 150ms;
}
.turn-button--next { justify-content: end; }
.turn-button:hover:not(:disabled) { background: #4c5b450c; color: var(--green); }
.turn-button:disabled { opacity: 0.3; }
.turn-button span[aria-hidden] { font-family: system-ui, sans-serif; font-size: 22px; }
.page-status { margin: 0; min-width: 100px; text-align: center; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.progress-track { height: 2px; margin: 16px 12px 0; background: #d7d7ca; }
.progress-track span { display: block; height: 100%; background: var(--green); width: 5.8824%; transition: width 220ms ease; }
.navigation-hint { margin: 16px 0 0; text-align: center; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--muted); font-size: 10px; letter-spacing: 0.04em; }
.touch-hint { display: none; }
.reader-footer { text-align: center; padding: 32px 20px 25px; font-size: 12px; color: var(--muted); }
.reader-footer a { text-decoration-color: #a8ab9b; }
.no-script-note { text-align: center; }

@media (min-width: 1400px) {
  .book-stage { min-height: 530px; }
  .book--cover { width: 425px; }
}
@media (max-width: 900px) and (min-width: 701px) {
  .book-page--text { padding: 40px 10%; }
  .story-text { font-size: 18px; line-height: 1.5; }
}
@media (max-width: 700px) {
  .site-header { padding: 22px 22px 12px; }
  .home-link { font-size: 15px; }
  .header-note { font-size: 12px; }
  .reader { width: calc(100% - 36px); padding: 12px 0; }
  .reader-heading { margin: 0 0 22px; gap: 12px; }
  .eyebrow { font-size: 9px; letter-spacing: 0.16em; }
  .page-picker { gap: 6px; }
  .page-picker label { display: none; }
  .page-picker select { max-width: 160px; font-size: 12px; }
  .book-stage { min-height: 0; }
  .book { display: flex; flex-direction: column; border-radius: 4px; }
  .book:not(.book--cover)::after { display: none; }
  .book-page--art { order: -1; }
  .book-page--art img { border-radius: 4px 4px 0 0; }
  .book-page--text { padding: 28px 28px 44px; min-height: 185px; }
  .story-text { font-size: 19px; line-height: 1.55; }
  .page-number { bottom: 15px; font-size: 10px; }
  .book--cover { width: min(340px, calc(100% - 20px)); }
  .cover-title { padding: 18px 12px 30px; }
  .cover-title h2 { font-size: 40px; }
  .cover-title p { margin-top: 14px; font-size: 12px; }
  .title-page h2 { font-size: 36px; }
  .title-page p { margin-top: 22px; }
  .reader-controls { margin-top: 26px; }
  .turn-controls { gap: 8px; }
  .turn-button { gap: 8px; padding: 8px; font-size: 13px; }
  .page-status { min-width: 82px; font-size: 11px; }
  .reader-footer { padding-top: 20px; }
}
@media (pointer: coarse) {
  .keyboard-hint { display: none; }
  .touch-hint { display: inline; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
