/* ============================================================
   Imperaline × Elementor compatibility
   ------------------------------------------------------------
   Layer order (declared in functions.php):
     imperaline-reset  <  elementor  <  imperaline-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.
     New sections added in Elementor without `mx` behave like normal Elementor.
   ============================================================ */

@layer imperaline-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::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;
    }

    /* 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 {
        fill: none !important;
    }
}

/* ------------------------------------------------------------------
   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 imperaline-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) .e-con.mx > .elementor-widget-html,
    body:not(.elementor-editor-active) .e-con.mx > .elementor-widget-shortcode,
    body:not(.elementor-editor-active) .mx-menu .elementor-shortcode,
    body:not(.elementor-editor-active) .mx-ico .elementor-icon-wrapper,
    body:not(.elementor-editor-active) .mx-ico .elementor-icon {
        display: contents;
    }

    /* Sticky header: the Theme Builder wrapper must not trap position:sticky. */
    body:not(.elementor-editor-active) .elementor-location-header {
        display: contents;
    }
}

/* ------------------------------------------------------------------
   Buttons: theme .btn styles applied to Elementor's Button widget
   ------------------------------------------------------------------ */
.elementor-widget.mx-btn .elementor-button {
    display: inline-block;
    padding: 14px 26px;
    border-radius: 10px;
    font-family: var(--head);
    font-weight: 700;
    font-size: .95rem;
    line-height: 1.65;
    letter-spacing: normal;
    text-transform: none;
    border: 2px solid transparent;
    transition: transform .15s ease, background .15s ease;
}

.elementor-widget.mx-btn .elementor-button:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.elementor-widget.mx-btn-primary .elementor-button { background: var(--magenta); color: #fff; }
.elementor-widget.mx-btn-primary .elementor-button:hover { background: var(--magenta-dark); color: #fff; }
.elementor-widget.mx-btn-light .elementor-button,
.elementor-widget.mx-btn-light .elementor-button:hover { background: #fff; color: var(--aubergine); }
.elementor-widget.mx-btn-outline .elementor-button { background: transparent; border-color: rgba(255,255,255,.6); color: #fff; }
.elementor-widget.mx-btn-outline .elementor-button:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ------------------------------------------------------------------
   Header / footer (Elementor Theme Builder templates)
   ------------------------------------------------------------------ */
.brand .mx-img img { width: 220px; }
@media (max-width: 960px) { .brand .mx-img img { width: 180px; } }
.footer-brand .mx-img img { width: 46px; }

/* ------------------------------------------------------------------
   Contact Form 7 (replaces the static contact.php form)
   ------------------------------------------------------------------ */
.wpcf7-box .wpcf7-form-control-wrap { display: block; }
.wpcf7-box .consent .wpcf7-form-control-wrap { display: block; }
.wpcf7-box .consent .wpcf7-list-item { margin: 0; display: block; }
.wpcf7-box .consent label {
    display: flex; gap: 10px; align-items: flex-start;
    font-family: inherit; font-weight: 400; font-size: .88rem; color: inherit; margin: 0;
}
.wpcf7-box .consent input[type="checkbox"] { width: auto; margin: 5px 0 0; flex: none; }
.wpcf7-box .wpcf7-not-valid-tip { margin: -12px 0 14px; font-size: .85rem; color: #9b1c33; }
.wpcf7-box .wpcf7-submit { width: auto; margin: 0; cursor: pointer; line-height: normal; }
.wpcf7-box textarea { height: 150px; }
.wpcf7-box .wpcf7-spinner { vertical-align: middle; }
.wpcf7-box .wpcf7 form .wpcf7-response-output {
    margin: 24px 0 0; padding: 16px 18px; border: 0; border-radius: 10px;
    font-weight: 600; background: #fdecef; color: #9b1c33;
}
.wpcf7-box .wpcf7 form.sent .wpcf7-response-output { background: #eaf8f0; color: #156c3d; }

/* Small helper class for the last info block in the contact card. */
.mx-mb0 { margin-bottom: 0 !important; }
