/* WRAPPER */
.qtech-steps-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 8px;
    --qtech-card-width-slim: 96px;
    --qtech-card-width-active: 520px;
    --qtech-accent: #d19fa9;
}

/* TRACK */
.qtech-steps-track {
    display: flex;
    flex-wrap: nowrap !important;
    gap: 24px;
    align-items: stretch;
    min-height: 260px;
}

/* CARD – base */
.qtech-step-card {
    flex: 0 0 110px;
    background-color: #0f0f0f;
    border-radius: 20px;
    color: #ffffff;
    cursor: pointer;
    transition:
        flex 0.75s cubic-bezier(0.25, 0.8, 0.25, 1),
        opacity 0.6s ease,
        transform 0.75s cubic-bezier(0.25, 0.8, 0.25, 1),
        box-shadow 0.6s ease;
    display: flex;
    align-items: stretch;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    position: relative;
}

.qtech-step-card.active {
    flex: 1 1 auto;
    background-color: #171717;
    box-shadow: 0 8px 32px rgba(209, 159, 169, 0.2);
}

.qtech-step-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    padding: 24px 28px;
    width: 100%;
}

.qtech-step-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1 1 auto;
}

.qtech-step-number {
    font-size: 16px;
    font-weight: 600;
    opacity: 0.9;
}

.qtech-step-title-wrapper {
    position: relative;
    width: 100%;
    height: auto;
    overflow: visible;
}

.qtech-step-card.active .qtech-step-title {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    font-size: 26px;
    line-height: 1.2;
    margin: 0;
    animation: slideInTitle 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.qtech-step-card:not(.active) .qtech-step-inner {
    justify-content: center;
    padding: 24px 0;
}

.qtech-step-card:not(.active) .qtech-step-main {
    align-items: center;
    justify-content: center;
    gap: 18px;
    text-align: center;
}

.qtech-step-card:not(.active) .qtech-step-number {
    font-size: 16px;
    margin: 0;
    opacity: 0.7;
    transition: opacity 0.4s ease;
}

.qtech-step-card:not(.active) .qtech-step-title {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 18px;
    font-weight: 600;
    opacity: 0.85;
    margin: 0 auto;
    display: inline-block;
    white-space: nowrap;
    transition: opacity 0.4s ease;
    max-height: 15ch;
    overflow: hidden;
}

.qtech-step-card:not(.active) {
    min-height: 200px;
}

.qtech-step-card:not(.active) .qtech-step-body,
.qtech-step-card:not(.active) .qtech-step-media {
    display: none;
}

.qtech-step-body {
    max-width: 480px;
    opacity: 0;
    transform: translateY(10px);
    transition:
        opacity 0.7s cubic-bezier(0.25, 0.8, 0.25, 1) 0.1s,
        transform 0.7s cubic-bezier(0.25, 0.8, 0.25, 1) 0.1s;
}

.qtech-step-card.active .qtech-step-body {
    opacity: 1;
    transform: translateY(0);
}

.qtech-step-desc {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 1.6;
}

.qtech-step-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.qtech-step-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(209, 159, 169, 0.3);
}

.qtech-step-media {
    flex: 0 0 220px;
    max-width: 220px;
    opacity: 0;
    transform: scale(0.95);
    transition:
        opacity 0.8s cubic-bezier(0.25, 0.8, 0.25, 1) 0.2s,
        transform 0.8s cubic-bezier(0.25, 0.8, 0.25, 1) 0.2s;
}

.qtech-step-card.active .qtech-step-media {
    opacity: 1;
    transform: scale(1);
}

.qtech-step-media img,
.qtech-step-media video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 16px;
}

h3.qtech-step-title { margin: 0; }
.qtech-step-card.active h3.qtech-step-title { min-height: 40px; }

@keyframes slideInTitle {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideInTitleMobile {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUpContent {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes expandAccent {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* ===== TABLET ===== */
@media (max-width: 1024px) {
    .qtech-steps-wrapper {
        --qtech-card-width-active: 420px;
        --qtech-card-width-slim: 80px;
    }
    .qtech-step-card.active .qtech-step-title { font-size: 22px; }
    .qtech-step-media { flex: 0 0 180px; max-width: 180px; }
}

/* ============================================================
   MOBILE <= 767px
   ============================================================ */
@media (max-width: 767px) {

    .qtech-steps-wrapper {
        overflow-x: hidden;
        overflow-y: visible;
        padding: 4px 0 16px;
    }

    .qtech-steps-track {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 8px;
        min-height: auto;
        width: 100%;
        box-sizing: border-box;
    }

    /* ALL cards — overflow hidden, no bleed ever */
    .qtech-step-card {
        flex: 0 0 auto !important;
        width: 100%;
        box-sizing: border-box;
        border-radius: 12px;
        background: #111111;
        border: 1px solid rgba(255, 255, 255, 0.06);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
        overflow: hidden !important;
        min-height: 0 !important;
        transition:
            background 0.4s ease,
            border-color 0.4s ease,
            box-shadow 0.4s ease;
    }

    /* ── COLLAPSED — small pill row ── */
    .qtech-step-card:not(.active) {
        height: 48px !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    .qtech-step-card:not(.active):active {
        background: #1c1c1c !important;
        transform: scale(0.99);
    }

    /* Inner row — simple flex, no pseudo tricks causing overflow */
    .qtech-step-card:not(.active) .qtech-step-inner {
        all: unset !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        height: 48px !important;
        padding: 0 16px !important;
        box-sizing: border-box !important;
        gap: 8px !important;
        overflow: hidden !important;
    }

    /* Accent dot */
    .qtech-step-card:not(.active) .qtech-step-inner::before {
        content: '';
        display: block;
        width: 5px;
        height: 5px;
        min-width: 5px;
        border-radius: 50%;
        background: rgba(209, 159, 169, 0.5);
        flex-shrink: 0;
    }

    /* Chevron */
    .qtech-step-card:not(.active) .qtech-step-inner::after {
        content: '';
        display: block;
        width: 6px;
        height: 6px;
        min-width: 6px;
        border-right: 1.5px solid rgba(255, 255, 255, 0.3);
        border-bottom: 1.5px solid rgba(255, 255, 255, 0.3);
        transform: rotate(-45deg);
        flex-shrink: 0;
        margin-left: auto;
    }

    /* Main — just a flex passthrough, no height set */
    .qtech-step-card:not(.active) .qtech-step-main {
        all: unset !important;
        display: flex !important;
        flex: 1 1 0% !important;
        min-width: 0 !important;
        align-items: center !important;
        justify-content: flex-start !important;
        overflow: hidden !important;
    }

    /* Hide number */
    .qtech-step-card:not(.active) .qtech-step-number {
        display: none !important;
    }

    /* Title wrapper — just a passthrough flex container */
    .qtech-step-card:not(.active) .qtech-step-title-wrapper {
        all: unset !important;
        display: flex !important;
        flex: 1 1 0% !important;
        min-width: 0 !important;
        align-items: center !important;
        overflow: hidden !important;
    }

    /* Title — simple single line, centered vertically by flex parent */
    .qtech-step-card:not(.active) .qtech-step-title,
    .qtech-step-card:not(.active) h3.qtech-step-title {
        all: unset !important;
        display: block !important;
        color: rgba(255, 255, 255, 0.85) !important;
        font-size: 13.5px !important;
        font-weight: 600 !important;
        line-height: 1.2 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        width: 100% !important;
        animation: none !important;
    }

    /* Hide body & media */
    .qtech-step-card:not(.active) .qtech-step-body,
    .qtech-step-card:not(.active) .qtech-step-media {
        display: none !important;
    }

    /* ── ACTIVE CARD ── */
    .qtech-step-card.active {
        flex: 0 0 auto !important;
        width: 100%;
        box-sizing: border-box;
        height: auto !important;
        border-radius: 16px;
        background: linear-gradient(160deg, #1a1212 0%, #161616 60%, #111111 100%);
        border: 1px solid rgba(209, 159, 169, 0.2);
        box-shadow:
            0 0 0 1px rgba(209, 159, 169, 0.08),
            0 8px 32px rgba(0, 0, 0, 0.5),
            0 2px 12px rgba(209, 159, 169, 0.12);
        overflow: hidden !important;
        position: relative;
    }

    .qtech-step-card.active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 20px;
        right: 20px;
        height: 2px;
        background: linear-gradient(90deg,
            transparent 0%,
            rgba(209, 159, 169, 0.6) 30%,
            rgba(209, 159, 169, 0.9) 50%,
            rgba(209, 159, 169, 0.6) 70%,
            transparent 100%
        );
        border-radius: 0 0 2px 2px;
        transform-origin: left center;
        animation: expandAccent 0.55s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
        z-index: 1;
    }

    .qtech-step-card.active .qtech-step-inner {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 22px 20px 24px !important;
        gap: 0 !important;
        justify-content: flex-start !important;
        height: auto !important;
        width: 100% !important;
        box-sizing: border-box !important;
        position: relative !important;
        z-index: 1 !important;
    }

    .qtech-step-card.active .qtech-step-main {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 6px !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        margin-bottom: 16px !important;
        text-align: left !important;
    }

    .qtech-step-card.active .qtech-step-number {
        display: inline-flex !important;
        font-size: 10px !important;
        font-weight: 800 !important;
        letter-spacing: 0.08em !important;
        color: var(--qtech-accent, #d19fa9) !important;
        background: rgba(209, 159, 169, 0.12) !important;
        border: 1px solid rgba(209, 159, 169, 0.28) !important;
        border-radius: 6px !important;
        padding: 3px 8px !important;
        opacity: 1 !important;
        margin-bottom: 4px !important;
        text-transform: uppercase !important;
    }

    .qtech-step-card.active .qtech-step-title-wrapper {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        position: static !important;
    }

    /* Active title animates from below — stays within card */
    .qtech-step-card.active .qtech-step-title,
    .qtech-step-card.active h3.qtech-step-title {
        display: block !important;
        writing-mode: horizontal-tb !important;
        font-size: 21px !important;
        font-weight: 700 !important;
        line-height: 1.25 !important;
        color: #ffffff !important;
        opacity: 1 !important;
        white-space: normal !important;
        height: auto !important;
        margin: 0 !important;
        animation: slideInTitleMobile 0.45s cubic-bezier(0.25, 0.8, 0.25, 1) forwards !important;
    }

    .qtech-step-card.active .qtech-step-body {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        opacity: 0;
        transform: translateY(12px);
        animation: fadeUpContent 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) 0.12s forwards;
        padding-top: 14px !important;
        border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
    }

    /* FIX: animation-fill-mode:both applies the "from" keyframe (opacity:0) before the delay,
       preventing any flash, without blocking the final "to" state (opacity:1) */
    .qtech-step-card.active .qtech-step-media {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        margin-top: 16px !important;
        transition: none !important;
        animation: fadeUpContent 0.55s cubic-bezier(0.25, 0.8, 0.25, 1) 0.22s both !important;
    }

    .qtech-step-media {
        flex: 1 1 100%;
        max-width: 100%;
    }

    /* FIX: contain keeps full image visible without cropping */
    .qtech-step-media img,
    .qtech-step-media video {
        width: 100% !important;
        height: auto !important;
        max-height: 240px !important;
        object-fit: contain !important;
        border-radius: 12px !important;
        display: block !important;
        border: 1px solid rgba(255, 255, 255, 0.06) !important;
    }

    .qtech-step-body { width: 100%; max-width: 100%; }

    .qtech-step-desc {
        font-size: 13.5px;
        line-height: 1.65;
        color: rgba(255, 255, 255, 0.65);
        margin: 0 0 18px;
    }

    .qtech-step-btn {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        padding: 13px 20px !important;
        font-size: 13.5px !important;
        font-weight: 600 !important;
        border-radius: 10px !important;
        letter-spacing: 0.02em !important;
        background: rgba(209, 159, 169, 0.12) !important;
        color: var(--qtech-accent, #d19fa9) !important;
        border: 1px solid rgba(209, 159, 169, 0.22) !important;
        box-sizing: border-box !important;
        transition:
            background 0.25s ease,
            box-shadow 0.25s ease,
            transform 0.2s ease;
    }

    .qtech-step-btn:hover,
    .qtech-step-btn:active {
        background: rgba(209, 159, 169, 0.2) !important;
        box-shadow: 0 4px 16px rgba(209, 159, 169, 0.2) !important;
        transform: translateY(-1px) !important;
    }
}

/* ===== EXTRA SMALL <= 480px ===== */
@media (max-width: 480px) {

    .qtech-step-card:not(.active) {
        height: 44px !important;
    }

    .qtech-step-card:not(.active) .qtech-step-inner {
        height: 44px !important;
        padding: 0 14px !important;
    }

    .qtech-step-card:not(.active) .qtech-step-title,
    .qtech-step-card:not(.active) h3.qtech-step-title {
        font-size: 12.5px !important;
    }

    .qtech-step-card.active .qtech-step-inner {
        padding: 18px 16px 20px !important;
    }

    .qtech-step-card.active .qtech-step-title,
    .qtech-step-card.active h3.qtech-step-title {
        font-size: 18px !important;
    }

    /* FIX: match contain fix at extra-small breakpoint too */
    .qtech-step-media img,
    .qtech-step-media video {
        max-height: 200px !important;
        object-fit: contain !important;
    }

    .qtech-step-desc { font-size: 12.5px; }

    .qtech-step-btn {
        padding: 12px 16px !important;
        font-size: 12.5px !important;
    }
}