/* Mile Site Experience 1.0.0 — additive to native kit 22193 and header 37191.
 * No font downloads, root token redefinitions, theme reset, logo filters or color replacement.
 * Every rule requires a server-gated body class and an existing Elementor root.
 */

/* Only this plugin's extension tokens; existing --mile-* kit values remain authoritative. */
body.mile-se {
    --mile-se-section-space: clamp(48px, var(--mile-space-6, 72px), 96px);
    --mile-se-control-size: 44px;
}

/* Text nodes only: never assign a font to i, svg, icon wrappers, pseudo-elements or all descendants. */
body.mile-se-visual .elementor :is(.elementor-icon-list-text, .elementor-button-text, .e-n-menu-title-text, .hfe-menu-item, .hfe-sub-menu-item) {
    font-family: var(--mile-font-body, "Roboto", "IBM Plex Sans Arabic", Arial, sans-serif) !important;
}

body.mile-se-visual .elementor .elementor-button-text {
    line-height: inherit;
}

body.mile-se-visual .elementor :is(.elementor-button, .elementor-menu-toggle, .e-n-menu-toggle) {
    min-block-size: var(--mile-se-control-size);
}

body.mile-se-visual .elementor :is(.elementor-menu-toggle, .e-n-menu-toggle) {
    min-inline-size: var(--mile-se-control-size);
}

/* Native kit already supplies the focus outline. This double ring supplements contrast on light/dark.
 * Does not remove outlines on mouse focus or alter foreground/background/gradient colors.
 */
body.mile-se-visual .elementor :is(.elementor-button, .elementor-menu-toggle, .e-n-menu-toggle, .elementor-nav-menu a):focus-visible {
    outline: 3px solid var(--mile-blue, #0066cc);
    outline-offset: 3px;
    box-shadow: 0 0 0 2px #fff, 0 0 0 6px var(--mile-ink, #18243b);
}

/* CONTENT SPACING: reviewed native section IDs below plus explicit opt-ins, only page-level children.
 * Anonymous source reviewed 2026-12-01: Home 39156, Demo 22878, Water 22821.
 * These bounded targets have no HTML-owned layout or carousel; all hero, bridge and empty sections stay native.
 * Add mile-content-section to another reviewed standard section/container, never a page wrapper.
 * An opted-in nested/card/widget container still will NOT match. No generic recursive padding.
 * First sections need a separate review; hero, promo, header/footer, route story, dispatcher,
 * sticky and carousel ownership always win, even if someone adds the opt-in accidentally.
 * :has() is a safety gate: older browsers that cannot support it skip this enhancement entirely.
 */
@supports selector(:has(*)) {
    body.mile-se-unified-spacing .elementor.elementor-39156[data-elementor-type="wp-page"]
        > :is(.elementor-element-892dc2c, .elementor-element-18a475a, .elementor-element-6270b7a, .elementor-element-3139412, .elementor-element-74ba765):not(.mile-spacing-preserve):not(:has(:is(.swiper, .swiper-container, iframe))),
    body.mile-se-unified-spacing .elementor.elementor-22878[data-elementor-type="wp-page"]
        > :is(.elementor-element-6fddc42, .elementor-element-10617bc):not(.mile-spacing-preserve):not(:has(:is(.swiper, .swiper-container, iframe))),
    body.mile-se-unified-spacing .elementor.elementor-22821[data-elementor-type="wp-page"]
        > :is(.elementor-element-0f05794, .elementor-element-a023c3d, .elementor-element-afb3f1d, .elementor-element-6caa16f, .elementor-element-8dcf2e5, .elementor-element-73bca3d):not(.mile-spacing-preserve):not(:has(:is(.swiper, .swiper-container, iframe))),
    body.mile-se-unified-spacing .elementor[data-elementor-type="wp-page"]:not(.elementor-41026):not(.mile-dispatcher):not(.mile-spacing-preserve)
        > :is(.e-con, .elementor-section).mile-content-section:not(:first-child):not(:is(.mile-spacing-preserve, .mile-hero, .hero, .mile-promo, .promo, .mile-route-story, .mile-route-slide, .mile-dispatcher, .elementor-element-d00004a, .elementor-sticky, .elementor-sticky--active, .elementor-location-header, .elementor-location-footer, .elementor-section-stretched)):not([data-settings*='"sticky"']):not([data-settings*='background_video_link']):not(:has(:is(.mile-route-story, .mile-route-slide, .mile-dispatcher, #mile-dispatcher, .elementor-widget-carousel, .elementor-widget-n-carousel, .elementor-widget-image-carousel, .elementor-widget-media-carousel, .elementor-widget-slides, .swiper, .swiper-container))),
    body.mile-se-unified-spacing .elementor[data-elementor-type="wp-page"]:not(.elementor-41026):not(.mile-dispatcher):not(.mile-spacing-preserve)
        > .elementor-section-wrap > .elementor-section.mile-content-section:not(:first-child):not(:is(.mile-spacing-preserve, .mile-hero, .hero, .mile-promo, .promo, .mile-route-story, .mile-route-slide, .mile-dispatcher, .elementor-element-d00004a, .elementor-sticky, .elementor-sticky--active, .elementor-section-stretched)):not([data-settings*='"sticky"']):not([data-settings*='background_video_link']):not(:has(:is(.mile-route-story, .mile-route-slide, .mile-dispatcher, #mile-dispatcher, .elementor-widget-carousel, .elementor-widget-n-carousel, .elementor-widget-image-carousel, .elementor-widget-media-carousel, .elementor-widget-slides, .swiper, .swiper-container))) {
        --padding-top: var(--mile-se-section-space);
        --padding-bottom: var(--mile-se-section-space);
        padding-block: var(--mile-se-section-space) !important;
    }
}

/* FOOTER 37194: native structure and all links remain untouched.
 * First known root = columns; second known root = copyright band.
 * Desktop columns are 64px block / 24px inline. The copyright band is intentionally not another 64px.
 * No background/color/border/image rules: preserve each existing light/dark treatment and logo.
 */
body.mile-se-footer .elementor.elementor-37194 .elementor-element.elementor-element-6e674af {
    --padding-top: 64px;
    --padding-bottom: 64px;
    --padding-left: var(--mile-space-3, 24px);
    --padding-right: var(--mile-space-3, 24px);
    padding: 64px var(--mile-space-3, 24px) !important;
}

body.mile-se-footer .elementor.elementor-37194 .elementor-element.elementor-element-3cc0474 {
    --padding-top: var(--mile-space-3, 24px);
    --padding-bottom: var(--mile-space-3, 24px);
    --padding-left: var(--mile-space-3, 24px);
    --padding-right: var(--mile-space-3, 24px);
    padding: var(--mile-space-3, 24px) !important;
    margin-block: 0 !important;
}

/* Known 37px left / 9px right asymmetry. Zero only the named inner container, not all descendants. */
body.mile-se-footer .elementor.elementor-37194 .elementor-element.elementor-element-8d16273 {
    --padding-left: 0px;
    --padding-right: 0px;
    padding-inline: 0 !important;
}

body.mile-se-footer .elementor.elementor-37194
    :is(.elementor-element-fed873f, .elementor-element-9111ce7, .elementor-element-a1f188c, .elementor-element-47e8e7e, .elementor-element-6305f2f) .elementor-heading-title {
    font-family: var(--mile-font-heading, "Plus Jakarta Sans", "IBM Plex Sans Arabic", Arial, sans-serif) !important;
    font-size: 20px !important;
    line-height: 1.4 !important;
    margin-block: 0 var(--mile-space-2, 16px);
}

body.mile-se-footer .elementor.elementor-37194
    :is(.elementor-element-6e674af, .elementor-element-3cc0474)
    :is(.elementor-widget-text-editor, .elementor-icon-list-text, .elementor-nav-menu a, .elementor-button-text) {
    font-family: var(--mile-font-body, "Roboto", "IBM Plex Sans Arabic", Arial, sans-serif) !important;
    font-size: 16px !important;
    line-height: 1.6 !important;
}

body.mile-se-footer .elementor.elementor-37194 .elementor-element-6e674af .elementor-widget-icon-list:not(.elementor-icon-list--layout-inline) .elementor-icon-list-items {
    display: flex;
    flex-direction: column;
    row-gap: 10px;
}

body.mile-se-footer .elementor.elementor-37194 .elementor-element-6e674af .elementor-widget-icon-list:not(.elementor-icon-list--layout-inline) .elementor-icon-list-item {
    margin-block: 0 !important;
    padding-block: 0 !important;
}

body.mile-se-footer .elementor.elementor-37194 .elementor-element-3cc0474 .elementor-widget-text-editor :is(p, ul) {
    margin-block: 0;
}

body.mile-se-footer .elementor.elementor-37194 .elementor-element-3cc0474 :is(.e-con-inner, .elementor-container) {
    row-gap: var(--mile-space-1, 8px);
}

/* Scope the fallback script to native classic Elementor menu widgets; CSS never changes visibility.
 * Existing 37191 header padding, dropdown ink/white colors, 16/15px sizing remain native-owned.
 */
body.mile-se-navigation .elementor.elementor-37191 .elementor-menu-toggle {
    min-inline-size: var(--mile-se-control-size);
    min-block-size: var(--mile-se-control-size);
}

@media (max-width: 767px) {
    body.mile-se {
        --mile-se-section-space: clamp(32px, var(--mile-space-5, 48px), 64px);
    }

    body.mile-se-footer .elementor.elementor-37194 .elementor-element.elementor-element-6e674af {
        --padding-top: 40px;
        --padding-bottom: 40px;
        --padding-left: 20px;
        --padding-right: 20px;
        padding: 40px 20px !important;
    }

    body.mile-se-footer .elementor.elementor-37194 .elementor-element.elementor-element-3cc0474 {
        --padding-top: 20px;
        --padding-bottom: 20px;
        --padding-left: 20px;
        --padding-right: 20px;
        padding: 20px !important;
    }

    body.mile-se-footer .elementor.elementor-37194 .elementor-element-6e674af .elementor-icon-list-item > a {
        min-block-size: var(--mile-se-control-size);
        align-items: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    /* Opted-in standard sections and affected controls only; no global animation kill switch. */
    body.mile-se-visual .elementor :is(.elementor-button, .elementor-menu-toggle, .e-n-menu-toggle),
    body.mile-se-navigation .elementor.elementor-37191 .elementor-nav-menu--dropdown {
        transition-duration: 0s !important;
        animation-duration: 0s !important;
    }

    body.mile-se-visual .elementor .elementor-button:active {
        transform: none !important;
    }
}
