/* Critical loader styles - base structure and CSS variables */
/* Used to style the loader in public/index.html before react app loads */

/* the primary-color and highlight-color are colors from the new sage brand */
.loader-wrapper {
    --primary-color: #330d7d;
    --highlight-color: #a576ff;
    position: relative;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: Poppins, Helvetica, Arial, sans-serif;
}

.loader-label-wrapper {
    margin: 40px 0 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 25dvh;
    width: 100%;
}

.loader-refresh-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.loader-app-version {
    position: absolute;
    bottom: 40px;
    width: 100%;
    text-align: center;
}

.loader-label-wrapper > h4 {
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.235;
    margin: 0;
}

#reload-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#reload-page > span {
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
}

#reload-page > a {
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

#reload-page > a:hover {
    text-decoration: underline;
}

#reload-page.shown {
    opacity: 1;
    pointer-events: all;
    transition: opacity 0.2s ease-in-out;
}

#reload-page:not(.shown) {
    opacity: 0;
    pointer-events: none;
}

/* Default CSS variables for logo animation */
.sage-loader {
    --count: 6;
    --base: #000000;
    --hl: var(--highlight-color, #a576ff);
    --intro-stagger: 140ms;
    --intro-dur: 700ms;
    --intro-total: calc((var(--count) - 1) * var(--intro-stagger) + var(--intro-dur));
    --sweep-dur: 1000ms;
}

/* Base styling */
.sage-loader .sage-logo {
    display: block;
}

.sage-loader path {
    fill: var(--base);
    opacity: 0;
}

/* Path index variables for animation delays */
.sage-logo path:nth-of-type(1) {
    --i: 0;
}

.sage-logo path:nth-of-type(2) {
    --i: 1;
}

.sage-logo path:nth-of-type(3) {
    --i: 2;
}

.sage-logo path:nth-of-type(4) {
    --i: 3;
}

.sage-logo path:nth-of-type(5) {
    --i: 4;
}

.sage-logo path:nth-of-type(6) {
    --i: 5;
}

/* Load this last to ensure all other styles are loaded first before making the loader visible */
div.loader-wrapper {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.1s ease-in-out;
}
