/* =========================================================
   MONTAGE: IMAGES
   Split from the child theme style.css for maintainability.
   ========================================================= */

/* CTAs with image mask */

.class-cta-mask img {
  aspect-ratio: 1;
  clip-path: polygon(
    37.3% 2.7%,
    50% 4%,
    62.7% 2.7%,
    73% 10.2%,
    84.6% 15.4%,
    89.8% 27%,
    97.3% 37.3%,
    96% 50%,
    97.3% 62.7%,
    89.8% 73%,
    84.6% 84.6%,
    73% 89.8%,
    62.7% 97.3%,
    50% 96%,
    37.3% 97.3%,
    27% 89.8%,
    15.4% 84.6%,
    10.2% 73%,
    2.7% 62.7%,
    4% 50%,
    2.7% 37.3%,
    10.2% 27%,
    15.4% 15.4%,
    27% 10.2%
  );
  object-fit: cover;
  width: 100%;
}

/* =====================================================
   ORGANIC IMAGE CARDS

   Apply to the Elementor Image widgets:

   organic-mask organic-mask--one
   organic-mask organic-mask--two
   organic-mask organic-mask--three
   ===================================================== */


/* ---------- Base widget ---------- */

.organic-mask {
    --blob-colour: #ffbd00;
    --blob-mask: none;
    --blob-transform: none;
    --blob-inset: 4px;
    --image-shape: 50%;

    position: relative;
    isolation: isolate;
    overflow: visible !important;
}


/* ---------- Yellow background shape ---------- */

.organic-mask::before {
    content: "";
    position: absolute;
    inset: var(--blob-inset);
    z-index: 0;

    pointer-events: none;
    background-color: var(--blob-colour);

    -webkit-mask-image: var(--blob-mask);
    mask-image: var(--blob-mask);

    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;

    -webkit-mask-position: center;
    mask-position: center;

    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;

    transform: var(--blob-transform);
    transform-origin: center;
}


/* ---------- Linked and unlinked images ---------- */

.organic-mask > img,
.organic-mask > a,
.organic-mask > picture {
    position: relative;
    z-index: 1;

    display: block;
    width: 100%;
}


/* ---------- Image sizing and shape ---------- */

.organic-mask img {
    display: block;

    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;

    object-fit: cover;
    object-position: center;

    border-radius: var(--image-shape);
}


/* =====================================================
   VARIANT 1
   ===================================================== */

.organic-mask--one {
    --image-shape:
        42% 58% 47% 53%
        /
        48% 41% 59% 52%;

    --blob-mask:
        url("/wp-content/themes/montage/assets/masks/organic-background-one.svg");

    --blob-inset: 0;

    --blob-transform:
        translate(-1%, 1%) scale(1.06);
}


/* =====================================================
   VARIANT 2
   ===================================================== */

.organic-mask--two {
    --image-shape:
        56% 44% 53% 47%
        /
        43% 55% 45% 57%;

    --blob-mask:
        url("/wp-content/themes/montage/assets/masks/organic-background-two.svg");

    --blob-inset: 0;

    --blob-transform:
        translate(-1%, 1%) scale(1.06);
}


/* =====================================================
   VARIANT 3
   ===================================================== */

.organic-mask--three {
    --image-shape:
        47% 53% 41% 59%
        /
        52% 43% 57% 48%;

    --blob-mask:
        url("/wp-content/themes/montage/assets/masks/organic-background-three.svg");

       --blob-inset: 0;

    --blob-transform:
        translate(-1%, 1%) scale(1.06);
}


/* =====================================================
   TABLET
   ===================================================== */

@media (max-width: 1024px) {

    .organic-mask--one {
        --blob-inset: 4px;
        --blob-transform: translate(-4px, 3px);
    }

    .organic-mask--two {
        --blob-inset: 2px;
        --blob-transform: translate(3px, 3px);
    }

    .organic-mask--three {
        --blob-inset: 6px;
        --blob-transform: translate(5px, 2px);
    }
}


/* =====================================================
   MOBILE
   ===================================================== */

@media (max-width: 767px) {

    .organic-mask {
        width: 100%;
        max-width: 440px;
        margin-inline: auto;
    }

    .organic-mask--one {
        --blob-inset: 3px;
        --blob-transform: translate(-3px, 3px);
    }

    .organic-mask--two {
        --blob-inset: 1px;
        --blob-transform: translate(3px, 2px);
    }

    .organic-mask--three {
        --blob-inset: 5px;
        --blob-transform: translate(4px, 2px);
    }
}

/* =====================================================
   WHO WE ARE BANNER IMAGE

   Apply "who-banner-image" to the Image widget.

   Parent banner container:
   - Position: Relative
   - Overflow: Hidden
   ===================================================== */


/* ---------- Image widget ---------- */

.who-banner-image {
    position: absolute !important;
    inset: 0 !important;

    z-index: 1;

    width: 100% !important;
    height: 100% !important;

    overflow: hidden;

    /*
     * The image widget covers the entire banner.
     *
     * Three corners of this quadrilateral sit outside
     * the banner canvas. Only the angled left point and
     * intersecting edges remain visible.
     */

    -webkit-clip-path: polygon(
        86.5% -88%,
        113.5% 83%,
        44.5% 119%,
        31.7% 25%
    );

    clip-path: polygon(
        86.5% -88%,
        113.5% 83%,
        44.5% 119%,
        31.7% 25%
    );
}


/* ---------- Photograph ---------- */

.who-banner-image img {
    display: block;
    position: absolute;
    inset: 0;

    width: 100% !important;
    height: 100% !important;

    object-fit: cover;

    /*
     * Adjust this if the important subject needs
     * to move horizontally within the mask.
     */
    object-position: var(--who-banner-focus, center center);
}


/* ---------- Keep banner content above the image ---------- */

.who-banner-image ~ *,
.who-banner-image + * {
    position: relative;
    z-index: 2;
}


/* =====================================================
   TABLET
   ===================================================== */

@media (max-width: 1024px) {

    .who-banner-image {
        -webkit-clip-path: polygon(
            90% -82%,
            117% 84%,
            46% 120%,
            29% 24%
        );

        clip-path: polygon(
            90% -82%,
            117% 84%,
            46% 120%,
            29% 24%
        );
    }

    .who-banner-image img {
        object-position: var(--who-banner-focus, center center);
    }
}


/* =====================================================
   MOBILE
   ===================================================== */

@media (max-width: 767px) {

    .who-banner-image {
        /*
         * Maintains the same off-canvas concept but moves
         * the visible point leftward so more of the image
         * remains visible on a narrow screen.
         */

        -webkit-clip-path: polygon(
            115% -70%,
            140% 84%,
            38% 120%,
            16% 36%
        );

        clip-path: polygon(
            115% -70%,
            140% 84%,
            38% 120%,
            16% 36%
        );
    }

    .who-banner-image img {
        object-position: var(--who-banner-focus, center center);
    }
}


/* =====================================================
   PERSON BIO IMAGE MASK

   Apply to the Elementor Image widget:

   person-bio-mask

   Optional positioning classes:
   person-bio-mask--left
   person-bio-mask--right
   person-bio-mask--top
   person-bio-mask--bottom

   Creates:
   - Angular portrait crop
   - Yellow angled shape top-left
   - Yellow angled shape on right
   ===================================================== */


/* =====================================================
   BASE WIDGET
   ===================================================== */

.person-bio-mask {
    --person-yellow: #ffbd00;

    /*
     * Main portrait shape
     */
    --person-image-shape:
        polygon(
            37% 0%,
            63% 0%,
            76% 31%,
            98% 86%,
            22% 100%,
            0% 100%,
            0% 29%
        );

    position: relative;
    isolation: isolate;

    width: 100%;

    overflow: visible !important;
}


/* =====================================================
   YELLOW BACKGROUND SHAPES
   ===================================================== */


/* ---------- Top-left yellow shape ---------- */

.person-bio-mask::before {
    content: "";

    position: absolute;
    z-index: 0;

    top: 0;
    left: 0;

    width: 38%;
    height: 30%;

    background-color: var(--person-yellow);

    -webkit-clip-path:
        polygon(
            18% 0%,
            71% 0%,
            100% 24%,
            0% 100%
        );

    clip-path:
        polygon(
            18% 0%,
            71% 0%,
            100% 24%,
            0% 100%
        );

    pointer-events: none;
}


/* ---------- Right-hand yellow shape ---------- */

.person-bio-mask::after {
    content: "";

    position: absolute;
    z-index: 0;

    top: 31%;
    right: 2%;

    width: 30%;
    height: 39%;

    background-color: var(--person-yellow);

    -webkit-clip-path:
        polygon(
            0% 0%,
            100% 28%,
            82% 100%,
            25% 76%
        );

    clip-path:
        polygon(
            0% 0%,
            100% 28%,
            82% 100%,
            25% 76%
        );

    transform: rotate(-1deg);

    pointer-events: none;
}


/* =====================================================
   ELEMENTOR IMAGE WRAPPERS
   ===================================================== */

.person-bio-mask > img,
.person-bio-mask > a,
.person-bio-mask > picture {
    position: relative;
    z-index: 1;

    display: block;

    width: 100%;
}


/* =====================================================
   PORTRAIT IMAGE
   ===================================================== */

.person-bio-mask img {
    display: block;

    width: 100% !important;
    height: auto !important;

    /*
     * Keeps every portrait using the same composition.
     */
    aspect-ratio: 1.03 / 1;

    object-fit: cover;
    object-position: center center;

    border-radius: 0 !important;

    -webkit-clip-path: var(--person-image-shape);
    clip-path: var(--person-image-shape);
}


/* =====================================================
   OPTIONAL INDIVIDUAL PORTRAIT POSITIONING

   Add one of these alongside person-bio-mask
   where a particular headshot needs adjusting.
   ===================================================== */


/* Move image framing towards the left */

.person-bio-mask--left img {
    object-position: 40% center;
}


/* Move image framing towards the right */

.person-bio-mask--right img {
    object-position: 60% center;
}


/* Show more of the top of the portrait */

.person-bio-mask--top img {
    object-position: center 30%;
}


/* Show more of the lower part of the portrait */

.person-bio-mask--bottom img {
    object-position: center 70%;
}


/* =====================================================
   RESPONSIVE ADJUSTMENTS
   ===================================================== */

@media (max-width: 767px) {

    .person-bio-mask {
        /*
         * Slightly simplify the shape on smaller screens
         * while retaining the overall visual treatment.
         */
        --person-image-shape:
            polygon(
                30% 0%,
                68% 0%,
                79% 31%,
                98% 86%,
                18% 100%,
                0% 100%,
                0% 25%
            );
    }

    .person-bio-mask::before {
        width: 40%;
        height: 28%;
    }

    .person-bio-mask::after {
        top: 30%;
        right: 1%;

        width: 31%;
        height: 40%;
    }
}

/* =====================================================
   ANGULAR IMAGE ACCENT

   Apply "angular-image-accent" to an Elementor Image
   widget under Advanced → CSS Classes.
   ===================================================== */

.angular-image-accent {
    --angular-accent-colour: #ffbd00;

    position: relative;
    isolation: isolate;

    width: 50% !important;
    max-width: 50% !important;

    margin-left: auto !important;
    margin-right: 0 !important;

    align-self: flex-end;

    overflow: visible !important;
}


/* Large triangular shape behind the image */
.angular-image-accent::before {
    content: "";

    position: absolute;
    z-index: 0;

    top: -4%;
    right: -18%;
    bottom: 2.5%;
    left: -4%;

    pointer-events: none;

    background-color: var(--angular-accent-colour);

    -webkit-clip-path: polygon(
        28% 0%,
        100% 50%,
        0% 78%
    );

    clip-path: polygon(
        28% 0%,
        100% 50%,
        0% 78%
    );
}


/* Keep Elementor wrappers above the triangle */

.angular-image-accent > .elementor-widget-container,
.angular-image-accent > a,
.angular-image-accent > picture {
    position: relative;
    z-index: 1;

    display: block;
    width: 100%;
}


/* Keep linked and unlinked images above the triangle */

.angular-image-accent img {
    position: relative;
    z-index: 1;

    display: block;

    width: 100% !important;
    height: auto;

    margin-left: auto;
    margin-right: 0;
}


/* =====================================================
   TABLET
   ===================================================== */

@media (max-width: 1024px) {

    .angular-image-accent {
        width: 75% !important;
        max-width: 75% !important;

        margin-left: auto !important;
        margin-right: 0 !important;
    }

    .angular-image-accent::before {
        top: -3%;
        right: -6%;
        bottom: 3%;
        left: -3%;
    }
}


/* =====================================================
   MOBILE
   ===================================================== */

@media (max-width: 767px) {

    .angular-image-accent {
        width: 75% !important;
        max-width: 75% !important;

        align-self: center;

        margin-left: auto !important;
        margin-right: auto !important;
    }

    .angular-image-accent::before {
        top: -3%;
        right: -8%;
        bottom: 3%;
        left: -3%;
    }
}


/* =====================================================
   BLOG LOOP GRID — CONSISTENT 3:2 FEATURED IMAGES

   Apply "blog-loop-image" to the Featured Image widget
   inside the Loop Item template.
   ===================================================== */

.blog-loop-image {
    aspect-ratio: 50 / 33;
    overflow: hidden;
}

.blog-loop-image > .elementor-widget-container,
.blog-loop-image a,
.blog-loop-image picture {
    display: block;
    width: 100%;
    height: 100%;
}

.blog-loop-image img {
    display: block;
    width: 100% !important;
    height: 100% !important;

    object-fit: cover !important;
    object-position: center;
}

/* =====================================================
   BRAND SHAPE 05 IMAGE ACCENT

   Apply "brand-shape-05" to an Elementor Image widget
   under Advanced → CSS Classes.
   ===================================================== */

.brand-shape-05 {
    --brand-shape-colour: #c6e1ff;

    isolation: isolate;

    width: 75% !important;
    max-width: 75% !important;

    margin-left: auto !important;
    margin-right: 0 !important;

    align-self: flex-end;

    overflow: visible !important;
}


/* =====================================================
   SVG BACKGROUND SHAPE
   ===================================================== */

.brand-shape-05::before {
    content: "";

    position: absolute;
    z-index: 0;

    /*
     * Larger negative offsets = more of the
     * background shape visible around the image.
     */
    top: -14%;
    right: -20%;
    bottom: -10%;
    left: -16%;

    pointer-events: none;

    background-color: var(--brand-shape-colour);

    -webkit-mask-image: url("../masks/brand-shapes-05.svg");
    mask-image: url("../masks/brand-shapes-05.svg");

    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;

    -webkit-mask-position: center;
    mask-position: center;

    -webkit-mask-size: contain;
    mask-size: contain;
}


/* =====================================================
   ELEMENTOR WRAPPERS
   Keep the image above the background shape
   ===================================================== */

.brand-shape-05 > .elementor-widget-container,
.brand-shape-05 > a,
.brand-shape-05 > picture {
    position: relative;
    z-index: 1;

    display: block;

    width: 100%;
}


/* Image */

.brand-shape-05 img {
    position: relative;
    z-index: 1;

    display: block;

    width: 100% !important;
    height: auto;

    margin-left: auto;
    margin-right: 0;
}


/* =====================================================
   OPTIONAL ALIGNMENT MODIFIERS
   ===================================================== */


/* Centre image */

.brand-shape-05.brand-shape-05--center {
    margin-left: auto !important;
    margin-right: auto !important;

    align-self: center;
}


/* Align left */

.brand-shape-05.brand-shape-05--left {
    margin-left: 0 !important;
    margin-right: auto !important;

    align-self: flex-start;
}


/* Full width */

.brand-shape-05.brand-shape-05--full {
    width: 100% !important;
    max-width: 100% !important;
}


/* =====================================================
   TABLET
   ===================================================== */

@media (max-width: 1024px) {

    .brand-shape-05 {
        width: 75% !important;
        max-width: 75% !important;

        margin-left: auto !important;
        margin-right: 0 !important;
    }

    .brand-shape-05::before {
        top: -12%;
        right: -16%;
        bottom: -8%;
        left: -12%;
    }


    /* Preserve alignment modifiers */

    .brand-shape-05.brand-shape-05--center {
        margin-left: auto !important;
        margin-right: auto !important;

        align-self: center;
    }

    .brand-shape-05.brand-shape-05--left {
        margin-left: 0 !important;
        margin-right: auto !important;

        align-self: flex-start;
    }

    .brand-shape-05.brand-shape-05--full {
        width: 100% !important;
        max-width: 100% !important;
    }

}


/* =====================================================
   MOBILE
   ===================================================== */

@media (max-width: 767px) {

    .brand-shape-05 {
        width: 75% !important;
        max-width: 75% !important;

        align-self: center;

        margin-left: auto !important;
        margin-right: auto !important;
    }

    .brand-shape-05::before {
        top: -10%;
        right: -14%;
        bottom: -7%;
        left: -10%;
    }


    /* Full width modifier */

    .brand-shape-05.brand-shape-05--full {
        width: 100% !important;
        max-width: 100% !important;
    }

}

/* =====================================================
   WHO WE ARE BANNER — KEN BURNS ZOOM
   ===================================================== */

.who-banner-image img {
    transform-origin: center center;
    animation: who-banner-ken-burns 10s ease-out forwards;
}

@keyframes who-banner-ken-burns {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.12);
    }
}

/* Respect visitors who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .who-banner-image img {
        animation: none;
        transform: none;
    }
}

/* =====================================================
   ANGULAR IMAGE ACCENT — ENTRANCE ANIMATION
   ===================================================== */

/* Rotate the coloured shape into position */
.angular-image-accent::before {
    transform-origin: center center;
    animation: angular-accent-rotate 1.4s ease-out both;
}

@keyframes angular-accent-rotate {
    from {
        opacity: 0;
        transform: rotate(-45deg);
    }

    to {
        opacity: 1;
        transform: rotate(0deg);
    }
}

/* Fade the photograph in over the shape */
.angular-image-accent img {
    animation: angular-image-fade-in 1.2s ease-out 0.4s both;
}

@keyframes angular-image-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Respect visitors who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .angular-image-accent::before,
    .angular-image-accent img {
        animation: none;
    }
}

/* =====================================================
   BRAND SHAPE 05 — ENTRANCE ANIMATION
   ===================================================== */

/* Rotate and fade the background shape into position */
.brand-shape-05::before {
    transform-origin: center center;
    animation: brand-shape-05-rotate 1.4s ease-out both;
}

@keyframes brand-shape-05-rotate {
    from {
        opacity: 0;
        transform: rotate(-45deg);
    }

    to {
        opacity: 1;
        transform: rotate(0deg);
    }
}

/* Fade the photograph in over the shape */
.brand-shape-05 img {
    animation: brand-shape-05-image-fade 1.2s ease-out 0.4s both;
}

@keyframes brand-shape-05-image-fade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Respect visitors who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .brand-shape-05::before,
    .brand-shape-05 img {
        animation: none;
    }
}