/* The homepage's bleed: on a phone the page dissolves into the status bar and the Safari toolbar instead of
   stopping at a hard edge, as on the service films. iOS Safari 26 tints its bars from what the page draws under them,
   so each fade lands on solid colour at the very edge and the bar takes it: page, fade and bar read as one surface.
   The homepage changes colour as it scrolls (the paper hero, white cards, the navy figures and call to action, the
   navy footer), so each edge takes the colour of the section under it (edge-bleed.js) and cross-fades to the next.
   The element spans 100lvh from the top, not bottom: 0, which would sit above Safari's collapsed toolbar.
   Solid through the safe area, then several stops: a linear ramp bands on an OLED screen. Touch screens only. */
/* Safari 26 takes a fixed edge element's background-color as the colour of its bar, flat and with a hard line, so
   the fades are gradient images, never a background-color (a colour with a mask read as solid cream bars). The
   colours are registered so they can still cross-fade inside the gradients. */
@property --edge-t { syntax: "<color>"; inherits: true; initial-value: #F4F2EC; }
@property --edge-b { syntax: "<color>"; inherits: true; initial-value: #F4F2EC; }
.edge-bleed { display: none; }
@media (hover: none) and (pointer: coarse) {
    .edge-bleed {
        --edge-th: calc(env(safe-area-inset-top, 0px) + 140px);
        --edge-bh: calc(100lvh - 100svh + env(safe-area-inset-bottom, 0px) + 72px);
        display: block; position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100lvh;
        z-index: 800; pointer-events: none;   /* over the content, under the cart button (900), toasts and every overlay */
    }
    /* main.css lifts every section after the hero's stage (html.hero-film .v8-stage-track ~ *: relative, z 5), and
       this layer is one of those siblings: without this it sat at the end of the page instead of on the screen */
    html.hero-film .v8-stage-track ~ .edge-bleed { position: fixed; z-index: 800; }
    .edge-bleed { transition: --edge-t .35s ease, --edge-b .35s ease; }
    .edge-bleed::before, .edge-bleed::after { content: ""; position: absolute; inset: 0; background-repeat: no-repeat; transition: opacity .35s ease; }
    /* top: only while the header is clear (over the hero); once it turns solid, the header itself meets the bar */
    .edge-bleed::before {
        background-image: linear-gradient(180deg, var(--edge-t) env(safe-area-inset-top, 0px),
            color-mix(in srgb, var(--edge-t) 86%, transparent) calc(env(safe-area-inset-top, 0px) + 24px),
            color-mix(in srgb, var(--edge-t) 46%, transparent) calc(env(safe-area-inset-top, 0px) + 60px),
            color-mix(in srgb, var(--edge-t) 14%, transparent) calc(env(safe-area-inset-top, 0px) + 100px),
            color-mix(in srgb, var(--edge-t) 0%, transparent) 100%);
        background-position: top; background-size: 100% var(--edge-th);
    }
    html:has(.navbar-area.scrolled) .edge-bleed::before { opacity: 0; }
    /* The caps: what Safari reads for its bars. The fades are images, which it passes over, so without these the
       status bar fell back to white over the hero. Each is a real background-color, sized to the safe area, where
       its fade is already solid in the same colour, so it draws nothing new. The top cap goes once the header is
       solid, and the header's own paper (the same colour) takes the bar. */
    .edge-bleed__cap { position: absolute; left: 0; right: 0; transition: background-color .35s ease; }
    .edge-bleed__cap--t { top: 0; height: env(safe-area-inset-top, 0px); background-color: var(--edge-t); }
    .edge-bleed__cap--b { bottom: 0; height: env(safe-area-inset-bottom, 0px); background-color: var(--edge-b); }
    html:has(.navbar-area.scrolled) .edge-bleed__cap--t { display: none; }
    .edge-bleed::after {
        background-image: linear-gradient(0deg, var(--edge-b) env(safe-area-inset-bottom, 0px),
            color-mix(in srgb, var(--edge-b) 90%, transparent) 24%, color-mix(in srgb, var(--edge-b) 60%, transparent) 46%,
            color-mix(in srgb, var(--edge-b) 25%, transparent) 70%, color-mix(in srgb, var(--edge-b) 0%, transparent) 100%);
        background-position: bottom; background-size: 100% var(--edge-bh);
    }
    /* the page ends clear of the bottom fade, so the last links are not dimmed */
    html:has(.edge-bleed) .footer { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 72px); }
}
@media (prefers-reduced-motion: reduce) { .edge-bleed, .edge-bleed::before, .edge-bleed::after, .edge-bleed__cap { transition: none; } }
