/* ════════════════════════════════════════════════════
   HPB Tab Slideshow — آکاردئون عمودی + پنل تصویر (Pixis-style)
   ════════════════════════════════════════════════════ */

:root {
    --hpb-ts-divider: #e5e7eb;
    --hpb-ts-title-active: #0f172a;
    --hpb-ts-title-inactive: #64748b;
    --hpb-ts-body: #475569;
    --hpb-ts-asset-bg: transparent;
    --hpb-ts-asset-radius: 20px;
    --hpb-ts-icon: #94a3b8;
    --hpb-ts-transition: 450ms;
}

.hpb-tab-slideshow {
    direction: rtl;
    padding: 8px 0 56px;
}

.hpb-tab-slideshow__title-wrap {
    margin-bottom: 40px;
    text-align: center;
}

.hpb-tab-slideshow__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(24px, 4vw, 56px);
    align-items: stretch;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* ستون‌ها LTR تا order موقعیت چپ/راست را قطعی کند؛ متن داخل ستون‌ها RTL می‌ماند */
    direction: ltr;
}

.hpb-tab-slideshow__tabs,
.hpb-tab-slideshow__assets {
    direction: rtl;
    min-width: 0;
}

/* تب‌ها چپ، تصویر راست */
.hpb-tab-slideshow--tabs-left .hpb-tab-slideshow__tabs {
    order: 1;
}

.hpb-tab-slideshow--tabs-left .hpb-tab-slideshow__assets {
    order: 2;
}

/* تب‌ها راست، تصویر چپ */
.hpb-tab-slideshow--tabs-right .hpb-tab-slideshow__tabs {
    order: 2;
}

.hpb-tab-slideshow--tabs-right .hpb-tab-slideshow__assets {
    order: 1;
}

/* ── Tabs column ─────────────────────────────────── */

.hpb-tab-slideshow__tabs {
    display: flex;
    flex-direction: column;
}

.hpb-ts-tab {
    border-bottom: 1px solid var(--hpb-ts-divider);
}

.hpb-ts-tab:first-child {
    border-top: 1px solid var(--hpb-ts-divider);
}

.hpb-ts-tab__trigger {
    display: block;
    width: 100%;
    padding: 22px 0;
    margin: 0;
    border: 0;
    background: transparent;
    text-align: right;
    cursor: pointer;
    color: inherit;
    font: inherit;
    transition: color var(--hpb-ts-transition) ease;
}

.hpb-ts-tab__headline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}

.hpb-ts-tab__title {
    display: block;
    font-size: var(--hpb-ts-title-size, clamp(1.05rem, 1.8vw, 1.35rem));
    font-weight: 600;
    line-height: 1.35;
    color: var(--hpb-ts-title-inactive);
    transition: color var(--hpb-ts-transition) ease, font-size var(--hpb-ts-transition) ease,
        font-weight var(--hpb-ts-transition) ease;
}

.hpb-ts-tab.is-active .hpb-ts-tab__title {
    font-size: var(--hpb-ts-title-size-active, clamp(1.65rem, 3vw, 2.35rem));
    font-weight: 700;
    color: var(--hpb-ts-title-active);
}

.hpb-ts-tab__icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hpb-ts-icon);
    transition: transform var(--hpb-ts-transition) ease, opacity var(--hpb-ts-transition) ease;
}

.hpb-ts-tab__icon-plus {
    position: relative;
    width: 14px;
    height: 14px;
}

.hpb-ts-tab__icon-plus::before,
.hpb-ts-tab__icon-plus::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    background: currentColor;
    border-radius: 1px;
    transition: transform var(--hpb-ts-transition) ease, opacity var(--hpb-ts-transition) ease;
}

.hpb-ts-tab__icon-plus::before {
    width: 14px;
    height: 2px;
    transform: translate(-50%, -50%);
}

.hpb-ts-tab__icon-plus::after {
    width: 2px;
    height: 14px;
    transform: translate(-50%, -50%);
}

.hpb-ts-tab.is-active .hpb-ts-tab__icon-plus::after {
    transform: translate(-50%, -50%) scaleY(0);
    opacity: 0;
}

.hpb-ts-tab__body-wrap {
    display: grid;
    grid-template-rows: 0fr;
    overflow: hidden;
    transition: grid-template-rows var(--hpb-ts-transition) ease, margin var(--hpb-ts-transition) ease;
}

.hpb-ts-tab.is-active .hpb-ts-tab__body-wrap {
    grid-template-rows: 1fr;
    margin-top: 14px;
}

.hpb-ts-tab__body {
    min-height: 0;
    display: block;
    font-size: 0.98rem;
    line-height: 1.85;
    color: var(--hpb-ts-body);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity var(--hpb-ts-transition) ease, transform var(--hpb-ts-transition) ease;
}

.hpb-ts-tab.is-active .hpb-ts-tab__body {
    opacity: 1;
    transform: none;
}

.hpb-ts-tab__body > * {
    margin-bottom: 0.65em;
}

.hpb-ts-tab__body > *:last-child {
    margin-bottom: 0;
}

/* ── Assets column ───────────────────────────────── */

.hpb-tab-slideshow__assets {
    position: relative;
    min-height: 320px;
}

.hpb-ts-asset {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.985);
    transition: opacity var(--hpb-ts-transition) ease, transform var(--hpb-ts-transition) ease,
        visibility var(--hpb-ts-transition) ease;
}

.hpb-ts-asset.is-active {
    position: relative;
    opacity: 1;
    visibility: visible;
    transform: none;
}

.hpb-ts-asset__frame {
    background: transparent;
    border-radius: var(--hpb-ts-asset-radius);
    overflow: hidden;
    min-height: clamp(280px, 38vw, 480px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: none;
}

.hpb-ts-asset__image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--hpb-ts-asset-radius);
    object-fit: contain;
}

.hpb-ts-asset__video {
    width: 100%;
    height: auto;
    max-height: clamp(280px, 50vw, 560px);
    display: block;
    border-radius: var(--hpb-ts-asset-radius);
    object-fit: contain;
    background: #0b1220;
}

.hpb-ts-asset__frame--video {
    padding: 0;
    background: transparent;
}

.hpb-ts-asset__frame--empty {
    color: #64748b;
    font-size: 1.1rem;
    text-align: center;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
}

.hpb-ts-asset__placeholder {
    padding: 24px;
}

/* ── Section shell (site pages) ──────────────────── */

.crafto-tab-slideshow__head {
    text-align: center;
    margin-bottom: 36px;
}

.crafto-tab-slideshow__lead {
    margin: 10px auto 0;
    max-width: 720px;
    color: #64748b;
    font-size: 1rem;
    line-height: 1.8;
}

/* ── Responsive ──────────────────────────────────── */

@media (max-width: 900px) {
    .hpb-tab-slideshow__grid {
        grid-template-columns: 1fr;
        direction: rtl;
    }

    .hpb-tab-slideshow--tabs-left .hpb-tab-slideshow__tabs,
    .hpb-tab-slideshow--tabs-left .hpb-tab-slideshow__assets,
    .hpb-tab-slideshow--tabs-right .hpb-tab-slideshow__tabs,
    .hpb-tab-slideshow--tabs-right .hpb-tab-slideshow__assets {
        order: unset;
    }

    .hpb-tab-slideshow__assets {
        min-height: 240px;
        order: -1;
    }

    .hpb-ts-asset__frame {
        min-height: 220px;
    }
}

@media (max-width: 480px) {
    .hpb-ts-tab__trigger {
        padding: 16px 0;
    }

    .hpb-ts-tab__body {
        font-size: 0.92rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hpb-ts-tab__body,
    .hpb-ts-asset,
    .hpb-ts-tab__body-wrap,
    .hpb-ts-tab__title,
    .hpb-ts-tab__icon-plus::before,
    .hpb-ts-tab__icon-plus::after {
        transition: none !important;
    }
}
