/* ============================================================================
   listing.hero.css  -  the coloured header on a product LISTING page
   ----------------------------------------------------------------------------
   Shared by range.cfm and brand.products.cfm. Both are "here is a wall of
   products" pages hanging off a brand, and both were missing the same two
   things: something at the top saying whose products these are, and a way back
   up. brand.products.cfm in particular opened straight onto a facet rail and 48
   cards with no heading above them and no route back to the brand page.

   These rules started life as .range-hero in css/range.landing.css. They are
   renamed and moved rather than copied because a second page now needs them,
   and a duplicated hero is the thing that eventually drifts - the same drift
   that left brand.cfm with twelve bespoke per-brand layouts.

   THE COLOUR IS THE BRAND'S. The page sets two custom properties, exactly as
   brand.cfm and range.cfm do:

       --brand-colour   the brand's primaryColour, or --oct-ink if unset
       --brand-ink      #fff or near-black, whichever reads on that colour

   --brand-ink is computed SERVER-SIDE from relative luminance (see the long
   note in brand.cfm for why the crossover is 0.35 and not the textbook 0.179).

   BUILT TO COLLAPSE. Eyebrow, image and logo are all optional; a listing with
   none of them still reads as deliberate.

   THE BAND (v=2). Both pages now wrap this hero in the same .brand-hero-band
   brand.cfm uses, painted by css/brand.hero.band.css from the brand's
   uploaded hero photograph and its Admin dials, so a range page carries the
   same banner as its brand page. When the band is painted it blanks this
   element's background and owns the bottom margin (see that file); with no
   band treatment the rules below render exactly as they always did.
============================================================================ */
.listing-hero {
    /* Fallbacks matter: a brand with no primaryColour still gets a hero rather
       than a transparent band with invisible text. */
    --brand-colour: var(--oct-ink);
    --brand-ink: #ffffff;

    background: var(--brand-colour);
    color: var(--brand-ink);
    padding: var(--oct-space-6) 0;
    margin-bottom: var(--oct-space-6);
    padding-left: 24px;
    padding-right: 24px;
    text-align: left;
}

.listing-hero-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--oct-space-6);
}

.listing-hero-text { flex: 1 1 340px; min-width: 0; order: 1; }

/* ----------------------------------------------------------------------------
   BREADCRUMB
   ----------------------------------------------------------------------------
   Sits inside the hero, so it is on the brand colour and inherits --brand-ink.
   Same shape as .pf-crumb on platform.cfm; not merged with it because that one
   is written against a photographic hero with hard-coded white, and this one
   has to work on Whiteline yellow as well as Blue Print navy.

   A VISIBLE trail is what makes the BreadcrumbList JSON-LD legitimate -
   Google's guidance is explicit that the markup must reflect a real breadcrumb
   on the page. See includes/breadcrumb.jsonld.cfm.
---------------------------------------------------------------------------- */
.listing-crumb {
    margin: 0 0 var(--oct-space-2);
    font-size: var(--oct-text-sm);
    line-height: 1.5;
    /* currentColor at reduced opacity rather than a fixed rgba(255,255,255,...),
       which would vanish on a light brand colour. */
    opacity: .82;
    text-align: left;
}
.listing-crumb a {
    color: var(--brand-ink);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.listing-crumb a:hover { opacity: 1; }
.listing-crumb .sep { margin: 0 var(--oct-space-1); }
.listing-crumb [aria-current="page"] { font-weight: 600; }

.listing-hero h1 {
    display: block;
    width: auto;
    margin: 0 0 var(--oct-space-3);
    font-size: var(--oct-h1);
    font-weight: 700;
    line-height: 1.15;
    color: var(--brand-ink);
    text-align: left;
}

.listing-hero-lead {
    max-width: var(--oct-measure);
    margin: 0 0 var(--oct-space-4);
    font-size: var(--oct-text-md);
    line-height: 1.6;
    /* Held back from the heading without introducing a second colour that might
       fail contrast on an arbitrary brand background. */
    opacity: .92;
    text-align: left;
}

.listing-hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--oct-space-3);
}

.listing-hero-count {
    display: inline-block;
    border: 1px solid currentColor;
    border-radius: var(--oct-radius-pill);
    padding: 5px 14px;
    font-size: var(--oct-text-sm);
    opacity: .9;
}

/* Inverted: the brand colour is already the background, so the button fills
   with the ink colour to stay legible on any brand. */
.listing-hero-cta {
    display: inline-block;
    background: var(--brand-ink);
    color: var(--brand-colour);
    font-size: var(--oct-text-base);
    font-weight: 700;
    padding: 11px 24px;
    border-radius: var(--oct-radius-sm);
    text-decoration: none;
    border: 2px solid var(--brand-ink);
}
.listing-hero-cta:hover {
    background: transparent;
    color: var(--brand-ink);
}

/* The quieter secondary route. */
.listing-hero-alt {
    font-size: var(--oct-text-sm);
    color: var(--brand-ink);
    text-decoration: underline;
    text-underline-offset: 3px;
    opacity: .85;
}
.listing-hero-alt:hover { opacity: 1; }

/* Optional photograph. Removed outright by an onerror handler when the file is
   missing, so this must not reserve space that would then collapse oddly. */
.listing-hero-image {
    flex: 0 1 300px;
    order: 2;
    min-width: 0;
}
.listing-hero-image img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    border-radius: var(--oct-radius);
}

/* The logo plate. Brand logos are supplied on assorted backgrounds, so it sits
   on its own surface rather than directly on the brand colour - a white-on-
   transparent logo vanishes into a light brand colour otherwise. Last visually
   on desktop; on a narrow screen it moves above the text so the page opens with
   something recognisable. */
.listing-hero-logo {
    flex: 0 0 auto;
    order: 3;
    background: var(--oct-surface);
    border-radius: var(--oct-radius);
    padding: var(--oct-space-3) var(--oct-space-4);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 150px;
    min-height: 80px;
}
.listing-hero-logo img {
    display: block;
    max-width: 180px;
    max-height: 64px;
    width: auto;
    height: auto;
}

/* Over a photograph the range picture needs its own surface: product shots are
   white-background JPEGs, but a transparent PNG would float its subject over
   whatever part of the photo lands behind it. Same reasoning as the logo plate. */
.brand-hero-band--photo .listing-hero-image img {
    background: var(--oct-surface);
    padding: var(--oct-space-2);
    box-sizing: border-box;
}

@media (max-width: 900px) {
    .listing-hero-image { flex-basis: 100%; }
    .listing-hero-image img { max-height: 170px; object-position: left; }
}

@media (max-width: 640px) {
    .listing-hero       { padding: var(--oct-space-5) 12px; }
    .listing-hero h1    { font-size: var(--oct-h1-mobile); }
    .listing-hero-inner { gap: var(--oct-space-4); }
    .listing-hero-logo  { order: 0; min-width: 130px; min-height: 68px; padding: var(--oct-space-3); }
    .listing-hero-logo img { margin: 0 auto; }
    .listing-hero-meta  { gap: var(--oct-space-2); display: none;}
    .listing-hero-cta   { padding: 11px 20px; }
}
