/* Card stages: every project preview (.pt-img tiles on the home page, .pp-art on project pages) becomes a
   small lit set built from the app's own colour (--base on .thumb.wmt) with the devices it ships on.
   assets/stage.js adds the layers and picks one composition per platform:
     st-web     browser window + two phones standing in front      (web + mobile apps)
     st-web2    two browser windows                                (web-only apps)
     st-mobile  three phones fanned                                (mobile-only apps)
     st-desk    a laptop showing the Mac desktop + floating panels (menu bar / tray apps)
     st-work    a browser window rising from the bottom            (Zoho product work)
   Everything is sized in container units (cqi = 1% of the stage width), so it stays crisp at every tile size.
   --px/--py (-1..1, pointer over the stage) and --lift (0/1, hover or focus) drive the parallax. */

.stage{--e:cubic-bezier(.2,.8,.2,1);--b:var(--base,var(--pi,#b9c4ff));--sh:color-mix(in oklab,var(--b) 35%,#0c1220);--mono:color-mix(in oklab,var(--b) 42%,#141a2a);--px:0;--py:0;--lift:0;isolation:isolate}

/* ---------- the set: base wash, a key light, a second glow from the tile's pastel, a deeper pool, grain ---------- */
.st-bg{position:absolute;inset:0;z-index:0;pointer-events:none;overflow:hidden;
  background:
    radial-gradient(52% 70% at var(--lx,18%) var(--ly,0%),#ffffffe0 0,#ffffff00 72%),
    radial-gradient(55% 75% at var(--ax,100%) var(--ay,96%),color-mix(in oklab,var(--pa,#fff) 95%,transparent) 0,transparent 72%),
    radial-gradient(70% 70% at var(--dx,62%) 118%,color-mix(in oklab,var(--b) 80%,transparent) 0,transparent 72%),
    linear-gradient(172deg,color-mix(in oklab,var(--b) 24%,#fff) 0%,color-mix(in oklab,var(--b) 50%,#f3f4f8) 100%);
  translate:calc(var(--px)*-.8cqi) calc(var(--py)*-.6cqi);scale:1.04;transition:translate .9s var(--e)}
/* the tile's pattern, only towards the edges */
.st-bg:before{content:"";position:absolute;inset:0;background:var(--pat,none);opacity:.7;
  -webkit-mask:radial-gradient(75% 80% at 50% 45%,transparent 40%,#000 100%);mask:radial-gradient(75% 80% at 50% 45%,transparent 40%,#000 100%)}
/* film grain */
.st-bg:after{content:"";position:absolute;inset:0;opacity:.22;mix-blend-mode:multiply;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .1 0 0 0 0 .12 0 0 0 0 .16 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E") 0 0/180px 180px}
/* the key light moves from card to card, so neighbours never look lit the same way */
[data-pat="1"] .stage{--lx:16%;--ly:0%;--ax:100%;--ay:100%;--dx:70%}
[data-pat="2"] .stage{--lx:84%;--ly:0%;--ax:0%;--ay:100%;--dx:30%}
[data-pat="3"] .stage{--lx:46%;--ly:-12%;--ax:100%;--ay:55%;--dx:20%}
[data-pat="4"] .stage{--lx:6%;--ly:40%;--ax:88%;--ay:0%;--dx:80%}

/* reset the older thumbnail layout inside a stage */
.stage .thumb.wmt{background:transparent!important;transform:none!important;border-radius:0}
.stage .wmt .phones{position:absolute;inset:0;display:block;padding:0!important;gap:0;transform:none!important;z-index:2}
.stage .thumb.wmt .phones :is(.ph,.pn) img,.stage .thumb.wmt.duo .phones :is(.ph,.pn) img,.stage .thumb.wmt.desk .phones .pn img{display:block;width:100%;height:auto;margin:0;border:0;border-radius:inherit;background:none;box-shadow:none;transform:none!important}

/* ---------- browser window ---------- */
.stage .thumb.wmt .web-win,.stage.st-work .web-win{position:absolute;z-index:1;left:5cqi;top:20%;width:60cqi;margin:0;border-radius:1.4cqi;overflow:hidden;background:#fff;
  box-shadow:0 0 0 max(1px,.12cqi) color-mix(in oklab,var(--sh) 16%,transparent),0 .8cqi 1.6cqi -.6cqi color-mix(in oklab,var(--sh) 28%,transparent),0 5cqi 9cqi -3.5cqi color-mix(in oklab,var(--sh) 50%,transparent);
  translate:calc(var(--px)*.9cqi) calc(var(--py)*.6cqi - var(--lift)*.8cqi);transition:translate .8s var(--e)}
.stage .thumb.wmt .wbar,.stage.st-work .wbar{display:flex;align-items:center;gap:.65cqi;height:3.3cqi;padding:0 1.3cqi;background:linear-gradient(#fcfcfd,#f1f2f5);border-bottom:max(1px,.1cqi) solid #e2e4ea}
.stage .thumb.wmt .wbar i,.stage.st-work .wbar i{width:.95cqi;height:.95cqi;border-radius:50%;background:#ff5f57;box-shadow:inset 0 0 0 max(.5px,.06cqi) #0000001f}
.stage .wbar i:nth-child(2){background:#febc2e}.stage .wbar i:nth-child(3){background:#28c840}
.stage .thumb.wmt .wbar b,.stage.st-work .wbar b{flex:0 1 34%;max-width:none;height:1.85cqi;margin:0 auto;border-radius:.6cqi;background:#e7e9ee}
.stage .web-win img{display:block;width:100%;height:auto}

/* ---------- phones: bezel, frame highlight, dynamic island, contact shadow ---------- */
.stage .ph{position:absolute;display:block;width:var(--w,20cqi);left:var(--x,60cqi);bottom:var(--y,8%);z-index:var(--z,2);
  padding:.62cqi;border-radius:calc(var(--w,20cqi)*.16);background:#0f1116;
  box-shadow:inset 0 0 0 max(1px,.14cqi) #3b404b,0 0 0 max(1px,.1cqi) #00000059,0 1.2cqi 2cqi -1cqi color-mix(in oklab,var(--sh) 55%,transparent),0 4cqi 7cqi -3cqi color-mix(in oklab,var(--sh) 55%,transparent);
  rotate:var(--r,0deg);translate:calc(var(--px)*var(--d,1.8cqi)) calc(var(--py)*1.1cqi - var(--lift)*var(--up,1.8cqi));transition:translate .8s var(--e),rotate .8s var(--e)}
.stage .ph img{border-radius:calc(var(--w,20cqi)*.13)!important;aspect-ratio:600/1300;object-fit:cover;object-position:top}
.stage .ph .isl{position:absolute;top:calc(.62cqi + var(--w,20cqi)*.035);left:50%;width:30%;height:calc(var(--w,20cqi)*.085);translate:-50% 0;border-radius:99px;background:#050608}
.stage .ph:after{content:"";position:absolute;z-index:-1;left:-12%;right:-12%;bottom:-6%;height:9%;border-radius:50%;
  background:radial-gradient(closest-side,color-mix(in oklab,var(--sh) 55%,transparent),transparent);
  translate:0 calc(var(--lift)*var(--up,1.8cqi));opacity:calc(1 - var(--lift)*.35);transition:translate .8s var(--e),opacity .8s}

/* web + mobile: the browser behind, two phones standing in front of its right edge */
.st-web .ph:nth-child(2){--w:19cqi;--x:59cqi;--y:7%;--z:3;--d:2.2cqi;--up:2.4cqi}
.st-web .ph:nth-child(1){--w:15.5cqi;--x:75.5cqi;--y:13%;--z:2;--d:1.5cqi;--up:1.4cqi}
.st-web .ph:nth-child(1) img{filter:saturate(.92) brightness(.98)}
.st-web .ph:nth-child(n+3){display:none}

/* mobile only: three phones fanned */
.st-mobile .ph:nth-child(2){--w:19.5cqi;--x:40.25cqi;--y:6%;--z:3;--d:2cqi;--up:2.6cqi}
.st-mobile .ph:nth-child(1){--w:16.5cqi;--x:23cqi;--y:9%;--r:-7deg;--d:1.3cqi;--up:1.4cqi}
.st-mobile .ph:nth-child(3){--w:16.5cqi;--x:60.5cqi;--y:9%;--r:7deg;--d:1.3cqi;--up:1.4cqi}
.st-mobile .ph:nth-child(n+4){display:none}
.st-mobile[data-n="2"] .ph:nth-child(1){--w:19cqi;--x:29cqi;--r:-5deg}
.st-mobile[data-n="2"] .ph:nth-child(2){--w:19cqi;--x:52cqi;--r:5deg}
.st-mobile[data-n="1"] .ph{--w:19.5cqi;--x:40.25cqi}

/* web only: two browser windows */
.st-web2 .thumb.wmt .web-win{left:5cqi;top:20%;width:60cqi}
.st-web2 .thumb.wmt .web-win.alt{left:auto;right:5cqi;top:38%;width:44cqi;z-index:2;translate:calc(var(--px)*1.8cqi) calc(var(--py)*1.1cqi - var(--lift)*2cqi)}

/* ---------- desktop apps: a laptop with the Mac desktop, the app's panels floating beside it ---------- */
.st-desk .thumb.wmt .web-win{left:7cqi;top:20%;width:58cqi;padding:1cqi 1cqi 1.3cqi;overflow:visible;border-radius:2.1cqi 2.1cqi .5cqi .5cqi;background:#101218;
  box-shadow:inset 0 0 0 max(1px,.14cqi) #2f333c,0 0 0 max(1px,.1cqi) #00000040}
.st-desk .thumb.wmt .web-win .wbar{display:none}
.st-desk .web-win img{border-radius:.5cqi}
.st-desk .web-win .notch{position:absolute;top:1cqi;left:50%;width:9%;height:1.5cqi;translate:-50% 0;border-radius:0 0 .7cqi .7cqi;background:#101218}
.st-desk .web-win .deck{position:absolute;left:-7%;right:-7%;top:100%;height:2.3cqi;border-radius:.3cqi .3cqi 1.8cqi 1.8cqi;
  background:linear-gradient(#eef0f4 0,#d5d9e0 45%,#a9aeb8 100%);box-shadow:inset 0 max(1px,.12cqi) 0 #ffffffcc,0 0 0 max(1px,.08cqi) #0000001f}
.st-desk .web-win .deck:before{content:"";position:absolute;left:50%;top:0;width:15%;height:45%;translate:-50% 0;border-radius:0 0 1cqi 1cqi;background:linear-gradient(#c3c7cf,#d9dce2)}
.st-desk .web-win .deck:after{content:"";position:absolute;z-index:-1;left:2%;right:2%;bottom:-2.6cqi;height:3.4cqi;border-radius:50%;background:radial-gradient(closest-side,color-mix(in oklab,var(--sh) 55%,transparent),transparent)}
.stage .pn{position:absolute;display:block;width:var(--w,22cqi);left:var(--x,68cqi);top:var(--t,24%);z-index:var(--z,2);max-height:48cqi;overflow:hidden;border-radius:1.4cqi;background:#fff;
  box-shadow:0 0 0 max(1px,.1cqi) #0000002e,0 1cqi 2cqi -1cqi color-mix(in oklab,var(--sh) 45%,transparent),0 5cqi 9cqi -3cqi color-mix(in oklab,var(--sh) 60%,transparent);
  translate:calc(var(--px)*var(--d,2cqi)) calc(var(--py)*1.2cqi - var(--lift)*var(--up,2cqi));transition:translate .8s var(--e)}
.stage .pn img{border-radius:0!important}
.st-desk .pn:nth-child(1){--w:21cqi;--x:66cqi;--t:30%;--z:3;--d:2.4cqi;--up:2.4cqi}
.st-desk .pn:nth-child(2){--w:18cqi;--x:77cqi;--t:21%;--z:2;--d:1.5cqi;--up:1.3cqi}
.st-desk .pn:nth-child(n+3){display:none}
/* a Windows taskbar corner, for the apps that also ship on Windows */
.st-tray{position:absolute;z-index:4;right:3.4cqi;bottom:4.2cqi;display:flex;align-items:center;gap:.9cqi;height:4.6cqi;padding:0 1.3cqi;border-radius:1.1cqi;
  background:#ffffffd1;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);box-shadow:0 0 0 max(1px,.1cqi) #ffffffb3,0 1.2cqi 2.4cqi -1.2cqi color-mix(in oklab,var(--sh) 50%,transparent)}
.st-tray i{width:1.5cqi;height:1.5cqi;border-radius:.35cqi;background:#9aa1ad}
.st-tray i:first-child{width:1cqi;height:1cqi;background:none;border:solid #6b7280;border-width:max(1px,.22cqi) max(1px,.22cqi) 0 0;rotate:-45deg;translate:0 .3cqi;border-radius:0}
.st-tray b{display:grid;place-items:center;width:2.6cqi;height:2.6cqi;border-radius:.6cqi;background:var(--mono);color:#fff;font:700 1.7cqi/1 var(--display,system-ui)}

/* ---------- Zoho work: one browser window rising from the bottom edge ---------- */
.stage.st-work .web-win{left:8cqi;top:12%;width:84cqi;width:84cqi;border-radius:1.4cqi 1.4cqi 0 0;translate:calc(var(--px)*.9cqi) calc(var(--py)*.5cqi + 2cqi - var(--lift)*2cqi)}
.st-work .web-win img{position:static!important;width:100%!important;height:auto!important;border-radius:0!important;box-shadow:none!important;transform:none!important}

/* ---------- overlay: monogram badge and platform pills ---------- */
.st-head{position:absolute;z-index:4;left:3.4cqi;right:3.4cqi;top:3.4cqi;display:flex;align-items:center;justify-content:flex-end;gap:8px;pointer-events:none}
.st-badge{--m:clamp(26px,7.4cqi,44px);display:grid;place-items:center;flex:none;width:var(--m);height:var(--m);border-radius:28%;background:var(--mono);color:#fff;
  font-family:var(--display,system-ui);font-weight:700;font-size:calc(var(--m)*.56);line-height:1;letter-spacing:.01em;
  box-shadow:inset 0 1px 0 #ffffff40,inset 0 0 0 1px #ffffff1f,0 .8cqi 1.8cqi -.6cqi color-mix(in oklab,var(--sh) 70%,transparent)}
.st-plats{display:flex;align-items:center;gap:2px;min-width:0;padding:3px;border-radius:999px;background:#ffffffd9;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);
  box-shadow:0 0 0 1px #ffffffb3,0 6px 16px -10px color-mix(in oklab,var(--sh) 70%,transparent)}
.st-p{display:inline-flex;align-items:center;gap:4px;height:clamp(20px,5.2cqi,28px);padding:0 clamp(6px,1.6cqi,10px);border-radius:999px;font-size:clamp(11px,2.7cqi,13.5px);font-weight:500;color:#1d2433;white-space:nowrap}
.st-p svg{width:1.15em;height:1.15em;flex:none;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}
@container (max-width:340px){.st-plats[data-c="4"] .st-p span,.st-plats[data-c="5"] .st-p span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}.st-plats[data-c="4"] .st-p,.st-plats[data-c="5"] .st-p{padding:0 7px}}
@container (max-width:250px){.st-p span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}.st-p{padding:0 7px}}
/* the platforms now sit on the stage, so the tile's own pill row would repeat them */
.ptile:has(.st-plats) .pt-meta{display:none}

/* ---------- light sweep ---------- */
.st-sweep{position:absolute;inset:0;z-index:5;pointer-events:none;overflow:hidden}
.st-sweep:before{content:"";position:absolute;top:-20%;bottom:-20%;left:0;width:45%;rotate:14deg;translate:-160% 0;
  background:linear-gradient(90deg,#ffffff00,#ffffff59 50%,#ffffff00);mix-blend-mode:soft-light}

/* ---------- motion: only for a mouse, only when motion is welcome ---------- */
.mo .pt-img.stage .thumb.wmt,.mo .ptile:hover .pt-img.stage .thumb.wmt,.mo .pt-img.stage .wmt .phones,.mo .ptile:hover .pt-img.stage .wmt .phones{transform:none!important}
@media (prefers-reduced-motion:no-preference){
  .ptile:focus-visible .stage{--lift:1}
  .ptile:focus-visible .st-sweep:before{translate:320% 0;transition:translate 1.2s cubic-bezier(.3,.6,.3,1)}
}
@media (hover:hover) and (pointer:fine) and (prefers-reduced-motion:no-preference){
  .ptile:hover .stage,.pp-art.stage:hover{--lift:1}
  .ptile:hover .st-mobile .ph:nth-child(1),.pp-art.st-mobile:hover .ph:nth-child(1){--r:-9deg}
  .ptile:hover .st-mobile .ph:nth-child(3),.pp-art.st-mobile:hover .ph:nth-child(3){--r:9deg}
  .ptile:hover .st-sweep:before,.pp-art.stage:hover .st-sweep:before{translate:320% 0;transition:translate 1.2s cubic-bezier(.3,.6,.3,1)}
}
@media (prefers-reduced-motion:reduce){
  .stage *,.stage *:before,.stage *:after{transition:none!important}
  .stage{--px:0!important;--py:0!important;--lift:0!important}
}

/* tile body and project-page frame pick up the app's colour */
.ptile.st-tint{background:color-mix(in oklab,var(--base) 7%,#fff);border-color:color-mix(in oklab,var(--base) 34%,#fff)}
.ptile.st-tint:hover{background:color-mix(in oklab,var(--base) 10%,#fff);border-color:color-mix(in oklab,var(--base) 60%,#fff)}
.pp-art.stage{border-color:color-mix(in oklab,var(--b) 40%,#fff)}

/* Platform pills appear on hover or keyboard focus (devices that can hover); touch screens keep them visible */
@media (hover:hover) and (pointer:fine){
  .st-head{opacity:0;transform:translateY(-4px);transition:opacity .2s ease,transform .2s ease}
  .ptile:hover .st-head,.ptile:focus-visible .st-head,.ptile:focus-within .st-head,.pp-art:hover .st-head{opacity:1;transform:none}
}
@media (prefers-reduced-motion:reduce){.st-head{transition:none;transform:none}}
