/* ==========================================================================
   VENDORHA — ویترین صفحهٔ اصلی
   --------------------------------------------------------------------------
   ⚠️ دو رفتار متفاوت:

     دسکتاپ →  ردیف افقی اسکرول‌شونده
     موبایل  →  شبکهٔ عمودی

   دلیل: صفحهٔ کوچک جای اسکرول افقی ندارد و کاربر با شست
   عمودی می‌چرخد.
   ========================================================================== */
.hs {
  --hs-accent: var(--green-btn, #16A34A);
  --hs-cols: 4;
  --hs-mcols: 2;

  padding: 40px 0;
  position: relative;
}

/* ---- پس‌زمینه ---- */
.hs-bg-soft { background: var(--bg-subtle); }

.hs-bg-gradient {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--hs-accent) 8%, transparent),
    color-mix(in srgb, var(--hs-accent) 2%, transparent));
}

.hs-bg-dark {
  background: linear-gradient(135deg, #0B3D26, #14653D);
  color: #fff;
}
.hs-bg-dark .hs-head h2,
.hs-bg-dark .hs-head p { color: #fff; }
.hs-bg-dark .hs-card { background: rgba(255, 255, 255, .07); }
.hs-bg-dark .hs-body h3 { color: #fff; }

/* ---- سربرگ ---- */
.hs-head {
  display: flex; align-items: flex-end; gap: 16px;
  justify-content: space-between; flex-wrap: wrap;
  margin-bottom: 20px;
}

.hs-eyebrow {
  display: inline-block; margin-bottom: 7px;
  padding: 4px 13px; border-radius: 999px;
  font-size: .72rem; font-weight: 800;
  background: color-mix(in srgb, var(--hs-accent) 14%, transparent);
  color: var(--hs-accent);
}

.hs-head h2 {
  margin: 0; font-size: 1.4rem; font-weight: 800;
  letter-spacing: -.01em;
}
.hs-head p {
  margin: 5px 0 0; font-size: .85rem;
  color: var(--slate); line-height: 1.9;
}

.hs-head-side {
  display: flex; align-items: center; gap: 10px;
}

.hs-all {
  font-size: .84rem; font-weight: 700;
  color: var(--hs-accent); text-decoration: none;
  white-space: nowrap;
}
.hs-all:hover { text-decoration: underline; }

.hs-nav { display: flex; gap: 5px; }
.hs-nav button {
  width: 34px; height: 34px; cursor: pointer;
  display: grid; place-items: center;
  border-radius: 50%; font-size: 1.2rem; line-height: 1;
  border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  transition: background .15s ease, border-color .15s ease;
}
.hs-nav button:hover {
  background: var(--hs-accent); color: #fff;
  border-color: var(--hs-accent);
}
.hs-nav button:disabled { opacity: .35; cursor: default; }

/* ==========================================================================
   ریل کارت‌ها
   ========================================================================== */
.hs-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc(
    (100% - (var(--hs-cols) - 1) * 16px) / var(--hs-cols));
  gap: 16px;

  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;

  /*
    ⚠️ فضای پایین برای سایهٔ کارت.

    بدون آن، `overflow` سایه را می‌برد.
  */
  padding-bottom: 6px;

  /* نوار اسکرول باریک و کم‌رنگ */
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.hs-track::-webkit-scrollbar { height: 6px; }
.hs-track::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 999px;
}

/* حالت شبکه‌ای */
.hs-grid .hs-track {
  grid-auto-flow: row;
  grid-template-columns: repeat(var(--hs-cols), 1fr);
  grid-auto-columns: auto;
  overflow: visible;
}

/* ==========================================================================
   کارت
   ========================================================================== */
.hs-card {
  scroll-snap-align: start;
  border-radius: 16px; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: transform .18s ease, box-shadow .18s ease,
              border-color .18s ease;
}
.hs-card:hover {
  transform: translateY(-4px);
  border-color: var(--hs-accent);
  box-shadow: 0 12px 30px rgba(15, 23, 42, .11);
}
.hs-card a {
  display: block; text-decoration: none; color: inherit;
  height: 100%;
}

/* کارت برجسته — دو ستون */
.hs-grid .hs-card.is-big { grid-column: span 2; }

/* ---- تصویر ---- */
.hs-thumb {
  position: relative; aspect-ratio: 1 / 1;
  background: var(--bg-subtle);
  display: grid; place-items: center; overflow: hidden;
}
.hs-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .3s ease;
}
.hs-card:hover .hs-thumb img { transform: scale(1.05); }

.hs-noimg { font-size: 2rem; opacity: .3; }

.hs-card-sm .hs-thumb { aspect-ratio: 4 / 3; }
.hs-card-lg .hs-thumb { aspect-ratio: 3 / 4; }

/* نشان‌ها */
.hs-off {
  position: absolute; top: 9px; inset-inline-start: 9px;
  padding: 3px 10px; border-radius: 999px;
  font-size: .74rem; font-weight: 800;
  background: #DC2626; color: #fff;
  box-shadow: 0 3px 10px rgba(220, 38, 38, .38);
}

.hs-badge {
  position: absolute; top: 9px; inset-inline-end: 9px;
  padding: 3px 10px; border-radius: 999px;
  font-size: .7rem; font-weight: 700;
  background: rgba(255, 255, 255, .94);
  color: #0F172A;
  backdrop-filter: blur(4px);
}

/* ---- متن ---- */
.hs-body { padding: 13px 14px 15px; }

.hs-body h3 {
  margin: 0 0 9px; font-size: .87rem; font-weight: 700;
  line-height: 1.75; min-height: 2.9em;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

.hs-price {
  display: flex; align-items: baseline; gap: 8px;
  flex-wrap: wrap;
}
.hs-price del {
  font-size: .74rem; color: var(--slate); opacity: .75;
}
.hs-price b {
  font-size: .95rem; color: var(--hs-accent);
  font-variant-numeric: tabular-nums;
}

/* ---- تایمر ---- */
.hs-timer {
  display: flex; gap: 3px; margin-top: 9px;
  padding: 6px 9px; border-radius: 8px;
  font-size: .78rem; font-weight: 800;
  font-variant-numeric: tabular-nums;
  direction: ltr; justify-content: center;
  background: color-mix(in srgb, #DC2626 10%, transparent);
  color: #B91C1C;
}
.hs-timer span {
  min-width: 1.6em; text-align: center;
}

/* ==========================================================================
   موبایل — شبکهٔ عمودی
   ========================================================================== */
@media (max-width: 768px) {
  .hs { padding: 28px 0; }

  .hs-head { margin-bottom: 14px; }
  .hs-head h2 { font-size: 1.15rem; }
  .hs-head p { font-size: .8rem; }

  /* ⚠️ دکمه‌های ناوبری در لمس بی‌فایده‌اند */
  .hs-nav { display: none; }

  .hs-track {
    grid-auto-flow: row;
    grid-template-columns: repeat(var(--hs-mcols), 1fr);
    grid-auto-columns: auto;
    gap: 11px;
    overflow: visible;
  }

  .hs-card.is-big { grid-column: span 1; }

  .hs-body { padding: 10px 11px 12px; }
  .hs-body h3 { font-size: .8rem; min-height: 2.8em; }
  .hs-price b { font-size: .86rem; }
}

@media (max-width: 420px) {
  .hs-head h2 { font-size: 1.05rem; }
  .hs-off, .hs-badge { font-size: .66rem; padding: 2px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .hs-card, .hs-thumb img { transition: none; }
  .hs-card:hover { transform: none; }
}
