/* Magic UI-inspired enhancements adapted for Novalgo's static frontend. */
@property --magic-beam-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

.magic-scroll-progress {
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  pointer-events: none;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, #ff92c0, #ff3d82 58%, #9d0b49);
  box-shadow: 0 0 14px rgba(255, 61, 130, .42);
}

.magic-particles {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: .48;
  mix-blend-mode: screen;
}

.globe[data-magic-globe]::before {
  display: none !important;
}

.globe[data-magic-globe] {
  background:
    radial-gradient(circle at 50% 92%, rgba(255, 114, 174, .13), transparent 42%),
    linear-gradient(145deg, #fff7fb, #ffeaf3);
}

.magic-globe-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.magic-globe-canvas {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: -52%;
  width: min(590px, 112%);
  aspect-ratio: 1;
  transform: translateX(-50%);
  opacity: 0;
  cursor: grab;
  contain: layout paint size;
  touch-action: none;
  transition: opacity .55s ease, filter .35s ease;
  filter: drop-shadow(0 28px 38px rgba(187, 28, 93, .13));
}

.globe[data-magic-globe]:hover .magic-globe-canvas {
  filter: drop-shadow(0 34px 48px rgba(187, 28, 93, .2));
}

.globe[data-magic-globe] .tag {
  z-index: 4;
  border: 1px solid rgba(255, 255, 255, .76);
  box-shadow: 0 12px 30px rgba(136, 16, 66, .08);
  backdrop-filter: blur(12px);
}

.magic-border {
  isolation: isolate;
  position: relative;
}

.magic-border::after {
  content: "";
  position: absolute;
  z-index: 8;
  inset: 0;
  padding: 1.5px;
  border-radius: inherit;
  pointer-events: none;
  background: conic-gradient(
    from var(--magic-beam-angle),
    transparent 0 67%,
    rgba(255, 128, 186, 0) 72%,
    rgba(255, 105, 171, .9) 79%,
    rgba(255, 255, 255, .98) 83%,
    rgba(255, 105, 171, .8) 87%,
    transparent 94%
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: magic-border-beam 7s linear infinite;
}

.magic-border-slow::after {
  animation-duration: 11s;
}

@keyframes magic-border-beam {
  to { --magic-beam-angle: 360deg; }
}

.magic-card {
  --magic-x: 50%;
  --magic-y: 50%;
  isolation: isolate;
  position: relative;
}

.magic-card::after {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(
      360px circle at var(--magic-x) var(--magic-y),
      rgba(255, 99, 163, .16),
      rgba(255, 180, 213, .055) 38%,
      transparent 68%
    );
  transition: opacity .35s ease;
}

.magic-card:hover::after,
.magic-card:focus-within::after {
  opacity: 1;
}

.magic-shimmer {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.magic-shimmer::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: -80%;
  bottom: -80%;
  left: -60%;
  width: 42%;
  pointer-events: none;
  transform: rotate(18deg);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, .62),
    transparent
  );
  animation: magic-shimmer 4.8s ease-in-out infinite;
  animation-delay: var(--magic-shimmer-delay, 0s);
}

.magic-shimmer.outline::before,
.magic-shimmer.light::before {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 61, 130, .2),
    transparent
  );
}

@keyframes magic-shimmer {
  0%, 55% { transform: translateX(-240%) rotate(18deg); }
  82%, 100% { transform: translateX(520%) rotate(18deg); }
}

.magic-blur-fade {
  opacity: 0;
  filter: blur(9px);
  transform: translateY(14px);
  transition:
    opacity .75s cubic-bezier(.16, 1, .3, 1),
    filter .75s cubic-bezier(.16, 1, .3, 1),
    transform .75s cubic-bezier(.16, 1, .3, 1);
}

.magic-blur-fade.magic-visible {
  opacity: 1;
  filter: blur(0);
  transform: none;
}

.magic-gradient-text {
  background-size: 220% auto;
  animation: magic-gradient-drift 8s ease-in-out infinite alternate;
}

@keyframes magic-gradient-drift {
  from { background-position: 0% 50%; }
  to { background-position: 100% 50%; }
}

.magic-dot-grid {
  isolation: isolate;
  position: relative;
  overflow: hidden;
}

.magic-dot-grid::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  opacity: .33;
  background-image: radial-gradient(circle, rgba(224, 20, 106, .21) 1px, transparent 1.4px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse 62% 48% at 50% 38%, #000 0 32%, transparent 76%);
  -webkit-mask-image: radial-gradient(ellipse 62% 48% at 50% 38%, #000 0 32%, transparent 76%);
}

.magic-dot-grid > .shell {
  position: relative;
  z-index: 1;
}

.magic-number {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  will-change: contents;
}

/* Live ecosystem visual: CSS background + selectable, responsive HTML content. */
.ecosystem-live {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 18px;
  width: min(91%, 620px);
  color: #100b0d;
}

.ecosystem-badge {
  position: relative;
  padding: 13px 32px;
  border: 1px solid rgba(255, 255, 255, .92);
  border-radius: 15px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 14px 34px rgba(114, 9, 51, .1);
  font-size: clamp(13px, 1.5vw, 17px);
  font-weight: 600;
  letter-spacing: .08em;
  line-height: 1;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.ecosystem-badge::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -9px;
  width: 18px;
  height: 18px;
  background: inherit;
  border-right: 1px solid rgba(255, 255, 255, .92);
  border-bottom: 1px solid rgba(255, 255, 255, .92);
  transform: translateX(-50%) rotate(45deg);
}

.ecosystem-strip {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 22px;
  background: rgba(255, 244, 249, .32);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .7),
    0 22px 50px rgba(112, 8, 50, .13);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.ecosystem-logo,
.ecosystem-token {
  display: grid;
  place-items: center;
  min-width: 0;
  height: 72px;
  border: 1px solid rgba(255, 255, 255, .76);
  border-radius: 16px;
  background: rgba(255, 255, 255, .52);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72);
  transition:
    transform .4s cubic-bezier(.16, 1, .3, 1),
    background .4s ease,
    box-shadow .4s ease;
}

.ecosystem-logo {
  flex: 0 0 72px;
  color: #e33577;
  font-size: 32px;
  font-weight: 600;
}

.ecosystem-plus {
  display: grid;
  flex: 0 0 25px;
  place-items: center;
  color: rgba(255, 255, 255, .95);
  font-size: 27px;
  font-weight: 300;
}

.ecosystem-token {
  flex: 1 1 0;
  align-content: center;
  gap: 5px;
  padding: 8px 5px;
  text-align: center;
}

.ecosystem-token strong {
  color: #c8165d;
  font-size: clamp(9px, .92vw, 12px);
  letter-spacing: .035em;
}

.ecosystem-token span {
  color: rgba(70, 29, 45, .62);
  font-size: clamp(8px, .75vw, 10px);
}

.ecosystem-strip:hover .ecosystem-token,
.ecosystem-strip:hover .ecosystem-logo {
  background: rgba(255, 255, 255, .72);
}

.ecosystem-strip:hover .ecosystem-token:hover,
.ecosystem-strip:hover .ecosystem-logo:hover {
  z-index: 1;
  transform: translateY(-4px);
  box-shadow: 0 14px 28px rgba(112, 8, 50, .13);
}

@media (max-width: 600px) {
  .ecosystem-live {
    width: min(92%, 420px);
    gap: 14px;
  }

  .ecosystem-badge {
    padding: 12px 25px;
  }

  .ecosystem-strip {
    gap: 6px;
    padding: 10px;
    border-radius: 18px;
  }

  .ecosystem-logo,
  .ecosystem-token {
    height: 59px;
    border-radius: 13px;
  }

  .ecosystem-logo {
    flex-basis: 55px;
    font-size: 25px;
  }

  .ecosystem-plus {
    flex-basis: 15px;
    font-size: 20px;
  }

  .ecosystem-token span {
    display: none;
  }
}

.magic-ripple-source {
  isolation: isolate;
  position: relative;
}

.magic-ripple-source::before,
.magic-ripple-source::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -18px;
  border: 1px solid rgba(255, 61, 130, .27);
  border-radius: inherit;
  pointer-events: none;
  animation: magic-ripple 4.4s cubic-bezier(.16, 1, .3, 1) infinite;
}

.magic-ripple-source::after {
  animation-delay: 2.2s;
}

@keyframes magic-ripple {
  0% {
    opacity: 0;
    transform: scale(.82);
  }
  18% {
    opacity: .75;
  }
  78%, 100% {
    opacity: 0;
    transform: scale(1.55);
  }
}

.sim-track-card.magic-border::after {
  padding: 1px;
  animation-duration: 12s;
}

.sim-output.magic-card::after {
  background:
    radial-gradient(
      520px circle at var(--magic-x) var(--magic-y),
      rgba(255, 99, 163, .11),
      rgba(255, 180, 213, .035) 42%,
      transparent 72%
    );
}

@media (prefers-reduced-motion: reduce) {
  .magic-border::after,
  .magic-shimmer::before,
  .magic-gradient-text,
  .magic-ripple-source::before,
  .magic-ripple-source::after {
    animation: none;
  }

  .magic-particles {
    display: none;
  }

  .magic-blur-fade {
    opacity: 1;
    filter: none;
    transform: none;
  }
}
