/* GLOW2 (V2: moves for everyone, even with Windows animations turned off)
   - a backlit glowing border that keeps the element normal size.
   Use with class="glow2" on (almost) any tag.
   A bright spot travels slowly around the border.
   UPINIT version: green + gold. */

@property --glow2-angle {          /* lets the browser animate the angle smoothly */
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

.glow2 {
  --glow2-color-1: #5dff8f;   /* leaf green */
  --glow2-color-2: #ffd45c;   /* gold */
  --glow2-width: 2px;         /* border thickness */
  --glow2-radius: 12px;       /* rounded corners */
  --glow2-speed: 16s;         /* time for the bright spot to go all the way around */
  --glow2-blur: 14px;         /* how far the back-light spreads */
  --glow2-bg: #0b1a12;        /* MUST match the element's background color */

  position: relative;
  isolation: isolate;
  border-radius: var(--glow2-radius);
  background-color: var(--glow2-bg);
}

/* the sharp glowing border (::before) and the soft back-light behind it (::after) */
.glow2::before,
.glow2::after {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--glow2-width));
  border-radius: calc(var(--glow2-radius) + var(--glow2-width));
  pointer-events: none;
  --glow2-ring: conic-gradient(from var(--glow2-angle),
    color-mix(in srgb, var(--glow2-color-1) 45%, transparent) 0deg,
    color-mix(in srgb, var(--glow2-color-2) 45%, transparent) 100deg,
    color-mix(in srgb, var(--glow2-color-1) 45%, transparent) 200deg,
    var(--glow2-color-1) 285deg,
    #ffffff 320deg,
    var(--glow2-color-2) 340deg,
    color-mix(in srgb, var(--glow2-color-1) 45%, transparent) 360deg);
}
.glow2::before {               /* colored border, with the inside painted the background color */
  z-index: -1;
  border: var(--glow2-width) solid transparent;
  background:
    linear-gradient(var(--glow2-bg), var(--glow2-bg)) padding-box,
    var(--glow2-ring) border-box;
  animation: glow2-spin var(--glow2-speed) linear infinite;
}
.glow2::after {                /* blurred light behind it = the back-light.
                                  It doesn't spin: a spinning blur on every card makes phones slow. */
  z-index: -2;
  background: linear-gradient(135deg, var(--glow2-color-1), var(--glow2-color-2));
  filter: blur(var(--glow2-blur));
  opacity: 0.35;
}

@keyframes glow2-spin {
  to { --glow2-angle: 360deg; }
}

/* Tags that can't hold ::before/::after (images, form boxes...) get a softer glow.
   For the full effect, wrap them: <span class="glow2"><input ...></span> */
:is(img, input, select, textarea, progress, video, iframe).glow2 {
  border: var(--glow2-width) solid var(--glow2-color-1);
  box-shadow: 0 0 10px color-mix(in srgb, var(--glow2-color-1) 60%, transparent);
}
