/* Motion layer for the home page: every project in one animated grid, a hero that lifts away
   on scroll, headings that ease in and a thin reading-progress line. Everything is scoped to html.mo,
   which assets/motion.js sets, so the page keeps its plain grid without JavaScript.
   --d             a tile's delay in the cascade as it arrives (row by row)
   --mx/--my (-1..1) pointer position over a tile: its light and the small tilt of its screenshots (mouse only)
   --hs  (0..1)   how far the hero has scrolled away */

html.mo body{overflow-x:clip}

/* ---------- reading progress ---------- */
.mo-progress{position:fixed;z-index:40;top:0;left:0;right:0;height:2px;background:var(--accent);transform-origin:0 50%;transform:scaleX(var(--sp,0));pointer-events:none}

/* ---------- hero: the words lift and fade, the portrait drifts a little slower ---------- */
.mo .hero-text{transform:translate3d(0,calc(var(--hs,0)*-140px),0);opacity:calc(1 - var(--hs,0)*1.3);will-change:transform,opacity}
.mo .hero-media{transform:translate3d(0,calc(var(--hs,0)*90px),0) scale(calc(1 + var(--hs,0)*.06));transform-origin:70% 40%;will-change:transform}
.mo .hero-hint{opacity:calc(1 - var(--hs,0)*3)}

/* ---------- section headings ease in ---------- */
.mo .shead{opacity:0;transform:translate3d(0,28px,0);transition:opacity .9s ease,transform .9s cubic-bezier(.2,.7,.2,1)}
.mo .shead.in{opacity:1;transform:none}
.mo .shead h2{font-size:clamp(44px,6.4vw,104px);line-height:.92;margin:0}

/* ---------- the platform filter floats, centred, while the side projects scroll by ---------- */
.mo .pfilter{position:sticky;top:14px;z-index:20;width:fit-content;max-width:calc(100% - 120px);margin:0 auto 18px;padding:5px;gap:4px;border:1px solid var(--line);border-radius:999px;background:#ffffffd1;-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);box-shadow:0 10px 30px -18px #141a2640}
.mo .pfilter button{border-color:transparent;background:none;padding:7px 14px}
.mo .pfilter button[aria-pressed=true]{background:var(--text);color:var(--bg)}

/* ---------- every project in one grid ---------- */
/* An even, responsive grid (three columns wide, two on a tablet, one on a phone). Tiles cascade in as they
   arrive, lift on hover with a soft light following the mouse, and glide to their new places when filtered. */
.mo{--mo-e:cubic-bezier(.2,.8,.2,1)}
.mo .ptiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(330px,100%),1fr));gap:clamp(16px,2vw,24px)}
.mo .ptile{position:relative;isolation:isolate;display:flex;flex-direction:column;border-radius:22px;overflow:hidden;
  opacity:0;translate:0 40px;scale:.97;
  transition:opacity .7s ease var(--d,0ms),translate .8s var(--mo-e) var(--d,0ms),scale .8s var(--mo-e) var(--d,0ms),transform .5s var(--mo-e),box-shadow .5s var(--mo-e),border-color .3s}
.mo .ptile.in{opacity:1;translate:0 0;scale:1}
.mo .ptile:hover{transform:translateY(-6px);box-shadow:0 32px 60px -32px color-mix(in srgb,var(--pi,#99a) 85%,#000)}
/* a soft light that follows the mouse across the tile */
.mo .ptile:after{content:"";position:absolute;inset:0;z-index:3;pointer-events:none;border-radius:inherit;opacity:0;transition:opacity .4s;
  background:radial-gradient(440px circle at calc(50% + var(--mx,0)*50%) calc(50% + var(--my,0)*50%),#ffffff5c,transparent 60%)}
.mo .ptile:hover:after{opacity:1}
/* the screenshots: a touch of zoom and tilt; the phones rise in front of the browser window */
.mo .pt-img{perspective:1100px}
.mo .pt-img .thumb.wmt{transition:transform .6s var(--mo-e);transform:rotateY(calc(var(--mx,0)*3deg)) rotateX(calc(var(--my,0)*-3deg))}
.mo .ptile:hover .pt-img .thumb.wmt{transform:scale(1.04) rotateY(calc(var(--mx,0)*3deg)) rotateX(calc(var(--my,0)*-3deg))}
.mo .pt-img .wmt .phones{transition:transform .6s var(--mo-e)}
.mo .ptile:hover .pt-img .wmt .phones{transform:translateY(-5%)}
.mo .ptile:hover .pt-img > img{transform:translateY(-3%) scale(1.02)}
/* the text: a bolder title and an arrow that slides in on hover */
.mo .pt-body{gap:8px;padding:18px 20px 20px}
.mo .pt-body h3{font-family:var(--display);font-weight:700;text-transform:uppercase;font-size:24px;letter-spacing:.01em;line-height:1.05;display:flex;align-items:center;gap:8px}
.mo .pt-body h3:after{content:"→";font-size:.8em;opacity:0;translate:-8px 0;transition:opacity .3s,translate .4s var(--mo-e)}
.mo .ptile:hover .pt-body h3:after,.mo .ptile:focus-visible .pt-body h3:after{opacity:1;translate:0 0}
.mo .ptile[hidden]{display:none}
@media(max-width:860px){
  .mo .pfilter{max-width:calc(100% - 76px);margin-left:auto;margin-right:var(--gut);overflow-x:auto;flex-wrap:nowrap;scrollbar-width:none}
  .mo .pfilter button{flex:none}
}

/* reduced motion: the grid stays, movement goes */
@media(prefers-reduced-motion:reduce){
  .mo .hero-text,.mo .hero-media{transform:none!important}
  .mo .hero-text,.mo .hero-hint{opacity:1}
  .mo .shead,.mo .ptile{opacity:1;transform:none!important;translate:none;scale:none;transition:none}
  .mo .pt-img .thumb.wmt,.mo .pt-img .wmt .phones,.mo .pt-img > img{transform:none!important}
  .mo .ptile:after{display:none}
}

/* =================== animation techniques, round two ===================
   Welcome (first visit per tab), word-by-word headings, skeleton shimmer for screenshots, a filter bar that
   hides while you scroll down, press feedback, a one-time nudge
   on the contact link, drifting colour behind the contact block, a staggered menu and soft page transitions.
   Every movement here stops under prefers-reduced-motion (see the end of this block). */

/* ---------- welcome: the name rises letter by letter ---------- */
.mo-w{display:inline-block;white-space:nowrap}
.mo-l{display:inline-block}
.mo-welcome .mo-l{animation:mo-rise .9s cubic-bezier(.2,.8,.2,1) both;animation-delay:calc(.25s + var(--i)*38ms)}
.mo-welcome .hi{animation:mo-fade .7s ease both .1s}
.mo-welcome .hero-intro{animation:mo-up .9s cubic-bezier(.2,.8,.2,1) both;animation-delay:calc(.55s + var(--n,12)*38ms)}
.mo-welcome .hero-hint{animation:mo-fade .8s ease both 1.9s}
.mo-welcome .hero-media{animation:mo-fade 1.2s ease both}
@keyframes mo-rise{from{opacity:0;transform:translateY(.55em) rotate(4deg)}to{opacity:1;transform:none}}
@keyframes mo-up{from{opacity:0;transform:translateY(18px)}to{opacity:1;transform:none}}
@keyframes mo-fade{from{opacity:0}to{opacity:1}}

/* ---------- headings: words rise one after another ---------- */
.mo .shead h2 .mo-word{display:inline-block;opacity:0;transform:translateY(.45em);transition:opacity .6s ease,transform .8s cubic-bezier(.2,.8,.2,1);transition-delay:calc(var(--i)*70ms)}
.mo .shead.in h2 .mo-word{opacity:1;transform:none}
.mo .shead{transform:none}

/* ---------- skeleton: a soft shimmer where a screenshot is still loading ---------- */
.mo .pt-img.mo-sk:before{content:"";position:absolute;z-index:0;inset:6% 4%;border-radius:14px;background:linear-gradient(100deg,#ffffff00 30%,#ffffffb3 50%,#ffffff00 70%) 0 0/250% 100%,color-mix(in srgb,var(--pi,#c9cfdb) 35%,#fff);animation:mo-shimmer 1.4s linear infinite}
@keyframes mo-shimmer{from{background-position:120% 0,0 0}to{background-position:-120% 0,0 0}}
.mo .pt-img img{opacity:0;transition:opacity .6s ease}
.mo .pt-img img.mo-ok{opacity:1}

/* ---------- the filter bar steps aside while you read ---------- */
.mo .pfilter{transition:transform .35s cubic-bezier(.2,.7,.2,1),opacity .35s}
/* the filter bar stays visible while scrolling (Gopinath, 2026-11-30) */
.mo .pfilter button{transition:background .2s,color .2s,transform .15s}
.mo .pfilter button:active{transform:scale(.94)}

/* ---------- press feedback (touch has no hover) ---------- */
.mo .ptile{-webkit-tap-highlight-color:transparent}
.mo .ptile:active .pt-img{scale:.98;transition:scale .12s}
.mo .ptile .pt-img{transition:opacity .8s ease,translate .9s cubic-bezier(.2,.7,.2,1),scale .3s}
.mo .pill{transition:transform .2s,background .2s,border-color .2s}
.mo .pill:hover{transform:translateY(-2px)}.mo .pill:active{transform:scale(.97)}

/* ---------- attention: one gentle nudge when the contact block first appears ---------- */
.mo .closing.in .textlink:after{animation:mo-nudge 1.1s ease .6s 2}
@keyframes mo-nudge{0%,100%{transform:none}30%{transform:translateX(8px)}60%{transform:translateX(-2px)}}

/* ---------- dynamic background: two soft colours drift slowly behind the contact block ---------- */
.mo .closing{position:relative;isolation:isolate;overflow:hidden}
.mo .closing:before,.mo .closing:after{content:"";position:absolute;z-index:-1;width:48vmax;height:48vmax;border-radius:50%;filter:blur(60px);opacity:.55;pointer-events:none}
.mo .closing:before{background:#fbe0e7;left:-18vmax;bottom:-30vmax;animation:mo-drift 22s ease-in-out infinite alternate}
.mo .closing:after{background:#dbeafb;right:-16vmax;top:-30vmax;animation:mo-drift 26s ease-in-out infinite alternate-reverse}
@keyframes mo-drift{from{transform:translate(0,0) scale(1)}to{transform:translate(8vmax,-4vmax) scale(1.15)}}

/* ---------- navigation: the menu's links slide in one after another ---------- */
.lhs-open .lhs-brand,.lhs-open .lhs-nav a,.lhs-open .lhs-projects{animation:mo-slide .45s cubic-bezier(.2,.8,.2,1) both}
.lhs-open .lhs-nav a:nth-child(1){animation-delay:.06s}.lhs-open .lhs-nav a:nth-child(2){animation-delay:.1s}
.lhs-open .lhs-nav a:nth-child(3){animation-delay:.14s}.lhs-open .lhs-nav a:nth-child(4){animation-delay:.18s}
.lhs-open .lhs-nav a:nth-child(5){animation-delay:.22s}.lhs-open .lhs-projects{animation-delay:.26s}
@keyframes mo-slide{from{opacity:0;transform:translateX(-14px)}to{opacity:1;transform:none}}

/* ---------- page transitions: a soft cross-fade into a project page and back (browsers that support it) ---------- */
@view-transition{navigation:auto}
::view-transition-old(root),::view-transition-new(root){animation-duration:.35s}

@media(prefers-reduced-motion:reduce){
  .mo-welcome *,.mo .closing:before,.mo .closing:after,.mo .closing .textlink:after,.mo .pt-img.mo-sk:before,
  .lhs-open .lhs-brand,.lhs-open .lhs-nav a,.lhs-open .lhs-projects{animation:none!important}
  .mo .shead h2 .mo-word,.mo .pt-img img{opacity:1;transform:none;transition:none}
  .mo-down .pfilter{transform:none;opacity:1;pointer-events:auto}
  @view-transition{navigation:none}
}
