/* ============================================================================
   NORTHWHICH COLLEGE — PAGE LOADER & PAGE TRANSITIONS
   ---------------------------------------------------------------------------
   An indigo curtain carrying the crest. While the page loads, the lion rises
   out of the light, a cyan ring fills with the real loading progress, the
   name and "Learn • Grow • Excel" follow. When the page is ready the two
   halves of the curtain part (top up, bottom down) along a line of cyan
   light. Clicking a link to another page closes the curtain again, so moving
   around the site feels like one continuous piece.

   First page of a visit: the full intro (at least ~1.5s, so it is seen).
   Every later page: the short version — just the crest and the ring, gone
   the moment the page is ready.

   Markup + its small script: database/brand.php (bm_loader_html), added
   right after <body> on the website, student login and register pages.
   Reduced motion: no loader at all. No JavaScript: it lifts itself after 4s.
   ========================================================================== */

.nwl { position: fixed; inset: 0; z-index: 2147483000; pointer-events: all; display: block;
       animation: nwlFailsafe 0s linear 4s forwards; }
.nwl * { box-sizing: border-box; }

/* the two halves of the curtain */
/* both halves paint one screen-sized gradient (top half shows its upper part,
   bottom half its lower part), so the curtain reads as one piece until it opens */
.nwl-p { position: absolute; left: 0; right: 0; height: 50.5%; overflow: hidden;
         background: radial-gradient(1100px 700px at 50% 50%, #3a3eb0 0%, #2e3192 35%, #1b1d66 70%, #0d0e33 100%) 0 0 / 100vw 100vh no-repeat, #0d0e33;
         transition: transform .85s cubic-bezier(.77,0,.18,1); }
.nwl-b { background-position: 0 100%, 0 0 !important; }
.nwl-p::before {                     /* the banner's circuit lines, drifting */
    content: ''; position: absolute; left: -220px; right: 0; top: -220px; height: calc(100vh + 440px); opacity: .13;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' fill='none' stroke='%23ffffff' stroke-width='1'%3E%3Cpath d='M0 40h70l30 30h120M0 150h40l40-40h60l30-30h50M110 220v-50l30-30h80M30 0v20l20 20'/%3E%3Ccircle cx='100' cy='70' r='2.5' fill='%2322b8d6'/%3E%3Ccircle cx='140' cy='140' r='2.5' fill='%2322b8d6'/%3E%3C/svg%3E") 0 0 / 220px 220px;
    animation: nwlDrift 30s linear infinite;
}
.nwl-p::after {                      /* soft light behind the crest, split exactly at the seam */
    content: ''; position: absolute; left: 50%; width: 760px; height: 760px; margin-left: -380px; border-radius: 50%;
    background: radial-gradient(circle, rgba(79,91,213,.5), rgba(34,184,214,.1) 42%, transparent 68%);
}
.nwl-t { top: 0; }
.nwl-t::after { top: calc(50vh - 380px); }
.nwl-b { bottom: 0; }
.nwl-b::after { bottom: calc(50vh - 380px); }
.nwl-b::before { top: calc(-220px - 49.5vh); }     /* same line pattern as the top half, continued */

/* the seam of light the curtain opens along */
.nwl-seam { position: absolute; left: 50%; top: 50%; width: 0; height: 2px; margin-top: -1px; z-index: 3; pointer-events: none;
            background: linear-gradient(90deg, transparent, #7fe3f5 20%, #fff 50%, #7fe3f5 80%, transparent);
            box-shadow: 0 0 18px 2px rgba(127,227,245,.8); transform: translateX(-50%); opacity: 0; }

/* the crest, ring, name and motto */
.nwl-core { position: absolute; left: 50%; top: 50%; z-index: 2; display: flex; flex-direction: column; align-items: center;
            transform: translate(-50%, -50%); text-align: center; color: #fff;
            transition: opacity .35s ease, transform .5s cubic-bezier(.6,0,.4,1); }
.nwl-crest { position: relative; width: 150px; height: 150px; display: flex; align-items: center; justify-content: center; }
.nwl-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.nwl-ring circle { fill: none; stroke-width: 2.5; }
.nwl-ring .tr { stroke: rgba(255,255,255,.12); }
.nwl-ring .pg { stroke: url(#nwlGrad); stroke-linecap: round; stroke-dasharray: 440; stroke-dashoffset: calc(440 - 440 * var(--nwl, 0)); transition: stroke-dashoffset .35s ease; filter: drop-shadow(0 0 6px rgba(127,227,245,.7)); }
.nwl-spin { position: absolute; inset: -8px; border-radius: 50%; border: 1.5px solid transparent; border-top-color: rgba(127,227,245,.75); border-right-color: rgba(127,227,245,.2);
            animation: nwlSpin 1.1s linear infinite; }
.nwl-lion { width: 92px; height: auto; display: block; position: relative;
            clip-path: inset(100% 0 0 0); animation: nwlRise 1s cubic-bezier(.16,1,.3,1) .1s forwards;
            filter: drop-shadow(0 6px 18px rgba(8,9,31,.45)); }
.nwl-lion-glow { position: absolute; left: 50%; top: 50%; width: 92px; height: 86px; transform: translate(-50%, -50%); pointer-events: none;
                 -webkit-mask: var(--nwl-mark) center / contain no-repeat; mask: var(--nwl-mark) center / contain no-repeat;
                 background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.95) 48%, rgba(127,227,245,.95) 52%, transparent 65%) 0 0 / 260% 100% no-repeat;
                 background-position: 130% 0; animation: nwlShine 1.3s ease-in-out 1s infinite; }
.nwl-word { width: 230px; height: auto; margin-top: 26px; opacity: 0; transform: translateY(10px); letter-spacing: .4em;
            animation: nwlUp .8s cubic-bezier(.16,1,.3,1) .45s forwards; }
.nwl-motto { margin-top: 14px; font: 600 12px/1 'Montserrat', 'Inter', system-ui, sans-serif; letter-spacing: .32em; text-transform: uppercase; color: rgba(255,255,255,.78);
             display: flex; gap: 12px; align-items: center; }
.nwl-motto span { opacity: 0; transform: translateY(8px); animation: nwlUp .7s cubic-bezier(.16,1,.3,1) forwards; }
.nwl-motto span:nth-child(1) { animation-delay: .7s; } .nwl-motto span:nth-child(3) { animation-delay: .85s; } .nwl-motto span:nth-child(5) { animation-delay: 1s; }
.nwl-motto i { width: 5px; height: 5px; border-radius: 50%; background: #22b8d6; box-shadow: 0 0 8px #7fe3f5; opacity: 0; animation: nwlUp .5s ease forwards .8s; }
.nwl-motto i:nth-of-type(2) { animation-delay: .95s; }
.nwl-pct { margin-top: 16px; font: 700 11px/1 'Montserrat', 'Inter', system-ui, sans-serif; letter-spacing: .2em; color: #7fe3f5; font-variant-numeric: tabular-nums; opacity: .9; }

/* glints, like the banner's lights */
.nwl-gl { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.nwl-gl i { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #fff; opacity: 0;
            box-shadow: 0 0 10px 3px rgba(127,227,245,.85); animation: nwlGlint 3.2s ease-in-out infinite; }
.nwl-gl i:nth-child(1) { left: 14%; top: 24%; } .nwl-gl i:nth-child(2) { left: 82%; top: 30%; animation-delay: .8s; }
.nwl-gl i:nth-child(3) { left: 24%; top: 74%; animation-delay: 1.5s; } .nwl-gl i:nth-child(4) { left: 74%; top: 80%; animation-delay: 2.2s; }

/* ── short version (any page after the first) ────────────────────────────── */
.nwl.is-quick .nwl-word, .nwl.is-quick .nwl-motto { display: none; }
.nwl.is-quick .nwl-crest { width: 110px; height: 110px; }
.nwl.is-quick .nwl-lion { width: 64px; animation-duration: .6s; animation-delay: 0s; }
.nwl.is-quick .nwl-lion-glow { width: 64px; height: 60px; animation-delay: .4s; }
.nwl.is-quick .nwl-pct { display: none; }

/* ── leaving: the core lifts away, the seam flashes, the curtain parts ───── */
.nwl.is-out { pointer-events: none; }
.nwl.is-out .nwl-core { opacity: 0; transform: translate(-50%, -50%) scale(1.08); }
.nwl.is-out .nwl-seam { animation: nwlSeam .7s ease forwards; }
.nwl.is-out .nwl-t { transform: translateY(-101%); transition-delay: .18s; }
.nwl.is-out .nwl-b { transform: translateY(101%); transition-delay: .18s; }

/* ── arriving (a link was clicked): the curtain closes over the page ─────── */
.nwl.is-closing .nwl-t { transform: translateY(-101%); animation: nwlCloseT .5s cubic-bezier(.77,0,.18,1) forwards; }
.nwl.is-closing .nwl-b { transform: translateY(101%); animation: nwlCloseB .5s cubic-bezier(.77,0,.18,1) forwards; }
.nwl.is-closing .nwl-core { opacity: 0; animation: nwlFade .3s ease .3s forwards; }
.nwl.is-closing .nwl-word, .nwl.is-closing .nwl-motto, .nwl.is-closing .nwl-pct { display: none; }

/* while the curtain is up, the page's own entrance animations wait for it */
html.nwl-on .rv { opacity: 0 !important; transform: translateY(28px) !important; transition: none !important; }
html.nwl-on .hd, html.nwl-on .sl, html.nwl-on .hd-logo img { animation-play-state: paused !important; }
html.nwl-on, html.nwl-on body { overflow: hidden !important; }
/* the previous one-off homepage intro is replaced by this loader */
.pl { display: none !important; }

/* phones */
@media (max-width: 600px) {
    .nwl-crest { width: 124px; height: 124px; }
    .nwl-lion { width: 76px; }
    .nwl-lion-glow { width: 76px; height: 71px; }
    .nwl-word { width: 190px; }
    .nwl-motto { font-size: 10.5px; letter-spacing: .26em; gap: 9px; }
}

@media (prefers-reduced-motion: reduce) {
    .nwl { display: none !important; }
    html.nwl-on .rv { opacity: 1 !important; transform: none !important; }
    html.nwl-on, html.nwl-on body { overflow: visible !important; }
}

@keyframes nwlFailsafe { to { visibility: hidden; opacity: 0; pointer-events: none; } }
@keyframes nwlDrift { to { transform: translate(220px, 220px); } }
@keyframes nwlSpin { to { transform: rotate(360deg); } }
@keyframes nwlRise { to { clip-path: inset(0 0 0 0); } }
@keyframes nwlShine { 0% { background-position: 130% 0; } 60%, 100% { background-position: -30% 0; } }
@keyframes nwlUp { to { opacity: 1; transform: none; } }
@keyframes nwlGlint { 0%, 100% { opacity: 0; transform: scale(.4); } 50% { opacity: 1; transform: scale(1); } }
@keyframes nwlSeam { 0% { width: 0; opacity: 1; } 45% { width: 100%; opacity: 1; } 100% { width: 100%; opacity: 0; } }
@keyframes nwlCloseT { from { transform: translateY(-101%); } to { transform: none; } }
@keyframes nwlCloseB { from { transform: translateY(101%); } to { transform: none; } }
@keyframes nwlFade { to { opacity: 1; } }
