/* =========================================================
   Motion layer — makes the page feel alive
   ========================================================= */
:root { --spring: cubic-bezier(.3, 1.5, .5, 1); --out: cubic-bezier(.2, .75, .2, 1); }
@keyframes rot { to { transform: rotate(360deg); } }
@keyframes up { from { opacity: 0; transform: translateY(26px); } }
@keyframes wipe {
  from { opacity: 0; clip-path: inset(0 0 100% 0); transform: translateY(40px); }
  to { opacity: 1; clip-path: inset(-25% -10% -35% -10%); transform: none; }
}
@keyframes pop { from { opacity: 0; transform: scale(.55); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(34px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg) scale(1.12); } 60% { transform: rotate(10deg); } }
@keyframes bob { 50% { transform: translateY(-6px); } }
@keyframes uline { to { background-size: 100% 2px; } }
@keyframes scanline { 0% { top: 0; opacity: 0; } 5% { opacity: 1; } 45% { top: 100%; opacity: 1; } 50%, 100% { top: 100%; opacity: 0; } }
@keyframes ringpulse { 0% { box-shadow: 0 0 0 0 rgba(173, 40, 49, .55); } 100% { box-shadow: 0 0 0 18px rgba(173, 40, 49, 0); } }

/* pause hero intro while the boot screen is up */
body.is-booting .hero *, body.is-booting .hero *::before, body.is-booting .hero *::after { animation-play-state: paused !important; }

/* ---------- HERO intro ---------- */
.hero__title.in .hero__hi { animation: slideIn .8s .05s var(--out) both; }
.hero__title.in .hero__name { animation: wipe 1.2s .18s var(--out) both; }
.hero__title.in .hero__en { animation: up .8s .55s var(--out) both; }
.hero__role.in { animation: up .8s .7s var(--out) both; }
.hero__lead strong { background: linear-gradient(90deg, var(--c-300), var(--c-500)) 100% 100% / 0 2px no-repeat; padding-bottom: 2px; }
.hero__lead.in strong { animation: uline .9s calc(1.2s + var(--i, 0) * .25s) var(--out) forwards; }
.hero__stats.in li { animation: pop .6s calc(.9s + var(--i, 0) * .12s) var(--spring) both; }

/* portrait: entrance (backwards fill keeps JS tilt working afterwards) */
.hero__visual.in .portrait { animation: portraitIn 1.3s .25s var(--out) backwards; }
@keyframes portraitIn { from { opacity: 0; transform: perspective(1000px) rotateY(-18deg) scale(.86); } }
.chip--1 { animation: pop .7s .95s var(--spring) backwards, float-a 5.5s 1.65s ease-in-out infinite; }
.chip--2 { animation: pop .7s 1.1s var(--spring) backwards, float-b 7s 1.8s ease-in-out infinite; }
.chip--3 { animation: pop .7s 1.25s var(--spring) backwards, float-c 6.4s 1.95s ease-in-out infinite; }
.chip .ico { transition: transform .4s var(--spring); }
.chip:hover .ico { transform: rotate(180deg) scale(1.2); }

/* scanning line over the photo */
.portrait__img::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; z-index: 2; pointer-events: none;
  background: var(--c-300); box-shadow: 0 0 18px 3px var(--c-300); opacity: 0;
  animation: scanline 6.5s 2.2s ease-in-out infinite;
}

/* orbit rings behind the portrait */
.orbit { position: absolute; left: 50%; top: 50%; width: 128%; aspect-ratio: 1; z-index: -1; pointer-events: none;
  translate: -50% calc(-50% + var(--sy, 0) * .07px); }
.orbit i { position: absolute; inset: 0; border-radius: 50%; border: 1px dashed rgba(173, 40, 49, .28); animation: rot 60s linear infinite; }
.orbit i:nth-child(2) { inset: 9%; border: 1px solid rgba(236, 122, 128, .14); animation-duration: 36s; animation-direction: reverse; }
.orbit i:nth-child(3) { inset: 19%; border-color: rgba(173, 40, 49, .2); animation-duration: 24s; }
.orbit i::after { content: ''; position: absolute; top: -5px; left: 50%; width: 9px; height: 9px; border-radius: 50%; background: var(--c-300); box-shadow: 0 0 14px 2px var(--c-300); }
.orbit i:nth-child(2)::after { top: auto; bottom: -4px; background: var(--c-500); box-shadow: 0 0 14px 2px var(--c-500); }
.orbit i:nth-child(3)::after { left: 12%; top: 16%; width: 6px; height: 6px; }

/* crosshair that follows the mouse in the hero */
.xh { position: absolute; left: 0; top: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity .3s; }
.hero.aim .xh { opacity: 1; }
.xh-v { bottom: 0; width: 1px; background: linear-gradient(180deg, transparent, rgba(236, 122, 128, .35), transparent); }
.xh-h { right: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(236, 122, 128, .35), transparent); }
.xh-t { font: 600 10.5px/1 var(--f-mono); letter-spacing: .08em; color: var(--c-300); padding: 4px 7px; border: 1px solid rgba(236, 122, 128, .45);
  background: rgba(18, 3, 2, .8); border-radius: 4px; direction: ltr; white-space: pre; }

/* ---------- Cursor ring ---------- */
.cur-ring, .cur-dot { position: fixed; left: 0; top: 0; z-index: 95; pointer-events: none; border-radius: 50%; }
.cur-ring { width: 34px; height: 34px; margin: -17px 0 0 -17px; border: 1.5px solid rgba(173, 40, 49, .6);
  transition: width .25s var(--out), height .25s var(--out), margin .25s var(--out), background .25s, border-color .25s; }
.cur-ring.hover { width: 58px; height: 58px; margin: -29px 0 0 -29px; background: rgba(173, 40, 49, .1); border-color: var(--c-300); }
.cur-ring.down { width: 24px; height: 24px; margin: -12px 0 0 -12px; }
.cur-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--c-300); box-shadow: 0 0 10px var(--c-300); }

/* ---------- Section headings ---------- */
.sec-head.in h2, .contact.in h2 { animation: wipe 1.05s .12s var(--out) both; }
.sec-rule { display: block; width: 120px; height: 2px; margin: 4px 0 18px; border-radius: 2px; position: relative;
  background: linear-gradient(90deg, var(--c-300), var(--c-500)); transform: scaleX(0); transform-origin: 100% 50%;
  transition: transform 1.1s .35s var(--out); }
.sec-rule::after { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--c-300); box-shadow: 0 0 12px var(--c-300); }
.sec-head--center .sec-rule { margin-inline: auto; transform-origin: 50% 50%; }
.sec-head.in .sec-rule { transform: scaleX(1); }
.kicker { min-height: 1.9em; }
.kicker.typing::after { content: '▌'; margin-inline-start: 2px; animation: blink .7s steps(1) infinite; }

/* ---------- Staggered items ---------- */
.svc.in .tags li, .proj.in .tags li, .xp.in .tags li { animation: pop .5s calc(.35s + var(--i, 0) * .07s) var(--spring) both; }
.stack.in li { animation: pop .45s calc(var(--i, 0) * .045s + .15s) var(--spring) both; }
.langs.in b { animation: pop .5s calc(var(--i, 0) * .1s + .1s) var(--spring) both; }
.pills.in li { animation: slideIn .6s calc(var(--i, 0) * .12s + .1s) var(--out) both; }
.xp.in .xp__list li { animation: slideIn .7s calc(var(--i, 0) * .12s + .25s) var(--out) both; }
.xp.in .xp__list .ico { animation: pop .6s calc(var(--i, 0) * .12s + .45s) var(--spring) both; }
.xp__logo { animation: ringpulse 2.4s infinite; }

/* service icons: idle bob + wiggle on hover */
.svc__ic { animation: bob 3.2s calc(var(--i, 0) * -.5s) ease-in-out infinite; }
.svc:hover .svc__ic .ico, .pills li:hover .ico, .xp__list li:hover .ico, .step:hover .ico { animation: wiggle .6s var(--spring); }

/* animated gradient border on hover (cards) */
.svc, .proj, .stack__g, .step, .gtab, .xp { position: relative; }
.svc::after, .proj::after, .stack__g::after, .step::after, .gtab::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none; z-index: 3;
  background: conic-gradient(from var(--a), transparent 0 55%, var(--c-300), var(--c-500), transparent 88%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0; transition: opacity .35s; animation: spin 3.5s linear infinite;
}
.svc:hover::after, .proj:hover::after, .stack__g:hover::after, .step:hover::after, .gtab:hover::after, .gtab.is-active::after { opacity: 1; }

/* project mock parallax with the mouse */
.proj .mock { translate: calc(var(--px, 0) * 22px) calc(var(--py, 0) * 18px); transition: translate .25s var(--out), transform .5s var(--out); }

/* process: line draws + numbers pop */
.process::before { transform: scaleX(0); transform-origin: 100% 50%; transition: transform 1.5s var(--out); }
.process.in::before { transform: scaleX(1); }
.step.in .step__n { animation: pop .8s .15s var(--spring) both; }

/* ---------- Buttons: shine sweep ---------- */
.btn { overflow: hidden; isolation: isolate; }
.btn::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .32) 50%, transparent 70%);
  transform: translateX(-130%); transition: transform .75s var(--out);
}
.btn:hover::before { transform: translateX(130%); }
.hero__actions .btn--primary::before { animation: shine 3.8s 2.6s ease-in-out infinite; }
.btn .ico { transition: transform .35s var(--spring); }
.btn:hover .ico { transform: translateX(-4px) scale(1.15); }

/* nav underline */
.nav__links a::before {
  content: ''; position: absolute; inset-inline: 14px; bottom: 4px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--c-300), var(--c-500)); transform: scaleX(0); transition: transform .3s var(--out);
}
.nav__links a:hover::before, .nav__links a.active::before { transform: scaleX(1); }

/* aurora drifts with scroll (parallax) */
.aurora i:nth-child(1) { translate: 0 calc(var(--sy, 0) * -.12px); }
.aurora i:nth-child(2) { translate: 0 calc(var(--sy, 0) * -.06px); }
.aurora i:nth-child(3) { translate: 0 calc(var(--sy, 0) * -.09px); }

/* the canvas dot-grid replaces the static CSS dot pattern */
.aurora::after { display: none; }

/* marquee is driven by JS (reacts to scroll speed & direction) */
.marquee__track { animation: none !important; transform-origin: 50% 50%; }

@media (pointer: coarse) { .cur-ring, .cur-dot, .xh { display: none; } }
@media (max-width: 640px) { .orbit { width: 118%; } }
