/* Me section (7 Nov 2026, Eunice): a 100vh dusk chapter between the Intro and About. Working name "Me"; all copy is dummy.
   Colour: dusk blue at the top (follows the Intro's day sky) deepening to violet and a mauve that matches the top of the
   About sunset sky, so the white Intro clouds and the peach About clouds both sit naturally on it.
   Clouds (code-painted PNGs in clouds/, see paint_clouds.py): the top bank belongs to Me and rolls up over the bottom of
   the Intro; the bottom bank belongs to About and rises over the bottom of Me. me-section.js moves them for the parallax. */
#me{position:relative;isolation:isolate;height:100vh;height:100svh;min-height:560px;color:#fff;scroll-margin-top:0}
#me .me-bg{position:absolute;inset:0;z-index:-2;background:linear-gradient(180deg,#55689f 0%,#6b5e98 52%,#8a6a9c 100%)}
/* Me overlaps the bottom of the Intro; its colour sweeps in with a soft edge under the rising cloud bank (set by me-section.js). */
#me.is-overlap{margin-top:-35vh;pointer-events:none}
#me.is-overlap .me-bg{-webkit-mask-image:linear-gradient(to bottom,transparent var(--fade-a,-1px),#000 var(--fade-b,0px));mask-image:linear-gradient(to bottom,transparent var(--fade-a,-1px),#000 var(--fade-b,0px))}
#me.is-overlap .me-copy{pointer-events:auto}
/* v2: the Intro scene is held still under the rising clouds (me-section.js), so the Intro must not clip it vertically. */
html.me-pin main.hero{overflow:visible;overflow-x:clip}
/* 25 Nov 2026 (Zen, iPad test: ?nohold fixed the ~20 s freeze at Chapter 02): on touch screens the Intro picture is not
   held; the sticky stage together with the touch scroll-snap and Safari's toolbar stopped the iPad repainting. Mice and
   trackpads keep the hold. */
@media not all and (pointer: coarse){html.me-pin .hero-stage{position:sticky;top:0;height:100vh;height:100svh}}   /* 25 Nov 2026 (Zen, iPad): the browser holds the Intro picture (sticky) while Chapter 02 rises; me-section.js sets .hero-hold to the length of the hold. Was a per-frame transform on .scene/.veil/.hero-breeze, which lagged behind touch scrolling. */

.sky-cloud{position:absolute;left:0;right:0;z-index:2;pointer-events:none;will-change:transform}
.sky-cloud>span{position:absolute;inset:0;background-repeat:no-repeat;background-size:100% 100%;will-change:transform}
/* Top bank: 75vh tall, its dense line (60% down the image) sits on the join. */
.me-cloud-top{top:-30vh;height:60vh}
/* Bottom bank, inside About: 70vh tall, dense line (55% down) on About's top edge. */
section#about{overflow:visible;overflow-x:clip}   /* beats about-section.css, which loads later */
section#about .about-cloud{top:-60.9vh;height:70vh;z-index:3}

.me-copy{position:absolute;left:50%;top:50%;z-index:4;width:min(640px,86%);transform:translate(-50%,-50%);text-align:center;text-shadow:0 1px 2px rgba(40,28,80,.45),0 4px 24px rgba(40,28,80,.35)}
#me .me-heading{margin:0;font-size:inherit}
#me .me-heading span{display:block}
#me .story-step .step-sub{margin:1.1em auto 0;max-width:520px;color:#f4effa}
@media(max-width:820px){
  .me-cloud-top{top:-20vh;height:40vh}
  section#about .about-cloud{top:-31.32vh;height:36vh}
}
@media(prefers-reduced-motion:reduce){.sky-cloud,.sky-cloud>span{will-change:auto}}

/* Four distinct cloud silhouettes per scene. Each row is one plane in a transparent atlas. */
.me-cloud-top>span{background-image:url(clouds/daylight-cloud-planes-v4.png)}
.about-cloud>span{background-image:url(clouds/sunset-cloud-planes-v4.png)}
.sky-cloud>span{background-size:100% 400%;background-repeat:no-repeat;contain:paint;-webkit-mask-image:linear-gradient(to bottom,transparent 0%,#000 3%,#000 94%,transparent 100%);mask-image:linear-gradient(to bottom,transparent 0%,#000 3%,#000 94%,transparent 100%)}
.sky-cloud>.sky-back{background-position:50% 0%;z-index:0}
.sky-cloud>.sky-mid{background-position:50% 33.333333%;z-index:1}
.sky-cloud>.sky-near{background-position:50% 66.666667%;z-index:2;left:-3%;right:-3%}
.sky-cloud>.sky-front{background-position:50% 100%;z-index:3;left:-7%;right:-7%}
@media(prefers-reduced-motion:reduce){.sky-cloud>.sky-mid,.sky-cloud>.sky-near,.sky-cloud>.sky-front{display:none}}

/* Clip the widened, drifting planes at the viewport sides. */
.sky-cloud{overflow-x:clip;overflow-y:visible}


/* v7: upright, translucent cloud planes rise and dissolve into the dusk background. */
.me-cloud-top>span{-webkit-mask-image:linear-gradient(to bottom,transparent 0%,#000 5%,#000 53%,transparent 96%);mask-image:linear-gradient(to bottom,transparent 0%,#000 5%,#000 53%,transparent 96%)}
.me-cloud-top>.sky-back{opacity:.36}
.me-cloud-top>.sky-mid{opacity:.46}
.me-cloud-top>.sky-near{opacity:.58}
.me-cloud-top>.sky-front{opacity:.7}

/* v8: extend the dusk paint above the section box, so its feather cannot be
   truncated at Me's top edge. Stops are measured from the original section top. */
#me.is-overlap .me-bg{top:-50vh;background:linear-gradient(180deg,#55689f 0%,#55689f 33.333333%,#6b5e98 68%,#8a6a9c 100%);-webkit-mask-image:linear-gradient(to bottom,transparent calc(var(--fade-a) + 50vh),#000 calc(var(--fade-b) + 50vh));mask-image:linear-gradient(to bottom,transparent calc(var(--fade-a) + 50vh),#000 calc(var(--fade-b) + 50vh))}

/* v11: retain each atlas strip's original 4:1 proportions at every viewport.
   A connected distant bank sits behind gently staggered cloud islands. */
.me-cloud-top{top:-12.5vw;height:25vw}
.me-cloud-top>.sky-near{height:26.5vw;bottom:auto}
.me-cloud-top>.sky-front{height:28.5vw;bottom:auto}

/* Stagger whole clouds without changing their width/height ratio. */
.me-cloud-top>.sky-mid{top:3vh;height:25vw;bottom:auto}
.me-cloud-top>.sky-near{top:8vh}
.me-cloud-top>.sky-front{top:5vh}

/* v12: natural full-cloud alpha supplies the contour; no common bottom fade.
   The narrow strip-edge feather prevents neighbouring sprite rows bleeding through. */
.me-cloud-top>span{background-image:url(clouds/daylight-full-cloud-silhouettes-v12.png);-webkit-mask-image:linear-gradient(to bottom,transparent 0%,#000 5%,#000 89%,transparent 100%);mask-image:linear-gradient(to bottom,transparent 0%,#000 5%,#000 89%,transparent 100%);-webkit-mask-composite:source-over;mask-composite:add}

/* Paper planes (9 Nov 2026, me-planes.js): a canvas over the dusk colour, under the clouds and the copy. While Me is
   rising over the Intro it is masked exactly like the dusk colour, so no plane ever flies over the meadow sky. */
.me-planes{position:absolute;inset:0;z-index:-1;width:100%;height:100%;pointer-events:none}
#me.is-overlap .me-planes{-webkit-mask-image:linear-gradient(to bottom,transparent var(--fade-a,-1px),#000 var(--fade-b,0px));mask-image:linear-gradient(to bottom,transparent var(--fade-a,-1px),#000 var(--fade-b,0px))}
@media(prefers-reduced-motion:reduce){.me-planes{display:none}}


/* Stagger the snapshots in loose clusters on either side of the copy. */
.me-value{margin:1.55em 0 0;color:#fff4df;font:italic 500 clamp(17px,1.55vw,23px)/1.3 var(--head-2)}
.me-snapshots{position:absolute;z-index:3;top:50%;width:25%;height:min(67%,600px);transform:translateY(-50%);pointer-events:none}
#me.is-overlap .me-snapshots{opacity:var(--snapshot-opacity,0);transition-property:translate}
.me-snapshots--left{left:5%}
.me-snapshots--right{right:7%}
.me-snapshots figure{position:absolute;top:var(--y);left:var(--x);width:min(54%,19svh,186px);margin:0;padding:5px 5px 12px;background:#fff5e6;box-shadow:0 9px 26px #39244b50;rotate:var(--tilt)}
.me-snapshots img{display:block;width:100%;height:auto;aspect-ratio:1}
.me-snapshots--left figure:nth-child(1){--x:16%;--y:1%;--tilt:-9deg}
.me-snapshots--left figure:nth-child(2){--x:49%;--y:22%;--tilt:8deg;z-index:1}
.me-snapshots--left figure:nth-child(3){--x:0%;--y:42%;--tilt:-7deg}
.me-snapshots--left figure:nth-child(4){--x:51%;--y:66%;--tilt:4deg;z-index:2}
@media(min-width:821px){.me-snapshots--left figure:nth-child(4){width:min(48%,17svh,164px)}}
.me-snapshots--right figure:nth-child(1){--x:43%;--y:1%;--tilt:8deg}
.me-snapshots--right figure:nth-child(2){--x:1%;--y:24%;--tilt:-6deg;z-index:1}
.me-snapshots--right figure:nth-child(3){--x:49%;--y:43%;--tilt:6deg}
.me-snapshots--right figure:nth-child(4){--x:10%;--y:68%;--tilt:-5deg;z-index:2}
.snapshot-mirrored img{scale:-1 1}
@media(min-width:821px){
  #me .me-copy{width:min(36%,540px)}
  #me .story-step .step-sub{max-width:405px}
}
#me.snapshots-arrived .me-snapshots figure{
  animation:snapshot-in 1.25s cubic-bezier(.2,.75,.25,1) var(--arrival,0s) backwards;
}
.me-snapshots figure:nth-child(2){--arrival:.16s}
.me-snapshots figure:nth-child(3){--arrival:.29s}
.me-snapshots figure:nth-child(4){--arrival:.43s}
@keyframes snapshot-in{from{opacity:0;translate:0 24px;rotate:0deg}}
/* 25 Nov 2026, gentle motion: kept with Reduce Motion on (small, in place); was a reduced-motion off rule */

.snapshot-photo{position:relative;display:block;overflow:hidden;aspect-ratio:1}
.snapshot-photo video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:0;transition:opacity .35s ease;pointer-events:none}
.snapshot-photo video.is-playing{opacity:1}
.snapshot-mirrored video{scale:-1 1}
/* 25 Nov 2026, gentle motion: kept with Reduce Motion on (small, in place); was a reduced-motion off rule */

@media(max-width:820px){
  #me{display:grid;align-content:center;justify-items:center;gap:20px;height:auto;min-height:100svh;padding:65px 22px 88px}
  #me .me-copy{position:relative;left:auto;top:auto;width:min(100%,440px);transform:none}
  .me-snapshots{position:relative;inset:auto;display:flex;justify-content:center;align-items:center;gap:clamp(4px,1.5vw,12px);width:min(100%,480px);height:auto;transform:none}
  .me-snapshots--left{order:-1}
  .me-snapshots--right{order:1}
  .me-snapshots figure{position:relative;inset:auto;width:23%;max-width:112px;padding:3px 3px 7px;rotate:calc(var(--tilt)*.65)}
  .me-snapshots--left figure:last-child{translate:0 11px}
}
