/* What every page shares (js/book.js): the stamps that lead from one page to the others, the bow of yarn under a heading,
   and the thread on the cover. All of it is paper, paint or yarn; nothing here is drawn as an icon. */

/* ---- the stamps: one per page, each cut from that page's own painting. The page you are on is the one that has been postmarked. ---- */
.stamps { --w: 104px; display: flex; flex-wrap: wrap; justify-content: center; gap: calc(var(--w) * .16); min-height: calc(var(--w) * 1.3); margin: 0; padding: 0; }
.stamp { position: relative; display: block; width: var(--w); rotate: var(--turn, 0deg); color: var(--ink); text-decoration: none; transition: rotate .3s, translate .3s cubic-bezier(.3, 1.5, .5, 1); }
a.stamp:hover, a.stamp:focus-visible { rotate: 0deg; translate: 0 -5px; outline: 0; }
a.stamp:focus-visible .st-paper { outline: 2px dashed var(--ink); outline-offset: 5px; }
/* the paper, with its perforated edge: a row of holes punched on the edge line, all the way round.
   The paper is a layer of its own under the picture and the name: a mask or a filter on the tilted stamp itself would blur its lettering. */
.st-paper { --p: calc(var(--w) * .085); position: relative; isolation: isolate; display: block; padding: calc(var(--p) * .95) calc(var(--p) * .95) calc(var(--p) * .5); box-shadow: 0 calc(var(--w) * .06) calc(var(--w) * .09) calc(var(--w) * -.02) rgba(var(--shadow), .42); }
.st-paper::before { content: ''; position: absolute; inset: 0; z-index: -1; background: #fffdf6;
  -webkit-mask: linear-gradient(#000 0 0) center / calc(100% - var(--p)) calc(100% - var(--p)) no-repeat, radial-gradient(circle, #0000 calc(var(--p) * .3), #000 calc(var(--p) * .3 + .6px)) calc(var(--p) * -.5) calc(var(--p) * -.5) / var(--p) var(--p) round;
  mask: linear-gradient(#000 0 0) center / calc(100% - var(--p)) calc(100% - var(--p)) no-repeat, radial-gradient(circle, #0000 calc(var(--p) * .3), #000 calc(var(--p) * .3 + .6px)) calc(var(--p) * -.5) calc(var(--p) * -.5) / var(--p) var(--p) round; }
.st-pic { display: block; aspect-ratio: 1 / .92; background: #dfe3f2 center / cover no-repeat; box-shadow: inset 0 0 0 1px rgba(var(--shadow), .16); }
.stamp b { display: block; padding-top: calc(var(--w) * .035); font: 700 calc(var(--w) * .178)/1.05 'Caveat', cursive; text-align: center; white-space: nowrap; }   /* small enough that the longest name ("what we ate") keeps clear of the perforations */
.stamp.play .st-pic { position: relative; }
.stamp.play .st-pic::after { content: '▶'; position: absolute; right: 6%; bottom: 6%; display: grid; place-content: center; width: 30%; aspect-ratio: 1; padding-left: 2%; border-radius: 50%; background: var(--pink); color: #fffdf6; font: calc(var(--w) * .13)/1 sans-serif; box-shadow: 0 1px 3px rgba(var(--shadow), .4); }
/* the postmark over the stamp of the page that is open */
.stamp.here { cursor: default; }
.stamp .postmark { position: absolute; left: 34%; top: -9%; width: 96%; rotate: -14deg; opacity: .72; pointer-events: none; overflow: visible; }
.stamps.small { --w: 76px; gap: 8px; }
/* in the top corner of a page, where stamps go */
.stamps.corner { position: absolute; z-index: 2; right: max(18px, calc(50% - 502px)); top: 18px; flex-wrap: nowrap; }
@media (max-width: 760px) { .stamps { --w: 63px; gap: 6px; } .stamps.small { --w: 62px; gap: 5px; }
  .stamps.corner { position: static; justify-content: center; margin: 12px 0 0; }
  .scene.top .stamps.corner { position: absolute; left: 0; right: 0; top: 10px; margin: 0; } .scene.top .scene-title { top: 37%; } }   /* over a painting they stay on it, above the title */

/* at the foot of a page: the way on */
.elsewhere { padding: 70px 18px 90px; text-align: center; }
.elsewhere .hand { margin: 0 0 20px; font-size: 28px; font-weight: 700; color: var(--ink); }

/* ---- a heading with the bow under it: the two strands (blue for him, pink for her) come in from either side and are tied in the middle ---- */
.chapter { margin: 96px 0 0; text-align: center; font-size: clamp(32px, 4.4vw, 44px); line-height: 1.1; }
.chapter::after { content: ''; display: block; width: min(250px, 70%); aspect-ratio: 250 / 34; margin: 10px auto 4px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 250 34' fill='none' stroke-linecap='round' stroke-width='3.4'%3E%3Cg stroke='%237ea3d8'%3E%3Cpath d='M4 19C30 12 48 25 72 18S108 15 125 17'/%3E%3Cpath d='M125 17C112 1 93 3 99 15c3 6 16 6 26 2z'/%3E%3Cpath d='M125 17c4 6 8 10 14 13'/%3E%3C/g%3E%3Cg stroke='%23ee8f96'%3E%3Cpath d='M246 19C220 26 202 11 178 17s-36 2-53 0'/%3E%3Cpath d='M125 17C138 1 157 3 151 15c-3 6-16 6-26 2z'/%3E%3Cpath d='M125 17c-4 6-8 10-14 13'/%3E%3C/g%3E%3Cg stroke-width='1.3' stroke-dasharray='4 5'%3E%3Cpath stroke='%23c3d5ef' d='M4 19C30 12 48 25 72 18S108 15 125 17'/%3E%3Cpath stroke='%23f9cfd3' d='M246 19C220 26 202 11 178 17s-36 2-53 0'/%3E%3C/g%3E%3Cellipse cx='125' cy='17' rx='4.6' ry='4' fill='%23ee8f96' stroke='%237ea3d8' stroke-width='2'/%3E%3C/svg%3E") center / contain no-repeat; }
.chapter + .hand { text-align: center; margin-bottom: 30px; }
.chapter.light { color: var(--card); text-shadow: 0 2px 14px rgba(20, 24, 70, .6); } .chapter.light + .hand { color: #e6e4f6; text-shadow: 0 1px 10px rgba(20, 24, 70, .7); }

/* ---- the cover's thread: the three years as two strands of yarn. Twisted together when they were in one place; his lifts away
        for New York, San Francisco and China and comes back each time; tied in a bow at today; loose and dotted after. ---- */
.kicker { margin: 0 0 10px; font: 400 12px/1.4 'Fraunces', serif; letter-spacing: .34em; text-indent: .34em; text-transform: uppercase; color: var(--soft); }
.thread { position: relative; margin: -6px calc(50% - 50vw) 0; height: 150px; }
.thread svg { display: block; width: 100%; height: 100%; overflow: visible; }
.thread .yarn { clip-path: inset(-40px 100% -40px 0); }
.thread.drawn .yarn { clip-path: inset(-40px 0 -40px 0); transition: clip-path 3.4s cubic-bezier(.45, 0, .25, 1) .3s; }
.thread .marks { opacity: 0; } .thread.drawn .marks { opacity: 1; transition: opacity 1.2s ease 2.6s; }
.thread text { font: 700 21px 'Caveat', cursive; fill: var(--ink); text-anchor: middle; }
.thread text.away { fill: #5f86c4; } .thread text.yr { font: 400 10.5px 'Fraunces', serif; letter-spacing: .22em; fill: var(--soft); }
.thread a { cursor: pointer; } .thread a:hover text, .thread a:focus-visible text { text-decoration: underline wavy #ee8f96 1.5px; } .thread a:focus-visible { outline: 0; }
.thread .tick { stroke: rgba(var(--shadow), .3); stroke-width: 1.4; stroke-linecap: round; }
@media (prefers-reduced-motion: reduce) { .thread .yarn, .thread.drawn .yarn { clip-path: none; transition: none; } .thread .marks, .thread.drawn .marks { opacity: 1; transition: none; } }
@media (max-width: 760px) { .thread { height: 128px; } .thread text { font-size: 17px; } .kicker { font-size: 10.5px; } }

/* on the cover: the stamps under the thread, and a slip on the painting that starts the film from that very picture */
.cover .stamps { margin-top: 22px; }
.cover .plate { margin-top: clamp(22px, 3.4vw, 40px); }
.playit { position: absolute; right: 7.5%; bottom: 11%; padding: 3px 18px 6px; font: 700 clamp(19px, 2.4vw, 27px)/1.2 'Caveat', cursive; color: var(--card); background: var(--pink); text-decoration: none; rotate: -2deg;
  box-shadow: 0 1px 2px rgba(var(--shadow), .3), 0 10px 16px -8px rgba(20, 24, 70, .7); transition: rotate .25s, translate .25s; }
.playit:hover, .playit:focus-visible { rotate: 0deg; translate: 0 -3px; }
.playit::before { content: ''; position: absolute; left: 50%; top: -8px; width: 46px; height: 15px; translate: -50% 0; rotate: 3deg; background: rgba(255, 250, 240, .55); }
