/* Agusha On-the-Go'27 · Igor Popeliukh — treatment site wrap.
   Layers: .grain (paper only) → main (slide plates) → #stage (three.js props placed ON the slides, transparent, no pointer). */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: #fcfcfb; }
body { -webkit-font-smoothing: antialiased; text-rendering: geometricPrecision; overflow-x: hidden; }

:root {
  --paper: #fcfcfb;
  --pw: 100vw;   /* slides run edge to edge: full width, no frame of paper around them */
}

#stage { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 3;   /* stage.js drops it to 0 during the iris/rhyme pins */
  pointer-events: none; display: block; }
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .045; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
main { position: relative; z-index: 2; }

/* ── plates: the 1920×1080 slides, scaled by site.js ── */
.plate {
  position: relative; width: var(--pw); aspect-ratio: 16 / 9; margin: 0 auto; overflow: hidden;
  background: #111; /* never seen; avoids a flash before the slide paints */
}
.plate > .slide { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; overflow: hidden; }
.plate .abs { position: absolute; }

.gap { height: var(--h, 12vh); }
.interlude { height: var(--h, 70vh); }

/* inside a slide: photos → background props → text and cards. Props sit behind the words and stay quiet. */
.plate .slide .prop-tile { z-index: 1; pointer-events: none; filter: saturate(.7) contrast(.94) drop-shadow(0 16px 22px rgba(60,45,30,.14)); }
.plate .slide .txt, .plate .slide .card { z-index: 2; }

/* kid-wipe: a warm soft band crosses the plate while it is revealed */
.wipe-band {
  position: absolute; top: -2%; bottom: -2%; width: 22%; left: -22%; z-index: 5; pointer-events: none;
  background: linear-gradient(90deg, rgba(58,40,30,0) 0%, rgba(58,40,30,.62) 38%, rgba(74,52,38,.7) 55%, rgba(58,40,30,0) 100%);
  filter: blur(18px); opacity: 0;
}

/* ── pinned scenes: iris (06→07) and circle rhyme (10→11) ── */
.pin { position: relative; height: 230svh; }
.pin--rhyme { height: 260svh; }
/* the slide keeps the full width; when it is taller than the screen it is centred and loses equal strips top and bottom */
.pin__stick { position: sticky; top: 0; height: 100svh; overflow: hidden; }
.iris-mask, .rhyme-mask { width: var(--pw); aspect-ratio: 16 / 9; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  clip-path: circle(var(--r, 0px) at var(--cx, 50%) var(--cy, 50%)); will-change: clip-path; }
.plate--in-pin { width: 100%; }

/* entrances start hidden only when JS is running (no-JS / reduced motion shows everything) */
.js .reveal-img, .js .reveal-txt { opacity: 0; }

@media (max-width: 700px) {
  .interlude { height: calc(var(--h, 70vh) * .6); }
  .pin { height: 170svh; } .pin--rhyme { height: 190svh; }
}

/* phones: no full-screen blend and no live shadow filter while scrolling */
@media (pointer: coarse) {
  .grain { mix-blend-mode: normal; opacity: .03; }
  .plate .slide .prop-tile { filter: saturate(.7) contrast(.94); }
  .iris-mask, .rhyme-mask { will-change: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .pin, .pin--rhyme { height: auto; }
  .pin__stick { position: static; height: auto; display: block; }
  .iris-mask, .rhyme-mask { clip-path: none; margin: 0 auto; position: relative; left: auto; top: auto; transform: none; }
  .js .reveal-img, .js .reveal-txt { opacity: 1; }
  .interlude { height: 16vh; }
}

/* ── phones held upright: ask to turn the phone, once, at the very start ──
   The treatment's own cover stands upright like the phone in your hand, then turns on its side. */
.rotate { display: none; }
@media (orientation: portrait) and (pointer: coarse) and (max-width: 820px) {
  html:not(.rotate-done) .rotate { display: grid; }
  html:not(.rotate-done), html:not(.rotate-done) body { overflow: hidden; height: 100%; }
}
.rotate {
  position: fixed; inset: 0; z-index: 100; grid-template-rows: 1fr auto auto; color: #111;
  padding: max(24px, env(safe-area-inset-top)) 24px max(26px, env(safe-area-inset-bottom));
  font-family: "HN", "Helvetica Neue", Arial, sans-serif; background-color: #fcfcfb;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.rotate__stage { display: grid; place-items: center; min-height: 0; }
.mini {
  width: var(--mw, 320px); aspect-ratio: 16 / 9; position: relative; overflow: hidden; background: #fff;
  transform: rotate(-90deg) scale(var(--s1, 1.3)); transform-origin: 50% 50%;
  filter: drop-shadow(0 22px 30px rgba(60,45,30,.18));
  animation: mini-turn 5.2s cubic-bezier(.7,0,.2,1) infinite;
}
.mini__s { position: absolute; inset: 0; }
.mini .slide { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; transform: scale(var(--k, .16)); }
.mini .slide .abs { position: absolute; }
@keyframes mini-turn {
  0%   { transform: rotate(-90deg) scale(var(--s1, 1.3)); opacity: 0; }
  7%   { opacity: 1; }
  26%  { transform: rotate(-90deg) scale(var(--s1, 1.3)); }
  54%  { transform: rotate(0deg) scale(1); }
  86%  { transform: rotate(0deg) scale(1); opacity: 1; }
  95%  { opacity: 0; }
  100% { transform: rotate(-90deg) scale(var(--s1, 1.3)); opacity: 0; }
}
.rotate__txt { padding-top: 18px; }
.rotate__t { margin: 0; font-size: clamp(40px, 12.5vw, 56px); line-height: .9; font-weight: 700; letter-spacing: -.04em; }
.rotate__sub { margin: 12px 0 0; font-size: 16px; line-height: 1.35; color: #6b6f75; }
.rotate__skip {
  justify-self: end; margin-top: 22px; background: none; border: 0; padding: 8px 0; font: inherit; font-size: 14px; color: #6b6f75;
  text-decoration: underline; text-underline-offset: 4px; cursor: pointer; grid-row: 3;
}
@media (prefers-reduced-motion: reduce) { .mini { animation: none; transform: none; } }
