/*
 * Full width image with text (was "Full width image with text overlay") (`vc_bgimage_text`)
 *
 * Loaded only on pages that use this element, after common.css. Rules
 * shared with other elements are in common.css.
 */

/*
 * Moved from the cognita-europe theme's custom-style.css in plugin 0.11.0
 * (element assets project, phase 4a), unchanged and in their original order.
 * They stayed in the theme at first because theme code still named their
 * classes. They come first here, as they came before every rule below.
 */

.img-overlay-middle {
    color: white;
    position: relative;
}

.cwb-bgimage--vtop{justify-content:flex-start}

.cwb-bgimage--vcenter{justify-content:center}

.cwb-bgimage--vbottom{justify-content:flex-end}

/* .component carries a 20px top margin, so whichever block happens to come
   first pushed the text 20px below where every other module starts its content.
   Other elements drop it with mt-0 on their first component; which block is
   first here depends on which fields are filled in, so it is done by position.

   div:first-of-type rather than :first-child: the element used to emit its
   button colour rules as <style> blocks inside this wrapper, so a <style> was
   the first child whenever a button was present. Those are gone, but matching
   the first div is still the accurate way to say what this means. */
.cwb-bgimage__text>div:first-of-type{margin-top:0}

/* Quote marks for a title set to render as a blockquote - 23 of the saved
   titles are quotations. This was written as a <style> block in the middle of
   the content, once per instance. */
.cwb-bgimage__text blockquote::before{content:open-quote}

.cwb-bgimage__text blockquote::after{content:close-quote}

/* Full Width Image With Text Overlay carries a real <img> for the same reasons:
as a CSS background the browser was given the full size original with no
srcset behind it, and a background can hold neither alt text nor lazy
loading. The picture fills the section behind the scrim and the text, and
object-position: right stands in for the background-position: right it used
to inherit from .callout-img, so the crop is unchanged. */
.cwb-bgimage__media{position:absolute;top:0;right:0;bottom:0;left:0;overflow:hidden;border-radius:inherit}

.cwb-bgimage__media>img{width:100%;height:100%;object-fit:cover;object-position:right;display:block}

/* Which part of the photograph survives the crop. .callout-img fixed this at
`right`, which suits a portrait on the right of the frame and cuts the head
off anything centred; right stays the default so nothing moves. */
.cwb-bgimage--pos-right .cwb-bgimage__media>img{object-position:right}

.cwb-bgimage--pos-center .cwb-bgimage__media>img{object-position:center}

.cwb-bgimage--pos-left .cwb-bgimage__media>img{object-position:left}

.cwb-bgimage--pos-top .cwb-bgimage__media>img{object-position:top}

.cwb-bgimage--pos-bottom .cwb-bgimage__media>img{object-position:bottom}

/* The text over the picture sits in the section's own flow, inside its padding
and on the same line as every other module's content. It used to be
positioned absolutely as a percentage down and across the section, which took
it out of both. The section is a flex column so the content can be aligned
down its height; the picture and the scrim are absolutely positioned and so
take no part in it. */
.section.cwb-bgimage{display:flex;flex-direction:column}

.cwb-bgimage__text--left{text-align:left}

.cwb-bgimage__text--center{text-align:center}

.cwb-bgimage__text--right{text-align:right}

/* Text colour. White is the default and is what .img-overlay-middle hardcodes;
the Colour Profile option lets the text inherit instead, which lands on the
Section Content Text Colour that Global Options writes onto .section.<profile>.
Both sit after .img-overlay-middle in this file, so they win on order. */
.cwb-bgimage__text--colour-white{color:#fff}

.cwb-bgimage__text--colour-profile{color:inherit}

/* The foreground image - a crest, a logo, a piece of set typography - and its
optional tint. The wrapper shrinks to the picture so the tint covers the
picture and nothing else; it used to be a full width block with an absolutely
positioned ::before at width:100%, so the tint ran the width of the section. */
.cwb-bgimage__foreground{position:relative;display:inline-block;max-width:100%}

.cwb-bgimage__foreground--tinted::before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;background:var(--cwb-bgimage-tint,transparent);pointer-events:none}

.cwb-bgimage__foreground>img{display:block;max-width:100%;height:auto}

/* Button alignment, matching the content alignment above. */
.cwb-bgimage__button--left{text-align:left}

.cwb-bgimage__button--center{text-align:center}

.cwb-bgimage__button--right{text-align:right}

/*
* With a Section Title the section holds the heading and then the picture in a
* box of its own. The box does what the section does for the text over the
* picture - a flex column with the section's padding, so the alignment
* dropdowns and the spacing are unchanged - and has no padding when it holds
* only the picture.
*/
.cwb-bgimage-group__box.cwb-bgimage {
    display: flex;
    flex-direction: column;
    padding: 80px 0;
}

.cwb-bgimage-group__box.cwb-bgimage--image-only {
    padding: 0;
}

@media (max-width: 991px) {
    .cwb-bgimage-group__box.cwb-bgimage {
        padding: 50px 0;
    }

    .cwb-bgimage-group__box.cwb-bgimage--image-only {
        padding: 0;
    }
}
