/* MailForge portfolio: cinematic presentation intro + playful email motion.
   JS (present-fx.js) gates everything on prefers-reduced-motion. */

/* ---------- cinematic intro overlay ---------- */
.pfx-overlay{position:fixed;inset:0;z-index:9999;display:grid;place-items:center;background:radial-gradient(120% 120% at 50% 18%,#18264a 0%,#0d1321 58%,#080d18 100%);animation:pfxOvIn .35s ease both;cursor:pointer}
.pfx-overlay.pfx-out{animation:pfxOvOut .4s ease both;pointer-events:none}
@keyframes pfxOvIn{from{opacity:0}to{opacity:1}}
@keyframes pfxOvOut{to{opacity:0;visibility:hidden}}
.pfx-stage{position:relative;width:min(76vw,430px);aspect-ratio:1;display:grid;place-items:center;perspective:950px}
.pfx-glow{position:absolute;width:72%;height:72%;border-radius:50%;background:radial-gradient(circle,rgba(69,126,247,.38),transparent 65%);filter:blur(30px);animation:pfxGlow 2.5s ease both}
@keyframes pfxGlow{0%{opacity:0;transform:scale(.55)}35%{opacity:1;transform:scale(1)}100%{opacity:.85;transform:scale(1.18)}}
.pfx-orbit{position:absolute;inset:5%;border:1px dashed rgba(120,165,255,.25);border-radius:50%;animation:pfxSpin 8s linear infinite}
.pfx-orbit.o2{inset:17%;border-color:rgba(0,166,244,.2);animation-duration:13s;animation-direction:reverse}
@keyframes pfxSpin{to{transform:rotate(360deg)}}
.pfx-env{position:relative;width:min(52vw,210px);aspect-ratio:200/134;transform-style:preserve-3d;animation:pfxFlight 2.4s cubic-bezier(.45,.1,.25,1) both,pfxEnvFly .8s cubic-bezier(.55,.05,.85,.45) 2.4s forwards}
.pfx-echo{position:absolute;width:min(52vw,210px);aspect-ratio:200/134;border-radius:12px;background:linear-gradient(135deg,rgba(69,126,247,.55),rgba(0,166,244,.35));filter:blur(16px);pointer-events:none;animation:pfxFlight 2.4s .1s cubic-bezier(.45,.1,.25,1) both,pfxEnvFly .8s 2.5s cubic-bezier(.55,.05,.85,.45) forwards;opacity:.45}
.pfx-echo.e2{animation-delay:.2s,2.6s;opacity:.22}
@keyframes pfxFlight{0%{opacity:0;transform:translate(-58vw,32vh) rotateZ(-16deg) rotateY(28deg) rotateX(10deg) scale(.55)}8%{opacity:1}30%{transform:translate(-10vw,-10vh) rotateZ(9deg) rotateY(-12deg) rotateX(6deg) scale(.85)}52%{transform:translate(42vw,-14vh) rotateZ(12deg) rotateY(0deg) rotateX(4deg) scale(.92)}72%{transform:translate(24vw,10vh) rotateZ(-8deg) rotateY(8deg) rotateX(10deg) scale(.96)}100%{opacity:1;transform:translate(0,0) rotateZ(0deg) rotateY(0deg) rotateX(14deg) scale(1)}}
@keyframes pfxEnvFly{0%{opacity:1;transform:translateZ(0) rotateX(14deg) scale(1)}100%{opacity:0;transform:translateZ(780px) rotateX(-6deg) scale(2)}}
.pfx-env-body{position:absolute;inset:0;border-radius:12px;background:linear-gradient(160deg,#2f6fe0,#1d4ed8 55%,#173a8f);box-shadow:0 24px 60px rgba(8,18,44,.65),inset 0 1px 0 rgba(255,255,255,.25)}
.pfx-env-body:before{content:"";position:absolute;inset:0;border-radius:12px;background:linear-gradient(to left bottom,transparent 49.4%,rgba(255,255,255,.16) 50%),linear-gradient(to right bottom,transparent 49.4%,rgba(255,255,255,.16) 50%)}
.pfx-env-flap{position:absolute;left:0;right:0;top:0;height:58%;transform-origin:top center;background:linear-gradient(180deg,#4b84f5,#2563eb);clip-path:polygon(0 0,100% 0,50% 100%);border-radius:12px 12px 0 0;animation:pfxFlap 1.7s ease-in-out .9s both}
@keyframes pfxFlap{0%,16%{transform:rotateX(0)}40%,58%{transform:rotateX(-172deg)}80%,100%{transform:rotateX(0)}}
.pfx-letter{position:absolute;left:9%;right:9%;top:12%;bottom:16%;background:linear-gradient(180deg,#f8fafc,#dbe6f7);border-radius:8px;box-shadow:0 10px 26px rgba(0,0,0,.35);animation:pfxLetter 1.7s cubic-bezier(.45,.05,.2,1) .9s both}
.pfx-letter:before{content:"";position:absolute;top:24%;left:16%;right:16%;height:6px;border-radius:3px;background:#c3d4ef}
.pfx-letter:after{content:"";position:absolute;top:46%;left:16%;right:36%;height:6px;border-radius:3px;background:#d5e1f5}
.pfx-stamp{position:absolute;top:9%;inset-inline-end:9%;width:15%;aspect-ratio:1;border-radius:22%;background:linear-gradient(135deg,#00a6f4,#2563eb);display:grid;place-items:center;color:#fff;font-size:clamp(9px,2.6vw,13px)}
.pfx-letter i{position:absolute;bottom:7%;left:50%;width:16%;aspect-ratio:1;border-radius:50%;background:#00bc7d;color:#fff;display:grid;place-items:center;font-style:normal;font-size:clamp(9px,2.6vw,14px);animation:pfxCheck .38s cubic-bezier(.3,1.4,.5,1) 1.75s both}
@keyframes pfxLetter{0%,20%{transform:translateY(6%)}42%,60%{transform:translateY(-70%)}82%,100%{transform:translateY(6%)}}
@keyframes pfxCheck{from{opacity:0;transform:translateX(-50%) scale(.3)}to{opacity:1;transform:translateX(-50%) scale(1)}}
.pfx-cap{position:absolute;bottom:12%;font-size:15px;font-weight:600;color:#c9d8f5;letter-spacing:.02em;animation:pfxOvIn .5s .3s ease both}
.pfx-hint{position:absolute;bottom:7%;font-size:11px;color:#7d8db0;animation:pfxOvIn .5s .55s ease both}
@media(max-width:600px){.pfx-cap{bottom:15%}.pfx-hint{bottom:10%}}

/* ---------- slide transition (direction-aware, replaces slideIn) ---------- */
body.presenting main>section.pres-cur{animation:pfxSlideIn .5s cubic-bezier(.22,.75,.25,1) both}
@keyframes pfxSlideIn{from{opacity:0;transform:translateX(var(--dir,40px))}to{opacity:1;transform:none}}

/* ---------- between-slide envelope flight ---------- */
.pfx-fly{position:fixed;left:0;top:0;z-index:120;width:46px;height:32px;pointer-events:none;will-change:transform;filter:drop-shadow(0 8px 18px rgba(8,18,44,.55))}
.pfx-fly span{display:block;width:100%;height:100%;border-radius:6px;background:linear-gradient(160deg,#3b76e8,#1d4ed8);position:relative}
.pfx-fly span:before{content:"";position:absolute;left:0;right:0;top:0;height:56%;background:linear-gradient(180deg,#5c8cf0,#2f6fe0);clip-path:polygon(0 0,100% 0,50% 100%)}

/* ---------- click play: mini envelope + dots ---------- */
.pfx-mini{position:fixed;z-index:120;width:26px;height:18px;pointer-events:none;border-radius:4px;background:linear-gradient(160deg,#457ef7,#1d4ed8);box-shadow:0 6px 16px rgba(8,18,44,.5);will-change:transform}
.pfx-mini:before{content:"";position:absolute;left:0;right:0;top:0;height:56%;background:linear-gradient(180deg,#6b99f2,#2f6fe0);clip-path:polygon(0 0,100% 0,50% 100%)}
.pfx-dot{position:fixed;z-index:120;width:7px;height:7px;border-radius:50%;pointer-events:none;will-change:transform}

/* nav buttons: keep [next ->] physically on the right in RTL bars */
[dir="rtl"] .pres-bar [data-grip]{order:-3}
[dir="rtl"] .pres-bar [data-a="next"]{order:-2}
[dir="rtl"] .pres-bar .pres-count{order:-1}

/* reduced-motion intro: same moment, fades only - no zoom, spin or travel */
.pfx-overlay.pfx-rm .pfx-orbit,.pfx-overlay.pfx-rm .pfx-echo{display:none}
.pfx-overlay.pfx-rm .pfx-glow{animation:pfxOvIn .6s ease both}
.pfx-overlay.pfx-rm .pfx-env{animation:pfxRmEnv .6s ease both}
.pfx-overlay.pfx-rm .pfx-env-flap{animation:none;transform:rotateX(-172deg)}
.pfx-overlay.pfx-rm .pfx-letter{animation:none;transform:translateY(-58%)}
.pfx-overlay.pfx-rm .pfx-letter i{animation:pfxCheck .3s ease .5s both}
@keyframes pfxRmEnv{from{opacity:0;transform:rotateX(14deg)}to{opacity:1;transform:rotateX(14deg)}}

/* ---------- interactive pet envelope + delivery goal ---------- */
.pfx-pet{position:fixed;left:0;top:0;z-index:9000;width:84px;aspect-ratio:200/134;cursor:grab;will-change:transform;filter:drop-shadow(0 14px 24px rgba(8,18,44,.55));touch-action:none}
.pfx-pet:active{cursor:grabbing}
.pfx-pet .pp-body{position:absolute;inset:0;border-radius:10px;background:linear-gradient(160deg,#2f6fe0,#1d4ed8 55%,#173a8f);box-shadow:inset 0 1px 0 rgba(255,255,255,.25)}
.pfx-pet .pp-body:before{content:"";position:absolute;inset:0;border-radius:10px;background:linear-gradient(to left bottom,transparent 49.4%,rgba(255,255,255,.16) 50%),linear-gradient(to right bottom,transparent 49.4%,rgba(255,255,255,.16) 50%)}
.pfx-pet .pp-flap{position:absolute;left:0;right:0;top:0;height:58%;transform-origin:top center;background:linear-gradient(180deg,#4b84f5,#2563eb);clip-path:polygon(0 0,100% 0,50% 100%);border-radius:10px 10px 0 0;transition:transform .45s cubic-bezier(.2,.8,.3,1);z-index:2}
.pfx-pet .pp-letter{position:absolute;left:9%;right:9%;top:12%;bottom:16%;background:linear-gradient(180deg,#f8fafc,#dbe6f7);border-radius:6px;box-shadow:0 8px 18px rgba(0,0,0,.3);display:grid;place-items:center;padding:2px 5px;text-align:center;transition:transform .45s cubic-bezier(.2,.8,.3,1);z-index:1}
.pfx-pet .pp-letter b{font-size:10.5px;line-height:1.4;color:#1e2a45;font-weight:700}
.pfx-pet .pp-stamp{position:absolute;top:8%;inset-inline-end:8%;width:15%;aspect-ratio:1;border-radius:22%;background:linear-gradient(135deg,#00a6f4,#2563eb);z-index:3}
.pfx-pet.open .pp-flap{transform:rotateX(-165deg)}
.pfx-pet.open .pp-letter{transform:translateY(-74%)}
.pfx-pet-echo{position:fixed;left:0;top:0;z-index:8999;width:84px;aspect-ratio:200/134;border-radius:10px;background:linear-gradient(135deg,rgba(69,126,247,.5),rgba(0,166,244,.3));filter:blur(10px);pointer-events:none;will-change:transform,opacity}
.pfx-tray{position:fixed;bottom:96px;right:22px;z-index:8998;width:92px;height:64px;pointer-events:none}
.pfx-tray .pt-glow{position:absolute;inset:-16px;border-radius:26px;background:radial-gradient(circle,rgba(0,188,125,.4),transparent 65%);opacity:0;transition:opacity .3s}
.pfx-tray .pt-slot{position:absolute;left:10px;right:10px;top:24px;height:10px;border-radius:6px;background:#0a0f1e;border:1px solid rgba(98,160,255,.25)}
.pfx-tray .pt-box{position:absolute;left:6px;right:6px;top:30px;bottom:0;background:linear-gradient(180deg,#1f293a,#141c2e);border:1px solid rgba(98,160,255,.35);border-radius:4px 4px 10px 10px;box-shadow:0 14px 30px rgba(8,18,44,.5)}
.pfx-tray.hot .pt-glow{opacity:1}
.pfx-tray.hot{animation:pfxTrayInvite 1s ease-in-out infinite}
@keyframes pfxTrayInvite{0%,100%{transform:translateY(0)}50%{transform:translateY(-6px)}}
.pfx-tray.shake{animation:pfxTrayShake .5s ease}
@keyframes pfxTrayShake{0%,100%{transform:translateX(0)}20%{transform:translateX(-5px) rotate(-2deg)}40%{transform:translateX(5px) rotate(2deg)}60%{transform:translateX(-4px)}80%{transform:translateX(3px)}}
.pfx-tray .pt-count{position:absolute;top:-6px;left:-8px;min-width:22px;height:22px;border-radius:999px;background:#00bc7d;color:#04220f;font:700 12px/22px var(--latin,monospace);text-align:center;padding:0 5px;opacity:0;transform:scale(.5);transition:opacity .3s,transform .3s;z-index:2}
.pfx-tray.counted .pt-count{opacity:1;transform:scale(1)}
.pfx-toast{position:fixed;z-index:9010;bottom:172px;right:16px;background:linear-gradient(135deg,#00bc7d,#0a8f62);color:#04220f;font:700 13px/1.2 var(--font);padding:8px 14px;border-radius:999px;box-shadow:0 10px 26px rgba(0,188,125,.35);pointer-events:none;opacity:0;transition:opacity .25s}
.pfx-ring{position:fixed;z-index:120;width:14px;height:14px;border:3px solid rgba(0,188,125,.8);border-radius:50%;pointer-events:none}

/* ---------- presentation cover (dedicated opening page) ---------- */
.pfx-cover{position:fixed;inset:0;z-index:8990;display:grid;place-items:center;background:radial-gradient(120% 120% at 50% 18%,#18264a 0%,#0d1321 58%,#080d18 100%);animation:pfxOvIn .35s ease both}
.pfx-cover.pfx-out{animation:pfxOvOut .45s ease both;pointer-events:none}
.pfx-cv-stage{position:absolute;inset:0;perspective:950px;pointer-events:none}
.pfx-cv-stage .pfx-env{position:absolute;left:0;top:0;width:min(40vw,190px);animation:pfxCvFlight 4.4s cubic-bezier(.45,.1,.25,1) infinite}
.pfx-cv-stage .pfx-echo{position:absolute;left:0;top:0;width:min(40vw,190px);animation:pfxCvFlight 4.4s .13s cubic-bezier(.45,.1,.25,1) infinite;opacity:.4}
.pfx-cv-stage .pfx-echo.e2{animation-delay:.26s;opacity:.2}
.pfx-cv-stage .pfx-env-flap{animation:pfxCvFlap 4.4s ease-in-out infinite}
.pfx-cv-stage .pfx-letter{animation:pfxCvLetter 4.4s cubic-bezier(.45,.05,.2,1) infinite}
.pfx-cv-stage .pfx-letter i{animation:pfxCvCheck 4.4s linear infinite}
.pfx-cv-stage .pfx-glow{left:14%;top:6%}
.pfx-cover.go .pfx-cv-stage .pfx-env,.pfx-cover.go .pfx-cv-stage .pfx-echo{animation:pfxCvZoom .6s cubic-bezier(.55,.05,.85,.45) forwards}
.pfx-cover.go .pfx-cv-stage .pfx-echo{animation-delay:.05s}
.pfx-cover.go .pfx-cv-body{animation:pfxOvOut .3s ease both}
@keyframes pfxCvFlight{0%{opacity:0;transform:translate(-16vw,62vh) rotateZ(-14deg) rotateY(24deg) scale(.7)}7%{opacity:1;transform:translate(4vw,55vh) rotateZ(-10deg) rotateY(18deg) scale(.8)}22%{transform:translate(28vw,24vh) rotateZ(11deg) rotateY(-10deg) scale(.92)}40%{transform:translate(72vw,10vh) rotateZ(-8deg) rotateY(0deg) scale(1)}54%{transform:translate(85vw,34vh) rotateZ(7deg) rotateY(10deg) scale(.95)}68%{transform:translate(46vw,46vh) rotateZ(-5deg) rotateY(-6deg) scale(1.05)}80%{transform:translate(52vw,40vh) rotateZ(3deg) scale(1.02)}89%{opacity:1;transform:translate(97vw,16vh) rotateZ(9deg) scale(.9)}95%{opacity:0;transform:translate(112vw,12vh) rotateZ(12deg) scale(.85)}100%{opacity:0;transform:translate(-16vw,62vh) rotateZ(-14deg) rotateY(24deg) scale(.7)}}
@keyframes pfxCvFlap{0%,32%{transform:rotateX(0)}44%,58%{transform:rotateX(-172deg)}72%,100%{transform:rotateX(0)}}
@keyframes pfxCvLetter{0%,34%{transform:translateY(6%)}46%,60%{transform:translateY(-70%)}74%,100%{transform:translateY(6%)}}
@keyframes pfxCvCheck{0%,47%{opacity:0;transform:translateX(-50%) scale(.3)}52%,60%{opacity:1;transform:translateX(-50%) scale(1)}66%,100%{opacity:0;transform:translateX(-50%) scale(.3)}}
@keyframes pfxCvZoom{0%{opacity:1;transform:translate(46vw,44vh) scale(1.05)}100%{opacity:0;transform:translate(46vw,44vh) scale(2.7) rotateZ(2deg)}}
.pfx-cv-body{position:relative;z-index:2;display:grid;justify-items:center;gap:13px;text-align:center;padding:0 20px;pointer-events:none}
.pfx-cv-eyebrow{font-size:12px;letter-spacing:.22em;color:#7fb4ff;font-weight:700}
.pfx-cv-title{font-size:clamp(30px,6vw,58px);font-weight:800;color:#f8fafc;margin:0;text-shadow:0 8px 40px rgba(69,126,247,.35)}
.pfx-cv-sub{font-size:15px;color:#99a6b8;max-width:540px;margin:0;line-height:1.8}
.pfx-cv-start{pointer-events:auto;margin-top:8px;font-family:var(--font);font-size:18px;font-weight:700;color:#fff;background:linear-gradient(135deg,#2563eb,#00a6f4);border:0;border-radius:999px;padding:16px 46px;cursor:pointer;box-shadow:0 12px 34px rgba(37,99,235,.45);transition:transform .2s,box-shadow .2s}
.pfx-cv-start:hover{transform:translateY(-2px) scale(1.03);box-shadow:0 18px 44px rgba(37,99,235,.6)}
.pfx-cv-hint{font-size:12.5px;color:#7d8db0}
.pfx-cv-build{position:absolute;bottom:12px;inset-inline-start:14px;font:600 11px var(--latin,monospace);color:#5b6a8a;direction:ltr}
.pfx-cv-exit{position:absolute;top:14px;inset-inline-end:14px;z-index:3;width:38px;height:38px;border-radius:50%;border:1px solid rgba(152,180,255,.3);background:rgba(20,30,55,.6);color:#c9d8f5;font-size:15px;cursor:pointer}
.pfx-cover.pfx-rm .pfx-cv-stage .pfx-echo,.pfx-cover.pfx-rm .pfx-cv-stage .pfx-orbit{display:none}
.pfx-cover.pfx-rm .pfx-cv-stage .pfx-env{animation:none;left:50%;transform:translate(-50%,12vh);opacity:.92}
.pfx-cover.pfx-rm .pfx-cv-stage .pfx-env-flap,.pfx-cover.pfx-rm .pfx-cv-stage .pfx-letter,.pfx-cover.pfx-rm .pfx-cv-stage .pfx-letter i{animation:none}
.pfx-cover.pfx-rm .pfx-cv-stage .pfx-glow{animation:none;opacity:.85}

/* ---------- cinematic cover film + brand reveal ---------- */
.pfx-cine{position:absolute;inset:0;width:100%;height:100%;transition:opacity 1.4s ease}
.pfx-cover.fin .pfx-cine{opacity:0;pointer-events:none}
.pfx-cv-final{position:absolute;inset:0;z-index:2;display:grid;place-content:center;justify-items:center;gap:8px;text-align:center;padding:0 20px;pointer-events:none;opacity:0;transform:scale(.96);transition:opacity 1.4s ease,transform 1.6s cubic-bezier(.2,.7,.3,1)}
.pfx-cover.fin .pfx-cv-final{opacity:1;transform:none}
.pfx-cv-logo{width:clamp(88px,14vh,132px);aspect-ratio:1;border-radius:23%;box-shadow:0 0 0 1px rgba(127,180,255,.25),0 18px 60px rgba(37,99,235,.45),0 0 90px rgba(34,211,238,.28);animation:pfxLogoIn 1.2s cubic-bezier(.2,.8,.3,1) both}
@keyframes pfxLogoIn{from{opacity:0;transform:scale(.6);filter:blur(8px)}to{opacity:1;transform:none;filter:none}}
.pfx-cover.fin .pfx-cv-logo{animation:pfxLogoIn 1.2s .2s cubic-bezier(.2,.8,.3,1) both}
.pfx-cv-brand{direction:ltr;font:800 clamp(26px,4.6vw,44px)/1.1 var(--latin,Arial);color:#fff;letter-spacing:.14em;margin-top:14px;text-shadow:0 0 34px rgba(37,99,235,.5)}
.pfx-cv-by{direction:ltr;font:600 14px/1.3 var(--latin,Arial);color:#7fb4ff;letter-spacing:.34em}
.pfx-cv-verbs{direction:ltr;font:700 clamp(13px,1.7vw,17px)/1.4 var(--latin,Arial);color:#e6f0ff;letter-spacing:.1em;margin-top:14px}
.pfx-cv-ar{font-size:15px;color:#9cc0ff;line-height:1.8}
.pfx-cv-finalmsg{direction:ltr;font:600 12.5px/1.4 var(--latin,Arial);color:#5f7db8;letter-spacing:.18em}
.pfx-cover .pfx-cv-start{margin-top:18px}
.pfx-cover:not(.fin) .pfx-cv-final{visibility:hidden}
.pfx-cv-skip{position:absolute;bottom:16px;inset-inline-end:16px;z-index:3;font:600 12.5px var(--font);color:#9cc0ff;background:rgba(20,30,55,.6);border:1px solid rgba(152,180,255,.3);border-radius:999px;padding:8px 16px;cursor:pointer;transition:opacity .3s}
.pfx-cv-skip:hover{color:#fff;border-color:rgba(152,180,255,.6)}
.pfx-cover.fin .pfx-cv-skip{opacity:0;pointer-events:none}
.pfx-cover.go .pfx-cv-final{animation:pfxOvOut .3s ease both}
.pfx-cover.pfx-rm .pfx-cine{display:none}
.pfx-cover:not(.fin) .pfx-cv-start{pointer-events:none}
.pfx-cover.fin .pfx-cv-final .pfx-cv-start,.pfx-cover.fin .pfx-cv-final .pfx-cv-logo{pointer-events:auto}
.pfx-cv-rmplay{position:absolute;inset:0;z-index:3;display:grid;place-content:center;gap:14px;text-align:center;padding:0 24px}
.pfx-cv-play{font:inherit;font-weight:700;font-size:17px;color:#fff;background:linear-gradient(135deg,#2563eb,#00a6f4);border:0;border-radius:999px;padding:15px 42px;cursor:pointer;box-shadow:0 14px 44px rgba(37,99,235,.45);transition:transform .25s ease}
.pfx-cv-play:hover{transform:translateY(-2px)}
.pfx-cv-rmnote{color:#99a6b8;font-size:12.5px;max-width:340px}
.pfx-cover.pfx-playing .pfx-cv-rmplay{display:none}
