/*
 * BrainyTech - Portfolio motion layer (pairs with Js/Pages/PortfolioFx.js).
 * Tokens only (DesignPack/Variables.css). Reduced motion = everything static.
 */

/* ═════════ 1 · Intro: logo wipe, then the curtain lifts ═════════ */
.intro{display:none}
.js .intro{display:grid;place-items:center;position:fixed;inset:0;z-index:100;background:var(--intro-bg,var(--bt-surface));pointer-events:none}
[data-theme="dark"] .intro{--intro-bg:var(--c-deep)}
.intro-seen .intro{display:none}
.intro img{width:min(46vw,300px);height:auto;clip-path:inset(0 100% 0 0);transform:translateY(8px)}
.intro.play img{animation:fxWipe .8s var(--bt-ease) .1s forwards}
.intro.out{transition:clip-path .8s var(--bt-ease);clip-path:inset(0 0 100% 0)}
.intro.out img{transition:opacity .35s ease,transform .8s var(--bt-ease);opacity:0;transform:translateY(-28px)}
@keyframes fxWipe{to{clip-path:inset(0 0 0 0);transform:none}}

/* ═════════ 2 · Headlines: words rise out of a mask ═════════ */
.fx-w{display:inline-block;overflow:hidden;vertical-align:top;padding:.12em .1em .24em;margin:-.12em -.1em -.24em}
.fx-w>span{display:inline-block;transform:translateY(calc(100% + .3em));transition:transform 1s var(--bt-out) calc(var(--k,0) * 70ms + .05s)}
h1 .dot,.fx-rev .dot{display:inline-block;transform:scale(0);transition:transform .6s var(--bt-out) calc(var(--k,0) * 70ms + .25s)}
.fx-ready h1 .fx-w>span,.fx-rev.in .fx-w>span{transform:none}
.fx-ready h1 .dot,.fx-rev.in .dot{transform:none}
/* Hero copy below the headline follows it */
.js .hero .copy .lede,.js .hero .copy .cta-row,.js .hero .copy .kick{opacity:0;transform:translateY(14px);transition:opacity .8s ease,transform 1s var(--bt-out)}
.js .hero .copy .kick{transition-delay:.05s}.js .hero .copy .lede{transition-delay:.45s}.js .hero .copy .cta-row{transition-delay:.6s}
.fx-ready .hero .copy .lede,.fx-ready .hero .copy .cta-row,.fx-ready .hero .copy .kick{opacity:1;transform:none}

/* ═════════ 3 · Card cursor + magnetic buttons ═════════ */
.fx-cur{position:fixed;left:0;top:0;z-index:60;pointer-events:none;will-change:transform}
.fx-cur span{position:absolute;left:0;top:0;translate:-50% -50%;display:flex;align-items:center;gap:.4em;white-space:nowrap;
  background:var(--c-signal);color:var(--c-white);font:600 14px/1 var(--bt-sans);padding:14px 18px;border-radius:40px;
  box-shadow:0 14px 30px -12px rgba(3,7,25,.5);scale:.2;opacity:0;transition:scale .45s var(--bt-out),opacity .25s ease}
.fx-cur.on span{scale:1;opacity:1}
/* the hand stays visible next to the pill: the card reads as clickable */
.has-cur .card .vis{cursor:pointer}
.has-cur .card:not(.final) .open{display:none}
.fx-mag{transition-property:translate,transform,background,color,box-shadow,opacity,bottom;transition-duration:.45s;transition-timing-function:var(--bt-out)}

/* ═════════ 4 · Live cards: the screen leans toward the pointer ═════════ */
.has-cur .card .cv{translate:calc(var(--mx,0) * -2.2%) calc(var(--my,0) * -2.2%);transition:transform 1.2s var(--bt-out),translate .9s var(--bt-out)}
.has-cur .card:hover .cv{transform:scale(1.06)}
.fx-vid{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:6;opacity:0;transition:opacity .5s ease}
.vis.playing .fx-vid{opacity:1}

/* ═════════ 5 · Closing ═════════ */
.contact .ct h2 .fx-w,.contact .ct h2 .fx-w>span{color:inherit}
.contact .btn-xl{transition-property:translate,transform,background,color,box-shadow}
.contact .btn-xl:hover{box-shadow:0 0 0 10px color-mix(in srgb,var(--c-paper) 10%,transparent)}

/* ═════════ Reduced motion: final states, no movement ═════════ */
@media (prefers-reduced-motion:reduce){
  .js .intro{display:none}
  .fx-w>span,h1 .dot,.fx-rev .dot{transform:none;transition:none}
  .js .hero .copy .lede,.js .hero .copy .cta-row,.js .hero .copy .kick{opacity:1;transform:none;transition:none}
}

/* ═════════ 6 · Blocks rise in on scroll (cards, facts, products, closing) ═════════ */
.fx-up{opacity:0;transform:translateY(28px);transition:opacity .8s ease calc(var(--u,0) * 80ms),transform 1.1s var(--bt-out) calc(var(--u,0) * 80ms)}
.fx-up.in{opacity:1;transform:none}
