:root {
  color-scheme: light;
  --ink: #223e36;
  --muted: #58675d;
  --green: #254c40;
  --paper: #faf6ea;
  --serif: Georgia, 'Times New Roman', serif;
  font: 16px/1.5 system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #f5f1e8; }
.site-header {
  display: flex; align-items: center; gap: 18px; padding: 14px clamp(18px, 4vw, 64px);
  border-bottom: 1px solid #dcded2; color: var(--muted); font-size: .875rem;
}
.book-brand { display: inline-flex; align-items: center; gap: 7px; }
.book-brand img { display: block; }
main { width: min(100% - 32px, 1160px); margin: 0 auto; padding: 20px 0 28px; }
.intro { text-align: center; margin-bottom: 14px; }
.intro h1 { font: 500 clamp(26px, 3.4vw, 44px)/1.12 var(--serif); margin: 0; }
.is-embedded body { background: transparent; }
.site-header[hidden], .intro[hidden] { display: none; }
.is-embedded main { width: min(100% - 24px, 1160px); padding: 0 0 14px; }
.reader { container-type: inline-size; }
.controls {
  display: grid; grid-template-columns: minmax(0, 7rem) 1fr minmax(0, 7rem);
  gap: 8px; align-items: center; min-height: 44px; margin: 0 auto 10px;
}
.controls button { width: 100%; height: 44px; min-height: 44px; padding-block: 0; white-space: nowrap; }
.controls p { font-size: .875rem; line-height: 1.25; text-align: center; margin: 0; }
button {
  display: inline-flex; justify-content: center; align-items: center; min-height: 42px; color: inherit;
  font: inherit; font-size: .875rem; padding: 8px 14px; border-radius: 7px;
  border: 1px solid #c6cdc0; background: #fffdf6; cursor: pointer;
}
button:disabled { opacity: .45; cursor: default; }
.primary { background: var(--green); color: #fff; border-color: var(--green); }
button:hover:not(:disabled):not(.primary) { background: #e8ecdf; }
:focus-visible { outline: 3px solid #a85a35; outline-offset: 3px; }
.stage {
  --stage-height: clamp(270px, 46cqw, 500px);
  --single-width: min(100%, calc(var(--stage-height) * 297 / 210));
  display: grid; place-items: start center; height: var(--stage-height);
  touch-action: pan-y pinch-zoom; overflow-anchor: none;
}
.stage > * { min-width: 0; min-height: 0; }
.cover {
  position: relative; min-width: 0; container-type: inline-size; overflow: hidden;
  color: #244e43;
}
.cover::before {
  position: absolute; content: ''; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, #77654b29, #fff5 1.5%, #7c6e5c1c 2.5%, transparent 4%);
}
.cover-copy { position: absolute; inset: 12% 4% auto; text-align: center; }
.cover h2 { margin: 0; font: 500 5.1cqw/1.1 var(--serif); letter-spacing: -.02em; }
.cover h2 span {
  display: inline-block; margin-top: 1.2cqw; padding-top: .8cqw;
  border-top: 1px solid #6f938280; font-size: 1.75cqw; letter-spacing: .12em;
}
.cover img {
  position: absolute; left: 28%; top: 36%; width: 44%; height: auto;
  border: 1px solid #fbf7e9; box-shadow: 0 1px 2px #493d2736;
}
.spread {
  width: 100%; aspect-ratio: 594/210; position: relative; isolation: isolate; container-type: inline-size;
  background: #f9f5e8; border-radius: 3px 4px 4px 3px; overflow: hidden;
  box-shadow: 0 3px 0 #dcd1b8, 0 5px 0 #f7efd9, 0 7px 0 #bdb89e, 0 10px 0 #315346, 0 17px 29px #50452c2c;
}
.spread::after {
  content: ''; position: absolute; z-index: 1; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent 49.1%, #53483213 49.84%, #594b3527 50%, #fffff837 50.3%, transparent 50.9%);
}
.cover-wrap {
  display: grid; grid-template: minmax(0,1fr) / 1fr;
  background: #faf6e9 url("assets/cover-paper.webp") center bottom / 100% 110%;
}
.cover-wrap[data-side="both"] { aspect-ratio: 603/210; grid-template-columns: minmax(0,1fr) 1.5% minmax(0,1fr); }
.cover-wrap[data-side="left"] { background-position: left bottom; background-size: 203% 110%; }
.cover-wrap[data-side="right"] { background-position: right bottom; background-size: 203% 110%; }
.cover-wrap::after { display: none; }
.cover-spine {
  display: grid; place-items: center; overflow: hidden;
  color: #35564a; background: linear-gradient(90deg, #57472355, #eee4cb39 30%, #e6dcc33b 72%, #57472355);
}
.cover-spine span { writing-mode: vertical-rl; white-space: nowrap; font: 500 clamp(6px, .75cqw, 10px) var(--serif); }
.story-spread img { display: block; width: 100%; height: auto; }
.book-view[data-side="left"], .book-view[data-side="right"] {
  width: var(--single-width); aspect-ratio: 297/210;
}
.book-view[data-side="left"] :is([data-panel="right"], [data-panel="spine"]),
.book-view[data-side="right"] :is([data-panel="left"], [data-panel="spine"]) { display: none; }
.story-spread[data-side="left"] img, .story-spread[data-side="right"] img {
  position: absolute; top: 0; width: 200%; max-width: none;
}
.story-spread[data-side="left"] img { left: 0; }
.story-spread[data-side="right"] img { left: -100%; }
.book-view:not([data-side="both"])::after { display: none; }
.book-view button.page-hit {
  display: none; position: absolute; inset-block: 0; z-index: 2;
  width: 50%; border: 0; border-radius: 0; background: transparent; cursor: zoom-in;
}
.book-view button.page-hit:hover { background: transparent; }
.book-view[data-side="both"] [data-hit="left"] { display: block; left: 0; }
.book-view[data-side="both"] [data-hit="right"] { display: block; right: 0; }
.book-view:not([data-side="both"]) [data-hit="both"] {
  display: block; inset-inline: 0; width: 100%; cursor: zoom-out;
}
.contents-view[data-side="both"] button[data-hit="left"],
.contents-view[data-side="left"] button[data-hit="both"] {
  inset: 0 2cqw auto auto; width: 44px; min-height: 0; height: clamp(23px, 4.8cqw, 44px);
  padding: 0; color: var(--muted); z-index: 4;
}
.contents-view[data-side="both"] button[data-hit="left"] { right: 51%; }
.contents-view[data-side="both"] [data-hit="left"]::after { content: '+'; }
.contents-view[data-side="left"] [data-hit="both"]::after { content: '−'; }
.page-hit:focus-visible { outline-offset: -5px; }
.back-cover { text-align: center; }
.back-cover::before { transform: scaleX(-1); }
.back-cover h2, .back-cover figure, .back-cover p { position: absolute; inset-inline: 8%; margin: 0; }
.back-cover h2, .back-cover p {
  font: 500 1.35cqw/1.35 system-ui, sans-serif;
  letter-spacing: .14em; text-transform: uppercase;
}
.back-cover h2 { top: 15%; }
.back-cover figure { top: 33%; }
.back-cover blockquote { margin: 0; font: italic 500 4.6cqw/1.2 var(--serif); }
.back-cover figcaption { margin-top: 2%; font-size: 1.65cqw; }
.back-cover p { top: 58%; }
.typeset { display: grid; grid-template: minmax(0,1fr) / 1fr; }
.typeset[data-side="both"] { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
.endpaper { background: #f4ecdf; }
.paper { background: radial-gradient(ellipse at 95% 0%, #f1e3c9, transparent 50%), var(--paper); }
.title-page { display: grid; place-items: center; text-align: center; container-type: inline-size; }
.contents-view {
  background-color: #fbf7ed;
  background-image: linear-gradient(#fbf7ed42, #fbf7ed7a), url("assets/cover-paper.webp");
  background-position: center bottom;
  background-size: 100% 100%;
}
.contents-view[data-side="left"] { background-position: left bottom; background-size: 200% 100%; }
.contents-view[data-side="right"] { background-position: right bottom; background-size: 200% 100%; }
.contents-page { container-type: inline-size; }
.contents-copy {
  display: grid; grid-template-rows: auto 1fr auto; gap: 2.7cqw; height: 100%;
  padding: 8cqw 12cqw 18cqw;
}
.contents-page h2 { margin: 0; font: 500 4.1cqw/1.15 var(--serif); }
.contents-list { margin: 0; padding: 0; list-style: none; }
.contents-list a {
  position: relative; z-index: 3;
  display: flex; align-items: baseline; justify-content: space-between; gap: 2cqw;
  padding: 1cqw 0; border-bottom: 1px solid #ddd5c2;
  color: var(--ink); font: 3.05cqw/1.25 var(--serif); text-decoration: none;
}
.contents-list a:hover { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.contents-list a span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.contents-page footer {
  color: var(--muted); font-size: 1.85cqw; line-height: 1.2;
}
.contents-page footer div { display: flex; justify-content: space-between; gap: 6px; }
.sample-note { display: block; margin-top: .6em; font-size: .95em; }
.last-page h2 { margin: 0; font: 500 5.3cqw/1.1 var(--serif); letter-spacing: -.02em; }
.last-page p { max-width: 28ch; margin: 3cqw auto 0; font: 3.1cqw/1.42 var(--serif); }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 640px) {
  .site-header { padding-block: 10px; }
  main { width: min(100% - 24px, 1160px); padding-bottom: 8px; }
  .stage { --stage-height: max(246px, calc(100cqw * 210 / 297)); }
  .controls { grid-template-columns: 80px 1fr 99px; }
  .controls button { padding-inline: 7px; font-size: .75rem; }
  .controls p { font-size: .75rem; }
  .cover-spine span { visibility: hidden; }
}
