/*
 * Animations for inschrijven.biggym.com (the custom frontend).
 * Same effects as on biggym.com, but opt-in per element by class instead of on every Elementor widget.
 */


/*
 * Neon border: two lights on exactly opposite sides that slowly travel around the edge, looping. No border in between.
 * Add the class neon_border to an element; add neon_border_pink as well for the pink border, and neon_border_hover to
 * only show it on hover.
 * Remove the element's own border; keep its border radius, the neon border follows it.
 */

@property --neon_border_angle {
    syntax: '<angle>';
    inherits: false;
    initial-value: 0deg;
}

.neon_border {
    --neon_border_color: rgb(27, 27, 27);
    /* The travelling lights: the colour mixed with white. Raise the percentage for brighter lights. */
    --neon_border_light: color-mix(in srgb, var(--neon_border_color), #ffffff 22%);
    --neon_border_width: 1px;
    /* How long each light is, as part of the full 360° around the element (at most 180deg). */
    --neon_border_length: 80deg;
    /* Time for one full round. */
    --neon_border_duration: 10s;

    position: relative;
}

.neon_border.neon_border_pink {
    --neon_border_color: rgb(230, 0, 127);
    --neon_border_light: color-mix(in srgb, var(--neon_border_color), #ffffff 45%);
}

.neon_border::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    box-sizing: border-box;
    padding: var(--neon_border_width);
    border-radius: inherit;
    /* Two lights on exactly opposite sides: the pattern repeats every 180°. The rest of the border is transparent. */
    background: repeating-conic-gradient(from var(--neon_border_angle),
            transparent 0deg,
            var(--neon_border_light) calc(var(--neon_border_length) / 2),
            transparent var(--neon_border_length),
            transparent 180deg);
    /* Only the border ring stays visible: the content area is cut out. */
    -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);
    pointer-events: none;
    animation: neon_border_travel var(--neon_border_duration) linear infinite;
    transition: background-color 0.4s ease;
}

/*
 * Hover only: add neon_border_hover as well. The lights fade in while the pointer is on the element (or while
 * something inside it has keyboard focus), and are paused while hidden so they cost nothing.
 */
.neon_border.neon_border_hover::after {
    opacity: 0;
    animation-play-state: paused;
    transition: opacity 0.4s ease, background-color 0.4s ease;
}

.neon_border.neon_border_hover:hover::after,
.neon_border.neon_border_hover:focus-within::after {
    opacity: 1;
    animation-play-state: running;
}

@keyframes neon_border_travel {
    to {
        --neon_border_angle: 360deg;
    }
}

@media (prefers-reduced-motion: reduce) {
    .neon_border::after {
        animation: none;
    }
}

.neon_border.neon_border_better_contrast {
    border: 1px solid #1b1b1b !important;
}
.neon_border.neon_border_better_contrast::after {
    height: calc(100% + 2px);
    margin-top: -1px;
    width: calc(100% + 2px);
    margin-left: -1px;
}
.neon_border.neon_border_better_contrast.neon_border_hover:hover::after {
    background-color: #212121;
}
.neon_border.neon_border_better_contrast:not(.neon_border_hover) {
    border-color: #1b1b1b !important;
}
.neon_border.neon_border_better_contrast.neon_border_pink::after {
    background-color: rgba(230, 0, 126, .47);
}





/*
 * Neon button: add the class neon-button to a <button> or <a> to give it this hover effect. On hover, the button's
 * border fades out and two light strips on exactly opposite sides of it start out small and grow (while travelling
 * along the border) until they meet and together form the whole border again. Meanwhile the background fades in,
 * starting right away but slowly, and reaching fully white when the strips meet. It ends in the hover style below
 * (white background, black text, white border).
 *
 * No inner element is needed: the script puts a canvas inside the button, behind its text and icons. Because of that
 * it works on <button> and <a>, but not on <input type="submit">, which cannot contain anything: use a <button> there.
 *
 * By default the button has a transparent background and a #474747 border. Add one of these classes as well to change
 * that:
 *   neon-button--alt    white border instead of #474747 (btn-alt does the same)
 *   neon-button--pink   pink light strips
 *   neon-button--dark   a dark (#1F1F1F) background on hover instead of white; the text stays white
 * Disabled buttons (disabled or aria-disabled="true") get no effect.
 * On touch screens (devices without hover) there are no light strips: the button quickly fades to its hover style.
 * body:not(#__) adds the weight of an ID, so these colours win over the frontend's own button classes; any of the
 * variables below can be changed per button class to fit a design.
 */

body:not(#__) .neon-button {
    --neon-button-radius: 0px 10px 0px 10px;
    /* Colour of the light strips. */
    --neon-button-light: #ffffff;
    /* Opacity of the light strips (0 to 1). */
    --neon-button-brightness: 1;
    /*
	 * How far the strips travel along the border while they grow, as part of the whole border. 0.5 is half a round,
	 * so the back end of each strip moves along too; at 0.25 the back ends stand still and the strips only seem to grow.
	 */
    --neon-button-travel: 0.5;
    /* Background and border before hovering. */
    --neon-button-background: transparent;
    --neon-button-border: #474747;
    /* Background (the colour the button lights up to) and border on hover. */
    --neon-button-fill: #ffffff;
    --neon-button-hover-border: #ffffff;
    /* Text colours before and after. */
    --neon-button-text: #ffffff;
    --neon-button-hover-text: #000000;
    /* Border width; the light strips are as wide as the border. */
    --neon-button-width: 1px;
    /* Duration of the whole effect. */
    --neon-button-duration: 1.2s;

    position: relative;
    border: var(--neon-button-width) solid var(--neon-button-border);
    border-radius: var(--neon-button-radius);
    background-color: var(--neon-button-background) !important;
    color: var(--neon-button-text);

    overflow: visible !important;

    transition: all .3s ease;
}

body:not(#__) .neon-button:is(.neon-button--alt, .btn-alt) {
    --neon-button-border: #ffffff;
}

body:not(#__) .neon-button.neon-button--pink {
    /* rgb(230, 0, 127) mixed with 45% white, like the pink neon border. */
    --neon-button-light: rgb(241, 115, 185);
}

/* Dark variant: the background fades in to #1F1F1F, so the text can stay white the whole time. */
body:not(#__) .neon-button.neon-button--dark {
    --neon-button-fill: #1f1f1f;
    --neon-button-hover-text: #ffffff;
}

body:not(#__) .neon-button:not(:disabled, [aria-disabled="true"]):hover,
body:not(#__) .neon-button:not(:disabled, [aria-disabled="true"]):focus-visible {
    border-color: var(--neon-button-hover-border);
    background-color: var(--neon-button-fill) !important;
    color: var(--neon-button-hover-text);
}

/* Icons in the button follow the text colour. */
body:not(#__) .neon-button svg {
    fill: currentColor;
}

body:not(#__) .neon-button.neon-button--ready {
    /* Keeps the canvas (z-index: -1) inside the button: above its background and border, below its text and icons. */
    isolation: isolate;
}

body:not(#__) .neon-button .neon-button__canvas {
    position: absolute;
    z-index: -1;
    /* No size until the script measures the button on the first hover, so it never takes space or causes scrolling. */
    top: 0;
    left: 0;
    display: block;
    width: 0;
    height: 0;
    pointer-events: none;
    margin: 0 !important;
    border-radius: 0px !important;
}

/* Touch screens: no light strips, just a quick fade to the hover style. */
@media (hover: none) {
    body:not(#__) .neon-button {
        transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {

    /*
	 * The button's own border fades out while the strips grow, and fades in to the hover border when they meet; the
	 * text switches from white to black at the right moment.
	 */
    body:not(#__) .neon-button.neon-button--ready:not(:disabled, [aria-disabled="true"]):hover,
    body:not(#__) .neon-button.neon-button--ready:not(:disabled, [aria-disabled="true"]):focus-visible {
        animation:
            neon-button-border var(--neon-button-duration) ease-in-out,
            neon-button-text var(--neon-button-duration) linear forwards;
        /*
		 * The hover colours only start after the effect, hidden under the canvas, so they never show halfway.
		 * Leaving the button resets everything immediately, without the delay.
		 */
        transition-delay: var(--neon-button-duration);
    }
}

@keyframes neon-button-border {
    0% {
        border-color: var(--neon-button-border);
    }

    6%,
    94% {
        border-color: transparent;
    }

    100% {
        border-color: var(--neon-button-hover-border);
    }
}

/*
 * The background starts fading in right away, slowly at first, and is fully white at the end (FILL_CURVE in the
 * animations JS). The text switches quickly at the moment black text becomes easier to read than white text: when
 * the background reaches a relative luminance of about 0.18, which for white fading in over a black page is at 68% of
 * the duration. A slow fade would pass through grey on grey. These are shares of the duration, so they stay right
 * when you change the duration.
 */
@keyframes neon-button-text {

    0%,
    67% {
        color: var(--neon-button-text);
    }

    69%,
    100% {
        color: var(--neon-button-hover-text);
    }
}