/* Base Styles & Variables */
:root {
    --bg-color: #ffffff;
    --text-color: #1f2937;
    --primary-color: #2563eb;
}

/* ================= Hexagon + Ripples Loader ================= */
/* simple dots loader replaces complex ones when present */
.chem-loader .dots-loader { display: inline-flex; gap: 10px; align-items: center; justify-content: center; }
.chem-loader .dots-loader span {
  width: 10px; height: 10px; border-radius: 50%;
  background: #2563eb;
  box-shadow: 0 0 8px rgba(37,99,235,.35);
  animation: dotBounce .8s ease-in-out infinite;
}
.chem-loader .dots-loader span:nth-child(2) { animation-delay: .1s; background: #06b6d4; box-shadow: 0 0 8px rgba(6,182,212,.35); }
.chem-loader .dots-loader span:nth-child(3) { animation-delay: .2s; background: #22c55e; box-shadow: 0 0 8px rgba(34,197,94,.35); }

@keyframes dotBounce { 0%, 80%, 100% { transform: translateY(0) scale(1); opacity: .9; } 40% { transform: translateY(-6px) scale(1.05); opacity: 1; } }

/* Hexagon outline using borders (benzene-like frame) */
.chem-loader .hex-loader .hexagon {
  position: absolute;
  top: 50%; left: 50%;
  width: 80px; height: 46px;
  background: transparent;
  border-left: 4px solid #2563eb; /* primary */
  border-right: 4px solid #06b6d4; /* cyan */
  transform: translate(-50%, -50%) rotate(90deg);
  filter: drop-shadow(0 6px 16px rgba(2,6,23,.18));
}
.chem-loader .hex-loader .hexagon::before,
.chem-loader .hex-loader .hexagon::after {
  content: "";
  position: absolute;
  width: 80px; height: 46px;
  border-left: 4px solid #2563eb;
  border-right: 4px solid #06b6d4;
}
.chem-loader .hex-loader .hexagon::before { transform: rotate(60deg); }
.chem-loader .hex-loader .hexagon::after  { transform: rotate(-60deg); }

/* Pulsing ripples */
.chem-loader .hex-loader .ripple {
  position: absolute;
  top: 50%; left: 50%;
  width: 120px; height: 120px;
  border: 2px solid rgba(37,99,235,0.35); /* primary with alpha */
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: hexRipple 2.5s infinite ease-out;
}
.chem-loader .hex-loader .ripple:nth-of-type(2) { animation-delay: .8s; }
.chem-loader .hex-loader .ripple:nth-of-type(3) { animation-delay: 1.6s; }

@keyframes hexRipple {
  0%   { transform: translate(-50%, -50%) scale(0.3); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

/* Floating particles */
.chem-loader .hex-loader .particle {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #6366f1; /* indigo accent */
  box-shadow: 0 0 10px rgba(99,102,241,.7);
  animation: particleFloat 6s infinite ease-in-out;
}
.chem-loader .hex-loader .particle.p1 { top: 20%; left: 15%; animation-delay: 0s; }
.chem-loader .hex-loader .particle.p2 { top: 70%; left: 30%; animation-delay: 1s; }
.chem-loader .hex-loader .particle.p3 { top: 40%; left: 80%; animation-delay: 2s; }
.chem-loader .hex-loader .particle.p4 { top: 85%; left: 60%; animation-delay: 3s; }
.chem-loader .hex-loader .particle.p5 { top: 10%; left: 70%; animation-delay: 4s; }

@keyframes particleFloat {
  0%, 100% { transform: translateY(0) scale(1); opacity: .8; }
  50%      { transform: translateY(-20px) scale(1.25); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .chem-loader .hex-loader .ripple,
  .chem-loader .hex-loader .particle { animation: none !important; }
}


body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #ffffff;
    /* Mesh-like soft glows using provided palette + small bottom-center glow */
    background-image:
        /* Top-left mint/teal glow (#d3f9f3 to #dafbf1) */
        radial-gradient(
            1000px 720px at 12% 10%,
            rgba(211, 249, 243, 0.60) 0%,   /* #d3f9f3 */
            rgba(218, 251, 241, 0.30) 28%, /* #dafbf1 */
            rgba(255, 255, 255, 0) 60%
        ),
        /* Subtle right-side depth (#daf8fa / #dcf9f8 / #d7f8f5) */
        radial-gradient(
            640px 460px at 84% 26%,
            rgba(218, 248, 250, 0.30) 0%,  /* #daf8fa */
            rgba(220, 249, 248, 0.22) 22%, /* #dcf9f8 */
            rgba(215, 248, 245, 0.14) 40%, /* #d7f8f5 */
            rgba(255, 255, 255, 0) 62%
        ),
        /* Small bottom-center glow (#d5faf1 / #dff4f3) */
        radial-gradient(
            460px 260px at 50% 90%,
            rgba(213, 250, 241, 0.42) 0%,  /* #d5faf1 */
            rgba(223, 244, 243, 0.22) 36%, /* #dff4f3 */
            rgba(255, 255, 255, 0) 70%
        ),
        /* Small bottom-right glow (#dcf9f8 / #dff4f3) */
        radial-gradient(
            360px 220px at 92% 92%,
            rgba(220, 249, 248, 0.34) 0%,  /* #dcf9f8 */
            rgba(223, 244, 243, 0.18) 40%, /* #dff4f3 */
            rgba(255, 255, 255, 0) 72%
        );
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    /* Prevent horizontal scroll while we ensure children are responsive */
    overflow-x: hidden;

}

/* Page Loader Overlay */
#page-loader {
    position: fixed;
    inset: 0;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity .4s ease;
}

#page-loader .spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid rgba(37, 99, 235, 0.18);
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Hide loader after page is ready */
body.loaded #page-loader {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
    #page-loader { transition: none; }
    #page-loader .spinner { animation-duration: 1.6s; }
}

/* --- Advanced Chemistry Loader --- */
.chem-loader {
    position: relative;
    width: clamp(180px, 36vw, 320px);
    height: clamp(180px, 36vw, 320px);
    display: grid;
    place-items: center;
    isolation: isolate;
}

/* Subtle hexagonal backdrop using layered gradients */
.chem-loader .hex-bg {
    position: absolute;
    inset: 0;
    border-radius: 20px;
    background:
      radial-gradient( 40% 60% at 20% 20%, rgba(99,102,241,0.14), rgba(99,102,241,0) 60%),
      radial-gradient( 40% 60% at 80% 70%, rgba(6,182,212,0.14), rgba(6,182,212,0) 65%),
      conic-gradient(from 0deg at 50% 50%, rgba(0,0,0,0.04), rgba(0,0,0,0.02), rgba(0,0,0,0.04));
    filter: saturate(1.05);
    z-index: 0;
    overflow: hidden;
}

/* Faux hex grid lines overlay */
.chem-loader .hex-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
      linear-gradient(30deg, rgba(2, 6, 23, 0.06) 12%, transparent 12.5%, transparent 87%, rgba(2, 6, 23, 0.06) 87.5%, rgba(2,6,23,0.06)),
      linear-gradient(150deg, rgba(2, 6, 23, 0.06) 12%, transparent 12.5%, transparent 87%, rgba(2, 6, 23, 0.06) 87.5%, rgba(2,6,23,0.06)),
      linear-gradient(90deg, rgba(2, 6, 23, 0.04) 2%, transparent 2.5%, transparent 97.5%, rgba(2, 6, 23, 0.04) 98%, rgba(2,6,23,0.04));
    background-size: 24px 42px, 24px 42px, 24px 24px;
    background-position: 0 0, 0 0, 0 0;
    opacity: .5;
    pointer-events: none;
}

/* Atom with orbits */
.chem-loader .atom {
    position: absolute;
    width: 68%;
    height: 68%;
    border-radius: 50%;
    display: grid; place-items: center;
    z-index: 2;
}
.chem-loader .atom .nucleus {
    width: 16px; height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    box-shadow: 0 0 0 6px rgba(37,99,235,0.12), 0 8px 24px rgba(2,6,23,0.16);
}
.chem-loader .orbit {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1.5px dashed rgba(2,6,23,0.18);
    transform-style: preserve-3d;
    /* control angles via CSS vars to keep electron phase while rotating */
    --rx: 0deg; /* tilt X */
    --ry: 0deg; /* tilt Y */
    --rzStart: 0deg; /* starting Z angle */
    animation: orbit-rotate 5.2s linear infinite, dashPulse 2.2s ease-in-out infinite;
}
.chem-loader .orbit-2 { --rx: 62deg; --ry: 0deg; --rzStart: 20deg; animation-duration: 6.2s; }
.chem-loader .orbit-3 { --rx: 0deg; --ry: 58deg; --rzStart: -18deg; animation-duration: 7s; }

.chem-loader .electron {
    position: absolute;
    top: -6px; left: 50%;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #06b6d4;
    box-shadow: 0 0 0 4px rgba(6,182,212,0.14);
    transform: translateX(-50%);
    /* remove self-spin; let the parent orbit rotation move the electron around the ring */
    animation: pulseGlow 1.4s ease-in-out infinite;
}
.chem-loader .orbit-1 { --rx: 0deg; --ry: 0deg; --rzStart: 0deg; }
.chem-loader .orbit-1 { animation-duration: 3.6s; }
.chem-loader .orbit-1 .carrier { position: absolute; inset: 0; transform: rotate(var(--rot,0deg)); }
.chem-loader .orbit-1 .carrier.c1 { --rot: 0deg; }
.chem-loader .orbit-1 .carrier.c2 { --rot: 120deg; }
.chem-loader .orbit-1 .carrier.c3 { --rot: 240deg; }
.chem-loader .orbit-2 .electron { background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,0.14); animation-duration: 2.1s; }
.chem-loader .orbit-3 .electron { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245,158,11,0.14); animation-duration: 2.4s; }

@keyframes orbit-rotate {
  from { transform: rotateZ(var(--rzStart)) rotateX(var(--rx)) rotateY(var(--ry)); }
  to   { transform: rotateZ(calc(360deg + var(--rzStart))) rotateX(var(--rx)) rotateY(var(--ry)); }
}
@keyframes pulseGlow { 0%,100% { filter: drop-shadow(0 0 0 rgba(0,0,0,0)); } 50% { filter: drop-shadow(0 0 8px rgba(37,99,235,0.35)); } }
@keyframes dashPulse { 0%,100% { border-color: rgba(2,6,23,0.18); opacity: .65; } 50% { border-color: rgba(2,6,23,0.30); opacity: .95; } }

/* Flask (Erlenmeyer) */
.chem-loader .flask {
    position: absolute;
    bottom: 10%;
    width: 40%;
    aspect-ratio: 1/1.1;
    z-index: 3;
    filter: drop-shadow(0 10px 24px rgba(2,6,23,0.14));
    animation: flaskBob 3s ease-in-out infinite;
}
.chem-loader .flask .neck {
    position: absolute; top: -14%; left: 50%; transform: translateX(-50%);
    width: 26%; height: 20%; border-radius: 6px;
    background: linear-gradient(#e2e8f0, #cbd5e1);
    box-shadow: inset 0 0 0 2px rgba(15,23,42,0.06);
}
.chem-loader .flask .liquid {
    position: absolute; inset: 18% 6% 4% 6%; border-radius: 10px 10px 12px 12px;
    background: linear-gradient(180deg, rgba(59,130,246,0.85), rgba(6,182,212,0.85));
    overflow: hidden;
}
.chem-loader .flask .liquid .wave {
    position: absolute; left: -50%; right: -50%; bottom: 18%; height: 30%;
    background: radial-gradient(50% 100% at 50% 0%, rgba(255,255,255,0.45), rgba(255,255,255,0) 60%);
    opacity: .6;
    animation: waveMove 2.2s ease-in-out infinite;
}
@keyframes waveMove { 0%,100%{ transform: translateX(0); } 50% { transform: translateX(10%); } }
@keyframes flaskBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

.chem-loader .flask .bubble {
    position: absolute; bottom: 8%; left: 50%; transform: translateX(-50%);
    width: 8px; height: 8px; border-radius: 50%;
    background: rgba(255,255,255,0.85);
    mix-blend-mode: screen;
    animation: bubbleUp 2.2s ease-in infinite;
}
.chem-loader .flask .bubble.b1 { left: 38%; animation-delay: .0s; }
.chem-loader .flask .bubble.b2 { left: 54%; width: 6px; height: 6px; animation-delay: .4s; }
.chem-loader .flask .bubble.b3 { left: 62%; width: 7px; height: 7px; animation-delay: .8s; }
@keyframes bubbleUp {
    0% { transform: translate(-50%, 0) scale(1); opacity: .9; }
    70% { opacity: .8; }
    100% { transform: translate(-50%, -120%) scale(0.8); opacity: 0; }
}

.chem-loader .loader-label {
    position: absolute;
    bottom: -14px;
    font-size: 12px;
    letter-spacing: .6px;
    color: #334155;
    background: rgba(255,255,255,0.7);
    border: 1px solid rgba(15,23,42,0.06);
    border-radius: 999px;
    padding: 4px 10px;
    z-index: 4;
    backdrop-filter: blur(4px);
    display: inline-flex; align-items: center; gap: 6px;
    animation: popIn .5s cubic-bezier(.22,.61,.36,1) .2s both;
}
.chem-loader .loader-label .label-text {
    background: linear-gradient(90deg, #334155, #1f2937, #334155);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    background-size: 200% 100%;
    animation: shimmer 2.2s linear infinite;
}
.chem-loader .loader-label .dots { display: inline-flex; gap: 3px; }
.chem-loader .loader-label .dots span {
    width: 5px; height: 5px; border-radius: 50%; background: #06b6d4; opacity: .8;
    animation: dot 1.2s ease-in-out infinite;
}
.chem-loader .loader-label .dots span:nth-child(2) { animation-delay: .2s; background: #22c55e; }
.chem-loader .loader-label .dots span:nth-child(3) { animation-delay: .4s; background: #f59e0b; }

@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: 0 0; } }
@keyframes dot { 0%, 80%, 100% { transform: translateY(0); opacity: .8; } 40% { transform: translateY(-3px); opacity: 1; } }
@keyframes popIn { 0% { transform: translateY(6px) scale(.98); opacity: 0; } 100% { transform: translateY(0) scale(1); opacity: 1; } }

/* Timed Progress Bar (sync ~5s) */
.chem-loader .loader-progress {
    position: absolute;
    bottom: -36px;
    width: min(260px, 70%);
    z-index: 4;
}
.chem-loader .loader-progress .progress-track {
    width: 100%; height: 6px;
    background: rgba(15,23,42,0.08);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(15,23,42,0.06);
}
.chem-loader .loader-progress .progress-bar {
    width: 0%; height: 100%;
    background: linear-gradient(90deg, #2563eb, #06b6d4);
    box-shadow: 0 0 16px rgba(37,99,235,0.25);
    background-size: 200% 100%;
    animation: progressFill 2.5s linear forwards, progressShimmer 1.2s linear infinite;
}

@keyframes progressFill {
    from { width: 0%; }
    to   { width: 100%; }
}
@keyframes progressShimmer { 0% { background-position: 200% 0; } 100% { background-position: 0 0; } }

@media (prefers-reduced-motion: reduce) {
    .chem-loader .loader-progress .progress-bar { animation: none; width: 100%; }
}

/* Reduced motion: stop spinning/anim but keep elegant static visual */
@media (prefers-reduced-motion: reduce) {
  .chem-loader .orbit,
  .chem-loader .electron,
  .chem-loader .flask .liquid .wave,
  .chem-loader .flask .bubble,
  .chem-loader .flask,
  .chem-loader .loader-label,
  .chem-loader .loader-progress .progress-bar { animation: none !important; }
}

/* Sparkles */
.chem-loader .sparkles { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.chem-loader .sparkles .sp {
  position: absolute; width: 4px; height: 4px; border-radius: 50%;
  background: rgba(255,255,255,0.9); box-shadow: 0 0 8px rgba(99,102,241,0.6);
  animation: twinkle 1.6s ease-in-out infinite;
}
.chem-loader .sparkles .s1 { top: 12%; left: 22%; animation-delay: .1s; }
.chem-loader .sparkles .s2 { top: 18%; right: 18%; animation-delay: .4s; }
.chem-loader .sparkles .s3 { bottom: 26%; left: 16%; animation-delay: .8s; }
.chem-loader .sparkles .s4 { bottom: 20%; right: 22%; animation-delay: 1.1s; }
.chem-loader .sparkles .s5 { top: 44%; left: 10%; animation-delay: .6s; }
.chem-loader .sparkles .s6 { top: 48%; right: 12%; animation-delay: 1.3s; }
@keyframes twinkle { 0%,100% { transform: scale(.8); opacity: .5; } 50% { transform: scale(1.25); opacity: 1; } }

/* Hex parallax shimmer */
.chem-loader .hex-bg::before {
  content: ""; position: absolute; inset: -10% -10% -10% -10%;
  background: radial-gradient(60% 40% at 20% 80%, rgba(99,102,241,0.18), transparent 60%),
              radial-gradient(40% 60% at 80% 30%, rgba(6,182,212,0.18), transparent 60%);
  filter: blur(10px); opacity: .6; pointer-events: none;
  animation: parallax 6s ease-in-out infinite;
}
@keyframes parallax { 0%,100% { transform: translate(0,0); } 50% { transform: translate(6px,-6px); } }

/* ===================== New Complex Chemistry Loader ===================== */
/* Subtle grid background with glow */
.chem-loader .grid-bg { position: absolute; inset: 0; border-radius: 20px; overflow: hidden; z-index: 0; }
.chem-loader .grid-bg::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(90deg, rgba(2,6,23,.06) 1px, transparent 1px),
                    linear-gradient(0deg, rgba(2,6,23,.06) 1px, transparent 1px);
  background-size: 22px 22px; opacity: .45;
}
.chem-loader .grid-bg::after {
  content: ""; position: absolute; inset: -20% -10% -10% -10%; pointer-events: none;
  background: radial-gradient(50% 40% at 20% 20%, rgba(99,102,241,.18), transparent 60%),
              radial-gradient(40% 50% at 80% 70%, rgba(6,182,212,.18), transparent 60%);
  filter: blur(10px); opacity: .7; animation: gridGlow 6s ease-in-out infinite;
}
@keyframes gridGlow { 0%,100% { transform: translate(0,0); } 50% { transform: translate(4px, -4px); } }

/* Molecule: hex ring (benzene-like) */
.chem-loader .molecule { position: absolute; width: 62%; height: 62%; z-index: 2; display: grid; place-items: center; }
.chem-loader .molecule .ring { position: relative; width: 100%; height: 100%; transform: rotate(90deg); animation: ringSpin 9s linear infinite; }
@keyframes ringSpin { to { transform: rotate(450deg); } }

/* Bonds: 6 sides of a hexagon */
.chem-loader .molecule .bond { position: absolute; left: 50%; top: 50%; width: 44%; height: 2px; background: rgba(2,6,23,.22); transform-origin: left center; border-radius: 2px; }
.chem-loader .molecule .b1 { transform: translate(-50%, -50%) rotate(0deg); }
.chem-loader .molecule .b2 { transform: translate(-50%, -50%) rotate(60deg); }
.chem-loader .molecule .b3 { transform: translate(-50%, -50%) rotate(120deg); }
.chem-loader .molecule .b4 { transform: translate(-50%, -50%) rotate(180deg); }
.chem-loader .molecule .b5 { transform: translate(-50%, -50%) rotate(240deg); }
.chem-loader .molecule .b6 { transform: translate(-50%, -50%) rotate(300deg); }

/* Alternating aromatic highlight sweeping around bonds */
.chem-loader .molecule .bond::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(37,99,235,.6), transparent); opacity: .0; }
.chem-loader .molecule .b1::after { animation: bondGlow 2.2s linear infinite .0s; }
.chem-loader .molecule .b2::after { animation: bondGlow 2.2s linear infinite .2s; }
.chem-loader .molecule .b3::after { animation: bondGlow 2.2s linear infinite .4s; }
.chem-loader .molecule .b4::after { animation: bondGlow 2.2s linear infinite .6s; }
.chem-loader .molecule .b5::after { animation: bondGlow 2.2s linear infinite .8s; }
.chem-loader .molecule .b6::after { animation: bondGlow 2.2s linear infinite 1.0s; }
@keyframes bondGlow { 0% { opacity: .0; transform: translateX(-40%); } 30% { opacity: .9; } 60% { opacity: .0; } 100% { transform: translateX(40%); opacity: .0; } }

/* Nodes at vertices */
.chem-loader .molecule .node { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(99,102,241,.22), 0 6px 16px rgba(2,6,23,.12); }
.chem-loader .molecule .n1 { left: 50%; top: 0; transform: translate(-50%, -6px); }
.chem-loader .molecule .n2 { right: 0; top: 25%; transform: translate(6px, -50%); }
.chem-loader .molecule .n3 { right: 0; bottom: 25%; transform: translate(6px, 50%); }
.chem-loader .molecule .n4 { left: 50%; bottom: 0; transform: translate(-50%, 6px); }
.chem-loader .molecule .n5 { left: 0; bottom: 25%; transform: translate(-6px, 50%); }
.chem-loader .molecule .n6 { left: 0; top: 25%; transform: translate(-6px, -50%); }

/* Substituent orbits around the molecule */
.chem-loader .sub-orbit { position: absolute; inset: -8% -8% -8% -8%; border-radius: 50%; border: 1.5px dashed rgba(2,6,23,.18); animation: subOrbit 5.5s linear infinite; }
.chem-loader .so-2 { inset: -18% -10% -18% -10%; animation-duration: 7s; }
.chem-loader .sub-orbit .sub-node { position: absolute; top: -5px; left: 50%; transform: translateX(-50%); width: 10px; height: 10px; border-radius: 50%; background: #06b6d4; box-shadow: 0 0 0 4px rgba(6,182,212,.14); }
@keyframes subOrbit { to { transform: rotate(360deg); } }

/* Periodic ticker */
.chem-loader .periodic-ticker { position: absolute; top: 6%; left: 10%; right: 10%; height: 20px; overflow: hidden; z-index: 3; opacity: .9; }
.chem-loader .periodic-ticker .track { display: inline-flex; gap: 14px; white-space: nowrap; animation: ticker 8s linear infinite; color: #334155; font-weight: 600; font-size: 12px; }
@keyframes ticker { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
.chem-loader .periodic-ticker span { padding: 2px 6px; border-radius: 6px; background: rgba(255,255,255,.7); border: 1px solid rgba(15,23,42,.06); }

/* Formula stream (marquee) */
.chem-loader .formula-stream { position: absolute; left: 8%; right: 8%; z-index: 3; }
.chem-loader .formula-stream.top { top: 72%; }
.chem-loader .formula-stream.bottom { bottom: 8%; }
.chem-loader .formula-stream .flow { white-space: nowrap; color: #0f172a; font-size: 12px; opacity: .85; animation: flow 9s linear infinite; }
@keyframes flow { 0% { transform: translateX(0); } 100% { transform: translateX(-60%); } }

/* Reduced motion for new loader */
@media (prefers-reduced-motion: reduce) {
  .chem-loader .grid-bg::after,
  .chem-loader .molecule .ring,
  .chem-loader .molecule .bond::after,
  .chem-loader .sub-orbit,
  .chem-loader .periodic-ticker .track,
  .chem-loader .formula-stream .flow { animation: none !important; }
}

/* Media should never overflow the viewport width */
img, picture, video, canvas, svg {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Avoid long inline elements forcing overflow */
.content, section, nav, footer, header, .container {
    overflow-x: clip;
}

/* ================= Image Lightbox Modal ================= */
body.modal-open { overflow: hidden; }

#image-lightbox {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15,23,42,0.35);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  z-index: 10000;
}

#image-lightbox[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

#image-lightbox .content {
  position: relative;
  max-width: min(1000px, 92vw);
  max-height: 88vh;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
  box-shadow: 0 20px 60px rgba(2,6,23,0.35);
  transform: translateY(10px) scale(.98);
  transition: transform .25s ease;
}

#image-lightbox[aria-hidden="false"] .content {
  transform: translateY(0) scale(1);
}

#image-lightbox img {
  display: block;
  max-width: 100%;
  max-height: 88vh;
  object-fit: contain;
  background: #0b1220;
}

#image-lightbox .close-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px; height: 36px;
  border-radius: 999px;
  border: none;
  background: rgba(15,23,42,0.6);
  color: #fff; font-size: 24px; line-height: 1;
  display: grid; place-items: center;
  cursor: pointer;
  transition: background .2s ease, transform .2s ease;
}

#image-lightbox .close-btn:hover { background: rgba(15,23,42,0.8); transform: scale(1.05); }
#image-lightbox .close-btn:active { transform: scale(.98); }

/* Add some content to see the effect */
.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: #1a365d;
}

p {
    font-size: 1.1rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    max-width: 800px;
}



@media (max-width: 520px) {
  .nav-center { visibility: hidden; }
}