/* ==========================================================================
   Why LiquidAnts — immersive, scroll-staged WebGL story
   ========================================================================== */

html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

#gl {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 1;
}

/* ---------------- Loader ---------------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(20px, 3vw, 40px);
  overflow: hidden;
  background: #02140e;
  clip-path: circle(150% at 50% 100%);
  transition: clip-path 1.4s var(--ease-in-out);
}

.loader.is-leaving {
  clip-path: circle(0% at 50% 100%);
}

.loader__liquid {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(
    ellipse 130vw 140vh at 50% 132%,
    #d4fff0 14%,
    #9ff5d2 26%,
    #5fe0ad 37%,
    #1fbf85 48%,
    #0b8a5d 60%,
    #064a33 80%,
    #02140e 100%
  );
  animation: liquid 8s ease-in-out infinite alternate;
  transform-origin: 50% 100%;
}

@keyframes liquid {
  0% { transform: scale(1, 1); filter: hue-rotate(0deg); }
  100% { transform: scale(1.08, 1.14); filter: hue-rotate(-12deg); }
}

.loader__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.loader__logo {
  height: 28px;
}

.loader__quote {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  width: min(90vw, 900px);
  text-align: center;
  font-size: clamp(28px, 4.2vw, 64px);
  line-height: 1.05;
  color: rgba(255, 255, 255, 0.92);
  mix-blend-mode: overlay;
}

.loader__bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.loader__count {
  font-size: clamp(110px, 17vh, 220px);
  line-height: 0.8;
  color: var(--white);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.06em;
}

.loader__enter {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  animation: rise 0.9s var(--ease-out) both;
}

.btn__rocket {
  width: 18px;
  height: 18px;
  fill: currentColor;
  transform: rotate(45deg);
  transition: transform 0.5s var(--ease-out);
}
.btn__rocket circle { fill: var(--mint, #7cffcb); }
.btn__flame { fill: #ff8a3d; transform-origin: 12px 17.5px; animation: flame 0.18s ease-in-out infinite alternate; }
@keyframes flame { to { transform: scaleY(0.6); opacity: 0.7; } }
.btn--launch:hover .btn__rocket { transform: rotate(45deg) translateY(-3px); }
.btn--launch.is-silent .btn__flame { animation: none; opacity: 0.35; }

/* Small transparent mute switch next to the launch button. 44px keeps it easy to hit. */
.mute {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--white);
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s, transform 0.3s var(--ease-out);
}
.mute:hover { background: rgba(0, 0, 0, 0.35); border-color: rgba(255, 255, 255, 0.7); }
.mute:active { transform: scale(0.94); }
.mute:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; }
.mute svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mute svg path:first-child { fill: currentColor; stroke: none; }
.mute .mute__off { display: none; }
.mute[aria-pressed="true"] .mute__on { display: none; }
.mute[aria-pressed="true"] .mute__off { display: inline; }

/* ---------------- Loader climb ---------------- */
/* Sits just above the quote, like an illustration for "move mountains". */
.climb {
  position: absolute;
  left: 50%;
  bottom: calc(50% + clamp(62px, 6.5vw, 96px));
  width: min(92vw, 760px);
  height: auto;
  aspect-ratio: 1200 / 260;
  transform: translateX(-50%);
  overflow: visible;
  pointer-events: none;
  opacity: 0.8;
}
.climb__ridge {
  fill: none;
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 1.2;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: var(--len, 2000);
  stroke-dashoffset: var(--len, 2000);
  animation: ridge 2.6s var(--ease-out) 0.2s forwards;
}
@keyframes ridge { to { stroke-dashoffset: 0; } }
.climb__flag { opacity: 0; transition: opacity 0.8s; }
.climb__flag line { stroke: rgba(255, 255, 255, 0.8); stroke-width: 1.2; }
.climb__flag path { fill: #fff; transform-origin: 0 -21px; animation: wave 1.6s ease-in-out infinite alternate; }
.climb__flag.is-up { opacity: 1; }
@keyframes wave { to { transform: scaleX(0.75); } }
.climb__ant { fill: #fff; }
@media (prefers-reduced-motion: reduce) {
  .climb__ridge { animation: none; stroke-dashoffset: 0; }
}

.loader__hint {
  width: 100%;
  margin: 6px 0 0;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.6);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}

/* ---------------- Stages ---------------- */
.stages {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 clamp(20px, 7vw, 120px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.7s var(--ease-out), visibility 0.7s;
}

.stage.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.stage > * {
  max-width: 560px;
}

.stage--center {
  align-items: center;
  text-align: center;
}

.stage--center > * {
  max-width: 900px;
}

.stage[data-stage="0"],
.stage--outro {
  justify-content: flex-end;
  padding-bottom: 13vh;
}

.stage[data-stage="0"] .stage__title,
.stage--outro .stage__title {
  font-size: clamp(40px, 5.8vw, 100px);
}

.stage--right {
  align-items: flex-end;
  text-align: left;
}

.stage--right > * {
  width: min(520px, 100%);
}

.stage__title {
  margin: 18px 0 22px;
  font-size: clamp(46px, 7.4vw, 124px);
  color: var(--white);
}

.stage--left .stage__title,
.stage--right .stage__title {
  font-size: clamp(42px, 5.6vw, 92px);
}

.stage__title em {
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--mint);
}

.stage__lede {
  margin: 0;
  font-size: clamp(15px, 1.25vw, 18px);
  line-height: 1.6;
  color: rgba(231, 233, 234, 0.78);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.9s 0.25s var(--ease-out), transform 0.9s 0.25s var(--ease-out);
}

.is-active .stage__lede,
.is-active .stats,
.is-active .chips,
.is-active .live-chip,
.is-active .ai-card,
.is-active .stage__ctas,
.is-active .stage__kicker,
.stage.is-active .disclaimer {
  opacity: 1;
  transform: none;
}

.stage__kicker,
.stats,
.chips,
.live-chip,
.ai-card,
.stage__ctas,
.stage--outro .disclaimer {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.9s 0.4s var(--ease-out), transform 0.9s 0.4s var(--ease-out);
}

.stage__kicker {
  margin-top: 28px;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 34px 0 0;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.stats div {
  padding: 16px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
}

.stats dt {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.stats dd {
  margin: 8px 0 0;
  font-size: clamp(18px, 1.6vw, 24px);
  color: var(--white);
  letter-spacing: -0.03em;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 30px 0 0;
  padding: 0;
  list-style: none;
}

.chips li {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}

.chips li[data-cat="crypto"] { color: var(--mint); }
.chips li[data-cat="tradfi"] { color: var(--gold); }
.chips li[data-cat="hip3"] { color: var(--purple); }
.chips li[data-cat="spot"] { color: var(--blue); }

.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 30px;
  padding: 12px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  font-size: 12px;
}

.live-chip__px {
  font-size: 22px;
  color: var(--white);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  transition: color 0.4s;
}

.live-chip__px.up { color: var(--bull); }
.live-chip__px.down { color: var(--bear); }

.live-chip__src {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.book-labels {
  position: fixed;
  left: 50%;
  bottom: 14vh;
  transform: translateX(-50%);
  display: flex;
  gap: 38vw;
  font-size: 11px;
  letter-spacing: 0.2em;
  max-width: none !important;
  width: auto !important;
}

.ai-card {
  margin-top: 30px;
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid rgba(152, 94, 255, 0.35);
  background: linear-gradient(160deg, rgba(152, 94, 255, 0.16), rgba(0, 0, 0, 0.6));
  backdrop-filter: blur(12px);
}

.ai-card__q {
  margin: 0 0 10px;
  font-size: 12px;
  color: #c9b3ff;
}

.ai-card__a {
  margin: 0;
  min-height: 4.8em;
  font-size: 14px;
  line-height: 1.6;
  color: var(--paper);
}

.ai-card__a::after {
  content: "▍";
  color: var(--purple);
  animation: pulse 0.8s infinite;
}

.stage__ctas {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 10px 0 30px;
}

/* ---------------- HUD ---------------- */
.hud {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  transition: opacity 1s var(--ease-out);
}

.hud.is-hidden { opacity: 0; }

.hud > * { pointer-events: auto; }

.hud__counter {
  position: absolute;
  left: clamp(18px, 3vw, 40px);
  bottom: 26px;
  font-size: clamp(56px, 8vh, 96px);
  line-height: 0.8;
  letter-spacing: -0.06em;
  color: var(--white);
  font-variant-numeric: tabular-nums;
}

.hud__counter small {
  font-size: 0.28em;
  letter-spacing: 0;
  color: var(--muted);
  margin-left: 6px;
}

.hud__rail {
  position: absolute;
  right: clamp(14px, 2.4vw, 34px);
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hud__rail button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 6px 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: transparent;
  transition: color 0.3s;
}

.hud__rail button::after {
  content: "";
  width: 18px;
  height: 1px;
  background: rgba(255, 255, 255, 0.3);
  transition: width 0.5s var(--ease-out), background 0.3s;
}

.hud__rail:hover button { color: var(--muted); }
.hud__rail button:hover { color: var(--white); }

.hud__rail button.is-active { color: var(--white); }

.hud__rail button.is-active::after {
  width: 42px;
  background: var(--mint);
}

.hud__progress {
  position: absolute;
  left: 50%;
  bottom: 34px;
  width: min(220px, 40vw);
  height: 1px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.15);
}

.hud__progress span {
  position: absolute;
  inset: 0;
  transform-origin: left;
  transform: scaleX(0);
  background: var(--mint);
  box-shadow: 0 0 10px var(--mint);
}

.hud__scroll {
  position: absolute;
  left: 50%;
  bottom: 50px;
  transform: translateX(-50%);
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  transition: opacity 0.5s;
}

.hud__scroll span {
  display: inline-block;
  animation: bob 1.6s ease-in-out infinite;
}

@keyframes bob {
  50% { transform: translateY(4px); }
}

.hud__sound {
  position: absolute;
  right: clamp(18px, 3vw, 40px);
  bottom: 26px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 0;
}

.hud__sound:hover { color: var(--white); }

@media (max-width: 760px) {
  .stage--left,
  .stage--right {
    align-items: flex-start;
    justify-content: flex-end;
    padding-bottom: 20vh;
  }
  .hud__rail { display: none; }
  .stats { grid-template-columns: 1fr 1fr 1fr; }
  .book-labels { gap: 50vw; bottom: 8vh; }
}
