/*
 * Preloaders of the xHosting theme (chosen in Admin > Themes > Preloader). Colours come from the theme palette:
 * --pl-color (default: the main colour) and --pl-bg (default: white), both overridable by the admin.
 */
.tpl-preloader {
    --pl-color: var(--tg-theme-primary, var(--base-color));
    --pl-bg: var(--tg-color-white-default, white);
    align-items: center;
    background: var(--pl-bg);
    display: flex;
    flex-direction: column;
    gap: 22px;
    inset: 0;
    justify-content: center;
    position: fixed;
    transition: opacity .35s ease, visibility .35s ease;
    z-index: 9999;
}
.tpl-preloader.is-done { opacity: 0; visibility: hidden; }
.tpl-preloader__logo { max-height: 48px; max-width: 180px; }
.tpl-preloader--line { background: transparent; inset: 0 0 auto 0; height: 3px; pointer-events: none; }
.tpl-preloader--line .tpl-preloader__logo { display: none; }

/* turning squares */
.pl-squares { animation: pl-squares 1s infinite; aspect-ratio: 1; background: var(--pl-g), var(--pl-g), var(--pl-g); background-size: 50% 50%; width: 56px;
    --pl-g: conic-gradient(from -90deg at 10px 10px, var(--pl-color) 90deg, transparent 0); }
@keyframes pl-squares { 0% { background-position: 0 0, 10px 10px, 20px 20px; } 33% { background-position: 10px 10px; } 66% { background-position: 0 20px, 10px 10px, 20px 0; } 100% { background-position: 0 0, 10px 10px, 20px 20px; } }

/* ring spinner */
.pl-spinner { animation: pl-spin .8s linear infinite; border: 4px solid color-mix(in srgb, var(--pl-color) 18%, transparent); border-radius: 50%; border-top-color: var(--pl-color); height: 52px; width: 52px; }
@keyframes pl-spin { to { transform: rotate(360deg); } }

/* bouncing dots */
.pl-dots { display: flex; gap: 10px; }
.pl-dots span { animation: pl-dot 1s infinite ease-in-out; background: var(--pl-color); border-radius: 50%; height: 14px; width: 14px; }
.pl-dots span:nth-child(2) { animation-delay: .15s; }
.pl-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes pl-dot { 0%, 80%, 100% { opacity: .35; transform: scale(.6); } 40% { opacity: 1; transform: scale(1); } }

/* equaliser bars */
.pl-bars { align-items: center; display: flex; gap: 6px; height: 44px; }
.pl-bars span { animation: pl-bar 1s infinite ease-in-out; background: var(--pl-color); border-radius: 3px; height: 100%; width: 7px; }
.pl-bars span:nth-child(2) { animation-delay: .1s; }
.pl-bars span:nth-child(3) { animation-delay: .2s; }
.pl-bars span:nth-child(4) { animation-delay: .3s; }
.pl-bars span:nth-child(5) { animation-delay: .4s; }
@keyframes pl-bar { 0%, 40%, 100% { transform: scaleY(.35); } 20% { transform: scaleY(1); } }

/* pulse (sits under the logo when the logo is shown) */
.pl-pulse { height: 56px; position: relative; width: 56px; }
.pl-pulse::before, .pl-pulse span { animation: pl-pulse 1.4s infinite ease-out; border: 3px solid var(--pl-color); border-radius: 50%; content: ""; inset: 0; position: absolute; }
.pl-pulse span { animation-delay: .7s; }
@keyframes pl-pulse { 0% { opacity: 1; transform: scale(.2); } 100% { opacity: 0; transform: scale(1); } }

/* progress line at the top of the page (does not cover the page) */
.pl-line { background: color-mix(in srgb, var(--pl-color) 15%, transparent); height: 3px; overflow: hidden; width: 100%; }
.pl-line span { animation: pl-line 1.1s infinite ease-in-out; background: var(--pl-color); display: block; height: 100%; width: 40%; }
@keyframes pl-line { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

@media (prefers-reduced-motion: reduce) {
    .pl-squares, .pl-spinner, .pl-dots span, .pl-bars span, .pl-pulse::before, .pl-pulse span, .pl-line span { animation-duration: 2.4s; }
}
