/* rings.css: give any element class "rn-ring" a thin multicolour ring that turns slowly.
   Tune with custom properties on the element or a parent:
     --rn-ring-colors  comma list of colours; end with the first colour again for a seamless loop
     --rn-ring-width   ring thickness (default 2px)
     --rn-ring-speed   time per turn (default 24s; .rn-ring--slow is 40s)
   The ring is drawn outside the element's box and follows its border-radius. */
@property --rn-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

.rn-ring {
  position: relative;
  isolation: isolate;
}

.rn-ring--slow { --rn-ring-speed: 40s; }

.rn-ring::before {
  content: '';
  position: absolute;
  inset: calc(var(--rn-ring-width, 2px) * -1);
  padding: var(--rn-ring-width, 2px);
  border-radius: inherit;
  pointer-events: none;
  z-index: -1;
  background: conic-gradient(from var(--rn-angle), var(--rn-ring-colors, #ff5a5f, #ffb400, #3ddc97, #4cc9f0, #9b5de5, #ff5a5f));
  /* punch out the middle so only the thin ring shows */
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: rn-ring-turn var(--rn-ring-speed, 24s) linear infinite;
}

@keyframes rn-ring-turn {
  to { --rn-angle: 360deg; }
}

@media (prefers-reduced-motion: reduce) {
  .rn-ring::before { animation: none; }
}
