/* ============ Arbaa Studio — animation layer 2 ============ */

/* ---------- Giant outlined words sliding behind sections ---------- */
section[data-bgword] { overflow: hidden; }
section[data-bgword] > .wrap { position: relative; z-index: 1; }
.bgword {
  position: absolute; top: 50%; left: 0; z-index: 0; pointer-events: none; user-select: none;
  font-family: var(--display); font-weight: 700; font-size: clamp(120px, 24vw, 360px); line-height: 1;
  white-space: nowrap; color: transparent; -webkit-text-stroke: 2px rgba(255, 255, 255, .06);
  translate: calc(var(--bp, 0) * -45vw + 15vw) -50%;
}
.bgword b { color: transparent; -webkit-text-stroke: 2px var(--bw-accent, rgba(0, 218, 245, .14)); }

/* ---------- Scroll zoom-in for big cards ---------- */
.zoomy { scale: calc(.88 + var(--zp, 1) * .12); border-radius: calc(28px + (1 - var(--zp, 1)) * 40px); }

/* ---------- Cursor block trail ---------- */
.trail { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; border-radius: 2px; }

/* ---------- Hero shockwave + shake ---------- */
.shock {
  position: fixed; z-index: 1000; pointer-events: none; border-radius: 50%;
  border: 3px solid var(--c, var(--cyan)); width: 20px; height: 20px; translate: -50% -50%;
}
.hero.shake { animation: shake .45s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
  10%, 90% { transform: translate(-2px, 1px) rotate(-.3deg); }
  20%, 80% { transform: translate(4px, -2px) rotate(.4deg); }
  30%, 50%, 70% { transform: translate(-7px, 3px) rotate(-.6deg); }
  40%, 60% { transform: translate(7px, -3px) rotate(.6deg); }
}
.blk.spin { animation: blkSpin .7s cubic-bezier(.34, 1.56, .64, 1) !important; }
@keyframes blkSpin { from { transform: rotate(0) scale(.6); } to { transform: rotate(360deg) scale(1); } }

/* ---------- Nav letter roll ---------- */
.roll { display: inline-block; overflow: hidden; vertical-align: top; line-height: 1.35; height: 1.35em; }
.roll .rc { display: inline-block; text-shadow: 0 1.35em var(--cyan); transition: transform .38s cubic-bezier(.65, 0, .35, 1); transition-delay: calc(var(--i) * 22ms); white-space: pre; }
a:hover > .roll .rc, .brand:hover .roll .rc { transform: translateY(-1.35em); }

/* ---------- Button shine + ripple ---------- */
.btn { position: relative; overflow: hidden; isolation: isolate; }
.btn::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; z-index: -1; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: skewX(-20deg); transition: left .6s ease;
}
.btn-primary::after { z-index: 0; }
.btn:hover::after { left: 130%; }
.btn > * { position: relative; z-index: 1; }
.ripple {
  position: absolute; border-radius: 50%; pointer-events: none; z-index: 0;
  background: rgba(255, 255, 255, .45); translate: -50% -50%; width: 10px; height: 10px;
  animation: ripple .6s ease-out forwards;
}
@keyframes ripple { to { width: 360px; height: 360px; opacity: 0; } }

/* ---------- Avatar flip ---------- */
.member .avatar { transform-style: preserve-3d; }
.member:hover .avatar { animation: avFlip .8s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes avFlip { from { transform: perspective(400px) rotateY(0); } to { transform: perspective(400px) rotateY(360deg); } }
.member:hover .title { animation: titleWave .5s ease; }
@keyframes titleWave { 50% { letter-spacing: .08em; } }

/* ---------- Physics playground ---------- */
.playground { position: relative; height: clamp(380px, 48vw, 520px); padding: 0; overflow: hidden; border-top: 1px solid var(--line); background: radial-gradient(ellipse at 50% 120%, rgba(155, 77, 255, .18), transparent 60%), var(--bg); }
.playground canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; }
.playground canvas:active { cursor: grabbing; }
.pg-label { position: absolute; left: 0; right: 0; top: clamp(30px, 6vw, 70px); text-align: center; pointer-events: none; z-index: 1; }
.pg-label h2 { font-size: clamp(32px, 5vw, 60px); margin: 12px 0 8px; }
.pg-label p { color: var(--muted); font-size: 15px; }
.pg-word {
  position: absolute; left: 50%; bottom: 8%; translate: -50% 0; pointer-events: none;
  font-family: var(--display); font-weight: 700; font-size: clamp(110px, 22vw, 300px); line-height: 1;
  color: transparent; -webkit-text-stroke: 2px rgba(255, 255, 255, .07);
}

/* ---------- ECHO: sonar cursor ripples ---------- */
.sonar-ripple {
  position: fixed; z-index: 999; pointer-events: none; border-radius: 50%;
  border: 1.5px solid rgba(0, 218, 245, .7); width: 90px; height: 90px; margin: -45px 0 0 -45px;
}

/* ---------- ECHO: flashlight text ---------- */
.flashlight.lit-on {
  -webkit-mask-image: radial-gradient(circle 260px at var(--fx) var(--fy), #000 35%, rgba(0, 0, 0, .14) 100%);
          mask-image: radial-gradient(circle 260px at var(--fx) var(--fy), #000 35%, rgba(0, 0, 0, .14) 100%);
}

/* ---------- ECHO: shoot the lights ---------- */
.twist .lit { position: relative; overflow: hidden; cursor: crosshair; transition: background .15s, color .15s; }
.twist .lit::after {
  content: "Click to shoot the light"; position: absolute; right: 18px; bottom: 14px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: #8a8270;
}
.twist .lit.shot { background: #050505 !important; filter: none !important; animation: none !important; }
.twist .lit.shot::after { content: "Click to restore power"; color: #4d6a77; }
.twist .lit.shot h3 { color: #cfe9ff; }
.twist .lit.shot p { color: #6f8a99 !important; }
.twist .lit.shot .eyebrow { color: #4d6a77 !important; }
.twist .lit.relight { animation: lightsOn 1.2s linear both !important; }
.muzzle {
  position: absolute; z-index: 5; pointer-events: none; width: 600px; height: 600px; translate: -50% -50%; border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, rgba(255, 240, 200, .9) 10%, rgba(255, 220, 150, .3) 30%, transparent 60%);
  animation: muzzle .35s ease-out forwards;
}
@keyframes muzzle { from { opacity: 1; scale: .3; } to { opacity: 0; scale: 1.2; } }
.hole {
  position: absolute; z-index: 4; width: 34px; height: 34px; translate: -50% -50%; pointer-events: none; border-radius: 50%;
  background:
    radial-gradient(circle, #000 0 18%, rgba(0, 218, 245, .5) 20%, transparent 24%),
    conic-gradient(from 10deg, transparent 0 8%, rgba(0, 218, 245, .35) 8% 9%, transparent 9% 30%, rgba(0, 218, 245, .35) 30% 31%, transparent 31% 55%, rgba(0, 218, 245, .35) 55% 56%, transparent 56% 80%, rgba(0, 218, 245, .35) 80% 81%, transparent 81%);
  animation: holeIn .25s ease-out;
}
@keyframes holeIn { from { scale: 0; } }
.twist.flash { animation: twistShake .3s; }
@keyframes twistShake { 25% { transform: translate(-4px, 2px); } 50% { transform: translate(4px, -2px); } 75% { transform: translate(-2px, 1px); } }
.twist .lit { padding-bottom: 56px; }
