/*!
 * foundation26 – Text & image (content-text-image); structure only, no .card, surfaces come from Appearance
 * © 2026 Atelier 26 AG – part of digiscapes®. All rights reserved. digiscapes® and brandscapes® are registered trademarks.
 */

/* === Surface === */
/* p-* (!important) wins over this padding. Float types: the surface sits on the text only */
.content-text-image:not(.text-image-float):is([class*="bg-"], [class*="shadow-"]),
.text-image-float .text-image-body:is([class*="bg-"], [class*="shadow-"]) {
    padding: var(--bs-gutter-y) var(--bs-gutter-x);
}

/* === Stack === */
.content-text-image {
    display: flex;
    flex-direction: column;
    gap: var(--bs-gutter-y);
}

.content-text-image.text-image-type-bottom {
    flex-direction: column-reverse;
}

/* Image Gap (bs_container_gap, col-gap-N in foundation26-grid.css): between image and text */
.content-text-image[class*="col-gap-"] {
    gap: var(--bs-col-gap);
}

/* === Image === */
.content-text-image .text-image-img {
    margin: 0;
}

.content-text-image .text-image-img :is(picture, img, svg) {
    display: block;
    width: 100%;
}

/* === Row, Row Reverse === */
.content-text-image .text-image-grid {
    row-gap: var(--bs-gutter-y); /* .row never applies --bs-row-gap; acts only between wrapped lines */
}
.content-text-image .text-image-grid[class*="col-gap-"] {
    row-gap: var(--bs-col-gap); /* the chosen gap also when image and text stack */
}

/* === Vertical Alignment === */
/* align-items, not align-content: the row has a single line */
.content-text-image .text-image-grid,
.content-text-image.text-image-style-top .text-image-grid {
    align-items: flex-start;
}

.content-text-image.text-image-style-center .text-image-grid {
    align-items: center;
}

.content-text-image.text-image-style-bottom .text-image-grid {
    align-items: flex-end;
}

/* min-width: 0 lets long words wrap */
.content-text-image .text-image-grid > .text-image-body {
    flex: 1 1 0;
    min-width: 0;
}

/* === Text === */
.content-text-image .text-image-body > :last-child {
    margin-bottom: 0;
}


/* === Order When Stacked === */
/* Text first only while the row is wrapped: below the breakpoint of the image column, the same container widths
   as the grid (xs 320, sm 440, md 768, lg 1024). "Always" columns (col-3/4/6) never wrap. */
@container not (min-width: 320px) {
    .text-image-text-first:has(> [class*="col-xs-"]) > .text-image-body { order: -1; }
}
@container not (min-width: 440px) {
    .text-image-text-first:has(> [class*="col-sm-"]) > .text-image-body { order: -1; }
}
@container not (min-width: 768px) {
    .text-image-text-first:has(> [class*="col-md-"]) > .text-image-body { order: -1; }
}
@container not (min-width: 1024px) {
    .text-image-text-first:has(> [class*="col-lg-"]) > .text-image-body { order: -1; }
}
