/* ============================================================
   hero.css — the Hero component: photo, scrim, layout, buttons
   ============================================================
   Everything the Hero component's panel choices turn into CSS. The
   panel writes classes onto the section (.hero-overlay--*,
   .hero-overlay-shape--*, .hero-lines--*, .section--content-*, .section--height-*, .section--on-light,
   .section--hero-*), onto the Bricks Container (.stacked-align-*) and
   onto the content block (.stacked-height-*); the "Hero Media" element
   (elements/hero-media.php) renders the photo as <picture class=
   "hero-media">. Section modifiers that are not hero-specific (surface,
   size, divider) stay in layout.css; the hero's buttons keep their base
   look from buttons.css and get only their in-hero behaviour here.
   Moved here from layout.css §3, buttons.css §3/§5/§6 and hero-media.css
   on 2026-09-07 (backlog row 45) — one component, one file.
   Conventions: _shared/bricks-builder/css-conventions.md

   Contents
     1. Frame & photo — the section is the query container
     2. Focus — the mobile focus takes over when the hero stacks
     3. Overlay — the scrim (Even, Linear, Radial) and Line background
     4. Light photo — text tokens, and how page Dark Mode flips it
     5. Content position
     6. Height — the panel's Height choice (wide hero)
     7. Content block width
     8. Stacked — the one @container rule
     9. Colour voice and buttons — token remap, wash on a photo, full-width row, text link
    10. Header on top of the photo — clearance and header overlay

   Last updated: 2026-10-20 (auto-stamped by the pre-commit hook)
   ============================================================ */


/* ------------------------------------------------------------
   1. Frame & photo — the section is the query container
   ------------------------------------------------------------
   The picture is absolutely positioned over the whole section, below
   the content (z-index -2 inside the section's own stacking context).
   The Even scrim is the picture's ::after; Linear and Radial sit on the
   text block's ::before at z-index -1 (section 3), above the photo and
   below the text.

   The section is also the hero's QUERY CONTAINER: every "when the hero
   is narrow" rule asks the section's own inline size, never the screen
   (rung 2 of the responsive ladder). A container cannot style itself
   from its own size — which is exactly why the scrim, the alignment and
   the height rules all target children of the section.
   ------------------------------------------------------------ */

.brxe-section:has(> .hero-media) {
    position: relative;
    isolation: isolate;
    container: hero / inline-size;
    /* Clips the scrim, which reaches past the text (section 3), so the
       page never scrolls sideways. */
    overflow: clip;

    /* The defaults: one place for every panel number, used when a field
       is empty. The builder script shows them as grey placeholder text in
       the empty field. Strength per shape: section 3. */
    --hero-content-width-default: 50%;
    --overlay-strength-default: 45%;
    /* Even on a stacked hero follows the hero's own Strength. */
    --overlay-strength-mobile-default: var(--overlay-strength, var(--overlay-strength-default));
    --overlay-linear-length-default: 0.75;
    --overlay-linear-start-default: 0;
    --overlay-radial-x-default: 0;
    --overlay-radial-y-default: 0;
    --overlay-radial-x-mobile-default: 0;
    --overlay-radial-y-mobile-default: 0;
    --overlay-radial-reach-default: 0.4;
    --header-overlay-strength-default: 65%;
    --header-overlay-height-default: 3;   /* header heights */
    --hero-text-position-default: 0.5;    /* the middle */
    --hero-text-position-mobile-default: 0;   /* the top (section 8) */

    /* One grid column, so the stacked hero can put the image BELOW the
       text (section 8b uses `order`). The Section Theme Style says block.
       Grid, not a flex column: Bricks forces flex-wrap: wrap on sections
       under 768 px (frontend.min.css), and in a wrapping column the
       image's aspect-ratio height collapsed to 0 (measured 10-10-2026).
       The picture is out of flow whenever it lies behind the text, so
       nothing else changes. Set here, outside the container query: a
       container cannot style itself from its own size. */
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

/* The hero's own top and bottom space sits on the Bricks Container, not
   on the section: the stacked hero (section 8) can then set its own,
   because a container query can style the section's children but never
   the section itself. The section's .section--spacious padding is
   switched off here (the class stays: the panel writes it). */
.brxe-section:has(> .hero-media),
.brxe-section.section--spacious:has(> .hero-media) {
    padding-block: 0;
}

/* The panel's "Text position (vertical)" (row 161, Katrine 11-10-2026):
   0 puts the text at the top, 50 in the middle (empty field), 100 at the
   bottom. The hero's air is ONE budget — twice --space-2xl plus the bar
   under a transparent header (section 10) — shared between top and
   bottom, so a Content decides hero keeps its height at every number.
   0–50 and 50–100 each move in a straight line, so every number moves
   the text. The ends keep --space-m clear of the bar and of the bottom
   edge (Katrine's choice 12-10-2026); a focus ring is never clipped. */
.brxe-section:has(> .hero-media) > .brxe-container {
    --hero-text-position-now: var(--hero-text-position, var(--hero-text-position-default));
    --hero-air: calc(2 * var(--space-2xl) + var(--hero-top-extra, 0rem));
    --hero-air-half: calc(var(--hero-air) / 2);
    /* Never past the middle, so 50 is always the middle. */
    --hero-air-top-minimum: min(var(--hero-air-half), var(--hero-top-extra, 0rem) + var(--space-m));
    --hero-air-bottom-minimum: min(var(--hero-air-half), var(--space-m));
    --hero-air-top: calc(
        var(--hero-air-half)
        + min(0, var(--hero-text-position-now) - 0.5) * 2 * (var(--hero-air-half) - var(--hero-air-top-minimum))
        + max(0, var(--hero-text-position-now) - 0.5) * 2 * (var(--hero-air-half) - var(--hero-air-bottom-minimum))
    );
    padding-block: var(--hero-air-top) calc(var(--hero-air) - var(--hero-air-top));
}

/* Two empty fillers above and below the text share the room a screen
   height adds (section 6) by the same number; without that room they
   are 0 tall. The Container's Row gap is 0 in the Hero master, so the
   fillers add no gap. Empty: nothing to read, focus or click. */
.brxe-section:has(> .hero-media) > .brxe-container::before,
.brxe-section:has(> .hero-media) > .brxe-container::after {
    content: "";
    flex-shrink: 0;
    flex-basis: 0;
}
.brxe-section:has(> .hero-media) > .brxe-container::before {
    flex-grow: var(--hero-text-position-now);
}
.brxe-section:has(> .hero-media) > .brxe-container::after {
    flex-grow: calc(1 - var(--hero-text-position-now));
}

/* The panel's "Image shape": the ratio the stacked hero gives an image
   that stands above or below the text (section 8b). Set here for the
   same reason; read only inside the container query. "The image's own
   shape" = no class = the image's natural ratio. */
.hero-image-shape--21-9 { --hero-image-shape: 21 / 9; }
.hero-image-shape--2-1 { --hero-image-shape: 2 / 1; }
.hero-image-shape--16-9 { --hero-image-shape: 16 / 9; }
.hero-image-shape--3-2 { --hero-image-shape: 3 / 2; }
.hero-image-shape--4-3 { --hero-image-shape: 4 / 3; }

.hero-media {
    position: absolute;
    inset: 0;
    z-index: -2;
    display: block;
}

.hero-media img {
    display: block;
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
    object-position: var(--hero-focus, 50% 50%);
}


/* ------------------------------------------------------------
   2. Focus — the mobile focus takes over when the hero stacks
   ------------------------------------------------------------
   Desktop focus applies always (above). Below 56rem the hero stacks and
   the mobile image shows (hero-media.php, the <source> media query), so
   the MOBILE focus takes over at the same point. 56rem is the stacking
   point in section 8; change all three together.
   ------------------------------------------------------------ */

@container hero (inline-size < 56rem) {
    .hero-media img {
        object-position: var(--hero-focus-mobile, var(--hero-focus, 50% 50%));
    }
}


/* ------------------------------------------------------------
   3. Overlay — the scrim
   ------------------------------------------------------------
   The Overlay choice writes two classes on the section: the scrim's
   colour (.hero-overlay--dark / --light) and its shape
   (.hero-overlay-shape--even / --linear / --radial / --lines). A colour
   without a shape draws nothing. The "No overlay" choices write neither.
     Even    — a flat cover on the photo.
     Linear  — dark from the photo's edge to the text's far edge, then a
               soft fade. Centred text: a band that fades to both sides.
     Radial  — a soft ellipse around the text.
     Lines   — no scrim: a background behind each line of text.
   Linear and Radial are painted on the TEXT BLOCK's ::before, one layer
   below the text and above the photo (z-index -1 inside the section's
   stacking context, photo at -2), so they follow the text wherever it
   sits and however wide the box is. Every fade is a smooth S-curve
   (eleven steps of a smoothstep): a fade that changes speed at a stop
   shows as a ring around the text (Katrine's trial page, 08-10-2026).

   Knobs. A hero's own numbers arrive on the section from the panel
   (inc/hero-panel-numbers.php); an empty field uses the default in
   section 1 (Strength's per shape below):
     --overlay-strength          how dark the scrim is behind the text
     --overlay-strength-mobile   the same when the hero is stacked
     --overlay-linear-length     Linear: the fade, as a share of the text (0.75)
     --overlay-linear-start      Linear: how far in over the text the fade starts (0)
     --overlay-radial-x / -y     Radial: moves the ellipse, share of the text (0)
     --overlay-radial-x-mobile / --overlay-radial-y-mobile
     --overlay-radial-reach      Radial: least reach past the text at an edge (0.4)
     --overlay-tint              the scrim colour (--overlay-dark / --overlay-light)
   Measured by assets/js/hero-follow-text.js on the text block; without
   the script the scrim follows the block's own edges:
     --hero-text-x / -y / -width / -height / -room
   ------------------------------------------------------------ */

/* --- Strength's defaults per shape (the rest are in section 1) --- */
:is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--linear {
    --overlay-strength-default: 80%;
    --overlay-strength-mobile-default: 60%;
}
:is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--radial {
    --overlay-strength-default: 60%;
    --overlay-strength-mobile-default: 85%;
}

/* --- Even: a flat cover on the photo ---
   A plain colour, not a two-stop gradient: Firefox drew a hairline seam
   through the gradient on the fractional-height box (Katrine, 04-09). */
:is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--even > .hero-media::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;   /* above the <img>, inside the picture's own stacking context */
}
.hero-overlay--dark.hero-overlay-shape--even > .hero-media::after {
    background-color: color-mix(in srgb, var(--overlay-tint, var(--overlay-dark)) var(--overlay-strength, var(--overlay-strength-default)), transparent);
}
.hero-overlay--light.hero-overlay-shape--even > .hero-media::after {
    background-color: color-mix(in srgb, var(--overlay-tint, var(--overlay-light)) var(--overlay-strength, var(--overlay-strength-default)), transparent);
}

/* --- Linear and Radial: behind the text --- */
:is(.hero-overlay--dark, .hero-overlay--light):is(.hero-overlay-shape--linear, .hero-overlay-shape--radial) > .brxe-container > .brxe-block {
    position: relative;

    --tx: var(--hero-text-x, 0px);
    --ty: var(--hero-text-y, 0px);
    --tw: var(--hero-text-width, 100%);
    --th: var(--hero-text-height, 100%);
    --tint-now: var(--overlay-tint, var(--overlay-dark));
    --strength-now: var(--overlay-strength, var(--overlay-strength-default));
    --fade: calc(var(--tw) * var(--overlay-linear-length, var(--overlay-linear-length-default)));
    --inset: calc(var(--tw) * var(--overlay-linear-start, var(--overlay-linear-start-default)));
    /* The S-curve: each step is a share of the strength. */
    --s0: transparent;
    --s1: color-mix(in srgb, var(--tint-now) calc(var(--strength-now) * 0.028), transparent);
    --s2: color-mix(in srgb, var(--tint-now) calc(var(--strength-now) * 0.104), transparent);
    --s3: color-mix(in srgb, var(--tint-now) calc(var(--strength-now) * 0.216), transparent);
    --s4: color-mix(in srgb, var(--tint-now) calc(var(--strength-now) * 0.352), transparent);
    --s5: color-mix(in srgb, var(--tint-now) calc(var(--strength-now) * 0.5), transparent);
    --s6: color-mix(in srgb, var(--tint-now) calc(var(--strength-now) * 0.648), transparent);
    --s7: color-mix(in srgb, var(--tint-now) calc(var(--strength-now) * 0.784), transparent);
    --s8: color-mix(in srgb, var(--tint-now) calc(var(--strength-now) * 0.896), transparent);
    --s9: color-mix(in srgb, var(--tint-now) calc(var(--strength-now) * 0.972), transparent);
    --s10: color-mix(in srgb, var(--tint-now) var(--strength-now), transparent);
}
.hero-overlay--light:is(.hero-overlay-shape--linear, .hero-overlay-shape--radial) > .brxe-container > .brxe-block {
    --tint-now: var(--overlay-tint, var(--overlay-light));
}
:is(.hero-overlay--dark, .hero-overlay--light):is(.hero-overlay-shape--linear, .hero-overlay-shape--radial) > .brxe-container > .brxe-block::before {
    content: "";
    position: absolute;
    z-index: -1;
    pointer-events: none;
}

/* Radial: a soft ellipse centred on the text. It reaches up to 60 % of
   the text's width past each side, but no further than the room to the
   hero's nearest side edge (at least --overlay-radial-reach), so it is
   never cut off on one side only. Full strength to 30 % of the way out,
   then the S-curve to clear at the edge. */
:is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--radial > .brxe-container > .brxe-block {
    --reach-x: min(var(--tw) * 0.6, max(var(--tw) * var(--overlay-radial-reach, var(--overlay-radial-reach-default)), var(--hero-text-room, 9999px)));
    --shift-x: var(--overlay-radial-x, var(--overlay-radial-x-default));
    --shift-y: var(--overlay-radial-y, var(--overlay-radial-y-default));
}
:is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--radial > .brxe-container > .brxe-block::before {
    left: calc(var(--tx) - var(--reach-x) + var(--tw) * var(--shift-x));
    top: calc(var(--ty) - var(--th) * 0.7 + var(--th) * var(--shift-y));
    width: calc(var(--tw) + var(--reach-x) * 2);
    height: calc(var(--th) * 2.4);
    background-image: radial-gradient(
        closest-side,
        var(--s10) 0%,
        var(--s10) 30%,
        var(--s9) 37%,
        var(--s8) 44%,
        var(--s7) 51%,
        var(--s6) 58%,
        var(--s5) 65%,
        var(--s4) 72%,
        var(--s3) 79%,
        var(--s2) 86%,
        var(--s1) 93%,
        var(--s0) 100%
    );
}

/* Linear: covers the photo's whole height (the section clips it). */
:is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--linear > .brxe-container > .brxe-block::before {
    top: -100vh;
    bottom: -100vh;
}
/* Text on the right: dark from the right edge, fading out to the left. */
:is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--linear.section--content-right > .brxe-container > .brxe-block::before {
    left: calc(var(--tx) + var(--inset) - var(--fade));
    right: -100vw;
    background-image: linear-gradient(to right,
        var(--s0) 0,
        var(--s1) calc(var(--fade) * 0.1),
        var(--s2) calc(var(--fade) * 0.2),
        var(--s3) calc(var(--fade) * 0.3),
        var(--s4) calc(var(--fade) * 0.4),
        var(--s5) calc(var(--fade) * 0.5),
        var(--s6) calc(var(--fade) * 0.6),
        var(--s7) calc(var(--fade) * 0.7),
        var(--s8) calc(var(--fade) * 0.8),
        var(--s9) calc(var(--fade) * 0.9),
        var(--s10) var(--fade));
}
/* Text on the left: the mirror image. */
:is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--linear.section--content-left > .brxe-container > .brxe-block::before {
    left: -100vw;
    right: calc(100% - var(--tx) - var(--tw) + var(--inset) - var(--fade));
    background-image: linear-gradient(to left,
        var(--s0) 0,
        var(--s1) calc(var(--fade) * 0.1),
        var(--s2) calc(var(--fade) * 0.2),
        var(--s3) calc(var(--fade) * 0.3),
        var(--s4) calc(var(--fade) * 0.4),
        var(--s5) calc(var(--fade) * 0.5),
        var(--s6) calc(var(--fade) * 0.6),
        var(--s7) calc(var(--fade) * 0.7),
        var(--s8) calc(var(--fade) * 0.8),
        var(--s9) calc(var(--fade) * 0.9),
        var(--s10) var(--fade));
}
/* Centred text: a band behind the text that fades out to both sides. */
:is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--linear.section--content-center > .brxe-container > .brxe-block::before {
    left: calc(var(--tx) + var(--inset) - var(--fade));
    width: calc(var(--tw) - var(--inset) * 2 + var(--fade) * 2);
    background-image: linear-gradient(to right,
        var(--s0) 0,
        var(--s1) calc(var(--fade) * 0.1),
        var(--s2) calc(var(--fade) * 0.2),
        var(--s3) calc(var(--fade) * 0.3),
        var(--s4) calc(var(--fade) * 0.4),
        var(--s5) calc(var(--fade) * 0.5),
        var(--s6) calc(var(--fade) * 0.6),
        var(--s7) calc(var(--fade) * 0.7),
        var(--s8) calc(var(--fade) * 0.8),
        var(--s9) calc(var(--fade) * 0.9),
        var(--s10) var(--fade),
        var(--s10) calc(100% - var(--fade)),
        var(--s9) calc(100% - var(--fade) * 0.9),
        var(--s8) calc(100% - var(--fade) * 0.8),
        var(--s7) calc(100% - var(--fade) * 0.7),
        var(--s6) calc(100% - var(--fade) * 0.6),
        var(--s5) calc(100% - var(--fade) * 0.5),
        var(--s4) calc(100% - var(--fade) * 0.4),
        var(--s3) calc(100% - var(--fade) * 0.3),
        var(--s2) calc(100% - var(--fade) * 0.2),
        var(--s1) calc(100% - var(--fade) * 0.1),
        var(--s0) 100%);
}

/* --- Line background: a background behind each line of text ---
   No scrim on the photo. The text's .line-background spans (inc/
   hero-line-background.php) get the tint instead; each line keeps its own
   padding (box-decoration-break). Strength 100 % = solid, lower = see-through.
   "Line background on" picks the parts: .hero-lines--title,
   .hero-lines--subtitle-description, else all text. A badge keeps its own pill. */
:is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--lines {
    --overlay-strength-default: 100%;
}
:is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--lines > .brxe-container > .brxe-block {
    --line-tint: var(--overlay-tint, var(--overlay-dark));
    --line-strength: var(--overlay-strength, var(--overlay-strength-default));
}
.hero-overlay--light.hero-overlay-shape--lines > .brxe-container > .brxe-block {
    --line-tint: var(--overlay-tint, var(--overlay-light));
}
:is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--lines:not(.hero-lines--subtitle-description, .hero-lines--title) > .brxe-container > .brxe-block .line-background,
:is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--lines.hero-lines--title > .brxe-container > .brxe-block .headline-title > .line-background,
:is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--lines.hero-lines--subtitle-description > .brxe-container > .brxe-block :is(.subtitle, .brxe-text) .line-background {
    background-color: color-mix(in srgb, var(--line-tint) var(--line-strength), transparent);
    padding: 0.05em 0.3em;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}
/* Lists: the background starts at the marker, so the tick sits on it too. */
:is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--lines:not(.hero-lines--title) > .brxe-container > .brxe-block :is(.list--check, .list--bullet) > li:has(> .line-background) {
    padding-inline-start: 0;
}
:is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--lines:not(.hero-lines--title) > .brxe-container > .brxe-block :is(.list--check, .list--bullet) > li:has(> .line-background)::before {
    inset-inline-start: 0.3em;
}
:is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--lines:not(.hero-lines--title) > .brxe-container > .brxe-block .list--check > li > .line-background {
    padding-inline-start: calc(1.85em + 0.3em);   /* list.css' tick gutter */
}
:is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--lines:not(.hero-lines--title) > .brxe-container > .brxe-block .list--bullet > li > .line-background {
    padding-inline-start: calc(1.25em + 0.3em);   /* list.css' bullet gutter */
}
/* The builder canvas draws the description without the spans: one box
   per paragraph there, the nearest look. */
:is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--lines:not(.hero-lines--title) > .brxe-container > .brxe-block .brxe-text:not(:has(.line-background)) > :is(p, ul, ol) {
    inline-size: fit-content;
    background-color: color-mix(in srgb, var(--line-tint) var(--line-strength), transparent);
    padding: 0.05em 0.3em;
}


/* ------------------------------------------------------------
   4. Light photo — text tokens, and how page Dark Mode flips it
   ------------------------------------------------------------
/* Text over a LIGHT photo (with or without a light scrim): body text
   goes to solid black and headings to near-black for a firmer contrast
   margin than the page defaults (Katrine, 15-08). The mirror image of
   .section--dark-neutral for the dark states — a token remap on the
   section, so every element inside stays token-driven. Every light
   Hero option carries it. */
.section--on-light {
    --text-base: var(--black);
    --text-heading: var(--grey-900);
    /* Re-read the token here: body resolves --text-base once and passes
       the COLOUR down, so a remap alone would never reach the text
       (same reason .section--dark sets color itself). */
    color: var(--text-base);
}

/* --- Photo context: light, under page Dark Mode --- */
/* Katrine's rule (03-09): in Dark Mode a light-photo hero becomes a dark
   state — less light in the eyes at night — while a dark hero never turns
   light. The text tokens flip in the generated dark-sections.css; here the
   scrim flips: every light scrim reads --overlay-tint, so pointing it at
   the dark tint turns the SAME shapes dark. */
html[data-brx-theme="dark"] .section--on-light {
    --overlay-tint: var(--overlay-dark);
}
/* The whole photo goes down a step too, so the text never starts on the
   bare light photo where a Linear or Radial scrim has barely begun. 40 %
   is the step that cleared the house floor of 6:1 on the demo photos
   (Katrine's find + choice, 05-09). */
html[data-brx-theme="dark"] .section--on-light > .hero-media::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background-color: color-mix(in srgb, var(--overlay-dark) 40%, transparent);
}
/* Even, and "Light image — No overlay", get one flat dark cover. 65 % is
   the step that keeps the photo readable AND cleared 6:1 behind the text
   (measured 05-09; 55 % left it at 4.6:1). A light image without a scrim
   has no shape of its own to follow the text, so the flat cover is its
   scrim at night. */
html[data-brx-theme="dark"] .section--on-light:is(.hero-overlay-shape--even, :not(.hero-overlay--light)) > .hero-media::after {
    background-color: color-mix(in srgb, var(--overlay-dark) var(--overlay-strength, 65%), transparent);
}


/* ------------------------------------------------------------
   5. Content position
   ------------------------------------------------------------
/* Where the content block sits in a photo/hero section. The Linear
   scrim follows the text to the same side (section 3). One per
   section; Right matches the original hero design. */
.section--content-left > .brxe-container {
    align-items: flex-start;
}
.section--content-right > .brxe-container {
    align-items: flex-end;
}
.section--content-center > .brxe-container {
    align-items: center;
    text-align: center;
}

/* Centre the content block's own children too. Nested row blocks
   (e.g. the button pair) are full width — Bricks' block default — so
   they also need their ITEMS centred along the row. */
.section--content-center > .brxe-container > .brxe-block {
    align-items: center;
}
.section--content-center > .brxe-container > .brxe-block > .brxe-block {
    justify-content: center;
}


/* ------------------------------------------------------------
   6. Height — the panel's Height choice (wide hero)
   ------------------------------------------------------------
/* Written by the component into the section's CSS classes (live in the
   canvas). Never a pixel number: "fill the screen" is the visitor's own
   screen, in svh so a phone's browser bars are respected. Always a
   MINIMUM — long content simply makes the hero taller. The glimpse
   variant stops short of the edge so the next section shows, which
   tells the visitor the page continues (Katrine, 05-09). Content decides
   = no rule on purpose. The stacked variants live in the container
   rule below. Both the wide and the stacked variant put the minimum on
   an INNER element, never the section: the Section renders as a block
   (its Theme Style), so a flex-grow child could not fill it — measured
   06-09 — and a container cannot size itself from its own query anyway.
   The Bricks Container is a flex column (Bricks core); the two fillers in
   section 1 place the block in the room the minimum adds, by the panel's
   Text position (vertical) — the middle when the field is empty. The
   Container carries the hero's own space and the header clearance as
   padding (sections 1 and 10), and Bricks sizes boxes border-box, so the
   minimum is simply the share of the screen: the hero is exactly that
   tall. */
.section--height-screen > .brxe-container {
    min-block-size: 100svh;
}
.section--height-screen-glimpse > .brxe-container {
    min-block-size: 80svh;
}


/* ------------------------------------------------------------
   7. Content block width
   ------------------------------------------------------------
/* The content block's width is the panel's "Text box width" (default
   50 %) while the hero is wide, and full width once it is STACKED (the
   container rule below). The old lock at 50 % — a block that grew past
   half walked off a directional scrim fixed to the photo, 2.6:1 at
   900 px — is gone: the scrim now follows the text (row 151). The hero
   still stacks when half of it is narrower than a readable line, the
   56rem threshold in the container rule. The block is never narrower
   than 28rem (about 45 characters), however small the typed number. */
.brxe-section:has(> .hero-media) > .brxe-container > .brxe-block {
    inline-size: max(28rem, var(--hero-content-width, var(--hero-content-width-default)));
}


/* ------------------------------------------------------------
   8. Stacked — the one @container rule (8b: image above or below the text)
   ------------------------------------------------------------
/* --- The hero when STACKED — one rule, the section's own width ---
   Below 56rem half the hero is narrower than a readable line (~45
   characters of body text), so the content block can no longer share
   the width with the photo: it goes full width and sits at the top of
   the photo. Everything that follows from that is decided HERE, once,
   by asking the hero section its own inline size — never the screen.
   Bricks' breakpoints play no part, so a hero in a narrow slot behaves
   the same as a hero on a phone. (Rung 2 of the responsive ladder,
   Katrine 05/06-09; replaced three @media blocks keyed to 48em.)

   A container cannot style itself, so every subject below is a child:
   the photo (`> .hero-media`, which carries the scrim), the Bricks
   Container (`> .brxe-container`, alignment and height) — never the
   section. */
@container hero (inline-size < 56rem) {
    /* The wide Height field stops here — Height (mobile) takes over on the
       content block below. Without this reset a wide "Fill the screen"
       leaked into the stacked hero: the container kept its minimum and
       centred the content halfway down the photo (Katrine, 06-09-2026). */
    .section--height-screen > .brxe-container,
    .section--height-screen-glimpse > .brxe-container {
        min-block-size: 0;
    }


    /* Same selector weight as the wide width rule above, or that rule wins
       on specificity and the stacked block keeps its wide width (found 06-09). */
    .brxe-section:has(> .hero-media) > .brxe-container > .brxe-block {
        inline-size: 100%;
    }

    /* The scrim on a stacked hero: the phone strength (its default per
       shape is in section 3), and Linear's fade along the text's height. */
    :is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--lines > .brxe-container > .brxe-block {
        --line-strength: var(--overlay-strength-mobile, var(--overlay-strength-mobile-default));
    }
    :is(.hero-overlay--dark, .hero-overlay--light):is(.hero-overlay-shape--linear, .hero-overlay-shape--radial) > .brxe-container > .brxe-block {
        --strength-now: var(--overlay-strength-mobile, var(--overlay-strength-mobile-default));
        --fade: calc(var(--th) * var(--overlay-linear-length, var(--overlay-linear-length-default)));
        --inset: calc(var(--th) * var(--overlay-linear-start, var(--overlay-linear-start-default)));
    }
    :is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--radial > .brxe-container > .brxe-block {
        --shift-x: var(--overlay-radial-x-mobile, var(--overlay-radial-x-mobile-default));
        --shift-y: var(--overlay-radial-y-mobile, var(--overlay-radial-y-mobile-default));
    }
    .hero-overlay--dark.hero-overlay-shape--even > .hero-media::after {
        background-color: color-mix(in srgb, var(--overlay-tint, var(--overlay-dark)) var(--overlay-strength-mobile, var(--overlay-strength-mobile-default)), transparent);
    }
    .hero-overlay--light.hero-overlay-shape--even > .hero-media::after {
        background-color: color-mix(in srgb, var(--overlay-tint, var(--overlay-light)) var(--overlay-strength-mobile, var(--overlay-strength-mobile-default)), transparent);
    }
    /* Linear runs downward: the text sits at the top of the photo, so it is
       dark from the top edge to the text's bottom, then the S-curve out.
       One rule for every content position. */
    :is(.hero-overlay--dark, .hero-overlay--light).hero-overlay-shape--linear:is(.section--content-left, .section--content-right, .section--content-center) > .brxe-container > .brxe-block::before {
        left: -100vw;
        right: -100vw;
        top: -100vh;
        bottom: auto;
        width: auto;
        height: calc(100vh + var(--ty) + var(--th) - var(--inset) + var(--fade));
        background-image: linear-gradient(to top,
            var(--s0) 0,
            var(--s1) calc(var(--fade) * 0.1),
            var(--s2) calc(var(--fade) * 0.2),
            var(--s3) calc(var(--fade) * 0.3),
            var(--s4) calc(var(--fade) * 0.4),
            var(--s5) calc(var(--fade) * 0.5),
            var(--s6) calc(var(--fade) * 0.6),
            var(--s7) calc(var(--fade) * 0.7),
            var(--s8) calc(var(--fade) * 0.8),
            var(--s9) calc(var(--fade) * 0.9),
            var(--s10) var(--fade));
    }

    /* Third action as a text link (section 9d): with the link in the row,
       every button takes its own full-width line and the link stands alone
       on the line below — centred or left by "Alignment (mobile)". Without
       this a short outline button and the link shared a line (Katrine's
       find on the builder's phone preview, 23-09-2026). Keyed on the
       show-link class, so a hidden link in the builder canvas does not
       count. Overrides the 9c "side by side while they fit" rule only for
       rows that hold the link — same selector weight as that rule plus
       one, or 9c's `flex: 1 0 auto` wins on specificity. */
    .brxe-section:has(> .hero-media) .brxe-block:has(> .brxe-text-link.show-link) > .brxe-button {
        flex-basis: 100%;
    }

    /* "Alignment (mobile)" — the panel's choice for the stacked hero.
       One element can carry ONE panel-written class field, so each of
       the three choices lives on its own element: Height on the section,
       Alignment (mobile) on the Bricks Container, Height (mobile) on the
       content block (verified 06-09: a second property writing the same
       field simply overwrote the first). Both options are ACTIVE rules:
       Left must undo a centred desktop hero, Centre a left/right one. */
    .brxe-container.stacked-align-left {
        align-items: flex-start;
        text-align: start;
    }
    .brxe-container.stacked-align-left > .brxe-block {
        align-items: flex-start;
    }
    .brxe-container.stacked-align-left > .brxe-block > .brxe-block {
        justify-content: flex-start;
    }
    .brxe-container.stacked-align-center {
        align-items: center;
        text-align: center;
    }
    .brxe-container.stacked-align-center > .brxe-block {
        align-items: center;
    }
    .brxe-container.stacked-align-center > .brxe-block > .brxe-block {
        justify-content: center;
    }

    /* The stacked hero has its own field, "Text position (vertical)
       (mobile)": empty = 0 = the top (Katrine 20-10-2026). The wide
       field stops here, so a centred wide hero keeps its stacked text at
       the top. The fillers (section 1) and the space below read it.
       The stacked hero's own space. At position 0: no extra space under
       a transparent header (Katrine 20-10-2026; it was --space-m), and
       --space-m under a solid one (section 10 sets the minimum), with
       --space-2xl at the bottom. Higher numbers move space from the
       bottom to the top, down to --space-m at the bottom at 100. The
       header clearance stays on top. Same selector weight as the wide
       rule in section 1; this one comes later, so it wins here. */
    .brxe-section:has(> .hero-media) > .brxe-container {
        --hero-text-position-now: var(--hero-text-position-mobile, var(--hero-text-position-mobile-default));
        --hero-stacked-air-move: calc(var(--hero-text-position-now) * (var(--space-2xl) - var(--space-m)));
        padding-block:
            calc(var(--hero-top-extra, 0rem) + var(--hero-stacked-air-top-minimum, var(--space-m)) + var(--hero-stacked-air-move))
            calc(var(--space-2xl) - var(--hero-stacked-air-move));
    }

    /* "Height (mobile)" — the panel writes it on the content block, and
       the Container reads it with :has(): the minimum sits on the
       Container (border-box, padding included), so the hero is exactly
       that tall. The content starts at the TOP, right under the text's
       scrim; the photo shows below it (Katrine, 06-09-2026 — centred
       text landed in the thin end of the scrim). The glimpse share is
       75 % here, not the wide hero's 80 %: a phone's browser bars take
       room, and 75 % keeps the next section in view (Katrine's choice
       11-10-2026). */
    .brxe-container:has(> .stacked-height-screen) {
        min-block-size: 100svh;
        justify-content: flex-start;
    }
    .brxe-container:has(> .stacked-height-screen-glimpse) {
        min-block-size: 75svh;
        justify-content: flex-start;
    }

    /* A list in the subtitle of a CENTRED stacked hero: a small inset on
       both sides, so the bullets stay inside the title's edges when the
       list fills the column (Katrine's choice 11-10-2026, "med indryk").
       Left-aligned heroes need none: bullets and title share an edge. */
    .brxe-container.stacked-align-center .subtitle:has(> :is(ul, ol)) {
        padding-inline: var(--space-s);
    }

    /* --- 8b. Image above or below the text — the panel's "Image position
       (mobile)" (row 151, Katrine 10-10-2026) ---
       The image leaves its place behind the text and becomes a block of
       its own, in the panel's Image shape (section 1), edge to edge; the
       text stands on the section's own colour. Nothing is painted on the
       image: no scrim, no header overlay, and no page-Dark-Mode cover on a
       light image (section 4). Height (mobile) has no effect — the shape
       sets the image's height and the text takes the room it needs. The
       Theme Style's section gap is the space between image and text.
       Typical use: a hero without a mobile image, whose wide hero image
       crops badly on a phone. Works with a mobile image too. */
    :is(.hero-image-position--above, .hero-image-position--below) > .hero-media {
        position: relative;   /* in flow; its pseudo-elements stay inside it */
        z-index: auto;
        block-size: auto;
        aspect-ratio: var(--hero-image-shape, auto);
    }
    /* The scrim, the header overlay and the Dark Mode cover all sit on
       pseudo-elements; none of them belongs on an image that stands
       alone. The `html[data-brx-theme]` twin outweighs section 4's Dark
       Mode rules, which carry that attribute in their selector. */
    .brxe-section:has(> .hero-media):is(.hero-image-position--above, .hero-image-position--below) > .hero-media::before,
    .brxe-section:has(> .hero-media):is(.hero-image-position--above, .hero-image-position--below) > .hero-media::after,
    html[data-brx-theme] .brxe-section:has(> .hero-media):is(.hero-image-position--above, .hero-image-position--below) > .hero-media::after,
    .brxe-section:has(> .hero-media):is(.hero-image-position--above, .hero-image-position--below) > .brxe-container > .brxe-block::before {
        content: none;
    }
    /* Height (mobile) is a minimum on the Container (above); not here.
       Text position (mobile) belongs to the image behind the text, so
       it is 0 here too. */
    .brxe-section:has(> .hero-media):is(.hero-image-position--above, .hero-image-position--below) > .brxe-container {
        --hero-text-position-now: 0;

        min-block-size: 0;
    }
    /* Above: the image stands at the hero's top edge, right under the
       (solid) header — the section has no padding of its own (section
       1), so nothing has to pull it up. The Container drops its top space
       and the header clearance: the header is solid again here
       (navigation.css §1), and the Theme Style's section gap is the air
       between image and text. Same weight as the stacked padding rule
       above; later, so it wins. */
    .brxe-section.hero-image-position--above > .brxe-container {
        padding-block-start: 0;
    }
    /* Below: the image closes the hero at its bottom edge; the Container
       drops its bottom space for the same reason. */
    .hero-image-position--below > .hero-media {
        order: 2;
    }
    .brxe-section.hero-image-position--below > .brxe-container {
        padding-block-end: 0;
    }

}


/* ------------------------------------------------------------
   9. Colour voice and buttons — token remap, wash on a photo, full-width row
   ------------------------------------------------------------

/* 9a. Colour voice — the panel's "Colour style" choice as a class.
   The choice puts .section--hero-primary, .section--hero-accent or
   .section--hero-neutral on the section (a class property, so the
   builder canvas shows it). Everything inside speaks the PRIMARY
   family by default: the filled button is Bricks' native Primary
   style, the highlighted word uses --text-highlight-primary, the badge
   the primary inverse pair, the outline button hovers
   --border-highlight-primary. Primary heroes therefore need no rule.
   The accent and neutral classes point those seven working names at
   their own family — the same mechanic as the dark sections and the
   header's voice (navigation.css §1). The label above the title stays
   --text-secondary in every family (headings.css), so it never
   competes with the highlighted word (Katrine, 14-09-2026).

   The rules themselves live in layout.css §3 ("Colour family"), shared
   with the generic .colour-accent / .colour-neutral classes that any
   section or block can carry (backlog 87, 14-09-2026) — one copy, so the
   hero and a plain section can never drift apart. */

/* 9b. Outline button on a photo — a wash so the label stays readable.
   An outline button is border + label with nothing behind it. Over a
   flat surface that is fine; over a PHOTO the label lands on whatever
   the picture happens to show — measured at 1.5:1 against white on the
   front page, where the button sits on a bright screen in the image.

   So in a hero the button gets a wash in the direction OPPOSITE its
   label: white label → dark wash, ink label → light wash. Hover adds
   more of the same, which keeps the existing hover direction (contrast
   goes up, never down) and needs no new panel choice — the section
   classes we already set say which context we are in.

   Scoped to sections that hold a hero photo, so ordinary outline
   buttons on flat surfaces are untouched. Beats the Theme Style on
   specificity, so no !important (Bricks Theme Styles are unlayered).
   ------------------------------------------------------------ */

/* Dark photo contexts — the label is white. Covers dark overlays,
   "no overlay — dark image", and every state under page Dark Mode. */
.brxe-section:has(> .hero-media) .bricks-button.outline {
    background-color: color-mix(in srgb, var(--overlay-dark) 30%, transparent);
    /* This list REPLACES the Button Theme Style's transition, so the
       lift and the shadow (buttons.css §1) must be named here too —
       without them the button jumped up while the wash faded
       (Katrine's find, 19-09-2026). */
    transition: background-color var(--transition-base),
                border-color var(--transition-base),
                color var(--transition-base),
                box-shadow var(--transition-fast),
                transform var(--transition-fast);
}

.brxe-section:has(> .hero-media) .bricks-button.outline:hover {
    background-color: color-mix(in srgb, var(--overlay-dark) 55%, transparent);
}

/* Light photo contexts — .section--on-light flips the label to ink, so
   the wash flips to white. Covers both light overlays and
   "no overlay — light image". */
.section--on-light:has(> .hero-media) .bricks-button.outline {
    background-color: color-mix(in srgb, var(--overlay-light) 55%, transparent);
}

.section--on-light:has(> .hero-media) .bricks-button.outline:hover {
    background-color: color-mix(in srgb, var(--overlay-light) 78%, transparent);
}

/* Page Dark Mode turns a light photo into a dark state (section 4), so
   the label goes back to white and the wash follows it. */
html[data-brx-theme="dark"] .section--on-light:has(> .hero-media) .bricks-button.outline {
    background-color: color-mix(in srgb, var(--overlay-dark) 30%, transparent);
}

html[data-brx-theme="dark"] .section--on-light:has(> .hero-media) .bricks-button.outline:hover {
    background-color: color-mix(in srgb, var(--overlay-dark) 55%, transparent);
}

/* 9c. Hero button row — side by side while they fit, full width once
   they wrap. The buttons stack ONLY when there is no room for two
   (Katrine, 10-09: a fixed width threshold stacked them on a phone
   that had room). Left alone, wrapped buttons would stack at their own
   text widths — 176px above 201px — which reads as an accident; full
   width gives one clean edge and a bigger tap target.

   How it works without a threshold: the row hugs its content (fit-
   content, capped at the block's width) and the buttons may grow. While
   both fit, the row is exactly as wide as the pair, so there is nothing
   to grow into and they keep their natural width. Once the pair is
   wider than the block, the row is the block's width and wraps (the
   master's Flex wrap field says wrap; Bricks forces it under 768px
   anyway), and each button grows to fill its own line. Rung 1 of the
   responsive ladder: no query at all, nothing to keep in sync with
   Bricks, and any button size or label length just works.
   ------------------------------------------------------------ */

.brxe-section:has(> .hero-media) .brxe-block:has(> .brxe-button) {
    inline-size: fit-content;
    max-inline-size: 100%;
}

.brxe-section:has(> .hero-media) .brxe-block:has(> .brxe-button) > .brxe-button {
    flex: 1 0 auto;
}

/* 9d. Third action — a text link in the button row (backlog 29, 23-09-2026).
   The panel's "Third action" Type choice shows either a third outline
   button (9b and 9c cover it like the other two) or a Text Link element
   in the same row. Only the colour is the link's own rule here.

   On a photo the link takes the hero's TEXT colour — white on a dark
   photo, ink on a light one, white again when page Dark Mode turns a
   light hero dark — instead of the link colour the Theme Style gives
   every text link (--text-link, a blue tint in the dark contexts, see
   dark-sections.css). Beside two buttons it reads as an action, not as
   a link in running text, so it borrows the text colour; `inherit`
   follows whatever the section resolved, in every state. The hover
   underline and the icon nudge stay as on every standalone text link
   (buttons.css §2–§3), so the hover still shows.

   Width: the 9c rule lets BUTTONS grow once the row wraps; the link is
   not a button, so it keeps its natural width (Katrine's choice, 23-09).
   The row's Align items = center (a master field) centres it against
   the buttons while they share a line. When the hero is STACKED the
   buttons take full-width lines and the link stands alone below them —
   the rule sits with the other stacked rules in section 8. */
.brxe-section:has(> .hero-media) .brxe-text-link,
.brxe-section:has(> .hero-media) .brxe-text-link:is(:hover, :focus-visible) {
    color: inherit;
}

/* 9e. Text shadow on the photo (Katrine's choice, 08-10-2026).
   The heading keeps the site's own shadow (headings.css). Subtitle, body
   text and a text-style label get a smaller, tighter one wherever the
   text is light on the photo — every dark state, and a light photo under
   page Dark Mode — so small letters stay crisp. The badge has its own
   background and gets none. Contrast is measured WITHOUT the shadow. */
.brxe-section:has(> .hero-media):not(.section--on-light) > .brxe-container > .brxe-block :is(.subtitle, .brxe-text, .label-text),
html[data-brx-theme="dark"] .section--on-light:has(> .hero-media) > .brxe-container > .brxe-block :is(.subtitle, .brxe-text, .label-text) {
    text-shadow: 0 1px 3px rgb(var(--shadow-color) / 0.6);
}


/* ------------------------------------------------------------
   10. Header on top of the photo — clearance and header overlay
   ------------------------------------------------------------
   The Hero panel's "Header: Transparent header" writes .header-over-hero
   onto the photo. The site header then sits on the photo's top edge,
   see-through until the page scrolls (navigation.css §1). Two things
   follow here.

   Clearance: the hero starts under the bar, so --hero-top-extra becomes
   the bar's height, and the Bricks Container adds it to its own space
   (sections 1 and 8). The wide hero adds it to its air budget, shared
   between top and bottom (section 1): with an empty Text position the
   text stays in the middle of the photo, half a bar at each edge, and
   the hero is exactly as tall as with a solid header. The top never
   gets less than the bar plus --space-m, so the text never slips under
   the bar at any number. The two findings
   behind it, both Katrine's, 11-10-2026: with the whole bar at the top
   only, the text sat half a bar too low in every Height (Tjills); with
   the whole bar at both edges, a Content decides hero grew by a full
   bar (the framework). The stacked hero adds the whole bar at the top
   only: its text sits at the top under the bar by design (section 8).
   The minimums (sections 6 and 8) are plain screen shares, so the hero
   still ends at the screen edge.

   Header overlay: a top-down shade on the photo's ::before, behind the
   bar, so logo and menu never meet the bare photo — full strength
   through the bar, then the same S-curve as the scrim. Same tint family
   as the scrim: dark by default, white over a light photo, and dark
   again when page Dark Mode flips a light hero (section 4). Knobs
   (defaults in section 1):
     --header-overlay-strength  how dark it is behind the bar (65%)
     --header-overlay-height    where it has faded out (three bar heights)
   ------------------------------------------------------------ */
.brxe-section:has(> .header-over-hero) {
    --hero-top-extra: var(--header-height);
    /* The stacked text may start right under the bar (section 8). */
    --hero-stacked-air-top-minimum: 0rem;
}

.header-over-hero::before {
    --band-tint: var(--overlay-tint, var(--overlay-dark));
    --band-strength: var(--header-overlay-strength, var(--header-overlay-strength-default));
    --band-height: var(--header-overlay-height, calc(var(--header-overlay-height-default) * var(--header-height)));
    --band-fade: calc(var(--band-height) - var(--header-height));
    content: "";
    position: absolute;
    inset-block-start: 0;
    inset-inline: 0;
    block-size: var(--band-height);
    z-index: 2;   /* above the scrim (::after, z-index 1) */
    background-image: linear-gradient(
        to bottom,
        color-mix(in srgb, var(--band-tint) var(--band-strength), transparent) 0,
        color-mix(in srgb, var(--band-tint) var(--band-strength), transparent) var(--header-height),
        color-mix(in srgb, var(--band-tint) calc(var(--band-strength) * 0.972), transparent) calc(var(--header-height) + var(--band-fade) * 0.1),
        color-mix(in srgb, var(--band-tint) calc(var(--band-strength) * 0.896), transparent) calc(var(--header-height) + var(--band-fade) * 0.2),
        color-mix(in srgb, var(--band-tint) calc(var(--band-strength) * 0.784), transparent) calc(var(--header-height) + var(--band-fade) * 0.3),
        color-mix(in srgb, var(--band-tint) calc(var(--band-strength) * 0.648), transparent) calc(var(--header-height) + var(--band-fade) * 0.4),
        color-mix(in srgb, var(--band-tint) calc(var(--band-strength) * 0.5), transparent) calc(var(--header-height) + var(--band-fade) * 0.5),
        color-mix(in srgb, var(--band-tint) calc(var(--band-strength) * 0.352), transparent) calc(var(--header-height) + var(--band-fade) * 0.6),
        color-mix(in srgb, var(--band-tint) calc(var(--band-strength) * 0.216), transparent) calc(var(--header-height) + var(--band-fade) * 0.7),
        color-mix(in srgb, var(--band-tint) calc(var(--band-strength) * 0.104), transparent) calc(var(--header-height) + var(--band-fade) * 0.8),
        color-mix(in srgb, var(--band-tint) calc(var(--band-strength) * 0.028), transparent) calc(var(--header-height) + var(--band-fade) * 0.9),
        transparent var(--band-height)
    );
}
.section--on-light > .header-over-hero::before {
    --band-tint: var(--overlay-tint, var(--overlay-light));
}
