/* ============================================================================
   brand.hero.band.css  -  the brand hero BAND, shared by every page that
   opens on a brand's banner
   ----------------------------------------------------------------------------
   brand.cfm, range.cfm and brand.products.cfm all wrap their hero in
   .brand-hero-band and set the same classes and custom properties on it, from
   the same server-side resolver (includes/brand.hero.resolve.cfm). These
   rules paint that band: the uploaded photograph with its overlay and ink, or
   the flat brand colour, or the hand-built Milltek carbon (which stays in
   css/brand.landing.css, as brand.cfm is the only page that renders it).

   The rules started life in css/brand.landing.css and moved here when
   range.cfm needed them: a range page that opened on a flat colour under a
   brand page with a photograph did not read as the same brand. Moved rather
   than copied, because a duplicated hero is the thing that drifts.

   The hero CHILD can be .brand-hero (brand.cfm) or .listing-hero (range.cfm,
   brand.products.cfm); every rule that touches the child names both.

   Load order: this file BEFORE the page's own stylesheet, so a page can still
   override a band rule if it ever has to.
============================================================================ */

/* ----------------------------------------------------------------------------
   THE BAND
   ----------------------------------------------------------------------------
   brand.cfm wraps the hero AND the brand's own vehicle selector in
   .brand-hero-band. A skin paints its background HERE, on the wrapper, so the
   photograph runs continuously from behind the brand name down behind the
   select boxes instead of stopping at a seam between two separately-painted
   elements.

   That is why a skin is two classes, not one:

       .brand-hero-band--<name>   the background, on the wrapper
       .brand-hero--<name>        --brand-colour / --brand-ink and accents

   The properties have to stay on the hero: .brand-hero declares its own
   fallbacks (--brand-colour: var(--oct-ink)), and a declaration on the element
   beats anything inherited from an ancestor, so setting them on the wrapper
   would silently do nothing.

   Unskinned, .brand-hero-band is inert and both children keep their own
   backgrounds - which is what Powerflex wants, since its selector is a white
   panel by design.
---------------------------------------------------------------------------- */
.brand-hero-band { display: block; }

/* A skinned band owns the background, so its children must not paint over it,
   and the gap between them closes. Scoped to the wrapper class rather than to
   each skin, so a second skin needs no extra plumbing. */
.brand-hero-band[class*="brand-hero-band--"] > .brand-hero,
.brand-hero-band[class*="brand-hero-band--"] > .listing-hero {
    background: none;
    margin-bottom: 0;
}
.brand-hero-band[class*="brand-hero-band--"] > .brand-own-selector {
    margin: 0;
}

/* ============================================================================
   DATA-DRIVEN HERO TREATMENTS  --  .brand-hero-band--photo / --colour
   ----------------------------------------------------------------------------
   Everything below the hand-written carbon skin is driven by Octane_Brands_Cache
   and set as custom properties on the band by brand.cfm, so a brand gets the
   Milltek treatment by uploading a photograph in Admin rather than by having
   someone write it a stylesheet.

   The band reads five properties, all emitted server-side, all validated there
   against a whitelist before they reach this file:

       --hero-image   url() of the uploaded image. ABSOLUTE URL ONLY - a
                      relative one is resolved against THIS STYLESHEET, not
                      against the page, so images/x.jpg would be fetched from
                      /css/images/x.jpg and silently render as nothing behind
                      the overlay. brand.cfm always emits the CDN URL, which is
                      absolute; keep it that way.
       --hero-pos     background-position, e.g. `center 58%`
       --hero-tint    0-1 overlay strength (Admin stores 0-100)
       --brand-colour the brand's primaryColour
       --brand-rgb    the same colour as `r,g,b`, because rgba() cannot take hex

   and four overlay classes choose WHAT is painted over the picture:

       --ov-ramp   dark at the left where the logo and heading sit, opening up
                   to the right - the Milltek treatment, and the right default
                   for a photograph with its subject on one side
       --ov-wash   an even veil, for a busy picture with no clear open side
       --ov-brand  the same ramp in the brand's own colour
       --ov-none   no overlay: only for an image that was prepared with the
                   text area already dark (or light) enough

   --ink-light / --ink-dark says which way the text runs; each overlay has a
   white-based variant so a light photograph with dark text gets a veil that
   lifts it rather than one that fights it.

   THE OVERLAY IS NOT DECORATION. Text over an arbitrary photograph fails
   contrast somewhere in the frame on almost every image; the overlay is what
   makes the heading, the breadcrumb and the picker labels legible regardless
   of what was uploaded. --ov-none exists for images that already do that job,
   not as a general option.
============================================================================ */
.brand-hero-band--photo,
.brand-hero-band--colour {
    margin-bottom: var(--oct-space-7);
}

.brand-hero-band--photo {
    /* Painted first-listed on top: overlay over photograph over base colour.
       The base shows only while the image loads and behind any letterboxing. */
    background-color: var(--hero-base, #11171f);
    background-image: var(--hero-wash, none), var(--hero-image, none);
    background-size: auto, cover;
    background-position: 0 0, var(--hero-pos, center center);
    background-repeat: no-repeat, no-repeat;
}
.brand-hero-band--photo.brand-hero-band--ink-dark { --hero-base: #eef0f3; }

/* Dark overlays, for light text. The stops are the Milltek ramp expressed as
   fractions of --hero-tint, so one dial moves the whole ramp and keeps its
   shape: strongest under the logo plate, half-open where the car usually is. */
.brand-hero-band--ov-ramp {
    --hero-wash: linear-gradient(90deg,
        rgba(0, 0, 0, calc(var(--hero-tint, .7) * 1.00))   0%,
        rgba(0, 0, 0, calc(var(--hero-tint, .7) * 0.92))  40%,
        rgba(0, 0, 0, calc(var(--hero-tint, .7) * 0.46))  72%,
        rgba(0, 0, 0, calc(var(--hero-tint, .7) * 0.32)) 100%);
}
.brand-hero-band--ov-wash {
    --hero-wash: linear-gradient(0deg,
        rgba(0, 0, 0, var(--hero-tint, .7)),
        rgba(0, 0, 0, var(--hero-tint, .7)));
}
.brand-hero-band--ov-brand {
    --hero-wash: linear-gradient(90deg,
        rgba(var(--brand-rgb, 17, 23, 31), calc(var(--hero-tint, .7) * 1.00))   0%,
        rgba(var(--brand-rgb, 17, 23, 31), calc(var(--hero-tint, .7) * 0.88))  45%,
        rgba(var(--brand-rgb, 17, 23, 31), calc(var(--hero-tint, .7) * 0.30)) 100%);
}
.brand-hero-band--ov-none { --hero-wash: none; }

/* Light overlays, for dark text. Same shapes, white instead of black -- a dark
   veil under near-black text makes it LESS readable, not more, which is the
   mistake this pair of rules exists to prevent. */
.brand-hero-band--ink-dark.brand-hero-band--ov-ramp {
    --hero-wash: linear-gradient(90deg,
        rgba(255, 255, 255, calc(var(--hero-tint, .7) * 1.00))   0%,
        rgba(255, 255, 255, calc(var(--hero-tint, .7) * 0.92))  40%,
        rgba(255, 255, 255, calc(var(--hero-tint, .7) * 0.46))  72%,
        rgba(255, 255, 255, calc(var(--hero-tint, .7) * 0.32)) 100%);
}
.brand-hero-band--ink-dark.brand-hero-band--ov-wash {
    --hero-wash: linear-gradient(0deg,
        rgba(255, 255, 255, var(--hero-tint, .7)),
        rgba(255, 255, 255, var(--hero-tint, .7)));
}

/* THE FLAT-COLOUR BAND. For every brand that has a primaryColour and no
   picture yet -- which is most of them, and the state this page was in.
   The hero was the only coloured element, so the vehicle picker sat on the
   white page below it as an unrelated white card. Extending the colour behind
   both makes them one block: this is the brand, here is your car.

   A single soft diagonal rather than a flat fill, so a 1632px band of one
   saturated colour has some depth to it; light enough that it reads as the
   brand colour and not as a gradient. */
.brand-hero-band--colour {
    background-color: var(--brand-colour, var(--oct-ink));
    background-image: linear-gradient(158deg, rgba(255, 255, 255, .10) 0%, rgba(0, 0, 0, .18) 100%);
}
.brand-hero-band--colour.brand-hero-band--ink-dark {
    background-image: linear-gradient(158deg, rgba(255, 255, 255, .20) 0%, rgba(0, 0, 0, .07) 100%);
}

/* ============================================================================
   THE PHOTOGRAPH COMES OFF THE BAND ON NARROW SCREENS
   ----------------------------------------------------------------------------
   The band wraps the heading AND the vehicle picker, so its SHAPE changes
   completely with the viewport. Measured on a live photo hero:

       viewport   band          aspect
         360      345 x 1513     0.23     <- four times taller than it is wide
         414      399 x 1464     0.27
         768      753 x  693     1.09
        1440     1425 x  586     2.43
        2560     2545 x  586     4.34

   At 0.23:1, background-size: cover scales a 1.6:1 landscape photograph up to
   about 2421px wide to fill the box, and the visitor sees a thin vertical
   sliver of the middle of the picture. That is not a file-size problem and a
   smaller file does not fix it - no crop of a photograph sensibly fills a box
   four times taller than it is wide.

   So below the layout breakpoint the picture covers the HEADING BLOCK alone
   (345 x 565 at 360px - a normal portrait shape, and what the p600/p900/p1200
   variants are cut to), and the band underneath carries the same overlay
   surface the hero sits on, so the picker appears to sit on the photograph
   fading out rather than on an unrelated slab.

   WHY --hero-base AND --hero-wash RATHER THAN THE BRAND COLOUR: the ink class
   on the band is chosen for the PICTURE, not for the brand colour, and the
   picker's glass panel and Go button in css/brand.vehicle.panel.css read that
   ink. Painting the brand colour here could put dark text on a dark brand.
   These two tokens are the ones the ink was chosen against, so they cannot
   disagree with it.

   Specificity note: the rule that blanks a banded child's background,
   .brand-hero-band[class*="brand-hero-band--"] > .brand-hero, is (0,3,0). The
   selector below matches it at (0,3,0) and wins on order, which is why it has
   the attribute selector on it and why it must stay after that rule.
============================================================================ */
@media only screen and (max-width: 767px) {
    .brand-hero-band--photo {
        background-color: var(--hero-base, #11171f);
        background-image: var(--hero-wash, none);
        background-size: auto;
        background-position: 0 0;
        background-repeat: no-repeat;
    }

    .brand-hero-band--photo[class*="brand-hero-band--"] > .brand-hero,
    .brand-hero-band--photo[class*="brand-hero-band--"] > .listing-hero {
        background-color: var(--hero-base, #11171f);
        background-image: var(--hero-wash, none), var(--hero-image, none);
        background-size: auto, cover;
        background-position: 0 0, var(--hero-pos, center center);
        background-repeat: no-repeat, no-repeat;
    }
}
