/* Page loader (RIVAN mark orbited by certificate, test flask, stethoscope) + back-to-top button */
#rivan-loader {
  position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center;
  background: radial-gradient(90% 80% at 50% 40%, #14308a 0%, #0a1b52 55%, #050c2b 100%);
  transition: opacity .6s ease, visibility .6s ease;
}
#rivan-loader.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
body.rl-lock { overflow: hidden; }

.rl-stage { position: relative; width: 300px; height: 300px; display: grid; place-items: center; }
.rl-ring { position: absolute; inset: 0; border-radius: 50%; border: 1px solid #d9b26a55; }
.rl-ring::before { content: ""; position: absolute; inset: 22px; border-radius: 50%; border: 1px dashed #d9b26a44; }
.rl-glow { position: absolute; width: 190px; height: 190px; border-radius: 50%; background: #2a8bff; opacity: .28; filter: blur(34px); animation: rlPulse 2s ease-in-out infinite; }
.rl-logo {
  position: relative; z-index: 2; width: 128px; height: 128px; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle, #fffdf6 62%, #f1e4bd 100%); border: 2px solid #d9b26a;
  box-shadow: 0 0 0 6px #0a1b52, 0 0 0 7px #d9b26a, 0 12px 34px #02061acc;
  animation: rlBeat 2s ease-in-out infinite;
}
.rl-logo img { width: 84px; height: 84px; object-fit: contain; }

/* orbit */
.rl-orbit { position: absolute; inset: 0; animation: rlSpin 7s linear infinite; }
.rl-item {
  position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; display: grid; place-items: center;
  border-radius: 50%; background: #0a1b52; border: 1.5px solid #d9b26a; box-shadow: 0 6px 18px #02061a99, inset 0 0 0 3px #0e2266;
}
.rl-item svg { width: 30px; height: 30px; animation: rlSpinBack 7s linear infinite; }
.rl-item:nth-child(1) { transform: rotate(0deg) translateY(-150px) rotate(0deg); }
.rl-item:nth-child(2) { transform: rotate(120deg) translateY(-150px) rotate(-120deg); }
.rl-item:nth-child(3) { transform: rotate(240deg) translateY(-150px) rotate(-240deg); }

.rl-text { margin-top: 26px; text-align: center; color: #f3dfae; font: 600 12px "Quicksand", "DM Sans", sans-serif; letter-spacing: 6px; text-transform: uppercase; }
.rl-bar { width: 180px; height: 3px; margin: 14px auto 0; border-radius: 3px; background: #ffffff1f; overflow: hidden; }
.rl-bar i { display: block; height: 100%; width: 40%; border-radius: 3px; background: linear-gradient(90deg, #f3dfae, #d9b26a, #a9803a); animation: rlBar 1.3s ease-in-out infinite; }
.rl-wrap { display: grid; justify-items: center; }

@keyframes rlSpin { to { transform: rotate(360deg); } }
@keyframes rlSpinBack { to { transform: rotate(-360deg); } }
@keyframes rlBeat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes rlPulse { 0%, 100% { opacity: .22; transform: scale(.9); } 50% { opacity: .42; transform: scale(1.1); } }
@keyframes rlBar { 0% { transform: translateX(-110%); } 100% { transform: translateX(300%); } }

@media (max-width: 480px) {
  .rl-stage { width: 250px; height: 250px; }
  .rl-item { width: 50px; height: 50px; margin: -25px 0 0 -25px; }
  .rl-item svg { width: 26px; height: 26px; }
  .rl-item:nth-child(1) { transform: rotate(0deg) translateY(-125px) rotate(0deg); }
  .rl-item:nth-child(2) { transform: rotate(120deg) translateY(-125px) rotate(-120deg); }
  .rl-item:nth-child(3) { transform: rotate(240deg) translateY(-125px) rotate(-240deg); }
  .rl-logo { width: 108px; height: 108px; }
  .rl-logo img { width: 70px; height: 70px; }
}
@media (prefers-reduced-motion: reduce) {
  .rl-orbit, .rl-item svg, .rl-logo, .rl-glow, .rl-bar i { animation: none; }
}

/* back to top */
#back-to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 900; width: 50px; height: 50px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; color: #f3dfae;
  background: linear-gradient(160deg, #17338f, #0a1b52); box-shadow: 0 10px 26px #02061acc, inset 0 0 0 1px #d9b26a99;
  opacity: 0; visibility: hidden; transform: translateY(16px) scale(.9);
  transition: opacity .3s ease, transform .3s ease, visibility .3s, box-shadow .3s;
}
#back-to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
#back-to-top:hover { transform: translateY(-4px); box-shadow: 0 14px 30px #02061aee, inset 0 0 0 1px #f3dfae; }
#back-to-top svg { width: 22px; height: 22px; position: relative; z-index: 1; }
#back-to-top .btt-ring { position: absolute; inset: 0; width: 50px; height: 50px; transform: rotate(-90deg); }
#back-to-top .btt-ring circle { fill: none; stroke-width: 2.5; }
#back-to-top .btt-track { stroke: #ffffff22; }
#back-to-top .btt-prog { stroke: #d9b26a; stroke-linecap: round; stroke-dasharray: 144.5; stroke-dashoffset: 144.5; }
@media (max-width: 650px) { #back-to-top { right: 14px; bottom: 14px; width: 44px; height: 44px; } #back-to-top .btt-ring { width: 44px; height: 44px; } }
body.pm-lock #back-to-top { display: none; }

/* ---- Loader v2: logo on top, icons light up one after another (no orbit) ---- */
.rl-wrap { gap: 0; }
.rl-logo { position: relative; width: 120px; height: 120px; animation: rlBeat 2.4s ease-in-out infinite; }
.rl-logo img { width: 78px; height: 78px; position: relative; z-index: 1; }
.rl-glow { position: absolute; inset: -20px; width: auto; height: auto; border-radius: 50%; z-index: 0; }
.rl-steps { display: flex; gap: 26px; margin-top: 38px; }
.rl-step { display: grid; justify-items: center; gap: 10px; }
.rl-step b {
  position: relative; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 16px;
  background: #0a1b52; border: 1.5px solid #d9b26a55; box-shadow: inset 0 0 0 3px #0e2266;
  opacity: .35; transform: translateY(10px) scale(.9);
  animation: rlStep 2.4s ease-in-out infinite;
}
.rl-step svg { width: 32px; height: 32px; animation: none; }
.rl-step em { font: 600 10.5px "Quicksand", "DM Sans", sans-serif; font-style: normal; letter-spacing: 2.5px; text-transform: uppercase; color: #f3dfae; opacity: .35; animation: rlLabel 2.4s ease-in-out infinite; }
.rl-step:nth-child(2) b, .rl-step:nth-child(2) em { animation-delay: .8s; }
.rl-step:nth-child(3) b, .rl-step:nth-child(3) em { animation-delay: 1.6s; }
@keyframes rlStep {
  0%, 100% { opacity: .35; transform: translateY(10px) scale(.9); border-color: #d9b26a55; box-shadow: inset 0 0 0 3px #0e2266; background: #0a1b52; }
  8%, 28% { opacity: 1; transform: translateY(0) scale(1.08); border-color: #f3dfae; background: linear-gradient(160deg, #17338f, #0a1b52); box-shadow: inset 0 0 0 3px #0e2266, 0 0 26px #d9b26a88, 0 10px 24px #02061acc; }
  38% { opacity: .35; transform: translateY(10px) scale(.9); border-color: #d9b26a55; box-shadow: inset 0 0 0 3px #0e2266; background: #0a1b52; }
}
@keyframes rlLabel { 0%, 100% { opacity: .35; } 8%, 28% { opacity: 1; } 38% { opacity: .35; } }
.rl-text { margin-top: 30px; }
@media (max-width: 480px) {
  .rl-steps { gap: 16px; margin-top: 30px; }
  .rl-step b { width: 56px; height: 56px; border-radius: 14px; }
  .rl-step svg { width: 28px; height: 28px; }
  .rl-step em { font-size: 9.5px; letter-spacing: 1.5px; }
  .rl-logo { width: 104px; height: 104px; }
  .rl-logo img { width: 68px; height: 68px; }
}
@media (prefers-reduced-motion: reduce) { .rl-step b, .rl-step em { animation: none; opacity: 1; transform: none; } }

/* ---- Back to top: gold button, navy arrow; hover flips to navy with gold arrow and glow ---- */
#back-to-top {
  color: #0a1b52; background: linear-gradient(145deg, #f7e6b8 0%, #d9b26a 55%, #a9803a 100%);
  box-shadow: 0 10px 24px #02061aaa, inset 0 0 0 1px #fff6d9aa;
}
#back-to-top .btt-track { stroke: #0a1b5233; }
#back-to-top .btt-prog { stroke: #0a1b52; }
#back-to-top:hover {
  color: #f3dfae; background: linear-gradient(145deg, #1d3fb0, #0a1b52); transform: translateY(-4px);
  box-shadow: 0 14px 30px #02061aee, 0 0 0 3px #d9b26a, 0 0 22px #d9b26a77;
}
#back-to-top:hover .btt-track { stroke: #ffffff2e; }
#back-to-top:hover .btt-prog { stroke: #f3dfae; }
#back-to-top:active { transform: translateY(-1px) scale(.96); }
