/* ══════════════════════════════════════════════════════════
   Magic Slide Button Widget  –  magic-button.css
   ══════════════════════════════════════════════════════════ */

.mbw-wrapper {
    display: inline-block;
}

/* ══════════════════════════════════════════════════════════
   CORE BUTTON
   Key fix: overflow:visible here so the persistent icon slot
   (which is a flex sibling of .mbw-track) is NEVER clipped.
   The sliding text clip is handled by .mbw-track alone.
   ══════════════════════════════════════════════════════════ */
.mbw-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 14px 32px;
    border: 2px solid #fff;
    background: transparent;
    color: #fff;

    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;

    /* IMPORTANT: overflow:visible so the icon outside the track
       is never clipped. The ::before hover fill is clipped by the
       border-box naturally since it's position:absolute inset:0. */
    overflow: visible;
    outline: none;
    width: max-content;

    transition:
        width        0.45s cubic-bezier(0.77, 0, 0.175, 1),
        border-color 0.3s ease,
        background   0.3s ease,
        color        0.3s ease;
}

/* Clip the button visually to its border-box using clip-path so
   the border radius is respected and the bg fill stays inside,
   while children (icon) can still overflow if needed.
   We use a pseudo for the bg fill, clipped by the button bounds. */
.mbw-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #fff;
    opacity: 0;
    border-radius: inherit;
    transition: opacity 0.3s ease;
    /* z-index:-1 puts it behind all children in the same stacking context */
    z-index: -1;
    pointer-events: none;
}
.mbw-btn:hover::before {
    opacity: 1;
}

/* ══════════════════════════════════════════════════════════
   SLIDING TEXT TRACK
   Only this element clips — the icon lives outside it.
   ══════════════════════════════════════════════════════════ */
.mbw-track {
    overflow: hidden;
    height: 1.2em;
    /* No position:relative needed — it's a flex child */
}

.mbw-btn-inner {
    display: flex;
    flex-direction: column;
    transition: transform 0.5s cubic-bezier(0.77, 0, 0.175, 1);
}

/* Each row is a flex container so icon+text sit side-by-side in slide mode */
.mbw-row {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    line-height: 1.2em;
    min-height: 1.2em;
}

.mbw-text-default,
.mbw-text-hover {
    white-space: nowrap;
    line-height: 1.2em;
}

.mbw-btn:hover .mbw-btn-inner {
    transform: translateY(-1.2em);
}

/* ══════════════════════════════════════════════════════════
   ICON WRAPPER
   Every icon is wrapped in <span class="mbw-icon-wrap"> by PHP.
   All Elementor style controls target .mbw-icon-wrap so they
   work regardless of whether Icons_Manager renders <i> or <svg>.
   ══════════════════════════════════════════════════════════ */
.mbw-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
    /* font-size / color / fill set by Elementor controls */
}

/* SVG icons: make them fill the wrapper's font-size box */
.mbw-icon-wrap svg {
    display: block;
    width: 1em;
    height: 1em;
}

/* FA / eicon fonts */
.mbw-icon-wrap i {
    display: inline-block;
    line-height: 1;
}

/* ── Gap between icon wrapper and text ──
   These are fallback defaults. Elementor's icon_gap control
   overrides them with {{WRAPPER}} high-specificity selectors.  */
.mbw-btn.mbw-icon-before .mbw-icon-wrap { margin-right: 8px; }
.mbw-btn.mbw-icon-after  .mbw-icon-wrap { margin-left:  8px; }

/* ══════════════════════════════════════════════════════════
   ICON BEHAVIOUR MODES
   ══════════════════════════════════════════════════════════ */

/* default_only — visible at rest, fades out on hover */
.mbw-icon-wrap.mbw-fade-default {
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.mbw-btn:hover .mbw-icon-wrap.mbw-fade-default {
    opacity: 0;
    pointer-events: none;
}

/* hover_only — hidden at rest, fades in on hover */
.mbw-icon-wrap.mbw-fade-hover {
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.mbw-btn:hover .mbw-icon-wrap.mbw-fade-hover {
    opacity: 1;
}

/* slide mode — icon travels inside the track with the text rows,
   no extra rules needed beyond .mbw-row flex layout.             */

/* ══════════════════════════════════════════════════════════
   HIDDEN SIZER  (measures button width for JS)
   ══════════════════════════════════════════════════════════ */
.mbw-sizer {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    visibility: hidden;
    pointer-events: none;
    height: 0;
    overflow: hidden;
    white-space: nowrap;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
}

.mbw-sizer-row {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

/* Sizer icon-wrap mirrors real icon-wrap sizing */
.mbw-sizer .mbw-icon-wrap {
    display: inline-flex;
    align-items: center;
}
