/*********************************************************************

     ██████╗ ███████╗███████╗███████╗██████╗
    ██╔═══██╗██╔════╝██╔════╝██╔════╝██╔══██╗
    ██║   ██║█████╗  █████╗  █████╗  ██████╔╝
    ██║   ██║██╔══╝  ██╔══╝  ██╔══╝  ██╔══██╗
    ╚██████╔╝██║     ██║     ███████╗██║  ██║
     ╚═════╝ ╚═╝     ╚═╝     ╚══════╝╚═╝  ╚═╝

 *********************************************************************/



    /*
        Figma reference — Assets / "Offer Sticker", two variants in 180 x 180.

            closed ... gold 64 x 64 against the right edge, 24px percent sign
            open ..... gold 180 x 180, text Hauora Bold 24, link underlined

        It belongs to the hero, and scrolls away with it. The sticker is
        printed at the end of the document, so it is positioned against the
        page itself: the header's height, then the distance down the hero.

        --nvm-offer-sticker-inset is that second distance, and it is 35% of
        the hero's height at each width — the hero keeps a different ratio per
        breakpoint, so the share has to be restated rather than inherited:

            small  3:4      133.33vw ... 30vw is a compromise, because the
                                         inner pages' 21:9 hero is far shorter
            tablet 16:9      56.25vw ... 19.7vw
            desktop 1920:945 49.22vw ... 17.2vw, which is 331px at 1920 —
                                         the artboard's own figure

        Laptop is deliberately absent: the hero is 16:9 there too, so it takes
        the tablet value the way the breakpoints already cascade.
    */

    .small {
        --nvm-offer-sticker-inset: 30vw;
    }

    .tablet {
        --nvm-offer-sticker-inset: 19.7vw;
    }

    .desktop {
        --nvm-offer-sticker-inset: 17.2vw;
    }

    /*
        The box is as wide as the open panel and it clips, which is the whole
        trick — and it is not decoration.

        Closed, the panel is parked one full width to the right. Fixed, that
        cost nothing: a fixed element never adds to the scrollable area. Absolute
        does. So the parked panel hung 180px past the right edge of the document
        and the page grew a horizontal scrollbar.

        That scrollbar was also the flicker. Opening slid the panel back inside,
        the overflow went away, the scrollbar with it, and the viewport got
        wider by its width — so everything measured in vw, the slideshow first
        among them, resized on every click.

        Clipping here keeps the parked panel out of the document's reckoning,
        and the page stops moving.

        pointer-events is the price of a box larger than what is drawn in it:
        the container would otherwise swallow clicks meant for the slideshow
        underneath, so it is transparent to the cursor and the two things that
        are actually visible take their clicks back.
    */

    .nvm-offer-sticker {
        position: absolute;
        top: calc( var(--nvm-header-height, 76px) + var(--nvm-offer-sticker-inset, 17.2vw) );
        right: 0;
        z-index: 120;
        width: 180px;
        overflow: hidden;   /* fallback for browsers without clip */
        overflow: clip;
        pointer-events: none;
    }

        .nvm-offer-sticker__toggle {
            position: absolute;
            top: 0;
            right: 0;
            pointer-events: auto;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 64px;
            height: 64px;
            padding: 0;
            border: none;
            box-shadow: none;
            background: var(--nvm-color-gold);
            color: var(--nvm-color-ink);
            cursor: pointer;
            transition: opacity 0.2s ease-in-out;
        }

        .nvm-offer-sticker__toggle:hover,
        .nvm-offer-sticker__toggle:focus-visible {
            background: var(--nvm-color-gold);
            opacity: 0.85;
        }

        /*
            Open, the tab has become the panel — it is the same gold square
            grown, not a second thing stacked under it. So it goes.

            visibility rather than display, so the fade can be seen and so the
            tab leaves the tab order while it is gone; display: none would
            snap, and opacity alone would leave a keyboard user landing on a
            button that is not there.
        */

        .nvm-offer-sticker.is-open .nvm-offer-sticker__toggle {
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.2s ease-in-out, visibility 0s linear 0.2s;
        }

            .nvm-offer-sticker__toggle svg {
                display: block;
                width: 24px;
                height: 24px !important;
            }

            /* responsiville.moressette.css fills every path with currentColor,
               which is what this icon wants — stated so it cannot drift. */

            .nvm-offer-sticker__toggle svg path {
                fill: currentColor;
            }



    /*
        The panel is laid out at its full size and slid out of view rather than
        hidden, so opening and closing can be animated. visibility keeps it out
        of the tab order while closed — opacity alone would leave a keyboard
        user landing on a link they cannot see.
    */

    /*
        The panel stays in the flow and gives the container its height, rather
        than being positioned over it. 180 is the artboard's square, but an
        offer written at length can make it taller and the box follows — laid
        out over it at a fixed height, the end of a long sentence would simply
        have been cut off.
    */

    .nvm-offer-sticker__panel {
        position: relative;
        pointer-events: auto;
        display: flex;
        flex-direction: column;
        gap: 14px;
        width: 100%;
        min-height: 180px;
        padding: 25px 18px;
        cursor: pointer;
        background: var(--nvm-color-gold);
        color: var(--nvm-color-ink);
        visibility: hidden;
        opacity: 0;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out, opacity 0.25s ease-in-out, visibility 0s linear 0.3s;
    }

    .nvm-offer-sticker.is-open .nvm-offer-sticker__panel {
        visibility: visible;
        opacity: 1;
        transform: translateX(0);
        transition: transform 0.3s ease-in-out, opacity 0.25s ease-in-out, visibility 0s linear 0s;
    }

        /* Focus is moved here by script when the sticker opens, which is not
           a keyboard action — so a ring is shown only when it truly was one. */

        .nvm-offer-sticker__panel:focus {
            outline: none;
        }

        .nvm-offer-sticker__panel:focus-visible {
            outline: 2px solid var(--nvm-color-ink);
            outline-offset: -4px;
        }

        .nvm-offer-sticker__text {
            font-size: 24px;
            font-weight: 700;
            line-height: 1.15;
        }

            .nvm-offer-sticker__text p {
                margin: 0;
            }

            .nvm-offer-sticker__text p + p {
                margin-top: 0.5em;
            }

        /* Text at the top of the square, link at its foot — the artboard is
           180 tall and the two are pushed apart, not merely stacked. */

        .responsiville .nvm-offer-sticker__link {
            margin-top: auto;
            align-self: flex-start;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 0;
            background: none;
            color: var(--nvm-color-ink);
            font-size: 16px;
            font-weight: 700;
            line-height: 1.3;
            text-decoration: underline;
        }

        .responsiville .nvm-offer-sticker__link:hover {
            background: none;
            opacity: 0.7;
        }



    /* On a phone the panel would cover a good part of the screen, so both the
       tab and the panel come down a size. */

    .small .nvm-offer-sticker__toggle {
        width: 48px;
        height: 48px;
    }

        .small .nvm-offer-sticker__toggle svg {
            width: 20px;
            height: 20px !important;
        }

    .small .nvm-offer-sticker {
        width: 150px;
    }

    .small .nvm-offer-sticker__panel {
        min-height: 150px;
        padding: 18px 14px;
        gap: 10px;
    }

    .small .nvm-offer-sticker__text {
        font-size: 19px;
    }

    .tablet .nvm-offer-sticker__toggle {
        width: 64px;
        height: 64px;
    }

        .tablet .nvm-offer-sticker__toggle svg {
            width: 24px;
            height: 24px !important;
        }

    .tablet .nvm-offer-sticker {
        width: 180px;
    }

    .tablet .nvm-offer-sticker__panel {
        min-height: 180px;
        padding: 25px 18px;
        gap: 14px;
    }

    .tablet .nvm-offer-sticker__text {
        font-size: 24px;
    }

    @media ( prefers-reduced-motion: reduce ) {

        .nvm-offer-sticker__panel {
            transition: opacity 0.2s linear, visibility 0s linear 0.2s;
            transform: none;
        }

        .nvm-offer-sticker.is-open .nvm-offer-sticker__panel {
            transform: none;
        }

    }
