/**
 * Ezzat Services Pro — clean homepage background runtime.
 * This file is loaded after the legacy stylesheet and is the only authority
 * for builder backgrounds and overlays.
 */
.ezsp-background-system {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background-color: var(--dhb-block-bg, transparent) !important;
    background-image: none !important;
}

/* Remove every historical pseudo veil from the builder wrapper. */
.ezsp-background-system::before,
.ezsp-background-system::after {
    content: none !important;
    display: none !important;
    opacity: 0 !important;
    background: none !important;
}

.ezsp-background-system > .ezsp-background-layers {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    border-radius: inherit;
}

.ezsp-background-system > :not(.ezsp-background-layers) {
    position: relative;
    z-index: 2;
}

.ezsp-static-background,
.ezsp-slider-background,
.ezsp-background-overlay {
    position: absolute;
    inset: 0;
    display: block;
    pointer-events: none;
}

.ezsp-static-background {
    z-index: 0;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

.ezsp-slider-background {
    z-index: 2;
    overflow: hidden;
}

.ezsp-background-overlay {
    z-index: 5;
    background: var(--ezsp-overlay-color, #000000);
    opacity: var(--ezsp-overlay-opacity, 0);
}

/* The visible sections must never paint their own old backgrounds or gradients. */
.ezsp-background-system > .dhb-home-hero,
.ezsp-background-system > .dhb-home-cta,
.ezsp-background-system > .dhb-section {
    background-color: transparent !important;
    background-image: none !important;
}

.ezsp-background-system > .dhb-home-hero::before,
.ezsp-background-system > .dhb-home-hero::after,
.ezsp-background-system > .dhb-home-cta::before,
.ezsp-background-system > .dhb-home-cta::after,
.ezsp-background-system > .dhb-section::before,
.ezsp-background-system > .dhb-section::after {
    content: none !important;
    display: none !important;
    background: none !important;
    opacity: 0 !important;
}

/* Compatibility: old overlay elements can never display inside the new renderer. */
.ezsp-background-system .dhb-static-overlay,
.ezsp-background-system .dhb-slider-overlay {
    display: none !important;
    opacity: 0 !important;
}

@media (prefers-reduced-motion: reduce) {
    .ezsp-background-system .dhb-bg-slide {
        transition: none !important;
    }
}

/* v8.3.2 — keep service-card images perfectly centered inside their frames. */
.dhb-builder-services .dhb-service-photo,
.dhb-home-services .dhb-service-photo {
    display: grid !important;
    place-items: center !important;
    align-content: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

.dhb-builder-services .dhb-service-photo picture,
.dhb-home-services .dhb-service-photo picture {
    display: grid !important;
    place-items: center !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
}

.dhb-builder-services .dhb-service-photo img,
.dhb-home-services .dhb-service-photo img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    margin: 0 auto !important;
    object-fit: cover !important;
    object-position: 50% 50% !important;
    transform: none !important;
}


/* v8.4.1 — image fills the configured frame exactly. */
.dhb-builder-services .dhb-service-photo,
.dhb-home-services .dhb-service-photo {
    padding: 0 !important;
    border-radius: var(--dhb-service-image-radius, 17px) !important;
}

.dhb-builder-services .dhb-service-photo picture,
.dhb-home-services .dhb-service-photo picture,
.dhb-builder-services .dhb-service-photo img,
.dhb-home-services .dhb-service-photo img {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: inherit !important;
}

/* Homepage entry animations */
.dhb-entry-enabled,.dhb-card-entry-enabled{--dhb-entry-duration:700ms;--dhb-entry-delay:0ms;}
.dhb-entry-target{opacity:0;will-change:transform,opacity,filter;transition-property:opacity,transform,filter;transition-duration:var(--dhb-anim-duration,700ms);transition-delay:var(--dhb-anim-delay,0ms);transition-timing-function:cubic-bezier(.22,1,.36,1);}
.dhb-entry-target.is-visible{opacity:1;transform:none!important;filter:none!important;}
.dhb-anim-fade{transform:none}.dhb-anim-fade-up{transform:translate3d(0,42px,0)}.dhb-anim-fade-down{transform:translate3d(0,-42px,0)}.dhb-anim-fade-left{transform:translate3d(-52px,0,0)}.dhb-anim-fade-right{transform:translate3d(52px,0,0)}
.dhb-anim-slide-up{transform:translate3d(0,90px,0)}.dhb-anim-slide-down{transform:translate3d(0,-90px,0)}.dhb-anim-slide-left{transform:translate3d(-110px,0,0)}.dhb-anim-slide-right{transform:translate3d(110px,0,0)}
.dhb-anim-zoom-in{transform:scale(.82)}.dhb-anim-zoom-out{transform:scale(1.16)}.dhb-anim-scale-up{transform:scale(.94)}.dhb-anim-flip-x{transform:perspective(900px) rotateX(70deg);transform-origin:center bottom}.dhb-anim-flip-y{transform:perspective(900px) rotateY(70deg);transform-origin:center}.dhb-anim-rotate-in{transform:scale(.88) rotate(-7deg)}.dhb-anim-blur-in{transform:translate3d(0,20px,0);filter:blur(12px)}.dhb-anim-bounce-in{transform:scale(.7);transition-timing-function:cubic-bezier(.34,1.56,.64,1)}
@media (prefers-reduced-motion:reduce){.dhb-entry-target{opacity:1!important;transform:none!important;filter:none!important;transition:none!important}}


/* v8.7.1 — stable service-card images without stretching or cropping. */
.dhb-builder-services .dhb-service-photo,
.dhb-home-services .dhb-service-photo {
    box-sizing: border-box !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(145deg, var(--mint, #edf9f4), var(--sky, #eef7fc)) !important;
}
.dhb-builder-services .dhb-service-photo picture,
.dhb-home-services .dhb-service-photo picture {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
}
.dhb-builder-services .dhb-service-photo img,
.dhb-home-services .dhb-service-photo img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    aspect-ratio: auto !important;
    transform: none !important;
}
/* Automatic side image size: consistent frame instead of full card height. */
.dhb-builder-services .dhb-service-image-width-auto.dhb-service-images-right .dhb-service-tile,
.dhb-builder-services .dhb-service-image-width-auto.dhb-service-images-left .dhb-service-tile,
.dhb-home-services.dhb-service-image-width-auto.dhb-service-images-right .dhb-service-tile,
.dhb-home-services.dhb-service-image-width-auto.dhb-service-images-left .dhb-service-tile {
    grid-template-columns: 150px minmax(0, 1fr) !important;
    padding: 14px !important;
    gap: 16px !important;
    align-items: center !important;
    overflow: visible !important;
}
.dhb-builder-services .dhb-service-image-width-auto.dhb-service-images-left .dhb-service-tile,
.dhb-home-services.dhb-service-image-width-auto.dhb-service-images-left .dhb-service-tile {
    grid-template-columns: minmax(0, 1fr) 150px !important;
}
.dhb-builder-services .dhb-service-image-width-auto.dhb-service-images-right .dhb-service-photo,
.dhb-builder-services .dhb-service-image-width-auto.dhb-service-images-left .dhb-service-photo,
.dhb-home-services.dhb-service-image-width-auto.dhb-service-images-right .dhb-service-photo,
.dhb-home-services.dhb-service-image-width-auto.dhb-service-images-left .dhb-service-photo {
    width: 150px !important;
    height: 120px !important;
    min-height: 0 !important;
    align-self: center !important;
    justify-self: center !important;
}
/* Automatic top image size: wide, balanced and responsive. */
.dhb-builder-services .dhb-service-images-top.dhb-service-image-width-auto .dhb-service-tile,
.dhb-home-services.dhb-service-images-top.dhb-service-image-width-auto .dhb-service-tile {
    padding: 14px !important;
    gap: 14px !important;
    align-items: stretch !important;
}
.dhb-builder-services .dhb-service-images-top.dhb-service-image-width-auto .dhb-service-photo,
.dhb-home-services.dhb-service-images-top.dhb-service-image-width-auto .dhb-service-photo {
    width: 100% !important;
    height: 210px !important;
    min-height: 0 !important;
}
/* Manual width/height keep their exact frame while displaying the whole image. */
.dhb-builder-services .dhb-service-image-width-fixed .dhb-service-photo,
.dhb-home-services.dhb-service-image-width-fixed .dhb-service-photo {
    width: var(--dhb-service-image-width) !important;
}
.dhb-builder-services .dhb-service-image-height-fixed .dhb-service-photo,
.dhb-home-services.dhb-service-image-height-fixed .dhb-service-photo {
    height: var(--dhb-service-image-height) !important;
    min-height: 0 !important;
}
@media (max-width: 640px) {
    .dhb-builder-services .dhb-service-image-width-auto.dhb-service-images-right .dhb-service-tile,
    .dhb-builder-services .dhb-service-image-width-auto.dhb-service-images-left .dhb-service-tile,
    .dhb-home-services.dhb-service-image-width-auto.dhb-service-images-right .dhb-service-tile,
    .dhb-home-services.dhb-service-image-width-auto.dhb-service-images-left .dhb-service-tile {
        grid-template-columns: 105px minmax(0, 1fr) !important;
        gap: 12px !important;
    }
    .dhb-builder-services .dhb-service-image-width-auto.dhb-service-images-left .dhb-service-tile,
    .dhb-home-services.dhb-service-image-width-auto.dhb-service-images-left .dhb-service-tile {
        grid-template-columns: minmax(0, 1fr) 105px !important;
    }
    .dhb-builder-services .dhb-service-image-width-auto.dhb-service-images-right .dhb-service-photo,
    .dhb-builder-services .dhb-service-image-width-auto.dhb-service-images-left .dhb-service-photo,
    .dhb-home-services.dhb-service-image-width-auto.dhb-service-images-right .dhb-service-photo,
    .dhb-home-services.dhb-service-image-width-auto.dhb-service-images-left .dhb-service-photo {
        width: 105px !important;
        height: 90px !important;
    }
    .dhb-builder-services .dhb-service-images-top.dhb-service-image-width-auto .dhb-service-photo,
    .dhb-home-services.dhb-service-images-top.dhb-service-image-width-auto .dhb-service-photo {
        height: 180px !important;
    }
}

/* v8.8.13 — mobile viewport overflow hardening.
 * Prevent manually-sized builder media (especially service images) and rich content
 * from making the document wider than the device viewport. */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

@supports (overflow: clip) {
    html,
    body {
        overflow-x: clip;
    }
}

/* Grid/flex children are allowed to shrink instead of forcing horizontal overflow. */
.dhb-container,
.dhb-builder-block,
.dhb-builder-block .dhb-section,
.dhb-builder-block .dhb-home-hero,
.dhb-builder-block .dhb-home-cta,
.dhb-home-hero-inner,
.dhb-service-grid,
.dhb-service-tile,
.dhb-service-content,
.ezsp-built-page,
.ezsp-page-block-inner,
.ezsp-primary-content,
.entry-content,
.normal-article,
.site-header,
.header-inner,
.branding,
.main-nav {
    min-width: 0;
    max-width: 100%;
}

/* Never let normal media widen the mobile viewport, including inline WP widths. */
body img,
body picture,
body video,
body canvas,
body svg,
body iframe,
.entry-content figure,
.entry-content .wp-block-image {
    max-width: 100% !important;
}

body img,
body video,
body canvas {
    height: auto;
}

/* Large logos configured in the panel must shrink on small screens. */
.dhb-header-logo,
.dhb-header-logo img,
.custom-logo-link,
.custom-logo {
    max-width: 100% !important;
}

/* Manual service-image widths are desktop preferences, not viewport minimums. */
.dhb-builder-services .dhb-service-image-width-fixed .dhb-service-photo,
.dhb-home-services.dhb-service-image-width-fixed .dhb-service-photo {
    width: min(var(--dhb-service-image-width), 100%) !important;
    max-width: 100% !important;
}

@media (max-width: 680px) {
    .header-inner {
        width: 100%;
        gap: 10px;
    }
    .branding {
        min-width: 0 !important;
        max-width: calc(100% - 48px) !important;
        flex: 1 1 auto;
    }
    .dhb-header-logo {
        min-width: 0;
        max-width: 100% !important;
    }
    .dhb-header-logo img,
    .custom-logo {
        width: auto !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: var(--dhb-logo-height, 52px) !important;
        object-fit: contain !important;
    }
    .dhb-header-text {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    /* A manually configured 300–600px service image must fit its mobile grid cell. */
    .dhb-builder-services.dhb-service-image-width-fixed.dhb-service-images-right .dhb-service-tile,
    .dhb-home-services.dhb-service-image-width-fixed.dhb-service-images-right .dhb-service-tile {
        grid-template-columns: minmax(90px, 38%) minmax(0, 1fr) !important;
    }
    .dhb-builder-services.dhb-service-image-width-fixed.dhb-service-images-left .dhb-service-tile,
    .dhb-home-services.dhb-service-image-width-fixed.dhb-service-images-left .dhb-service-tile {
        grid-template-columns: minmax(0, 1fr) minmax(90px, 38%) !important;
    }
    .dhb-builder-services.dhb-service-image-width-fixed.dhb-service-images-right .dhb-service-photo,
    .dhb-builder-services.dhb-service-image-width-fixed.dhb-service-images-left .dhb-service-photo,
    .dhb-home-services.dhb-service-image-width-fixed.dhb-service-images-right .dhb-service-photo,
    .dhb-home-services.dhb-service-image-width-fixed.dhb-service-images-left .dhb-service-photo {
        width: 100% !important;
        max-width: 100% !important;
    }
    .dhb-builder-services.dhb-service-image-width-fixed.dhb-service-images-top .dhb-service-photo,
    .dhb-home-services.dhb-service-image-width-fixed.dhb-service-images-top .dhb-service-photo {
        width: min(var(--dhb-service-image-width), 100%) !important;
        max-width: 100% !important;
        margin-inline: auto !important;
    }

    /* User-authored content can contain wide tables/code; keep scrolling local. */
    .entry-content table,
    .dhb-text-block-content table {
        max-width: 100%;
    }
    .entry-content pre,
    .dhb-text-block-content pre {
        max-width: 100%;
        overflow-x: auto;
    }
}

/* v8.8.14 — definitive mobile document-width containment.
 * Builder blocks historically use overflow:visible; a single wide child could therefore
 * enlarge the whole RTL document and make the initial mobile viewport appear shifted,
 * leaving a large blank strip on the left. Contain block overflow at mobile widths and
 * force every structural wrapper to resolve against the device viewport. */
@media (max-width: 782px) {
    html {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow-x: hidden !important;
    }

    body {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        overflow-x: hidden !important;
        position: relative !important;
    }

    /* WordPress mobile admin bar must follow the visual viewport too. */
    #wpadminbar {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        left: 0 !important;
        right: 0 !important;
    }

    body > header,
    body > main,
    body > footer,
    body > div:not(#wpadminbar),
    .site-header,
    .global-search,
    .single-wrap,
    .dhb-homepage,
    .ezsp-built-page,
    .dhb-builder-block,
    .dhb-builder-block > section,
    .dhb-section,
    .section {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin-left: 0;
        margin-right: 0;
    }

    /* This is the important override for the legacy overflow:visible rule. */
    .dhb-builder-block,
    .dhb-builder-block > section,
    .dhb-homepage,
    .ezsp-built-page,
    .single-wrap,
    .ezsp-primary-content,
    .entry-content,
    .normal-article {
        overflow-x: hidden !important;
    }

    .dhb-container {
        width: calc(100% - 20px) !important;
        max-width: calc(100% - 20px) !important;
        min-width: 0 !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* Flex/grid form controls often have an intrinsic min-width and can widen RTL pages. */
    .global-search form,
    .global-search input,
    .global-search button,
    .search-row,
    .search-row > *,
    .dhb-hero-request-card,
    .dhb-hero-request-form,
    .dhb-hero-request-form > *,
    .service-hero,
    .service-summary,
    .service-image,
    .breadcrumbs,
    .single-wrap .breadcrumbs,
    .ezsp-content-sidebar-layout,
    .archive-layout,
    .sidebar,
    .widget,
    .card,
    .service-card,
    .post-card,
    .dhb-service-grid,
    .dhb-service-tile,
    .dhb-service-photo,
    .dhb-service-content,
    .dhb-wide-panel,
    .dhb-panel-copy,
    .dhb-panel-image,
    .dhb-home-cta,
    .dhb-page-content-block,
    .ezsp-page-block-inner {
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .global-search form {
        width: 100% !important;
    }

    .global-search input {
        width: 0 !important;
        min-width: 0 !important;
        flex: 1 1 0 !important;
    }

    /* User content: long URLs/words/tables stay inside their own box. */
    .entry-content,
    .normal-article,
    .dhb-text-block-content,
    .ezsp-page-block-inner,
    .breadcrumbs,
    .single-wrap .breadcrumbs {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .entry-content table,
    .dhb-text-block-content table {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto;
    }

    /* Inline image dimensions from WordPress/editor may not become a page minimum. */
    img,
    picture,
    video,
    iframe,
    canvas,
    figure,
    .wp-block-image,
    .wp-block-image img,
    [class*="image"] img {
        max-width: 100% !important;
    }
}
