/* ==========================================================================
   HERO — the first band of every page
   ==========================================================================
   The hero article goes in the layout's Hero section (article "Display in:
   Hero"), so #hero is the hook. The article carries only its variant class:

     hero--light   cream band, navy copy. A statement (`hero__frame`) or
                   columns (`hero__intro`: copy | divider | stat rail or card)
     hero--split   Home: headline | divider | copy + buttons, stats row below
     hero--text    dark gradient, white copy

   Decor sits in a first text element `hero-decor`: `.hero-wash` (light
   heroes) or `.hero-blobs` (Home).
   ========================================================================== */

/* Each child of the hero is held to the content column. `:where()` keeps the
   id's weight out, so the variant and page rules below override it. */
:where(#hero) .mod_article {
    > * {
        box-sizing: border-box;
        max-width: var(--container-max);
        margin-inline: auto;
        padding-inline: var(--page-gutter);
    }
    a.btn { margin-top: 0.5rem; }
    p { text-wrap: balance; }      /* even lines, no one-word last line (John, 14 Oct) */
}

/* The decor layer spans the whole band, behind the copy */
:is(.hero--light, .hero--split) .hero-decor {
    position: absolute;
    inset: 0;
    z-index: 0;
    margin: 0;
    max-width: none;
    padding-inline: 0;
    pointer-events: none;
}

/* ---- Light -------------------------------------------------------------- */
.hero--light {
    --hero-h1-gap: clamp(0.875rem, 1vw, 1.5rem);   /* H1 → lead */
    position: relative;
    overflow: clip;
    background: var(--cream);
    color: var(--body);
    padding-top: clamp(128px, 17vw, 300px);        /* clears the fixed header */
    padding-bottom: clamp(48px, 7vw, 104px);
    > * { position: relative; z-index: 1; }
    h1 {
        color: var(--heading);
        background: none;                 /* no h1 text-gradient */
        -webkit-text-fill-color: currentColor;
        font-family: var(--type-display);
        font-weight: 700;
        font-size: var(--fs-hero-h1);
        line-height: 1.04;
        margin: 0 0 var(--hero-h1-gap);
    }

    /* the eyebrow sits above the top rule */
    .hero-eyebrow { margin: 0 auto clamp(0.9rem, 1.6vw, 1.4rem); }

    /* Intro: copy | divider | rail or card, with rules above and below.
       The rules are pseudo-elements inset by the gutter: a border would
       overshoot the text. */
    .hero__intro {
        --hero-h1-gap: clamp(1.25rem, 1.85vw, 2.75rem);
        position: relative;
        padding-block: clamp(1.75rem, 3vw, 2.75rem);
        align-items: start;

        .rte {
            padding-right: 30px;
        }
    }
    .hero__intro::before, .hero__intro::after {
        content: "";
        position: absolute;
        left: var(--page-gutter);
        right: var(--page-gutter);
        height: 0;
        border-top: 1px solid var(--hairline);
        pointer-events: none;
    }
    .hero__intro::before { top: 0; }
    .hero__intro::after { bottom: 0; }
    .hero__intro > *:first-child p {
        color: var(--heading);
        font-size: clamp(1.05rem, 1.35vw, 1.25rem);
        line-height: 1.55;
        max-width: var(--hero-intro-measure, none);   /* the column is the measure */
        margin: 0 0 1.25rem;
    }
    .hero__intro a.btn { margin-top: 0.25rem; margin-bottom: 0; }

    /* Statement: rules above and below; the copy's width is a per-page dial
       (`--hero-frame-max`, set as body.page-<alias> .hero__frame in the page's
       own file). The board's gaps: 32px above the H1, 42px below. */
    .hero__frame {
        --hero-frame-max: 62%;
        position: relative;
        padding-block: clamp(1.25rem, 2.2vw, 2rem) clamp(1.5rem, 2.8vw, 2.625rem);
    }
    .hero__frame::before, .hero__frame::after {
        content: "";
        position: absolute;
        left: var(--page-gutter);
        right: var(--page-gutter);
        height: 0;
        border-top: 1px solid var(--hairline);
        pointer-events: none;
    }
    .hero__frame::before { top: 0; }
    .hero__frame::after { bottom: 0; }
    .hero__frame > * { max-width: var(--hero-frame-max); }
    .hero__frame h1 { margin: 0 0 var(--hero-h1-gap); }
    /* the frame's padding alone sets the gap to the bottom rule */
    .hero__frame :last-child { margin-bottom: 0; }
    .hero__frame p {
        color: var(--body);
        font-size: clamp(1.05rem, 1.25vw, 1.1875rem);
        line-height: 1.55;
        margin: 0;
    }
}

/* Divider between the intro's columns: desktop only, so a padded card in the
   second column (Plan Explainers' .pe-card) keeps its own padding below */
@media only screen and (min-width: 993px) {
    .hero--light .hero__intro > *:nth-child(2) {
        border-left: 1px solid var(--hairline);
        padding-left: clamp(1.75rem, 3.5vw, 3.5rem);
    }
    .hero--light .hero__intro > *:nth-child(2):not(.pe-card) { align-self: stretch; }
}

/* Stat rail: metric + caption, a hairline between each */
.hero-rail {
    display: flex; flex-direction: column;
    .stat { padding-block: clamp(1rem, 1.8vw, 1.6rem); }
    .stat:first-child { padding-top: 0; }
    .stat + .stat { border-top: 1px solid var(--hairline); }
    .num {
        display: block;
        font-family: var(--type-display);
        font-weight: 700;
        color: var(--prime);
        font-size: clamp(1.35rem, 1.9vw, 1.625rem);
        line-height: 1.1;
        margin-bottom: 0.35em;
    }
}
.hero--light .hero-rail p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.4;
    max-width: none;
}

/* The intro stacks at 992 instead of halving: half a tablet is too narrow for
   a rail or a card. `:has()` lifts these above the framework's mixed-pair rule. */
@media only screen and (max-width: 992px) {
    .hero--light .hero__intro.row:not(.no-stack):has(> .col-2-5) > :is(.col-3-5, .col-2-5) {
        flex: 0 0 100%;
    }
    .hero--light .hero__intro > *:nth-child(2) { margin-top: clamp(1.5rem, 3vw, 2rem); }
}
@media only screen and (max-width: 760px) {
    .hero--light .hero__frame > * { max-width: none; }
}

/* ---- The wash: soft cyan and pink masses behind a light hero -------------
   Markup: <div class="hero-wash"><i class="hw hw1"></i>…hw4</div>. Placed in
   a centred 2400px box (the board width) so it tracks the page column.
   Per-page dials: --wash-strength (opacity), --wash-speed (duration),
   --wash-y (shift), --wash-core (how far the colour holds before fading),
   --wash-travel (distance). */
.hero-wash {
    position: absolute;
    inset: 0;
    max-width: 2400px;
    margin-inline: auto;
    pointer-events: none;
    --wash-strength: 1;
    --wash-speed: 1;
    --wash-y: 0%;
    --wash-core: 38%;
    --wash-travel: 2.5;
    .hw {
        position: absolute;
        border-radius: 50%;
        will-change: transform;
        translate: 0 var(--wash-y);
    }
    .hw1 {   /* cyan, upper left */
        left: -20%;
        top: -14%;
        width: 64%;
        aspect-ratio: 1063 / 620;
        background: radial-gradient(closest-side,
            var(--blob-cyan) 0%, var(--blob-cyan) var(--wash-core), transparent 100%);
        opacity: calc(0.95 * var(--wash-strength));
        animation: washSink calc(16s * var(--wash-speed)) ease-in-out -7s infinite;
    }
    .hw2 {   /* pink, upper right */
        left: 34%;
        top: -18%;
        width: 78%;
        aspect-ratio: 1326 / 768;
        background: radial-gradient(closest-side,
            var(--blob-pink) 0%, var(--blob-pink) var(--wash-core), transparent 100%);
        opacity: calc(1 * var(--wash-strength));
        animation: washDrift calc(21s * var(--wash-speed)) ease-in-out -19s infinite;
    }
    .hw3 {   /* cyan, lower left */
        left: 2%;
        top: 44%;
        width: 52%;
        aspect-ratio: 1 / 0.72;
        background: radial-gradient(closest-side,
            var(--blob-cyan) 0%, var(--blob-cyan) calc(var(--wash-core) * 0.8), transparent 100%);
        opacity: calc(0.82 * var(--wash-strength));
        animation: washRise calc(18s * var(--wash-speed)) ease-in-out -23s infinite;
    }
    .hw4 {   /* pink, lower right */
        left: 52%;
        top: 38%;
        width: 66%;
        aspect-ratio: 1 / 0.62;
        background: radial-gradient(closest-side,
            var(--blob-pink) 0%, var(--blob-pink) calc(var(--wash-core) * 0.8), transparent 100%);
        opacity: calc(0.88 * var(--wash-strength));
        animation: washCircle calc(23s * var(--wash-speed)) ease-in-out -11s infinite;
    }
}
/* `translate` on .hw carries --wash-y, so these use `transform` and compose */
@keyframes washSink {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    15%  { transform: translate3d(calc(4% * var(--wash-travel)), calc(8% * var(--wash-travel)), 0) scale(1.16); }
    30%  { transform: translate3d(calc(10% * var(--wash-travel)), calc(18% * var(--wash-travel)), 0) scale(0.92); }
    45%  { transform: translate3d(calc(2% * var(--wash-travel)), calc(27% * var(--wash-travel)), 0) scale(1.18); }
    60%  { transform: translate3d(calc(-8% * var(--wash-travel)), calc(20% * var(--wash-travel)), 0) scale(0.9); }
    80%  { transform: translate3d(calc(-13% * var(--wash-travel)), calc(8% * var(--wash-travel)), 0) scale(1.12); }
    100% { transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes washDrift {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    18%  { transform: translate3d(calc(-10% * var(--wash-travel)), calc(9% * var(--wash-travel)), 0) scale(1.2); }
    36%  { transform: translate3d(calc(-22% * var(--wash-travel)), calc(16% * var(--wash-travel)), 0) scale(0.88); }
    54%  { transform: translate3d(calc(-30% * var(--wash-travel)), calc(-4% * var(--wash-travel)), 0) scale(1.18); }
    72%  { transform: translate3d(calc(-18% * var(--wash-travel)), calc(-16% * var(--wash-travel)), 0) scale(0.9); }
    88%  { transform: translate3d(calc(-6% * var(--wash-travel)), calc(-10% * var(--wash-travel)), 0) scale(1.1); }
    100% { transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes washRise {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    20%  { transform: translate3d(calc(8% * var(--wash-travel)), calc(-12% * var(--wash-travel)), 0) scale(1.22); }
    40%  { transform: translate3d(calc(17% * var(--wash-travel)), calc(-25% * var(--wash-travel)), 0) scale(0.88); }
    58%  { transform: translate3d(calc(2% * var(--wash-travel)), calc(-35% * var(--wash-travel)), 0) scale(1.18); }
    78%  { transform: translate3d(calc(-13% * var(--wash-travel)), calc(-22% * var(--wash-travel)), 0) scale(0.9); }
    100% { transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes washCircle {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    16%  { transform: translate3d(calc(11% * var(--wash-travel)), calc(-9% * var(--wash-travel)), 0) scale(1.15); }
    33%  { transform: translate3d(calc(22% * var(--wash-travel)), calc(2% * var(--wash-travel)), 0) scale(0.9); }
    50%  { transform: translate3d(calc(26% * var(--wash-travel)), calc(16% * var(--wash-travel)), 0) scale(1.2); }
    66%  { transform: translate3d(calc(8% * var(--wash-travel)), calc(24% * var(--wash-travel)), 0) scale(0.92); }
    83%  { transform: translate3d(calc(-9% * var(--wash-travel)), calc(14% * var(--wash-travel)), 0) scale(1.12); }
    100% { transform: translate3d(0, 0, 0) scale(1); }
}

/* ---- Split (Home) --------------------------------------------------------- */
/* Spacing is the board's, in proportion below 2400: 32px from the top rule to
   the headline, 63px from the headline to the stats, the copy 91px right of
   the divider. */
.hero--split {
    --hs-pad: clamp(1.25rem, 1.333vw, 2rem);         /* top rule → headline */
    --hs-gap: clamp(1.75rem, 2.625vw, 3.9375rem);    /* headline → stats rule */
    position: relative;
    overflow: clip;
    background: #FBFAF9;
    color: var(--text);
    padding-top: clamp(150px, 21vw, 400px);          /* clears the fixed header */
    padding-bottom: clamp(60px, 8vw, 120px);
    h1, h3 { color: var(--heading); }
    > * { position: relative; z-index: 1; }
    h1 {
        font-family: var(--type-display);
        font-weight: 700;
        font-size: clamp(2.1rem, 3.125vw, 4.6875rem);   /* 75 at 2400, in proportion */
        line-height: 1.15;
        margin: 0;
        background: none;
        -webkit-text-fill-color: currentColor;
    }
    h1 em { font-style: normal; font-size: 1.2em; }  /* the enlarged word */

    .hero__intro {
        position: relative;
        padding-top: var(--hs-pad);
        align-items: start;
    }
    .hero__intro::before {
        content: "";
        position: absolute;
        top: 0;
        left: var(--page-gutter);
        right: var(--page-gutter);
        height: 0;
        border-top: 1px solid var(--hairline);
        pointer-events: none;
    }
    /* The copy column stretches so its divider runs from the top rule to the
       stats rule; the copy centres on the headline */
    .hero__intro > *:nth-child(2) {
        position: relative;
        overflow: visible;
        padding-left: clamp(1.5rem, 3.8vw, 5.6875rem);
        align-self: stretch;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    .hero__intro > *:nth-child(2)::before {
        content: "";
        position: absolute;
        left: 0;
        top: calc(-1 * var(--hs-pad));
        bottom: calc(-1 * var(--hs-gap));
        border-left: 1px solid var(--hairline);
        pointer-events: none;
    }
    .hero__intro p { color: var(--heading); }
    .hero__intro a.btn { margin-top: 0.5rem; margin-bottom: 0; }

    /* Stats: rules above and below, dividers between cells */
    .hero__stats {
        position: relative;
        align-items: center;
        margin-top: var(--hs-gap);
        padding-block: clamp(1rem, 1.3vw, 1.9375rem);
    }
    .hero__stats::before, .hero__stats::after {
        content: "";
        position: absolute;
        left: var(--page-gutter);
        right: var(--page-gutter);
        height: 0;
        border-top: 1px solid var(--hairline);
        pointer-events: none;
    }
    .hero__stats::before { top: 0; }
    .hero__stats::after { bottom: 0; }
    .hero__stats > * {
        position: relative;
        text-align: center;
        padding-inline: clamp(0.5rem, 1.5vw, 1.25rem);
    }
    .hero__stats > * + * { border-left: 1px solid var(--hairline); }
    .hero__stats h3 {
        display: block;
        font-family: var(--type-display);
        font-weight: 700;
        font-size: clamp(1.1rem, 1.9vw, 1.625rem);
        line-height: 1.1;
        margin: 0 0 0.3em;
    }
    .hero__stats p {
        margin: 0;
        color: var(--text-muted);
        font-size: 0.85rem;
        line-height: 1.35;
    }
}
@media only screen and (max-width: 900px) {
    .hero--split h1 { margin-bottom: 1.25rem; }
    .hero--split .hero__intro > *:nth-child(2) { padding-left: 0; }
    .hero--split .hero__intro > *:nth-child(2)::before { content: none; }
}
/* The stats' dividers follow the cells' step-down (2-up at 992, stacked at
   600): the cell that starts a line has none (John, 16 Oct) */
@media only screen and (max-width: 992px) {
    .hero--split .hero__stats > :nth-child(odd) { border-left: 0; }
}
@media only screen and (max-width: 600px) {
    .hero--split .hero__stats > * + * { border-left: 0; }
}

/* Home's drifting blobs (the design's ellipses). --blob-speed scales the
   cycle, --blob-travel the path: set to move about as fast as the other
   heroes' wash (For Financial Advisors), John 14 Oct. */
.hero-blobs {
    position: absolute; inset: 0; pointer-events: none;
    --blob-speed: 0.6;
    --blob-travel: 2.2;
    .hb { position: absolute; height: auto; will-change: transform; }
    .hb5 { left: -8%;  top: -18%; width: 42vw; animation: heroBlobA calc(18s * var(--blob-speed)) ease-in-out infinite; }
    .hb3 { left: -16%; top: 6%;   width: 38vw; animation: heroBlobB calc(22s * var(--blob-speed)) ease-in-out infinite; }
    .hb1 { left: 20%;  top: -12%; width: 54vw; animation: heroBlobC calc(20s * var(--blob-speed)) ease-in-out infinite; }
    .hb2 { left: 44%;  top: 0%;   width: 54vw; animation: heroBlobA calc(24s * var(--blob-speed)) ease-in-out infinite; }
    .hb4 { left: 36%;  top: 18%;  width: 52vw; animation: heroBlobB calc(17s * var(--blob-speed)) ease-in-out infinite reverse; }
}
@keyframes heroBlobA {
    0%   { transform: translate(0, 0) scale(1); }
    25%  { transform: translate(calc(7% * var(--blob-travel)), calc(-6% * var(--blob-travel))) scale(1.12); }
    50%  { transform: translate(calc(-5% * var(--blob-travel)), calc(5% * var(--blob-travel))) scale(0.9); }
    75%  { transform: translate(calc(6% * var(--blob-travel)), calc(7% * var(--blob-travel))) scale(1.08); }
    100% { transform: translate(0, 0) scale(1); }
}
@keyframes heroBlobB {
    0%   { transform: translate(0, 0) scale(1); }
    25%  { transform: translate(calc(-7% * var(--blob-travel)), calc(5% * var(--blob-travel))) scale(0.88); }
    50%  { transform: translate(calc(6% * var(--blob-travel)), calc(-7% * var(--blob-travel))) scale(1.15); }
    75%  { transform: translate(calc(-5% * var(--blob-travel)), calc(-6% * var(--blob-travel))) scale(1.04); }
    100% { transform: translate(0, 0) scale(1); }
}
@keyframes heroBlobC {
    0%   { transform: translate(0, 0) scale(1); }
    33%  { transform: translate(calc(-6% * var(--blob-travel)), calc(-6% * var(--blob-travel))) scale(1.1); }
    66%  { transform: translate(calc(7% * var(--blob-travel)), calc(4% * var(--blob-travel))) scale(0.92); }
    100% { transform: translate(0, 0) scale(1); }
}

/* ---- Text (dark) ---------------------------------------------------------- */
.hero--text {
    position: relative;
    overflow: clip;
    background: var(--grad-hero);
    color: var(--white);
    padding-block: clamp(48px, 7vw, 88px);
    h1 {
        color: var(--white);
        margin: 0 0 0.4em;
        font-weight: 200;
        font-size: clamp(2.5rem, 5vw, 3.75rem);
        line-height: 1.05;
        max-width: 18ch;
    }
    p { color: rgba(255, 255, 255, 0.82); max-width: 44em; }
    .eyebrow.on-dark { margin-bottom: 0.9em; }
}

@media (prefers-reduced-motion: reduce) {
    .hero-wash .hw, .hero-blobs .hb { animation: none; }
}

/* Lead copy wraps balanced */
.hero__intro p { text-wrap: balance; }
