/* ==========================================================================
   PIVX earn page — animated level preview.
   Three stations on a rail, a light that keeps running, and a state that
   follows the scroll position (pivx-level-preview.js adds the classes).
   ========================================================================== */

.pivx-level-preview {
  position: relative;
  margin: 0;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--pivx-earn-line);
  background:
    radial-gradient(circle at 20% 0, rgba(190, 147, 253, 0.09), transparent 22rem),
    rgba(4, 6, 12, 0.42);
}

.pivx-level-preview__head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: baseline;
  justify-content: space-between;
}

.pivx-level-preview__eyebrow {
  color: var(--pivx-earn-purple);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.pivx-level-preview__status {
  color: var(--pivx-earn-copy);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.pivx-level-preview__status b {
  color: #fff;
}

/* ---------- the track ---------------------------------------------------- */

.pivx-level-preview__track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.pivx-level-preview__step {
  --step-accent: var(--pivx-earn-purple);
  position: relative;
  z-index: 2;
  min-width: 0;
}

.pivx-level-preview__step:nth-child(2) { --step-accent: var(--pivx-earn-green); }
.pivx-level-preview__step:nth-child(3) { --step-accent: var(--pivx-earn-gold); }

/* rail sits behind the dots, from the first centre to the last centre */
.pivx-level-preview__rail {
  position: absolute;
  top: 23px;
  right: calc(100% / 6);
  left: calc(100% / 6);
  z-index: 1;
  height: 2px;
  border-radius: 2px;
  background: rgba(190, 147, 253, 0.16);
  pointer-events: none;
}

.pivx-level-preview__fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 8%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--pivx-earn-purple), var(--pivx-earn-green), var(--pivx-earn-gold));
  box-shadow: 0 0 12px rgba(190, 147, 253, 0.45);
  transition: width 0.65s cubic-bezier(0.22, 0.68, 0.32, 1);
}

/* the light that keeps running down the rail */
.pivx-level-preview__spark {
  position: absolute;
  top: 50%;
  left: 0;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px #fff, 0 0 20px var(--pivx-earn-purple), 0 0 30px rgba(85, 245, 172, 0.6);
  opacity: 0;
  animation: plp-run 7s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

@keyframes plp-run {
  0% { left: 0; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}

/* ---------- stations ----------------------------------------------------- */

.pivx-level-preview__step > a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 16px;
  color: inherit;
  text-decoration: none;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.pivx-level-preview__step > a:hover,
.pivx-level-preview__step > a:focus-visible {
  background: rgba(255, 255, 255, 0.04);
  border-color: color-mix(in srgb, var(--step-accent) 34%, transparent);
  outline: none;
}

.pivx-level-preview__step.is-active > a {
  background: rgba(255, 255, 255, 0.05);
  border-color: color-mix(in srgb, var(--step-accent) 52%, transparent);
  transform: translateY(-2px);
}

.pivx-level-preview__dot {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border: 1px solid color-mix(in srgb, var(--step-accent) 45%, transparent);
  border-radius: 50%;
  background: rgba(7, 9, 16, 0.92);
  color: color-mix(in srgb, var(--step-accent) 70%, #fff);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-weight: 700;
  transition: box-shadow 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}

/* dashed orbit that turns slowly */
.pivx-level-preview__dot i {
  position: absolute;
  inset: -6px;
  border: 1px dashed color-mix(in srgb, var(--step-accent) 32%, transparent);
  border-radius: 50%;
  opacity: 0.55;
  animation: plp-orbit 16s linear infinite;
}

@keyframes plp-orbit {
  to { transform: rotate(360deg); }
}

.pivx-level-preview__step.is-done .pivx-level-preview__dot {
  background: color-mix(in srgb, var(--step-accent) 16%, rgba(7, 9, 16, 0.92));
}

.pivx-level-preview__step.is-active .pivx-level-preview__dot {
  border-color: var(--step-accent);
  background: color-mix(in srgb, var(--step-accent) 22%, rgba(7, 9, 16, 0.92));
  box-shadow: 0 0 20px color-mix(in srgb, var(--step-accent) 60%, transparent);
}

.pivx-level-preview__step.is-active .pivx-level-preview__dot i {
  opacity: 1;
  animation-duration: 6s;
}

.pivx-level-preview__copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.pivx-level-preview__copy strong {
  overflow: hidden;
  color: #eef2fb;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
}

.pivx-level-preview__step.is-active .pivx-level-preview__copy strong {
  color: #fff;
}

.pivx-level-preview__copy small {
  color: var(--pivx-earn-copy);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---------- responsive --------------------------------------------------- */

@media (max-width: 860px) {
  .pivx-level-preview__copy strong { font-size: 0.78rem; }
  .pivx-level-preview__copy small { display: none; }
}

@media (max-width: 620px) {
  .pivx-level-preview { padding: 16px 12px 14px; }

  .pivx-level-preview__step > a {
    flex-direction: column;
    gap: 8px;
    padding: 8px 4px;
    text-align: center;
  }

  .pivx-level-preview__dot {
    width: 38px;
    height: 38px;
    font-size: 0.86rem;
  }

  .pivx-level-preview__rail { top: 27px; }

  .pivx-level-preview__copy strong { font-size: 0.68rem; }

  .pivx-level-preview__status { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pivx-level-preview__spark,
  .pivx-level-preview__dot i {
    animation: none !important;
  }

  .pivx-level-preview__fill { transition: none; }
  .pivx-level-preview__step.is-active > a { transform: none; }
}
