/* ==========================================================================
   Bytelyne — motion layer
   Loaded after styles.css. Everything here animates transform/opacity only.
   ========================================================================== */

:root {
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
}

/* --------------------------------------------------------- reveal variants */

[data-anim] {
  opacity: 0;
  transition: opacity var(--anim-duration, 620ms) var(--ease-out-expo) var(--anim-delay, 0s),
    transform var(--anim-duration, 620ms) var(--anim-ease, var(--ease-spring)) var(--anim-delay, 0s);
}

[data-anim].is-inview {
  opacity: 1;
  transform: none;
}

[data-anim="rise"] {
  transform: translate3d(0, 34px, 0);
}
[data-anim="fade"] {
  transform: none;
}
[data-anim="scale"] {
  transform: scale(0.92);
}
[data-anim="left"] {
  transform: translate3d(-40px, 0, 0);
}
[data-anim="right"] {
  transform: translate3d(40px, 0, 0);
}
/* Hinges up from its bottom edge — the 3D layout reveal. */
[data-anim="hinge"] {
  transform: perspective(1200px) rotateX(-32deg) translate3d(0, 40px, 0);
  transform-origin: 50% 100%;
}
[data-anim="flip"] {
  transform: perspective(1200px) rotateY(-24deg) translate3d(30px, 0, 0);
  transform-origin: 0% 50%;
}

/* ------------------------------------------------------------ intro screen */

html.intro-active,
html.intro-active body {
  overflow: hidden;
}

.intro {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  pointer-events: none;
}

/* Two solid panels that split apart to reveal the page — the exit animation. */
.intro-panel {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50.5%;
  background: var(--bg-color);
  transition: transform 700ms var(--ease-out-expo);
}
.intro-panel-top {
  top: 0;
}
.intro-panel-bottom {
  bottom: 0;
}

.intro.is-leaving .intro-panel-top {
  transform: translate3d(0, -100%, 0);
}
.intro.is-leaving .intro-panel-bottom {
  transform: translate3d(0, 100%, 0);
}

.intro-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
  transition: opacity 320ms ease, transform 420ms var(--ease-out-expo);
}

.intro.is-leaving .intro-content {
  opacity: 0;
  transform: translate3d(0, -22px, 0);
}

.intro-logo {
  height: 62px;
  width: auto;
  opacity: 0;
  transform: scale(0.7) translate3d(0, 14px, 0);
}

.intro.is-running .intro-logo {
  animation: intro-pop 760ms var(--ease-out-expo) forwards;
}

@keyframes intro-pop {
  to {
    opacity: 1;
    transform: scale(1) translate3d(0, 0, 0);
  }
}

/* Per-letter 3D hinge, staggered — the classic variant cascade. */
.intro-letters {
  display: flex;
  gap: 0.04em;
  perspective: 700px;
  font-size: clamp(2rem, 7vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.intro-letters span {
  display: inline-block;
  opacity: 0;
  transform: rotateX(-90deg) translate3d(0, 0.35em, 0);
  transform-origin: 50% 0;
}

.intro.is-running .intro-letters span {
  animation: intro-letter 620ms var(--ease-out-expo) forwards;
  animation-delay: calc(180ms + var(--i) * 45ms);
}

@keyframes intro-letter {
  to {
    opacity: 1;
    transform: rotateX(0deg) translate3d(0, 0, 0);
  }
}

.intro-bar {
  width: 190px;
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  overflow: hidden;
}

.intro-bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--gradient-main);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.intro.is-running .intro-bar i {
  animation: intro-load 1500ms var(--ease-out-expo) forwards;
}

@keyframes intro-load {
  to {
    transform: scaleX(1);
  }
}

/* ------------------------------------------------------ buttons, rebuilt */

.btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transform: translate3d(var(--mag-x, 0), var(--mag-y, 0), 0);
  transition: transform 420ms var(--ease-spring), box-shadow 300ms ease,
    background-color 300ms ease, border-color 300ms ease, color 300ms ease;
}

/* Sheen that wipes across on hover. A transform on a pseudo-element, so it
   composites — no background-position animation. */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(255, 255, 255, 0.22) 50%,
    transparent 80%
  );
  transform: translate3d(-110%, 0, 0);
  transition: transform 700ms var(--ease-out-expo);
}

.btn:hover::before {
  transform: translate3d(110%, 0, 0);
}

.btn:active {
  transform: translate3d(var(--mag-x, 0), var(--mag-y, 0), 0) scale(0.96);
  transition-duration: 90ms;
}

.btn-primary:hover {
  transform: translate3d(var(--mag-x, 0), calc(var(--mag-y, 0px) - 2px), 0);
}

.btn-arrow .arrow {
  display: inline-block;
}

/* The submit button's skew wipe is replaced by the shared sheen. */
.btn-submit-fill::before {
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(16, 185, 129, 0.35) 50%,
    transparent 80%
  );
}

/* ------------------------------------------------------- nav pill (layoutId) */

.nav-links {
  position: relative;
}

.nav-pill {
  position: absolute;
  left: 0;
  top: 50%;
  width: 100px;
  height: 34px;
  margin-top: -17px;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0;
  pointer-events: none;
  transform-origin: 50% 50%;
  transition: transform 420ms var(--ease-spring), opacity 260ms ease;
  z-index: 0;
}

.nav-links a {
  position: relative;
  z-index: 1;
  padding: 0.35rem 0.65rem;
}

/* ------------------------------------------------------------- card depth */

.service-card,
.service-feature-card,
.project-card,
.value-card,
.founder-card {
  transition: transform 420ms var(--ease-spring), border-color 300ms ease;
}

/* A 2D translate composites; a 3D rotation would repaint the card's contents on
   every frame. See the note in motion.js. */
.service-card:hover,
.service-feature-card:hover,
.project-card:hover,
.value-card:hover,
.founder-card:hover {
  transform: translate3d(0, -6px, 0);
  transition-duration: 260ms;
}

/* --------------------------------------------------------- filter chips */

.filter-chip {
  position: relative;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  padding: 0.7rem 1.4rem;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: inherit;
  transition: transform 380ms var(--ease-spring), color 240ms ease,
    border-color 240ms ease, background-color 240ms ease;
}

.filter-chip:hover {
  color: var(--text-main);
  transform: translate3d(0, -2px, 0);
}

.filter-chip:active {
  transform: scale(0.95);
  transition-duration: 90ms;
}

.filter-chip.is-active {
  color: var(--primary-color);
  border-color: rgba(59, 130, 246, 0.55);
  background: rgba(59, 130, 246, 0.12);
}

/* ----------------------------------------------------------- cursor glow */

/* The original used filter: blur(20px) + mix-blend-mode: screen and a rAF loop
   that never stopped -- three separate per-frame costs. This is a plain radial
   gradient (soft without a blur pass), no blend mode, and the loop parks itself
   the moment the glow catches up with the pointer. */
.cursor-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 460px;
  height: 460px;
  margin: -230px 0 0 -230px;
  border-radius: 50%;
  background: radial-gradient(
    circle closest-side,
    rgba(59, 130, 246, 0.13),
    rgba(139, 92, 246, 0.08) 45%,
    transparent 72%
  );
  pointer-events: none;
  z-index: 900;
  opacity: 0;
  transition: opacity 420ms ease;
  will-change: transform;
}

.cursor-glow.is-on {
  opacity: 1;
}

/* ------------------------------------------------------------ scroll cue */

.scroll-cue {
  position: absolute;
  bottom: 6.5rem;
  left: 50%;
  width: 26px;
  height: 42px;
  margin-left: -13px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 20px;
  z-index: 20;
  pointer-events: none;
}

.scroll-cue::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 8px;
  width: 3px;
  height: 7px;
  margin-left: -1.5px;
  border-radius: 3px;
  background: var(--primary-color);
  animation: scroll-cue 1.8s var(--ease-out-expo) infinite;
}

@keyframes scroll-cue {
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 0;
  }
  35% {
    opacity: 1;
  }
  70% {
    transform: translate3d(0, 15px, 0);
    opacity: 0;
  }
  100% {
    transform: translate3d(0, 15px, 0);
    opacity: 0;
  }
}

/* ------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  [data-anim],
  [data-anim].is-inview {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .intro {
    display: none;
  }
  .btn::before,
  .scroll-cue::after {
    animation: none;
    transition: none;
  }
  .nav-pill {
    display: none;
  }
}

/* Phones skip the heavier 3D entrances: a hinge on a full-width card projects
   wider than its box and reads as jitter on a small screen. */
@media (max-width: 700px) {
  [data-anim="hinge"],
  [data-anim="flip"] {
    transform: translate3d(0, 28px, 0);
  }
  .scroll-cue {
    display: none;
  }
}


/* ------------------------------------------------- park off-screen loops */

/* Compositor animations keep ticking, and keep a layer alive, even when they
   are scrolled out of view. script.js sets .hero-out once the hero is gone. */
/* The slab carries the hover glow now that box-shadow no longer animates. */
.service-card:hover::after {
  opacity: 1;
}

body.hero-out .motion-shape,
body.hero-out .metric-card,
body.hero-out .bar,
body.hero-out .pulse-dot::after,
body.hero-out .scroll-cue::after {
  animation-play-state: paused;
}
