/* ============================================================
   Mithrayon × Elementor compatibility
   ------------------------------------------------------------
   Layer order (declared in functions.php):
     mithrayon-reset  <  elementor  <  mithrayon-compat  <  unlayered
   - Elementor's own stylesheets are imported into the `elementor` layer,
     so every unlayered theme rule (style.css) wins over Elementor defaults.
   - Per-element CSS generated from the Elementor editor stays unlayered,
     so styling done in the editor still overrides the theme.
   - Containers built from the theme markup carry the `mx` class.
   ============================================================ */

@layer mithrayon-compat {

    /* Theme-structured containers: neutral box, theme classes decide layout. */
    .e-con.mx {
        display: block;
        padding: 0;
        margin: 0;
        gap: normal;
        width: auto;
        height: auto;
        min-height: 0;
        border-radius: 0;
        position: static;
        overflow: visible;
        z-index: auto;
        flex: initial;
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: normal;
        align-items: normal;
        align-content: normal;
        align-self: auto;
        order: 0;
        transition: none;
    }

    .e-con.mx.mx-justify-center {
        justify-content: center;
    }

    .e-con.mx::before {
        width: auto;
        height: auto;
        top: auto;
        left: auto;
        border: 0;
        transition: none;
    }

    .e-con.mx > .elementor-widget {
        position: static;
        margin: 0;
        width: auto;
        min-width: auto;
        max-width: none;
        flex: initial;
        align-self: auto;
        order: 0;
    }

    /* Headings: size/spacing come from the theme class on the widget. */
    .mx-h .elementor-heading-title {
        font-size: inherit;
        line-height: inherit;
    }

    /* Icons (uploaded line-SVGs): inherit theme colour, never filled. */
    .mx-ico .elementor-icon,
    .mx-ico .elementor-icon-wrapper {
        color: inherit;
        line-height: 0;
    }

    .mx-ico svg,
    .mx-list svg,
    .mx-btn svg {
        fill: none !important;
    }

    /* Icon list used for .checklist */
    .mx-list .elementor-icon-list-icon {
        flex: none;
        top: 0;
    }

    .checklist .elementor-icon-list-icon svg {
        width: 20px;
        height: 20px;
    }

    .footer-contact .elementor-icon-list-icon svg {
        width: 16px;
        height: 16px;
    }

    .mx-list .elementor-icon-list-text {
        padding: 0;
        align-self: auto;
        color: inherit;
    }
}

/* ------------------------------------------------------------------
   Front end only: make Elementor's wrapper boxes "transparent" so the
   theme's grid/flex/sibling rules see the original element structure.
   (Kept as normal boxes inside the editor so every widget stays clickable.)
   ------------------------------------------------------------------ */
@layer mithrayon-compat {
    body:not(.elementor-editor-active) .e-con.mx > .elementor-widget-text-editor,
    body:not(.elementor-editor-active) .e-con.mx > .elementor-widget-image,
    body:not(.elementor-editor-active) .e-con.mx > .elementor-widget-icon,
    body:not(.elementor-editor-active) .mx-ico .elementor-icon-wrapper,
    body:not(.elementor-editor-active) .mx-ico .elementor-icon {
        display: contents;
    }
}

/* In the editor, never hide content behind the scroll-reveal animation. */
.elementor-editor-active .reveal {
    opacity: 1;
    transform: none;
}

/* ------------------------------------------------------------------
   Theme rules that relied on the original element structure
   ------------------------------------------------------------------ */

/* Buttons: theme .btn styles applied to Elementor's Button widget */
.mx-btn .elementor-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.95rem 2rem;
    border-radius: 8px;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    line-height: inherit;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.25s ease;
    white-space: nowrap;
    color: var(--white);
    fill: currentColor;
}

.mx-btn .elementor-button-content-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.mx-btn .elementor-button-icon {
    display: inline-flex;
    font-size: 16px;
}

.mx-btn .elementor-button-icon svg {
    width: 16px;
    height: 16px;
}

.mx-btn-primary .elementor-button {
    background: var(--grad);
    box-shadow: 0 10px 26px rgba(240, 112, 0, 0.35);
}

.mx-btn-primary .elementor-button:hover,
.mx-btn-primary .elementor-button:focus {
    background: linear-gradient(135deg, #f0a800 0%, #e05f00 55%, #d63e00 100%);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(240, 112, 0, 0.45);
}

.mx-btn-outline .elementor-button {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.35);
}

.mx-btn-outline .elementor-button:hover,
.mx-btn-outline .elementor-button:focus {
    background: transparent;
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

.split-copy .mx-btn {
    margin-top: 2.1rem;
}

/* .checklist is an Icon List widget: grid lives on the inner <ul> */
.checklist > .elementor-icon-list-items {
    display: grid;
    gap: 0.9rem;
}

/* .contact-form-card > p */
.contact-form-card > .elementor-widget-text-editor > p {
    font-size: 0.95rem;
    margin-bottom: 1.8rem;
}

/* Careers: open positions grid (was an inline style) */
.services-grid.mx-grid-autofit {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* CTA band: background image is set in Elementor; overlay via inset shadow */
.cta-band.e-con {
    box-shadow: inset 0 0 0 100vmax rgba(13, 28, 43, 0.88);
}

/* Image-filled boxes: let the image fill the box like before */
.service-card-img .mx-img img,
.project-card .mx-img img {
    height: 100%;
}

/* ------------------------------------------------------------------
   Header / footer (Elementor Theme Builder templates)
   ------------------------------------------------------------------ */
/* .logo-img sits on the Image widget wrapper, so size the <img> inside it */
.mx-img.logo-img img {
    height: 52px;
    width: auto;
    flex: none;
}

.site-footer .mx-img.logo-img img {
    height: 72px;
}

@media (max-width: 600px) {
    .mx-img.logo-img img {
        height: 44px;
    }
}

.header-cta .mx-btn .elementor-button {
    padding: 0.7rem 1.4rem;
    font-size: 0.85rem;
}

@media (max-width: 900px) {
    .header-cta .mx-btn {
        display: none;
    }
}

/* Footer contact: was one <ul> holding list items + certificate images */
.e-con.mx.mx-footer-contact {
    display: grid;
    gap: 1rem;
}

.footer-contact > .elementor-icon-list-items {
    display: grid;
    gap: 1rem;
}

.footer-contact .elementor-icon-list-item > a {
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
}

.mx-footer-contact .mx-img img {
    width: 150px;
}

@media (max-width: 600px) {
    .hero-actions .mx-btn,
    .hero-actions .mx-btn .elementor-button {
        width: 100%;
    }
}
