/* Block: Card Image */

/* Light/dark/dark-sand: painel primary (laranja + tinta sand).
   data-surface="primary" + paint --system-bg-primary. Botão/chips
   invertidos contra o fill:
     --system-button-bg = --system-fg          (tinta on-primary)
     --system-button-fg = --system-bg-surface  (cor do fill)
   ACF pode sobrescrever --system-bg-surface inline (--custom-bg).

   Só orange: --system-bg-primary colapsa pra sand (= box). Sem bg ACF
   o card atua como [data-surface="box"] — título preto, muted, chips/botão
   marca. Com --custom-bg o primary + inline prevalece. */
.block-card-image {
    --system-bg-surface:      var(--system-bg-primary);
    --system-fg-on-surface:   var(--system-fg-on-primary);
    --system-button-bg:       var(--system-fg);
    --system-button-fg:       var(--system-bg-surface);
    --system-button-hover-bg: var(--system-fg);
    --system-button-hover-fg: var(--system-bg-surface);
    --system-chips-fg:        var(--system-fg);
}

/* Mesmo rebind de theme.css [data-surface="box"] — só no orange, onde o
   fill primary vira sand. :not(--custom-bg) preserva personalização ACF. */
[data-theme="orange"] .block-card-image:not(.block-card-image--custom-bg) {
    --system-bg-surface:      var(--system-bg-box);
    --system-fg-on-surface:   var(--system-fg-on-box);

    --system-fg-adjustment:   var(--system-fg-adjustment-box);
    --system-fg:              var(--system-fg-on-box);
    --system-fg-primary:      var(--brand-primary);
    --system-fg-secondary:    var(--brand-secondary);

    --system-bg-primary:      var(--brand-primary);
    --system-fg-on-primary:   var(--system-fg-on-brand);
    --system-button-bg:       var(--system-bg-primary);
    --system-button-fg:       var(--system-fg-on-primary);
    --system-button-hover-bg: var(--brand-dark-sand);
    --system-button-hover-fg: var(--system-fg-on-primary);
    --system-chips-fg:        var(--brand-primary);
}

.block-card-image .cta-button { display: inline-flex; }

.block-card-image__card {
    background-color: var(--system-bg-surface);
    border-radius: var(--system-border-radius-lg);
    padding: 15px;
    display: flex;
    gap: var(--system-spacing-gap-lg);
    align-items: flex-start;
    width: 100%;
}

/* The card-image frame is a bio-video-surface wrapper — shared positioning
   (absolute video under overlay image) lives in video-surface.css. We
   only own the block's sizing/border-radius/hover-scale here. */
.block-card-image__col-image {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    border-radius: var(--system-border-radius-md);
    aspect-ratio: 1 / 1;
    min-height: 100%;
}

.block-card-image__image,
.block-card-image__video {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

/* When a video is active the <video> is absolutely positioned, so it
   needs to fill the wrapper — overrides the static height:auto above. */
.block-card-image__col-image.has-video .block-card-image__video {
    height: 100%;
}

.block-card-image__col-image:hover .block-card-image__image,
.block-card-image__col-image:hover .block-card-image__video {
    transform: scale(1.02);
}

/* Mode where the hover zoom would compete with video feedback */
.block-card-image__col-image[data-video-mode="hover"]:hover .block-card-image__video {
    transform: none;
}

.block-card-image__col-content {
    flex: 1 1 0;
    min-width: 0;
    align-self: stretch;
    display: flex;
    gap: var(--system-spacing-gap-xl);
    flex-direction: column;
    justify-content: space-between;
    padding: var(--system-spacing-inset-sm) var(--system-spacing-inset-sm) var(--system-spacing-inset-sm) 0;
    color: var(--system-fg);

    @container page-content (max-width: 1500px) {
        gap: var(--system-spacing-gap-md);
        padding: var(--system-spacing-inset-xs) var(--system-spacing-inset-xs) var(--system-spacing-inset-xs) 0;
    }
}

.block-card-image__header {
    display: flex;
    flex-direction: column;
    gap: var(--system-spacing-gap-md);

    @container page-content (max-width: 1500px) {
        gap: var(--system-spacing-gap-sm);
    }
}

/* Chips (--system-chips-fg) e o h2 (--system-fg) vêm da superfície ativa
   (primary em light/dark; box remap em orange/dark-sand). */

.block-card-image__body {
    display: flex;
    flex-direction: column;
    gap: var(--system-spacing-gap-lg);

    @container page-content (max-width: 1500px) {
        gap: var(--system-spacing-gap-md);
    }
}

.block-card-image__text {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.block-card-image__text p {
    margin: 0;
}

.block-card-image__text p:not(:first-child) {
    color: var(--system-fg-muted);
}

@container page-content (max-width: 1500px) {
    .block-card-image__card {
        padding:10px;
    }
}

@container page-content (max-width: 1500px) {
    .block-card-image__card {
        gap: var(--system-spacing-gap-md);
    }

    .block-card-image__content.text-body-lg {
        font-size: var(--system-font-size-body-md);
        line-height: var(--system-line-height-body-md);
    }

    .block-card-image__content.text-body-md {
        font-size: var(--system-font-size-body-sm);
        line-height: var(--system-line-height-body-sm);
    }

    .block-card-image__text {
    gap: 10px;
    }
}

@container page-content (max-width: 1024px) {
    .block-card-image__card {
        flex-direction: column;
        border-radius: var(--system-border-radius-md);
        padding: 10px;
    }
    /* width: 100% is required because the card keeps `align-items: flex-start`
       on the column flex layout (not stretch). Without video, the inline <img>
       gives the wrapper intrinsic width; with video (card-image uses
       overlay_image=false → no <img>, only absolutely-positioned <video>) the
       wrapper has no content to size itself by and would collapse to 0 width,
       which then collapses `aspect-ratio: 1/1` to 0 height → surface vanishes. */
    .block-card-image__col-image {
        min-width: unset;
        flex: unset;
        width: 100%;
    }

    .block-card-image__title br { display: none; }

    .block-card-image__title h2 { text-align: center; }
    .block-card-image__col-content {
        width: 100%;
        padding: 0 10px 15px 10px;
    }

    .block-card-image__text p { text-align: center; }
    .block-card-image__header { align-items: center; justify-content: center; }
    .block-card-image__card .buttons { justify-content: center; }

    .block-card-image__content.text-body-lg {
        font-size: var(--system-font-size-body-lg);
        line-height: var(--system-line-height-body-lg);
    }

    .block-card-image__content.text-body-md {
        font-size: var(--system-font-size-body-md);
        line-height: var(--system-line-height-body-md);
    }


}

@container page-content (max-width: 768px) {
    .block-card-image__card {
        border-radius: var(--system-border-radius-sm);
    }

    .block-card-image { padding: 0 10px; }
}

