/* First storybook milestone: header, illustrated hero, and phone wallpaper. */
:root {
  --story-ink: #193e53;
  --story-muted: #526775;
  --story-paper: #fffdf7;
  --story-blue: #e7f3f7;
  --story-yellow: #f7d77b;
  --story-orange: #a64e30;
}

.story-icon { display: inline-block; width: 24px; height: 24px; flex: 0 0 auto; vertical-align: middle; }
.skip-link { position: absolute; top: 10px; left: 16px; z-index: 100; padding: 12px 18px; background: var(--story-paper); transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid #2a6b8b; outline-offset: 5px; }
#top:focus { outline: none; }
#hatterkep { scroll-margin-top: 24px; }

.storybook-header { max-width: 1200px; height: 88px; padding-inline: 24px; }
.storybook-header .brand { gap: 12px; }
.storybook-header .brand-paw { width: 44px; height: 44px; background: #f8e8af; border-radius: 49% 45% 47% 40%; }
.storybook-header .brand-paw .story-icon { width: 30px; height: 30px; }
.storybook-header .brand strong { font-size: 25px; }
.storybook-header .brand small { font-size: 10px; letter-spacing: .1em; }
.storybook-header .main-nav a { display: inline-flex; align-items: center; min-height: 44px; }
.storybook-header .nav-cta { border-color: #c6d6dc; border-radius: 16px 20px 16px 19px; background: #fffdf7; }

.storybook-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "copy art" "actions art";
  column-gap: clamp(30px, 6vw, 86px);
  align-items: center;
  padding: 38px 28px 66px;
  isolation: isolate;
  color: var(--story-ink);
}
.storybook-hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 25px -24px 8px;
  background: radial-gradient(ellipse at 73% 35%, #d7eaf1a8, transparent 66%), radial-gradient(ellipse at 15% 84%, #f9eac08c, transparent 53%);
  border-radius: 47% 42% 36% 28% / 23% 28% 38% 28%;
}
.storybook-copy { grid-area: copy; align-self: end; padding-top: 30px; }
.story-kicker { display: flex; align-items: center; gap: 9px; margin: 0 0 20px; color: var(--story-muted); font: 18px/1.4 'Kalam', cursive; }
.story-kicker .story-icon { width: 21px; height: 21px; transform: rotate(-12deg); }
.storybook-copy h1 { max-width: none; margin: 0; font: 700 clamp(48px, 5.7vw, 74px)/1.09 'Kalam', cursive; letter-spacing: -.045em; }
.storybook-copy h1 span { position: relative; display: inline-block; isolation: isolate; }
.storybook-copy h1 span::after { content: ""; position: absolute; z-index: -1; left: -1%; right: -2%; bottom: 10%; height: 14%; background: var(--story-yellow); border-radius: 30% 17% 35% 19%; transform: rotate(-1.5deg); opacity: .75; }
.storybook-lead { max-width: 420px; margin: 22px 0 0; font-size: 17px; line-height: 1.75; color: var(--story-muted); }
.storybook-art { grid-area: art; position: relative; width: 100%; max-width: 480px; margin: 0; justify-self: center; padding: 10px 10px 0; }
.storybook-picture { overflow: hidden; aspect-ratio: 4 / 5; border: 7px solid var(--story-paper); border-radius: 46% 45% 6% 5% / 25% 26% 5% 6%; box-shadow: 0 12px 28px #16364c12; transform: rotate(1.5deg); }
.storybook-picture img { width: 100%; height: 100%; object-fit: cover; object-position: center 68%; }
.storybook-art figcaption { position: relative; width: fit-content; margin: -20px auto 0; padding: 9px 18px 7px; background: var(--story-paper); border-radius: 7px 4px 6px 3px; color: var(--story-ink); font: 18px/1.4 'Kalam', cursive; box-shadow: 0 4px 10px #16364c0d; transform: rotate(-3deg); }
.storybook-art figcaption .story-icon { width: 19px; height: 19px; margin-left: 4px; color: var(--story-orange); }
.story-spark { position: absolute; top: 8%; right: 0; width: 59px; height: 69px; color: var(--story-orange); transform: rotate(10deg); }
.storybook-actions { grid-area: actions; align-self: start; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding-top: 28px; }
.story-button { display: inline-flex; align-items: center; justify-content: center; gap: 14px; min-height: 52px; max-width: 100%; padding: 12px 22px; border: 1.5px solid var(--story-ink); border-radius: 13px 18px 13px 17px / 15px 12px 17px 12px; background: var(--story-yellow); color: var(--story-ink); box-shadow: 2px 3px 0 #193e532b; font: 700 15px/1.45 'DM Sans', sans-serif; text-align: center; transition: background .18s, transform .18s, box-shadow .18s; }
.story-button:hover { background: #f4ce62; transform: translateY(-2px); box-shadow: 2px 5px 0 #193e532b; }
.story-button:active { transform: translateY(1px); box-shadow: 1px 1px 0 #193e532b; }
.story-button .story-icon { width: 21px; height: 21px; }
.story-text-link { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 44px; color: var(--story-ink); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 5px; text-decoration-color: #82949d; text-decoration-thickness: 1px; }
.story-text-link:hover { text-decoration-color: currentColor; }
.storybook-footnote { display: flex; align-items: center; gap: 10px; flex-basis: 100%; margin: 12px 0 20px; color: var(--story-muted); font: 16px/1.4 'Kalam', cursive; }
.storybook-footnote .story-icon { width: 20px; height: 20px; transform: rotate(12deg); }

.wallpaper-gift { padding: 26px 0 36px; }
.gift-panel { position: relative; display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); grid-template-areas: "preview copy" "preview actions"; column-gap: clamp(32px, 5vw, 72px); padding: 54px 72px 46px; color: var(--story-ink); background: radial-gradient(ellipse at 20% 60%, #fff5c7b0, transparent 56%), #eaf3f1; border-radius: 34px 40px 32px 38px / 36px 30px 38px 30px; border: 1px solid #d6e2dc; }
.gift-panel::before { content: ""; position: absolute; inset: 9px; border: 1px dashed #93afa966; border-radius: 27px 33px 25px 31px; pointer-events: none; }
.gift-copy { grid-area: copy; align-self: end; }
.gift-copy .story-kicker { margin-bottom: 18px; }
.gift-number { display: grid; place-items: center; width: 34px; height: 34px; background: #f8e6ab; border-radius: 43% 51% 42% 48%; font-size: 16px; }
.gift-copy h2 { margin: 0; font: 700 clamp(38px, 4vw, 52px)/1.12 'Kalam', cursive; letter-spacing: -.03em; }
.gift-copy h2 span { color: var(--story-orange); }
.gift-copy > p:last-child { max-width: 375px; margin: 16px 0 0; font-size: 16px; line-height: 1.75; color: var(--story-muted); }
.gift-preview { grid-area: preview; position: relative; align-self: center; justify-self: center; width: 100%; max-width: 290px; margin: 0; padding: 7px 24px 12px; }
.wallpaper-phone { position: relative; width: 100%; padding: 7px; border: 2px solid var(--story-ink); border-radius: 31px; background: var(--story-paper); box-shadow: 9px 13px 0 #92ada329, 0 12px 24px #193e5312; transform: rotate(-5deg); }
.wallpaper-phone img { width: 100%; height: auto; border-radius: 22px; }
.gift-preview figcaption { position: relative; width: max-content; max-width: 100%; margin: 14px auto 0; padding: 5px 12px; font: 19px/1.4 'Kalam', cursive; background: #fffdf7c4; transform: rotate(-3deg); }
.gift-preview figcaption .story-icon { width: 19px; height: 19px; color: var(--story-orange); }
.gift-spark { position: absolute; right: 0; top: 0; width: 46px; height: 62px; color: var(--story-orange); transform: rotate(12deg); }
.gift-actions { grid-area: actions; align-self: start; padding-top: 24px; }
.gift-format { margin: 12px 0 0; color: var(--story-muted); font-size: 12px; }
.wallpaper-help { max-width: 375px; margin-top: 18px; border-block: 1px solid #193e5326; }
.wallpaper-help summary { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; list-style: none; color: var(--story-ink); font-size: 14px; }
.wallpaper-help summary::-webkit-details-marker { display: none; }
.wallpaper-help summary span { font-size: 23px; line-height: 1; transition: transform .15s; }
.wallpaper-help[open] summary span { transform: rotate(45deg); }
.wallpaper-help p { margin: 0 0 16px; color: var(--story-muted); font-size: 14px; line-height: 1.7; }
.more-surprises { margin-top: 16px; font-size: 13px; }

@media (max-width: 900px) {
  .storybook-header .main-nav { gap: 15px; }
  .storybook-hero { column-gap: 20px; padding: 28px 0 52px; }
  .storybook-copy h1 { font-size: clamp(42px, 6.1vw, 55px); }
  .storybook-copy .story-kicker { font-size: 16px; }
  .storybook-lead { font-size: 15px; }
  .storybook-lead br { display: none; }
  .storybook-actions { gap: 8px; padding-top: 24px; }
  .storybook-footnote { margin-top: 8px; font-size: 14px; }
  .storybook-art { padding-inline: 4px; }
  .storybook-art figcaption { font-size: 15px; padding-inline: 12px; }
  .gift-panel { padding: 42px 34px; column-gap: 26px; }
  .gift-preview { max-width: 260px; padding-inline: 20px; }
  .gift-copy .story-kicker { font-size: 16px; }
}

@media (max-width: 780px) {
  .storybook-header { height: 76px; padding: 0 20px; }
  .storybook-header .brand { gap: 9px; }
  .storybook-header .brand strong { font-size: 23px; }
  .storybook-header .brand-paw { width: 39px; height: 39px; }
  .storybook-header .brand-paw .story-icon { width: 27px; height: 27px; }
  .storybook-header .menu-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; min-height: 44px; padding: 5px 8px; border: 1px solid #d4ddd8; border-radius: 12px 10px 13px 10px; font-size: 12px; }
  .storybook-header .menu-toggle .story-icon { width: 20px; height: 20px; }
  .storybook-header .main-nav { display: none; position: absolute; top: 69px; left: 15px; right: 15px; padding: 12px 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--story-paper); box-shadow: var(--shadow); }
  .storybook-header .main-nav.open { display: grid; gap: 5px; }
  .storybook-header .main-nav a { font-size: 15px; }
  .storybook-header .nav-cta { justify-content: center; margin-top: 5px; background: #f8e6ab; }
}

@media (max-width: 620px) {
  .storybook-hero { width: min(100% - 40px, 440px); grid-template-columns: minmax(0, 1fr); grid-template-areas: "copy" "art" "actions"; padding: 18px 0 28px; row-gap: 0; text-align: center; }
  .storybook-hero::before { inset: 135px -20px 115px; border-radius: 39% 38% 18% 26%; }
  .storybook-copy { padding: 0; }
  .storybook-copy .story-kicker { justify-content: center; gap: 7px; margin-bottom: 10px; font-size: 15px; }
  .storybook-copy h1 { font-size: clamp(39px, 11.6vw, 55px); line-height: 1.04; letter-spacing: -.045em; }
  .storybook-lead { max-width: 310px; margin: 16px auto 0; font-size: 15px; line-height: 1.6; }
  .storybook-lead br { display: block; }
  .storybook-art { max-width: 380px; margin-top: 20px; padding: 0 4px; }
  .storybook-picture { aspect-ratio: 1.12; border-width: 5px; border-radius: 35% 36% 7% 6% / 19% 20% 6% 7%; transform: rotate(1deg); }
  .storybook-picture img { object-position: center 78%; }
  .storybook-art figcaption { margin-top: -13px; padding: 5px 13px; font-size: 16px; }
  .story-spark { top: 1%; right: -1px; width: 40px; height: 48px; }
  .storybook-actions { display: flex; flex-direction: column; gap: 4px; padding-top: 23px; }
  .storybook-actions .story-button { width: 100%; max-width: 340px; }
  .story-button { min-height: 52px; padding: 12px 16px; font-size: 14px; }
  .storybook-footnote { justify-content: center; margin: 4px 0 0; font-size: 14px; }
  .storybook-footnote .story-icon { width: 17px; height: 17px; }
  .wallpaper-gift { width: min(100% - 30px, 440px); padding: 24px 0 22px; }
  .gift-panel { grid-template-columns: minmax(0, 1fr); grid-template-areas: "copy" "preview" "actions"; padding: 30px 24px 24px; border-radius: 24px 28px 23px 26px; text-align: center; }
  .gift-panel::before { inset: 7px; border-radius: 18px 21px 17px 19px; }
  .gift-copy .story-kicker { justify-content: center; gap: 8px; margin-bottom: 12px; font-size: 15px; }
  .gift-number { width: 29px; height: 29px; font-size: 14px; }
  .gift-copy h2 { font-size: clamp(36px, 10vw, 44px); line-height: 1.08; }
  .gift-copy > p:last-child { max-width: 300px; margin: 12px auto 0; font-size: 15px; line-height: 1.65; }
  .gift-preview { width: 214px; max-width: 100%; padding: 5px 24px 0; margin-top: 25px; }
  .wallpaper-phone { border-radius: 23px; padding: 5px; box-shadow: 7px 8px 0 #92ada329; }
  .wallpaper-phone img { border-radius: 16px; }
  .gift-preview figcaption { margin-top: 9px; padding: 5px 0; font-size: 16px; }
  .gift-preview figcaption .story-icon { width: 16px; height: 16px; }
  .gift-spark { width: 36px; height: 49px; }
  .gift-actions { padding-top: 20px; min-width: 0; }
  .gift-actions .story-button { width: 100%; gap: 9px; }
  .gift-format { margin-top: 11px; font-size: 11px; }
  .wallpaper-help { margin-top: 16px; text-align: left; }
  .more-surprises { margin-top: 12px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .story-button, .wallpaper-help summary span { transition: none; }
}

/* Printable gifts: previews are rendered from the actual A4 downloads. */
.printables { padding: 40px 0 96px; color: var(--story-ink); scroll-margin-top: 24px; }
.printable-intro { margin: 0 auto 38px; text-align: center; }
.printable-intro .story-kicker { justify-content: center; margin-bottom: 12px; }
.printable-intro h2 { margin: 0; font: 700 clamp(34px, 4.5vw, 54px)/1.15 'Kalam', cursive; letter-spacing: -.03em; }
.printable-intro > p:last-child { max-width: 490px; margin: 14px auto 0; color: var(--story-muted); font-size: 16px; line-height: 1.7; }
.certificate-panel { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); grid-template-areas: "preview copy" "preview actions"; column-gap: 65px; padding: 48px 68px; background: radial-gradient(ellipse at 25% 75%, #fffdf5, transparent 66%), #f8eed4; border: 1px solid #e7dcbc; border-radius: 31px 38px 32px 27px; }
.certificate-copy { grid-area: copy; align-self: end; }
.certificate-copy .story-kicker { margin-bottom: 14px; }
.certificate-copy h3 { margin: 0; font-size: clamp(36px, 4vw, 48px); letter-spacing: -.03em; line-height: 1.12; }
.certificate-copy h3 span { color: var(--story-orange); }
.certificate-copy > p:last-child { max-width: 375px; margin: 17px 0 0; color: var(--story-muted); font-size: 16px; line-height: 1.75; }
.certificate-preview { grid-area: preview; display: block; width: 100%; max-width: 305px; justify-self: center; align-self: center; padding: 9px; background: white; box-shadow: 0 10px 26px #193e5314; transform: rotate(-2.5deg); border: 1px solid #dcd8cd; }
.certificate-preview img { display: block; width: 100%; height: auto; }
.certificate-preview > span { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; font-size: 12px; text-decoration: underline; text-underline-offset: 4px; }
.certificate-preview:hover { border-color: var(--story-ink); }
.certificate-actions { grid-area: actions; align-self: start; padding-top: 24px; }
.certificate-note { display: flex; align-items: center; gap: 9px; max-width: 320px; margin-top: 26px; font: 17px/1.55 'Kalam', cursive; color: var(--story-muted); }
.certificate-note .story-icon { width: 22px; height: 22px; color: var(--story-orange); }
.coloring-section { padding-top: 65px; scroll-margin-top: 24px; }
.coloring-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 28px; }
.coloring-heading .story-kicker { margin-bottom: 12px; }
.coloring-heading h3 { margin: 0; font-size: clamp(30px, 3vw, 39px); line-height: 1.2; letter-spacing: -.025em; }
.coloring-heading > div > p:last-child:not(.gift-format) { margin: 12px 0 0; color: var(--story-muted); font-size: 15px; }
.coloring-bundle { flex: 0 0 auto; text-align: center; }
.coloring-bundle .story-button { background: #e1eee7; }
.coloring-bundle .story-button:hover { background: #cfe3d7; }
.coloring-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.coloring-card { min-width: 0; overflow: hidden; border: 1px solid #deded2; border-radius: 13px 17px 14px 16px; background: var(--story-paper); box-shadow: 0 4px 12px #193e5307; }
.coloring-preview { display: block; padding: 10px; background: white; border-bottom: 1px solid #ecece3; }
.coloring-preview:focus-visible { outline-offset: -4px; }
.coloring-preview img { width: 100%; height: auto; aspect-ratio: 600 / 849; object-fit: contain; transition: transform .18s; }
.coloring-preview:hover img { transform: scale(1.025); }
.coloring-card-copy { padding: 14px 16px 16px; }
.coloring-number { color: var(--story-muted); font: 13px 'Kalam', cursive; }
.coloring-card h4 { min-height: 2.7em; margin: 4px 0 0; font: 700 22px/1.3 'Kalam', cursive; }
.coloring-card-copy p { margin: 5px 0 13px; font-size: 11px; color: var(--story-muted); }
.coloring-download { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 46px; padding: 8px 10px; border: 1px solid #bccdc6; border-radius: 9px 11px 8px 10px; background: #eaf3ef; font-size: 13px; font-weight: 700; }
.coloring-download:hover { background: #dcece3; border-color: var(--story-ink); }
.coloring-download .story-icon { width: 19px; height: 19px; }
.print-help { max-width: 740px; margin: 28px auto 0; border-block: 1px solid #193e5326; }
.print-help summary { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 10px 4px; cursor: pointer; list-style: none; font-size: 14px; font-weight: 600; }
.print-help summary::-webkit-details-marker { display: none; }
.print-help summary span { font-size: 24px; font-weight: 400; line-height: 1; }
.print-help[open] summary span { transform: rotate(45deg); }
.print-help p { margin: 0 4px 18px; color: var(--story-muted); font-size: 14px; line-height: 1.75; }
.printable-shortcuts { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px 28px; margin-top: 32px; }
.printable-shortcuts a { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; font-size: 13px; text-decoration: underline; text-decoration-color: #82949d; text-underline-offset: 5px; }

@media (max-width: 900px) {
  .certificate-panel { padding: 38px; column-gap: 32px; }
  .coloring-heading { align-items: start; flex-direction: column; gap: 22px; }
  .coloring-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  .coloring-card h4 { min-height: 0; }
}

@media (max-width: 620px) {
  .printables { padding: 30px 0 65px; }
  .printable-intro { padding-inline: 8px; margin-bottom: 26px; }
  .printable-intro .story-kicker { gap: 7px; font-size: 15px; }
  .printable-intro h2 { font-size: clamp(33px, 9vw, 43px); }
  .printable-intro > p:last-child { font-size: 15px; }
  .certificate-panel { grid-template-columns: minmax(0, 1fr); grid-template-areas: "copy" "preview" "actions"; padding: 30px 24px; border-radius: 24px 28px 23px 26px; text-align: center; }
  .certificate-copy .story-kicker { justify-content: center; font-size: 16px; }
  .certificate-copy h3 { font-size: clamp(35px, 10vw, 43px); }
  .certificate-copy > p:last-child { max-width: 300px; margin: 14px auto 0; font-size: 15px; }
  .certificate-preview { max-width: 240px; margin-top: 26px; padding: 6px; }
  .certificate-actions { padding-top: 28px; }
  .certificate-actions .story-button { width: 100%; }
  .certificate-note { justify-content: center; max-width: 280px; margin: 19px auto 0; font-size: 15px; }
  .coloring-section { padding-top: 44px; }
  .coloring-heading { gap: 22px; margin-bottom: 23px; }
  .coloring-heading .story-kicker { font-size: 16px; }
  .coloring-heading h3 { max-width: 350px; font-size: clamp(30px, 8vw, 36px); }
  .coloring-bundle { width: 100%; }
  .coloring-bundle .story-button { width: 100%; }
  .coloring-grid { gap: 12px; }
  .coloring-preview { padding: 5px; }
  .coloring-card-copy { padding: 10px; }
  .coloring-card h4 { min-height: 2.7em; font-size: 18px; }
  .coloring-number { font-size: 12px; }
  .coloring-card-copy p { font-size: 10px; margin-bottom: 10px; }
  .coloring-download { gap: 8px; font-size: 12px; padding-inline: 6px; }
  .coloring-download .story-icon { width: 17px; height: 17px; }
  .print-help { margin-top: 22px; }
  .printable-shortcuts { gap: 6px 16px; margin-top: 24px; }
  .printable-shortcuts a { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .coloring-preview img { transition: none; }
}

/* Mobile story rail: full-width chapters with a conventional top menu. */
@media (max-width: 780px) {
  html, body { height: 100%; overscroll-behavior: none; }
  body { overflow: hidden; }
  .storybook-header {
    height: 70px;
    padding: 0 17px;
    background: color-mix(in srgb, var(--story-paper) 94%, transparent);
    border-bottom: 1px solid #193e5317;
    backdrop-filter: blur(12px);
  }
  .storybook-header .menu-toggle {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    min-width: 46px;
    padding: 0;
    border: 1px solid #193e5326;
    border-radius: 14px;
    background: #fffdf7;
    color: var(--story-ink);
    cursor: pointer;
  }
  .hamburger-icon {
    display: grid;
    gap: 5px;
    width: 25px;
  }
  .hamburger-icon span {
    display: block;
    width: 100%;
    height: 3px;
    border-radius: 999px;
    background: currentColor;
    transform-origin: center;
    transition: transform .2s ease, opacity .15s ease;
  }
  .menu-toggle[aria-expanded="true"] .hamburger-icon span:first-child { transform: translateY(8px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] .hamburger-icon span:nth-child(2) { opacity: 0; }
  .menu-toggle[aria-expanded="true"] .hamburger-icon span:last-child { transform: translateY(-8px) rotate(-45deg); }
  .storybook-header .menu-toggle[aria-expanded="true"] { background: #f8e6ab; }
  .storybook-header .main-nav {
    position: absolute;
    inset: 62px 15px auto;
    z-index: 50;
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    height: auto;
    padding: 12px;
    overflow: hidden;
    border: 1px solid #193e5326;
    border-radius: 20px;
    background: color-mix(in srgb, var(--story-paper) 97%, transparent);
    box-shadow: 0 16px 36px #193e5324;
    backdrop-filter: blur(12px);
  }
  .storybook-header .main-nav.open { display: grid; }
  .storybook-header .main-nav a,
  .storybook-header .main-nav .nav-cta {
    display: grid;
    place-items: center;
    min-height: 48px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: #ffffff73;
    color: var(--story-muted) !important;
    font-size: 13px;
    white-space: nowrap;
  }
  .storybook-header .main-nav a.active {
    border-color: #193e5326;
    background: #f8e6ab;
    color: var(--story-ink) !important;
  }
  .storybook-header .nav-cta span { display: none; }
  main {
    display: flex;
    width: 100vw;
    height: calc(100dvh - 70px);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    overscroll-behavior-inline: contain;
  }
  main::-webkit-scrollbar { display: none; }
  main > section,
  main > .section-shell {
    flex: 0 0 100vw;
    width: 100vw;
    max-width: none;
    height: 100%;
    margin: 0;
    padding-inline: 15px;
    overflow-x: hidden;
    overflow-y: hidden;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    overscroll-behavior-y: contain;
    scrollbar-width: none;
  }
  main > .intro,
  main > .printables,
  main > .puzzle { overflow-y: auto; }
  main > section::-webkit-scrollbar { display: none; }
  main > section:focus-visible { outline-offset: -4px; }
  .site-footer { display: none; }
  .surprise-toast { bottom: 15px; }

  /* Keep the shorter chapters comfortably inside one phone screen. */
  .storybook-hero { padding-block: 12px 18px; }
  .storybook-art { margin-top: 12px; }
  .storybook-picture { max-height: 36dvh; }
  .storybook-actions { padding-top: 14px; }
  .storybook-footnote { display: none; }
  .wallpaper-gift { padding-block: 14px; }
  .gift-panel { min-height: 100%; padding-block: 22px; }
  .gift-preview { margin-top: 14px; }
  .wallpaper-help, .more-surprises { display: none; }
  .peek { padding-block: 24px; }
  .peek-images { min-height: min(43dvh, 330px); margin-top: 18px; }
  .challenge { min-height: 100%; padding-block: 18px; }
  .puzzle { padding-block: 20px; }
  .puzzle-layout { margin-top: 22px; }
  .qr-invite { justify-content: center; min-height: 100%; padding-block: 24px; }
}

@media (max-width: 780px) and (max-height: 740px) {
  .storybook-header { height: 62px; }
  main { height: calc(100dvh - 62px); }
  .storybook-header .brand small { display: none; }
  .storybook-header .main-nav { top: 56px; }
  .storybook-lead { margin-top: 9px; }
  .storybook-art { margin-top: 8px; }
  .storybook-picture { max-height: 31dvh; }
  .storybook-actions { padding-top: 10px; }
  .gift-copy > p:last-child, .gift-preview figcaption, .gift-format { display: none; }
  .gift-preview { width: 180px; }
  .section-heading .section-subtitle { display: none; }
  .challenge-intro { margin-block: 10px; }
  .challenge-item { padding-block: 9px; }
}

@media (max-width: 780px) and (prefers-reduced-motion: reduce) {
  main { scroll-behavior: auto; }
  .hamburger-icon span { transition: none; }
}
