/* ===================================================================
   Page title hero — Views/Shared/_PageTitle.cshtml

   One banner shared by every public page. Each page supplies its own
   photo through --page-title-image; everything that keeps the wording
   readable over that photo lives here, so a new picture can never
   quietly break the heading's contrast.

   Layers, back to front:
     1. .page-title-hero        solid dark base, shown while the photo loads
     2. .page-title-hero__media the photo, slowly drifting outwards
     3. .page-title-hero__scrim dark gradient + hexagon texture
     4. .page-title-hero__content the wording
=================================================================== */

.page-title-hero {
    --page-title-ink: #ffffff;
    --page-title-shade: 8, 22, 28; /* the dark the scrim is built from, as RGB parts */
    --page-title-scrim: 0.85;
    --page-title-focus: center;
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
    isolation: isolate;
    min-height: clamp(340px, 32vw, 460px);
    padding: 70px 0;
    /* Behind the photo, so the first paint is dark rather than white: on a slow connection the
       heading is readable from the moment it appears instead of flashing dark-on-dark. */
    background-color: rgb(var(--page-title-shade));
}

.page-title-hero--compact {
    min-height: clamp(260px, 23vw, 340px);
    padding: 56px 0;
}

/* 2. The photo ---------------------------------------------------- */
.page-title-hero__media {
    position: absolute;
    inset: 0;
    z-index: -2;
    display: block;
    background-image: var(--page-title-image);
    background-position: var(--page-title-focus);
    background-size: cover;
    background-repeat: no-repeat;
    /* A touch of bite, so the photo still looks crisp through the shade rather than washed out. */
    filter: saturate(1.06) contrast(1.04);
    /* Starts a touch oversized and drifts out, so the banner has some life without anything moving
       under the reader's eye. */
    transform: scale(1.04);
    animation: page-title-hero-drift 20s ease-out forwards;
    will-change: transform;
}

@keyframes page-title-hero-drift {
    from { transform: scale(1.04); }
    to   { transform: scale(1.12); }
}

/* 3. The scrim ---------------------------------------------------- */
.page-title-hero__scrim {
    position: absolute;
    inset: 0;
    z-index: -1;
    display: block;
    opacity: var(--page-title-scrim);
    background-image:
        /* A pool of shade sitting under the wording and fading out well before the right-hand
           edge. Darkening only where the letters are is what lets the rest of the photo stay
           bright: a veil across the whole banner would cost the picture far more than it buys
           the text. */
        radial-gradient(105% 135% at 6% 50%,
            rgba(var(--page-title-shade), 0.92) 0%,
            rgba(var(--page-title-shade), 0.84) 32%,
            rgba(var(--page-title-shade), 0.52) 54%,
            rgba(var(--page-title-shade), 0.16) 72%,
            rgba(var(--page-title-shade), 0) 86%),
        /* A whisper of shade top and bottom — it settles the banner against the header and the
           section below without touching the middle of the picture. */
        linear-gradient(180deg,
            rgba(var(--page-title-shade), 0.26) 0%,
            rgba(var(--page-title-shade), 0.04) 38%,
            rgba(var(--page-title-shade), 0.06) 62%,
            rgba(var(--page-title-shade), 0.32) 100%);
    background-size: cover, cover;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
}

/* Centred banners need the pool in the middle instead of down one side. */
.page-title-hero--center .page-title-hero__scrim {
    background-image:
        radial-gradient(95% 125% at 50% 50%,
            rgba(var(--page-title-shade), 0.88) 0%,
            rgba(var(--page-title-shade), 0.76) 38%,
            rgba(var(--page-title-shade), 0.40) 62%,
            rgba(var(--page-title-shade), 0.08) 88%,
            rgba(var(--page-title-shade), 0) 100%),
        linear-gradient(180deg,
            rgba(var(--page-title-shade), 0.26) 0%,
            rgba(var(--page-title-shade), 0.04) 38%,
            rgba(var(--page-title-shade), 0.06) 62%,
            rgba(var(--page-title-shade), 0.32) 100%);
}

/* A hairline of the brand colour along the bottom edge, where the banner meets the page. */
.page-title-hero::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 3px;
    background: linear-gradient(90deg, var(--base-color) 0%, rgba(24, 188, 199, 0) 85%);
}

/* 4. The wording -------------------------------------------------- */
.page-title-hero__content {
    position: relative;
    z-index: 1;
}

.page-title-hero--center .page-title-hero__content {
    margin: 0 auto;
    text-align: center;
}

.page-title-hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    font-family: var(--alt-font);
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    /* A light tint of the brand colour rather than the brand colour itself: #18bcc7 on this scrim
       sits under the 4.5:1 contrast mark, this clears it. */
    color: #8fe9f1;
}

.page-title-hero__eyebrow::before {
    content: "";
    width: 42px;
    height: 2px;
    flex: none;
    background-color: var(--base-color);
}

.page-title-hero__title {
    margin-bottom: 20px;
    font-family: var(--alt-font);
    font-size: clamp(2.1rem, 1.15rem + 2.7vw, 3.6rem);
    line-height: 1.08;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--page-title-ink);
    /* Two shadows, since the shade is now a pool rather than a blanket: a tight one for a crisp
       edge against a bright patch of photo, and a wide, soft one that pads the letters out. */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.32), 0 4px 30px rgba(0, 0, 0, 0.5);
}

.page-title-hero__lead {
    max-width: 62ch;
    margin-bottom: 0;
    font-size: 17px;
    line-height: 30px;
    color: rgba(255, 255, 255, 0.86);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 18px rgba(0, 0, 0, 0.5);
}

.page-title-hero--center .page-title-hero__lead {
    margin-left: auto;
    margin-right: auto;
}

.page-title-hero__crumbs {
    margin-top: 28px;
    font-size: 14px;
    line-height: 20px;
}

.page-title-hero__crumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
    color: rgba(255, 255, 255, 0.7);
}

.page-title-hero--center .page-title-hero__crumbs ol {
    justify-content: center;
}

.page-title-hero__crumbs li + li::before {
    content: "/";
    margin: 0 10px;
    color: rgba(255, 255, 255, 0.4);
}

.page-title-hero__crumbs a {
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    transition: color 0.3s ease-in-out;
}

.page-title-hero__crumbs a:hover,
.page-title-hero__crumbs a:focus-visible {
    color: var(--base-color);
}

/* Smaller screens ------------------------------------------------- */
@media (max-width: 991px) {
    .page-title-hero {
        min-height: clamp(280px, 46vw, 380px);
        padding: 56px 0;
    }

    .page-title-hero--compact {
        min-height: 240px;
        padding: 44px 0;
    }

    /* The wording runs the full width of a phone, so there is nowhere to fade out sideways. The
       shade runs down the banner instead: the top strip stays clear for the photo, and it deepens
       from there, under the heading and everything below it. */
    .page-title-hero__scrim,
    .page-title-hero--center .page-title-hero__scrim {
        background-image:
            linear-gradient(180deg,
                rgba(var(--page-title-shade), 0.28) 0%,
                rgba(var(--page-title-shade), 0.56) 18%,
                rgba(var(--page-title-shade), 0.80) 36%,
                rgba(var(--page-title-shade), 0.86) 100%),
            linear-gradient(0deg,
                rgba(var(--page-title-shade), 0.08) 0%,
                rgba(var(--page-title-shade), 0.08) 100%);
    }

    .page-title-hero__content,
    .page-title-hero--center .page-title-hero__content {
        text-align: left;
    }

    .page-title-hero--center .page-title-hero__crumbs ol {
        justify-content: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .page-title-hero__media {
        animation: none;
        transform: none;
    }
}

/* Windows high contrast and forced-colour modes drop the photo entirely; without this the heading
   would be left sitting on an untreated picture. */
@media (forced-colors: active) {
    .page-title-hero__media,
    .page-title-hero__scrim {
        display: none;
    }
}
