/**
 * Mobile Slider Widget — Frontend Styles
 * Plugin:  Mobile Slider by BrandSlick
 * Version: 1.0.1
 * Author:  BrandSlick (https://brandslick.com)
 *
 * Changelog v1.0.1:
 *  - FIX: FG image is now absolutely positioned — Offset Y only moves
 *         the image, content below is never pushed.
 *  - NEW: --bms-fg-peek CSS variable controls reserved space in stack.
 *  - NEW: .bms-content-gap element for gap between image and content.
 *  - FIX: Full-widget touch swipe (not just image area).
 *  - FIX: Arrow tap targets enlarged to 44px min for mobile.
 */

/* ============================================================
   WRAPPER
   ============================================================ */
.bms-slider-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
    touch-action: pan-y;
}

/* ============================================================
   SLIDES OUTER
   ============================================================ */
.bms-slides-outer {
    overflow: hidden;
    width: 100%;
    position: relative;
    /* Height is set dynamically by JS to match current slide's natural height */
    height: auto;
    transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   SLIDES TRACK
   ============================================================ */
.bms-slides-track {
    display: flex;
    flex-direction: row;
    align-items: flex-start; /* each slide takes its own natural height */
    will-change: transform;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   INDIVIDUAL SLIDE
   ============================================================ */
.bms-slide {
    flex: 0 0 100%;
    width: 100%;
    min-width: 100%;
    box-sizing: border-box;
    position: relative;
    /* height is natural — JS measures this to set .bms-slides-outer height */
    height: auto;
    align-self: flex-start;
}

/* ============================================================
   IMAGES STACK
   ──────────────────────────────────────────────────────────
   padding-bottom reserves space for the FG image that hangs
   below the BG image. Set via --bms-fg-peek (computed in PHP).
   ============================================================ */
.bms-images-stack {
    position: relative;
    width: 100%;
    padding-bottom: var(--bms-fg-peek, 140px);
}

/* Background Image — stays in normal flow */
.bms-bg-image-wrap {
    position: relative;
    width: 100%;
    height: 340px;
    overflow: hidden;
    z-index: 1;
}

.bms-bg-image-wrap img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
}

/* ── FOREGROUND IMAGE
   position:absolute inside .bms-images-stack.
   top = bg_height - fg_overlap  (injected inline by PHP render())
   This places the FG image straddling the BG bottom edge:
     - fg_overlap px of FG sits ON TOP of the BG image
     - (fg_h - fg_overlap) px hangs BELOW the BG image
   padding-bottom on .bms-images-stack reserves that hanging space.
   Content (title/buttons) starts after the stack — never pushed by FG.
   ─────────────────────────────────────────────────────────── */
.bms-fg-image-wrap {
    position: absolute;
    width: 75%;
    height: 200px;   /* overridden inline by PHP */
    overflow: hidden;
    left: 20px;      /* overridden inline by PHP */
    top: 280px;      /* fallback: bg_h(340) - overlap(60); overridden inline by PHP */
    bottom: auto;
    z-index: 3;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    border-radius: 8px;
}

.bms-fg-image-wrap img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    border-radius: inherit;
}

/* ── CONTENT GAP
   Spacer between the FG image bottom and the title.
   Height driven by --bms-content-gap CSS variable (set inline).
   ─────────────────────────────────────────────────────────── */
.bms-content-gap {
    display: block;
    height: 0;
    width: 100%;
    /* margin-top injected inline — supports negative values to pull content up */
}

/* ============================================================
   CONTENT AREA
   ============================================================ */
.bms-content-area {
    padding: 0 24px 24px;
    text-align: center;
    position: relative;
    z-index: 1;
}

/* ============================================================
   TITLE
   ============================================================ */
.bms-slide-title {
    margin: 0 0 12px 0;
    font-size: 2em;
    font-weight: 700;
    line-height: 1.2;
    color: #111;
}

/* ============================================================
   DESCRIPTION
   ============================================================ */
.bms-slide-desc {
    margin: 0 0 24px 0;
    font-size: 0.95em;
    line-height: 1.7;
    color: #555;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.bms-buttons-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
}

.bms-btn {
    display: inline-block;
    padding: 12px 20px;
    font-size: 0.9em;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    border-radius: 4px;
    border: 2px solid transparent;
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
    box-sizing: border-box;
    line-height: 1.4;
    touch-action: manipulation;
    position: relative;
    z-index: 5;
}

.bms-btn.bms-btn-filled {
    background-color: #5b9bd5;
    color: #ffffff;
    border-color: #5b9bd5;
}
.bms-btn.bms-btn-filled:hover {
    background-color: #4a88c0;
    border-color: #4a88c0;
}

.bms-btn.bms-btn-outline {
    background-color: transparent;
    color: #5b9bd5;
    border-color: #5b9bd5;
}
.bms-btn.bms-btn-outline:hover {
    background-color: #5b9bd5;
    color: #ffffff;
}

.bms-btn.bms-btn-text {
    background-color: transparent;
    color: #5b9bd5;
    border-color: transparent;
    padding-left: 0;
    padding-right: 0;
}
.bms-btn.bms-btn-text:hover {
    text-decoration: underline;
}

/* ============================================================
   ARROWS WRAP
   ============================================================ */
.bms-arrows-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin: 16px 0 8px 0;
    padding: 0 16px;
    box-sizing: border-box;
    position: relative;
    z-index: 5;
}

.bms-arrows-wrap.bms-arrows-bottom-left  { justify-content: flex-start; }
.bms-arrows-wrap.bms-arrows-bottom-right { justify-content: flex-end; }
.bms-arrows-wrap.bms-arrows-bottom-center { justify-content: center; }

/* ============================================================
   ARROW BUTTONS
   ============================================================ */
.bms-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    /* Visual padding */
    padding: 8px;
    color: #111;
    font-size: 18px;
    line-height: 1;
    transition: color 0.2s ease, background-color 0.2s ease;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    /* Mobile: prevent double-tap zoom, allow tap through */
    touch-action: manipulation;
    position: relative;
    z-index: 10;
    /* Minimum tap target for accessibility / iOS guidelines */
    min-width: 44px;
    min-height: 44px;
    box-sizing: border-box;
}

.bms-arrow:hover  { color: #5b9bd5; }

.bms-arrow:disabled,
.bms-arrow.bms-disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

.bms-arrow svg { width: 18px; height: 18px; display: block; fill: currentColor; pointer-events: none; }
.bms-arrow i   { pointer-events: none; }

/* Side arrows */
.bms-arrow-side {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(255,255,255,0.85);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.bms-arrow-side-prev { left: 8px; }
.bms-arrow-side-next { right: 8px; }

/* ============================================================
   DOTS
   ============================================================ */
.bms-dots-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
    z-index: 5;
}

.bms-dots-standalone {
    margin: 12px 0 8px 0;
    flex: unset;
}

.bms-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background-color: #ccc;
    cursor: pointer;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
    flex-shrink: 0;
    /* Larger invisible touch area */
    padding: 8px;
    margin: -8px;
    background-clip: content-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.bms-dot.active {
    width: 24px;
    background-color: #5b9bd5;
}

/* ============================================================
   TRANSITION STATES
   ============================================================ */
.bms-slides-track.bms-no-transition { transition: none !important; }

.bms-slider-wrapper.bms-is-dragging .bms-slides-track { transition: none !important; }
.bms-slider-wrapper.bms-is-dragging { cursor: grabbing; }
.bms-slider-wrapper.bms-is-dragging * { -webkit-user-select: none; user-select: none; }

/* ============================================================
   ELEMENTOR EDITOR
   ============================================================ */
.elementor-editor-active .bms-slide { pointer-events: auto; }
