/* ═══════════════════════════════════════
   Flavor Collection Manager — frontend
   ═══════════════════════════════════════ */

.fcm-wrap,
.fcm-wrap * {
    box-sizing: border-box;
}

.fcm-wrap {
    direction: rtl;
}

/* ── wrapper ── */
.hss-wrapper.fcm-wrap {
    --hss-gap: 16px;
    --hss-carousel-full: 4;
    --hss-carousel-peek: 0.5;
    position: relative;
    contain: layout;
}

/* ── viewport (مشترک carousel + inline) ── */
.fcm-wrap .hss-carousel-viewport {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none;          /* inline: بدون scrollbar */
    overscroll-behavior-x: contain;
    touch-action: auto;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    /* GPU composite layer فقط هنگام scroll */
    transform: translateZ(0);
}

/* carousel: scrollbar نازک */
.fcm-wrap.fcm-carousel-wrap .hss-carousel-viewport {
    scrollbar-width: thin;
}

.fcm-wrap .hss-carousel-viewport::-webkit-scrollbar { height: 0; }
.fcm-wrap.fcm-carousel-wrap .hss-carousel-viewport::-webkit-scrollbar { height: 4px; }
.fcm-wrap.fcm-carousel-wrap .hss-carousel-viewport::-webkit-scrollbar-thumb { background: rgba(0,0,0,.2); border-radius: 2px; }

.fcm-wrap .hss-carousel-viewport.is-dragging {
    cursor: grabbing;
    user-select: none;
    scroll-behavior: auto;
}

/* ── track مشترک ── */
.fcm-wrap .hss-track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc(
        (100% - var(--hss-gap) * var(--hss-carousel-full))
        / (var(--hss-carousel-full) + var(--hss-carousel-peek))
    );
    gap: var(--hss-gap);
    padding-bottom: 4px;
}

/* ── inline track — دقیقاً مثل carousel ── */
.fcm-inline-wrap .hss-track {
    /* ارث می‌بره از .hss-track — فقط آیتم‌ها auto-size هستن */
    grid-auto-columns: auto;
    align-items: center;
    padding-bottom: 2px;
}

/* ── carousel spacing (desktop: arrows فضا می‌خوان) ── */
.fcm-wrap.fcm-carousel-wrap .hss-carousel-viewport {
    width: 100%;
    max-width: 100%;
    margin-inline: 0;
}

/* ── arrows — فعلاً hidden ── */
.fcm-arrow { display: none !important; }

/* ═══════ کارت / آیتم ═══════ */

.fcm-item,
.fcm-item-link { width: 100%; }

.fcm-item {
    contain: layout style paint;
}

.fcm-item-link {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    text-decoration: none !important;
    color: inherit !important;
}

/* ── تصویر دایره‌ای ── */
.fcm-item-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 50%;
    flex: 0 0 auto;
    display: block;
    margin-inline: auto;
}

.fcm-item-image img {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover;
    object-position: center;
    display: block;
    border-radius: 50%;
    will-change: auto;
    transition: transform .3s ease, opacity .3s ease;
}

.fcm-item:hover .fcm-item-image img {
    will-change: transform;
}

/* ── گرادینت بردر (مشترک related + header) ── */
.fcm-item-image::before,
.fcm-hdr-img::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: var(--fcm-gb-size, 0);
    background: linear-gradient(
        var(--fcm-gb-angle, 135deg),
        var(--fcm-gb-c1, transparent),
        var(--fcm-gb-c2, transparent)
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 1;
}

/* ── placeholder ── */
.fcm-item-ph {
    position: absolute !important;
    inset: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
}

/* ── نام ── */
.fcm-item-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ═══════ گرید ═══════ */

.fcm-grid .fcm-item {
    content-visibility: auto;
    contain-intrinsic-size: 220px;
}

.fcm-grid .fcm-item[hidden] { display: none !important; }

.fcm-grid-sentinel { width: 100%; height: 1px; }

/* ═══════ تگ خطی (inline) — دقیقاً مثل کاروسل ═══════ */

.fcm-inline-item { flex: 0 0 auto; }

.fcm-tag {
    display: inline-flex !important;
    align-items: center;
    white-space: nowrap;
    text-decoration: none !important;
    color: inherit !important;
    cursor: pointer;
}

.fcm-tag-img {
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 50% !important;
    display: block;
    flex-shrink: 0;
}

/* ═══════ هدر کالکشن ═══════ */

.fcm-hdr-img {
    overflow: hidden !important;
    aspect-ratio: 1 / 1;
    display: block !important;
    border-radius: 50% !important;
    position: relative;           /* برای ::before */
    flex-shrink: 0;
}

.fcm-hdr-img img {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    display: block !important;
    object-fit: cover;
    border-radius: 50% !important;
    position: relative;
    z-index: 0;
    transition: transform .3s ease;
}

.fcm-hdr-img:hover img { will-change: transform; }

/* ═══════ breakpoints ═══════ */

@media (max-width: 1024px) {
    .hss-wrapper.fcm-wrap {
        --hss-carousel-full: 3;
    }
}

@media (max-width: 767px) {
    .hss-wrapper.fcm-wrap {
        --hss-gap: 8px;
        --hss-carousel-full: 2;
    }
}
