/* ===================================================================
   Hero: the whole top of a page is green and ends in a wave (assets/top-wave.svg, made by build-wave.php).
   The menu sits on the green, see-through; once the page scrolls it turns into the normal white bar.
   =================================================================== */

.hero {
    position: relative;
    overflow: hidden;
    isolation: isolate;

    /* slide up under the sticky header, so the green starts at the very top of the window */
    margin-top: calc(-1 * var(--header-height));
    padding-top: var(--header-height);

    background: linear-gradient(180deg, var(--hero-top), var(--hero-bottom));
    color: var(--on-hero);
}

.hero > :not(.hero-wave) {
    position: relative;
    z-index: 1;
}

.hero-wave {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    z-index: 0;

    /* same proportions as the drawing; on a narrow screen it keeps a minimum height and the sides are cropped */
    height: max(220px, 29.2vw);

    /* the ground under the layers melts into the page colour, so the green never ends in a hard edge */
    background: linear-gradient(
        180deg,
        transparent 0%,
        color-mix(in srgb, var(--color-bg) 10%, transparent) 38%,
        color-mix(in srgb, var(--color-bg) 55%, transparent) 72%,
        var(--color-bg) 100%
    );

    overflow: hidden;
    pointer-events: none;
}

.hero-wave svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* on a phone, slide the drawing so its highest peak sits in the middle of the screen */
@media (max-width: 600px) {

    .hero-wave svg {
        width: 200%;
        max-width: none;
        margin-left: -80%;
    }
}

/* ===== the menu on top of the green (only while the page is not scrolled and the mobile sheet is closed) ===== */

body:has(.hero) .site-header:not(.is-scrolled):not(.is-open) {
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom-color: transparent;
}

body:has(.hero) .site-header:not(.is-scrolled):not(.is-open) :is(.nav-link, .nav-trigger, .btn-login, .nav-icon-btn, .nav-burger) {
    color: var(--on-hero);
}

body:has(.hero) .site-header:not(.is-scrolled):not(.is-open) :is(.nav-link, .nav-trigger, .btn-login, .nav-icon-btn):hover,
body:has(.hero) .site-header:not(.is-scrolled):not(.is-open) .has-menu.open > .nav-trigger {
    color: var(--on-hero);
    background: color-mix(in srgb, var(--on-hero) 12%, transparent);
}

body:has(.hero) .site-header:not(.is-scrolled):not(.is-open) .nav-link[aria-current="page"] {
    background: color-mix(in srgb, var(--on-hero) 12%, transparent);
}

/* "Live demo" on the green: still no fill, a delicate dark border; the live dot (also in the green hero and the green last
   call) turns dark green so it stays visible */
body:has(.hero) .site-header:not(.is-scrolled):not(.is-open) .nav-demo {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--on-hero) 38%, transparent);
}

:root:not([data-theme="dark"]) body:has(.hero) .site-header:not(.is-scrolled):not(.is-open) .live-pulse,
:root:not([data-theme="dark"]) .hero .live-pulse,
:root:not([data-theme="dark"]) .cta-band .live-pulse {
    --pulse: var(--color-green-ink);
}

/* the opened mobile sheet is plain white from the bar down */
body:has(.hero) .site-header.is-open {
    background: var(--color-bg);
}

/* logo, version 2: dark lettering and white "ee" (the green eyes would vanish on green) */

:root:not([data-theme="dark"]) body:has(.hero) .site-header:not(.is-scrolled):not(.is-open) .nav-logo .logo-light {
    display: none;
}

:root:not([data-theme="dark"]) body:has(.hero) .site-header:not(.is-scrolled):not(.is-open) .nav-logo .logo-band {
    display: block;
}

/* the button: green on green would disappear, so it turns dark (light theme only) */

:root:not([data-theme="dark"]) body:has(.hero) .site-header:not(.is-scrolled):not(.is-open) .btn-cta {
    background: var(--color-green-ink);
    color: #ffffff;
    box-shadow: none;
}

:root:not([data-theme="dark"]) body:has(.hero) .site-header:not(.is-scrolled):not(.is-open) .btn-cta:hover {
    background: #0a4a26;
    box-shadow: 0 10px 22px -12px rgba(5, 46, 22, .6);
}
