/* =====================================================================
   Lea wird 18 – paper & crayon scroll story
   ===================================================================== */
:root {
  --paper: #f6eedc;
  --paper-2: #fffdf6;
  --card: #d8b98c;
  --card-dark: #b9966a;
  --note: #fff0a3;
  --ink: #2b2b2b;
  --red: #e2473a;
  --orange: #f28c28;
  --yellow: #f5c324;
  --green: #5aae4a;
  --duo: #58cc02;
  --blue: #3f8fd6;
  --purple: #9b6bd1;
  --night: #27314f;
  --hand: 'Caveat', 'Comic Sans MS', 'Chalkboard SE', cursive;
  --body: 'Patrick Hand', 'Comic Sans MS', 'Chalkboard SE', cursive;
  --col: min(540px, 62svh);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; overflow-x: clip; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 21px;
  line-height: 1.3;
  width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  overscroll-behavior: none;
  touch-action: pan-y pinch-zoom;
}
/* every section clips sideways overflow itself: scraps parked off-screen before they slide in
   must never widen the page (clip, not hidden, so position: sticky keeps working inside) */
#story, .scene, .flow, .cover { overflow-x: hidden; overflow-x: clip; }
em { font-style: normal; text-decoration: underline wavy var(--red); text-decoration-thickness: 2px; text-underline-offset: 3px; }
strong { font-weight: 700; }

/* paper grain over everything */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 50;
  opacity: .5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.38 0 0 0 0 0.28 0 0 0 .14 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- shared SVG sketch classes (used inside the sprite and inline art) ---------- */
.ol { fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ol.thin { stroke-width: 1.6; }
.ol.thick { stroke-width: 7; }
.ol.red { stroke: var(--red); }
.lo { fill: none; stroke: var(--ink); stroke-linecap: round; stroke-linejoin: round; }
.lf { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.fig { display: block; height: auto; overflow: visible; }

/* ---------- paper scraps ---------- */
.scrap {
  position: relative;
  background: var(--paper-2);
  padding: .55em .8em;
  filter: drop-shadow(1px 2px 0 rgba(90, 70, 40, .10)) drop-shadow(0 6px 10px rgba(60, 40, 10, .14));
  transform: rotate(var(--r, 0deg));
  margin: 0;
  /* torn edge – replaced per element by script with an irregular polygon */
  clip-path: polygon(0 2%, 4% 0, 30% 1.5%, 60% 0, 100% 2%, 99% 40%, 100% 70%, 98.5% 100%, 70% 98.5%, 30% 100%, 0 98%, 1% 60%);
}
.scrap.card {
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.05) 0 2px, transparent 2px 9px),
    var(--card);
}
.scrap.note { background: var(--note); }
.scrap.tape::before {
  content: ""; position: absolute; left: 50%; top: -11px; width: 86px; height: 24px;
  transform: translateX(-50%) rotate(-3deg);
  background: rgba(255, 236, 170, .72);
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.25) 0 3px, transparent 3px 6px);
  border-left: 2px dashed rgba(200,170,90,.35); border-right: 2px dashed rgba(200,170,90,.35);
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.caption { font-size: 1.05em; text-align: center; }
.caption.center { max-width: 22em; margin: 0 auto; }
.label { font-family: var(--hand); font-size: 1.6em; font-weight: 700; padding: .1em .7em; }

/* ---------- speech bubbles & thought cloud ---------- */
.bubble {
  position: relative; background: #fff; color: var(--ink);
  padding: .5em .8em; font-family: var(--hand); font-size: 1.45em; font-weight: 500; line-height: 1.15;
  border: 2.6px solid var(--ink);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  box-shadow: 2px 3px 0 rgba(0,0,0,.12);
}
.bubble.small { font-size: 1.3em; text-align: center; }
.bubble::after {
  content: ""; position: absolute; width: 18px; height: 18px; background: #fff;
  border: 2.6px solid var(--ink); border-top: none; border-right: none;
}
.bubble.tail-bl::after { left: 22px; bottom: -11px; transform: rotate(-30deg) skewX(-20deg); }
.bubble.tail-br::after { right: 22px; bottom: -11px; transform: rotate(-60deg) skewX(20deg); }
.cloud {
  position: relative; background: #fff; border: 2.6px solid var(--ink);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  padding: .45em 1.2em; font-family: var(--hand); font-size: 1.3em; line-height: 1.1; text-align: center;
  box-shadow: 2px 3px 0 rgba(0,0,0,.12);
}
.cloud::before, .cloud::after {
  content: ""; position: absolute; background: #fff; border: 2.6px solid var(--ink); border-radius: 50%;
}
.cloud::before { width: 16px; height: 16px; left: 22px; bottom: -22px; }
.cloud::after { width: 9px; height: 9px; left: 10px; bottom: -36px; }

/* ---------- Liam's red-pen notes ---------- */
.redpen {
  position: absolute; right: .7em; bottom: .35em;
  font-family: var(--hand); font-weight: 700; color: var(--red); font-size: 1.05em; line-height: 1;
  transform: rotate(var(--r, -4deg)); text-align: right;
  padding: .1em .2em;
}
.redpen.big { font-size: 2.6em; right: .3em; bottom: .2em; }

/* =====================================================================
   COVER
   ===================================================================== */
.cover {
  min-height: 100vh; min-height: 100svh;
  display: grid; place-items: center; padding: 20px 16px 40px; position: relative; overflow: hidden;
}
.cover-inner { position: relative; width: 100%; max-width: var(--col); height: 92vh; height: 92svh; }
.cover .label { position: absolute; left: 6%; top: 2%; }
.title { position: absolute; left: 0; right: 0; top: 11%; margin: 0; text-align: center; font-family: var(--hand); font-weight: 700; line-height: .95; }
.crayon-word { display: block; }
.crayon-word > span { display: inline-block; color: var(--c, var(--ink)); font-size: min(3.6rem, 8svh); transform: rotate(var(--rot, -3deg)); text-shadow: 2px 2px 0 rgba(0,0,0,.08); }
.crayon-word > span:nth-child(2n) { --rot: 4deg; }
.crayon-word.small { font-size: min(2rem, 4.4svh); color: var(--ink); margin: -.1em 0; }
.crayon-word.big > span { font-size: min(6.4rem, 13svh); }
.cover-lea { position: absolute; left: 50%; bottom: 13%; width: min(50%, 30svh); transform: translateX(-50%); }
.cover-balloons { position: absolute; right: 0; top: 33%; width: 28%; }
.cover-cake { position: absolute; right: 0; bottom: 16%; width: 30%; }
.cover .sub { position: absolute; right: 0; top: 1%; width: 36%; text-align: center; font-size: .9em; hyphens: auto; }
.hint { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); text-align: center; font-family: var(--hand); font-size: 1.4em; font-weight: 700; }
.hint-arrow { width: 40px; display: block; margin: 0 auto; animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(8px); } }

.drop-in { animation: dropIn .7s cubic-bezier(.2,.9,.3,1.2) both; animation-delay: var(--d, 0s); }
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-60px) rotate(calc(var(--r, 0deg) - 10deg)); }
  to   { opacity: 1; transform: translateY(0) rotate(var(--r, 0deg)); }
}
.cover-lea.drop-in { animation-name: dropInLea; }
@keyframes dropInLea { from { opacity: 0; transform: translate(-50%, 60px); } to { opacity: 1; transform: translate(-50%, 0); } }
.hint.drop-in { animation-name: fadeIn; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* =====================================================================
   STICKY SCENES
   ===================================================================== */
.scene { position: relative; height: calc(var(--len, 3) * 100vh); height: calc(var(--len, 3) * 100svh); }
.stage {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
  max-width: var(--col); margin: 0 auto;
}
.el { position: absolute; will-change: transform, opacity; opacity: 0; }
.scene.night .stage { background: var(--night); }
.scene.night { background: var(--night); }
.scene.night .caption { color: var(--ink); }

.mini { font-family: var(--hand); font-size: 1.5em; font-weight: 700; padding: .15em .6em; white-space: nowrap; }
.strike::after {
  content: ""; position: absolute; left: 4%; right: 4%; top: 50%; height: 5px; background: var(--red);
  transform: rotate(-4deg); border-radius: 3px; opacity: .9;
}
.bigwish { position: absolute; }
.bigwish .scrap { font-family: var(--hand); font-size: 2.2em; font-weight: 700; text-align: center; line-height: .95; padding: .4em .5em; }
.bigwish .circle { position: absolute; inset: -22% -12%; width: 124%; height: 144%; overflow: visible; }
.bigwish .circle path { opacity: .9; }

.burst {
  font-family: var(--hand); font-weight: 700; font-size: 2.2em; line-height: 1; color: var(--ink);
  background: var(--red); color: #fff; padding: .35em .6em;
  clip-path: polygon(50% 0, 61% 14%, 78% 6%, 80% 24%, 98% 26%, 86% 42%, 100% 54%, 84% 64%, 92% 84%, 72% 80%, 68% 100%, 50% 86%, 32% 100%, 28% 80%, 8% 84%, 16% 64%, 0 54%, 14% 42%, 2% 26%, 20% 24%, 22% 6%, 39% 14%);
}
.burst.yellow { background: var(--yellow); color: var(--ink); }
.burst.blue { background: var(--blue); }
.winner { font-family: var(--hand); text-align: center; font-size: 2.2em; line-height: 1; padding: .4em .5em; }
.winner span { font-size: .6em; }

/* =====================================================================
   FLOW SECTIONS (wish list, finale)
   ===================================================================== */
.flow { position: relative; max-width: var(--col); margin: 0 auto; padding: 0 16px; }
.wishes { padding-bottom: 20vh; }
.sticky-head {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 16px 8px;
  margin: 0 -16px; background: var(--paper);
}
.sticky-head::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 16px; background: linear-gradient(var(--paper), rgba(246,238,220,0)); pointer-events: none; }
.sticky-head .head { width: 84px; flex: 0 0 auto; }
.sticky-head .cloud { flex: 1; }
.list { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding-top: 10px; }
.heading { font-family: var(--hand); font-size: 2.2em; font-weight: 700; text-align: center; margin: 14px 10% 10px; }
.arrow { width: 90px; height: 90px; margin: -4px 0; align-self: flex-start; margin-left: 12%; overflow: visible; }
.arrow.right { align-self: flex-end; margin-right: 12%; margin-left: 0; }
.arrow path { stroke-width: 3.6; stroke-dasharray: 1; stroke-dashoffset: 1; }

.wish { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 18px 20px 44px; margin: 6px 0 14px; }
.wish .nr { position: absolute; left: .4em; top: .2em; font-family: var(--hand); font-weight: 700; font-size: 1.5em; color: var(--blue); }
.wish .fig { width: 62%; margin: 0 auto; }
.wish .fig.wide { width: 86%; }
.wish .fig.owl { width: 42%; margin: 0 0 0 auto; }
.wish p { margin: 0 0 .6em; text-align: center; font-size: 1.08em; }
.wish.tiny { width: 78%; margin-left: auto; margin-right: 0; padding-bottom: 16px; }
.wish.tiny p { text-align: left; }
.wish.tiny .redpen.big { bottom: auto; top: .2em; left: .4em; right: auto; }

/* data-view elements start hidden until the scroll engine places them */
[data-view] { opacity: 0; will-change: transform, opacity; }
.no-js [data-view], .no-js .el { opacity: 1 !important; transform: none !important; }

/* =====================================================================
   FINALE
   ===================================================================== */
.finale { padding-top: 10vh; padding-bottom: 14vh; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.finale .arrow { align-self: center; margin: 0; }
.owl-wrap { position: relative; width: 74%; max-width: 340px; }
.owl-big { width: 100%; animation: owlBob 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes owlBob { 0%,100% { transform: rotate(-2deg) translateY(0); } 50% { transform: rotate(2deg) translateY(-6px); } }
.spark { position: absolute; width: 34px; animation: twinkle 1.6s ease-in-out infinite; }
.spark.s1 { left: -6%; top: 10%; }
.spark.s2 { right: -4%; top: 2%; animation-delay: .5s; }
.spark.s3 { right: 8%; top: 46%; animation-delay: 1s; width: 24px; }
@keyframes twinkle { 0%,100% { opacity: .2; transform: scale(.7) rotate(0); } 50% { opacity: 1; transform: scale(1.1) rotate(20deg); } }

/* envelope */
.envelope-wrap { width: 82%; max-width: 360px; }
.envelope {
  position: relative; display: block; width: 100%; aspect-ratio: 3 / 2; border: 0; padding: 0; background: none;
  cursor: pointer; font: inherit; color: var(--ink); -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 8px 12px rgba(60,40,10,.18));
  transform: rotate(-2deg);
}
.envelope > span { position: absolute; inset: 0; display: block; }
.envelope .env-back { background: #e9d9b8; border: 2.6px solid var(--ink); border-radius: 6px; }
.envelope .env-letter {
  inset: 6% 6% auto 6%; height: 80%; background: var(--paper-2); border: 2.6px solid var(--ink); border-radius: 4px;
  transition: transform .6s cubic-bezier(.2,.8,.2,1.1) .3s;
  background-image: repeating-linear-gradient(0deg, transparent 0 18px, rgba(63,143,214,.35) 18px 20px);
}
.envelope .env-front {
  background: #f1e3c4;
  clip-path: polygon(0 0, 50% 55%, 100% 0, 100% 100%, 0 100%);
  border: 2.6px solid var(--ink); border-radius: 6px;
}
.env-front::before, .env-front::after {
  content: ""; position: absolute; top: 0; width: 60%; height: 2.6px; background: var(--ink); transform-origin: 0 0;
}
.env-front::before { left: 0; transform: rotate(47deg); }
.env-front::after { right: 0; transform-origin: 100% 0; transform: rotate(-47deg); }
.envelope .env-flap {
  background: #e4d2ad; border: 2.6px solid var(--ink); border-radius: 6px 6px 0 0;
  clip-path: polygon(0 0, 100% 0, 50% 58%);
  transform-origin: 50% 0; transition: transform .5s ease-in; z-index: 2;
}
.env-flap::after { content: ""; position: absolute; inset: 0; clip-path: polygon(0 0, 100% 0, 50% 58%); box-shadow: inset 0 -2.6px 0 var(--ink); }
.envelope .env-seal { inset: 50% auto auto 50%; width: 52px; height: 52px; transform: translate(-50%, -50%); z-index: 3; transition: opacity .3s, transform .3s; }
.env-seal svg { width: 100%; height: 100%; overflow: visible; }
.envelope .env-label { inset: auto 0 8% 0; text-align: center; font-family: var(--hand); font-weight: 700; font-size: 1.6em; line-height: 1; z-index: 2; }
.env-label small { font-size: .55em; font-weight: 500; }
.envelope.open .env-flap { transform: rotateX(180deg); }
.envelope.open .env-seal { opacity: 0; transform: translate(-50%, -50%) scale(.3); }
.envelope.open .env-letter { transform: translateY(-62%); }
.envelope.open .env-label { opacity: 0; transition: opacity .3s; }
.envelope:hover .env-seal, .envelope:focus-visible .env-seal { transform: translate(-50%, -50%) scale(1.15); }
.envelope:focus-visible { outline: 3px dashed var(--blue); outline-offset: 6px; }

.letter { width: 92%; max-width: 420px; padding: 22px 22px 18px; text-align: center; animation: letterIn .7s cubic-bezier(.2,.9,.3,1.2) both; }
.letter[hidden] { display: none; }
@keyframes letterIn { from { opacity: 0; transform: translateY(40px) rotate(var(--r)); } to { opacity: 1; transform: translateY(0) rotate(var(--r)); } }
.letter-head { font-family: var(--hand); font-weight: 700; font-size: 2.4em; line-height: 1; color: var(--duo); margin: 0; text-shadow: 2px 2px 0 rgba(0,0,0,.1); }
.letter-sub { font-family: var(--hand); font-size: 1.4em; margin: 0 0 .5em; }
.letter p { margin: .4em 0; }
.btn {
  display: inline-block; margin: .6em 0 .4em; padding: .5em 1.3em; font-family: var(--hand); font-weight: 700; font-size: 1.4em; line-height: 1;
  background: var(--duo); color: #fff; text-decoration: none; border: 2.6px solid var(--ink);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px; box-shadow: 3px 4px 0 var(--ink);
  transition: transform .15s, box-shadow .15s;
}
.btn:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.letter-foot { font-family: var(--hand); font-size: 1.2em; color: #666; }
.letter-foot .heart { width: 22px; vertical-align: -4px; display: inline-block; }

/* confetti scraps */
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i {
  position: absolute; top: -20px; width: 12px; height: 18px; background: var(--c);
  clip-path: polygon(10% 0, 100% 8%, 92% 100%, 0 90%);
  animation: confetti var(--dur) linear var(--delay) infinite; opacity: 0;
}
@keyframes confetti {
  0% { transform: translateY(0) rotate(0); opacity: 0; }
  5% { opacity: .9; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: .8; }
}

/* =====================================================================
   DESKTOP: keep the phone-column feel, decorate the margins
   ===================================================================== */
@media (min-width: 700px) {
  body { font-size: 22px; }
  .scene .stage { box-shadow: 0 0 0 1px rgba(0,0,0,.04); }
}

@media (prefers-reduced-motion: reduce) {
  .drop-in, .hint-arrow, .owl-big, .spark, .confetti i { animation: none !important; opacity: 1; }
  .el, [data-view] { transition: none; }
}
