/* ASIS Lab Loaders
   The nine science loaders (same drawings as the Merck search page) and the hooks that
   put them in WooCommerce's cart/checkout overlays, the side cart, add-to-cart buttons
   and the header search. Each area is switched on by a body class
   (asis-ll-on-cart / -atc / -search) from Settings > Lab Loaders. */

:root {
    --asis-ll-accent: #97c03a;
    --asis-ll-accent-deep: #5f8a17;
    /* The small filling flask as a mask image, so it takes the colour of the text around it */
    --asis-ll-mini: url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%2216%2036%2048%2044%22%3E%3Cstyle%3E.l%7Banimation:l%201.6s%20ease-in-out%20infinite%7D.w%7Banimation:w%20.9s%20linear%20infinite%7D%40keyframes%20l%7B0%25%7Btransform:translateY(74px)%7D55%25%7Btransform:translateY(55px)%7D80%25%7Btransform:translateY(55px);opacity:1%7D100%25%7Btransform:translateY(55px);opacity:0%7D%7D%40keyframes%20w%7Bfrom%7Btransform:translateX(-20px)%7Dto%7Btransform:translateX(0)%7D%7D%3C/style%3E%3Cdefs%3E%3CclipPath%20id=%22c%22%3E%3Cpath%20d=%22M35.6%2040V53.6L23.2%2073c-.8%201.3%200%202.4%201.4%202.4h30.8c1.4%200%202.2-1.1%201.4-2.4L44.4%2053.6V40z%22/%3E%3C/clipPath%3E%3C/defs%3E%3Cg%20clip-path=%22url(%23c)%22%3E%3Cg%20class=%22l%22%3E%3Cpath%20class=%22w%22%20fill=%22%23000%22%20fill-opacity=%22.55%22%20d=%22M0%204q5-4%2010%200t10%200%2010%200%2010%200%2010%200%2010%200%2010%200%2010%200%2010%200V44H0z%22/%3E%3C/g%3E%3C/g%3E%3Cpath%20fill=%22none%22%20stroke=%22%23000%22%20stroke-width=%224%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22%20d=%22M34%2040V53L21.6%2072.4C20.3%2074.6%2021.5%2077%2024%2077H56C58.5%2077%2059.7%2074.6%2058.4%2072.4L46%2053V40M31%2040H49%22/%3E%3C/svg%3E");
}

.asis-ll-flask {
    display: block;
    width: 84px;
    height: 88px;
    margin: 0 auto;
    overflow: visible;
    --asis-ll-flask-glass: #1b2235;
    --asis-ll-flask-liquid: #3f6fd1;
}

.asis-ll-flask-glass {
    fill: none;
    stroke: var(--asis-ll-flask-glass);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.asis-ll-flask-liquid,
.asis-ll-flask-stream,
.asis-ll-flask-beaker-liquid {
    fill: var(--asis-ll-flask-liquid);
}

.asis-ll-flask-bubble {
    fill: #fff;
    opacity: 0;
    transform-box: fill-box;
    animation: asis-ll-flask-bubble 2.8s ease-in infinite;
}

.asis-ll-flask-bubble--2 {
    animation-delay: 0.5s;
}

.asis-ll-flask-level {
    animation: asis-ll-flask-level 2.8s ease-in-out infinite;
}

.asis-ll-flask-liquid {
    animation: asis-ll-flask-wave 0.9s linear infinite;
}

.asis-ll-flask-beaker {
    transform-origin: 41px 12px;
    animation: asis-ll-flask-tilt 2.8s ease-in-out infinite;
}

.asis-ll-flask-beaker-liquid {
    transform-box: fill-box;
    transform-origin: 50% 100%;
    animation: asis-ll-flask-empty 2.8s ease-in-out infinite;
}

.asis-ll-flask-stream {
    transform-box: fill-box;
    transform-origin: 50% 0;
    animation: asis-ll-flask-stream 2.8s linear infinite;
}

@keyframes asis-ll-flask-tilt {
    0%, 8%   { transform: rotate(-8deg); }
    22%, 62% { transform: rotate(-72deg); }
    78%, 100% { transform: rotate(-8deg); }
}

@keyframes asis-ll-flask-stream {
    0%, 18%  { transform: scaleY(0); opacity: 1; }
    28%      { transform: scaleY(1); opacity: 1; }
    60%      { transform: translateY(0) scaleY(1); opacity: 1; }
    70%      { transform: translateY(58px) scaleY(0); opacity: 1; }
    71%, 100% { transform: scaleY(0); opacity: 0; }
}

@keyframes asis-ll-flask-empty {
    0%, 22%  { transform: scaleY(1); opacity: 1; }
    62%      { transform: scaleY(0.12); opacity: 1; }
    80%      { transform: scaleY(0.12); opacity: 0; }
    81%      { transform: scaleY(1); opacity: 0; }
    100%     { transform: scaleY(1); opacity: 1; }
}

@keyframes asis-ll-flask-level {
    0%, 24%  { transform: translateY(77px); opacity: 1; }
    66%      { transform: translateY(54px); opacity: 1; }
    86%      { transform: translateY(54px); opacity: 1; }
    97%      { transform: translateY(54px); opacity: 0; }
    98%, 100% { transform: translateY(77px); opacity: 0; }
}

@keyframes asis-ll-flask-wave {
    from { transform: translateX(-20px); }
    to   { transform: translateX(0); }
}

@keyframes asis-ll-flask-bubble {
    0%, 40%  { transform: translateY(0); opacity: 0; }
    50%      { opacity: 0.85; }
    80%      { transform: translateY(-14px); opacity: 0; }
    100%     { transform: translateY(-14px); opacity: 0; }
}

/* Small: just the flask, filling up and settling - for buttons and the search status */
.asis-ll-flask--mini {
    display: inline-block;
    width: 1.15em;
    height: 1.15em;
    margin: 0;
    vertical-align: -0.2em;
    flex-shrink: 0;
    --asis-ll-flask-glass: currentColor;
    --asis-ll-flask-liquid: currentColor;
}

.asis-ll-flask--mini .asis-ll-flask-glass {
    stroke-width: 4;
}

.asis-ll-flask--mini .asis-ll-flask-liquid {
    opacity: 0.55;
}

.asis-ll-flask--mini .asis-ll-flask-level {
    animation: asis-ll-flask-mini-level 1.6s ease-in-out infinite;
}

@keyframes asis-ll-flask-mini-level {
    0%   { transform: translateY(74px); }
    55%  { transform: translateY(55px); }
    80%  { transform: translateY(55px); opacity: 1; }
    100% { transform: translateY(55px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .asis-ll-flask *,
    .asis-ll-flask--mini .asis-ll-flask-level {
        animation: none !important;
    }

    .asis-ll-flask-level {
        transform: translateY(60px);
    }

    .asis-ll-flask-stream,
    .asis-ll-flask-bubble {
        display: none;
    }
}

/* The nine loaders (pouring flask above, the rest below). lab-loaders.js picks one at random. */

.asis-ll {
    display: block;
    position: relative;
    width: 96px;
    height: 96px;
    margin: 0 auto;
    overflow: visible;
    --asis-ll-ink: #1b2235;
    --asis-ll-liquid: #3f6fd1;
    --asis-ll-liquid-2: #5bb0e0;
    --asis-ll-surface: #fff;
}

.asis-ll svg {
    overflow: visible;
}

.asis-ll-g {
    fill: none;
    stroke: var(--asis-ll-ink);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.asis-ll-thin {
    fill: none;
    stroke: var(--asis-ll-ink);
    stroke-width: 1.4;
    stroke-linecap: round;
    opacity: 0.35;
}

.asis-ll-ink { fill: var(--asis-ll-ink); }
.asis-ll-liq { fill: var(--asis-ll-liquid); }
.asis-ll-liq2 { fill: var(--asis-ll-liquid-2); }
.asis-ll-acc { fill: var(--asis-ll-accent); }

/* Pipette */
.asis-ll-pp-bulb { transform-box: fill-box; transform-origin: 50% 50%; animation: asis-ll-pp-squeeze 1.2s ease-in-out infinite; }
.asis-ll-pp-drop { fill: var(--asis-ll-liquid); animation: asis-ll-pp-drop 1.2s cubic-bezier(.5, 0, 1, .6) infinite; }
.asis-ll-pp-level { animation: asis-ll-pp-level 4.8s steps(1, end) infinite; }
.asis-ll-pp-ripple { fill: none; stroke: var(--asis-ll-surface); stroke-width: 1.2; transform-box: fill-box; transform-origin: 50% 50%; animation: asis-ll-pp-ripple 1.2s ease-out infinite; }
@keyframes asis-ll-pp-squeeze { 0%, 30% { transform: scaleX(1); } 40% { transform: scaleX(0.78); } 55%, 100% { transform: scaleX(1); } }
@keyframes asis-ll-pp-drop { 0%, 35% { transform: translateY(0) scale(0.4); opacity: 0; } 45% { transform: translateY(0) scale(1); opacity: 1; } 100% { transform: translateY(46px) scale(1); opacity: 1; } }
@keyframes asis-ll-pp-level { 0% { transform: translateY(0); } 25% { transform: translateY(-5px); } 50% { transform: translateY(-10px); } 75% { transform: translateY(-15px); } }
@keyframes asis-ll-pp-ripple { 0%, 80% { transform: scale(0.2); opacity: 0; } 85% { opacity: 0.9; } 100% { transform: scale(1.4); opacity: 0; } }

/* Centrifuge */
.asis-ll-cf-rotor { transform-origin: 50px 50px; animation: asis-ll-cf-spin 2.6s cubic-bezier(.45, 0, .55, 1) infinite; }
.asis-ll-cf-trail { fill: none; stroke: var(--asis-ll-liquid); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 26 200; transform-origin: 50px 50px; animation: asis-ll-cf-spin 2.6s cubic-bezier(.45, 0, .55, 1) infinite, asis-ll-cf-trail 2.6s ease-in-out infinite; }
@keyframes asis-ll-cf-spin { to { transform: rotate(1440deg); } }
@keyframes asis-ll-cf-trail { 0%, 100% { opacity: 0; } 50% { opacity: 0.5; } }

/* Tube rack */
.asis-ll-rk-bar { fill: var(--asis-ll-surface); }
.asis-ll-rk-level { animation: asis-ll-rk-bob 1.4s ease-in-out infinite alternate; }
.asis-ll-rk-level--2 { animation-duration: 1.1s; animation-delay: -0.4s; }
.asis-ll-rk-level--3 { animation-duration: 1.7s; animation-delay: -0.9s; }
.asis-ll-rk-bubble { fill: var(--asis-ll-surface); opacity: 0; animation: asis-ll-rk-bubble 1.8s ease-in infinite; }
@keyframes asis-ll-rk-bob { from { transform: translateY(0); } to { transform: translateY(-4px); } }
@keyframes asis-ll-rk-bubble { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 0.9; } 90% { transform: translateY(-24px); opacity: 0; } 100% { opacity: 0; } }

/* DNA helix */
.asis-ll-dna-a, .asis-ll-dna-b, .asis-ll-dna-r { animation-duration: 1.6s; animation-timing-function: ease-in-out; animation-iteration-count: infinite; animation-direction: alternate; animation-delay: var(--asis-ll-d, 0s); }
.asis-ll-dna-a { fill: var(--asis-ll-liquid); animation-name: asis-ll-dna-a; }
.asis-ll-dna-b { fill: var(--asis-ll-accent); animation-name: asis-ll-dna-b; }
.asis-ll-dna-r { fill: var(--asis-ll-ink); opacity: 0.25; transform-box: fill-box; transform-origin: 50% 50%; animation-name: asis-ll-dna-r; animation-timing-function: linear; }
@keyframes asis-ll-dna-a { from { transform: translateX(-22px); opacity: 1; } to { transform: translateX(22px); opacity: 0.45; } }
@keyframes asis-ll-dna-b { from { transform: translateX(22px); opacity: 0.45; } to { transform: translateX(-22px); opacity: 1; } }
@keyframes asis-ll-dna-r { 0% { transform: scaleX(1); } 50% { transform: scaleX(0.05); } 100% { transform: scaleX(1); } }

/* Benzene ring (phenol) */
.asis-ll-bz-hex { stroke-dasharray: 157; animation: asis-ll-bz-hex 3.2s ease-in-out infinite; }
.asis-ll-bz-ring { stroke: var(--asis-ll-liquid); stroke-dasharray: 95; animation: asis-ll-bz-ring 3.2s ease-in-out infinite; }
.asis-ll-bz-bond { stroke-dasharray: 17; animation: asis-ll-bz-bond 3.2s ease-in-out infinite; }
.asis-ll-bz-label { font-family: 'IBM Plex Sans', -apple-system, 'Segoe UI', sans-serif; font-size: 10px; font-weight: 600; fill: var(--asis-ll-accent-deep); animation: asis-ll-bz-label 3.2s ease-in-out infinite; }
@keyframes asis-ll-bz-hex { 0% { stroke-dashoffset: 157; opacity: 1; } 40%, 86% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes asis-ll-bz-ring { 0%, 34% { stroke-dashoffset: 95; opacity: 1; } 60%, 86% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes asis-ll-bz-bond { 0%, 56% { stroke-dashoffset: 17; opacity: 1; } 68%, 86% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes asis-ll-bz-label { 0%, 64% { opacity: 0; } 74%, 86% { opacity: 1; } 100% { opacity: 0; } }

/* Petri dish */
.asis-ll-pt-agar { fill: var(--asis-ll-liquid); opacity: 0.08; }
.asis-ll-pt-col { transform-box: fill-box; transform-origin: 50% 50%; opacity: 0; animation: asis-ll-pt-grow 3.6s ease-out infinite; animation-delay: var(--asis-ll-d, 0s); }
@keyframes asis-ll-pt-grow { 0% { transform: scale(0); opacity: 0; } 8% { opacity: 0.9; } 50% { transform: scale(1); } 82% { transform: scale(1); opacity: 0.9; } 96%, 100% { transform: scale(1); opacity: 0; } }

/* Magnetic stirrer */
.asis-ll-st-bar { fill: var(--asis-ll-ink); transform-box: fill-box; transform-origin: 50% 50%; animation: asis-ll-st-spin 0.5s linear infinite; }
.asis-ll-st-vortex { transform-box: fill-box; transform-origin: 50% 0; animation: asis-ll-st-vortex 1.2s ease-in-out infinite alternate; }
.asis-ll-st-swirl { fill: none; stroke: var(--asis-ll-surface); stroke-width: 1.4; stroke-linecap: round; stroke-dasharray: 9 60; opacity: 0.7; animation: asis-ll-st-swirl 0.9s linear infinite; }
.asis-ll-st-swirl--2 { animation-duration: 1.3s; }
.asis-ll-st-led { fill: var(--asis-ll-accent); animation: asis-ll-st-led 1.2s steps(1, end) infinite; }
@keyframes asis-ll-st-spin { 0% { transform: scaleX(1); } 50% { transform: scaleX(0.2); } 100% { transform: scaleX(1); } }
@keyframes asis-ll-st-vortex { from { transform: scaleY(0.85) translateX(-1px); } to { transform: scaleY(1.1) translateX(1px); } }
@keyframes asis-ll-st-swirl { to { stroke-dashoffset: -69; } }
@keyframes asis-ll-st-led { 0% { opacity: 1; } 50% { opacity: 0.25; } }

/* Microscope */
.asis-ll-ms svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.asis-ll-ms-cells { animation: asis-ll-ms-focus 3.2s ease-in-out infinite; }
.asis-ll-ms-field { fill: var(--asis-ll-liquid); fill-opacity: 0.06; }
.asis-ll-ms-ring { stroke-width: 3.2; }
.asis-ll-ms-cell { fill: var(--asis-ll-liquid); fill-opacity: 0.22; stroke: var(--asis-ll-liquid); stroke-width: 1.4; }
.asis-ll-ms-nuc { fill: var(--asis-ll-liquid); opacity: 0.75; }
.asis-ll-ms-cell.asis-ll-ms--green { fill: var(--asis-ll-accent); stroke: var(--asis-ll-accent-deep); }
.asis-ll-ms-nuc.asis-ll-ms--green { fill: var(--asis-ll-accent-deep); }
@keyframes asis-ll-ms-focus { 0% { filter: blur(5px); transform: scale(1.08); } 45%, 75% { filter: blur(0); transform: scale(1); } 100% { filter: blur(5px); transform: scale(1.08); } }

@media (prefers-reduced-motion: reduce) {
    .asis-ll,
    .asis-ll * {
        animation: none !important;
    }

    .asis-ll-pt-col {
        opacity: 0.9;
    }
}


/* ========== Cart & checkout overlays, side cart ========== */

/* Drawn over WooCommerce's white blockUI overlay (lab-loaders.js) */
.asis-ll-block {
    position: absolute;
    inset: 0;
    z-index: 1012;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    color: #1b2235;
    font-size: 26px;
}

.asis-ll-block--page {
    position: fixed;
}

/* Tall areas: the loader sits near the top and stays in view (sticky) while scrolling */
.asis-ll-block--tall {
    align-items: flex-start;
}

.asis-ll-block--tall > * {
    position: sticky;
    top: calc(50vh - var(--asis-ll-size, 88px) / 2);
    margin-top: 72px !important;
}

.asis-ll-block .asis-ll,
.asis-ll-block .asis-ll-flask:not(.asis-ll-flask--mini) {
    width: var(--asis-ll-size, 88px);
    height: var(--asis-ll-size, 88px);
    margin: 0;
}

.asis-ll-block--sidecart {
    z-index: 100000;
    background: rgba(255, 255, 255, 0.72);
}

/* WooCommerce's own grey spinner and the side cart's spinner icon */
body.asis-ll-on-cart .blockUI.blockOverlay::before,
body.asis-ll-on-cart .xoo-wsc-loader-icon {
    display: none !important;
}

/* ========== Add-to-cart buttons ========== */

/* Shop tiles (.ajax_add_to_cart), the product page's button (Astra's ajax add to cart
   puts .loading on .single_add_to_cart_button), and YITH's Add to quote while it saves
   (YITH adds a GIF, img.ywraq-loader, next to the button; that is hidden and the flask
   goes on the button instead). */
body.asis-ll-on-atc .ajax_add_to_cart.loading::after,
body.asis-ll-on-atc .add_to_cart_button.loading::after,
body.asis-ll-on-atc .single_add_to_cart_button.loading::after,
body.asis-ll-on-atc .yith-ywraq-add-button:has(> .ywraq-loader) .add-request-quote-button::after {
    content: "" !important;
    display: inline-block !important;
    position: static !important;
    width: 1.15em !important;
    height: 1.15em !important;
    margin: 0 0 0 0.5em !important;
    padding: 0 !important;
    vertical-align: -0.2em !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    font-size: inherit !important;
    background: currentColor !important;
    -webkit-mask: var(--asis-ll-mini) center / contain no-repeat;
    mask: var(--asis-ll-mini) center / contain no-repeat;
}

/* The product page's button is bigger; so is its flask */
body.asis-ll-on-atc .single_add_to_cart_button.loading::after {
    width: 1.4em !important;
    height: 1.4em !important;
    vertical-align: -0.3em !important;
}

/* Woo and Astra fade or hide a loading button's text; keep it readable beside the flask */
body.asis-ll-on-atc .single_add_to_cart_button.loading {
    opacity: 0.85 !important;
}

body.asis-ll-on-atc .yith-ywraq-add-button > img.ywraq-loader {
    display: none !important;
}

/* ========== Header search (FiboSearch) ========== */

/* FiboSearch marks the search box with .dgwt-wcas-processing while it waits for results.
   This site's FiboSearch draws nothing in its .dgwt-wcas-preloader box during that time
   (the box only turns into the x button afterwards), so the flask goes in there. Other
   setups use the .dgwt-wcas-inner-preloader image instead, which is covered too. */
body.asis-ll-on-search .dgwt-wcas-processing .dgwt-wcas-preloader,
body.asis-ll-on-search .dgwt-wcas-preloader.dgwt-wcas-inner-preloader {
    background-image: none !important;
    z-index: 2 !important;
    pointer-events: none;
}

body.asis-ll-on-search .dgwt-wcas-processing .dgwt-wcas-preloader > *,
body.asis-ll-on-search .dgwt-wcas-preloader.dgwt-wcas-inner-preloader > * {
    visibility: hidden;
}

body.asis-ll-on-search .dgwt-wcas-processing .dgwt-wcas-preloader::after,
body.asis-ll-on-search .dgwt-wcas-preloader.dgwt-wcas-inner-preloader::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 6px;
    width: 22px;
    height: 22px;
    margin-top: -11px;
    background: #234196;
    -webkit-mask: var(--asis-ll-mini) center / contain no-repeat;
    mask: var(--asis-ll-mini) center / contain no-repeat;
}

/* ========== Moving between shop pages (lab-loaders.js watchNavigation) ==========
   A soft white veil over the page with one loader and its line in a card. Below the
   side cart and the admin bar; above the page and its sticky header. */

.asis-ll-nav {
    position: fixed;
    inset: 0;
    z-index: 99990;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(245, 248, 252, 0.7);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 200ms ease;
    cursor: progress;
}

.asis-ll-nav.is-on {
    opacity: 1;
}

.asis-ll-nav-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-width: 220px;
    padding: 26px 30px 20px;
    background: #fff;
    border: 1px solid #e1e6ef;
    border-radius: 20px;
    box-shadow: 0 18px 44px rgba(27, 34, 53, 0.16);
}

.asis-ll-nav-card .asis-ll,
.asis-ll-nav-card .asis-ll-flask {
    width: 96px;
    height: 96px;
    margin: 0;
}

.asis-ll-nav-text {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #1b2235;
    text-align: center;
}

/* ========== Settings page preview ========== */

.asis-ll-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
    max-width: 960px;
}

.asis-ll-preview figure {
    margin: 0;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 18px 12px 12px;
    text-align: center;
}

.asis-ll-preview figcaption {
    margin-top: 10px;
    font-size: 12px;
    color: #50575e;
}
