/* ==========================================================================
   Mobile polish: "Why Choose" timeline (icon + card list)
   Loaded AFTER the page's inline <style>, so these rules win on phones.
   Desktop (>= 769px) is untouched. RTL (Urdu / Arabic) is mirrored below.
   ========================================================================== */

@media (max-width: 768px) {

    .timeline-container {
        --tl-icon: 46px;                 /* icon circle size            */
        --tl-gap: 16px;                  /* space between icon and card */
        --tl-line: #dbe7fb;              /* vertical connector colour   */
        max-width: 100%;
        margin: 0 auto;
        padding: 4px 0;
    }

    /* vertical connector: runs through the centre of the icons */
    .timeline-container::before {
        left: calc(var(--tl-icon) / 2) !important;
        right: auto !important;
        top: 24px;
        bottom: 24px;
        width: 2px;
        transform: translateX(-50%);
        background: linear-gradient(to bottom, rgba(24,119,242,.05), var(--tl-line) 12%, var(--tl-line) 88%, rgba(24,119,242,.05));
        border-radius: 2px;
    }

    /* one row = [icon] [card]  (icon is pulled out of the flow) */
    .timeline-item,
    .timeline-item:nth-child(even) {
        display: block !important;
        position: relative;
        width: 100%;
        margin: 0 0 22px 0 !important;
        padding-left: calc(var(--tl-icon) + var(--tl-gap));
        min-height: var(--tl-icon);
    }
    .timeline-item:last-child { margin-bottom: 0 !important; }

    /* the invisible desktop spacer must never show on phones */
    .timeline-item > .timeline-content.d-none,
    .timeline-item > .timeline-content[style*="opacity: 0"] { display: none !important; }

    /* icon: fixed on the line, level with the card's heading */
    .timeline-icon-wrap {
        position: absolute;
        left: 0;
        top: 14px;
        width: var(--tl-icon);
        height: var(--tl-icon);
        z-index: 2;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .timeline-icon {
        width: var(--tl-icon);
        height: var(--tl-icon);
        min-width: var(--tl-icon);
        flex: 0 0 var(--tl-icon);
        font-size: 1.15rem;
        color: #fff;
        background: linear-gradient(135deg, #1877f2 0%, #0a58ca 100%);
        border: 3px solid #fff;                       /* gap that "cuts" the line */
        box-shadow: 0 0 0 1px #cfe0fb, 0 6px 14px rgba(24,119,242,.28);
    }

    /* the card */
    .timeline-content,
    .timeline-item:nth-child(even) .timeline-content {
        width: 100% !important;
        padding: 18px 18px 18px 20px !important;
        text-align: left !important;
        background: #fff;
        border: 1px solid #e6eefb;
        border-radius: 16px;
        box-shadow: 0 8px 22px rgba(15, 40, 90, .06) !important;
    }

    /* little pointer from the card towards its icon */
    .timeline-item > .timeline-content:not(.d-none)::before {
        content: '';
        position: absolute;
        left: -7px;
        top: 28px;
        width: 12px;
        height: 12px;
        background: #fff;
        border-left: 1px solid #e6eefb;
        border-bottom: 1px solid #e6eefb;
        transform: rotate(45deg);
    }

    .timeline-content h4 {
        font-size: 1.05rem;
        line-height: 1.35;
        font-weight: 700;
        color: #0f172a;
        margin: 0 0 8px 0;
    }
    .timeline-content p {
        font-size: .92rem;
        line-height: 1.65;
        color: #5b6b82;
        margin: 0;
    }
    .timeline-content p strong { color: #1e3a6e; font-weight: 600; }
}

/* very small phones */
@media (max-width: 380px) {
    .timeline-container { --tl-icon: 40px; --tl-gap: 12px; }
    .timeline-icon { font-size: 1rem; }
    .timeline-icon-wrap { top: 12px; }
    .timeline-content,
    .timeline-item:nth-child(even) .timeline-content { padding: 16px 14px 16px 16px !important; }
    .timeline-item > .timeline-content:not(.d-none)::before { top: 24px; }
}

/* ----- RTL (Urdu, Arabic): mirror everything ----- */
@media (max-width: 768px) {
    [dir="rtl"] .timeline-container::before {
        left: auto !important;
        right: calc(var(--tl-icon) / 2) !important;
        transform: translateX(50%);
    }
    [dir="rtl"] .timeline-item,
    [dir="rtl"] .timeline-item:nth-child(even) {
        padding-left: 0;
        padding-right: calc(var(--tl-icon) + var(--tl-gap));
    }
    [dir="rtl"] .timeline-icon-wrap { left: auto; right: 0; }
    [dir="rtl"] .timeline-content,
    [dir="rtl"] .timeline-item:nth-child(even) .timeline-content {
        text-align: right !important;
        padding: 18px 20px 18px 18px !important;
    }
    [dir="rtl"] .timeline-item > .timeline-content:not(.d-none)::before {
        left: auto;
        right: -7px;
        border-left: 0;
        border-bottom: 0;
        border-right: 1px solid #e6eefb;
        border-top: 1px solid #e6eefb;
    }
}
