/* ==========================================================
   Arup Barman — Enhancement layer (v9.6)
   Animations + mobile optimisation. Loaded AFTER style.css.
   Does not modify any core theme file. Delete this file and the
   enqueue block at the end of functions.php to revert completely.
   ========================================================== */

/* ---------- 1. MOBILE OPTIMISATION ---------- */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{overflow-x:clip}
img,svg,video{max-width:100%}
a,button,select{-webkit-tap-highlight-color:transparent}
.floating-whatsapp{bottom:calc(20px + env(safe-area-inset-bottom,0px))}

@media (max-width:900px){
  /* Sticky, blurred header on the homepage too */
  body.home .site-header{position:sticky;top:0;padding-bottom:10px;background:rgba(255,255,255,.88);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px)}
  .site-header{transition:transform .35s cubic-bezier(.16,1,.3,1),box-shadow .3s}
  .site-header.abx-hide{transform:translateY(-120%)}
  .site-header.is-scrolled{box-shadow:0 8px 26px rgba(0,0,0,.06)}

  /* Proper 44px tap targets in menu */
  .toggle{width:44px;height:44px;padding:0;border-radius:14px;background:#f3f3f3;display:grid;place-items:center;font-size:22px;line-height:1;cursor:pointer}
  .menu{max-height:calc(100vh - 110px);max-height:calc(100dvh - 110px);overflow-y:auto;-webkit-overflow-scrolling:touch;gap:2px!important}
  .menu li{list-style:none;width:100%}
  .menu a,.menu li a{display:block;width:100%;padding:14px 6px!important;font-size:16px;font-weight:700}
  .menu .nav-cta,.menu li:last-child a{text-align:center;margin-top:8px!important;padding:15px 22px!important}

  /* Hero: photo first, then CTA, then the target card */
  .edge-visual{display:flex!important;flex-direction:column;gap:14px}
  .edge-visual>*{margin:0!important}
  .edge-profile-card{order:1}.edge-talk-card{order:2}.edge-target-card{order:3}.edge-skill-card{order:4}
  .edge-talk-card{min-height:110px;padding:20px 20px 20px 24px!important}
  .edge-skill-card{min-height:96px!important}
  .edge-skill-card .bulb{font-size:34px!important}
  .edge-skill-card strong{font-size:16px}

  /* Section rhythm */
  .edge-section{padding:60px 0}
  .edge-section-top{gap:18px;margin-bottom:30px}
  .edge-outline-btn{display:flex;justify-content:space-between;align-items:center;width:100%;min-height:50px}
  .edge-service-card:hover,.edge-blog-card:hover{transform:none}
  .edge-blog-card{min-height:0}
  .edge-project-card>b{width:48px;height:48px;right:22px;top:22px}

  /* Footer never hides behind the floating WhatsApp button */
  footer{padding-bottom:calc(92px + env(safe-area-inset-bottom,0px))!important}
  .footer-grid{gap:28px}
  .footer-social,.social-links{gap:10px}
  .footer-social a,.social-links-wide a{min-width:44px;min-height:44px}
}

@media (max-width:520px){
  .edge-hero{padding:24px 0 40px}
  .edge-hero-copy{margin:14px 0 24px}
  .edge-hero-copy h1{font-size:clamp(38px,11.4vw,52px);letter-spacing:-.055em}
  .edge-hero-copy p{font-size:15.5px;line-height:1.55;margin-top:16px}
  .edge-kicker{font-size:8.5px;gap:7px;letter-spacing:.09em}

  .edge-profile-card{min-height:350px!important;border-radius:28px}
  .edge-profile-card img{height:92%!important}
  .edge-handnote{font-size:18px!important;top:8%!important}

  .edge-target-card{min-height:290px!important;padding:24px!important}
  .edge-target{top:38%!important;transform:translate(-50%,-50%) scale(.56)!important}
  .edge-scribble{left:20px!important;bottom:20px!important;font-size:15px!important}
  .edge-stat{right:12px!important;bottom:12px!important;min-width:0!important;padding:10px 12px!important;grid-template-columns:34px 1fr!important}
  .edge-stat strong{font-size:16px!important}

  .edge-section{padding:50px 0}
  .edge-section h2,.edge-about-grid h2{font-size:clamp(36px,10.8vw,48px)}
  .edge-about-copy>p{font-size:19px;margin:22px 0 26px}
  .edge-service-card{padding:18px!important;gap:14px;min-height:0;border-radius:24px}
  .edge-service-card h3{font-size:22px}
  .edge-project-card{min-height:290px!important;padding:22px!important;border-radius:26px!important}
  .edge-project-card h3{font-size:clamp(34px,10.5vw,42px)!important}
  .edge-project-card p{font-size:14.5px}
  .edge-exp-list>div{padding:20px 0;gap:6px 12px}
  .edge-exp-list strong{font-size:16px;line-height:1.3;word-break:break-word}
  .edge-blog-card{padding:22px!important;border-radius:24px}
  .edge-blog-card h3{font-size:22px;margin:18px 0 10px}
  .edge-cta{padding:56px 0}
  .social-bar{padding:28px 0}
}

/* Touch screens: no sticky hover states, add tap feedback instead */
@media (hover:none){
  .edge-service-card:hover,.edge-project-card:hover,.edge-blog-card:hover,.ab-service-card:hover,.ab-price-card:hover,.ab-latest-card:hover{transform:none;box-shadow:none}
  .edge-service-card:active,.edge-project-card:active,.edge-blog-card:active,.edge-talk-card:active,.edge-outline-btn:active,.ab-inquiry-whatsapp:active{transform:scale(.985);transition:transform .12s}
}

/* ---------- 2. ANIMATION LAYER ---------- */
@media (prefers-reduced-motion:no-preference){

  /* scroll progress bar */
  .abx-progress{position:fixed;left:0;top:0;width:100%;height:3px;z-index:10001;pointer-events:none;transform-origin:0 50%;transform:scaleX(0);background:linear-gradient(90deg,#ff1f2d,#ff7a84)}

  /* staggered scroll reveal (works with the theme's own .reveal) */
  @keyframes abxRise{from{opacity:0;transform:translateY(38px) scale(.975)}to{opacity:1;transform:none}}
  html.js .reveal.visible{animation:abxRise .85s cubic-bezier(.16,1,.3,1) backwards;animation-delay:var(--abx-d,0s)}

  /* hero headline: word-by-word rise */
  .abx-w{display:inline-block;overflow:hidden;vertical-align:top;padding-bottom:.08em;margin-bottom:-.08em}
  .abx-wi{display:inline-block;transform:translateY(112%)}
  body.intro-complete .abx-wi{animation:abxWord .95s cubic-bezier(.16,1,.3,1) both;animation-delay:calc(var(--i,0)*70ms + .05s)}
  @keyframes abxWord{from{transform:translateY(112%) rotate(4deg)}to{transform:none}}

  /* hero cards enter one after another */
  @keyframes abxPop{from{opacity:0;translate:0 44px;scale:.92}to{opacity:1;translate:0 0;scale:1}}
  .edge-visual.visible>.edge-target-card{animation:abxPop .9s cubic-bezier(.16,1,.3,1) .05s backwards}
  .edge-visual.visible>.edge-profile-card{animation:abxPop .9s cubic-bezier(.16,1,.3,1) .2s backwards}
  .edge-visual.visible>.edge-talk-card{animation:abxPop .9s cubic-bezier(.16,1,.3,1) .4s backwards}
  .edge-visual.visible>.edge-skill-card{animation:abxPop .9s cubic-bezier(.16,1,.3,1) .55s backwards}

  /* target: breathing rings, landing dart, ripple bullseye */
  @keyframes abxRing{0%,100%{scale:1}50%{scale:1.045}}
  .edge-target .r1{animation:abxRing 3.6s ease-in-out infinite}
  .edge-target .r2{animation:abxRing 3.6s ease-in-out .3s infinite reverse}
  .edge-target .r3{animation:abxRing 3.6s ease-in-out .6s infinite}
  @keyframes abxBull{0%{scale:1;box-shadow:0 0 0 0 rgba(255,255,255,.65)}70%{scale:1.25;box-shadow:0 0 0 16px rgba(255,255,255,0)}100%{scale:1;box-shadow:0 0 0 0 rgba(255,255,255,0)}}
  .edge-target .bull{animation:abxBull 2s ease-out infinite}
  @keyframes abxDart{0%{translate:70px -46px;opacity:0}10%{translate:0 0;opacity:1}13%{translate:-5px 3px}17%{translate:0 0}88%{opacity:1}100%{translate:0 0;opacity:0}}
  .edge-target .dart{animation:abxDart 5s cubic-bezier(.2,.8,.2,1) infinite}

  /* stat card bars + floats */
  @keyframes abxBar{0%,100%{scale:1 .55}50%{scale:1 1}}
  .edge-stat .bars i{transform-origin:50% 100%;animation:abxBar 1.9s ease-in-out infinite}
  .edge-stat .bars i:nth-child(2){animation-delay:.2s}.edge-stat .bars i:nth-child(3){animation-delay:.4s}
  @keyframes abxFloat{0%,100%{translate:0 0}50%{translate:0 -9px}}
  .edge-handnote{animation:abxFloat 4.4s ease-in-out infinite}
  .edge-scribble{animation:abxFloat 5.2s ease-in-out .4s infinite}
  .edge-skill-card{animation:abxFloat 5.6s ease-in-out .8s infinite}
  .edge-stat{animation:abxFloat 4.8s ease-in-out 1.1s infinite}
  @keyframes abxDrift{0%,100%{translate:0 0;scale:1}50%{translate:-18px -14px;scale:1.08}}
  .edge-profile-shape{animation:abxDrift 9s ease-in-out infinite}
  @keyframes abxGlow{from{opacity:.35;translate:-6% -4%}to{opacity:1;translate:8% 6%}}
  .edge-profile-card:before{content:"";position:absolute;inset:-10%;z-index:1;pointer-events:none;background:radial-gradient(circle at 28% 22%,rgba(255,255,255,.28),transparent 46%);animation:abxGlow 7s ease-in-out infinite alternate}
  @keyframes abxBulb{0%,100%{rotate:-6deg;scale:1;filter:drop-shadow(0 0 0 rgba(255,190,40,0))}50%{rotate:6deg;scale:1.12;filter:drop-shadow(0 0 14px rgba(255,190,40,.75))}}
  .edge-skill-card .bulb{animation:abxBulb 2.6s ease-in-out infinite}
  @keyframes abxDash{0%,100%{translate:0 0;opacity:.55}50%{translate:12px 0;opacity:1}}
  .edge-dash-arrow{animation:abxDash 1.8s ease-in-out infinite}
  @keyframes abxNudge{0%,100%{translate:0 0}50%{translate:7px 0}}
  .edge-talk-card>b{animation:abxNudge 1.6s ease-in-out infinite}
  @keyframes abxRedGlow{0%,100%{box-shadow:0 18px 44px rgba(255,31,45,.22)}50%{box-shadow:0 22px 60px rgba(255,31,45,.5)}}
  .edge-talk-card{animation:abxRedGlow 2.8s ease-in-out infinite}
  .edge-visual.visible>.edge-talk-card{animation:abxPop .9s cubic-bezier(.16,1,.3,1) .4s backwards,abxRedGlow 2.8s ease-in-out 1.4s infinite}
  .edge-visual.visible>.edge-skill-card{animation:abxPop .9s cubic-bezier(.16,1,.3,1) .55s backwards,abxFloat 5.6s ease-in-out 1.5s infinite}
  /* pointer parallax on the portrait (desktop only, vars set by JS) */
  .edge-profile-card img{translate:calc(var(--abx-px,0)*-12px) calc(var(--abx-py,0)*-8px);transition:translate .35s ease-out}

  /* section label bar grows in */
  @keyframes abxGrow{from{scale:0 1}to{scale:1 1}}
  .edge-label i{transform-origin:0 50%}
  .reveal.visible .edge-label i{animation:abxGrow .9s cubic-bezier(.16,1,.3,1) .2s backwards}

  /* cards: cursor spotlight, icon spin, project shine */
  .edge-service-card,.edge-blog-card{position:relative;overflow:hidden}
  .edge-service-card:before,.edge-blog-card:before{content:"";position:absolute;inset:0;pointer-events:none;opacity:0;transition:opacity .3s;background:radial-gradient(260px circle at var(--sx,50%) var(--sy,50%),rgba(255,31,45,.10),transparent 70%)}
  .edge-service-icon{transition:background .3s,color .3s,rotate .45s cubic-bezier(.34,1.56,.64,1),scale .45s cubic-bezier(.34,1.56,.64,1)}
  .edge-round-arrow{transition:background .3s,color .3s,translate .3s}
  .edge-project-card{transition:translate .4s cubic-bezier(.16,1,.3,1),box-shadow .4s}
  .edge-project-card:after{content:"";position:absolute;inset:0;pointer-events:none;background:linear-gradient(110deg,transparent 35%,rgba(255,255,255,.14) 50%,transparent 65%);translate:-130% 0;transition:translate .9s ease}
  .edge-project-card>b{transition:rotate .4s cubic-bezier(.34,1.56,.64,1),background .3s,color .3s}
  @media (hover:hover){
    .edge-service-card:hover:before,.edge-blog-card:hover:before{opacity:1}
    .edge-service-card:hover .edge-service-icon{background:#ff1f2d;color:#fff;rotate:-8deg;scale:1.1}
    .edge-service-card:hover .edge-round-arrow{background:#ff1f2d;color:#fff;translate:4px 0}
    .edge-project-card:hover{translate:0 -9px;box-shadow:0 26px 60px rgba(0,0,0,.28)}
    .edge-project-card:hover:after{translate:130% 0}
    .edge-project-card:hover>b{rotate:45deg;background:#ff1f2d;color:#fff}
    .edge-blog-card{transition:translate .3s,box-shadow .3s}
    .edge-blog-card:hover{translate:0 -6px;box-shadow:0 18px 40px rgba(0,0,0,.08)}
    .edge-blog-card>a:hover{color:#ff1f2d}
    .edge-exp-list>div{transition:padding-left .3s,background .3s}
    .edge-exp-list>div:hover{padding-left:16px;background:#fafafa}
    .footer-social a:hover,.social-links-wide a:hover{translate:0 -3px}
  }

  /* CTA section: slow pulsing circles */
  .edge-cta{position:relative;overflow:hidden}
  .edge-cta .wrap{position:relative;z-index:1}
  @keyframes abxOrb{0%,100%{scale:1;opacity:.14}50%{scale:1.2;opacity:.26}}
  .edge-cta:before{content:"";position:absolute;right:-8%;top:-40%;width:520px;height:520px;border-radius:50%;background:#fff;opacity:.14;pointer-events:none;animation:abxOrb 7s ease-in-out infinite}
  .edge-cta:after{content:"";position:absolute;left:-6%;bottom:-50%;width:380px;height:380px;border-radius:50%;background:#000;opacity:.08;pointer-events:none;animation:abxOrb 9s ease-in-out 1s infinite}

  /* floating WhatsApp pulse */
  @keyframes abxWa{0%{box-shadow:0 0 0 0 rgba(37,211,102,.55)}70%{box-shadow:0 0 0 18px rgba(37,211,102,0)}100%{box-shadow:0 0 0 0 rgba(37,211,102,0)}}
  .floating-whatsapp{animation:abxWa 2.6s ease-out 2.5s infinite}

  /* tap / click ripple on buttons */
  .abx-rip{position:relative;overflow:hidden}
  .menu .nav-cta,.edge-outline-btn,.ab-inquiry-whatsapp{position:relative;overflow:hidden}
  .abx-ripple{position:absolute;border-radius:50%;pointer-events:none;background:rgba(255,255,255,.45);scale:0;animation:abxRipple .65s ease-out forwards}
  .edge-outline-btn .abx-ripple{background:rgba(255,31,45,.18)}
  @keyframes abxRipple{to{scale:1;opacity:0}}

  /* mobile menu: smooth open + staggered items */
  @media (max-width:900px){
    .menu.open{animation:abxMenu .32s cubic-bezier(.16,1,.3,1) both;transform-origin:top right}
    @keyframes abxMenu{from{opacity:0;transform:translateY(-10px) scale(.97)}to{opacity:1;transform:none}}
    .menu.open>*{animation:abxMenuItem .45s cubic-bezier(.16,1,.3,1) both}
    .menu.open>*:nth-child(1){animation-delay:.04s}.menu.open>*:nth-child(2){animation-delay:.08s}
    .menu.open>*:nth-child(3){animation-delay:.12s}.menu.open>*:nth-child(4){animation-delay:.16s}
    .menu.open>*:nth-child(5){animation-delay:.2s}.menu.open>*:nth-child(6){animation-delay:.24s}
    .menu.open>*:nth-child(n+7){animation-delay:.28s}
    @keyframes abxMenuItem{from{opacity:0;translate:-14px 0}to{opacity:1;translate:0 0}}
  }

  /* Elementor homepage version of the floating widgets */
  body.ab-elementor-home .ab-hero-note-widget{animation:abxFloat 4.6s ease-in-out infinite}
  body.ab-elementor-home .ab-growth-widget{animation:abxFloat 5.2s ease-in-out .7s infinite}
  @keyframes abxCircle{0%,100%{scale:1}50%{scale:1.06}}
  body.ab-elementor-home .ab-hero-visual:before{animation:abxCircle 5s ease-in-out infinite}
}
