/* Landing-page loading screen (templates/index.html, block "preloader").
   Hidden unless the page's script adds html.splash-on (first visit in a browser session, motion allowed).
   If that script ever fails, the animations at the bottom hide the screen and unlock scrolling by themselves. */

#tup-splash {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 50% 38%, #ffffff 0%, #fff7f7 52%, #fbe4e6 100%);
    color: #801423;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    opacity: 1;
    visibility: visible;
    transition: opacity .6s ease, visibility .6s ease;
}
html.splash-on { overflow: hidden; }
html.splash-on #tup-splash { display: flex; }
#tup-splash.is-done { opacity: 0; visibility: hidden; pointer-events: none; }   /* the page is usable while it fades */
#tup-splash.is-done .splash-stage { transform: scale(1.05); }

#tup-splash.splash-dark {
    background: radial-gradient(circle at 50% 38%, #1e293b 0%, #0f172a 58%, #020617 100%);
    color: #fca5a5;
}

/* soft drifting light behind everything */
#tup-splash::before,
#tup-splash::after {
    content: "";
    position: absolute;
    width: 46vmax;
    height: 46vmax;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .5;
    pointer-events: none;
}
#tup-splash::before { top: -18vmax; left: -14vmax; background: rgba(232, 185, 35, .22); animation: splash-drift 9s ease-in-out infinite alternate; }
#tup-splash::after { bottom: -20vmax; right: -14vmax; background: rgba(128, 20, 35, .20); animation: splash-drift 11s ease-in-out infinite alternate-reverse; }
#tup-splash.splash-dark::before { background: rgba(232, 185, 35, .12); }
#tup-splash.splash-dark::after { background: rgba(190, 60, 80, .20); }

.splash-stage {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform .8s ease;
}

/* logo with a spinning ring */
.splash-mark {
    position: relative;
    width: 140px;
    height: 140px;
    display: grid;
    place-items: center;
    isolation: isolate;
}
.splash-mark::before {                       /* white disc the logo sits on */
    content: "";
    position: absolute;
    inset: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 18px 40px rgba(128, 20, 35, .18), inset 0 0 0 1px rgba(128, 20, 35, .06);
}
.splash-glow {
    position: absolute;
    inset: -22px;
    z-index: -1;                             /* behind the white disc, so the logo keeps its colour */
    border-radius: 50%;
    background: radial-gradient(circle, rgba(128, 20, 35, .22), transparent 66%);
    animation: splash-breathe 2.4s ease-in-out infinite;
}
.splash-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #801423 0deg, #e8b923 110deg, rgba(232, 185, 35, 0) 230deg, #801423 360deg);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
            mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
    animation: splash-spin 1.5s linear infinite;
}
.splash-ring-2 {
    inset: 8px;
    opacity: .45;
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px));
            mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px));
    animation-duration: 2.6s;
    animation-direction: reverse;
}
.splash-logo {
    position: relative;
    width: 82px;
    height: 82px;
    object-fit: contain;
    animation: splash-pop .9s cubic-bezier(.2, .9, .25, 1.2) both, splash-float 3.2s ease-in-out .9s infinite;
}

/* wordmark: letters rise one after another */
.splash-title {
    margin-top: 36px;
    display: flex;
    gap: .36em;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: .12em;
    line-height: 1;
}
.splash-title span {
    display: inline-block;
    opacity: 0;
    transform: translateY(10px);
    animation: splash-rise .6s cubic-bezier(.2, .8, .2, 1) forwards;
    animation-delay: calc(.35s + var(--i) * .06s);
}
.splash-title .splash-gap { width: .5em; }
.splash-sub {
    margin-top: 12px;
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .26em;
    text-transform: uppercase;
    color: #78716c;
    opacity: 0;
    animation: splash-rise .7s ease 1.05s forwards;
}
#tup-splash.splash-dark .splash-sub { color: #94a3b8; }

.splash-bar {
    margin-top: 26px;
    width: 190px;
    height: 3px;
    border-radius: 99px;
    overflow: hidden;
    background: rgba(128, 20, 35, .12);
}
#tup-splash.splash-dark .splash-bar { background: rgba(252, 165, 165, .18); }
.splash-bar > i {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 99px;
    background: linear-gradient(90deg, #801423, #e8b923);
    transition: width .4s ease-out;
}

@keyframes splash-spin { to { transform: rotate(360deg); } }
@keyframes splash-breathe { 0%, 100% { transform: scale(.92); opacity: .7; } 50% { transform: scale(1.08); opacity: 1; } }
@keyframes splash-pop { from { opacity: 0; transform: scale(.5) rotate(-12deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes splash-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes splash-rise { to { opacity: 1; transform: translateY(0); } }
@keyframes splash-drift { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(6vmax, 4vmax, 0); } }

/* "Reduce motion": same look, nothing moves (the fade at the end stays; it is only an opacity change). */
#tup-splash.splash-calm::before,
#tup-splash.splash-calm::after,
#tup-splash.splash-calm .splash-stage * { animation: none !important; }
#tup-splash.splash-calm .splash-title span,
#tup-splash.splash-calm .splash-sub { opacity: 1; transform: none; }
#tup-splash.splash-calm .splash-stage,
#tup-splash.is-done.splash-calm .splash-stage { transform: none; }
#tup-splash.splash-calm .splash-bar > i { transition: none; }

@media (max-width: 420px) {
    .splash-title { font-size: 1.1rem; }
    .splash-sub { letter-spacing: .18em; font-size: .56rem; }
    .splash-bar { width: 150px; }
}

/* Safety net: if the script never finishes (blocked, error), the screen leaves on its own after 9 s. */
@keyframes splash-failsafe { to { opacity: 0; visibility: hidden; } }
@keyframes splash-unlock { to { overflow: auto; } }
html.splash-on #tup-splash { animation: splash-failsafe .01s linear 9s forwards; }
html.splash-on { animation: splash-unlock .01s linear 9s forwards; }

/* ---- Progress bar while moving to another page (templates/includes/_nav_progress.html) ---- */
#nav-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 10001;
    pointer-events: none;
    opacity: 0;
    transition: opacity .25s ease;
}
#nav-progress.is-on { opacity: 1; }
#nav-progress > i {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #801423, #e8b923);
    box-shadow: 0 0 8px rgba(232, 185, 35, .6);
    border-radius: 0 3px 3px 0;
    transition: width .35s ease-out;
}
@media (prefers-reduced-motion: reduce) {
    #nav-progress, #nav-progress > i { transition: none; }
}
