/* ---------- The letter: envelope, unfolding paper, handwriting and the crew ---------- */
/* the letter is a full-screen stage of its own; while it takes over from the hub it sits on top as an overlay */
#letter.screen { position: fixed; inset: 0; z-index: 40; display: none; max-width: none; margin: 0; padding: 0; gap: 0; text-align: left; }
#letter.screen.active, #letter.lt-over { display: block; }
#letter.lt-over { animation: none; }
.lt-stage { position: absolute; inset: 0; overflow: hidden; color: var(--ink); }

/* night sky with a warm candle glow, plus the petal canvas */
.lt-bg { position: absolute; inset: 0; z-index: 0; background: radial-gradient(130% 75% at 50% 108%, #3d2449 0%, #2b1d3a 40%, #1d1327 78%); }
#letter.lt-over .lt-bg { animation: ltFade .7s ease both; }
.lt-glow {
  position: absolute; inset: 0;
  background: radial-gradient(55% 40% at 50% 46%, rgba(255, 181, 74, .16), rgba(255, 181, 74, 0) 70%),
              radial-gradient(70% 40% at 50% 100%, rgba(238, 138, 164, .16), rgba(238, 138, 164, 0) 70%);
}
.lt-sky { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---- the paper (scrollable on a phone) ---- */
.lt-scroll {
  position: absolute; inset: 0; z-index: 2; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; visibility: hidden;
  padding: max(14px, env(safe-area-inset-top)) 12px 0;
  scrollbar-width: thin; scrollbar-color: #4a3660 transparent;
}
.lt-scroll.on { visibility: visible; }
.lt-sheet {
  --fs: 1.5rem; --lh: 2.15rem; --ro: -7px;
  position: relative; z-index: 1; width: min(36rem, 100%); margin: 0 auto;
  min-height: max(22rem, calc(100svh - 14.5rem));
  padding: var(--lh) 1.15rem calc(var(--lh) * 1.4) 2.3rem;
  color: var(--ink); border-radius: 6px; cursor: default;
  background-color: #f8e8da;
  background-image:
    linear-gradient(90deg, transparent 1.6rem, rgba(238, 138, 164, .45) 1.6rem, rgba(238, 138, 164, .45) calc(1.6rem + 1.5px), transparent calc(1.6rem + 1.5px)),
    repeating-linear-gradient(180deg, transparent 0, transparent calc(var(--lh) - 1px), rgba(122, 90, 160, .2) calc(var(--lh) - 1px), rgba(122, 90, 160, .2) var(--lh)),
    linear-gradient(180deg, #fff7ee, #f8e8da);
  background-size: auto, auto, 100% var(--vis, 100%);
  background-repeat: no-repeat, repeat, no-repeat;
  background-position: 0 0, 0 var(--ro), 0 0;
  box-shadow: 0 1.4rem 2.6rem -1.2rem rgba(0, 0, 0, .75);
}
/* two soft fold creases where the letter was folded */
.lt-sheet::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: calc(var(--c2, 0px) + 16px); pointer-events: none; border-radius: inherit;
  background: linear-gradient(180deg,
    transparent calc(var(--c1, -40px) - 1px), rgba(255, 255, 255, .55) calc(var(--c1, -40px) - 1px), rgba(255, 255, 255, .55) var(--c1, -40px),
    rgba(120, 80, 100, .13) var(--c1, -40px), transparent calc(var(--c1, -40px) + 14px),
    transparent calc(var(--c2, -20px) - 1px), rgba(255, 255, 255, .55) calc(var(--c2, -20px) - 1px), rgba(255, 255, 255, .55) var(--c2, -20px),
    rgba(120, 80, 100, .13) var(--c2, -20px), transparent calc(var(--c2, -20px) + 14px));
}
.lt-head { margin: 0 0 var(--lh); font: 700 calc(var(--fs) * 1.08)/var(--lh) var(--hand); color: #b0566f; }
.lt-hh svg { display: block; margin: 0 0 -.1rem .3rem; }
.lt-p { margin: 0 0 var(--lh); font: 500 var(--fs)/var(--lh) var(--hand); overflow-wrap: break-word; }

/* each word is drawn in by a left-to-right ink wipe */
.lt-w { display: inline-block; opacity: 0; }
.lt-w.on { opacity: 1; animation: ltInk var(--wd, .3s) linear var(--wdl, 0s) both; }
.lt-w.on.ink { animation: none; }
.lt-w.on.lt-now { animation: ltShow .5s ease both; }
@keyframes ltInk { from { clip-path: inset(-40% 100% -40% -10%); } to { clip-path: inset(-40% -14% -40% -10%); } }
@keyframes ltShow { from { opacity: 0; transform: translateY(3px); } }

/* signature */
.lt-sign { display: flex; flex-direction: column; align-items: flex-end; margin: 0; padding-right: .3rem; }
.lt-love { font: 600 calc(var(--fs) * 1.08)/var(--lh) var(--hand); margin-right: 3.4em; }
.lt-name { font: 700 calc(var(--fs) * 1.7)/1.15 var(--hand); color: #6d2e5c; margin-right: .5em; }
.lt-flourish { display: block; width: 9.6rem; height: auto; margin: -.55rem -.2rem 0 0; overflow: visible; }
.lt-flourish > path { fill: none; stroke: #b0566f; stroke-width: 2.3; stroke-linecap: round; opacity: 0; }
.lt-sign.drawing .lt-flourish > path, .lt-sign.done .lt-flourish > path { opacity: 1; }
.lt-sign.lt-now .lt-flourish > path { animation: ltShow .6s ease both; }
.lt-fheart { transform-box: fill-box; transform-origin: 50% 50%; transform: scale(0); }
.lt-sign.done .lt-fheart { animation: ltHeartPop .6s cubic-bezier(.3, 1.7, .5, 1) both; }
@keyframes ltHeartPop { from { transform: scale(0) rotate(-20deg); } to { transform: none; } }

/* the quill that does the writing */
.lt-pen { position: absolute; left: 0; top: 0; z-index: 3; width: 60px; height: 60px; opacity: 0; pointer-events: none; transform-origin: 5px 56px; will-change: transform; }
.lt-pen.on { opacity: 1; animation: ltFade .4s ease both; }
.lt-pen svg { display: block; filter: drop-shadow(2px 5px 3px rgba(58, 36, 66, .25)); }

/* ---- Kuromi and the cats on a little ledge strung with fairy lights ---- */
.lt-crew { position: relative; z-index: 2; width: 100%; margin: -1.3rem auto 0; }
.lt-crew-box { position: relative; width: 100%; aspect-ratio: 360 / 176; }
.lt-crew-glow, .lt-ledge { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.lt-ledge { z-index: 2; }
/* the clip box ends at the ledge top, so the crew is hidden until they pop up */
.lt-chars { position: absolute; left: 0; top: 0; width: 100%; height: calc(100% * 154 / 176); overflow: hidden; z-index: 1; }
.lt-pop { position: absolute; transform: translateY(112%); }
/* the boxes overlap (Kuromi's holds her sign), so only painted shapes take taps */
.lt-pop, .lt-pop div, .lt-pop svg { pointer-events: none; }
.lt-pop svg * { pointer-events: visiblePainted; }
.lt-pop svg { display: block; width: 100%; height: 100%; overflow: visible; }
.lt-sw { position: relative; }
.lt-tap, .lt-sw { width: 100%; height: 100%; }
.lt-crew .lt-tap { cursor: pointer; }
.lt-crew.on .lt-pop { animation: ltPop .85s cubic-bezier(.34, 1.45, .6, 1) var(--d, 0s) both; }
@keyframes ltPop { from { transform: translateY(112%); } to { transform: none; } }
.lt-crew.on .lt-tap { animation: ltLand .5s ease-out calc(var(--d, 0s) + .45s) both; }
@keyframes ltLand { 35% { transform: scale(1.08, .9); } 70% { transform: scale(.97, 1.04); } }
/* only Kuromi sways; the cats are kept alive by their waves, the balloon and blinks */
.lt-crew.on .lt-sw-kuromi { animation: ltSway 3.6s ease-in-out infinite; }
@keyframes ltSway { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg); } }
.lt-tap.hop { animation: ltHop .55s cubic-bezier(.3, 1.4, .6, 1) !important; }
@keyframes ltHop { 35% { transform: translateY(-14%) scale(.96, 1.05); } 72% { transform: translateY(0) scale(1.06, .94); } }
/* the little moves inside each character only run once they are up */
.lt-crew .tail, .lt-crew .eyes, .lt-signboard { transform-box: fill-box; }
/* blinks are a class toggled on the story clock from JS */
.lt-crew .eyes { transform-origin: 50% 50%; }
.lt-crew .blink .eyes { transform: scaleY(.12); }
.lt-part { position: absolute; }
.lt-wave { transform: rotate(-16deg); }
.lt-crew.on .lt-wave { animation: ltWave .46s ease-in-out infinite alternate; }
.lt-crew.on .lt-sw-grey .lt-wave { animation-delay: -.23s; animation-duration: .54s; }
@keyframes ltWave { from { transform: rotate(-16deg); } to { transform: rotate(22deg); } }
.lt-signboard { transform-origin: 50% 0; }
.lt-crew.on .lt-balloon { animation: ltBalloon 3.2s ease-in-out infinite alternate; }
@keyframes ltBalloon { from { transform: rotate(-7deg); } to { transform: rotate(5deg); } }
.lt-bulb {
  position: absolute; z-index: 3; width: 5.2%; aspect-ratio: 1; margin: -2.6% 0 0 -2.6%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, var(--c), transparent); opacity: .38;
}

/* the way back to the start */
.lt-end { display: flex; justify-content: center; padding: .5rem 0 calc(1.6rem + env(safe-area-inset-bottom, 0px)); }
.lt-replay { display: inline-flex; align-items: center; gap: .5rem; visibility: hidden; background: rgba(43, 29, 58, .7); border-color: rgba(238, 138, 164, .65); }
.lt-replay:hover { border-color: var(--rose); }
.lt-end.on .lt-replay { visibility: visible; animation: ltRise .9s cubic-bezier(.3, 1.3, .5, 1) both; }
@keyframes ltRise { from { opacity: 0; transform: translateY(14px) scale(.96); } }

/* "Follow along" and "Show all": a bottom bar off to the side of the words, never over them on wide screens */
.lt-ctrl {
  position: absolute; z-index: 6; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: flex; gap: .5rem; align-items: center; pointer-events: none;
}
.lt-ctrl button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: 0 1.05rem;
  border: 1.5px solid rgba(238, 138, 164, .55); border-radius: 999px; cursor: pointer; white-space: nowrap;
  font: 700 .88rem var(--body); color: var(--cream); background: #3a2442; box-shadow: 0 .5rem 1.2rem -.4rem rgba(0, 0, 0, .65);
  opacity: 0; pointer-events: none;
}
.lt-ctrl button[hidden] { display: none; }
.lt-ctrl button.on { opacity: 1; pointer-events: auto; animation: ltRise .45s ease both; }
.lt-ctrl .lt-skip.on { animation-delay: .5s; }
.lt-ctrl button:active { transform: scale(.96); }
@media (min-width: 900px) {
  .lt-ctrl { left: calc(50% + 18rem + 1.25rem); top: 2rem; bottom: auto; transform: none; flex-direction: column; align-items: flex-start; }
}

/* the way back: the letter fades and sinks away while the cake room starts underneath */
#letter.lt-exit { pointer-events: none; }
#letter.lt-exit .lt-bg { animation: none; }  /* lt-over must not replay the hub fade-in on the way out */
#letter.lt-exit .lt-stage { animation: ltExit .75s cubic-bezier(.5, 0, .75, 0) both; }
@keyframes ltExit { to { opacity: 0; transform: translateY(1.5rem) scale(.96); } }

/* ---- the envelope and the folding stand-in for the letter (driven from JS on BD's clock) ---- */
.lt-envs { position: absolute; inset: 0; z-index: 4; }
.lt-e {
  position: absolute; left: calc(var(--ew) * -.5); top: calc(var(--eh) * -.5); width: var(--ew); height: var(--eh);
  transform-origin: 50% 50%; will-change: transform; opacity: 0;
}
.lt-e svg { display: block; width: 100%; height: 100%; }
.lt-e-shadow { z-index: 1; top: calc(var(--eh) * .3); height: calc(var(--eh) * .5); background: radial-gradient(closest-side, rgba(10, 4, 16, .55), rgba(10, 4, 16, 0)); }
.lt-e-back { z-index: 2; }
.lt-e-pocket { z-index: 4; }
.lt-e-flapw { z-index: 5; }
.lt-e-sealw { z-index: 6; }
/* a twin of the hub's envelope drawing (its body, 300 x 146 of a 320 x 176 box, matches our width); its
   transform origin is the body centre, which is where our envelope centre sits */
.lt-hubtwin {
  position: absolute; z-index: 7; left: calc(var(--ew) * -160 / 300); top: calc(var(--ew) * -95 / 300);
  width: calc(var(--ew) * 320 / 300); height: calc(var(--ew) * 176 / 300); transform-origin: 50% 53.977%; will-change: transform;
}
.lt-hubtwin[hidden] { display: none; }
.lt-hubtwin svg { display: block; width: 100%; height: 100%; overflow: visible; }
.lt-flap { position: absolute; left: 0; top: 0; width: 100%; height: calc(var(--eh) * 124 / 205); transform-origin: 50% 0; transform-style: preserve-3d; }
.lt-flap i { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.lt-flap .bk { transform: rotateY(180deg); }
.lt-seal { position: absolute; left: 50%; top: calc(var(--eh) * 110 / 205); width: calc(var(--ew) * .18); height: calc(var(--ew) * .18); margin: calc(var(--ew) * -.09) 0 0 calc(var(--ew) * -.09); }
.lt-seal i { position: absolute; inset: 0; }
.lt-seal svg { display: block; width: 100%; height: 100%; overflow: visible; }
.lt-seal .l { clip-path: inset(-20% calc(50% - 1px) -20% -20%); }  /* the halves overlap a hair: no seam */
.lt-seal .r { clip-path: inset(-20% -20% -20% calc(50% - 1px)); }
.lt-ring { position: absolute; inset: -12%; border: 2px solid #f6b3c6; border-radius: 50%; opacity: 0; }
.lt-seal.go .lt-ring { animation: ltRing .6s ease-out both; }
@keyframes ltRing { from { opacity: .9; transform: scale(.7); } to { opacity: 0; transform: scale(2.3); } }

.lt-fold { position: absolute; z-index: 3; opacity: 0; transform-origin: 50% 50%; transform-style: preserve-3d; will-change: transform; }
.lt-pn { position: absolute; inset: 0 0 -1px; transform-style: preserve-3d; }
.lt-pn i { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.lt-pn .bk { transform: rotateX(180deg); background: linear-gradient(180deg, #ead5c3, #f3e2d2); }
.lt-hg { position: absolute; left: 0; top: 100%; width: 100%; height: 100%; transform-origin: 50% 0; transform-style: preserve-3d; will-change: transform; }
.lt-pn .fr {
  --o: 0px;
  background-color: #f8e8da;
  background-image:
    linear-gradient(180deg, rgba(120, 80, 100, var(--crease, 0)), rgba(120, 80, 100, 0) 14px),
    linear-gradient(90deg, transparent 1.6rem, rgba(238, 138, 164, .45) 1.6rem, rgba(238, 138, 164, .45) calc(1.6rem + 1.5px), transparent calc(1.6rem + 1.5px)),
    repeating-linear-gradient(180deg, transparent 0, transparent calc(var(--lh) - 1px), rgba(122, 90, 160, .2) calc(var(--lh) - 1px), rgba(122, 90, 160, .2) var(--lh)),
    linear-gradient(180deg, #fff7ee, #f8e8da);
  background-size: auto, auto, auto, 100% var(--vis, 100%);
  background-repeat: no-repeat, no-repeat, repeat, no-repeat;
  background-position: 0 0, 0 0, 0 calc(var(--ro) + var(--o)), 0 var(--o);
}
.lt-fold { --fs: 1.5rem; --lh: 2.15rem; --ro: -7px; }
.lt-fold > .lt-pn > i { border-radius: 6px 6px 0 0; }
.lt-fold > .lt-hg > .lt-pn > .fr { --o: calc(var(--vis) / -3); --crease: .13; }
.lt-fold > .lt-hg > .lt-hg > .lt-pn > .fr { --o: calc(var(--vis) / -1.5); --crease: .13; }
.lt-fold.fits > .lt-hg > .lt-hg > .lt-pn > i { border-radius: 0 0 6px 6px; }
.lt-fold.fits > .lt-hg > .lt-hg > .lt-pn > .fr { box-shadow: 0 1.4rem 2.6rem -1.2rem rgba(0, 0, 0, .75); }

/* bigger handwriting on wider screens, a touch smaller on narrow phones */
@media (min-width: 700px) {
  .lt-sheet, .lt-fold { --fs: 1.7rem; --lh: 2.4rem; --ro: -8px; }
  .lt-sheet { padding-left: 2.9rem; padding-right: 2rem; min-height: max(24rem, calc(100svh - 16rem)); }
  .lt-scroll { padding-top: 2rem; }
  .lt-crew { width: min(100%, 34rem); }
}
/* laptops (she may watch on a shared screen): a bigger finale */
@media (min-width: 900px) { .lt-crew { width: min(100%, 40rem); } }
@media (max-width: 370px) {
  .lt-sheet, .lt-fold { --fs: 1.4rem; --lh: 2rem; --ro: -6px; }
  .lt-sheet { padding-left: 2.1rem; padding-right: .9rem; }
}

@keyframes ltFade { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  #letter.lt-exit .lt-stage { animation-name: ltFade; animation-direction: reverse; }
}

/* ---- the full-screen view of a handwritten page ---- */
.lt-zoom {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  background: rgba(20, 12, 28, .92); cursor: zoom-out; animation: ltFade .25s ease both;
}
.lt-zoom[hidden] { display: none; }
.lt-zoom img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 1rem 3rem rgba(0, 0, 0, .6); }
.lt-zoom-x {
  position: absolute; top: max(10px, env(safe-area-inset-top)); right: 12px; width: 2.6rem; height: 2.6rem;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; font-size: 1.7rem; line-height: 1; cursor: pointer;
}

/* ---- the letter as a little book: a cover she taps open, then pages she taps to turn ---- */
.lt-sheet.lt-book {
  --bw: min(100%, 30rem, calc((100vh - 7.5rem) * .7));
  --bw: min(100%, 30rem, calc((100svh - 7.5rem) * .7));
  width: var(--bw); aspect-ratio: 7 / 10; min-height: 0; margin: 0 auto; padding: 0;
  background: none; box-shadow: none; border-radius: 4px 12px 12px 4px; perspective: 2400px;
  animation: ltBookIn .7s cubic-bezier(.3, 1.2, .5, 1) both;
}
@keyframes ltBookIn { from { opacity: 0; transform: translateY(10px) scale(.97); } }
/* the stack of page edges peeking out under the top leaf */
.lt-sheet.lt-book::before, .lt-sheet.lt-book::after {
  content: ""; display: block; position: absolute; top: 0; left: 0; right: 0; bottom: 0; height: auto; pointer-events: none;
  border-radius: 3px 10px 10px 3px; background: #eadcc4; z-index: 0;
}
.lt-sheet.lt-book::before { transform: translate(7px, 7px); background: #d9c6a6; box-shadow: 0 1.6rem 2.6rem -1rem rgba(0, 0, 0, .8); }
.lt-sheet.lt-book::after { transform: translate(3.5px, 3.5px); }
.lt-book .lt-leaves { position: absolute; inset: 0; z-index: 1; transform-style: preserve-3d; }
.lt-leaf {
  position: absolute; inset: 0; transform-origin: 0 50%; transform-style: preserve-3d;
  transition: transform 1.05s cubic-bezier(.45, .05, .2, 1); cursor: pointer; outline: none;
}
.lt-leaf.turned { transform: rotateY(-180deg); pointer-events: none; }
.lt-face {
  position: absolute; inset: 0; overflow: hidden; border-radius: 3px 10px 10px 3px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
/* a shadow sweeps over the page as it lifts */
.lt-face::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, rgba(40, 20, 30, 0), rgba(40, 20, 30, .35)); transition: opacity 1.05s ease;
}
.lt-leaf.turned .lt-face::after { opacity: 1; }
.lt-leaf:focus-visible .lt-face { box-shadow: 0 0 0 3px rgba(246, 201, 214, .9); }

/* paper pages: warm cream, the spine's shade at the left, a book typeface */
.lt-paper .lt-face {
  color: #3b2a30;
  background:
    linear-gradient(90deg, rgba(110, 70, 50, .22), rgba(110, 70, 50, .06) 4%, rgba(110, 70, 50, 0) 9%),
    radial-gradient(120% 90% at 60% 40%, #fffaf1, #f6ead6);
}
.lt-pg {
  position: absolute; top: 8.5%; bottom: 10%; left: 12%; right: 9%; overflow: hidden;
  font: 400 var(--bfs, 17px)/1.52 "EB Garamond", Garamond, Georgia, serif;
  text-align: justify; hyphens: auto; -webkit-hyphens: auto;
}
.lt-pg .lt-p { margin: 0; font: inherit; text-indent: 1.4em; overflow-wrap: normal; }
.lt-pg .lt-head + .lt-body .lt-p:first-child, .lt-pg .lt-p.lt-has-dc, .lt-pg .lt-body > .lt-p:first-child { text-indent: 0; }
.lt-pg .lt-p + .lt-p { margin-top: .35em; }
.lt-pg .lt-w { display: inline; }
.lt-pg .lt-w.on, .lt-pg .lt-w.on.lt-now { animation: ltFade .6s ease both; }
/* page one: a little dedication heading, an italic opening line and a drop cap */
.lt-pg .lt-head {
  margin: 0 0 .9em; text-align: center; font: 600 .78em/1.4 "EB Garamond", Georgia, serif;
  letter-spacing: .22em; text-transform: uppercase; color: #a8516b;
}
.lt-pg .lt-head .lt-hh { display: inline-block; vertical-align: -.15em; }
.lt-pg .lt-head .lt-hh svg { width: 1em; height: 1em; margin: 0 0 0 .35em; }
.lt-pg1 .lt-body > .lt-p:first-child { text-align: center; font-style: italic; font-size: 1.12em; margin-bottom: .6em; }
.lt-dc {
  float: left; font: 400 3.55em/.82 "Caprasimo", "EB Garamond", Georgia, serif; color: #8e3f63;
  margin: .06em .1em 0 0; padding-top: .02em;
}
.lt-folio {
  position: absolute; left: 0; right: 0; bottom: 4.2%; text-align: center;
  font: italic 400 max(11px, calc(var(--bfs, 17px) * .78)) "EB Garamond", Georgia, serif; color: #a08672;
}
.lt-folio::before, .lt-folio::after { content: "\2014"; margin: 0 .5em; opacity: .55; }
/* the last page ends with the signature in handwriting */
.lt-pg .lt-sign { --fs: 1.3em; --lh: 1.5em; margin-top: .5em; }
.lt-pg .lt-flourish { width: 7.5em; }

/* the cover: plum cloth, gold foil, a gilded frame and a spine */
.lt-cover .lt-face {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .45), rgba(0, 0, 0, .1) 3.5%, rgba(255, 220, 160, .14) 4.5%, rgba(0, 0, 0, .15) 6%, rgba(0, 0, 0, 0) 9%),
    radial-gradient(120% 85% at 32% 22%, #6a3476 0%, #4a2357 45%, #2a1433 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), inset -10px 0 22px -14px rgba(0, 0, 0, .7);
}
/* fine cloth grain */
.lt-cover .lt-face::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5; mix-blend-mode: overlay;
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .05) 0 1px, transparent 1px 3px), repeating-linear-gradient(-45deg, rgba(0, 0, 0, .08) 0 1px, transparent 1px 3px);
}
.lt-cv {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 14% 0 16%; text-align: center; color: #f3d28a; font-size: calc(var(--bwpx, 360px) / 22);
}
.lt-cv-frame { position: absolute; top: 5.5%; bottom: 5.5%; left: 11%; right: 6%; border: 1.5px solid rgba(240, 200, 120, .75); border-radius: 3px; }
.lt-cv-frame::before { content: ""; position: absolute; inset: 5px; border: 1px solid rgba(240, 200, 120, .35); border-radius: 2px; }
.lt-cv-frame .c { position: absolute; width: 14px; height: 14px; border: 1.5px solid rgba(240, 200, 120, .85); border-radius: 50%; background: #3e1d49; }
.lt-cv-frame .tl { left: -8px; top: -8px; } .lt-cv-frame .tr { right: -8px; top: -8px; }
.lt-cv-frame .bl { left: -8px; bottom: -8px; } .lt-cv-frame .br { right: -8px; bottom: -8px; }
.lt-cv-sky { width: 62%; height: auto; margin-bottom: 1.1em; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .45)); }
.lt-cv-for { margin: 0; font: italic 400 1.5em/1 "EB Garamond", Georgia, serif; letter-spacing: .06em; color: #f0d6a4; }
.lt-cv-title, .lt-cv-sky, .lt-cv-rule svg { position: relative; }
.lt-cv-title {
  margin: .08em 0 .1em; font: 400 3.6em/1.05 "Caprasimo", Georgia, serif; letter-spacing: .01em; overflow-wrap: anywhere;
  background: linear-gradient(170deg, #fff3cc 0%, #e8b862 40%, #fff0c0 58%, #c98f3c 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35));
}
.lt-cv-rule { display: flex; align-items: center; gap: .6em; width: 70%; margin: .5em 0 .8em; }
.lt-cv-rule span { flex: 1; height: 1px; background: linear-gradient(90deg, rgba(240, 200, 120, 0), rgba(240, 200, 120, .85), rgba(240, 200, 120, 0)); }
.lt-cv-by { margin: 0; font: 500 1.05em/1.2 "EB Garamond", Georgia, serif; letter-spacing: .32em; text-transform: uppercase; color: #f0d6a4; }
.lt-cv-tap {
  position: absolute; bottom: 10%; left: 0; right: 0; margin: 0; font: 600 .8em/1 "Figtree", sans-serif;
  letter-spacing: .18em; text-transform: uppercase; color: rgba(246, 201, 214, .85); animation: ltTap 2.2s ease-in-out infinite;
}
@keyframes ltTap { 50% { opacity: .35; } }
/* once the book is open the hint goes (otherwise it shows through, mirrored, on the turned cover) */
.lt-cover.turned .lt-cv-tap { animation: none; opacity: 0; visibility: hidden; transition: opacity .25s, visibility 0s .25s; }

/* the page controls under the book */
.lt-nav { display: flex; align-items: center; justify-content: center; gap: .9rem; min-height: 3rem; margin: .7rem auto 0; color: #f6c9d6; }
.lt-nav-t { min-width: 3.5em; text-align: center; font: italic 500 1.05rem/1 "EB Garamond", Georgia, serif; letter-spacing: .08em; }
.lt-nav-t:empty { display: none; }
.lt-nav-b {
  display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; padding: 0; border-radius: 50%;
  border: 1px solid rgba(238, 138, 164, .55); background: rgba(43, 29, 58, .7); color: inherit; cursor: pointer;
}
.lt-nav-b[hidden], .lt-nav-more[hidden] { display: none; }
.lt-nav-more {
  display: inline-flex; align-items: center; gap: .45rem; padding: .55rem 1rem; border-radius: 999px; opacity: 0;
  border: 1px solid rgba(238, 138, 164, .55); background: rgba(43, 29, 58, .7); color: inherit; font: 600 .85rem/1 "Figtree", sans-serif; cursor: pointer;
  transition: opacity .6s ease;
}
.lt-nav-more.on { opacity: 1; }
.lt-nav + .lt-crew { margin-top: .6rem; }
@media (prefers-reduced-motion: reduce) {
  .lt-leaf, .lt-face::after { transition-duration: .01s; }
  .lt-cv-tap { animation: none; }
}

/* the handwritten pages inside the book: the photo laid on the page like a pasted-in sheet */
.lt-ph { position: absolute; top: 5.5%; bottom: 9.5%; left: 10%; right: 6%; display: flex; flex-direction: column; gap: .5em; }
.lt-ph-img { position: relative; flex: 1; min-height: 0; }
.lt-ph-img img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transform: rotate(-1deg);
  filter: drop-shadow(0 .4rem .5rem rgba(60, 30, 30, .4));
}
.lt-photo:nth-child(odd) .lt-ph-img img { transform: rotate(1.2deg); }
.lt-ph-line { flex: none; margin: 0; text-align: center; font: 700 calc(var(--bwpx, 360px) / 15)/1.1 var(--hand); color: #a8516b; }
.lt-ph-zoom {
  position: absolute; right: 8%; bottom: 3.2%; z-index: 2; display: inline-flex; align-items: center; justify-content: center;
  width: 2.2rem; height: 2.2rem; padding: 0; border: 0; border-radius: 50%; background: rgba(142, 63, 99, .85); color: #fff; cursor: zoom-in;
}
/* phones: the book fills the screen's height, so the pages hold more text at a readable size */
@media (max-width: 600px) {
  .lt-sheet.lt-book { width: 100%; aspect-ratio: auto; height: calc(100vh - 7rem); height: calc(100svh - 7rem); max-height: 50rem; }
  .lt-pg { left: 10.5%; right: 7.5%; top: 7%; bottom: 8.5%; }
  .lt-ph { left: 9%; right: 5%; }
}

/* the closed book inside the envelope: the same cover, with the page edges drawn as shadows */
.lt-fold-book > .lt-cover { position: absolute; inset: 0; border-radius: 3px 10px 10px 3px; box-shadow: 3.5px 3.5px 0 #eadcc4, 7px 7px 0 #d9c6a6, 0 1.6rem 2.6rem -1rem rgba(0, 0, 0, .8); }
.lt-fold-book .lt-cv-tap { visibility: hidden; }
/* the real book takes over invisibly, so no entrance animation */
.lt-sheet.lt-book { animation: none; }
