/*
 * Cyon Astra Animation
 * Everything is scoped to .cyon-astra and prefixed ca- so it can't leak into
 * the theme, and theme styles are less likely to leak in.
 */

.cyon-astra {
  --inner-size: calc(560px * 0.68); /* matches the original: ~381px */
  --center-size: 180px;
  --cta-size: 130px;
  --pad: 32px;

  --ring-color: #3a404d;
  --brand: #1a53ff;
  --line-color: #3a404d;
  --bg: #17191f;

  --icon-box: 48px;
  --icon-bg: #3a404d;
  --icon-fg: #1b1f2a;

  --sweep-speed: 8s; /* one full rotation; each item is lit for a quarter of it */
  --ca-max: 660px;

  container-type: inline-size;
  box-sizing: border-box;
  position: relative;
  width: 100%;
  max-width: var(--ca-max);
  aspect-ratio: 1 / 1;
  margin-inline: auto;
  background: var(--bg);
  color: #fff;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial,
    sans-serif;
  line-height: normal;
}

.cyon-astra *,
.cyon-astra *::before,
.cyon-astra *::after {
  box-sizing: content-box;
}

/* Themes often set svg { max-width: 100%; height: auto } — undo that here */
.cyon-astra svg {
  max-width: none;
}

.cyon-astra .ca-diagram {
  position: relative;
  width: 100%;
  height: 100%;
  isolation: isolate;
}

.cyon-astra .ca-outer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.cyon-astra .ca-inner-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: var(--inner-size);
  height: var(--inner-size);
  border-radius: 50%;
  box-shadow: 0 0 14px rgba(10, 101, 255, 0.45),
    0 0 32px rgba(10, 101, 255, 0.3), 0 0 64px rgba(10, 101, 255, 0.2);
  z-index: 1;
  pointer-events: none;
}

/* Diagonal lines (position, length and angle are set by the script) */
.cyon-astra .ca-line {
  position: absolute;
  height: 2px;
  width: 0;
  background: var(--line-color);
  transform-origin: 0 0;
  pointer-events: none;
  z-index: 6;
  border-radius: 2px;
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

@keyframes ca-pulse-inward {
  0% {
    background-position: 100% 0;
  }
  50% {
    background-position: 0 0;
  }
  100% {
    background-position: -50% 0;
  }
}

.cyon-astra .ca-line.is-active {
  background: linear-gradient(
    to left,
    rgba(26, 83, 255, 0) 0%,
    rgba(26, 83, 255, 0.6) 40%,
    rgba(26, 83, 255, 1) 60%,
    rgba(26, 83, 255, 0) 100%
  );
  background-size: 200% 100%;
  animation: ca-pulse-inward 0.8s linear infinite;
  box-shadow: 0 0 10px rgba(10, 101, 255, 0.7),
    0 0 18px rgba(10, 101, 255, 0.35);
}

.cyon-astra .ca-center {
  position: absolute;
  width: var(--center-size);
  height: var(--center-size);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(
    120% 120% at 50% 40%,
    #1475ff 0%,
    #0a65ff 45%,
    #0846b3 100%
  );
  box-shadow: 0 0 60px rgba(10, 101, 255, 0.35) inset,
    0 0 24px rgba(10, 101, 255, 0.25);
  z-index: 5;
}

.cyon-astra .ca-center svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Corner items */
.cyon-astra .ca-cta {
  position: absolute;
  width: var(--cta-size);
  height: var(--cta-size);
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  background: linear-gradient(0deg, #17191f 0%, #17191f 59%);
  text-align: center;
  transition: 0.3s;
  z-index: 7;
  box-shadow: inset 0 0 0 2px var(--line-color);
}

/* The ::before/::after patches cut gaps into each box's outline. They're
   painted in --bg, so --bg must match whatever sits behind the animation. */
.cyon-astra .ca-cta::before,
.cyon-astra .ca-cta::after {
  display: block;
  content: "";
  position: absolute;
  background-color: var(--bg);
}

.cyon-astra .ca-cta.ca-tl { left: var(--pad); top: var(--pad); }
.cyon-astra .ca-cta.ca-tl::after { width: 35px; height: 20px; bottom: -20px; left: 0; }
.cyon-astra .ca-cta.ca-tl::before { width: 20px; height: 30px; top: 2px; right: -20px; }

.cyon-astra .ca-cta.ca-tr { right: var(--pad); top: var(--pad); }
.cyon-astra .ca-cta.ca-tr::after { width: 32px; height: 20px; bottom: -20px; right: 0; }
.cyon-astra .ca-cta.ca-tr::before { width: 20px; height: 32px; top: 0; left: -20px; }

.cyon-astra .ca-cta.ca-br { right: var(--pad); bottom: var(--pad); }
.cyon-astra .ca-cta.ca-br::after { width: 32px; height: 20px; top: -20px; right: 0; }
.cyon-astra .ca-cta.ca-br::before { width: 20px; height: 30px; bottom: 2px; left: -20px; }

.cyon-astra .ca-cta.ca-bl { left: var(--pad); bottom: var(--pad); }
.cyon-astra .ca-cta.ca-bl::after { width: 32px; height: 20px; top: -20px; left: 0; }
.cyon-astra .ca-cta.ca-bl::before { width: 20px; height: 30px; bottom: 2px; right: -20px; }

.cyon-astra .ca-cta.is-active {
  background: linear-gradient(0deg, #182f73 0%, #17191f 59%);
}

.cyon-astra .ca-cta-icon {
  width: var(--icon-box);
  height: var(--icon-box);
  border-radius: 10px;
  background: var(--icon-bg);
  color: var(--icon-fg);
  display: grid;
  place-items: center;
  transition: background-color 0.25s ease, color 0.25s ease,
    box-shadow 0.25s ease;
}

.cyon-astra .ca-cta-icon svg {
  width: 70%;
  height: 70%;
  display: block;
}

.cyon-astra .ca-cta-label {
  margin: 0;
  line-height: 1.2;
  font-size: 14px;
}

.cyon-astra .ca-cta.is-active .ca-cta-icon {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 0 12px rgba(26, 83, 255, 0.55),
    0 0 24px rgba(26, 83, 255, 0.35);
}

/* Small version — based on the animation's own width rather than the
   screen's, so it also works in narrow columns and sidebars */
@container (max-width: 560px) {
  .cyon-astra .ca-diagram {
    --cta-size: 80px;
    --inner-size: calc(560px * 0.48); /* ~269px, as in the original */
  }
  .cyon-astra .ca-cta::before,
  .cyon-astra .ca-cta::after,
  .cyon-astra .ca-cta-label {
    display: none;
  }
}

/* Respect "reduce motion": the wheel holds still on the first item */
@media (prefers-reduced-motion: reduce) {
  .cyon-astra .ca-line.is-active {
    animation: none;
    background: var(--brand);
  }
  .cyon-astra .ca-cta,
  .cyon-astra .ca-line,
  .cyon-astra .ca-cta-icon {
    transition: none;
  }
}
