/* ==========================================================================
   Razima — components.css
   کیت نقش‌مایه (PLAN 5.1) و اجزای مشترک همه‌ی صفحه‌ها. فقط از توکن‌های base.css رنگ می‌گیرند.
   ========================================================================== */

/* ============================ کیت نقش‌مایه ============================ */

/* دوخت زیگزاگ: زیر تیتر بخش، جداکننده‌ی فوتر، لوگو. رنگ = --tone (رنگ خط یا برند) */
.zz { display: block; width: 48px; height: 8px; flex: none; background: var(--tone); -webkit-mask: var(--zz-mask); mask: var(--zz-mask); }
.zz--wide { width: 100%; }

.zz--muted { background: var(--line-strong); }

/* برچسب آویز لباس: مستطیل گرد با سوراخ واقعی (ماسک)، کمی کج. نشان تخفیف، «جدید»، کپشن اسلاید */
.hang-tag {
  --hole: calc(100% - 10px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 2px 12px;
  padding-inline-start: 22px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--fg);
  font-size: var(--fs-2xs);
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
  transform: rotate(-4deg);
  -webkit-mask: radial-gradient(circle 3px at var(--hole) 50%, #0000 95%, #000);
  mask: radial-gradient(circle 3px at var(--hole) 50%, #0000 95%, #000);
}
[dir="ltr"] .hang-tag { --hole: 10px; }
.hang-tag--sale { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
.hang-tag--tone { border-color: transparent; background: var(--tint); color: var(--tone); }

/* کش کمر: نوار کبریتی نازک بالای سایت و بالای فوتر */
.waistband {
  height: 7px;
  background: repeating-linear-gradient(90deg, var(--wb, var(--line-strong)) 0 1px, transparent 1px 5px);
  box-shadow: inset 0 1px 0 var(--line), inset 0 -1px 0 var(--line);
  opacity: .9;
}

/* چوب‌لباسی: خط بالای کاشی دسته و نشانگر مگامنو؛ فقط در هاور رنگ می‌گیرد */
.hanger {
  display: block;
  width: 32px;
  height: 16px;
  background: var(--line-strong);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 16'%3E%3Cpath d='M16 6.2V5a2.3 2.3 0 1 0-2.3-2.3M16 6.2 2.8 13.1a1.2 1.2 0 0 0 .55 2.27h25.3a1.2 1.2 0 0 0 .55-2.27z' fill='none' stroke='%23000' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 16'%3E%3Cpath d='M16 6.2V5a2.3 2.3 0 1 0-2.3-2.3M16 6.2 2.8 13.1a1.2 1.2 0 0 0 .55 2.27h25.3a1.2 1.2 0 0 0 .55-2.27z' fill='none' stroke='%23000' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: background-color var(--dur-2) var(--ease);
}
:hover > .hanger, :focus-visible > .hanger, .is-active > .hanger { background: var(--tone); }

/* چیپ سایز (S M L / ۷۵B): قرص کوچک با حاشیه‌ی مویی؛ انتخاب = حلقه‌ی جوهری، ناموجود = خط مورب */
.size-chip {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 38px;
  padding-inline: 12px;
  border: 1px solid var(--line-input);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--fg);
  font-size: var(--fs-sm);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color var(--dur-1), box-shadow var(--dur-1), transform var(--dur-1) var(--ease);
}
.size-chip:hover { border-color: var(--fg-subtle); }
.size-chip:active { transform: scale(.96); }
.size-chip[aria-pressed="true"], input:checked + .size-chip { border-color: var(--fg); box-shadow: inset 0 0 0 .5px var(--fg); }
input:focus-visible + .size-chip { outline: 2px solid var(--focus); outline-offset: 3px; }
.size-chip[aria-disabled="true"], .size-chip:disabled, input:disabled + .size-chip {
  color: var(--fg-subtle);
  background: linear-gradient(to top left, transparent calc(50% - .6px), var(--line-strong) 50%, transparent calc(50% + .6px)) var(--surface);
  cursor: not-allowed;
}


/* برچسب لاتین کوچک بالای تیتر (NEW COLLECTION) */
.latin { unicode-bidi: isolate; color: var(--fg-subtle); font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }

/* ============================ دکمه ============================ */
.btn {
  --btn-bg: var(--bg-soft);
  --btn-fg: var(--fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55em;
  min-height: 46px;
  padding: .6em 1.5em;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--fs-sm);
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--dur-1) var(--ease), background-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.btn:hover { --btn-bg: var(--bg-tint); }
.btn:active { transform: scale(.98); }
.btn[disabled], .btn[aria-disabled="true"] { cursor: not-allowed; opacity: .5; transform: none; }
.btn--primary { --btn-bg: var(--primary); --btn-fg: var(--on-primary); }
.btn--primary:hover { --btn-bg: var(--primary-strong); }
.btn--accent { --btn-bg: var(--accent); --btn-fg: var(--on-accent); }
.btn--accent:hover { --btn-bg: var(--accent); box-shadow: inset 0 0 0 99px rgba(0, 0, 0, .08); }
.btn--dark { --btn-bg: var(--fg); --btn-fg: var(--bg); }
.btn--dark:hover { --btn-bg: var(--fg); box-shadow: inset 0 0 0 99px rgba(127, 127, 127, .18); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--fg); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn--ghost:hover { --btn-bg: transparent; box-shadow: inset 0 0 0 1px var(--fg); }
.btn--ghost .icon:last-child { transition: transform var(--dur-2) var(--ease); }
.btn--ghost:hover .icon:last-child { transform: translateX(-3px); }
[dir="ltr"] .btn--ghost:hover .icon:last-child { transform: translateX(3px); }
.btn--glass { --btn-bg: var(--glass); --btn-fg: var(--on-dark); box-shadow: inset 0 0 0 1px var(--glass-line); }
.btn--glass:hover { --btn-bg: #fff; --btn-fg: #24262B; }
.btn--link { --btn-bg: transparent; --btn-fg: var(--brand); min-height: auto; padding: 0; border-radius: 0; }
.btn--link:hover { --btn-bg: transparent; text-decoration: underline; text-underline-offset: 6px; }
.btn--sm { min-height: 38px; padding: .45em 1.1em; font-size: var(--fs-xs); }
.btn--lg { min-height: 54px; padding: .7em 1.9em; font-size: var(--fs-md); }
.btn--block { width: 100%; }
.btn .icon { width: 1.15em; height: 1.15em; }
.btn.is-busy { position: relative; pointer-events: none; color: transparent !important; }
.btn.is-busy::after { content: ""; position: absolute; inset: 0; width: 20px; height: 20px; margin: auto; border: 2px solid currentColor; border-color: var(--btn-fg) transparent var(--btn-fg) var(--btn-fg); border-radius: 50%; animation: rz-spin .7s linear infinite; }

/* دکمه‌ی آیکنی گرد */
.btn-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  transition: background-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
}
.btn-icon:hover { background: var(--bg-soft); }
.btn-icon:active { transform: scale(.94); }
.btn-icon .icon { width: 22px; height: 22px; }
.btn-icon--sm { width: 36px; height: 36px; }
.btn-icon--sm .icon { width: 18px; height: 18px; }

.btn-icon[aria-pressed="true"] { color: var(--accent); }

/* دکمه‌ی گرد افزودن به سبد */
.btn-add {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  cursor: pointer;
  transition: transform var(--dur-2) var(--ease), background-color var(--dur-2);
}
.btn-add:hover { background: var(--primary-strong); transform: scale(1.06); }
.btn-add[disabled] { background: var(--bg-tint); color: var(--fg-subtle); transform: none; cursor: not-allowed; }
.btn-add.is-busy .icon { animation: rz-spin .8s linear infinite; }
.btn-add.is-done { background: var(--success); color: #fff; }
.btn-add--soft { background: var(--bg-soft); color: var(--fg); }
.btn-add--soft:hover { background: var(--primary); color: var(--on-primary); }
[data-toggle-favorite][aria-pressed="true"] .icon { fill: currentColor; }

/* ============================ تیتر بخش ============================ */
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--fg-subtle); font-size: var(--fs-xs); font-weight: 650; line-height: 1.8; }
.eyebrow > .icon { width: 18px; height: 18px; color: var(--tone); }

.section-head { display: grid; justify-items: center; gap: 6px; max-width: 680px; margin: 0 auto clamp(28px, 4vw, 48px); text-align: center; }
.section-head h2 { font-size: var(--fs-2xl); }
.section-head h2::after { content: ""; display: block; width: 48px; height: 8px; margin: 12px auto 0; background: var(--tone); -webkit-mask: var(--zz-mask); mask: var(--zz-mask); transform-origin: right center; transition: transform var(--dur-4) var(--ease-out) .15s; }
.js .section-head:not(.is-in) h2::after { transform: scaleX(0); }
.section-head p { color: var(--fg-muted); }
.section-head--start { justify-items: start; margin-inline: 0; text-align: start; }
.section-head--start h2::after, .section-head--split h2::after { margin-inline: 0; }
.section-head--split { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; max-width: none; text-align: start; }
.section-head--split > div:not(.rail-nav):not(.tabs) { display: grid; justify-items: start; gap: 4px; }

/* ============================ نشان و چیپ ============================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding-inline: 10px;
  border-radius: var(--r-pill);
  background: var(--bg-soft);
  color: var(--fg-muted);
  font-size: var(--fs-2xs);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.badge--new { background: var(--brand-soft); color: var(--brand); }
.badge--success { background: var(--success-bg); color: var(--success); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.badge--warning { background: var(--warning-bg); color: var(--warning); }
.badge--muted { background: var(--bg-soft); color: var(--fg-muted); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--fg);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: border-color var(--dur-1), background-color var(--dur-2), box-shadow var(--dur-1), transform var(--dur-1) var(--ease);
}
.chip:hover { border-color: var(--fg-subtle); }
.chip:active { transform: scale(.97); }
.chip .icon { width: 1.1em; height: 1.1em; color: var(--fg-subtle); }
.chip[aria-pressed="true"], .chip.is-active, input:checked + .chip { border-color: var(--fg); background: var(--bg-soft); box-shadow: inset 0 0 0 .5px var(--fg); }
.chip[aria-pressed="true"] .icon, .chip.is-active .icon, input:checked + .chip .icon { color: var(--fg); }
input:focus-visible + .chip { outline: 2px solid var(--focus); outline-offset: 3px; }
.chip[aria-disabled="true"], input:disabled + .chip { opacity: .45; cursor: not-allowed; text-decoration: line-through; }
.chip__count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding-inline: 6px; border-radius: var(--r-pill); background: var(--bg-soft); color: var(--fg-muted); font-size: var(--fs-2xs); font-weight: 700; }

.chip-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-block: 4px; scroll-snap-type: x proximity; }
.chip-row::-webkit-scrollbar { display: none; }
.chip-row > * { scroll-snap-align: start; }

/* ============================ کارت ============================ */
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }

/* ---------- کارت محصول (PLAN 6.5) ----------
   عکس ۴:۵ در چاه کرم، عکس دوم با opacity (فقط hover)، یک برچسب آویز، دل، پنل سایز درون عکس، قرص تخفیف در سطر قیمت.
   پیوند تیتر (::after) فقط بدنه را می‌پوشاند؛ عکس پیوند جدای خودش را دارد تا دل و پنل سایز روی آن کلیک‌پذیر بمانند. */
.p-card { position: relative; display: flex; flex-direction: column; gap: 10px; height: 100%; container-type: inline-size; }
.p-card > * { position: relative; z-index: 1; }
.p-card__media { aspect-ratio: 4 / 5; max-width: 100%; overflow: hidden; border-radius: var(--r); background: var(--grad-media); isolation: isolate; transition: box-shadow var(--dur-2) var(--ease); }
.p-card__img { position: absolute; inset: 0; }
.p-card__img img { width: 100%; height: 100%; object-fit: cover; }
.p-card__img > img { transition: transform var(--dur-4) var(--ease); }
.p-card__alt { position: absolute; inset: 0; opacity: 0; transition: opacity var(--dur-3) var(--ease); }
@media (hover: hover) and (pointer: fine) {
  .p-card { transition: transform var(--dur-2) var(--ease); }
  .p-card:hover { transform: translateY(-4px); }
  .p-card:hover .p-card__media { box-shadow: var(--sh-2); }
  .p-card:hover .p-card__img > img { transform: scale(1.03); }
  .p-card:hover .p-card__alt { opacity: 1; }
}
.p-card__tag { position: absolute; top: 12px; inset-inline-start: 10px; z-index: 2; max-width: calc(100% - 56px); overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.p-card__tag.hang-tag--tone { border: 1px solid color-mix(in srgb, var(--tone) 22%, transparent); }
.p-card__tag--out { color: var(--fg-muted); }
.p-card__fav { position: absolute; top: 8px; inset-inline-end: 8px; z-index: 2; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: var(--surface-glass); color: var(--fg); box-shadow: var(--sh-1); cursor: pointer; transition: color var(--dur-2), transform var(--dur-2) var(--ease-spring); }
.p-card__fav .icon { width: 18px; height: 18px; }
.p-card__fav:hover, .p-card__fav[aria-pressed="true"] { color: var(--accent); }
.p-card__fav:active { transform: scale(.9); }
.p-card__body { display: grid; gap: 3px; padding-inline: 2px; }
.p-card__meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; color: var(--fg-subtle); font-size: var(--fs-2xs); font-weight: 600; }
.p-card__cat { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.p-card__cat a { position: relative; z-index: 2; }
.p-card__cat a:hover { color: var(--fg); }
.p-card__rating { display: inline-flex; flex: none; align-items: center; gap: 3px; color: var(--fg-muted); font-weight: 650; }
.p-card__rating b { color: var(--fg); font-weight: 750; }
.p-card__rating span { color: var(--fg-subtle); font-size: .9em; }
.p-card__title { font-size: var(--fs-sm); font-weight: 650; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: calc(2 * 1.7em); }
.p-card__title a::after { content: ""; position: absolute; inset: 0; z-index: 0; }
.p-card__colors { display: flex; align-items: center; gap: 6px; min-height: 14px; margin-top: 2px; }
.p-card__colors i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12), 0 0 0 1px var(--line); }
.p-card__more { color: var(--fg-subtle); font-size: var(--fs-2xs); font-weight: 650; line-height: 1; }
.p-card__foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; margin-top: auto; padding-inline: 2px; }
.p-card__foot .btn-add { position: relative; z-index: 2; }
.p-card.is-out .p-card__img img { opacity: .55; }
.p-card.is-out .price strong { color: var(--fg-subtle); font-size: var(--fs-sm); }
@container (max-width: 190px) {
  .p-card__title { font-size: var(--fs-xs); }
  .p-card__fav { top: 6px; inset-inline-end: 6px; width: 32px; height: 32px; }
  .p-card__tag { top: 10px; inset-inline-start: 6px; }
  .p-card__foot .btn-add { width: 34px; height: 34px; }
  .p-card__foot .btn-add .icon { width: 18px; height: 18px; }
  .p-card__foot .price strong { font-size: var(--fs-sm); }
}

/* پنل سایز: از پایین درون عکس بالا می‌آید (shop.js، محتوا از /Shop/Sizes) */
.size-panel { position: absolute; inset-inline: 6px; bottom: 6px; z-index: 3; display: grid; gap: 8px; max-height: calc(100% - 12px); overflow-y: auto; padding: 8px 10px 10px; border-radius: calc(var(--r) - 5px); background: var(--surface-glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: var(--sh-2); visibility: hidden; transform: translateY(calc(100% + 10px)); transition: transform var(--dur-3) var(--ease-out), visibility 0s linear var(--dur-3); }
.size-panel.is-open { visibility: visible; transform: none; transition: transform var(--dur-3) var(--ease-out); }
.size-panel__head { display: flex; align-items: center; gap: 8px; min-height: 26px; font-size: var(--fs-2xs); }
.size-panel__title { font-weight: 750; }
.size-panel__guide { display: inline-flex; align-items: center; gap: 3px; color: var(--fg-muted); font-weight: 600; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.size-panel__guide .icon { width: 14px; height: 14px; }
.size-panel__guide:hover { color: var(--fg); }
.size-panel__close { display: grid; place-items: center; width: 28px; height: 28px; margin-inline-start: auto; margin-inline-end: -4px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--fg-muted); cursor: pointer; }
.size-panel__close:hover { background: var(--bg-soft); color: var(--fg); }
.size-panel__chips, .size-panel__colors { display: flex; flex-wrap: wrap; gap: 6px; }
.size-panel .size-chip { position: relative; min-width: 40px; height: 32px; padding-inline: 8px; font-size: var(--fs-xs); }
.size-chip.is-low::after { content: ""; position: absolute; top: 3px; inset-inline-end: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.size-chip.is-busy { opacity: .55; }
.size-chip.is-done { border-color: var(--success); color: var(--success); box-shadow: inset 0 0 0 .5px var(--success); }
.size-panel__price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 0; font-size: var(--fs-xs); font-weight: 700; font-variant-numeric: tabular-nums; }
.size-panel__price del { color: var(--fg-subtle); font-weight: 500; }
@container (max-width: 190px) {
  .size-panel { inset-inline: 4px; bottom: 4px; padding: 6px 8px 8px; gap: 6px; }
  .size-panel .size-chip { min-width: 36px; height: 30px; padding-inline: 6px; }
  .size-panel__guide span { display: none; }
  .size-panel__colors { gap: 5px; }
  .size-panel .swatch { width: 22px; height: 22px; }
  .size-panel .swatch::after { inset: -3px; }
  /* قیمت کارت درست زیر عکس است و برچسب هر چیپ قیمتش را دارد */
  .size-panel__price { display: none; }
}

/* دایره‌ی رنگ قابل انتخاب (پنل سایز، صفحه‌ی محصول) */
.swatch { position: relative; display: inline-grid; flex: none; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: var(--c, var(--bg-soft)); color: var(--fg); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); font: inherit; font-size: var(--fs-2xs); font-weight: 650; cursor: pointer; }
.swatch::after { content: ""; position: absolute; inset: -4px; border-radius: inherit; box-shadow: 0 0 0 1px transparent; transition: box-shadow var(--dur-1); }
.swatch:hover::after { box-shadow: 0 0 0 1px var(--fg-subtle); }
.swatch[aria-pressed="true"]::after, .swatch.is-done::after { box-shadow: 0 0 0 1.5px var(--fg); }
.swatch:disabled { cursor: not-allowed; background: linear-gradient(to top left, transparent calc(50% - .7px), var(--fg-subtle) 50%, transparent calc(50% + .7px)) var(--c, var(--bg-soft)); opacity: .55; }
.swatch--lg { width: 30px; height: 30px; }
.swatch--text { width: auto; min-width: 26px; padding-inline: 10px; border-radius: var(--r-pill); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-input); }
.swatch.is-busy { opacity: .55; }

.price { display: grid; gap: 2px; line-height: 1.3; }
.price del { color: var(--fg-subtle); font-size: var(--fs-xs); text-decoration-thickness: 1px; }
.price strong { font-size: var(--fs-md); font-weight: 750; color: var(--fg); font-variant-numeric: tabular-nums; }
.price small { color: var(--fg-muted); font-size: var(--fs-2xs); font-weight: 600; margin-inline-start: 2px; }
.price--lg strong { font-size: var(--fs-2xl); }
.price__note { color: var(--fg-muted); font-size: var(--fs-sm); font-weight: 650; }
.price__was { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
/* قرص ملایم درصد تخفیف در سطر قیمت (نه برچسب قرمز روی عکس) */
.price__off { padding-inline: 7px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent); font-size: var(--fs-2xs); font-weight: 750; line-height: 20px; }

/* کارت مطلب */
.post-card { position: relative; display: flex; flex-direction: column; gap: 12px; }
.post-card__media { position: relative; display: block; aspect-ratio: 3 / 2; max-width: 100%; overflow: hidden; border-radius: var(--r-lg); background: var(--bg-soft); }
.post-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-4) var(--ease); }
.post-card:hover .post-card__media img { transform: scale(1.03); }
.post-card__placeholder { display: grid; place-items: center; height: 100%; color: var(--line-strong); }
.post-card__placeholder .icon { width: 56px; height: 56px; stroke-width: 1.2; }
.post-card__cat { position: absolute; top: 12px; inset-inline-start: 12px; z-index: 2; max-width: calc(100% - 24px); overflow: hidden; padding: 3px 12px; border-radius: var(--r-pill); background: var(--surface-glass); color: var(--fg); font-size: var(--fs-2xs); font-weight: 650; white-space: nowrap; text-overflow: ellipsis; pointer-events: none; }
.post-card__body { position: relative; display: flex; flex: 1; flex-direction: column; gap: 6px; padding-inline: 2px; }
.post-card__title { font-size: var(--fs-md); font-weight: 700; line-height: 1.8; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card__title a::after { content: ""; position: absolute; inset: 0; }
.post-card__title a:hover { color: var(--brand); }
.post-card__excerpt { color: var(--fg-muted); font-size: var(--fs-sm); line-height: 1.9; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; color: var(--fg-subtle); font-size: var(--fs-xs); }

/* ============================ آکاردئون، زبانه، ریل ============================ */
.acc { display: grid; gap: 0; border-top: 1px solid var(--line); }
.acc details { border-bottom: 1px solid var(--line); }
.acc summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 4px; font-weight: 650; cursor: pointer; list-style: none; }
.acc summary::-webkit-details-marker { display: none; }
.acc summary .icon { width: 20px; height: 20px; color: var(--fg-subtle); transition: transform var(--dur-3) var(--ease); }
.acc details[open] summary .icon { transform: rotate(180deg); color: var(--fg); }
.acc__body { padding: 0 4px 18px; color: var(--fg-muted); line-height: 2; }
.acc details[open] .acc__body { animation: rz-acc-in var(--dur-3) var(--ease); }
@keyframes rz-acc-in { from { opacity: 0; transform: translateY(-4px); } }

.tabs { display: inline-flex; gap: 4px; max-width: 100%; padding: 4px; border-radius: var(--r-pill); background: var(--bg-soft); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 16px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--fg-muted); font-size: var(--fs-sm); font-weight: 650; white-space: nowrap; cursor: pointer; transition: background-color var(--dur-2), color var(--dur-2), box-shadow var(--dur-2); }
.tab .icon { width: 1.05em; height: 1.05em; }
.tab:hover { color: var(--fg); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: var(--sh-1), 0 0 0 1px var(--line); }
.js .tabpanel:not(.is-active) { display: none; }
.js .tabpanel.is-active { animation: rz-tab-in var(--dur-3) var(--ease); }
@keyframes rz-tab-in { from { opacity: 0; transform: translateY(6px); } }

.rail { --rail-item: 248px; display: grid; grid-auto-flow: column; grid-auto-columns: min(var(--rail-item), 78%); gap: 16px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; padding-block: 8px 24px; margin-block-end: -16px; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }
.rail-nav { display: flex; gap: 8px; }
.rail-nav .btn-icon { box-shadow: inset 0 0 0 1px var(--line-strong); }
.rail-nav .btn-icon:disabled { opacity: .35; cursor: default; }

.rail-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; }

/* ============================ فرم ============================ */
.field { display: grid; gap: 6px; }
.field__label { font-size: var(--fs-sm); font-weight: 650; }
.field__hint { color: var(--fg-subtle); font-size: var(--fs-xs); }
.field__error { color: var(--danger); font-size: var(--fs-xs); font-weight: 600; }
.input, .select, .textarea {
  width: 100%;
  min-height: 50px;
  padding: 10px 16px;
  border: 1px solid var(--line-input);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--fg);
  transition: border-color var(--dur-2), box-shadow var(--dur-2);
}
.input::placeholder, .textarea::placeholder { color: var(--fg-subtle); opacity: .85; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--fg-muted); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); outline: none; }
.input[aria-invalid="true"], .input.input-validation-error { border-color: var(--danger); }
.textarea { min-height: 130px; resize: vertical; line-height: 1.9; }
.select {
  appearance: none;
  padding-inline-end: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236C6F76' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 18px;
  background-position: left 16px center;
}
.input--ltr { direction: ltr; text-align: left; }

/* جستجوی کپسولی */
.search-pill { position: relative; display: flex; align-items: center; width: 100%; min-height: 50px; border-radius: var(--r-pill); background: var(--bg-soft); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow var(--dur-2), background-color var(--dur-2); }
.search-pill:focus-within { background: var(--surface); box-shadow: inset 0 0 0 1px var(--brand), 0 0 0 3px var(--brand-soft); }
.search-pill > .icon { position: absolute; inset-inline-start: 18px; color: var(--fg-subtle); pointer-events: none; }
.search-pill input { flex: 1; min-width: 0; height: 50px; padding-inline: 50px 18px; border: 0; background: transparent; outline: none; }
.search-pill input::placeholder { color: var(--fg-subtle); }
.search-pill .btn { margin-inline-end: 5px; min-height: 40px; }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--fs-sm); }
.check input { appearance: none; display: grid; place-items: center; flex: none; width: 20px; height: 20px; margin: 0; border: 1px solid var(--line-input); border-radius: 6px; background: var(--surface); cursor: pointer; transition: background-color var(--dur-1), border-color var(--dur-1); }
.check input[type="radio"] { border-radius: 50%; }
.check input::after { content: ""; width: 9px; height: 5px; border-left: 1.8px solid var(--on-primary); border-bottom: 1.8px solid var(--on-primary); transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform var(--dur-1) var(--ease); }
.check input[type="radio"]::after { width: 8px; height: 8px; border: 0; border-radius: 50%; background: var(--on-primary); transform: scale(0); }
.check input:checked { background: var(--primary); border-color: var(--primary); }
.check input:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.check input[type="radio"]:checked::after { transform: scale(1); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--fs-sm); }
.switch input { appearance: none; position: relative; flex: none; width: 42px; height: 24px; margin: 0; border-radius: var(--r-pill); background: var(--line-strong); cursor: pointer; transition: background-color var(--dur-2); }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--sh-1); transition: transform var(--dur-2) var(--ease); }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(-18px); }
[dir="ltr"] .switch input:checked::after { transform: translateX(18px); }

.qty { display: inline-flex; align-items: center; height: 46px; padding: 4px; border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--surface); }
.qty button { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: var(--fg); transition: background-color var(--dur-2); }
.qty button:hover { background: var(--bg-soft); }
.qty input { width: 44px; border: 0; background: transparent; text-align: center; font-weight: 750; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.qty input::-webkit-inner-spin-button, .qty input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ============================ پیام و اعلان ============================ */
.alert { display: flex; align-items: flex-start; gap: 12px; padding: 14px 18px; border-radius: var(--r); background: var(--brand-soft); color: var(--brand); font-size: var(--fs-sm); line-height: 1.9; }
.alert .icon { margin-top: 3px; }
.alert--success { background: var(--success-bg); color: var(--success); }
.alert--danger { background: var(--danger-bg); color: var(--danger); }
.alert--warning { background: var(--warning-bg); color: var(--warning); }

.toast-region { position: fixed; inset-inline: 0; bottom: calc(20px + var(--tabbar-space, 0px) + env(safe-area-inset-bottom, 0px)); z-index: 300; display: grid; justify-items: center; gap: 8px; padding-inline: 16px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; max-width: min(520px, 100%); padding: 12px 20px 12px 16px; border-radius: var(--r-pill); background: var(--fg); color: var(--bg); font-size: var(--fs-sm); font-weight: 600; box-shadow: var(--sh-3); pointer-events: auto; animation: rz-toast-in var(--dur-3) var(--ease-out); }
.toast .icon { color: inherit; opacity: .8; }
.toast.is-leaving { animation: rz-toast-out var(--dur-2) var(--ease-in) forwards; }
@keyframes rz-toast-in { from { opacity: 0; transform: translateY(16px); } }
@keyframes rz-toast-out { to { opacity: 0; transform: translateY(10px); } }

/* بنر فراخوان (برگه‌ها؛ فاز ۸ بازطراحی می‌کند) */

/* ============================ ناوبری کمکی ============================ */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--fg-subtle); font-size: var(--fs-xs); }
.crumbs a { color: var(--fg-muted); transition: color var(--dur-2); }
.crumbs a:hover { color: var(--fg); }
.crumbs .icon { width: 14px; height: 14px; }
.crumbs [aria-current="page"] { color: var(--fg); font-weight: 650; }

.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.pager a, .pager span { display: grid; place-items: center; min-width: 42px; height: 42px; padding-inline: 10px; border-radius: var(--r-pill); border: 1px solid var(--line); color: var(--fg-muted); font-weight: 650; font-variant-numeric: tabular-nums; transition: border-color var(--dur-2), color var(--dur-2); }
.pager a:hover { border-color: var(--fg-subtle); color: var(--fg); }
.pager [aria-current="page"] { background: var(--primary); border-color: transparent; color: var(--on-primary); }
.pager span.is-disabled { opacity: .4; }

.skeleton { border-radius: var(--r-sm); background: linear-gradient(90deg, var(--bg-soft) 0%, var(--bg-tint) 50%, var(--bg-soft) 100%); background-size: 200% 100%; animation: rz-shimmer 1.4s linear infinite; }

/* نوار شناور مقایسه */
.compare-bar { position: fixed; left: 50%; bottom: calc(20px + var(--tabbar-space, 0px) + env(safe-area-inset-bottom, 0px)); z-index: 95; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: var(--r-pill); background: var(--fg); color: var(--bg); font-size: var(--fs-sm); font-weight: 650; box-shadow: var(--sh-3); transform: translate(-50%, 160%); visibility: hidden; transition: transform var(--dur-3) var(--ease), visibility 0s linear var(--dur-3); }
[dir="rtl"] .compare-bar { padding: 8px 16px 8px 8px; }
.compare-bar.is-visible { transform: translate(-50%, 0); visibility: visible; transition-delay: 0s; }
.compare-bar__icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(127, 127, 127, .25); }
.compare-bar__clear { color: inherit; }
.compare-bar__clear:hover { background: rgba(127, 127, 127, .25); }
[data-compare-toggle][aria-pressed="true"] { color: var(--brand); }

/* ============================ برگه / پنل کناری (دیالوگ) ============================
   موتور کشوی layout.js (data-drawer): موبایل از پایین بالا می‌آید، دسکتاپ پنل کناری از سمت پایان. */
.sheet {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 820px);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: var(--surface);
  box-shadow: var(--sh-3);
  transform: translateY(105%);
  visibility: hidden;
  transition: transform var(--dur-3) var(--ease-out), visibility 0s linear var(--dur-3);
}
.sheet.is-open { transform: none; visibility: visible; transition-delay: 0s; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.sheet__title { display: flex; align-items: center; gap: 8px; font-size: var(--fs-lg); font-weight: 750; }
.sheet__title .icon { color: var(--tone); }
.sheet__body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 18px calc(20px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 1024px) {
  .sheet { top: 0; inset-inline: auto 0; width: min(560px, 92vw); max-height: none; border-radius: 0; transform: translateX(-105%); }
  [dir="ltr"] .sheet { transform: translateX(105%); }
  .sheet.is-open { transform: none; }
}

/* ---------- کارت محصول: قاب، دوخت و «در سبد» ----------
   کارت قاب دارد تا دکمه‌ی + به محصول خودش بچسبد و کارت‌ها از هم جدا خوانده شوند. دو وجه از هویت برند: خط دوخت (چین‌دار) بین
   عکس‌ و قیمت، و رنگ خط محصول (--tone) که روی هاور و حالت «در سبد» قاب را رنگی می‌کند. */
.p-card {
  gap: 8px;
  padding: 8px 8px 10px;
  border: 1px solid var(--line);
  border-radius: calc(var(--r-lg) + 2px);
  background: var(--surface);
  transition: transform var(--dur-2) var(--ease), border-color var(--dur-2), box-shadow var(--dur-2) var(--ease);
}
.p-card__media { border-radius: var(--r); }
.p-card__body, .p-card__foot { padding-inline: 4px; }
.p-card__foot { position: relative; padding-top: 14px; }
.p-card__foot::before {
  content: ""; position: absolute; inset-inline: 4px; top: 0; height: 8px;
  background: color-mix(in srgb, var(--tone) 38%, var(--line));
  -webkit-mask: var(--zz-mask); mask: var(--zz-mask);
  opacity: .8;
}
@media (hover: hover) and (pointer: fine) {
  .p-card:hover { border-color: color-mix(in srgb, var(--tone) 45%, var(--line)); box-shadow: var(--sh-2); }
  .p-card:hover .p-card__media { box-shadow: none; }
}
.p-card.is-in-cart {
  border-color: var(--tone);
  box-shadow: 0 0 0 1px var(--tone), 0 10px 24px -18px var(--tone);
  background: linear-gradient(180deg, color-mix(in srgb, var(--tint) 70%, var(--surface)), var(--surface) 55%);
}
.p-card__incart {
  position: absolute; z-index: 2; inset-inline-start: 8px; bottom: 8px;
  display: inline-flex; align-items: center; gap: 4px; max-width: calc(100% - 16px); padding: 4px 10px 4px 8px;
  border-radius: var(--r-pill); background: var(--primary); color: var(--on-primary);
  font-size: var(--fs-2xs); font-weight: 750; line-height: 1.5; box-shadow: var(--sh-1); pointer-events: none;
  animation: rz-pop var(--dur-3) var(--ease-spring);
}
.p-card__incart[hidden] { display: none; }
.p-card__incart .icon { width: 13px; height: 13px; stroke-width: 2.2; }
@keyframes rz-pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.p-card.is-in-cart .btn-add:not([hidden]) { box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 22%, transparent); }

/* شمارنده‌ی روی کارت: + عدد − (سطل زباله وقتی یک پله به حداقل مانده) */
.p-qty { display: inline-flex; align-items: center; flex: none; height: 38px; padding: 3px; border-radius: var(--r-pill); background: var(--primary); color: var(--on-primary); position: relative; z-index: 2; }
.p-qty[hidden] { display: none; }
.p-qty button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; transition: background-color var(--dur-2), transform var(--dur-1) var(--ease); }
.p-qty button:hover { background: rgba(255, 255, 255, .16); }
.p-qty button:active { transform: scale(.9); }
.p-qty button:disabled { opacity: .4; cursor: not-allowed; }
.p-qty output { min-width: 24px; text-align: center; font-weight: 800; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; line-height: 1; }
.p-qty .p-qty__trash { display: none; }
.p-qty.is-min .p-qty__trash { display: block; }
.p-qty.is-min .p-qty__minus { display: none; }
.p-qty.is-busy { opacity: .6; pointer-events: none; }
@container (max-width: 190px) {
  .p-qty { height: 34px; }
  .p-qty button { width: 28px; height: 28px; }
  .p-qty output { min-width: 18px; }
}

/* چیپ سایزی که همین حالا در سبد است */
.size-chip.is-in-cart, .swatch.is-in-cart { position: relative; box-shadow: inset 0 0 0 1.5px var(--tone, var(--fg)); }
.size-chip.is-in-cart::after, .swatch.is-in-cart::after { content: attr(data-in-cart); position: absolute; top: -6px; inset-inline-end: -4px; min-width: 16px; height: 16px; padding-inline: 4px; border-radius: 8px; background: var(--primary); color: var(--on-primary); font-size: 10px; font-weight: 800; line-height: 16px; text-align: center; }
