:root {
  --forest: #536b4d;
  --forest-deep: #3d553c;
  --cream: #fff0d5;
  --cream-light: #fff9eb;
  --peach: #ffdcbb;
  --brown: #805038;
  --ink: #302b29;
  --pink: #ed82a4;
  --blue: #4c90df;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--forest); color: var(--ink); font-family: Georgia, Cambria, 'Times New Roman', serif; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 4px solid var(--blue); outline-offset: 4px; }
h1[tabindex="-1"]:focus { outline: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.cover { min-height: 100svh; display: grid; place-items: center; background: var(--forest); }
.canva-cover { position: relative; width: min(100%, 460px); aspect-ratio: 346 / 551; overflow: clip; border-radius: 28px; }
.canva-cover-art { display: block; position: absolute; width: 112.7168%; max-width: none; height: auto; left: -6.3584%; top: -26.6788%; }
.canva-unlock-form { position: absolute; inset: 0; }
.canva-unlock-form input, .canva-unlock-button { position: absolute; left: 7.5145%; width: 84.9711%; border: 0; border-radius: 15px; background: transparent; }
.canva-unlock-form input { top: 60.4356%; height: 8.7114%; padding: 5px 14px; text-align: center; font-size: 1.15rem; color: var(--ink); }
.canva-unlock-form input[aria-invalid="true"] { box-shadow: inset 0 0 0 3px #b75056; }
.canva-unlock-button { top: 71.3249%; height: 8.53%; }
.canva-unlock-button:hover { background: #fff4; }
.canva-unlock-message { position: absolute; top: 82.2142%; left: 9%; width: 82%; margin: 0; color: #8f323d; text-align: center; font-size: .95rem; }
.cover-card { width: min(100%, 560px); padding: 35px 26px 30px; text-align: center; background: var(--cream); border: 7px solid var(--brown); border-radius: 25px; box-shadow: 0 12px 0 #354d35, 0 20px 35px #243d2f7d; position: relative; }
.cover-card::before, .cover-card::after { content: '✦'; color: #cf8847; position: absolute; font-size: 24px; top: 25px; }
.cover-card::before { left: 23px; }
.cover-card::after { right: 23px; }
.cover-kicker, .eyebrow { margin: 0; color: var(--forest-deep); font-size: .8rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.cover h1 { margin: 8px 0 2px; color: var(--forest-deep); font-size: clamp(3.8rem, 15vw, 6rem); line-height: .95; letter-spacing: -.05em; }
.cover-subtitle { margin: 13px 0 28px; font-size: 1.17rem; }
.cover-footer { margin: 29px 0 0; color: var(--forest-deep); font-size: .92rem; }
.frog-pair { display: flex; justify-content: center; gap: 24px; align-items: flex-end; margin-top: 31px; }
.frog { width: 78px; height: 59px; border-radius: 48% 48% 44% 44%; background: #91bc7e; border: 3px solid var(--brown); display: block; position: relative; box-shadow: inset 0 -8px #7cae70; }
.frog::before, .frog::after { content: ''; position: absolute; background: #91bc7e; border: 3px solid var(--brown); border-radius: 50%; width: 28px; height: 28px; top: -16px; }
.frog::before { left: 5px; }
.frog::after { right: 5px; }
.frog-eye { position: absolute; width: 6px; height: 8px; background: var(--ink); border-radius: 50%; top: 3px; z-index: 1; }
.frog-eye:first-child { left: 20px; }
.frog-eye:nth-child(2) { right: 20px; }
.frog-smile { position: absolute; width: 23px; height: 9px; border-bottom: 3px solid var(--ink); border-radius: 50%; left: 25px; top: 29px; }
.frog-bow { position: absolute; bottom: -10px; right: -10px; z-index: 2; font-style: normal; font-size: 27px; line-height: 1; color: var(--pink); text-shadow: 1px 1px var(--brown); }
.frog-blue .frog-bow { color: var(--blue); left: -10px; right: auto; }
.frog-blue { transform: rotate(7deg); }
.frog-pink { transform: rotate(-7deg); }

.unlock-form { border-top: 2px dashed #bc9271; padding-top: 25px; }
.unlock-form label { display: block; font-size: 1.03rem; font-weight: 700; margin-bottom: 13px; }
.unlock-row { display: grid; gap: 12px; }
.unlock-row input { width: 100%; min-height: 50px; border: 3px solid var(--brown); border-radius: 14px; background: var(--cream-light); padding: 10px 14px; text-align: center; font-size: 1.15rem; }
.unlock-row input[aria-invalid="true"] { border-color: #b75056; }
.unlock-message { min-height: 1.3em; color: #8f323d; margin: 8px 0 0; font-size: .95rem; }
.paper-button, .quiet-button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 11px 18px; border-radius: 15px; font-weight: 700; line-height: 1.25; text-decoration: none; }
.paper-button { color: var(--ink); background: #ffd9a2; border: 3px solid var(--brown); box-shadow: 0 4px 0 var(--brown); }
.paper-button:hover { background: #ffe5ba; transform: translateY(1px); box-shadow: 0 3px 0 var(--brown); }
.quiet-button { color: var(--forest-deep); background: var(--cream-light); border: 2px solid var(--forest-deep); }
.quiet-button:hover { background: #e9efdd; }

#story { min-height: 100svh; padding: 0 14px 48px; }
.reader-shell { width: min(100%, 1080px); margin: 0 auto; }
.chapter-progress { display: flex; justify-content: center; gap: 11px; padding: 20px 0 8px; }
.progress-dot { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--cream); background: transparent; }
.progress-dot.is-current { background: var(--cream); }
.chapter-heading { text-align: center; color: var(--cream-light); padding: 5px 16px 23px; }
.chapter-heading .eyebrow { color: var(--cream); }
.chapter-heading h1 { margin: 8px 0 0; font-size: clamp(2.35rem, 8vw, 4.5rem); line-height: 1; }
.chapter-intro { margin: 9px 0 0; font-size: 1rem; }
.comic-page { margin: 0 auto 28px; background: var(--cream); border-radius: 22px; padding: 17px 13px 19px; box-shadow: 0 7px 0 #344b32; }
.panel-list { display: grid; gap: 17px; }
.panel { position: relative; overflow: hidden; aspect-ratio: var(--panel-ratio); margin: 0; border: 3px solid var(--brown); background: var(--peach); border-radius: 8px; }
.panel img { display: block; position: absolute; max-width: none; width: var(--image-width); height: auto; left: var(--image-left); top: var(--image-top); }
.page-art { display: none; }
.full-page-button { width: 100%; margin-top: 17px; }
.story-navigation { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 30px auto 18px; }
.story-navigation > * { flex: 1; }
.story-navigation .paper-button { flex: 1.25; }
.restart-button { display: block; margin: 23px auto 0; color: var(--cream); background: transparent; border: 0; text-decoration: underline; text-underline-offset: 4px; min-height: 44px; }

.reveal-screen, .ending-screen { min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--cream-light); padding: 36px 15px; }
.reveal-screen .eyebrow, .ending-screen .eyebrow { color: var(--cream); }
.reveal-screen h1 { font-size: clamp(2.3rem, 8vw, 4rem); line-height: 1.05; max-width: 12ch; margin: 23px auto 10px; }
.reveal-screen p:not(.eyebrow) { font-size: 1.15rem; margin: 0 0 30px; }
.reveal-button { min-width: 220px; }
.reveal-screen .quiet-button { margin-top: 22px; background: transparent; color: var(--cream); border-color: var(--cream); }
.closed-book { width: 128px; height: 160px; margin-bottom: 36px; border-radius: 7px 18px 18px 7px; background: var(--peach); border: 7px solid var(--brown); box-shadow: 7px 7px 0 var(--cream-light), 12px 12px 0 #344b32; display: grid; place-items: center; transform: rotate(-8deg); }
.book-heart { display: grid; place-items: center; width: 72px; height: 72px; border: 3px solid var(--brown); border-radius: 50%; color: #c64960; font-size: 3.6rem; }
.draft-disclaimer { color: var(--cream); text-align: center; font-size: .9rem; margin: -7px 0 17px; }
.letter-card { width: min(100%, 630px); margin: 19px 0 20px; padding: 38px 25px 44px; background: var(--cream); border: 6px solid var(--brown); border-radius: 25px; color: var(--ink); box-shadow: 0 8px 0 #344b32; }
.letter-heart { color: #c64960; font-size: 3rem; }
.letter-card h1 { font-size: clamp(2.35rem, 8vw, 4rem); margin: 4px 0 19px; color: var(--forest-deep); }
.letter-card p { margin: 0 auto; max-width: 25ch; font-size: clamp(1.24rem, 4.5vw, 1.75rem); line-height: 1.55; }
.ending-screen .story-navigation { width: min(100%, 630px); }

#page-viewer { max-width: min(98vw, 1300px); max-height: 96svh; padding: 10px; border: 5px solid var(--brown); border-radius: 16px; background: var(--cream); }
#page-viewer::backdrop { background: #1e311edd; }
.viewer-inner { display: grid; gap: 10px; justify-items: end; }
.viewer-inner img { display: block; width: 100%; max-height: 83svh; object-fit: contain; }
.viewer-close { min-height: 44px; padding: 8px 13px; background: var(--cream-light); border: 2px solid var(--brown); border-radius: 10px; }

@media (min-width: 900px) {
  .canva-cover { width: min(460px, calc(100svh * 346 / 551)); }
  #story { padding-inline: 28px; }
  .chapter-heading { padding-bottom: 15px; }
  .chapter-heading h1 { font-size: 2.7rem; }
  .comic-page { padding: 24px; }
  .page-art { display: block; }
  .page-art img { display: block; width: 100%; height: auto; border-radius: 8px; }
  .panel-list { display: none; }
  .story-navigation { width: min(100%, 750px); }
  .full-page-button { display: none; }
}
@media (max-width: 420px) {
  .cover-card { padding-inline: 18px; }
  .story-navigation { flex-direction: column-reverse; }
  .story-navigation > * { width: 100%; }
  .story-navigation > span { display: none; }
  .comic-page { padding-inline: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .paper-button:hover { transform: none; }
}

.single-panel-page { max-width: 720px; }
.single-panel-page .complete-panel { display: block; width: 100%; height: auto; }

.wedding-photo { width: min(100%, 630px); margin: 19px 0 0; padding: 10px; background: var(--cream); border: 6px solid var(--brown); border-radius: 25px; box-shadow: 0 8px 0 #344b32; }
.wedding-photo img { display: block; width: 100%; height: auto; border-radius: 10px; }
#story.is-ending { padding: 0; background: #faf7ee; }
.ending-screen { padding: 0 0 24px; color: var(--ink); }
.keepsake-artwork { width: 100%; margin: 0; }
.keepsake-artwork img { display: block; width: 100%; height: auto; }
@media (min-width: 900px) {
  .keepsake-artwork { height: 100svh; display: grid; place-items: center; }
  .keepsake-artwork img { width: auto; height: 100%; max-width: 100%; object-fit: contain; }
}
.ending-screen .story-navigation { width: min(calc(100% - 32px), 630px); margin: 24px auto 0; }
