/* ============================================================
   CS Design System — Blueprint hero (homepage)

   The hero keeps the light engineering sheet of .cs-hero--model (paper
   ground, navy copy, layout). Only the burner changes, in an endless loop:
   its line drawing is plotted, one boundary crosses it and the real burner
   (a ray-traced film on a canvas) takes the place of the lines, the burner
   turns once, and the same steps run back. hero-blueprint.bundle.js drives
   it; without script the finished drawing shows.
   ============================================================ */

.cs-hero--bp .cs-bp,
.cs-bp__plan,
.cs-bp__real {
    position: absolute;
    inset: 0;
}

/* Left of the boundary the burner is real, right of it still drawn. */
.cs-bp__plan { clip-path: inset(0 0 0 var(--bp-edge, 0px)); }

/* The film has a white ground; multiplied onto the paper only the burner and
   its shadow remain. */
.cs-bp__real {
    clip-path: inset(0 calc(100% - var(--bp-edge, 0px)) 0 0);
    mix-blend-mode: multiply;
}

/* The drawing's box — the stage of the model hero. */
.cs-bp__stage {
    position: absolute;
    inset: calc(var(--cs-navbar-h) + 6rem) 3.5vw 1rem 39%;
    transform: translate(1rem, calc(-1 * clamp(2rem, calc(6.25vw - 3rem), 4rem)));
}

.cs-bp__sheet {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Placed and sized by the script so the film's burner lies on the drawing. */
.cs-bp__film {
    position: absolute;
    display: block;
}

/* The film only feeds the canvas. */
.cs-bp__film-source {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.cs-bp__sheet {
    object-fit: contain;
    object-position: center;
    user-select: none;
    pointer-events: none;
}

/* Visible edges are plotted from left to right. */
.cs-bp__sheet--visible {
    clip-path: inset(0 calc((1 - var(--bp-plot, 1)) * 100%) 0 0);
}

/* Concealed edges follow as a lighter second pass. */
.cs-bp__sheet--hidden {
    opacity: calc(var(--bp-internals, 1) * 0.3);
}

/* Until the script takes over, a late fade keeps slow connections from
   showing the complete drawing for a moment and then plotting it again. */
.cs-bp:not(.is-live):not(.is-static) .cs-bp__plan .cs-bp__stage {
    animation: cs-bp-unscripted 0.5s 1.8s both;
}

@keyframes cs-bp-unscripted {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* While the drawing is all there is, the real layer is not painted at all;
   once the sweep is through, the turning burner is no longer clipped. */
.cs-bp:not([data-bp-phase="sweep"]):not([data-bp-phase="real"]) .cs-bp__real { visibility: hidden; }
.cs-bp[data-bp-phase="real"] .cs-bp__plan { visibility: hidden; }
.cs-bp[data-bp-phase="real"] .cs-bp__real { clip-path: none; }

/* The drawing stands still, so the byline keeps to the copy column instead of
   running into the burner's fittings on narrower desktops. */
@media (min-width: 62.001rem) {
    .cs-hero--bp .cs-hero__byline { max-width: min(46ch, 34vw); }
}

/* ---------- Pause control (WCAG 2.2.2), where the model hero has its own ---------- */

.cs-hero--bp .cs-bp__pause {
    top: auto;
    right: max(var(--cs-gutter), calc((100% - var(--cs-maxwidth)) / 2 + var(--cs-gutter)));
    bottom: 1.25rem;
    left: auto;
    min-height: 2.75rem;
    border-color: rgba(35, 37, 77, 0.45);
    background: rgba(248, 247, 243, 0.96);
    color: var(--cs-navy);
}

.cs-hero--bp .cs-bp__pause:hover {
    border-color: var(--cs-navy);
    background: var(--cs-navy);
    color: #fff;
}

.cs-hero--bp .cs-bp__pause:focus-visible { outline-color: #245b8c; }
.cs-hero--bp .cs-bp__pause[hidden] { display: none; }

/* ---------- Narrow screens: burner above, copy below ---------- */

@media (max-width: 62rem) {
    /* Copy first, the burner below it, then the pause control. */
    .cs-hero--bp .cs-hero__pin { grid-template-rows: auto minmax(15rem, 1fr) auto; }
    .cs-hero--bp .cs-hero__content { order: 1; }

    .cs-hero--bp .cs-bp {
        position: relative;
        inset: auto;
        order: 2;
        min-height: 0;
        width: 100%;
    }

    .cs-bp__stage {
        inset: 0 var(--cs-gutter);
        transform: none;
    }

    .cs-hero--bp .cs-bp__pause {
        position: relative;
        inset: auto;
        order: 3;
        justify-self: start;
        margin: 0 var(--cs-gutter) max(1.25rem, env(safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: reduce) {
    .cs-bp:not(.is-live):not(.is-static) .cs-bp__plan .cs-bp__stage { animation: none; }
}
