/* ==========================================================================
   nullen.cc — motion
   Every animation in the system lives here: keyframes, entrance sequences and
   micro-interactions. Loaded after style.css so it can override it.

   Everything in this file respects prefers-reduced-motion (see the bottom).
   ========================================================================== */

/* ---------- Keyframes ---------- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes line-in {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes caret-blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

@keyframes sweep {
  0% {
    transform: translateX(-100%);
  }
  60%,
  100% {
    transform: translateX(100%);
  }
}

@keyframes shine {
  from {
    transform: translateX(-160%) skewX(-20deg);
  }
  to {
    transform: translateX(260%) skewX(-20deg);
  }
}

@keyframes drift {
  0%,
  100% {
    transform: translate(-50%, 0) scale(1);
  }
  50% {
    transform: translate(-47%, 30px) scale(1.12);
  }
}

@keyframes marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@keyframes grow-x {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes pulse-ring {
  0%,
  100% {
    box-shadow: 0 0 0 0 var(--accent-soft);
  }
  50% {
    box-shadow: 0 0 0 7px transparent;
  }
}

@keyframes float-y {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes nudge {
  0%,
  100% {
    transform: translateY(-50%);
  }
  50% {
    transform: translateY(calc(-50% - 4px));
  }
}

/* ---------- Page entrance ---------- */
.js .hero__copy > *,
.js .hero__panel-wrap {
  animation: rise 0.85s var(--ease-out) both;
}

.js .hero__copy > *:nth-child(1) {
  animation-delay: 0.04s;
}

.js .hero__copy > *:nth-child(2) {
  animation-delay: 0.12s;
}

.js .hero__copy > *:nth-child(3) {
  animation-delay: 0.2s;
}

.js .hero__copy > *:nth-child(4) {
  animation-delay: 0.28s;
}

.js .hero__copy > *:nth-child(5) {
  animation-delay: 0.36s;
}

.js .hero__panel-wrap {
  animation-delay: 0.2s;
}

/* the panel drifts gently once it has arrived */
.js .hero__panel {
  animation: float-y 7s ease-in-out 1.2s infinite;
}

/* ---------- Button shine ---------- */
.btn--accent {
  position: relative;
  overflow: hidden;
}

.btn--accent::after {
  content: "";
  position: absolute;
  top: -60%;
  bottom: -60%;
  left: 0;
  width: 55%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(-160%) skewX(-20deg);
  pointer-events: none;
}

.btn--accent:hover::after {
  animation: shine 0.8s var(--ease) forwards;
}

/* ---------- Logo dot ---------- */
.logo__dot {
  animation: pulse-ring 2.8s ease-in-out infinite;
}

/* ---------- Eyebrow dot ---------- */
.hero__eyebrow::before {
  animation: pulse-ring 2.6s ease-in-out infinite;
}

/* ---------- Hero backdrop ---------- */
.hero__bg::after {
  animation: drift 14s ease-in-out infinite;
}

/* ---------- Hero panel: the code types itself in ---------- */
.panel__code .line {
  display: block;
  opacity: 0;
  animation: line-in 0.42s var(--ease-out) forwards;
}

.panel__code .line:nth-child(1) {
  animation-delay: 0.5s;
}

.panel__code .line:nth-child(2) {
  animation-delay: 0.68s;
}

.panel__code .line:nth-child(3) {
  animation-delay: 0.86s;
}

.panel__code .line:nth-child(4) {
  animation-delay: 1.04s;
}

.panel__code .line:nth-child(5) {
  animation-delay: 1.22s;
}

/* the cursor keeps blinking after the last line lands */
.panel__code .line:last-child::after {
  content: "\258C";
  margin-left: 3px;
  color: var(--accent);
  animation: caret-blink 1.05s steps(1) infinite;
}

/* the emptiness bars grow in */
.panel__bar i {
  transform-origin: left;
  animation: grow-x 0.9s var(--ease-out) 1.1s both;
}

.panel__bars li:nth-child(2) .panel__bar i {
  animation-delay: 1.2s;
}

.panel__bars li:nth-child(3) .panel__bar i {
  animation-delay: 1.32s;
}

/* ---------- Marquee ---------- */
.marquee {
  overflow: hidden;
  padding: var(--space-4) 0;
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.marquee__track {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  width: max-content;
  animation: marquee 42s linear infinite;
}

.marquee:hover .marquee__track {
  animation-play-state: paused;
}

.marquee__track span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  white-space: nowrap;
}

.marquee__track span::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.7;
}

.marquee__track span:nth-child(3n) {
  color: var(--muted);
}

/* ---------- Cards ---------- */
/* a light sweeps across the top edge of the featured tool */
.tool-feature::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  transform: translateX(-100%);
  animation: sweep 4.5s var(--ease) 1.4s infinite;
  pointer-events: none;
  z-index: 2;
}

/* the icon tiles lift a little on hover */
.card__icon,
.tool-mini__icon {
  transition: transform var(--duration) var(--ease-out),
    background-color var(--duration) var(--ease);
}

.card:hover .card__icon,
.tool-mini:hover .tool-mini__icon {
  transform: translateY(-3px) scale(1.05);
  background: var(--accent);
  color: var(--accent-contrast);
}

/* ---------- Columns on the tool page ---------- */
.columns__fill {
  transform-origin: left;
  animation: grow-x 0.5s var(--ease-out) both;
}

.columns__row:nth-child(2) .columns__fill {
  animation-delay: 0.06s;
}

.columns__row:nth-child(3) .columns__fill {
  animation-delay: 0.12s;
}

.columns__row:nth-child(4) .columns__fill {
  animation-delay: 0.18s;
}

.columns__row:nth-child(5) .columns__fill {
  animation-delay: 0.24s;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .js .hero__copy > *,
  .js .hero__panel,
  .js .hero__panel-wrap,
  .panel__code .line,
  .panel__bar i,
  .columns__fill,
  .tool-feature::after,
  .btn--accent::after {
    animation: none !important;
  }

  .panel__code .line {
    opacity: 1;
    transform: none;
  }

  .panel__bar i,
  .columns__fill {
    transform: none;
  }

  .marquee__track {
    animation: none;
    width: auto;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-6);
  }
}
