/*
 * ASIS Site Style - page background (includes/backdrop.php): lab icons in fine lines,
 * glowing lines and dot patches, for shop, product, homepage and login pages.
 *
 * Its own file so it can load without the rest of the new look: in the "Login page
 * background only" mode this is the only stylesheet loaded, on the logged-out My
 * Account page. Every rule hangs off body.asis-ss-backdrop, which is only set on pages
 * that print the backdrop.
 */

/* Colours used below (the same values as body.asis-ss in site-style.css, repeated so
   this file works on its own) */
body.asis-ss-backdrop {
    --asis-ss-brand: #234196;
    --asis-ss-accent: #97c03a;
    --asis-ss-line: #e1e6ef;
}

/* --------------------------------------------------------------------------
   Shop backdrop (includes/backdrop.php): lab icons in fine lines, glowing lines,
   dot patches, on a soft wash. Sits behind the page's main container; the white tiles
   cover it, so it shows in the gaps, the side margins and below the brand panel.
   -------------------------------------------------------------------------- */

body.asis-ss-backdrop {
    overflow-x: clip !important; /* the layer is full window width; no sideways scroll (see the sticky sidebar note) */
}

body.asis-ss-backdrop #content > .ast-container {
    position: relative;
    isolation: isolate;
}

body.asis-ss-backdrop .asis-ss-bg {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 100vw;
    transform: translateX(-50%);
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(245, 248, 252, 0) 0, #f5f8fc 160px, #f5f8fc calc(100% - 80px), rgba(245, 248, 252, 0) 100%);
}

body.asis-ss-backdrop .asis-ss-bg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* Icons */
body.asis-ss-backdrop .asis-ss-bg-icon {
    position: absolute;
    overflow: visible;
    fill: none;
    stroke: var(--asis-ss-brand);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-opacity: 0.3;
    transform: rotate(var(--asis-ss-rot, 0deg));
    animation: asis-ss-bg-float 16s ease-in-out infinite;
    animation-delay: var(--asis-ss-delay, 0s);
}

body.asis-ss-backdrop .asis-ss-bg-icon--green {
    stroke: var(--asis-ss-accent);
    stroke-opacity: 0.6;
}

@keyframes asis-ss-bg-float {
    0%, 100% { transform: translateY(0) rotate(var(--asis-ss-rot, 0deg)); }
    50%      { transform: translateY(-12px) rotate(var(--asis-ss-rot, 0deg)); }
}

/* Lines with a glowing pulse running along them, as on the Merck page */
body.asis-ss-backdrop .asis-ss-bg-line {
    position: absolute;
    width: 900px;
    height: auto;
    overflow: visible;
    --asis-ss-line: var(--asis-ss-brand);
}

body.asis-ss-backdrop .asis-ss-bg-line--green {
    --asis-ss-line: var(--asis-ss-accent);
}

body.asis-ss-backdrop .asis-ss-bg-line--a { top: 4%;  left: calc(50% - 1050px); }
body.asis-ss-backdrop .asis-ss-bg-line--b { top: 30%; left: calc(50% + 120px); }
body.asis-ss-backdrop .asis-ss-bg-line--c { top: 56%; left: calc(50% - 980px); }
body.asis-ss-backdrop .asis-ss-bg-line--d { top: 80%; left: calc(50% + 60px); }

body.asis-ss-backdrop .asis-ss-bg-line path {
    fill: none;
    stroke: var(--asis-ss-line);
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

body.asis-ss-backdrop .asis-ss-bg-line-base {
    stroke-width: 1.5;
    stroke-opacity: 0.18;
}

body.asis-ss-backdrop .asis-ss-bg-line--green .asis-ss-bg-line-base {
    stroke-opacity: 0.4;
}

body.asis-ss-backdrop .asis-ss-bg-line-pulse,
body.asis-ss-backdrop .asis-ss-bg-line-glow {
    stroke-dasharray: 110 1700;
    stroke-dashoffset: 0;
    animation: asis-ss-bg-pulse 12s linear infinite;
}

body.asis-ss-backdrop .asis-ss-bg-line-pulse {
    stroke-width: 2.4;
    stroke-opacity: 0.85;
}

body.asis-ss-backdrop .asis-ss-bg-line-glow {
    stroke-width: 9;
    stroke-opacity: 0.35;
    filter: blur(5px);
}

body.asis-ss-backdrop .asis-ss-bg-line--b path { animation-delay: -3s; }
body.asis-ss-backdrop .asis-ss-bg-line--c path { animation-delay: -6s; }
body.asis-ss-backdrop .asis-ss-bg-line--d path { animation-delay: -9s; }

@keyframes asis-ss-bg-pulse {
    to { stroke-dashoffset: -1810; }
}

/* Dot patches */
body.asis-ss-backdrop .asis-ss-bg-dots {
    position: absolute;
    width: 340px;
    height: 340px;
    background-image: radial-gradient(circle, rgba(35, 65, 150, 0.2) 1.3px, transparent 1.7px);
    background-size: 13px 13px;
    -webkit-mask-image: radial-gradient(closest-side, #000 25%, transparent);
    mask-image: radial-gradient(closest-side, #000 25%, transparent);
}

body.asis-ss-backdrop .asis-ss-bg-dots--a { top: 20%; left: -60px; }
body.asis-ss-backdrop .asis-ss-bg-dots--b { top: 48%; right: -80px; }
body.asis-ss-backdrop .asis-ss-bg-dots--c { top: 78%; left: 2%; }

/* Product pages: the page itself is now on the wash, so the panels that used the wash
   (buy box, related products) turn white to stand off it */
body.asis-ss-backdrop--product.single-product .summary form.cart {
    background: #fff;
}

body.asis-ss-backdrop--product.single-product section:is(.related, .upsells) {
    background: rgba(255, 255, 255, 0.86);
}

body.asis-ss-backdrop--product.single-product table.shop_attributes th {
    background: #f7f9fc;
}

/* The brand panel and tiles sit on the wash; give the panel a white face like the tiles */
body.asis-ss-backdrop #secondary .ast-filter-wrap {
    background: rgba(255, 255, 255, 0.86);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

@media (max-width: 921px) {
    /* Phones and tablets: a lighter backdrop - a few icons in the margins, no lines */
    body.asis-ss-backdrop .asis-ss-bg-line,
    body.asis-ss-backdrop .asis-ss-bg-dots--b,
    body.asis-ss-backdrop .asis-ss-bg-dots--c,
    body.asis-ss-backdrop--product .asis-ss-bg-icon,
    body.asis-ss-backdrop .asis-ss-bg-icon--extra {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.asis-ss-backdrop .asis-ss-bg-line-pulse,
    body.asis-ss-backdrop .asis-ss-bg-line-glow {
        display: none;
    }

    body.asis-ss-backdrop .asis-ss-bg-icon {
        animation: none;
    }
}
