/* --- HERO CAPTION: a full-bleed picture, a boxed title + facts row over its bottom-left corner --- */
.hero-caption {
    position: relative;
    border-bottom: var(--hero-caption-border-bottom, none);
}

.hero-caption__picture {
    display: block;
}

.hero-caption__image {
    display: block;
    width: 100%;
    height: var(--hero-caption-image-height, auto);
    object-fit: cover;
}

.hero-caption__box {
    position: absolute;
    left: var(--hero-caption-left, 5%);
    bottom: var(--hero-caption-bottom, 40px);
    z-index: 2;
    max-width: calc(100% - 2 * var(--hero-caption-left, 5%));
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.hero-caption__title {
    display: inline-block;
    margin: 0 0 var(--hero-caption-title-margin-bottom, 0);
    padding: var(--hero-caption-title-padding, 6px 8px);
    background: var(--hero-caption-bg, rgba(0, 0, 0, 0.8));
    color: var(--hero-caption-color, #FFFFFF);
    font-family: var(--hero-caption-title-font, var(--font-family-heading, inherit));
    font-size: var(--hero-caption-title-size, 28px);
    font-weight: var(--hero-caption-title-weight, 700);
    line-height: var(--hero-caption-title-line-height, 1.1);
    text-transform: var(--hero-caption-title-transform, none);
}

.hero-caption__meta {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: var(--hero-caption-meta-gap, 30px);
    margin: 0;
    padding: var(--hero-caption-meta-padding, 8px 14px);
    background: var(--hero-caption-bg, rgba(0, 0, 0, 0.8));
    color: var(--hero-caption-color, #FFFFFF);
    font-size: var(--hero-caption-meta-size, 14px);
    font-weight: var(--hero-caption-meta-weight, 600);
    line-height: var(--hero-caption-meta-line-height, 1.5);
}

.hero-caption__meta-item {
    display: inline-flex;
    align-items: center;
    gap: var(--hero-caption-icon-gap, 8px);
}

.hero-caption__icon {
    width: var(--hero-caption-icon-size, 22px);
    height: var(--hero-caption-icon-size, 22px);
    flex: 0 0 auto;
}

/* Phones: the box sits under the picture, on its own background. */
@media (max-width: 767px) {
    .hero-caption__box {
        position: static;
        max-width: none;
        padding: var(--hero-caption-padding-mobile, 0);
        background: var(--hero-caption-bg, rgba(0, 0, 0, 0.8));
        align-items: var(--hero-caption-align-mobile, flex-start);
        text-align: var(--hero-caption-align-mobile, left);
    }
    .hero-caption__title,
    .hero-caption__meta {
        width: 100%;
        background: transparent;
    }
    .hero-caption__title {
        font-size: var(--hero-caption-title-size-mobile, var(--hero-caption-title-size, 28px));
        line-height: var(--hero-caption-title-line-height-mobile, var(--hero-caption-title-line-height, 1.1));
    }
    /* Optional short rule under the title (--hero-caption-title-rule-display-mobile: block). */
    .hero-caption__title::after {
        content: '';
        display: var(--hero-caption-title-rule-display-mobile, none);
        width: var(--hero-caption-title-rule-width-mobile, 62px);
        height: 2px;
        margin: var(--hero-caption-title-rule-margin-mobile, 15px auto 5px);
        background: var(--hero-caption-title-rule-color-mobile, var(--color-primary));
    }
    .hero-caption__meta {
        flex-direction: var(--hero-caption-meta-direction-mobile, row);
        align-items: center;
        gap: var(--hero-caption-meta-gap-mobile, 10px 30px);
        padding: var(--hero-caption-meta-padding-mobile, var(--hero-caption-meta-padding, 8px 14px));
        font-size: var(--hero-caption-meta-size-mobile, var(--hero-caption-meta-size, 14px));
    }
}

/* --- Opt-ins (hero-caption.html.twig): extended (hero-caption--extended: a shade over the picture, the title's max
   width, the eyebrow, icons drawn in the text colour, the stacked box's own colours and tablet / phone sizes),
   stackUpTo 'tablet' (hero-caption--stack-tablet) and titleColor 'dark' (hero-caption--dark-text). Every rule below
   sits under one of these modifier classes, so a caption without them renders as before. --- */

.hero-caption--extended .hero-caption__picture {
    position: relative;
}

/* Optional shade over the picture (e.g. a gradient under the caption): --hero-caption-shade, default none, at
   --hero-caption-shade-opacity (default 1). */
.hero-caption--extended .hero-caption__picture::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--hero-caption-shade, none);
    opacity: var(--hero-caption-shade-opacity, 1);
    pointer-events: none;
}

/* Optional width limit of the title (it wraps beyond it). */
.hero-caption--extended .hero-caption__title {
    max-width: var(--hero-caption-title-max-width, none);
}

.hero-caption--extended .hero-caption__eyebrow {
    margin: var(--hero-caption-eyebrow-margin, 0 0 8px);
    padding: var(--hero-caption-eyebrow-padding, var(--hero-caption-title-padding, 6px 8px));
    background: var(--hero-caption-eyebrow-bg, var(--hero-caption-bg, rgba(0, 0, 0, 0.8)));
    color: var(--hero-caption-color, #FFFFFF);
    font-family: var(--hero-caption-eyebrow-font, var(--hero-caption-title-font, var(--font-family-heading, inherit)));
    font-size: var(--hero-caption-eyebrow-size, 14px);
    font-weight: var(--hero-caption-eyebrow-weight, 700);
    line-height: var(--hero-caption-eyebrow-line-height, 1.5);
    text-transform: var(--hero-caption-eyebrow-transform, uppercase);
}

/* titleColor 'dark' (a light picture): the caption in --hero-caption-dark-color over --hero-caption-dark-shade
   (defaults: the usual colour and shade). Stacked layouts below keep their own colours. */
.hero-caption--dark-text .hero-caption__picture::after {
    background: var(--hero-caption-dark-shade, var(--hero-caption-shade, none));
}

.hero-caption--dark-text .hero-caption__eyebrow,
.hero-caption--dark-text .hero-caption__title,
.hero-caption--dark-text .hero-caption__meta {
    color: var(--hero-caption-dark-color, var(--hero-caption-color, #FFFFFF));
}

/* iconMask: the icon file is used as a mask, filled with the text colour. */
.hero-caption--extended .hero-caption__icon--mask {
    display: inline-block;
    background-color: currentColor;
    -webkit-mask: var(--hero-caption-icon) center / contain no-repeat;
    mask: var(--hero-caption-icon) center / contain no-repeat;
}

/* Stacked (phones, and tablets with stackUpTo 'tablet'): the box under the picture in its own colours
   (--hero-caption-stacked-bg, --hero-caption-stacked-color; default the caption's), the picture and the type with
   their -mobile tokens (-tablet first on tablets). */
@media (max-width: 767px) {
    .hero-caption--extended .hero-caption__image {
        height: var(--hero-caption-image-height-mobile, var(--hero-caption-image-height, auto));
    }
    .hero-caption--extended .hero-caption__picture::after {
        background: var(--hero-caption-shade-stacked, var(--hero-caption-shade, none));
    }
    .hero-caption--extended .hero-caption__box {
        background: var(--hero-caption-stacked-bg, var(--hero-caption-bg, rgba(0, 0, 0, 0.8)));
    }
    .hero-caption--extended .hero-caption__eyebrow,
    .hero-caption--extended .hero-caption__title,
    .hero-caption--extended .hero-caption__meta {
        background: transparent;
        color: var(--hero-caption-stacked-color, var(--hero-caption-color, #FFFFFF));
    }
    .hero-caption--extended .hero-caption__eyebrow {
        margin: var(--hero-caption-eyebrow-margin-mobile, var(--hero-caption-eyebrow-margin, 0 0 8px));
        font-size: var(--hero-caption-eyebrow-size-mobile, var(--hero-caption-eyebrow-size, 14px));
        line-height: var(--hero-caption-eyebrow-line-height-mobile, var(--hero-caption-eyebrow-line-height, 1.5));
    }
    .hero-caption--extended .hero-caption__title {
        margin: var(--hero-caption-title-margin-mobile, 0 0 var(--hero-caption-title-margin-bottom, 0));
    }
    .hero-caption--extended .hero-caption__meta {
        align-items: var(--hero-caption-meta-align-mobile, center);
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .hero-caption--stack-tablet .hero-caption__image {
        height: var(--hero-caption-image-height-tablet, var(--hero-caption-image-height-mobile, var(--hero-caption-image-height, auto)));
    }
    .hero-caption--stack-tablet .hero-caption__picture::after {
        background: var(--hero-caption-shade-stacked, var(--hero-caption-shade, none));
    }
    .hero-caption--stack-tablet .hero-caption__box {
        position: static;
        max-width: none;
        padding: var(--hero-caption-padding-tablet, var(--hero-caption-padding-mobile, 0));
        background: var(--hero-caption-stacked-bg, var(--hero-caption-bg, rgba(0, 0, 0, 0.8)));
        align-items: var(--hero-caption-align-mobile, flex-start);
        text-align: var(--hero-caption-align-mobile, left);
    }
    .hero-caption--stack-tablet .hero-caption__eyebrow,
    .hero-caption--stack-tablet .hero-caption__title,
    .hero-caption--stack-tablet .hero-caption__meta {
        width: 100%;
        background: transparent;
        color: var(--hero-caption-stacked-color, var(--hero-caption-color, #FFFFFF));
    }
    .hero-caption--stack-tablet .hero-caption__eyebrow {
        margin: var(--hero-caption-eyebrow-margin-tablet, var(--hero-caption-eyebrow-margin-mobile, var(--hero-caption-eyebrow-margin, 0 0 8px)));
        font-size: var(--hero-caption-eyebrow-size-tablet, var(--hero-caption-eyebrow-size-mobile, var(--hero-caption-eyebrow-size, 14px)));
        line-height: var(--hero-caption-eyebrow-line-height-tablet, var(--hero-caption-eyebrow-line-height-mobile, var(--hero-caption-eyebrow-line-height, 1.5)));
    }
    .hero-caption--stack-tablet .hero-caption__title {
        margin: var(--hero-caption-title-margin-tablet, var(--hero-caption-title-margin-mobile, 0 0 var(--hero-caption-title-margin-bottom, 0)));
        font-size: var(--hero-caption-title-size-tablet, var(--hero-caption-title-size-mobile, var(--hero-caption-title-size, 28px)));
        line-height: var(--hero-caption-title-line-height-tablet, var(--hero-caption-title-line-height-mobile, var(--hero-caption-title-line-height, 1.1)));
    }
    .hero-caption--stack-tablet .hero-caption__meta {
        flex-direction: var(--hero-caption-meta-direction-tablet, row);
        gap: var(--hero-caption-meta-gap-tablet, var(--hero-caption-meta-gap-mobile, 10px 30px));
        padding: var(--hero-caption-meta-padding-tablet, var(--hero-caption-meta-padding-mobile, var(--hero-caption-meta-padding, 8px 14px)));
    }
}
