/* ===========================================================================
   فست‌کارت — نوارِ سه‌گامِ خرید (سبد ← ارسال ← پرداخت). دور ۸۱
   ===========================================================================

   «بخش‌های بالا که steps رو نشون میده باید در صفحه پرداخت و صفحه shipping و
   صفحه cart یکدست بشه.»

   تا این دور سه شکل داشت: سبد نوارِ قدیمیِ `c-checkout-stepbar`ِ خودش را
   داشت، ارسال دایره‌های ۷۲ پیکسلی در `pages/shipping.css` و پرداخت آیکون‌های
   بی‌قاب در `pages/payment.css`. حالا هر سه صفحه همان `_shared/checkout_steps.html`
   را می‌گذارند و همین یک فایل شکلش را می‌دهد؛ قاعدهٔ گام در شیوه‌نامهٔ هیچ
   صفحه‌ای نمانده.

   نشانه‌گذاری مشترکِ چهار قالب است و دست نخورد: شمارهٔ «گامِ ۱» با شمارندهٔ
   CSS و تیکِ گامِ گذشته با شبه‌عنصر ساخته می‌شوند، تا قالب‌های دیگر چیزِ
   بی‌شکلی نبینند.
   =========================================================================== */

.ck-steps {
    margin-block: 0 var(--ds-space-5, 2rem);
    padding: 18px clamp(12px, 3vw, 32px) 14px;
    background: var(--theme-surface, #fff);
    border: 1px solid var(--theme-line, #e5e7eb);
    border-radius: var(--theme-radius-lg, 16px);
    box-shadow: var(--theme-shadow-sm, 0 1px 2px rgb(15 23 42 / .04));
}

.ck-steps__list {
    counter-reset: ck-step;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0;
    padding: 0;
    list-style: none;
}

.ck-steps__item {
    counter-increment: ck-step;
    position: relative;
    display: flex;
    justify-content: center;
    color: var(--theme-ink-muted, #6b7280);
}

/* خطِ پیشرفت: از مرکزِ گامِ قبلی تا مرکزِ همین گام. گامِ گذشته و فعلی خطِ رنگی
   می‌گیرند، پس کاربر می‌بیند چه اندازه از مسیر آمده. */
.ck-steps__item + .ck-steps__item::before {
    content: '';
    position: absolute;
    top: 25px;
    inset-inline-end: calc(50% + 32px);
    width: calc(100% - 64px);
    height: 3px;
    border-radius: 3px;
    background: var(--theme-line, #e5e7eb);
}
.ck-steps__item.is-done + .ck-steps__item::before {
    background: linear-gradient(to left, var(--theme-accent, #0da487), var(--theme-accent-strong, var(--theme-accent, #0da487)));
}
[dir="ltr"] .ck-steps__item.is-done + .ck-steps__item::before {
    background: linear-gradient(to right, var(--theme-accent, #0da487), var(--theme-accent-strong, var(--theme-accent, #0da487)));
}

/* `display` صریح و با دو کلاس: قاعده‌های سراسریِ قالب پیوند و `span` را block یا inline-block می‌کنند و
   عنوان کنارِ دایره می‌افتاد، نه زیرش. */
.ck-steps .ck-steps__link {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
    border-radius: var(--theme-radius, 10px);
    outline-offset: 4px;
}
a.ck-steps__link:hover .ck-steps__icon { transform: translateY(-2px); box-shadow: var(--theme-shadow-md, 0 6px 16px rgb(15 23 42 / .08)); }
a.ck-steps__link:focus-visible { outline: 2px solid var(--theme-accent, #0da487); }

.ck-steps__icon {
    width: 52px;
    height: 52px;
    padding: 12px;
    margin-block-end: 8px;
    border-radius: 50%;
    border: 2px solid var(--theme-line, #e5e7eb);
    background: var(--theme-surface, #fff);
    filter: grayscale(1);
    opacity: .55;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

/* «گامِ ۱» — شمارندهٔ CSS با رقمِ فارسی؛ بالای عنوان، کم‌رنگ. */
.ck-steps__link::before {
    content: 'گام ' counter(ck-step, persian);
    order: 1;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--theme-ink-muted, #6b7280);
}
.ck-steps__title {
    order: 2;
    font-size: var(--ds-text-sm, .9rem);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* گامِ فعلی: حلقهٔ برند با هالهٔ نرم و عنوانِ پررنگ. */
.ck-steps__item.is-current { color: var(--theme-ink, #1f2937); }
.ck-steps__item.is-current .ck-steps__icon {
    border-color: var(--theme-accent, #0da487);
    background: var(--theme-accent-wash, var(--theme-accent-soft, #eafaf6));
    box-shadow: 0 0 0 6px var(--theme-accent-soft, #eafaf6);
    filter: none;
    opacity: 1;
}
.ck-steps__item.is-current .ck-steps__title { font-weight: 800; }
.ck-steps__item.is-current .ck-steps__link::before { color: var(--theme-accent, #0da487); }

/* گامِ گذشته: کامل، با تیکِ کوچک روی گوشهٔ دایره. پیوند است و برمی‌گرداند. */
.ck-steps__item.is-done { color: var(--theme-ink, #1f2937); }
.ck-steps__item.is-done .ck-steps__icon {
    border-color: var(--theme-accent, #0da487);
    filter: none;
    opacity: 1;
}
.ck-steps__item.is-done .ck-steps__link::after {
    content: '';
    position: absolute;
    top: 34px;
    inset-inline-start: calc(50% + 12px);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--theme-surface, #fff);
    background: var(--theme-accent, #0da487)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.2 4.2L19 7'/%3E%3C/svg%3E")
        center / 12px no-repeat;
}

@media (max-width: 575.98px) {
    .ck-steps { padding: 12px 6px 10px; border-radius: var(--theme-radius, 12px); margin-block-end: var(--ds-space-4, 1.25rem); }
    .ck-steps__icon { width: 40px; height: 40px; padding: 8px; margin-block-end: 6px; }
    .ck-steps__item + .ck-steps__item::before { top: 19px; inset-inline-end: calc(50% + 25px); width: calc(100% - 50px); }
    .ck-steps__item.is-current .ck-steps__icon { box-shadow: 0 0 0 4px var(--theme-accent-soft, #eafaf6); }
    .ck-steps__item.is-done .ck-steps__link::after { top: 26px; inset-inline-start: calc(50% + 8px); width: 17px; height: 17px; background-size: 10px; }
    .ck-steps__title { font-size: 12px; }
    .ck-steps__link::before { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .ck-steps__icon { transition: none; }
    a.ck-steps__link:hover .ck-steps__icon { transform: none; }
}

/* `checkout-base.css` در ۴۸۰ پیکسل نامِ گام‌های دیگر را پنهان می‌کند (برای نوارهای افقیِ قالب‌های دیگر)؛
   اینجا هر گام ستونِ خودش را دارد و نام‌ها جا می‌شوند — بی‌نام، دایرهٔ خاکستری معنایی ندارد. */
@media (max-width: 480px) {
    .ck-steps__item:not(.is-current) .ck-steps__title { display: block; }
}
