/* ============================================================
   AumNamah Radioanalytical Lab — Clean White & Blue Preloader
   Elegant, minimal, professional — matches site theme
   ============================================================ */

/* Skip flag */
html.rl-preloader-skip .rl-preloader {
    display: none !important;
}

/* Lock scroll */
html.rl-preloader-active,
html.rl-preloader-active body {
    overflow: hidden !important;
}

/* ============================================================
   Root Overlay — White & Blue Theme
   ============================================================ */
.rl-preloader {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 48px;
    padding: 32px 24px;
    background: #ffffff;
    overflow: hidden;
    font-family: "Inter", system-ui, -apple-system, sans-serif;
    color: #191b23;
    -webkit-font-smoothing: antialiased;
    transition: opacity 700ms cubic-bezier(0.16, 1, 0.3, 1),
                transform 700ms cubic-bezier(0.16, 1, 0.3, 1),
                filter 700ms cubic-bezier(0.16, 1, 0.3, 1),
                visibility 700ms cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform, filter;
}

/* Subtle background gradient */
.rl-preloader::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% 40%, rgba(0, 74, 198, 0.04) 0%, transparent 70%),
        radial-gradient(ellipse 50% 50% at 80% 80%, rgba(37, 99, 235, 0.03) 0%, transparent 60%);
    pointer-events: none;
    z-index: -1;
}

/* ============================================================
   SVG Container — The Lab Icon
   ============================================================ */
.rl-pl-icon-wrap {
    position: relative;
    z-index: 2;
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: rl-pl-icon-in 800ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes rl-pl-icon-in {
    from { opacity: 0; transform: translateY(-20px) scale(0.9); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.rl-pl-icon-wrap svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* ============================================================
   Lab Name Badge
   ============================================================ */
.rl-pl-brand {
    position: relative;
    z-index: 2;
    text-align: center;
    animation: rl-pl-brand-in 800ms cubic-bezier(0.16, 1, 0.3, 1) 100ms both;
}

@keyframes rl-pl-brand-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.rl-pl-brand-name {
    font-family: "Manrope", system-ui, sans-serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #004ac6;
    margin: 0 0 6px 0;
}

.rl-pl-brand-tagline {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #737686;
}

/* ============================================================
   Progress Section
   ============================================================ */
.rl-pl-progress {
    position: relative;
    z-index: 2;
    width: min(360px, 80vw);
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: rl-pl-progress-in 800ms cubic-bezier(0.16, 1, 0.3, 1) 200ms both;
}

@keyframes rl-pl-progress-in {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Progress bar track */
.rl-pl-bar {
    position: relative;
    height: 3px;
    width: 100%;
    border-radius: 9999px;
    background: #e2e8f0;
    overflow: hidden;
}

/* Progress bar fill */
.rl-pl-bar-fill {
    position: relative;
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, #004ac6 0%, #2563eb 50%, #3b82f6 100%);
    box-shadow: 0 0 12px rgba(0, 74, 198, 0.3);
    transition: width 150ms cubic-bezier(0.16, 1, 0.3, 1), background 400ms ease;
}

.rl-pl-bar-fill.is-success {
    background: linear-gradient(90deg, #004ac6 0%, #2563eb 100%);
    box-shadow: 0 0 16px rgba(0, 74, 198, 0.4);
}

/* Shimmer on bar fill */
.rl-pl-bar-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.5) 50%, transparent 100%);
    animation: rl-pl-shimmer 1.8s linear infinite;
}

@keyframes rl-pl-shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Progress meta info row */
.rl-pl-progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rl-pl-status {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
    min-height: 16px;
    transition: opacity 220ms ease, color 300ms ease;
}

.rl-pl-status.is-fading {
    opacity: 0;
}

.rl-pl-status.is-success {
    color: #004ac6;
}

.rl-pl-percent {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #004ac6;
    letter-spacing: 0.03em;
    transition: color 300ms ease;
}

.rl-pl-percent.is-success {
    color: #004ac6;
}

/* ============================================================
   SVG Animations
   ============================================================ */

/* Flask liquid wave */
@keyframes rl-liquid-wave {
    0%   { d: path("M 26 75 Q 35 71, 44 75 Q 53 79, 62 75 L 62 90 Q 44 93, 26 90 Z"); }
    50%  { d: path("M 26 75 Q 35 79, 44 75 Q 53 71, 62 75 L 62 90 Q 44 93, 26 90 Z"); }
    100% { d: path("M 26 75 Q 35 71, 44 75 Q 53 79, 62 75 L 62 90 Q 44 93, 26 90 Z"); }
}

/* Bubble float */
@keyframes rl-bubble-1 {
    0%   { transform: translate(0, 0); opacity: 0.7; }
    50%  { opacity: 1; }
    100% { transform: translate(-3px, -18px); opacity: 0; }
}

@keyframes rl-bubble-2 {
    0%   { transform: translate(0, 0); opacity: 0.5; }
    60%  { opacity: 0.9; }
    100% { transform: translate(2px, -22px); opacity: 0; }
}

@keyframes rl-bubble-3 {
    0%   { transform: translate(0, 0); opacity: 0.6; }
    40%  { opacity: 1; }
    100% { transform: translate(-1px, -15px); opacity: 0; }
}

.rl-bubble-1 { animation: rl-bubble-1 2.4s ease-in-out infinite; }
.rl-bubble-2 { animation: rl-bubble-2 3.1s ease-in-out infinite 0.5s; }
.rl-bubble-3 { animation: rl-bubble-3 2.7s ease-in-out infinite 1.2s; }

/* Atom orbit spin */
@keyframes rl-orbit-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.rl-orbit-1 {
    transform-origin: 44px 44px;
    animation: rl-orbit-spin 4s linear infinite;
}

.rl-orbit-2 {
    transform-origin: 44px 44px;
    animation: rl-orbit-spin 5s linear infinite reverse;
}

.rl-orbit-3 {
    transform-origin: 44px 44px;
    animation: rl-orbit-spin 7s linear infinite;
}

/* Electron pulsing */
@keyframes rl-electron-pulse {
    0%, 100% { r: 2.5; opacity: 0.9; }
    50%      { r: 3.5; opacity: 1; }
}

.rl-electron {
    animation: rl-electron-pulse 1.5s ease-in-out infinite;
}

/* Radiation wave pulses */
@keyframes rl-wave-pulse {
    0%   { r: 8;  opacity: 0.4; stroke-width: 1.5; }
    100% { r: 28; opacity: 0;   stroke-width: 0.3; }
}

.rl-wave-1 { animation: rl-wave-pulse 2.5s ease-out infinite; }
.rl-wave-2 { animation: rl-wave-pulse 2.5s ease-out infinite 0.8s; }
.rl-wave-3 { animation: rl-wave-pulse 2.5s ease-out infinite 1.6s; }

/* ============================================================
   Exit Transition
   ============================================================ */
.rl-preloader.is-leaving {
    opacity: 0;
    transform: translateY(-16px) scale(0.98);
    filter: blur(6px);
    visibility: hidden;
    pointer-events: none;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 640px) {
    .rl-preloader { gap: 36px; padding: 24px 16px; }
    .rl-pl-icon-wrap { width: 130px; height: 130px; }
    .rl-pl-brand-name { font-size: 18px; }
    .rl-pl-brand-tagline { font-size: 10px; }
    .rl-pl-progress { width: min(300px, 85vw); }
    .rl-pl-status { font-size: 10px; }
    .rl-pl-percent { font-size: 12px; }
}

/* ============================================================
   Reduced Motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .rl-preloader,
    .rl-preloader *,
    .rl-preloader svg * {
        animation: none !important;
        transition: opacity 300ms ease, transform 300ms ease, filter 300ms ease, visibility 300ms ease !important;
    }
    .rl-pl-bar-fill {
        transition: width 200ms linear !important;
    }
}
