/* ==========================================================================
   Arabshop — مكتبة المكوّنات
   أزرار، حقول، بطاقات، شارات، تبويبات، أكورديون، نوافذ، تنبيهات،
   هياكل تحميل، حالات فارغة… كلها تشترك في نفس اللغة البصرية.
   ========================================================================== */

/* ══ الأزرار ═══════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.75rem;
  padding-inline: 1.25rem;
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 700;
  white-space: nowrap;
  text-align: center;
  transition: background-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              box-shadow var(--t-base) var(--ease),
              transform var(--t-fast) var(--ease);
}

.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn--primary {
  background: var(--brand-600);
  color: var(--on-primary);
  box-shadow: var(--shadow-brand);
}
.btn--primary:hover { background: var(--brand-700); }

.btn--secondary {
  background: var(--brand-50);
  color: var(--brand-700);
}
.btn--secondary:hover { background: var(--brand-100); }

.btn--outline {
  background: var(--surface);
  color: var(--ink-800);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.btn--outline:hover { box-shadow: inset 0 0 0 1px var(--brand-500); color: var(--brand-700); }

.btn--ghost { color: var(--ink-700); }
.btn--ghost:hover { background: var(--surface-muted); }

.btn--gold {
  background: var(--gold-500);
  color: var(--ink-900);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) calc(32% * var(--shadow-k)), transparent);
}
.btn--gold:hover { background: var(--gold-600); }

.btn--danger { background: var(--danger); color: var(--on-media); }
.btn--danger:hover { filter: brightness(0.92); }

.btn--on-dark {
  background: color-mix(in srgb, var(--on-media) 14%, transparent);
  color: var(--on-media);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--on-media) 34%, transparent);
  backdrop-filter: blur(6px);
}
.btn--on-dark:hover { background: color-mix(in srgb, var(--on-media) 24%, transparent); }

.btn--xs { height: 2rem;    padding-inline: 0.75rem; font-size: var(--text-xs); border-radius: var(--r-sm); }
.btn--sm { height: 2.375rem; padding-inline: 1rem;   font-size: var(--text-sm); }
.btn--lg { height: 3.25rem; padding-inline: 2rem;   font-size: var(--text-md); border-radius: var(--r-lg); }
.btn--block { width: 100%; }
.btn--pill { border-radius: var(--r-full); }

.btn--icon { width: 2.75rem; padding-inline: 0; }
.btn--icon.btn--sm { width: 2.375rem; }
.btn--icon.btn--xs { width: 2rem; }

/* زر أيقونة دائري خفيف (الهيدر، البطاقات) */
.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--r-md);
  color: var(--ink-700);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.icon-btn:hover { background: var(--surface-muted); color: var(--brand-600); }
.icon-btn--sm { width: 2.25rem; height: 2.25rem; border-radius: var(--r-sm); }

/* ══ الشارات ═══════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1875rem 0.5rem;
  border-radius: var(--r-sm);
  font-size: var(--text-2xs);
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.badge--discount { background: var(--gold-100); color: var(--gold-700); }
.badge--new      { background: var(--brand-100); color: var(--brand-700); }
.badge--hot      { background: var(--danger-50); color: var(--danger); }
.badge--out      { background: var(--surface-sunk); color: var(--ink-500); }
.badge--success  { background: var(--success-50); color: var(--success); }
.badge--warning  { background: var(--warning-50); color: var(--warning-700); }
.cart-line__preorder { align-self: flex-start; white-space: normal; }
.badge--info     { background: var(--info-50); color: var(--info); }
.badge--solid    { background: var(--brand-600); color: var(--on-primary); }

/* عداد صغير فوق أيقونة */
.count-dot {
  position: absolute;
  inset-block-start: 0.25rem;
  inset-inline-end: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.125rem;
  height: 1.125rem;
  padding-inline: 0.25rem;
  border-radius: var(--r-full);
  background: var(--gold-500);
  color: var(--ink-900);
  font-size: var(--text-2xs);
  font-weight: 800;
  line-height: 1;
  unicode-bidi: plaintext;
}

.count-dot--brand { background: var(--brand-600); color: var(--on-primary); }

/* ══ الحقول ════════════════════════════════════════════════════════════ */

.field { display: flex; flex-direction: column; gap: 0.4375rem; }

.field__label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-700);
}

.field__label .req { color: var(--danger); }

.field__hint { font-size: var(--text-xs); color: var(--ink-400); }

.field__error {
  display: flex;
  align-items: center;
  gap: 0.3125rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--danger);
}

.input, .select-native, .textarea {
  width: 100%;
  height: 2.875rem;
  padding-inline: 0.875rem;
  border-radius: var(--r-input);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  font-size: 1rem; /* 16px: لا تكبير تلقائي في iOS عند التركيز */
  color: var(--ink-900);
  transition: box-shadow var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}

.textarea { height: auto; min-height: 7rem; padding-block: 0.75rem; resize: vertical; line-height: var(--leading-normal); }

.input::placeholder, .textarea::placeholder { color: var(--ink-400); }

.input:hover, .select-native:hover, .textarea:hover { box-shadow: inset 0 0 0 1px var(--ink-300); }

.input:focus, .select-native:focus, .textarea:focus {
  outline: none;
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--brand-500), 0 0 0 4px var(--brand-50);
}

.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select-native[aria-invalid="true"] {
  box-shadow: inset 0 0 0 2px var(--danger);
}

.select-native {
  appearance: none;
  padding-inline-end: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235A7183' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.75rem center;
  background-size: 1.125rem;
}

/* حقل بأيقونة داخلية */
.input-group { position: relative; }
.input-group .icon {
  position: absolute;
  inset-inline-start: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-400);
  pointer-events: none;
}
.input-group .input { padding-inline-start: 2.75rem; }
.input-group__action {
  position: absolute;
  inset-inline-end: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-400);
  padding: 0.25rem;
  border-radius: var(--r-xs);
}
.input-group__action:hover { color: var(--ink-800); }
.input-group__action .icon { position: static; transform: none; color: inherit; } /* not the field icon's placement */
.input-group:has(.input-group__action) .input { padding-inline-end: 2.75rem; }

/* اختيار / راديو */
.choice {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  cursor: pointer;
  font-size: var(--text-base);
}

.choice input { flex-shrink: 0; width: 1.125rem; height: 1.125rem; accent-color: var(--brand-600); margin-block-start: 0.125rem; }

/* بطاقة اختيار (طرق الدفع/الشحن) */
.choice-card {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
  cursor: pointer;
  transition: box-shadow var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.choice-card:hover { box-shadow: inset 0 0 0 1px var(--brand-300); }
.choice-card:has(input:checked) { background: var(--brand-50); box-shadow: inset 0 0 0 2px var(--brand-500); }
.choice-card input { accent-color: var(--brand-600); width: 1.125rem; height: 1.125rem; }
.choice-card__body { flex: 1; display: flex; flex-direction: column; gap: 0.125rem; }
.choice-card__title { font-weight: 700; }
.choice-card__meta { font-size: var(--text-xs); color: var(--ink-500); }

/* مفتاح تبديل */
/* المفتاح: حقل الاختيار يغطّي المساحة كاملة (شفافاً) بدل أن يكون بلا أبعاد،
   ليبقى هدفاً حقيقياً للمس ولقارئات الشاشة وأدوات الاختبار. */
.switch { position: relative; display: inline-flex; align-items: center; gap: 0.75rem; cursor: pointer; }
.switch input {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%; margin: 0;
  opacity: 0; cursor: pointer;
}
.switch__track {
  position: relative;
  width: 2.75rem; height: 1.5rem;
  border-radius: var(--r-full);
  background: var(--border-strong);
  transition: background-color var(--t-base) var(--ease);
}
.switch__track::after {
  content: "";
  position: absolute;
  inset-block-start: 3px;
  inset-inline-start: 3px;
  width: 1.125rem; height: 1.125rem;
  border-radius: var(--r-full);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: translate var(--t-base) var(--ease);
}
.switch input:checked + .switch__track { background: var(--brand-600); }
.switch input:checked + .switch__track::after { translate: -1.25rem 0; }
[dir="ltr"] .switch input:checked + .switch__track::after { translate: 1.25rem 0; }
.switch input:focus-visible + .switch__track { outline: 3px solid var(--brand-300); outline-offset: 2px; }

/* ══ البطاقات ══════════════════════════════════════════════════════════ */

.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.card--flat { box-shadow: inset 0 0 0 1px var(--border); }
.card--pad { padding: var(--space-5); }
.card--pad-lg { padding: var(--space-6); }

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-5);
  border-block-end: 1px solid var(--border);
}

.card__title { font-size: var(--text-md); font-weight: 700; }
.card__body { padding: var(--space-5); }

/* ══ بطاقة المنتج ══════════════════════════════════════════════════════ */

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-base) var(--ease), transform var(--t-base) var(--ease-out);
}

.product-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.product-card.is-out { opacity: 0.72; }

.product-card__media {
  position: relative;
  aspect-ratio: 1;
  background: var(--surface-muted);
  overflow: hidden;
}

.product-card__img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--t-slow) var(--ease-out);
}

.product-card:hover .product-card__img { transform: scale(1.06); }
/* second picture: over the first, shown on hover where a mouse is used */
.product-card__img--hover { position: absolute; inset: 0; opacity: 0; transition: opacity var(--t-base) var(--ease); }
@media (hover: hover) {
  .product-card:hover .product-card__img--hover { opacity: 1; }
  /* pointing at a colour chip previews that colour on the main photo: the second photo steps aside */
  .product-card:has(.card-swatch:hover) .product-card__img--hover { opacity: 0; }
}
.quick-view__desc { font-size: var(--text-sm); line-height: var(--leading-normal); }

.product-card__flags {
  position: absolute;
  inset-block-start: 0.625rem;
  inset-inline-start: 0.625rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3125rem;
  z-index: 2;
}

.product-card__fav {
  position: absolute;
  inset-block-start: 0.625rem;
  inset-inline-end: 0.625rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem; height: 2.25rem;
  border-radius: var(--r-full);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--ink-500);
  box-shadow: var(--shadow-xs);
  backdrop-filter: blur(4px);
  transition: color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.product-card__fav:hover { background: var(--surface); color: var(--danger); }
.product-card__fav[aria-pressed="true"] { color: var(--danger); }
.product-card__fav[aria-pressed="true"] .icon { fill: currentColor; }

/* زر عرض سريع يظهر عند المرور */
.product-card__quick {
  position: absolute;
  inset-inline: 0.625rem;
  inset-block-end: 0.625rem;
  z-index: 2;
  opacity: 0;
  translate: 0 0.75rem;
  transition: opacity var(--t-base) var(--ease), translate var(--t-base) var(--ease-out);
}

@media (hover: hover) {
  .product-card:hover .product-card__quick,
  .product-card:focus-within .product-card__quick { opacity: 1; translate: 0 0; }
}
@media (hover: none) { .product-card__quick { display: none; } }

.product-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.4375rem;
  padding: 0.875rem;
}

.product-card__brand { font-size: var(--text-2xs); font-weight: 600; color: var(--brand-600); }

.product-card__title {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.6;
  color: var(--ink-800);
  min-height: calc(2 * 1.6em); /* سطران كاملان: البطاقات تبقى على خط واحد */
}

.product-card__rating { display: flex; align-items: center; gap: 0.3125rem; font-size: var(--text-2xs); color: var(--ink-400); }

/* wrap-reverse: when the old price wraps it goes above, so the current price stays on one line across a row */
.product-card__prices { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap-reverse; margin-block-start: auto; }
.product-card__from { font-size: var(--text-2xs); font-weight: 600; color: var(--ink-500); }
/* Colour chips (UI/Cards/product-card): a 24px tap target around an 18px chip; a hairline ring so white and black
   chips show on any card, light or dark. A sold-out colour is crossed. */
.card-swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 0.125rem; margin-inline: -0.1875rem; }
.card-swatch {
  position: relative; display: grid; place-items: center; width: 1.5rem; height: 1.5rem; padding: 0; border: 0; border-radius: 50%;
  background: transparent; cursor: pointer;
}
.card-swatch::before {
  content: ""; width: 1.125rem; height: 1.125rem; border-radius: 50%; background: var(--sw, var(--line));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 22%, transparent);
}
.card-swatch[aria-pressed="true"]::before, .card-swatch:focus-visible::before { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 22%, transparent), 0 0 0 2px var(--card-bg), 0 0 0 3.5px var(--ink); }
.card-swatch:focus-visible { outline: none; }
.card-swatch.is-out::after {
  content: ""; position: absolute; width: 1.25rem; height: 1.5px; background: var(--ink-500); transform: rotate(-45deg); border-radius: 1px;
}
.card-swatch.is-out::before { opacity: 0.55; }
.card-swatches__more { padding-inline: 0.25rem; font-size: var(--text-2xs); font-weight: 600; color: var(--ink-500); }
.card-swatches__more:hover { color: var(--ink); }
.product-card__hint { font-size: var(--text-2xs); color: var(--ink-500); }
.card-swatches .only-narrow { display: none; }
@media (max-width: 599px) {
  .card-swatches .card-swatch:nth-of-type(n+5) { display: none; }
  .card-swatches .not-narrow { display: none; }
  .card-swatches .only-narrow { display: inline; }
}
/* A colour chosen on the card: its photo stays, the second-photo hover is off. */
.product-card.is-swatched .product-card__img--hover { display: none; }
.product-card__prices .price { font-size: var(--text-md); }

.product-card__foot { display: flex; align-items: center; gap: 0.5rem; padding: 0 0.875rem 0.875rem; }
.product-card__foot .btn { flex: 1; }

/* شريط منتجات أفقي قابل للتمرير على الجوال */
.product-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(11rem, 1fr);
  gap: var(--space-4);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-block-end: var(--space-2);
  margin-inline: calc(var(--gutter) * -1);
  padding-inline: var(--gutter);
  scrollbar-width: none;
}
.product-rail::-webkit-scrollbar { display: none; }
.product-rail > * { scroll-snap-align: start; }

@media (min-width: 768px) {
  .product-rail { grid-auto-columns: minmax(13rem, 1fr); }
}
/* A rail with one or two products keeps normal card widths instead of stretching them across the page. */
.product-rail:not(:has(> :nth-child(3))) { grid-auto-columns: minmax(11rem, 18rem); }

/* شبكة المنتجات */
.product-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 640px)  { .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.product-grid--5 { }
@media (min-width: 1280px) { .product-grid--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* ══ التقييم بالنجوم ═══════════════════════════════════════════════════ */

.stars { position: relative; display: inline-flex; align-items: center; }
.stars__row, .stars__fill { display: inline-flex; gap: 1px; }
/* the gold row is clipped from the start side (right in Arabic) to the rating */
.stars__fill { position: absolute; inset-block: 0; inset-inline-start: 0; align-items: center; overflow: hidden; white-space: nowrap; }
.stars .icon { width: 0.8125rem; height: 0.8125rem; fill: var(--border-strong); color: var(--border-strong); }
.stars .icon.is-on { fill: var(--gold-500); color: var(--gold-500); }
.stars--lg .icon { width: 1.125rem; height: 1.125rem; }

/* ══ بطاقة الفئة ═══════════════════════════════════════════════════════ */

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.625rem;
  padding: var(--space-4) var(--space-2);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  text-align: center;
  transition: box-shadow var(--t-base) var(--ease), transform var(--t-base) var(--ease-out);
}

.category-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }

.category-card__media {
  width: 4.5rem; height: 4.5rem;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--brand-50);
}

.category-card__media img { width: 100%; height: 100%; object-fit: cover; }

.category-card__name { font-size: var(--text-sm); font-weight: 700; color: var(--ink-800); }
.category-card__count { font-size: var(--text-2xs); color: var(--ink-400); }

@media (min-width: 768px) {
  .category-card__media { width: 5.5rem; height: 5.5rem; }
}

/* ══ التبويبات ═════════════════════════════════════════════════════════ */

.tabs { border-block-end: 1px solid var(--border); }
.tabs__list { display: flex; gap: var(--space-1); overflow-x: auto; scrollbar-width: none; }
.tabs__list::-webkit-scrollbar { display: none; }

.tabs__tab {
  position: relative;
  padding: 0.875rem 1rem;
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--ink-500);
  white-space: nowrap;
  transition: color var(--t-fast) var(--ease);
}
.tabs__tab:hover { color: var(--ink-800); }
.tabs__tab[aria-selected="true"] { color: var(--brand-600); }
.tabs__tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset-inline: 0.5rem;
  inset-block-end: -1px;
  height: 3px;
  border-radius: var(--r-full) var(--r-full) 0 0;
  background: var(--brand-600);
}

.tabs__panel { padding-block-start: var(--space-5); }

/* ══ الأكورديون ════════════════════════════════════════════════════════ */

.accordion { display: flex; flex-direction: column; gap: var(--space-3); }

.accordion__item {
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
  overflow: hidden;
}

.accordion__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  padding: 1rem 1.125rem;
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--ink-800);
  text-align: start;
}

.accordion__trigger .icon { transition: rotate var(--t-base) var(--ease); color: var(--ink-400); }
.accordion__trigger[aria-expanded="true"] { color: var(--brand-600); }
.accordion__trigger[aria-expanded="true"] .icon { rotate: 180deg; color: var(--brand-600); }

.accordion__panel { padding: 0 1.125rem 1.125rem; color: var(--ink-500); line-height: var(--leading-normal); }

/* ══ فتات الخبز ════════════════════════════════════════════════════════ */

.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 0.375rem; font-size: var(--text-xs); color: var(--ink-400); }
.breadcrumb a { color: var(--ink-500); transition: color var(--t-fast) var(--ease); }
.breadcrumb a:hover { color: var(--brand-600); }
.breadcrumb__sep { color: var(--ink-300); }
.breadcrumb [aria-current="page"] { color: var(--ink-800); font-weight: 600; }

/* ══ الترقيم ═══════════════════════════════════════════════════════════ */

.pagination { display: flex; align-items: center; justify-content: center; gap: 0.375rem; }

.pagination__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding-inline: 0.625rem;
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink-700);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
a.pagination__btn:hover { box-shadow: inset 0 0 0 1px var(--brand-400); color: var(--brand-700); }
.pagination__btn[aria-current="page"] { background: var(--brand-600); color: var(--on-primary); box-shadow: none; }
.pagination__btn:disabled, .pagination__btn[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; }
.pagination__gap { display: flex; align-items: center; padding-inline: 0.25rem; color: var(--ink-300); }

/* ══ الطبقة والنوافذ والأدراج ══════════════════════════════════════════ */

.overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: color-mix(in srgb, var(--shadow-color) 48%, transparent);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity var(--t-base) var(--ease);
}
.overlay[data-open="true"] { opacity: 1; }

body.is-locked { overflow: hidden; }

/* درج جانبي */
.drawer {
  position: fixed;
  inset-block: 0;
  inset-inline-end: 0;
  z-index: var(--z-panel);
  display: flex;
  flex-direction: column;
  width: min(26rem, 100vw);
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  translate: 100% 0;
  transition: translate var(--t-slow) var(--ease-out);
}
[dir="rtl"] .drawer { translate: -100% 0; }

.drawer--start { inset-inline-end: auto; inset-inline-start: 0; translate: -100% 0; }
[dir="rtl"] .drawer--start { translate: 100% 0; }

.drawer[data-open="true"] { translate: 0 0; }

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-block-end: 1px solid var(--border);
}
.drawer__title { font-size: var(--text-md); font-weight: 800; }
.drawer__body { flex: 1; overflow-y: auto; padding: var(--space-4) var(--space-5); }
.drawer__foot { padding: var(--space-4) var(--space-5); border-block-start: 1px solid var(--border); background: var(--surface); }

/* نافذة منبثقة */
.modal {
  position: fixed;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  z-index: var(--z-panel);
  width: min(34rem, calc(100vw - 2rem));
  max-height: calc(100vh - 3rem);
  display: flex;
  flex-direction: column;
  translate: 50% -50%;
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  opacity: 0;
  scale: 0.97;
  transition: opacity var(--t-base) var(--ease), scale var(--t-base) var(--ease-out);
}
[dir="ltr"] .modal { translate: -50% -50%; }
.modal[data-open="true"] { opacity: 1; scale: 1; }
.modal--wide { width: min(56rem, calc(100vw - 2rem)); }

.modal__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-5); border-block-end: 1px solid var(--border);
}
.modal__title { font-size: var(--text-lg); font-weight: 800; }
.modal__body { flex: 1; overflow-y: auto; padding: var(--space-5); }
.modal__foot { display: flex; gap: var(--space-3); padding: var(--space-5); border-block-start: 1px solid var(--border); }
.modal__foot .btn { flex: 1; }

/* ══ التنبيهات المنبثقة ════════════════════════════════════════════════ */

.toaster {
  position: fixed;
  inset-block-end: var(--space-5);
  inset-inline-start: var(--space-5);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 17rem;
  max-width: min(24rem, calc(100vw - 2rem));
  padding: 0.875rem 1rem;
  border-radius: var(--r-md);
  background: var(--scheme-dark-bg);
  color: var(--scheme-dark-text);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 600;
  pointer-events: auto;
  animation: toast-in var(--t-slow) var(--ease-out);
}

.toast--success .icon { color: color-mix(in srgb, var(--success) 50%, var(--scheme-dark-text)); }
.toast--error   .icon { color: color-mix(in srgb, var(--danger) 50%, var(--scheme-dark-text)); }
.toast--info    .icon { color: var(--brand-300); }
.toast__close { margin-inline-start: auto; opacity: 0.65; }
.toast__close:hover { opacity: 1; }
.toast.is-leaving { animation: toast-out var(--t-base) var(--ease) forwards; }

@keyframes toast-in  { from { opacity: 0; translate: 0 1rem; } to { opacity: 1; translate: 0 0; } }
@keyframes toast-out { to { opacity: 0; translate: 0 0.5rem; } }

/* ══ التلميحات ═════════════════════════════════════════════════════════ */

.tooltip { position: relative; }
.tooltip::after {
  content: attr(data-tip);
  position: absolute;
  inset-block-end: calc(100% + 0.5rem);
  inset-inline-start: 50%;
  translate: 50% 0;
  padding: 0.375rem 0.625rem;
  border-radius: var(--r-sm);
  background: var(--scheme-dark-bg);
  color: var(--scheme-dark-text);
  font-size: var(--text-2xs);
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-fast) var(--ease);
}
[dir="ltr"] .tooltip::after { translate: -50% 0; }
.tooltip:hover::after, .tooltip:focus-visible::after { opacity: 1; }

/* ══ القوائم المنسدلة ══════════════════════════════════════════════════ */

.menu {
  position: absolute;
  inset-block-start: calc(100% + 0.5rem);
  inset-inline-end: 0;
  z-index: var(--z-sticky);
  min-width: 12rem;
  padding: 0.375rem;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--border);
}

.menu__item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.625rem 0.75rem;
  border-radius: var(--r-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-700);
  text-align: start;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.menu__item:hover { background: var(--surface-muted); color: var(--brand-700); }
.menu__item[aria-selected="true"] { background: var(--brand-50); color: var(--brand-700); }
.menu__sep { height: 1px; margin: 0.375rem 0.25rem; background: var(--border); }

/* ══ هياكل التحميل ═════════════════════════════════════════════════════ */

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--surface-sunk);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 65%, transparent), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer { from { translate: -100% 0; } to { translate: 100% 0; } }

.skeleton--text { height: 0.75rem; border-radius: var(--r-full); }
.skeleton--title { height: 1.25rem; border-radius: var(--r-full); }
.skeleton--media { aspect-ratio: 1; border-radius: var(--r-lg); }
.skeleton--btn { height: 2.5rem; border-radius: var(--r-md); }

/* ══ الحالات الفارغة والأخطاء ══════════════════════════════════════════ */

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-16) var(--space-4);
  text-align: center;
}

.state__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5rem; height: 5rem;
  border-radius: var(--r-2xl);
  background: var(--brand-50);
  color: var(--brand-500);
}

.state__icon--warn { background: var(--warning-50); color: var(--warning); }
.state__icon--error { background: var(--danger-50); color: var(--danger); }

.state__title { font-size: var(--text-xl); }
.state__body { max-width: 30rem; color: var(--ink-500); line-height: var(--leading-normal); }

/* ══ التنبيهات الثابتة ═════════════════════════════════════════════════ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
}
.alert--success { background: var(--success-50); color: var(--success); }
.alert--warning { background: var(--warning-50); color: var(--warning-700); }
.alert--danger  { background: var(--danger-50);  color: var(--danger); }
.alert--info    { background: var(--info-50);    color: var(--info); }

/* ══ شريط الخطوات ══════════════════════════════════════════════════════ */

.steps { display: flex; align-items: center; gap: 0.5rem; }

.step { display: flex; align-items: center; gap: 0.5rem; flex: 1; }
.step:last-child { flex: 0; }

.step__dot {
  display: flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem;
  flex-shrink: 0;
  border-radius: var(--r-full);
  background: var(--surface-sunk);
  color: var(--ink-400);
  font-size: var(--text-sm);
  font-weight: 800;
  unicode-bidi: plaintext;
}
.step__label { font-size: var(--text-xs); font-weight: 700; color: var(--ink-400); white-space: nowrap; }
.step__line { flex: 1; height: 2px; border-radius: var(--r-full); background: var(--border); }

.step.is-active .step__dot { background: var(--brand-600); color: var(--on-primary); }
.step.is-active .step__label { color: var(--ink-900); }
.step.is-done .step__dot { background: var(--brand-100); color: var(--brand-700); }
.step.is-done .step__label { color: var(--ink-600); }
.step.is-done .step__line { background: var(--brand-300); }

@media (max-width: 767px) {
  .step__label { display: none; }
  .step.is-active .step__label { display: block; }
}

/* ══ عناصر متنوعة ══════════════════════════════════════════════════════ */

/* محدّد الكمية */
.qty {
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  overflow: hidden;
}
.qty__btn {
  display: flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem;
  color: var(--ink-700);
  transition: background-color var(--t-fast) var(--ease);
}
.qty__btn:hover:not(:disabled) { background: var(--surface-muted); color: var(--brand-600); }
.qty__btn:disabled { opacity: 0.35; }
.qty__value { min-width: 2.5rem; text-align: center; font-weight: 700; unicode-bidi: plaintext; }
.qty--lg .qty__btn { width: 2.75rem; height: 2.75rem; }

/* رقاقة فلتر / وسم */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--r-full);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-700);
  transition: all var(--t-fast) var(--ease);
}
.chip:hover { box-shadow: inset 0 0 0 1px var(--brand-400); color: var(--brand-700); }
.chip.is-active, .chip[aria-pressed="true"] {
  background: var(--brand-600); color: var(--on-primary); box-shadow: none;
}
.chip--removable .icon { opacity: 0.7; }

/* صورة رمزية */
.avatar {
  display: flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem;
  border-radius: var(--r-full);
  background: var(--brand-100);
  color: var(--brand-700);
  font-weight: 800;
  flex-shrink: 0;
}
.avatar--lg { width: 3.5rem; height: 3.5rem; font-size: var(--text-lg); }

/* شريط تقدّم */
.progress { height: 0.5rem; border-radius: var(--r-full); background: var(--surface-sunk); overflow: hidden; }
.progress__bar { height: 100%; border-radius: var(--r-full); background: var(--brand-500); transition: width var(--t-slow) var(--ease); }
.progress__bar--gold { background: var(--gold-500); }

/* Product card add-to-cart form (server form, enhanced by theme.js): keep the footer layout as before. */
.product-card__form { display: contents; }

/* Card add-to-cart: brief confirmation after an in-place add. */
.product-card__form .is-added { opacity: .75; }

/* البريد والهاتف وكلمة المرور تُكتب بحروف لاتينية: من اليسار داخل الصفحة العربية */
[dir="rtl"] .input:is([type="email"], [type="tel"], [type="password"], [type="url"]) { direction: ltr; text-align: end; }
/* سهم القائمة المنسدلة في جهة النهاية في الاتجاهين */
[dir="ltr"] .select-native { background-position: right 0.75rem center; }

/* ── زر ينتظر الشبكة: مؤشر دوّار بدل النص (aria-busy يُعلن الحالة) ── */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 1.1em; height: 1.1em;
  border: 2px solid currentColor; border-color: var(--on-primary) var(--on-primary) transparent transparent;
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
.btn--outline.is-loading::after, .btn--ghost.is-loading::after { border-color: var(--brand-600) var(--brand-600) transparent transparent; }

/* ── رابط داخل الرسالة المنبثقة («عرض السلة») ── */
.toast__action { margin-inline-start: auto; padding-inline-start: var(--space-3); color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }

/* ── الكمية بحجم صغير (السلة المصغّرة) ── */
.qty--sm .qty__btn { width: 2rem; height: 2rem; }
.cart-lines--mini .cart-line { padding-block: var(--space-3); }
.cart-lines--mini[aria-busy="true"] { opacity: 0.6; pointer-events: none; }

/* ── شكل البطاقات ونسبة الصورة من الإعدادات (data-* على <body>) ── */
[data-card-style="border"] .product-card { box-shadow: none; border: 1px solid var(--border); }
[data-card-style="border"] .product-card:hover { box-shadow: none; border-color: var(--border-strong); }
[data-card-style="flat"] .product-card, [data-card-style="flat"] .product-card:hover { box-shadow: none; transform: none; }
[data-card-ratio="portrait"] .product-card__media { aspect-ratio: 3 / 4; }
[data-card-ratio="landscape"] .product-card__media { aspect-ratio: 4 / 3; }

/* ── زر فوق الصورة بلون السطح (العرض السريع) ── */
.btn--on-surface { background: color-mix(in srgb, var(--surface) 94%, transparent); color: var(--ink-900); box-shadow: var(--shadow-sm); }
.btn--on-surface:hover { background: var(--surface); color: var(--brand-600); }

/* ── العرض السريع ── */
.quick-view__grid { display: grid; gap: var(--space-5); }
@media (min-width: 720px) { .quick-view__grid { grid-template-columns: 1fr 1fr; } }
.quick-view__img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: var(--r-lg); background: var(--surface-muted); }
.quick-view__thumbs { display: flex; gap: var(--space-2); margin-block-start: var(--space-2); overflow-x: auto; }
.quick-view__thumbs button { flex: none; width: 3.5rem; height: 3.5rem; border-radius: var(--r-sm); overflow: hidden; box-shadow: inset 0 0 0 1px var(--border); }
.quick-view__thumbs button[aria-current="true"] { box-shadow: inset 0 0 0 2px var(--brand-600); }
/* The tax line goes with the price: none while loading or for a combination that does not exist. */
.quick-view__info .stack:has(> .row [data-qv-price]:empty) > .pdp__vat { display: none; }
.quick-view__thumbs img { width: 100%; height: 100%; object-fit: cover; }

/* ── أكورديون بعنصر <details> الأصلي (الأسئلة الشائعة: يعمل بلا JS) ── */
summary.accordion__trigger { list-style: none; cursor: pointer; }
summary.accordion__trigger::-webkit-details-marker { display: none; }
details[open] > .accordion__trigger { color: var(--brand-600); }
details[open] > .accordion__trigger .icon { rotate: 180deg; color: var(--brand-600); }

/* ── بطاقة هيكلية أثناء تحميل المفضلة ── */
.skeleton-card { display: flex; flex-direction: column; gap: var(--space-3); padding-block-end: var(--space-4); }
.skeleton--short { width: 55%; }

/* ── زر ينتظر صفحة الدفع: مؤشر دوّار مع نص «جارٍ تجهيز الدفع…» ── */
.btn.is-pending { pointer-events: none; cursor: progress; }
.btn.is-pending::before {
  content: ""; flex: none; width: 1em; height: 1em; border-radius: 50%;
  border: 2px solid currentColor; border-inline-end-color: transparent; border-block-end-color: transparent;
  animation: spin 0.8s linear infinite;
}

/* ── أعمدة شبكة المنتجات من إعدادات القسم (--cols / --cols-m) ── */
.product-grid { grid-template-columns: repeat(var(--cols-m, 2), minmax(0, 1fr)); }
@media (min-width: 640px)  { .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .product-grid { grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); } }

/* "Product photo background" = "light": cards and quick view get the same soft light panel as the product page, also
   in dark mode (photos shot on white then don't show as white boxes on a dark card). */
[data-photo-bg="light"] { --photo-light: color-mix(in srgb, var(--ink) 3.5%, var(--card-bg)); }
:root[data-mode="dark"] [data-photo-bg="light"] { --photo-light: color-mix(in srgb, var(--ink) 90%, var(--bg)); }
[data-photo-bg="light"] .product-card__media, [data-photo-bg="light"] .quick-view__img, [data-photo-bg="light"] .bundle-item__media { background: var(--photo-light); }

/* ══ Custom HTML (sections/custom-html; docs/CUSTOM_HTML.md) ═══════════════════════════════════════════════════
   The HTML arrives cleaned (no scripts, styles or style attributes). Containment: a fixed or absolute element
   inside (e.g. a theme class reused there) stays inside this box and can't cover the page or the order form. */
.custom-html { position: relative; contain: layout paint; isolation: isolate; overflow: hidden; overflow-wrap: anywhere; }
.custom-html img { max-width: 100%; height: auto; }
.custom-html :is(h1, h2, h3) { font-family: var(--font-display); line-height: 1.25; }
/* text takes the colour around it (the section, or the HTML's own CSS on a parent), as authors expect */
.custom-html :is(h1, h2, h3, h4, h5, h6, p, li, blockquote, figcaption) { color: inherit; }
.custom-html :is(p, ul, ol, table, figure) + :is(p, ul, ol, table, figure, h2, h3) { margin-block-start: var(--space-3); }
.custom-html ul, .custom-html ol { padding-inline-start: 1.25rem; }
.custom-html ul { list-style: disc; } .custom-html ol { list-style: decimal; }
.custom-html table { width: 100%; border-collapse: collapse; }
.custom-html :is(th, td) { padding: 0.5rem 0.75rem; border-block-end: 1px solid var(--line); text-align: start; }
/* utilities (ch-*): layout */
.ch-stack { display: grid; gap: var(--space-4); }
.ch-row { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: center; }
.ch-center { text-align: center; } .ch-row.ch-center { justify-content: center; }
.ch-stack > :is(.ch-badge, .ch-btn, img) { justify-self: start; }
.ch-stack.ch-center > :is(.ch-badge, .ch-btn, img) { justify-self: center; }
.ch-grid-2, .ch-grid-3, .ch-grid-4 { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 640px) { .ch-grid-2, .ch-grid-3, .ch-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .ch-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .ch-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ch-narrow { max-width: 42rem; margin-inline: auto; }
/* text */
.ch-title { font-family: var(--font-display); font-size: var(--text-3xl); font-weight: 800; line-height: 1.2; }
.ch-subtitle { font-size: var(--text-xl); font-weight: 700; }
.ch-lead { font-size: var(--text-lg); line-height: var(--leading-normal); }
.ch-muted { color: var(--muted); }
.ch-small { font-size: var(--text-sm); }
.ch-primary { color: var(--primary); }
.ch-sale { color: var(--sale); }
/* boxes */
.ch-card { padding: var(--space-5); border-radius: var(--card-radius); background: var(--card-bg); box-shadow: inset 0 0 0 1px var(--line); }
.ch-soft { padding: var(--space-5); border-radius: var(--card-radius); background: color-mix(in srgb, var(--primary) 8%, var(--bg)); }
.ch-badge { display: inline-flex; align-items: center; padding: 0.2rem 0.65rem; border-radius: 999px; font-size: var(--text-xs); font-weight: 700; background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }
.ch-divider { border: 0; border-block-start: 1px solid var(--line); margin-block: var(--space-5); }
/* links as buttons (in-page anchors such as href="#buy", or other pages) */
.ch-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 2.75rem; padding: 0 1.25rem; border-radius: var(--btn-radius); background: var(--primary); color: var(--on-primary); font-weight: 700; text-decoration: none; }
.ch-btn--outline { background: transparent; color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--primary); }
/* images */
.ch-img-round { border-radius: var(--card-radius); }
.ch-img-circle { border-radius: 50%; aspect-ratio: 1; object-fit: cover; }
.ch-img-full { width: 100%; }

/* ══ Option chips (UI/option-chips, quick view): colours as round chips, other values as buttons ══════════════════ */
.opt-group { border: 0; padding: 0; margin: 0; min-width: 0; }
.opt-group > legend { padding: 0; margin-block-end: var(--space-2); }
.opt-group__chosen { font-weight: 500; color: var(--ink-500); }
.opt-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.opt-chip { position: relative; display: inline-flex; cursor: pointer; }
.opt-chip__text {
  display: inline-flex; align-items: center; justify-content: center; min-width: 2.75rem; min-height: 2.5rem; padding: 0.375rem 0.875rem;
  border: 1px solid var(--line); border-radius: var(--btn-radius); background: var(--card-bg); color: var(--ink);
  font-size: var(--text-sm); font-weight: 600; transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.opt-chip:hover .opt-chip__text { border-color: var(--ink-500); }
.opt-chip input:checked + .opt-chip__text { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.opt-chip input:focus-visible + .opt-chip__text, .opt-chip input:focus-visible + .opt-chip__dot { outline: 2px solid var(--primary); outline-offset: 2px; }
.opt-chip.is-out .opt-chip__text { color: var(--ink-500); text-decoration: line-through; border-style: dashed; }
.opt-chip__dot {
  display: block; width: 2.75rem; height: 2.75rem; border-radius: 50%; background: var(--sw, var(--line));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 22%, transparent);
}
.opt-chip input:checked + .opt-chip__dot { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 22%, transparent), 0 0 0 3px var(--card-bg), 0 0 0 5px var(--ink); }
.opt-chip--colour.is-out .opt-chip__dot { opacity: 0.5; }
.opt-chip--colour.is-out::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 2.5rem; height: 2px;
  background: var(--ink-500); transform: translate(-50%, -50%) rotate(-45deg); border-radius: 1px; pointer-events: none;
}

/* ══ Bundle contents (UI/bundle-items; quick view builds the same) ═════════════════════════════════════════════ */
.bundle-items { display: grid; gap: var(--space-2); margin-block: var(--space-3); }
.bundle-items__title { font-size: var(--text-sm); font-weight: 700; color: var(--ink); }
.bundle-items__notice { display: flex; align-items: center; gap: 0.375rem; font-size: var(--text-xs); color: var(--warning-700); }
.bundle-items__list { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.bundle-item__link {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem; border: 1px solid var(--line); border-radius: var(--card-radius);
  background: var(--card-bg); color: var(--ink); text-decoration: none; transition: border-color var(--t-fast) var(--ease);
}
.bundle-item__link:hover { border-color: var(--ink-500); }
.bundle-item__media { flex: none; width: 3.5rem; height: 3.5rem; border-radius: calc(var(--card-radius) * 0.6); overflow: hidden; background: var(--surface-muted); }
.bundle-item__media img { display: block; width: 100%; height: 100%; object-fit: contain; }
.bundle-item__text { display: grid; gap: 0.125rem; min-width: 0; flex: 1; }
.bundle-item__name { font-size: var(--text-sm); font-weight: 600; }
.bundle-item__variant { font-size: var(--text-2xs); color: var(--ink-500); }
.bundle-item__out { font-size: var(--text-2xs); font-weight: 600; color: var(--danger); }
.bundle-item__qty { flex: none; direction: ltr; unicode-bidi: isolate; padding: 0.125rem 0.5rem; border-radius: 999px; background: color-mix(in srgb, var(--ink) 8%, transparent); font-size: var(--text-xs); font-weight: 700; }
.bundle-item.is-out .bundle-item__media, .bundle-item.is-out .bundle-item__name { opacity: 0.6; }
.bundle-items--short .bundle-item__media { width: 2.5rem; height: 2.5rem; }
.bundle-items__more { font-size: var(--text-xs); font-weight: 600; }

/* A bundle's contents on its card (UI/bundle-peek): item pictures in a row, and/or «يحتوي: …» */
.bundle-peek { display: flex; flex-direction: column; gap: 0.375rem; }
.bundle-peek__thumbs { display: flex; flex-wrap: wrap; gap: 0.375rem; margin: 0; padding: 0; list-style: none; }
.bundle-peek__thumb, .bundle-peek__more {
  position: relative; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; flex: none;
  border-radius: var(--r-sm); background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line);
}
.bundle-peek__thumb img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.bundle-peek__initial { font-weight: 700; color: var(--ink-500); }
.bundle-peek__qty {
  position: absolute; inset-block-end: -0.25rem; inset-inline-end: -0.25rem; padding: 0 0.25rem; border-radius: var(--r-full);
  background: var(--ink); color: var(--bg); font-size: 0.625rem; font-weight: 700; line-height: 1.4; direction: ltr; unicode-bidi: isolate;
}
.bundle-peek__more { font-size: var(--text-xs); font-weight: 700; color: var(--ink-500); }
.bundle-peek__names { margin: 0; font-size: var(--text-2xs); color: var(--ink-500); }
/* phones: at most 3 pictures, each width with its own «+N» (like the colour chips) */
.bundle-peek .only-narrow { display: none; }
@media (max-width: 599px) {
  .bundle-peek__thumb:nth-child(4) { display: none; }
  .bundle-peek__thumbs { flex-wrap: nowrap; gap: 0.25rem; }
  .bundle-peek__thumb, .bundle-peek__more { width: 2rem; height: 2rem; }
  .bundle-peek .not-narrow { display: none; }
  .bundle-peek .only-narrow { display: grid; }
}

/* A bundle line's contents in the cart (UI/cart-bundle, drawer and page): compact chips that wrap */
.cart-bundle { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.375rem; font-size: var(--text-2xs); color: var(--ink-500); }
.cart-bundle__label { font-weight: 700; }
.cart-bundle__list { display: contents; margin: 0; padding: 0; list-style: none; }
.cart-bundle__item { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.125rem 0.375rem 0.125rem 0.125rem; border-radius: var(--r-full); background: var(--surface-sunk); }
.cart-bundle__thumb { width: 1.5rem; height: 1.5rem; border-radius: var(--r-full); object-fit: contain; background: var(--surface); }
.cart-bundle__name { color: var(--ink-700); max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-bundle__var { color: var(--ink-500); max-width: 7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-bundle__qty { font-weight: 700; direction: ltr; unicode-bidi: isolate; }
.cart-bundle__pre { font-size: 0.625rem; padding: 0 0.375rem; }
