/*
  Sketchbook (v06). A spiral-bound pad on a desk. Pages are paper faces on 3D
  leaves; type and drawings scale with the page through container units.
*/
:root {
  --desk: #27231f;
  --paper: #f4efe3;
  --paper-2: #e9e2d1;
  --ink: #232842;
  --graphite: #4a4946;
  --soft: #7d786f;
  --red: #b0412c;
  --kraft: #b58b58;
  --kraft-in: #c9a674;
  --tape: rgba(234, 219, 178, 0.86);
  --hand: "Reenie Beanie", "Bradley Hand", "Segoe Print", cursive;
  --note: "Shantell Sans", "Trebuchet MS", ui-rounded, sans-serif;
  --pen: var(--ink);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .34 0 0 0 0 .25 0 0 0 .55 -.17'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23g)'/%3E%3C/svg%3E");
  --fibre: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.014 .55' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .2 0 0 0 0 .1 0 0 0 .7 -.25'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23f)'/%3E%3C/svg%3E");
  --wood: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='400'%3E%3Cfilter id='w'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.003 .07' numOctaves='3' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .1 0 0 0 0 .07 0 0 0 0 .04 0 0 0 .9 -.3'/%3E%3C/filter%3E%3Crect width='600' height='400' filter='url(%23w)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--desk);
  color: var(--ink);
  font-family: var(--note);
  font-variation-settings: "INFM" 60, "BNCE" 20;
  -webkit-font-smoothing: antialiased;
}
html.home, html.home body { height: 100%; overflow: hidden; overscroll-behavior: none; }
button { font: inherit; color: inherit; }
img { -webkit-user-drag: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The desk */
.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: pinch-zoom;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  background:
    radial-gradient(110% 85% at 26% 16%, rgba(255, 226, 178, 0.15), rgba(255, 226, 178, 0) 62%),
    radial-gradient(90% 70% at 82% 104%, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0) 70%),
    var(--wood),
    var(--desk);
}
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--paper);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease 0.05s;
  z-index: 9000;
}
.stage.opening::after { opacity: 1; }

/* The book */
.book {
  position: absolute;
  transform: translateX(var(--shift, 0px)) scale(var(--zoom, 1));
  transition: transform 0.55s cubic-bezier(0.3, 0.1, 0.2, 1);
  opacity: 0;
}
.stage.ready .book { opacity: 1; }
.stage:not(.ready) .book { transition: none; }
.stage.opening .book { --zoom: 1.14; transition: transform 0.45s cubic-bezier(0.5, 0, 0.75, 0); }

.board {
  position: absolute;
  top: -5px;
  width: calc(var(--pw) + 7px);
  height: calc(var(--ph) + 10px);
  background-color: var(--kraft);
  background-image: var(--fibre), var(--grain);
  border-radius: 3px 8px 8px 3px;
  box-shadow: 0 24px 46px rgba(0, 0, 0, 0.5), 0 5px 12px rgba(0, 0, 0, 0.35);
  z-index: 1;
}
.spread .board-r { left: var(--pw); }
.spread .board-l { left: -7px; border-radius: 8px 3px 3px 8px; visibility: hidden; }
.spread.open-l .board-l { visibility: visible; }
.single .board-r { left: 0; }
.single .board-l { display: none; }

.edges {
  position: absolute;
  top: 0;
  width: var(--pw);
  height: var(--ph);
  background: var(--paper-2);
  border-radius: 2px 5px 5px 2px;
  z-index: 2;
}
.spread .edges-r { left: var(--pw); }
.spread .edges-l { left: 0; border-radius: 5px 2px 2px 5px; }
.single .edges-r { left: 0; }
.single .edges-l { display: none; }

.leaves { position: absolute; inset: 0; }
.leaf {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--pw);
  height: var(--ph);
  transform-origin: 0 50%;
  transform-style: preserve-3d;
}
.spread .leaf { left: var(--pw); }
.leaf.far { visibility: hidden; }
.single .leaf.turned { visibility: hidden; }
.leaf.moving { will-change: transform; }
.leaf.probe { visibility: hidden; pointer-events: none; z-index: -1; }

.face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  container-type: size;
  background-color: var(--paper);
  background-image: linear-gradient(90deg, rgba(70, 52, 30, 0.2), rgba(70, 52, 30, 0) 4.5%), var(--grain);
  border-radius: 2px 5px 5px 2px;
  color: var(--pen);
}
.face.back {
  transform: rotateY(180deg);
  background-image: linear-gradient(270deg, rgba(70, 52, 30, 0.2), rgba(70, 52, 30, 0) 4.5%), var(--grain);
  border-radius: 5px 2px 2px 5px;
}
.face::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(28, 22, 16, 0.6), rgba(28, 22, 16, 0.25));
  opacity: var(--shf, 0);
  z-index: 50;
}
.face.back::after {
  background: linear-gradient(270deg, rgba(28, 22, 16, 0.6), rgba(28, 22, 16, 0.25));
  opacity: var(--shb, 0);
}

.pg {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  padding: 6cqh 7cqw 6cqh 12cqw;
}
.back .pg { padding: 6cqh 12cqw 6cqh 7cqw; }

/* The spiral */
.coils { position: absolute; top: 0; z-index: 5000; pointer-events: none; overflow: visible; }
.coils .hole { fill: #2b2621; fill-opacity: 0.82; }
.coils .wire { fill: none; stroke: #262524; stroke-width: 3.4; stroke-linecap: round; }
.coils .hi { fill: none; stroke: #b9b6b0; stroke-width: 1.1; stroke-linecap: round; stroke-opacity: 0.85; }
.closed .coils .hole-l { display: none; }

/* Turning corners */
.corner {
  position: absolute;
  bottom: 0;
  width: 12cqw;
  height: 12cqw;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  z-index: 40;
}
.corner-r { right: 0; }
.corner-l { left: 0; }
.corner::before {
  content: "";
  position: absolute;
  bottom: 0;
  width: 44%;
  height: 44%;
  transition: width 0.22s ease, height 0.22s ease;
  filter: drop-shadow(-1px -1px 1.5px rgba(40, 30, 20, 0.18));
}
.corner-r::before { right: 0; background: linear-gradient(315deg, rgba(60, 46, 28, 0.55) 0 50%, #fbf8f0 50%, #e4dcc9 100%); border-top-left-radius: 3px; }
.corner-l::before { left: 0; background: linear-gradient(45deg, rgba(60, 46, 28, 0.55) 0 50%, #fbf8f0 50%, #e4dcc9 100%); border-top-right-radius: 3px; }
.corner:hover::before, .corner:focus-visible::before { width: 64%; height: 64%; }
.corner:focus-visible { outline: 2px dashed var(--pen); outline-offset: -6px; }

/* Contents tab */
.tab {
  position: absolute;
  z-index: 6000;
  font-family: var(--hand);
  font-size: 23px;
  line-height: 1;
  color: var(--ink);
  background: var(--tape);
  border: 0;
  padding: 7px 20px 5px;
  cursor: pointer;
  transform: rotate(3deg);
  clip-path: polygon(0 8%, 4% 0, 8% 10%, 12% 2%, 88% 2%, 92% 10%, 96% 0, 100% 8%, 100% 92%, 96% 100%, 92% 90%, 88% 98%, 12% 98%, 8% 90%, 4% 100%, 0 92%);
  transition: transform 0.2s ease;
}
.tab:hover { transform: rotate(1deg) translateY(-2px); }
.tab:focus-visible { outline: 2px dashed #f4efe3; outline-offset: 3px; }
.tab[hidden] { display: none; }

/* Marks that draw themselves */
.art, .arrows { overflow: visible; }
.s { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 1; stroke-dashoffset: 0; }
.s.ink { stroke: var(--pen); stroke-width: 1.7; }
.s.pencil { stroke: var(--graphite); stroke-width: 1.15; stroke-opacity: 0.85; }
.s.light { stroke: var(--graphite); stroke-width: 0.8; stroke-opacity: 0.45; }
.s.cons { stroke: #7d8aa0; stroke-width: 0.7; stroke-opacity: 0.5; }
.s.hatch { stroke: var(--graphite); stroke-width: 0.75; stroke-opacity: 0.55; }
.s.faint { stroke-opacity: 0.35; }
.s.red { stroke: var(--red); stroke-width: 1.5; }
.s.arrow { stroke: var(--pen); stroke-width: 1.6; }
.s.ghost { stroke-opacity: 0.45; stroke-width: 1; }
.s-t { fill: var(--pen); font-family: var(--hand); text-anchor: middle; }
.smudge { fill: url(#sk-smudge); }
.ch-no .s, .ch-kind .s, .ct-h .s, .ch-open .s { stroke-width: 1.6; }
.ch-no .s.red { stroke-width: 2.2; }

.pending .s, .pending .s-t, .pending .smudge { opacity: 0; }
.drawing .s { animation: sk-draw var(--t, 0.3s) cubic-bezier(0.35, 0.05, 0.35, 1) var(--d, 0s) both; }
.drawing .s-t, .drawing .smudge { animation: sk-fade 0.5s ease var(--d, 0s) both; }
@keyframes sk-draw {
  0% { stroke-dashoffset: 1; opacity: 0; }
  0.5% { opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}
@keyframes sk-fade { from { opacity: 0; } to { opacity: 1; } }

/* Coffee */
.coffee { position: absolute; width: 50cqw; aspect-ratio: 1; pointer-events: none; mix-blend-mode: multiply; z-index: 0; }
.coffee-svg { display: block; width: 100%; height: 100%; overflow: visible; }

/* Cover */
.pg-cover {
  background-color: var(--kraft);
  background-image: linear-gradient(90deg, rgba(40, 26, 10, 0.28), rgba(40, 26, 10, 0) 6%), var(--fibre), var(--grain);
  color: var(--ink);
}
.cv-label {
  position: absolute;
  left: 17cqw;
  right: 15cqw;
  top: 22cqh;
  padding: 3.6cqh 7cqw 3.2cqh;
  background: #f7f3ea;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1.5px rgba(40, 30, 20, 0.18), inset 0 0 0 5px #f7f3ea, inset 0 0 0 6.5px rgba(40, 30, 20, 0.12), 0 1px 2px rgba(0, 0, 0, 0.2);
  transform: rotate(-1.4deg);
}
.cv-name { margin: 0; font-family: var(--hand); font-size: min(15cqw, 9cqh); line-height: 0.95; color: var(--ink); }
.cv-line { margin: 1.6cqh 0 0; font-size: clamp(15px, 3.2cqw, 19px); color: var(--graphite); }
.cv-band {
  position: absolute;
  top: -2px;
  bottom: -2px;
  right: 9cqw;
  width: max(8px, 2.6cqw);
  background: linear-gradient(90deg, #191716, #3c3936 45%, #1d1b19);
  box-shadow: -2px 0 6px rgba(0, 0, 0, 0.35);
  z-index: 3;
}
.pg-cover .coffee { left: 30cqw; top: 58cqh; opacity: 0.8; }

/* Inside the cover */
.pg-inside {
  background-color: var(--kraft-in);
  background-image: linear-gradient(270deg, rgba(40, 26, 10, 0.22), rgba(40, 26, 10, 0) 5%), var(--fibre), var(--grain);
}
.pg-inside .pg { padding-top: 14cqh; }
.in-found { margin: 0; font-size: max(14px, min(3cqw, 1.8cqh)); color: rgba(35, 40, 66, 0.78); transform: rotate(-1deg); }
.in-name { margin: 1.4cqh 0 0; font-family: var(--hand); font-weight: 400; font-size: min(18cqw, 10.5cqh); line-height: 0.88; color: var(--ink); transform: rotate(-2.2deg); transform-origin: 0 50%; }
.in-line { margin: 3cqh 0 0; font-size: clamp(15px, 3.5cqw, 22px); line-height: 1.35; color: #2b2723; max-width: 26ch; }
.in-count { margin: 4cqh 0 0; font-family: var(--hand); font-size: min(8.5cqw, 5cqh); color: #3a352e; transform: rotate(1.5deg); }
.in-basket { margin: 1cqh 0 0; font-size: clamp(14px, 2.8cqw, 18px); color: #3a352e; }
.in-doodle { position: relative; flex: 1 1 auto; min-height: 0; margin: 2cqh -4cqw 0 -2cqw; }
.in-doodle svg, .nt-study svg, .end-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Contents */
.ct-name { margin: 0 0 2.4cqh; }
.spread .ct-name { display: none; }
.ct-artist { margin: 0; font-family: var(--hand); font-size: min(14cqw, 7.5cqh); line-height: 0.9; color: var(--ink); transform: rotate(-1.5deg); transform-origin: 0 50%; }
.ct-line { margin: 0.8cqh 0 0; font-size: clamp(16px, 3.9cqw, 19px); color: var(--graphite); }
.ct-h { position: relative; align-self: flex-start; margin: 0 0 2.2cqh; font-family: var(--hand); font-weight: 400; font-size: min(12cqw, 7cqh); line-height: 1; color: var(--ink); }
.ct-h .art { position: absolute; left: -4%; bottom: -0.12em; width: 108%; height: 0.32em; }
.ct-cont { font-size: 0.6em; color: var(--soft); margin-left: 0.3em; }
.ct-list { list-style: none; margin: 0 -1cqw 0 0; padding: 0 4cqw 0 0; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.ct-i { transform: translateX(var(--sx, 0)) rotate(var(--tilt, 0deg)); transform-origin: 0 50%; }
.ct-b {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 0.3em;
  width: 100%;
  padding: 0.3cqh 0.2em 0.6cqh 0;
  border: 0;
  background: none;
  color: var(--pen);
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
}
.ct-n, .ct-t { font-family: var(--hand); font-size: calc(min(8.2cqw, 4.7cqh) * var(--fs, 1)); line-height: 0.96; }
.ct-n { min-width: 1.15em; opacity: 0.8; }
.spread .ct-t { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5em; }
.ct-k { font-family: var(--note); font-size: max(12px, min(2.7cqw, 1.6cqh)); line-height: 1; color: var(--pen); opacity: 0.72; text-transform: lowercase; letter-spacing: 0.04em; white-space: nowrap; }
.single .ct-k { margin-left: 0.3em; vertical-align: 0.15em; }
.ct-b:hover .ct-tt, .ct-b:focus-visible .ct-tt { text-decoration: underline wavy; text-decoration-thickness: 1px; text-underline-offset: 0.16em; }
.ct-b:focus-visible { outline: 2px dashed var(--pen); outline-offset: 2px; }
.pg-contents .coffee { right: -14cqw; bottom: -6cqh; }
.writing .ct-i { animation: ct-write 0.4s cubic-bezier(0.4, 0.1, 0.3, 1) calc(var(--k, 0) * 55ms + 150ms) backwards; }
@keyframes ct-write {
  from { clip-path: polygon(0 -60%, 0 -60%, 0 160%, 0 160%); }
  to { clip-path: polygon(0 -60%, 100% -60%, 100% 160%, 0 160%); }
}

/* A chapter page */
.ch-head { display: flex; align-items: center; justify-content: space-between; gap: 4cqw; }
.ch-no { position: relative; display: inline-block; font-family: var(--hand); font-size: min(15cqw, 8.5cqh); line-height: 1; color: var(--red); padding: 0.06em 0.42em 0; }
.ch-kind { position: relative; display: inline-block; font-size: max(12px, min(2.9cqw, 1.7cqh)); text-transform: uppercase; letter-spacing: 0.16em; color: var(--pen); padding: 0.55em 0.85em 0.45em 1em; }
.ch-no .art, .ch-kind .art { position: absolute; inset: 0; width: 100%; height: 100%; }
.ch-title {
  margin: 1.2cqh 0 0;
  font-family: var(--hand);
  font-weight: 400;
  font-size: min(12.5cqw, 7.6cqh);
  line-height: 0.9;
  color: var(--pen);
  transform: rotate(var(--tilt, 0deg));
  transform-origin: 0 50%;
}
.ch-title a { color: inherit; text-decoration: none; border-radius: 6px; }
.ch-title a:hover { text-decoration: underline wavy; text-decoration-thickness: 1.5px; text-underline-offset: 0.12em; }
.ch-title a:focus-visible, .ch-open:focus-visible { outline: 2px dashed var(--pen); outline-offset: 4px; }
.ch-art { position: relative; flex: 1 1 auto; min-height: 20cqh; margin: 1.2cqh -3cqw 0.6cqh; }
.ch-art > .art { position: absolute; inset: 0; width: 100%; height: 100%; }
.single .ch-art { margin: 1.2cqh -9cqw 0.6cqh -5cqw; }
.ch-tag {
  margin: 0;
  max-width: 34ch;
  font-size: clamp(16px, 3.7cqw, 22px);
  line-height: 1.36;
  color: var(--pen);
  transform: rotate(var(--ttilt, 0deg));
}
.note-r .ch-tag { margin-left: auto; }
.ch-lede { margin: 1.6cqh 0 0; max-width: 36ch; font-size: clamp(16px, 3.4cqw, 20px); line-height: 1.42; font-weight: 300; color: var(--graphite); }
.spread .ch-lede { display: none; }
.note-r .ch-lede { margin-left: auto; }
.ch-open {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  margin-top: 2cqh;
  font-family: var(--hand);
  font-size: min(8.6cqw, 5cqh);
  line-height: 1;
  color: var(--red);
  text-decoration: none;
  border-radius: 6px;
}
.ch-open .art { width: 1.6em; height: 0.6em; }
.ch-open:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.12em; }
.arrows { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.pg-ch .coffee { z-index: 0; }
.cf-a { right: -18cqw; top: 14cqh; }
.cf-b { left: 4cqw; bottom: -12cqh; }
.cf-c { right: 10cqw; top: -16cqh; }

/* Notes page beside a drawing */
.nt-no { margin: 0; align-self: flex-end; font-family: var(--hand); font-size: min(9cqw, 5cqh); line-height: 1; color: var(--soft); }
.nt-media { display: flex; justify-content: center; align-items: flex-start; flex: 0 1 auto; min-height: 0; margin-top: 3cqh; }
.taped {
  position: relative;
  margin: 0;
  max-width: 84%;
  padding: 2.2cqw 2.2cqw 6.5cqw;
  background: #fbf8f1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 10px 22px rgba(40, 30, 20, 0.18);
  transform: rotate(var(--rot, 0deg));
}
.taped img { display: block; width: 100%; height: auto; max-height: 36cqh; object-fit: cover; }
.tape {
  position: absolute;
  width: 24cqw;
  height: 6cqw;
  min-height: 16px;
  background: var(--tape);
  clip-path: polygon(0 10%, 3% 0, 6% 12%, 9% 2%, 91% 2%, 94% 12%, 97% 0, 100% 10%, 100% 90%, 97% 100%, 94% 88%, 91% 98%, 9% 98%, 6% 88%, 3% 100%, 0 90%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}
.tape.t1 { top: -2.6cqw; left: -7cqw; transform: rotate(-34deg); }
.tape.t2 { top: -2.6cqw; right: -7cqw; transform: rotate(30deg); }
.posters { display: flex; gap: 2.4cqw; align-items: flex-start; justify-content: center; width: 100%; }
.poster { position: relative; flex: 1 1 0; min-width: 0; max-width: 300px; margin: 0; padding: 1cqw; background: #fbf8f1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 6px 14px rgba(40, 30, 20, 0.16); transform: rotate(var(--rot, 0deg)); }
.poster img { display: block; width: 100%; height: auto; }
.poster .tape { width: 10cqw; height: 3.2cqw; min-height: 10px; top: -1.8cqw; left: 50%; margin-left: -5cqw; transform: rotate(var(--trot, -4deg)); }
.stickers { display: grid; grid-template-columns: 1fr 1fr; gap: 4cqw 5cqw; width: 92%; }
.sticker {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 3 / 2;
  padding: 0.2em 0.4em;
  background: #fffdf7;
  border: 1.5px solid rgba(35, 40, 66, 0.55);
  border-radius: 7px;
  font-family: var(--hand);
  font-size: min(8cqw, 4.6cqh);
  line-height: 0.95;
  text-align: center;
  color: var(--ink);
  transform: rotate(var(--rot, 0deg));
  box-shadow: 0 2px 5px rgba(40, 30, 20, 0.14);
}
.sticker::after { content: ""; position: absolute; right: -1.5px; bottom: -1.5px; width: 18%; height: 26%; background: linear-gradient(135deg, #f4efe3 50%, #ddd5c2 50%); border-bottom-right-radius: 7px; }
.nt-study { position: relative; width: 100%; height: 40cqh; }
.nt-lede { margin: 4.5cqh 0 0; font-size: clamp(17px, 3.8cqw, 23px); line-height: 1.34; color: var(--pen); transform: rotate(-0.8deg); max-width: 30ch; }
.nt-heads { list-style: none; margin: auto 0 0; padding: 3cqh 0 0; font-family: var(--hand); font-size: min(6.4cqw, 3.6cqh); line-height: 1.05; color: var(--graphite); }
.nt-heads li::before { content: ""; display: inline-block; width: 0.32em; height: 0.32em; margin: 0 0.45em 0.08em 0; border: 1.5px solid currentColor; border-radius: 50%; vertical-align: middle; }

/* Blank backs, the last pages */
.pg-blank .smear { position: absolute; left: 20cqw; top: 30cqh; width: 50cqw; height: 18cqh; background: radial-gradient(closest-side, rgba(90, 86, 80, 0.12), rgba(90, 86, 80, 0)); transform: rotate(-8deg); }
.pg-end .pg { align-items: flex-start; }
.end-no { margin: 0; font-family: var(--hand); font-size: min(15cqw, 8.5cqh); line-height: 1; color: rgba(74, 73, 70, 0.45); }
.end-art { position: relative; flex: 1 1 auto; width: 100%; margin: 2cqh 0; opacity: 0.8; }
.end-back { border: 0; background: none; padding: 0.1em 0.2em; cursor: pointer; font-family: var(--hand); font-size: min(8.6cqw, 5cqh); color: var(--red); border-radius: 6px; }
.end-back:hover { text-decoration: underline; }
.end-back:focus-visible { outline: 2px dashed var(--pen); outline-offset: 3px; }
.pg-endl .nt-study { height: 60cqh; margin-top: 12cqh; }

/* Short pages, such as a phone on its side */
@container (max-height: 560px) {
  .nt-heads { display: none; }
}
@container (max-height: 520px) {
  .ch-lede { display: none; }
  .ch-head { margin-bottom: -1cqh; }
}

/* The fallback page: a sheet taken out of the pad */
body.fallback {
  min-height: 100vh;
  background:
    radial-gradient(110% 70% at 26% 0%, rgba(255, 226, 178, 0.14), rgba(255, 226, 178, 0) 62%),
    var(--wood),
    var(--desk);
  overflow-x: hidden;
}
.sheet {
  position: relative;
  width: min(780px, calc(100% - 20px));
  margin: 18px auto 46px;
  padding: 34px 26px 44px 50px;
  background-color: var(--paper);
  background-image: var(--grain);
  border-radius: 3px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.5), 0 4px 10px rgba(0, 0, 0, 0.3);
  container-type: inline-size;
  color: var(--pen);
}
.sheet::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 10px;
  bottom: 10px;
  width: 16px;
  background: radial-gradient(circle, var(--desk) 0 4.4px, rgba(0, 0, 0, 0) 5px) center top / 16px 26px repeat-y;
}
.fb-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.fb-home { font-family: var(--hand); font-size: 32px; line-height: 1; color: var(--ink); text-decoration: none; border-radius: 6px; }
.fb-home:hover { text-decoration: underline wavy; text-decoration-thickness: 1px; }
.fb-basket { font-size: 15px; color: var(--graphite); }
.fb-head { display: flex; align-items: center; gap: 18px; margin-top: 22px; }
.fallback .ch-no { font-size: clamp(46px, 9cqi, 70px); }
.fallback .ch-kind { font-size: 13px; }
.fb-title { margin: 10px 0 0; font-family: var(--hand); font-weight: 400; font-size: clamp(50px, 11cqi, 92px); line-height: 0.9; color: var(--pen); transform: rotate(-1deg); transform-origin: 0 50%; }
.fb-tag { margin: 14px 0 0; font-size: clamp(17px, 2.8cqi, 22px); line-height: 1.4; max-width: 40ch; }
.fb-art { position: relative; width: 100%; max-width: 620px; aspect-ratio: 4 / 3; margin: 18px auto 6px; }
.fb-art > .art { position: absolute; inset: 0; width: 100%; height: 100%; }
.fb-lede { margin: 12px 0 0; font-size: clamp(19px, 3.3cqi, 25px); line-height: 1.4; max-width: 34ch; transform: rotate(-0.6deg); }
.fb-sec h2 { margin: 34px 0 4px; font-family: var(--hand); font-weight: 400; font-size: clamp(34px, 6cqi, 46px); line-height: 1; color: var(--pen); }
.fb-sec p { margin: 0; font-size: 18px; line-height: 1.62; max-width: 60ch; color: #2b2a33; }
.fb-label { margin: 38px 0 12px; font-family: var(--hand); font-weight: 400; font-size: clamp(30px, 5.4cqi, 40px); line-height: 1; color: var(--pen); }
.fb-photos { display: grid; gap: 34px 22px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 40px; }
.fb-photos .taped { max-width: 100%; padding: 12px 12px 14px; }
.fb-photos .taped img { max-height: none; }
.fb-photos .tape { width: 110px; height: 26px; top: -12px; }
.fb-photos .tape.t1 { left: -26px; }
.fb-photos .tape.t2 { right: -26px; }
.fb-photos figcaption { margin-top: 10px; font-size: 15px; line-height: 1.35; color: var(--graphite); }
.fb-posters { display: flex; flex-wrap: wrap; gap: 26px 20px; }
.fb-posters .poster { flex: 0 1 150px; padding: 7px; }
.fb-posters .poster .tape { width: 54px; height: 16px; top: -9px; margin-left: -27px; }
.fb-posters figcaption { margin-top: 8px; font-size: 14px; line-height: 1.35; color: var(--graphite); }
.fb-posters figcaption b { display: block; font-family: var(--hand); font-weight: 400; font-size: 24px; color: var(--pen); }
.fb-stickers { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px; }
.fb-stickers .sticker { font-size: 30px; }
.fb-details { margin: 0; padding: 0; list-style: none; font-size: 17px; line-height: 1.5; }
.fb-details li::before { content: ""; display: inline-block; width: 0.42em; height: 0.42em; margin: 0 0.6em 0.1em 0; border: 1.5px solid currentColor; border-radius: 50%; vertical-align: middle; }
.fb-buy { position: relative; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; margin-top: 40px; padding: 16px 22px; border: 2px solid var(--pen); border-radius: 4px 14px 6px 12px; transform: rotate(-0.8deg); }
.fb-price { margin: 0; font-family: var(--hand); font-size: 44px; line-height: 1; }
.fb-ed { margin: 0; font-size: 15px; color: var(--graphite); }
.fb-btn { border: 0; cursor: pointer; padding: 8px 20px 6px; border-radius: 5px 12px 6px 14px; background: var(--pen); color: var(--paper); font-family: var(--hand); font-size: 28px; line-height: 1; }
.fb-btn:hover { filter: brightness(1.25); }
.fb-btn:focus-visible { outline: 2px dashed var(--pen); outline-offset: 3px; }
.fb-status { margin: 0; flex-basis: 100%; font-size: 16px; color: var(--red); min-height: 1.2em; }
.fb-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-top: 54px; padding-top: 18px; border-top: 1.5px dashed rgba(74, 73, 70, 0.45); }
.fb-next { display: inline-flex; flex-direction: column; gap: 2px; color: var(--red); text-decoration: none; text-align: right; margin-left: auto; border-radius: 6px; }
.fb-next span { font-size: 14px; color: var(--graphite); }
.fb-next b { font-family: var(--hand); font-weight: 400; font-size: clamp(30px, 6cqi, 40px); line-height: 1; }
.fb-next:hover b { text-decoration: underline wavy; text-decoration-thickness: 1px; }
.fb-home:focus-visible, .fb-next:focus-visible { outline: 2px dashed var(--pen); outline-offset: 4px; }

@media (max-width: 520px) {
  .sheet { width: calc(100% - 12px); margin: 6px auto 30px; padding: 26px 16px 34px 38px; }
  .sheet::before { left: 8px; }
  .fb-sec p { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .drawing .s, .drawing .s-t, .drawing .smudge, .writing .ct-i { animation: none; }
  .book, .stage.opening .book { transition: none; }
  .stage::after { transition: none; }
}
