/* Blog archive hero reference template */
.acdh-template-blog_archive {
    --acdh-blog-bg-start: #ffffff;
    --acdh-blog-bg-end: #edf5ff;
    --acdh-blog-content-max: 1440px;
    --acdh-blog-min-height: 520px;
    --acdh-blog-inline-pad: 56px;
    --acdh-blog-block-pad: 36px;
    --acdh-blog-gap: 56px;
    --acdh-blog-media-width: 42%;
    --acdh-blog-image-height: 460px;
    --acdh-blog-image-x: 0px;
    --acdh-blog-image-y: 0px;
    --acdh-blog-halo-size: 360px;
    --acdh-blog-halo-opacity: .92;
    --acdh-blog-copy-max: 620px;
    --acdh-blog-title-size: 56px;
    --acdh-blog-title-color: #111827;
    --acdh-blog-line-width: 72px;
    --acdh-blog-line-height: 4px;
    --acdh-blog-line-color: #246bdf;
    --acdh-blog-description-size: 21px;
    --acdh-blog-description-color: #5f6b7a;
    --acdh-blog-decoration-size: 210px;
    --acdh-blog-decoration-opacity: .13;
    position: relative;
    width: 100%;
    max-width: 100%;
    min-height: var(--acdh-blog-min-height);
    margin-inline: 0;
    overflow: clip;
    background: linear-gradient(110deg, var(--acdh-blog-bg-start) 0%, var(--acdh-blog-bg-end) 100%);
}

/*
 * Keep viewport bleed independent from the constrained inner content. Using the
 * same symmetric breakout on RTL and LTR avoids the one-sided bleed issue that
 * can happen when Elementor parents have a boxed width.
 */
.acdh-template-blog_archive.acdh-blog-full-bleed {
    width: 100vw;
    max-width: 100vw;
    margin-inline: calc(50% - 50vw);
}

.acdh-template-blog_archive .acdh-template-shell {
    width: min(var(--acdh-blog-content-max), 100%);
    min-height: var(--acdh-blog-min-height);
    margin-inline: auto;
    padding-top: calc(var(--acdh-blog-block-pad) + var(--acdh-active-header-safe, 0px));
    padding-right: var(--acdh-blog-inline-pad);
    padding-bottom: var(--acdh-blog-block-pad);
    padding-left: var(--acdh-blog-inline-pad);
    display: grid;
    grid-template-columns: minmax(0, var(--acdh-blog-media-width)) minmax(0, 1fr);
    align-items: center;
    gap: var(--acdh-blog-gap);
    position: relative;
    z-index: 2;

    /*
     * Physical left/right placement must not flip when writing direction flips.
     * Text direction is restored on the content column below.
     */
    direction: ltr;
}

/* Default/fallback layout: image physically left, content physically right. */
.acdh-template-blog_archive .acdh-template-media {
    order: 1;
}

.acdh-template-blog_archive .acdh-template-content {
    order: 2;
}

/* Desktop physical-side control generated by the shared layout compatibility layer. */
.acdh-blog-layout-state.acdh-blog-media-left .acdh-template-blog_archive .acdh-template-shell {
    grid-template-columns: minmax(0, var(--acdh-blog-media-width)) minmax(0, 1fr);
}

.acdh-blog-layout-state.acdh-blog-media-left .acdh-template-blog_archive .acdh-template-media {
    order: 1;
}

.acdh-blog-layout-state.acdh-blog-media-left .acdh-template-blog_archive .acdh-template-content {
    order: 2;
}

.acdh-blog-layout-state.acdh-blog-media-right .acdh-template-blog_archive .acdh-template-shell {
    grid-template-columns: minmax(0, 1fr) minmax(0, var(--acdh-blog-media-width));
}

.acdh-blog-layout-state.acdh-blog-media-right .acdh-template-blog_archive .acdh-template-content {
    order: 1;
}

.acdh-blog-layout-state.acdh-blog-media-right .acdh-template-blog_archive .acdh-template-media {
    order: 2;
}

.acdh-template-blog_archive .acdh-template-media {
    position: relative;
    align-self: end;
    min-height: var(--acdh-blog-image-height);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    min-width: 0;
}

.acdh-template-blog_archive .acdh-template-media-halo {
    position: absolute;
    width: var(--acdh-blog-halo-size);
    aspect-ratio: 1;
    border-radius: 50%;
    background: rgba(221, 235, 255, var(--acdh-blog-halo-opacity));
    left: 50%;
    top: 48%;
    transform: translate(-50%, -50%);
    z-index: 0;
}

.acdh-template-blog_archive .acdh-template-image {
    position: relative;
    z-index: 1;
    height: var(--acdh-blog-image-height);
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    transform: translate(var(--acdh-blog-image-x), var(--acdh-blog-image-y));
}

.acdh-template-blog_archive .acdh-template-image img {
    display: block;
    width: auto;
    max-width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: bottom center;
}

.acdh-template-blog_archive .acdh-template-content {
    position: relative;
    z-index: 3;
    max-width: var(--acdh-blog-copy-max);
    justify-self: start;
    min-width: 0;
    text-align: start;
}

/* Restore writing direction after the shell is locked to physical LTR layout. */
.acdh-template-blog_archive[dir="rtl"] .acdh-template-content {
    direction: rtl;
}

.acdh-template-blog_archive[dir="ltr"] .acdh-template-content {
    direction: ltr;
}

.acdh-template-blog_archive .acdh-template-blog-title {
    margin: 0;
    font-size: var(--acdh-blog-title-size);
    line-height: 1.15;
    font-weight: 800;
    color: var(--acdh-blog-title-color);
}

.acdh-template-blog_archive .acdh-template-blog-title-line {
    display: block;
    width: var(--acdh-blog-line-width);
    height: var(--acdh-blog-line-height);
    margin-block: 16px 24px;
    margin-inline-start: 0;
    border-radius: 999px;
    background: var(--acdh-blog-line-color);
}

.acdh-template-blog_archive .acdh-template-blog-description {
    margin: 0;
    max-width: var(--acdh-blog-copy-max);
    color: var(--acdh-blog-description-color);
    font-size: var(--acdh-blog-description-size);
    line-height: 1.95;
}

.acdh-template-blog-decoration {
    position: absolute;
    z-index: 1;
    width: var(--acdh-blog-decoration-size);
    height: var(--acdh-blog-decoration-size);
    inset-inline-start: 6%;
    inset-block-start: 50%;
    transform: translateY(-50%);
    opacity: var(--acdh-blog-decoration-opacity);
    pointer-events: none;
}

.acdh-template-blog-decoration svg {
    width: 100%;
    height: 100%;
    display: block;
    fill: none;
    stroke: #4d8ee8;
    stroke-width: 1.5;
}

.acdh-template-blog_archive.acdh-blog-no-decoration .acdh-template-blog-decoration,
.acdh-template-blog_archive.acdh-blog-hide-image .acdh-template-media {
    display: none;
}

.acdh-template-blog_archive.acdh-blog-hide-image .acdh-template-shell {
    grid-template-columns: 1fr !important;
}

.acdh-template-blog_archive.acdh-blog-hide-image .acdh-template-content {
    order: 1 !important;
    justify-self: center;
}

/*
 * Header overlap is owned by the base Doctor Hero CSS. The reference template
 * now consumes its active safe-space variable so the inherited Elementor
 * control visibly moves both columns below the header instead of only changing
 * the base template's .acdh-content padding.
 */
.acdh-template-blog_archive.acdh-under-header .acdh-template-shell {
    padding-top: calc(var(--acdh-blog-block-pad) + var(--acdh-active-header-safe, 0px));
}

@media (max-width: 1024px) {
    .acdh-template-blog_archive {
        --acdh-blog-min-height: 460px;
        --acdh-blog-inline-pad: 32px;
        --acdh-blog-block-pad: 30px;
        --acdh-blog-gap: 32px;
        --acdh-blog-media-width: 44%;
        --acdh-blog-image-height: 390px;
        --acdh-blog-title-size: 46px;
        --acdh-blog-description-size: 18px;
        --acdh-blog-decoration-size: 160px;
    }

    /* Tablet stack mode. */
    .acdh-blog-layout-state.acdh-blog-tablet-stack .acdh-template-blog_archive .acdh-template-shell {
        grid-template-columns: 1fr;
    }

    .acdh-blog-layout-state.acdh-blog-tablet-stack .acdh-template-blog_archive .acdh-template-content,
    .acdh-blog-layout-state.acdh-blog-tablet-stack .acdh-template-blog_archive .acdh-template-media {
        width: 100%;
        max-width: 100%;
    }

    .acdh-blog-layout-state.acdh-blog-tablet-stack.acdh-blog-stack-media-first .acdh-template-blog_archive .acdh-template-media {
        order: 1;
    }

    .acdh-blog-layout-state.acdh-blog-tablet-stack.acdh-blog-stack-media-first .acdh-template-blog_archive .acdh-template-content {
        order: 2;
    }

    .acdh-blog-layout-state.acdh-blog-tablet-stack.acdh-blog-stack-content-first .acdh-template-blog_archive .acdh-template-content {
        order: 1;
    }

    .acdh-blog-layout-state.acdh-blog-tablet-stack.acdh-blog-stack-content-first .acdh-template-blog_archive .acdh-template-media {
        order: 2;
    }

    /* Tablet row mode honors the dedicated responsive side selector. */
    .acdh-blog-layout-state.acdh-blog-tablet-row.acdh-blog-tablet-media-left .acdh-template-blog_archive .acdh-template-shell {
        grid-template-columns: minmax(0, var(--acdh-blog-media-width)) minmax(0, 1fr);
    }

    .acdh-blog-layout-state.acdh-blog-tablet-row.acdh-blog-tablet-media-left .acdh-template-blog_archive .acdh-template-media {
        order: 1;
    }

    .acdh-blog-layout-state.acdh-blog-tablet-row.acdh-blog-tablet-media-left .acdh-template-blog_archive .acdh-template-content {
        order: 2;
    }

    .acdh-blog-layout-state.acdh-blog-tablet-row.acdh-blog-tablet-media-right .acdh-template-blog_archive .acdh-template-shell {
        grid-template-columns: minmax(0, 1fr) minmax(0, var(--acdh-blog-media-width));
    }

    .acdh-blog-layout-state.acdh-blog-tablet-row.acdh-blog-tablet-media-right .acdh-template-blog_archive .acdh-template-content {
        order: 1;
    }

    .acdh-blog-layout-state.acdh-blog-tablet-row.acdh-blog-tablet-media-right .acdh-template-blog_archive .acdh-template-media {
        order: 2;
    }
}

@media (max-width: 767px) {
    .acdh-template-blog_archive {
        --acdh-blog-min-height: 620px;
        --acdh-blog-inline-pad: 20px;
        --acdh-blog-block-pad: 34px;
        --acdh-blog-gap: 24px;
        --acdh-blog-image-height: 330px;
        --acdh-blog-title-size: 38px;
        --acdh-blog-description-size: 17px;
        --acdh-blog-decoration-size: 120px;
    }

    /* Safe fallback for old/cached markup: mobile stacks content first. */
    .acdh-template-blog_archive .acdh-template-shell {
        grid-template-columns: 1fr;
    }

    .acdh-template-blog_archive .acdh-template-content,
    .acdh-template-blog_archive .acdh-template-media {
        width: 100%;
        max-width: 100%;
    }

    .acdh-template-blog_archive .acdh-template-content {
        order: 1;
    }

    .acdh-template-blog_archive .acdh-template-media {
        order: 2;
    }

    /* Mobile row mode remains available when explicitly requested. */
    .acdh-blog-layout-state.acdh-blog-mobile-row.acdh-blog-mobile-media-left .acdh-template-blog_archive .acdh-template-shell {
        grid-template-columns: minmax(0, var(--acdh-blog-media-width)) minmax(0, 1fr);
    }

    .acdh-blog-layout-state.acdh-blog-mobile-row.acdh-blog-mobile-media-left .acdh-template-blog_archive .acdh-template-media {
        order: 1;
    }

    .acdh-blog-layout-state.acdh-blog-mobile-row.acdh-blog-mobile-media-left .acdh-template-blog_archive .acdh-template-content {
        order: 2;
    }

    .acdh-blog-layout-state.acdh-blog-mobile-row.acdh-blog-mobile-media-right .acdh-template-blog_archive .acdh-template-shell {
        grid-template-columns: minmax(0, 1fr) minmax(0, var(--acdh-blog-media-width));
    }

    .acdh-blog-layout-state.acdh-blog-mobile-row.acdh-blog-mobile-media-right .acdh-template-blog_archive .acdh-template-content {
        order: 1;
    }

    .acdh-blog-layout-state.acdh-blog-mobile-row.acdh-blog-mobile-media-right .acdh-template-blog_archive .acdh-template-media {
        order: 2;
    }

    /* Mobile stack mode honors both the shared stack control and the legacy
       blog-specific "image first" switch. */
    .acdh-blog-layout-state.acdh-blog-mobile-stack .acdh-template-blog_archive .acdh-template-shell {
        grid-template-columns: 1fr;
    }

    .acdh-blog-layout-state.acdh-blog-mobile-stack.acdh-blog-mobile-stack-media-first .acdh-template-blog_archive .acdh-template-media,
    .acdh-template-blog_archive.acdh-blog-mobile-image-first .acdh-template-media {
        order: 1 !important;
    }

    .acdh-blog-layout-state.acdh-blog-mobile-stack.acdh-blog-mobile-stack-media-first .acdh-template-blog_archive .acdh-template-content,
    .acdh-template-blog_archive.acdh-blog-mobile-image-first .acdh-template-content {
        order: 2 !important;
    }

    .acdh-blog-layout-state.acdh-blog-mobile-stack.acdh-blog-mobile-stack-content-first .acdh-template-blog_archive .acdh-template-content {
        order: 1;
    }

    .acdh-blog-layout-state.acdh-blog-mobile-stack.acdh-blog-mobile-stack-content-first .acdh-template-blog_archive .acdh-template-media {
        order: 2;
    }

    .acdh-template-blog_archive .acdh-template-content {
        max-width: 100%;
    }

    .acdh-template-blog-decoration {
        inset-inline-start: auto;
        inset-inline-end: 8px;
        inset-block-start: 24%;
    }
}
