/* =========================================================
   Image with Text
   ========================================================= */
.image-with-text-section {
    word-break: break-word;
    background-color: rgb(var(--color-background));
    padding: var(--section-padding, 30px) 0;

    --iwt-rt-title-font: "Brother Bold", "Brother", sans-serif;
    --iwt-rt-subtitle-font: "FraktionMono Italic", sans-serif;
    --iwt-rt-body-font: "FraktionMono Bold", sans-serif;

    --iwt-button-gap: 12px;
    --iwt-image-caption-gap: 10px;
    --section-title-gap: 20px;
}

/* Do NOT set padding on .page-width here */
.image-with-text-section .page-width {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    gap: var(--content-gap, 0);
}

/* =========================================================
   Section title
   ========================================================= */
.image-with-text__section-title {
    margin: 0 0 var(--section-title-gap, 20px) 0;
    grid-column: 1 / -1;
    font-family: "Brother Bold", "Brother", sans-serif;
    font-weight: 800;
    line-height: 1.1;
}

.image-with-text__section-title.rte p {
    margin: 0;
}

@media (max-width: 959px) {
    .image-with-text__section-title.section-title-align-m-left {
        text-align: left;
    }

    .image-with-text__section-title.section-title-align-m-center {
        text-align: center;
    }

    .image-with-text__section-title.section-title-align-m-right {
        text-align: right;
    }
}

@media (min-width: 960px) {
    .image-with-text__section-title.section-title-align-d-left {
        text-align: left;
    }

    .image-with-text__section-title.section-title-align-d-center {
        text-align: center;
    }

    .image-with-text__section-title.section-title-align-d-right {
        text-align: right;
    }
}

/* =========================================================
   Layout
   ========================================================= */
/* Mobile: stack */
@media (max-width: 959px) {
    .image-with-text-section .page-width {
        display: flex !important;
        flex-direction: column !important;
        gap: var(--content-gap, 0);
    }
}

/* Desktop: 50/50 default */
@media (min-width: 960px) {
    .image-with-text-section .page-width {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: var(--content-gap, 0);
        align-items: stretch !important;
    }

    /* Desktop reverse (swap columns) */
    .image-with-text-section.image-with-text--desktop-reverse .page-width>.image-with-text__image {
        grid-column: 2;
    }

    .image-with-text-section.image-with-text--desktop-reverse .page-width>.image-with-text__group {
        grid-column: 1;
    }

    .image-with-text-section .page-width:not(:has(.image-with-text__image)) {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .image-with-text-section .page-width:not(:has(.image-with-text__image))>.image-with-text__group {
        width: 100%;
        max-width: var(--content-max-width, 1000px);
    }
}

/* Mobile reverse (order swap) */
@media (max-width: 959px) {
    .image-with-text-section.image-with-text--mobile-reverse .page-width>.image-with-text__image {
        order: 1 !important;
    }

    .image-with-text-section.image-with-text--mobile-reverse .page-width>.image-with-text__group {
        order: 0 !important;
    }
}

.image-with-text-section .page-width>.image-with-text__image,
.image-with-text-section .page-width>.image-with-text__group {
    width: 100%;
    min-width: 0;
    max-width: none;
}

/* =========================================================
   Image (+ caption under image)
   ========================================================= */
.image-with-text__image {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: var(--iwt-image-caption-gap);
    overflow: visible;
}

.image-with-text__image-media {
    position: relative;
    display: block;
    width: 100%;
    border-radius: var(--image-radius, 0px);
    overflow: hidden;
}

.image-with-text__image-media>img {
    max-width: 100%;
    width: 100%;
    height: auto;
    aspect-ratio: var(--aspect-ratio, auto);
    object-fit: cover;
    display: block;
}

.image-with-text__image-media .hover-scale__image {
    width: 100%;
    max-width: 100%;
}

.image-with-text__image-media .empty-image-class {
    display: block;
    width: 100%;
    height: 100%;
    background-color: rgb(var(--color-image-background));
}

.image-with-text__image-caption {
    font-family: var(--iwt-rt-body-font);
    color: inherit;
    line-height: 1.3;
}

.image-with-text__image-caption.rte p {
    margin: 0;
}

.image-with-text__image-caption.text-left {
    text-align: left;
}

.image-with-text__image-caption.text-center {
    text-align: center;
}

.image-with-text__image-caption.text-right {
    text-align: right;
}

/* =========================================================
   Group / Skin
   ========================================================= */
.image-with-text__group[class*="color-"] {
    background-color: rgb(var(--color-background));
    color: rgb(var(--color-text));
}

.image-with-text__group,
.image-with-text__group-skin {
    height: 100%;
}

.image-with-text__group-skin {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    padding-inline: var(--group-padding-inline, var(--content-padding, 40px));
    padding-block: var(--group-padding-block, var(--content-padding, 40px));
}

@media (max-width: 959px) {
    .image-with-text__group-skin {
        padding-inline: var(--group-padding-inline-mobile, var(--group-padding-inline, var(--content-padding, 40px)));
        padding-block: var(--group-padding-block-mobile, var(--group-padding-block, var(--content-padding, 40px)));
    }
}

/* Allow blocks to layout without extra wrappers affecting flex/grid */
.image-with-text__group-skin>div[id^="shopline-block-"] {
    display: contents;
}

/* Ensure nested text inherits skin color */
.image-with-text__group-skin :is(h1, h2, h3, h4, h5, h6, p, li, small, span, div) {
    color: inherit;
}

/* Neutralize style-system padding class on OUTER group (keep padding in skin only) */
.image-with-text-section .page-width>.image-with-text__group[class~="layout:block:section--image-with-text__group:spacing"] {
    padding: 0 !important;
    margin: 0 !important;
}

/* =========================================================
   Hard-set fonts
   ========================================================= */
.image-with-text-section .image-with-text__heading,
.image-with-text-section .image-with-text__heading :is(p, span, strong, em, a, li, div) {
    font-family: "Brother Bold", "Brother", sans-serif;
    font-weight: 800;
}

.image-with-text-section .image-with-text__subheading,
.image-with-text-section .image-with-text__subheading :is(p, span, strong, em, a, li, div) {
    font-family: "FraktionMono Italic", sans-serif;
    font-style: italic;
    font-weight: 400;
}

.image-with-text-section .image-with-text__rich-text,
.image-with-text-section .image-with-text__rich-text :is(p, span, strong, em, a, li, div) {
    font-family: "FraktionMono Bold", sans-serif;
}

.image-with-text__subheading {
    font-size: var(--body3-font-size);
    text-transform: uppercase;
    letter-spacing: 0.3em;
}

/* =========================================================
   Per-block typography options
   ========================================================= */
.image-with-text-section .image-with-text-typography--enabled {
    font-size: var(--font-size-mobile, inherit);
    letter-spacing: var(--letter-spacing, normal);
    color: var(--text-color, inherit);
}

@media (min-width: 960px) {
    .image-with-text-section .image-with-text-typography--enabled {
        font-size: var(--font-size-desktop, var(--font-size-mobile, inherit));
    }
}

.image-with-text-section .image-with-text-typography--enabled :is(p, span, strong, em, a, li, small, div) {
    font-size: inherit;
    letter-spacing: inherit;
    color: inherit;
}

/* =========================================================
   Rich text font routing
   ========================================================= */
.image-with-text-section .image-with-text__rich-text {
    font-family: var(--iwt-rt-body-font);
}

.image-with-text-section .image-with-text__rich-text :is(h1, h2) {
    font-family: var(--iwt-rt-title-font);
}

.image-with-text-section .image-with-text__rich-text :is(h3, h4, h5, h6) {
    font-family: var(--iwt-rt-subtitle-font);
}

.image-with-text-section .image-with-text__rich-text :is(p, li, span, strong, em, a, small, div, blockquote) {
    font-family: inherit;
}

/* =========================================================
   Secondary Image + caption (group image mode)
   ========================================================= */
.image-with-text__group-secondary-image {
    border-radius: var(--group-secondary-image-radius, 24px);
    overflow: hidden;
}

.image-with-text__group-secondary-image :is(.image, picture, img) {
    border-radius: inherit;
}

.image-with-text__group-secondary-image img {
    display: block;
    width: 100%;
    height: auto;
}

/* Caption under right column image */
.image-with-text__group-secondary-caption {
    margin-top: 10px;
    line-height: 1.2;
    font-family: "FraktionMono Bold", sans-serif;
}

.image-with-text__group-secondary-caption.rte p {
    margin: 0;
}

/* =========================================================
   Buttons (2 buttons side-by-side)
   ========================================================= */
.image-with-text-section .image-with-text__button {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 48px;
    width: 100%;
    order: 30;
    align-items: flex-start;
}

.image-with-text__button-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--iwt-button-gap, 12px);
    width: 100%;
}

.image-with-text__button-row .button {
    width: fit-content;
    max-width: 100%;
    background-color: var(--button-bg, rgb(var(--color-button-background)));
    color: var(--button-text, rgb(var(--color-button-text)));
    border-radius: var(--button-radius, 12px);
}

/* Button block alignment (explicit) */
.image-with-text-section .image-with-text__button--align-left {
    align-items: flex-start;
}

.image-with-text-section .image-with-text__button--align-center {
    align-items: center;
}

.image-with-text-section .image-with-text__button--align-right {
    align-items: flex-end;
}

.image-with-text-section .image-with-text__button--align-left .image-with-text__button-row {
    justify-content: flex-start;
}

.image-with-text-section .image-with-text__button--align-center .image-with-text__button-row {
    justify-content: center;
}

.image-with-text-section .image-with-text__button--align-right .image-with-text__button-row {
    justify-content: flex-end;
}

/* Button alignment (auto based on content alignment) */
.image-with-text-section .image-with-text__button--align-auto .image-with-text__button-row {
    justify-content: flex-start;
}

@media (min-width: 960px) {
    .image-with-text-section .image-with-text__group-skin.content-align-d-left .image-with-text__button--align-auto .image-with-text__button-row {
        justify-content: flex-start;
    }

    .image-with-text-section .image-with-text__group-skin.content-align-d-center .image-with-text__button--align-auto .image-with-text__button-row {
        justify-content: center;
    }

    .image-with-text-section .image-with-text__group-skin.content-align-d-right .image-with-text__button--align-auto .image-with-text__button--align-auto .image-with-text__button-row,
    .image-with-text-section .image-with-text__group-skin.content-align-d-right .image-with-text__button--align-auto .image-with-text__button-row {
        justify-content: flex-end;
    }
}

@media (max-width: 959px) {
    .image-with-text-section .image-with-text__group-skin.content-align-m-left .image-with-text__button--align-auto .image-with-text__button-row {
        justify-content: flex-start;
    }

    .image-with-text-section .image-with-text__group-skin.content-align-m-center .image-with-text__button--align-auto .image-with-text__button-row {
        justify-content: center;
    }

    .image-with-text-section .image-with-text__group-skin.content-align-m-right .image-with-text__button--align-auto .image-with-text__button-row {
        justify-content: flex-end;
    }
}

/* Button subtext */
.image-with-text__button-subtext {
    width: 100%;
    margin-top: 4px;
    line-height: 1.2;
    font-family: "FraktionMono Bold", sans-serif;
    padding-left: 10px;
}

.image-with-text__button-subtext.rte p {
    margin: 0;
}

.image-with-text__button-subtext--align-left {
    text-align: left !important;
    padding-left: 10px;
}

.image-with-text__button-subtext--align-center {
    text-align: center !important;
    padding-left: 0;
}

.image-with-text__button-subtext--align-right {
    text-align: right !important;
    padding-left: 0;
}

/* Auto-align subtext based on content alignment */
@media (max-width: 959px) {
    .image-with-text__group-skin.content-align-m-left .image-with-text__button-subtext--align-auto {
        text-align: left;
        padding-left: 10px;
    }

    .image-with-text__group-skin.content-align-m-center .image-with-text__button-subtext--align-auto {
        text-align: center;
        padding-left: 0;
    }

    .image-with-text__group-skin.content-align-m-right .image-with-text__button-subtext--align-auto {
        text-align: right;
        padding-left: 0;
    }
}

@media (min-width: 960px) {
    .image-with-text__group-skin.content-align-d-left .image-with-text__button-subtext--align-auto {
        text-align: left;
        padding-left: 10px;
    }

    .image-with-text__group-skin.content-align-d-center .image-with-text__button-subtext--align-auto {
        text-align: center;
        padding-left: 0;
    }

    .image-with-text__group-skin.content-align-d-right .image-with-text__button-subtext--align-auto {
        text-align: right;
        padding-left: 0;
    }
}

/* =========================================================
   Icons
   ========================================================= */
.image-with-text__icons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--group-icons-gap, 18px);
    margin-top: 22px;
    order: 20;
}

.image-with-text__icons--left {
    justify-content: flex-start;
}

.image-with-text__icons--center {
    justify-content: center;
}

.image-with-text__icons--right {
    justify-content: flex-end;
}

.image-with-text__icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: none;
}

.image-with-text__icon-media {
    width: var(--group-icons-width, var(--group-icons-size, 72px));
    height: var(--group-icons-height, var(--group-icons-size, 72px));
    display: grid;
    place-items: center;
    overflow: hidden;
}

@media (max-width: 959px) {
    .image-with-text__icon-media {
        width: var(--group-icons-width-mobile, var(--group-icons-width, var(--group-icons-size, 72px)));
        height: var(--group-icons-height-mobile, var(--group-icons-height, var(--group-icons-size, 72px)));
    }
}

.image-with-text__icon-media :is(img, picture) {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Icon fonts + colors */
.image-with-text-section .image-with-text__icon-label,
.image-with-text-section .image-with-text__icon-heading {
    font-family: "Brother Bold", "Brother", sans-serif;
    font-weight: 800;
    color: var(--icon-heading-color, inherit);
    letter-spacing: var(--icon-heading-letter-spacing, 0.04em);
}

.image-with-text-section .image-with-text__icon-text {
    font-family: "FraktionMono Bold", sans-serif;
    color: var(--icon-text-color, inherit);
    letter-spacing: var(--icon-text-letter-spacing, normal);
}

/* Grid label */
.image-with-text__icon-label {
    margin-top: 10px;
    font-size: var(--group-icon-heading-size, 12px);
    letter-spacing: var(--icon-heading-letter-spacing, 0.08em);
    text-transform: uppercase;
    line-height: 1.1;
}

@media (max-width: 959px) {
    .image-with-text__icon-label {
        font-size: var(--group-icon-heading-size-mobile, var(--group-icon-heading-size, 12px));
    }
}

/* Inline icon list layout */
.image-with-text__icons--inline {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
}

.image-with-text__icons--inline .image-with-text__icon {
    display: grid;
    grid-template-columns: var(--group-icons-width, var(--group-icons-size, 72px)) 1fr;
    column-gap: 16px;
    align-items: center;
    text-align: left;
    width: 100%;
}

@media (max-width: 959px) {
    .image-with-text__icons--inline .image-with-text__icon {
        grid-template-columns: var(--group-icons-width-mobile, var(--group-icons-width, var(--group-icons-size, 72px))) 1fr;
    }
}

.image-with-text__icons--inline .image-with-text__icon-media {
    border-radius: 9999px;
    overflow: hidden;
}

.image-with-text__icon-content {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Inline heading/text default styles */
.image-with-text-section .image-with-text__icon-heading {
    text-transform: uppercase;
    line-height: 1.05;
    margin: 0 0 6px 0;
}

.image-with-text-section .image-with-text__icon-text {
    line-height: 1.35;
}

/* =========================================================
   FIX: Icon typography sizes must respect settings
   - Force container font-size from vars
   - Force ALL RTE descendants to inherit (kills inline font-size)
   ========================================================= */
.image-with-text-section .image-with-text__icons .image-with-text__icon-heading {
    font-size: var(--group-icon-heading-size, 24px) !important;
}

.image-with-text-section .image-with-text__icons .image-with-text__icon-text {
    font-size: var(--group-icon-text-size, 14px) !important;
}

.image-with-text-section .image-with-text__icons .image-with-text__icon-label {
    font-size: var(--group-icon-heading-size, 12px) !important;
}

@media (max-width: 959px) {
    .image-with-text-section .image-with-text__icons .image-with-text__icon-heading {
        font-size: var(--group-icon-heading-size-mobile, 20px) !important;
    }

    .image-with-text-section .image-with-text__icons .image-with-text__icon-text {
        font-size: var(--group-icon-text-size-mobile, 14px) !important;
    }

    .image-with-text-section .image-with-text__icons .image-with-text__icon-label {
        font-size: var(--group-icon-heading-size-mobile, 12px) !important;
    }
}

.image-with-text-section .image-with-text__icons :is(.image-with-text__icon-heading.rte, .image-with-text__icon-text.rte, .image-with-text__icon-label.rte) * {
    font-size: inherit !important;
    line-height: inherit !important;
    letter-spacing: inherit !important;
    color: inherit !important;
}

/* =========================================================
   Content alignment (group skin)
   ========================================================= */
@media (min-width: 960px) {
    .image-with-text__group-skin.content-align-d-left {
        text-align: left;
        align-items: flex-start;
    }

    .image-with-text__group-skin.content-align-d-center {
        text-align: center;
        align-items: center;
    }

    .image-with-text__group-skin.content-align-d-right {
        text-align: right;
        align-items: flex-end;
    }

    .image-with-text__group-skin.content-valign-d-top {
        justify-content: flex-start;
    }

    .image-with-text__group-skin.content-valign-d-center {
        justify-content: center;
    }

    .image-with-text__group-skin.content-valign-d-bottom {
        justify-content: flex-end;
    }
}

@media (max-width: 959px) {
    .image-with-text__group-skin.content-align-m-left {
        text-align: left;
        align-items: flex-start;
    }

    .image-with-text__group-skin.content-align-m-center {
        text-align: center;
        align-items: center;
    }

    .image-with-text__group-skin.content-align-m-right {
        text-align: right;
        align-items: flex-end;
    }

    .image-with-text__group-skin.content-valign-m-top {
        justify-content: flex-start;
    }

    .image-with-text__group-skin.content-valign-m-center {
        justify-content: center;
    }

    .image-with-text__group-skin.content-valign-m-bottom {
        justify-content: flex-end;
    }
}

/* =========================================================
   Section title typography overrides not being respected
   - Forces section title + its richtext children to inherit the
     CSS-variable typography (even if Shopline injects inline styles)
   ========================================================= */

.image-with-text-section .image-with-text__section-title {
    margin: 0 0 var(--section-title-gap, 20px) 0;
    grid-column: 1 / -1;
    font-family: "Brother Bold", "Brother", sans-serif;
    font-weight: 800;
    line-height: 1.1;
}

/* kill default richtext spacing */
.image-with-text-section .image-with-text__section-title.rte :is(p, h1, h2, h3, h4, h5, h6) {
    margin: 0;
}

/* alignment classes (your existing markup) */
@media (max-width: 959px) {
    .image-with-text-section .image-with-text__section-title.section-title-align-m-left {
        text-align: left;
    }

    .image-with-text-section .image-with-text__section-title.section-title-align-m-center {
        text-align: center;
    }

    .image-with-text-section .image-with-text__section-title.section-title-align-m-right {
        text-align: right;
    }
}

@media (min-width: 960px) {
    .image-with-text-section .image-with-text__section-title.section-title-align-d-left {
        text-align: left;
    }

    .image-with-text-section .image-with-text__section-title.section-title-align-d-center {
        text-align: center;
    }

    .image-with-text-section .image-with-text__section-title.section-title-align-d-right {
        text-align: right;
    }
}

/* IMPORTANT:
   Force the typography vars to win over Shopline RTE + inline styles */
.image-with-text-section .image-with-text__section-title.image-with-text-typography--enabled {
    font-size: var(--font-size-mobile, inherit) !important;
    letter-spacing: var(--letter-spacing, normal) !important;
    color: var(--text-color, inherit) !important;
}

@media (min-width: 960px) {
    .image-with-text-section .image-with-text__section-title.image-with-text-typography--enabled {
        font-size: var(--font-size-desktop, var(--font-size-mobile, inherit)) !important;
    }
}

/* Force ALL richtext children to inherit (overrides inline styles too) */
.image-with-text-section .image-with-text__section-title.image-with-text-typography--enabled :is(h1, h2, h3, h4, h5, h6, p, span, strong, em, a, li, small, div, blockquote) {
    font-size: inherit !important;
    letter-spacing: inherit !important;
    color: inherit !important;
}