/* ---------- The photo walk: polaroids on the wall, fairy lights, a little world for each month ---------- */
#gallery { justify-content: flex-start; min-height: 100vh; min-height: 100svh; padding-top: calc(12px + env(safe-area-inset-top, 0px)); pointer-events: none; }
.gw-head { position: relative; isolation: isolate; display: flex; flex-direction: column; align-items: center; gap: .45rem; }
.gw-head::before { content: ""; position: fixed; left: 0; right: 0; top: 0; height: calc(env(safe-area-inset-top, 0px) + 76px); z-index: -1; pointer-events: none;
  background: linear-gradient(rgba(29, 19, 39, .78), rgba(29, 19, 39, .45) 55%, rgba(29, 19, 39, 0)); }
.gw-title { margin: 0; font-family: var(--display); font-size: clamp(1.2rem, 5.3vw, 1.9rem); line-height: 1.15; white-space: nowrap; text-shadow: 0 2px 14px rgba(29, 19, 39, .9), 0 0 2px rgba(29, 19, 39, .8); }
.gw-dots { display: flex; gap: 7px; }
.gw-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(251, 239, 228, .28); transition: transform .4s ease, background .4s ease; }
.gw-dots i.on { background: var(--cream); }
.gw-dots i.now { background: var(--rose); transform: scale(1.5); }

/* ---------- the polaroids (sizes in --u = 1% of the photo width) ---------- */
.gw-frame { --peg: calc(var(--u) * 6); }
.gw-str { position: absolute; left: 20%; right: 20%; top: calc(var(--peg) - 3px); height: 2px; background: #6d5a7c; }
.gw-swing { position: absolute; inset: 0; transform-origin: 50% var(--peg); will-change: transform; }
.gw-pol {
  position: absolute; left: 0; right: 0; top: var(--peg); bottom: 0;
  background: linear-gradient(170deg, #fffaf3, #f4e7db);
  border-radius: calc(var(--u) * .8);
  box-shadow: 0 calc(var(--u) * 3) calc(var(--u) * 7) calc(var(--u) * -1.5) rgba(10, 4, 16, .7), 0 0 0 1px rgba(58, 36, 66, .08);
}
.gw-photo { position: absolute; left: calc(var(--u) * 4.5); top: calc(var(--u) * 4.5); width: calc(var(--u) * 100); height: calc(var(--u) * 133.333); overflow: hidden; background: #e9dcd6; border-radius: 1px; }
.gw-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gw-photo.missing img { visibility: hidden; }
.gw-photo.missing::after { content: "\2661"; position: absolute; inset: 0; display: grid; place-items: center; color: #d9b3c0; font-size: calc(var(--u) * 24); }
.gw-strip { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--u) * 20.5); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(var(--u) * .4); }
.gw-month { font: 700 calc(var(--u) * 11)/1 var(--hand); color: #7a3b6e; transform: rotate(-2deg); clip-path: inset(-20% 102% -20% -2%); }
.gw-cap { font: 600 calc(var(--u) * 6.4)/1 var(--hand); color: #b0566f; opacity: 0; }
.gw-cap:empty { display: none; }
/* the month writes itself in as we arrive */
.gw-frame.seen .gw-month { animation: gwWrite 1.3s cubic-bezier(.45, .1, .3, 1) .25s both; }
.gw-frame.seen .gw-cap { animation: gwFadeUp .8s ease 1.2s both; }
@keyframes gwWrite { from { clip-path: inset(-20% 102% -20% -2%); } to { clip-path: inset(-20% -4% -20% -4%); } }
@keyframes gwFadeUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* wooden pegs clipping the polaroid to the string */
.gw-peg {
  position: absolute; top: 0; width: calc(var(--u) * 3.4); height: calc(var(--u) * 9.4); margin-left: calc(var(--u) * -1.7);
  background: linear-gradient(90deg, #a86e3f, #e6b07a 45%, #c18450); border-radius: calc(var(--u) * .9);
  box-shadow: 1px 0 1.5px rgba(0, 0, 0, .45);
}
.gw-peg::after { content: ""; position: absolute; left: -12%; right: -12%; top: 40%; height: calc(var(--u) * 1.3); border-radius: 2px; background: #b9b0c0; }
.gw-peg.l { left: 20%; }
.gw-peg.r { left: 80%; }
.gw-frame.lift .gw-str { visibility: hidden; }
.gw-wstr { position: absolute; inset: 0; background: #6d5a7c; }
.gw-frame.lift .gw-peg { animation: gwUnclip .45s ease-in forwards; }
.gw-frame.lift .gw-peg.r { animation-name: gwUnclipR; }
@keyframes gwUnclip { to { transform: translate(-6px, -22px) rotate(-28deg); opacity: 0; } }
@keyframes gwUnclipR { to { transform: translate(6px, -22px) rotate(28deg); opacity: 0; } }

/* a warm pool of light on the wall behind the frame we are looking at (opacity set by JS) */
.gw-wallglow { opacity: 0; background: radial-gradient(ellipse 50% 50% at 50% 46%, rgba(255, 196, 120, .24), rgba(255, 170, 100, .09) 55%, rgba(255, 170, 100, 0) 100%); }

/* ---------- fairy lights ---------- */
.gw-gap svg { position: absolute; left: 0; top: 0; overflow: visible; }
.gw-bulb { position: absolute; width: 0; height: 0; }
.gw-bulb b { position: absolute; left: -3.5px; top: 3px; width: 7px; height: 11px; border-radius: 45% 45% 50% 50% / 38% 38% 62% 62%; background: radial-gradient(circle at 40% 62%, #fffaf0 0 18%, var(--c) 62%); }
.gw-bulb b::before { content: ""; position: absolute; left: 1.5px; top: -3px; width: 4px; height: 4px; border-radius: 1px; background: #4a3660; }
.gw-bulb::after { content: ""; position: absolute; left: -10px; top: -2px; width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle, var(--c), rgba(0, 0, 0, 0) 62%); opacity: .45; }
/* the bulbs twinkle in two alternating groups (two animated layers per string, cheap on phones) */
.gw-tw { position: absolute; inset: 0; animation: gwTwinkle 1.9s ease-in-out var(--d, 0s) infinite alternate; }
.gw-tw.b { animation-duration: 2.7s; animation-direction: alternate-reverse; }
@keyframes gwTwinkle { 0% { opacity: .55; } 55% { opacity: 1; } 100% { opacity: .8; } }
.gw-boost { position: absolute; inset: 0; opacity: 0; will-change: opacity; }
.gw-boost i { position: absolute; width: 40px; height: 40px; margin: -12px 0 0 -20px; border-radius: 50%; background: radial-gradient(circle, var(--c), rgba(0, 0, 0, 0) 60%); opacity: .5; }

/* layers far along the wall are off screen: their animations wait until we come near */
.gw-far, .gw-far *, .gw-far *::before, .gw-far *::after { animation-play-state: paused !important; }

/* lightning and November's flash light up the wall behind the frames (never in front of them) */
.gw-wash { opacity: 0; background: radial-gradient(ellipse 75% 60% at 50% 45%, rgba(214, 228, 255, .5), rgba(214, 228, 255, .16) 60%, rgba(214, 228, 255, 0)); }
.gw-wash.bolt { animation: gwBoltWash 1.2s linear; }
.gw-wash.flash { background: radial-gradient(ellipse 75% 60% at 50% 45%, rgba(255, 250, 240, .6), rgba(255, 240, 230, .2) 60%, rgba(255, 240, 230, 0)); animation: gwFlashWash .9s ease-out; }
@keyframes gwBoltWash { 0% { opacity: 0; } 7% { opacity: 1; } 14% { opacity: .1; } 24% { opacity: .75; } 60%, 100% { opacity: 0; } }
@keyframes gwFlashWash { 0% { opacity: 0; } 8% { opacity: 1; } 100% { opacity: 0; } }
/* the room lights go down behind the November frame as the film takes over */
.gw-dim { opacity: 0; background: #120b19; }

.gw-fx { width: 100%; height: 100%; }

/* ---------- props ---------- */
.gw-l > svg, .gw-l > div > svg { display: block; overflow: visible; width: 100%; height: 100%; }
.flip svg { transform: scaleX(-1); }
.gw-sway { transform-origin: 50% 0; animation: gwSway 4.6s ease-in-out infinite alternate; }
.gw-sway.slow { animation-duration: 6.5s; }
.gw-sway.kite { transform-origin: 50% 22%; animation: gwKite 3.4s ease-in-out infinite alternate; }
.late .gw-sway { animation-delay: -2.2s; }
.gw-tugw, .gw-tugw > div { width: 100%; height: 100%; }
.gw-tugw { transform-origin: 50% 0; }
.gw-tugw svg { display: block; overflow: visible; width: 100%; height: 100%; }
.tug .gw-tugw { animation: gwTug 1.5s ease-in-out; }
@keyframes gwTug { 0%, 100% { transform: none; } 22% { transform: translate(5px, -24px) rotate(5deg); } 50% { transform: translate(-3px, -8px) rotate(-3deg); } 75% { transform: translate(1px, -12px) rotate(1deg); } }
@keyframes gwSway { from { transform: rotate(-1.4deg); } to { transform: rotate(1.4deg); } }
@keyframes gwKite { 0% { transform: translate(-4px, 0) rotate(-7deg); } 50% { transform: translate(3px, -8px) rotate(3deg); } 100% { transform: translate(6px, -2px) rotate(8deg); } }
.gw-bob { animation: gwBob 3.2s ease-in-out var(--d, 0s) infinite alternate; }
.gw-bob.fast { position: absolute; left: 0; right: 0; top: 0; bottom: 6px; animation: gwBobFast 1.5s ease-in-out infinite alternate; }
@keyframes gwBob { from { transform: translateY(0) rotate(-1.5deg); } to { transform: translateY(-10px) rotate(1.5deg); } }
@keyframes gwBobFast { from { transform: translateY(0) rotate(-4deg); } to { transform: translateY(-3px) rotate(3deg); } }
.gw-rock { transform-origin: 50% 95%; animation: gwRock 3s ease-in-out infinite alternate; }
@keyframes gwRock { from { transform: rotate(-7deg); } to { transform: rotate(4deg); } }
.gw-drip { animation: gwDrip 1.5s ease-in infinite; }
@keyframes gwDrip { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(50px); opacity: 0; } }
.gw-pulse { animation: gwPulse 2.2s ease-in-out infinite alternate; }
@keyframes gwPulse { from { opacity: .55; } to { opacity: 1; } }

/* chiya steam */
.gw-chiya .gw-steam, .gw-sillprop .gw-steam { position: absolute; left: 30%; width: 40%; bottom: 72%; height: 60%; }
.gw-steam i { position: absolute; bottom: 0; width: 6px; height: 22px; border-radius: 50%; background: rgba(251, 239, 228, .4); opacity: 0; animation: gwSteam 2.6s ease-out infinite; }
.gw-steam i:nth-child(1) { left: 15%; }
.gw-steam i:nth-child(2) { left: 45%; animation-delay: -.9s; }
.gw-steam i:nth-child(3) { left: 75%; animation-delay: -1.7s; }
@keyframes gwSteam { 0% { transform: translateY(6px) scale(.6, .8); opacity: 0; } 30% { opacity: .8; } 100% { transform: translate(5px, -30px) scale(1.3, 1.4); opacity: 0; } }

/* paper boat on a puddle */
.gw-puddle { position: absolute; left: -16%; right: -16%; bottom: -4px; height: 20px; border-radius: 50%; background: radial-gradient(ellipse at 50% 50%, rgba(122, 167, 230, .5), rgba(122, 167, 230, .14) 60%, rgba(122, 167, 230, 0) 72%); }
.gw-puddle::after { content: ""; position: absolute; inset: 20% 25%; border-radius: 50%; border: 1.5px solid rgba(190, 215, 255, .5); animation: gwRipple 2.4s ease-out infinite; }
@keyframes gwRipple { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }

/* diyas */
.gw-flame { position: absolute; left: 50%; top: -20px; width: 14px; height: 24px; margin-left: -7px; }
.gw-flame::before { content: ""; position: absolute; left: -26px; top: -18px; width: 66px; height: 66px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 190, 90, .5), rgba(255, 170, 70, 0) 62%); animation: gwGlow 1.7s ease-in-out var(--d, 0s) infinite alternate; }
.gw-flame i { position: absolute; inset: 0; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; transform-origin: 50% 90%; background: radial-gradient(ellipse at 50% 72%, #fffbe0, #ffd36b 40%, #ff9a3a 70%, rgba(255, 120, 40, 0) 76%); animation: gwFlick .45s ease-in-out var(--d, 0s) infinite alternate; }
.gw-diya .gw-flame { opacity: 0; transform: scale(.2); transform-origin: 50% 90%; }
.gw-diya.lit .gw-flame { animation: gwLight .6s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes gwLight { from { opacity: 0; transform: scale(.2); } to { opacity: 1; transform: none; } }
@keyframes gwFlick { 0% { transform: scale(1, 1) rotate(-2deg); } 50% { transform: scale(.9, 1.1) rotate(2deg); } 100% { transform: scale(1.05, .94) rotate(-1deg); } }
@keyframes gwGlow { from { opacity: .7; } to { opacity: 1; } }

/* the monsoon window */
.gw-window { background: #5a3f3a; border-radius: 12px 12px 4px 4px; box-shadow: inset 0 0 0 3px #6e4f47; }
.gw-glass { position: absolute; left: 12px; right: 12px; top: 12px; bottom: 34px; overflow: hidden; border-radius: 6px 6px 2px 2px; background: linear-gradient(#19253f, #2a3a5c 62%, #3a4a6c); }
.gw-glass::before { content: ""; position: absolute; right: 22%; top: 14%; width: 22px; height: 22px; border-radius: 50%; background: #e9e2cf; opacity: .5; box-shadow: 0 0 18px 6px rgba(233, 226, 207, .18); }
.gw-hills { position: absolute; left: 0; right: 0; bottom: 0; height: 46%;
  background: radial-gradient(ellipse 70% 80% at 22% 100%, #26385a 62%, rgba(0, 0, 0, 0) 63%), radial-gradient(ellipse 80% 64% at 85% 100%, #1d2c48 62%, rgba(0, 0, 0, 0) 63%); }
.gw-hills::after { content: ""; position: absolute; left: 30%; bottom: 22%; width: 3px; height: 3px; border-radius: 50%; background: #ffd36b; box-shadow: 18px 6px 0 #ffd36b, 40px -4px 0 #ffb54a, 66px 10px 0 #ffd36b, -14px 12px 0 #ffb54a; opacity: .8; }
.gw-rain { position: absolute; left: -30px; right: -30px; top: -120px; bottom: 0; }
.gw-rain svg { display: block; width: 100%; height: 100%; animation: gwRain .6s linear infinite; }
.gw-rain.b svg { animation-duration: .9s; opacity: .55; }
@keyframes gwRain { from { transform: translateY(0); } to { transform: translateY(120px); } }
.gw-bolt { position: absolute; inset: 0; background: #dfe8ff; opacity: 0; animation: gwBolt 6.5s linear 1.5s infinite; }
@keyframes gwBolt { 0%, 90% { opacity: 0; } 91% { opacity: .55; } 92% { opacity: .05; } 93.5% { opacity: .4; } 96%, 100% { opacity: 0; } }
.gw-window.big { border-radius: 18px 18px 4px 4px; }
.gw-window.big .gw-glass::before { top: 3%; }
.gw-window.strike .gw-bolt { animation: gwBolt 6.5s linear -5.9s infinite; }
.gw-bars { position: absolute; left: 12px; right: 12px; top: 12px; bottom: 34px; }
.gw-bars::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 6px; margin-left: -3px; background: #5a3f3a; }
.gw-bars::after { content: ""; position: absolute; left: 0; right: 0; top: 46%; height: 6px; background: #5a3f3a; }
.gw-sill { position: absolute; left: -12px; right: -12px; bottom: 16px; height: 18px; border-radius: 4px; background: linear-gradient(#8a614f, #6e4b3e); box-shadow: 0 6px 10px -4px rgba(0, 0, 0, .5); }
.gw-sillprop { position: absolute; right: 18px; bottom: 32px; width: 54px; }
.gw-sillprop svg { width: 100%; height: auto; }

/* ---------- characters: they breathe, blink and swish their tails ---------- */
.gw-char .sway { transform-box: fill-box; transform-origin: 50% 100%; animation: gwBreath 2.6s ease-in-out infinite alternate; }
.gw-char .eyes { transform-box: fill-box; transform-origin: 50% 50%; animation: gwBlink 4.4s ease-in-out infinite; }
.gw-char .tail { transform-box: fill-box; transform-origin: 0% 100%; animation: gwTail 2.2s ease-in-out infinite alternate; }
@keyframes gwBreath { from { transform: scale(1, 1); } to { transform: scale(1.015, 1.035); } }
@keyframes gwBlink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes gwTail { from { transform: rotate(-6deg); } to { transform: rotate(8deg); } }
.gw-kin, .gw-catin { position: absolute; inset: 0; transform-origin: 50% 90%; }
.gw-cat svg { position: absolute; left: 0; top: 0; }
.gw-cat .walk, .gw-cat.walking .sit, .gw-cat.standing .sit { visibility: hidden; }
.gw-cat.walking .walk, .gw-cat.standing .walk { visibility: visible; }
.gw-cat .cw-leg { transform-box: fill-box; transform-origin: 50% 0; }
.gw-cat.walking .cw-leg { animation: gwLeg .3s ease-in-out infinite alternate; }
.gw-cat.walking .cw-leg.b { animation-direction: alternate-reverse; }
.gw-cat .cw-tail { transform-box: fill-box; transform-origin: 100% 100%; animation: gwTail 1.2s ease-in-out infinite alternate; }
@keyframes gwLeg { from { transform: rotate(-24deg); } to { transform: rotate(24deg); } }

/* May's butterflies */
.gw-fly .gw-wing { transform-box: fill-box; animation: gwFlap .2s ease-in-out var(--d, 0s) infinite alternate; }
.gw-fly .gw-wing.l { transform-origin: 100% 40%; }
.gw-fly .gw-wing.r { transform-origin: 0% 40%; }
.gw-fly.rest .gw-wing { animation-duration: 1.4s; }
@keyframes gwFlap { from { transform: scaleX(1); } to { transform: scaleX(.22); } }

/* ---------- November: Kuromi's birthday photo plays when we arrive at its frame ---------- */
.gw-photo.kc-wrap { background: #f7c4d1; }
.kc-wrap svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.kc-scene .kc-bubble, .kc-scene .kc-hbd, .kc-scene .kc-spark, .kc-scene .kc-flash { opacity: 0; }
.kc-scene .kc-bubble, .kc-scene .kc-hbd, .kc-scene .kc-spark, .kc-scene .kc-burst, .kc-scene .kc-lens, .kc-scene .eyes, .kc-scene .sway, .kc-scene .kc-bob { transform-box: fill-box; transform-origin: 50% 50%; }
.kc-scene .kc-burst { transform: scale(0); }
.kc-scene .kc-bubble { transform-origin: 30% 100%; }
.kc-scene .sway, .kc-scene .kc-bob { transform-origin: 50% 100%; }
.gw-frame.in .kc-scene .sway, .gw-frame.in .kc-scene .kc-bob { animation: kcBob 1.5s ease-in-out infinite alternate; }
/* the whole beat (camera up, "say cheese", flash, print, greeting) plays in about 2.9 s */
.gw-frame.in .kc-cam { animation: kcCam .6s cubic-bezier(.3, 1.5, .5, 1) .1s both; }
.gw-frame.in .kc-bubble { animation: kcBubble 1.2s ease .2s both; }
.gw-frame.in .kc-lens { animation: kcLens .7s ease-in-out .6s both; }
.gw-frame.in .kc-rec { animation: kcRec .5s steps(2, jump-none) infinite; }
.gw-frame.in .kc-scene .eyes { animation: kcWink .4s ease 1.3s both; }
.gw-frame.in .kc-burst { animation: kcBurst .6s ease-out 1.4s both; }
.gw-frame.in .kc-flash { animation: kcFlash .9s ease-out 1.42s both; }
.gw-frame.in .kc-print { animation: kcPrint 1s cubic-bezier(.2, .8, .3, 1) 1.85s both; }
.gw-frame.in .kc-hbd { animation: kcHbd .7s cubic-bezier(.3, 1.6, .5, 1) 2s both; }
.gw-frame.in .kc-spark { animation: kcSpark .9s ease-in-out calc(2.1s + var(--i) * .08s) infinite alternate both; }
@keyframes kcBob { from { transform: translateY(0); } to { transform: translateY(-1.4px); } }
@keyframes kcCam { from { transform: translateY(7px); } to { transform: none; } }
@keyframes kcBubble { 0% { opacity: 0; transform: scale(.5); } 14% { opacity: 1; transform: scale(1.06); } 22% { transform: scale(1); } 82% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(.9); } }
@keyframes kcLens { 0%, 100% { transform: scale(1); } 50% { transform: scale(.7); } }
@keyframes kcRec { 0% { opacity: 1; } 100% { opacity: .2; } }
@keyframes kcWink { 0%, 100% { transform: scaleY(1); } 40% { transform: scaleY(.1); } }
@keyframes kcBurst { 0% { transform: scale(0); opacity: 1; } 35% { transform: scale(1.5) rotate(10deg); opacity: 1; } 100% { transform: scale(2) rotate(30deg); opacity: 0; } }
@keyframes kcFlash { 0% { opacity: 0; } 6% { opacity: .96; } 100% { opacity: 0; } }
@keyframes kcPrint { from { transform: none; } to { transform: translateY(15px); } }
@keyframes kcHbd { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
@keyframes kcSpark { from { opacity: 0; transform: scale(.3) rotate(0deg); } to { opacity: 1; transform: scale(1) rotate(45deg); } }

/* just before the film takes the card, the live scene settles into exactly the still the film draws:
   no bob, sparkles at rest (turned 45 degrees, full opacity), the print out, the greeting in, no bubble/burst/flash */
.gw-frame.kc-still .kc-scene .sway, .gw-frame.kc-still .kc-scene .kc-bob, .gw-frame.kc-still .kc-scene .kc-cam,
.gw-frame.kc-still .kc-scene .eyes, .gw-frame.kc-still .kc-scene .kc-lens { animation: none; transform: none; }
.gw-frame.kc-still .kc-scene .kc-spark { animation: none; opacity: 1; transform: scale(1) rotate(45deg); }
.gw-frame.kc-still .kc-scene .kc-print { animation: none; transform: translateY(15px); }
.gw-frame.kc-still .kc-scene .kc-hbd { animation: none; opacity: 1; transform: none; }
.gw-frame.kc-still .kc-scene .kc-bubble, .gw-frame.kc-still .kc-scene .kc-flash { animation: none; opacity: 0; }
.gw-frame.kc-still .kc-scene .kc-burst { animation: none; opacity: 0; transform: scale(0); }
.gw-frame.kc-still .kc-scene .kc-rec { animation: none; opacity: 1; }

/* the title steps aside as the November frame comes off the wall (the film brings its own) */
#gallery.gw-out .gw-head { animation: gwHeadOut .7s ease forwards; }
@keyframes gwHeadOut { to { opacity: 0; transform: translateY(-8px); } }
