/* animations.css — gallery of futuristic on-brand animations for
   /animations. Black + white only, CSS-only, GPU-accelerated. Each
   animation is self-contained inside a .hero-anim panel. Respects
   prefers-reduced-motion at the bottom. */

/* ────────────────────────────────────────────────────────────────────
   Gallery layout
   ──────────────────────────────────────────────────────────────────── */

.anim-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  padding: 3rem 0;
}

.anim-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.anim-card .hero-anim {
  width: 100%;
  max-width: none;
}
.anim-card h3 {
  margin: 0;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  color: var(--ink, #0a0a0a);
}
.anim-card p {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--ink-soft, rgba(10, 10, 10, 0.6));
}

.animations-hero {
  padding: clamp(4rem, 11vw, 7rem) 0 2rem;
  border-bottom: 1px solid rgba(10, 10, 10, 0.08);
}
.animations-hero h1 {
  margin: 0 0 1rem;
  font-family: var(--font-sans, system-ui, sans-serif);
  font-weight: 300;
  font-size: clamp(2.4rem, 7vw, 4.5rem);
  letter-spacing: -0.04em;
  line-height: 1;
}
.animations-hero p {
  max-width: 38rem;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink-soft, rgba(10, 10, 10, 0.6));
}

/* ────────────────────────────────────────────────────────────────────
   5 — LISSAJOUS LOOP — animated SVG curve traced + retraced
   ──────────────────────────────────────────────────────────────────── */

.hero-anim-lissajous svg {
  position: absolute;
  inset: 12%;
  width: 76%;
  height: 76%;
  z-index: 2;
  stroke: #0a0a0a;
  fill: none;
  stroke-width: 1.5;
}
.hero-anim-lissajous svg path {
  stroke-dasharray: 2200;
  stroke-dashoffset: 2200;
  animation: lissajous-draw 6s ease-in-out infinite;
}
@keyframes lissajous-draw {
  0%   { stroke-dashoffset: 2200; }
  50%  { stroke-dashoffset: 0;    }
  100% { stroke-dashoffset: -2200;}
}

/* ────────────────────────────────────────────────────────────────────
   6 — MATRIX RAIN — 8 columns of falling dot streams
   ──────────────────────────────────────────────────────────────────── */

.hero-anim-matrix .anim-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  overflow: hidden;
}
.hero-anim-matrix .col {
  position: relative;
  overflow: hidden;
}
.hero-anim-matrix .col::before {
  content: '';
  position: absolute;
  top: -100%;
  left: 50%;
  width: 1px;
  height: 60%;
  background: linear-gradient(180deg, transparent, #0a0a0a 60%, #0a0a0a 100%);
  transform: translateX(-50%);
  animation: matrix-fall 3.4s linear infinite;
}
.hero-anim-matrix .col:nth-child(1)::before { animation-delay: 0.0s; }
.hero-anim-matrix .col:nth-child(2)::before { animation-delay: 0.5s; }
.hero-anim-matrix .col:nth-child(3)::before { animation-delay: 1.1s; }
.hero-anim-matrix .col:nth-child(4)::before { animation-delay: 0.3s; }
.hero-anim-matrix .col:nth-child(5)::before { animation-delay: 1.8s; }
.hero-anim-matrix .col:nth-child(6)::before { animation-delay: 0.9s; }
.hero-anim-matrix .col:nth-child(7)::before { animation-delay: 2.2s; }
.hero-anim-matrix .col:nth-child(8)::before { animation-delay: 1.4s; }
@keyframes matrix-fall {
  0%   { top: -65%; }
  100% { top: 105%; }
}

/* ────────────────────────────────────────────────────────────────────
   7 — SPECTROGRAM BARS — 12 vertical bars oscillating at different
   frequencies
   ──────────────────────────────────────────────────────────────────── */

.hero-anim-spectro .anim-stage {
  position: absolute;
  inset: 18%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3%;
}
.hero-anim-spectro .bar {
  flex: 1;
  background: #0a0a0a;
  border-radius: 1px;
  transform-origin: center;
  animation: spectro-pulse 1.6s ease-in-out infinite alternate;
}
.hero-anim-spectro .bar:nth-child(1)  { animation-duration: 0.9s; }
.hero-anim-spectro .bar:nth-child(2)  { animation-duration: 1.3s; }
.hero-anim-spectro .bar:nth-child(3)  { animation-duration: 0.7s; }
.hero-anim-spectro .bar:nth-child(4)  { animation-duration: 1.8s; }
.hero-anim-spectro .bar:nth-child(5)  { animation-duration: 1.1s; }
.hero-anim-spectro .bar:nth-child(6)  { animation-duration: 0.6s; }
.hero-anim-spectro .bar:nth-child(7)  { animation-duration: 1.5s; }
.hero-anim-spectro .bar:nth-child(8)  { animation-duration: 1.0s; }
.hero-anim-spectro .bar:nth-child(9)  { animation-duration: 1.4s; }
.hero-anim-spectro .bar:nth-child(10) { animation-duration: 0.8s; }
.hero-anim-spectro .bar:nth-child(11) { animation-duration: 1.2s; }
.hero-anim-spectro .bar:nth-child(12) { animation-duration: 0.95s; }
@keyframes spectro-pulse {
  from { height: 12%; }
  to   { height: 92%; }
}

/* ────────────────────────────────────────────────────────────────────
   8 — WIREFRAME SPHERE — CSS 3D rotating wireframe
   ──────────────────────────────────────────────────────────────────── */

.hero-anim-sphere .anim-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 800px;
}
.hero-anim-sphere .sphere {
  position: relative;
  width: 55%;
  aspect-ratio: 1;
  transform-style: preserve-3d;
  animation: sphere-rotate 14s linear infinite;
}
.hero-anim-sphere .sphere span {
  position: absolute;
  inset: 0;
  border: 1px solid #0a0a0a;
  border-radius: 50%;
}
/* 8 rings rotated around different axes */
.hero-anim-sphere .sphere span:nth-child(1) { transform: rotateY(0deg);   }
.hero-anim-sphere .sphere span:nth-child(2) { transform: rotateY(22.5deg);}
.hero-anim-sphere .sphere span:nth-child(3) { transform: rotateY(45deg);  }
.hero-anim-sphere .sphere span:nth-child(4) { transform: rotateY(67.5deg);}
.hero-anim-sphere .sphere span:nth-child(5) { transform: rotateY(90deg) rotateX(0deg);  }
.hero-anim-sphere .sphere span:nth-child(6) { transform: rotateY(90deg) rotateX(22.5deg);}
.hero-anim-sphere .sphere span:nth-child(7) { transform: rotateY(90deg) rotateX(45deg); }
.hero-anim-sphere .sphere span:nth-child(8) { transform: rotateY(90deg) rotateX(67.5deg);}
@keyframes sphere-rotate {
  from { transform: rotateY(0deg)   rotateX(15deg); }
  to   { transform: rotateY(360deg) rotateX(15deg); }
}

/* ────────────────────────────────────────────────────────────────────
   9 — GLITCH DISPLACEMENT — frame mark with rgb-shift-style displacement
   ──────────────────────────────────────────────────────────────────── */

.hero-anim-glitch .anim-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-anim-glitch .glitch {
  position: relative;
  width: 42%;
  aspect-ratio: 1;
}
.hero-anim-glitch .glitch::before,
.hero-anim-glitch .glitch::after,
.hero-anim-glitch .glitch span {
  content: '';
  position: absolute;
  inset: 0;
  border: 2.5px solid #0a0a0a;
}
.hero-anim-glitch .glitch::before {
  animation: glitch-shift-a 2.4s steps(1, end) infinite;
}
.hero-anim-glitch .glitch::after {
  animation: glitch-shift-b 2.4s steps(1, end) infinite;
  opacity: 0.4;
}
.hero-anim-glitch .glitch span::after {
  content: '';
  position: absolute;
  inset: 28%;
  border: 2.5px solid #0a0a0a;
}
@keyframes glitch-shift-a {
  0%, 100% { transform: translate(0, 0);   }
  10%      { transform: translate(-3px, 1px); }
  20%      { transform: translate(2px, -1px);}
  30%      { transform: translate(0, 0);  }
  70%      { transform: translate(2px, 2px); }
  74%      { transform: translate(0, 0); }
}
@keyframes glitch-shift-b {
  0%, 100% { transform: translate(0, 0); }
  15%      { transform: translate(3px, -1px); }
  18%      { transform: translate(0, 0); }
  65%      { transform: translate(-2px, 2px); }
  70%      { transform: translate(0, 0); }
}

/* ────────────────────────────────────────────────────────────────────
   10 — SIGIL DRAW — SVG nested-frame mark traced by stroke-dashoffset
   ──────────────────────────────────────────────────────────────────── */

.hero-anim-sigil svg {
  position: absolute;
  inset: 18%;
  width: 64%;
  height: 64%;
  z-index: 2;
  stroke: #0a0a0a;
  fill: none;
  stroke-width: 2;
  stroke-linecap: square;
}
.hero-anim-sigil svg rect {
  stroke-dasharray: 480;
  stroke-dashoffset: 480;
  animation: sigil-draw 4s ease-in-out infinite;
}
.hero-anim-sigil svg rect:nth-child(1) { animation-delay: 0s;   }
.hero-anim-sigil svg rect:nth-child(2) { animation-delay: 0.6s; }
.hero-anim-sigil svg rect:nth-child(3) { animation-delay: 1.2s; }
@keyframes sigil-draw {
  0%, 5%   { stroke-dashoffset: 480; opacity: 0; }
  10%      { opacity: 1; }
  50%      { stroke-dashoffset: 0; opacity: 1; }
  85%      { opacity: 1; }
  100%     { stroke-dashoffset: -480; opacity: 0; }
}

/* ────────────────────────────────────────────────────────────────────
   11 — PENDULUM — single pendulum swinging on a hairline
   ──────────────────────────────────────────────────────────────────── */

.hero-anim-pendulum .anim-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.hero-anim-pendulum .arm {
  width: 1px;
  height: 65%;
  margin-top: 8%;
  background: #0a0a0a;
  position: relative;
  transform-origin: top center;
  animation: pendulum-swing 2.4s ease-in-out infinite;
}
.hero-anim-pendulum .arm::before {
  /* pivot dot */
  content: '';
  position: absolute;
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  background: #0a0a0a;
  border-radius: 50%;
}
.hero-anim-pendulum .arm::after {
  /* bob (frame mark) */
  content: '';
  position: absolute;
  bottom: -6%;
  left: 50%;
  width: 18%;
  aspect-ratio: 1;
  transform: translateX(-50%);
  border: 1.5px solid #0a0a0a;
  background: #ffffff;
}
@keyframes pendulum-swing {
  0%, 100% { transform: rotate(28deg); }
  50%      { transform: rotate(-28deg); }
}

/* ────────────────────────────────────────────────────────────────────
   12 — FREQUENCY WAVE — sine wave drawn by SVG with sliding stroke
   ──────────────────────────────────────────────────────────────────── */

.hero-anim-wave svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  stroke: #0a0a0a;
  fill: none;
  stroke-width: 1.5;
}
.hero-anim-wave svg path {
  stroke-dasharray: 800 200;
  animation: wave-slide 3.5s linear infinite;
}
@keyframes wave-slide {
  to { stroke-dashoffset: -1000; }
}

/* ────────────────────────────────────────────────────────────────────
   13 — LIGHT TUNNEL — perspective lines converging to a point
   ──────────────────────────────────────────────────────────────────── */

.hero-anim-tunnel .anim-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-anim-tunnel .frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8%;
  aspect-ratio: 1;
  border: 1px solid #0a0a0a;
  transform: translate(-50%, -50%) scale(1);
  opacity: 0;
  animation: tunnel-zoom 4s linear infinite;
}
.hero-anim-tunnel .frame:nth-child(1) { animation-delay: 0.0s; }
.hero-anim-tunnel .frame:nth-child(2) { animation-delay: 0.4s; }
.hero-anim-tunnel .frame:nth-child(3) { animation-delay: 0.8s; }
.hero-anim-tunnel .frame:nth-child(4) { animation-delay: 1.2s; }
.hero-anim-tunnel .frame:nth-child(5) { animation-delay: 1.6s; }
.hero-anim-tunnel .frame:nth-child(6) { animation-delay: 2.0s; }
.hero-anim-tunnel .frame:nth-child(7) { animation-delay: 2.4s; }
.hero-anim-tunnel .frame:nth-child(8) { animation-delay: 2.8s; }
.hero-anim-tunnel .frame:nth-child(9) { animation-delay: 3.2s; }
.hero-anim-tunnel .frame:nth-child(10){ animation-delay: 3.6s; }
@keyframes tunnel-zoom {
  0%   { opacity: 0;   transform: translate(-50%, -50%) scale(0.4)  rotate(0deg); }
  20%  { opacity: 0.9; }
  100% { opacity: 0;   transform: translate(-50%, -50%) scale(8)    rotate(45deg); }
}

/* ────────────────────────────────────────────────────────────────────
   14 — BAUHAUS — three primitive shapes shuffling into the brand mark
   ──────────────────────────────────────────────────────────────────── */

.hero-anim-bauhaus .anim-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5%;
}
.hero-anim-bauhaus .shape {
  width: 22%;
  aspect-ratio: 1;
  animation: bauhaus-cycle 5.4s ease-in-out infinite;
}
.hero-anim-bauhaus .shape.circle   { border-radius: 50%; background: #0a0a0a; }
.hero-anim-bauhaus .shape.square   { background: #0a0a0a; }
.hero-anim-bauhaus .shape.triangle {
  background: transparent;
  width: 0;
  height: 0;
  border-left: calc(22% / 2 * 4.55) solid transparent;
  border-right: calc(22% / 2 * 4.55) solid transparent;
  border-bottom: calc(22% * 4.55) solid #0a0a0a;
  aspect-ratio: auto;
  /* keep within stage bounds via scale (the calc above is approximate
     because we don't know the parent width here; the visual still
     reads correctly because the stage is square and 22% × 4.55 ≈ 1) */
  transform: scale(0.22);
  transform-origin: center;
}
.hero-anim-bauhaus .shape.circle   { animation-delay: 0.0s; }
.hero-anim-bauhaus .shape.square   { animation-delay: 0.4s; }
.hero-anim-bauhaus .shape.triangle { animation-delay: 0.8s; }
@keyframes bauhaus-cycle {
  0%, 100% { transform: translate(0, 0)        scale(1);    opacity: 1; }
  25%      { transform: translate(0, -20%)     scale(0.85); opacity: 0.8; }
  50%      { transform: translate(0, 0)        scale(1.15); opacity: 1; }
  75%      { transform: translate(0, 20%)      scale(0.85); opacity: 0.8; }
}

/* ────────────────────────────────────────────────────────────────────
   prefers-reduced-motion — kill animations across the gallery.
   ──────────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .hero-anim-lissajous svg path,
  .hero-anim-matrix .col::before,
  .hero-anim-spectro .bar,
  .hero-anim-sphere .sphere,
  .hero-anim-glitch .glitch::before,
  .hero-anim-glitch .glitch::after,
  .hero-anim-sigil svg rect,
  .hero-anim-pendulum .arm,
  .hero-anim-wave svg path,
  .hero-anim-tunnel .frame,
  .hero-anim-bauhaus .shape {
    animation: none !important;
    transform: none !important;
  }
}
