/* ============================================================
   الشافعي المتميز — واجهة المتجر (M2)
   Mobile-First: صنع للجوال أولاً ثم تُضاف تحسينات الشاشات الأكبر.
   طابع: فاتح دافئ، فاخر، ذهبي (M14 — عاجي/كريمي بدل الداكن).
   جميع الألوان قابلة للتعديل من متغيرات CSS فقط.
   ============================================================ */

:root {
  /* M14 — ألوان الخلفية الفاتحة الدافئة (عاجي/كريمي) مع بقاء الهوية الذهبية.
     عاجي دافئ غير أبيض قاسٍ: نصوص داكنة، أسطح كريمية، وذهبي ساطع للعبوات
     (أزرار/شارات/خطوط) وذهبي-حبر مقروء للنصوص التي تحتاج تبايناً. */
  --color-background: #faf3e3;
  --color-surface: #f5edda;
  --color-surface-raised: #eee3ca;
  --color-gold: #f2b90d;
  --color-gold-deep: #8a6500;
  /* ذهبي-حبر مخصص لنصوص الذهب على الخلفية الفاتحة (نفس القيمة، تسمية واضحة) */
  --color-gold-ink: #8a6500;
  --color-text: #33291b;
  --color-muted: #6d5d43;
  --color-border: rgba(138, 101, 0, 0.3);
  --color-whatsapp: #25d366;
  --color-danger: #c23a32;

  /* إضاءة ذهبية ناعمة (M7) — مبنية على لون الهوية الذهبي */
  --glow-gold: rgba(242, 185, 13, 0.3);
  --glow-gold-soft: rgba(242, 185, 13, 0.15);
  --glow-gold-faint: rgba(242, 185, 13, 0.07);

  /* الخطوط */
  --font-arabic: "Amiri", serif;
  --font-body: "Almarai", "Tajawal", "Plus Jakarta Sans", sans-serif;

  /* أبعاد */
  --radius-sm: 0.5rem;
  --radius: 0.75rem;
  --radius-lg: 1.25rem;
  --max-width: 1200px;
  --header-h: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* خلفية "مسرح المنتج": إضاءة دافئة فاتحة خلف صور المنتجات لتصبح الصورة هي البطل
     حتى مع الصور العمودية (fit-contain) دون قصّ. */
  --stage-bg: radial-gradient(120% 95% at 50% 10%, #fdf8ec 0%, #f0e6cb 78%);
}

/* ---------- أساسيات ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--color-background);
  background-image: radial-gradient(1000px 540px at 50% -8%, rgba(242, 185, 13, 0.08), transparent 62%);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  isolation: isolate;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.ltr {
  direction: ltr;
  unicode-bidi: embed;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 1rem;
}

:focus-visible {
  /* M18 — حلقة تركيز بتباين كافٍ على الخلفية العاجية (#8a6500 بدل الذهبي الفاتح). */
  outline: 2px solid var(--color-gold-deep);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: var(--color-gold);
  color: #33291b;
}

/* ---------- الهيدر ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--color-background);
  background: color-mix(in srgb, var(--color-background) 86%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  transition: background 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.header-inner {
  position: relative;
  max-width: var(--max-width);
  margin-inline: auto;
  height: 100%;
  padding-inline: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex: none;
}

.brand-name {
  font-family: var(--font-arabic);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-gold-ink);
  line-height: 1.2;
  white-space: nowrap;
}

.brand-sub {
  display: none;
  font-family: var(--font-body);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* التنقل */
.site-nav {
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  position: absolute;
  top: calc(100% + 1px);
  inset-inline: 0;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0.5rem 1rem 0.9rem;
  box-shadow: 0 18px 30px rgba(122, 92, 33, 0.18);
}

.site-nav a {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-muted);
  padding: 0.7rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

.site-nav a:hover {
  color: var(--color-gold-ink);
}

.site-nav a.is-active {
  color: var(--color-gold-ink);
  background: rgba(242, 185, 13, 0.08);
}

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

.lang-toggle,
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-gold-ink);
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}

.lang-toggle {
  min-width: 52px;
  padding-inline: 0.9rem;
  font-weight: 700;
  font-size: 0.85rem;
}

.lang-toggle:hover,
.nav-toggle:hover {
  background: var(--color-surface-raised);
}

.lang-toggle:active,
.nav-toggle:active {
  transform: scale(0.96);
}

.nav-toggle {
  width: 44px;
}

.nav-toggle-icon {
  position: relative;
  width: 20px;
  height: 2px;
  background: var(--color-gold);
  transition: background 0.2s var(--ease);
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  background: var(--color-gold);
  transition: transform 0.25s var(--ease), top 0.25s var(--ease);
}

.nav-toggle-icon::before { top: -6px; }
.nav-toggle-icon::after { top: 6px; }

.nav-open .nav-toggle-icon { background: transparent; }
.nav-open .nav-toggle-icon::before { top: 0; transform: rotate(45deg); }
.nav-open .nav-toggle-icon::after { top: 0; transform: rotate(-45deg); }

.nav-open .site-nav {
  display: flex;
  animation: navIn 0.25s var(--ease) both;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  isolation: isolate;
  min-height: min(78vh, 620px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(120% 110% at 50% 32%, rgba(20, 16, 11, 0) 52%, rgba(20, 16, 11, 0.42) 100%),
    linear-gradient(180deg, rgba(20, 16, 11, 0.28) 0%, rgba(20, 16, 11, 0.4) 46%, var(--color-background) 100%);
}

/* دفء الجمر الصاعد من الأسفل (M7) — إضاءة ذهبية خافتة خلف محتوى الـHero */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(58% 52% at 50% 100%, rgba(242, 185, 13, 0.1), transparent 72%);
}

.hero-content {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding: calc(var(--header-h) + 2rem) 1rem 3rem;
}

.hero-eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--color-gold);
  margin-bottom: 0.5rem;
}

.hero-title {
  font-family: var(--font-arabic);
  font-size: clamp(2rem, 8vw, 3.4rem);
  font-weight: 700;
  line-height: 1.15;
  color: #fdf6e3;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
}

.hero-tagline {
  margin-top: 0.75rem;
  max-width: 34rem;
  font-family: var(--font-arabic);
  font-size: clamp(1rem, 3.4vw, 1.25rem);
  color: rgba(253, 246, 227, 0.94);
}

.hero-actions {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ---------- أزرار ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.3s var(--ease);
}

.btn:active {
  transform: translateY(1px) scale(0.98);
}

.btn-gold {
  background: var(--color-gold);
  color: #14100b;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-gold:hover,
.btn-gold:focus-visible {
  background: #ffcc33;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 0 12px var(--glow-gold-soft);
}

.btn-outline {
  border-color: rgba(138, 101, 0, 0.5);
  color: var(--color-gold-ink);
  background: rgba(242, 185, 13, 0.08);
}

.btn-outline:hover {
  border-color: var(--color-gold-deep);
  background: rgba(242, 185, 13, 0.16);
  box-shadow: 0 0 12px var(--glow-gold-faint);
}

/* نسخة الـHero فوق الصورة: خلفية داكنة شفافة + نص ذهبي ساطع لثبات القراءة */
.hero .btn-outline {
  border-color: rgba(242, 185, 13, 0.6);
  color: #ffe9ae;
  background: rgba(29, 24, 18, 0.5);
}

.hero .btn-outline:hover {
  border-color: var(--color-gold-ink);
  color: #fff3d6;
  background: rgba(29, 24, 18, 0.68);
}

.btn:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

.btn-soon {
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.18);
  color: #14100b;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-weight: 700;
}

/* ---------- أقسام عامة ---------- */
.section {
  padding: 2.5rem 1rem 2.5rem;
  scroll-margin-top: var(--header-h);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--max-width);
  margin-inline: auto;
  margin-bottom: 1.15rem;
}

.section-title {
  font-family: var(--font-arabic);
  font-size: clamp(1.4rem, 4.6vw, 1.9rem);
  font-weight: 700;
  color: var(--color-gold-ink);
  line-height: 1.3;
}

/* فاصل هندسي ذهبي تحت العنوان — جزء من نظام الهوية (خط هندسي، بلا زخرفة زائدة) */
.section-title::after {
  content: "";
  display: block;
  width: 2.6rem;
  height: 2px;
  margin-top: 0.5rem;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
}

.section-link {
  flex: none;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-muted);
  border-bottom: 1px solid var(--color-gold-deep);
  padding-bottom: 2px;
}

.section-link:hover {
  color: var(--color-gold-ink);
}

.section-body {
  max-width: var(--max-width);
  margin-inline: auto;
}

/* ---------- شبكة المنتجات ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.product-card {
  display: flex;
  flex-direction: column;
  /* M15-POLISH — فصل البطاقة عن الخلفية بلطف: سطح عاجي دافئ أفتح قليلاً +
     ظل ناعم وحد رفيع، دون تحويل البطاقة إلى صندوق أبيض. */
  background: linear-gradient(180deg, #fdfaf1 0%, var(--color-surface) 55%);
  border: 1px solid rgba(138, 101, 0, 0.22);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(88, 66, 20, 0.08);
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.product-card:hover {
  transform: translateY(-3px);
  border-color: var(--color-gold-deep);
  box-shadow: 0 8px 24px rgba(88, 66, 20, 0.12);
}

.card-media {
  position: relative;
  aspect-ratio: 4 / 4.6;
  overflow: hidden;
  background: var(--stage-bg);
  /* M15-POLISH — إطار داخلي خفيف يجعل الصور المختلفة تبدو ضمن "مسرح" واحد
     دون قصّ أو تغيير object-fit. */
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  border-bottom: 1px solid rgba(88, 66, 20, 0.07);
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}

.product-card:hover .card-media img {
  transform: scale(1.04);
}

.card-badges {
  position: absolute;
  top: 0.5rem;
  inset-inline-start: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: flex-start;
}

.card-body {
  padding: 0.85rem 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.card-cat {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--color-gold-deep);
}

.card-name {
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--color-text);
}

.card-price {
  margin-top: auto;
  padding-top: 0.3rem;
  font-size: 0.85rem;
  color: var(--color-muted);
}

/* ---------- شارات ---------- */
.badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  line-height: 1.4;
}

.badge-new {
  background: var(--color-gold);
  color: #14100b;
  box-shadow: 0 0 6px var(--glow-gold-soft);
}

.badge-offer {
  background: var(--color-danger);
  color: #fff;
  box-shadow: 0 0 6px rgba(226, 85, 77, 0.25);
}

.badge-featured {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-gold);
  color: var(--color-gold-ink);
  box-shadow: 0 0 6px var(--glow-gold-soft);
}

.badge-soldout {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-muted);
}

/* ---------- منتجات جديدة (spotlight) ---------- */
.spotlight {
  display: grid;
  gap: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 0 18px var(--glow-gold-faint);
}

.spotlight-media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--stage-bg);
}

.spotlight-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.spotlight-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.spotlight-name {
  font-family: var(--font-arabic);
  font-size: 1.3rem;
  color: var(--color-text);
}

.spotlight-cat {
  font-size: 0.75rem;
  color: var(--color-gold-deep);
  font-weight: 700;
}

.spotlight-desc {
  font-size: 0.9rem;
  color: var(--color-muted);
}

.spotlight .btn {
  margin-top: 0.5rem;
}

/* ---------- تصنيفات ---------- */
.cat-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.cat-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 62px;
  padding: 0.9rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-text);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}

.cat-chip:hover {
  border-color: var(--color-gold-ink);
  color: var(--color-gold-ink);
  transform: translateY(-2px);
}

/* ---------- عروض فارغة / نتائج فارغة ---------- */
.offers-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem 1rem;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  color: var(--color-muted);
  font-size: 0.95rem;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--color-muted);
}

.empty-state-block {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1.5rem;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
}

.empty-state-title {
  font-family: var(--font-arabic);
  font-size: 1.3rem;
  color: var(--color-gold-ink);
  margin-bottom: 0.4rem;
}

.empty-state-hint {
  color: var(--color-muted);
  font-size: 0.9rem;
}

/* ---------- نبذة / معلومات ---------- */
.about-text {
  max-width: 46rem;
  margin-inline: auto;
  text-align: center;
  font-family: var(--font-arabic);
  font-size: 1.05rem;
  color: var(--color-muted);
}

.info-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.info-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.info-title {
  font-family: var(--font-arabic);
  color: var(--color-gold-ink);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.info-text {
  color: var(--color-muted);
  font-size: 0.95rem;
}

/* ---------- تواصل ---------- */
.contact-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 1fr;
}

.contact-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.contact-card:hover {
  border-color: var(--color-gold-ink);
  transform: translateY(-2px);
}

.contact-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-gold-deep);
}

.contact-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
  word-break: break-word;
}

/* ---------- صفحة المنتجات ---------- */
.page-hero {
  padding: 2.5rem 1rem 1.75rem;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(180deg, rgba(242, 185, 13, 0.06), transparent);
}

.page-hero .page-title {
  font-family: var(--font-arabic);
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  color: var(--color-gold-ink);
}

/* فاصل ذهبي تحت عنوان الصفحات الفرعية — تناسق مع عناوين الأقسام */
.page-title::after {
  content: "";
  display: block;
  width: 3rem;
  height: 2px;
  margin: 0.6rem auto 0;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.25rem 0 0.25rem;
}

.search-box {
  position: relative;
}

.search-box input {
  width: 100%;
  height: 48px;
  padding-inline: 1rem 2.75rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.95rem;
}

.search-box input::placeholder {
  color: var(--color-muted);
}

.search-box input:focus {
  outline: none;
  border-color: var(--color-gold-ink);
}

.search-icon {
  position: absolute;
  top: 50%;
  inset-inline-end: 0.9rem;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  pointer-events: none;
  color: var(--color-muted);
}

.filter-bar {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 0.4rem;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  min-height: 44px;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-surface) 82%, transparent);
  color: var(--color-muted);
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.2s var(--ease);
}

.chip:hover {
  color: var(--color-gold-ink);
  border-color: var(--color-gold-ink);
}

/* M15-POLISH — وضوح الحالة النشطة: تمييز حاسم بين المحدد وغيره بلا إعادة تصميم. */
.chip-active {
  background: var(--color-gold);
  color: #14100b;
  border-color: var(--color-gold-ink);
  font-weight: 800;
  box-shadow: 0 0 0 3px var(--glow-gold-soft), 0 2px 6px rgba(138, 101, 0, 0.22);
}

.results-count {
  font-size: 0.82rem;
  color: var(--color-muted);
  margin-bottom: 0.85rem;
}

/* ---------- صفحة التفاصيل ---------- */
.detail-section {
  padding: 1.5rem 1rem 3.5rem;
}

.detail-grid {
  display: grid;
  gap: 1.5rem;
}

.gallery-main {
  aspect-ratio: 4 / 4.4;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--stage-bg);
  border: 1px solid var(--color-border);
}

.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumbs {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.gallery-thumbs::-webkit-scrollbar {
  display: none;
}

.thumb {
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  overflow: hidden;
  padding: 0;
  background: var(--stage-bg);
}

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

.thumb-active {
  border-color: var(--color-gold-ink);
}

.video-main video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-info {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  align-items: flex-start;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.detail-name {
  font-family: var(--font-arabic);
  font-size: clamp(1.5rem, 5vw, 2rem);
  color: var(--color-text);
  line-height: 1.3;
}

.detail-desc {
  color: var(--color-muted);
  font-size: 0.98rem;
}

.detail-price {
  font-family: var(--font-arabic);
  font-size: 1.35rem;
  color: var(--color-gold-ink);
}

.meta-list {
  list-style: none;
  width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.meta-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.1rem;
  font-size: 0.9rem;
  border-top: 1px solid var(--color-border);
}

.meta-item:first-child {
  border-top: none;
}

.meta-label {
  color: var(--color-muted);
}

.meta-value {
  color: var(--color-text);
  font-weight: 700;
  text-align: end;
}

/* M18 — أخضر نجاح أغمق لاجتياز AA للنص الصغير (#2f7d43 → #276b3a). */
.meta-ok { color: #276b3a; }
.meta-err { color: var(--color-danger); }

.detail-note {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1rem;
}

/* M15-POLISH — مجموعة الشراء: الكمية + أضف للسلة معاً (منطقة شراء واحدة). */
.purchase-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.purchase-group .qty-row {
  margin-inline-end: 0.25rem;
}

.purchase-group .btn-add {
  flex: 1 1 180px;
  min-height: 48px;
  justify-content: center;
}

/* M15-POLISH — الإجراءات الثانوية (واتساب الجملة + مشاركة) تحت زر الشراء. */
.secondary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* M16 — حجم مضغوط وموحّد لأزرار إجراءات QV (الشراء والثانوية) دون تكديس.
   مقصور على QV (.qv-info) حتى لا تتغير صفحة التفاصيل. */
.qv-info .detail-actions .btn,
.qv-info .purchase-group .btn-add {
  min-height: 40px;
}

.qv-info .secondary-actions .btn {
  flex: 0 1 auto;
  min-height: 40px;
  height: 40px;
  padding: 0 0.85rem;
  font-size: 0.85rem;
  justify-content: center;
}

/* مشاركة — قصر الحد المكتوب خلف أيقونة "أضف للسلة" داخل QV */
.qv-info .purchase-group .btn-add {
  flex: 0 1 auto;
  min-width: max-content;
  padding: 0 1.1rem;
}

/* المشاركة: أيقونة فقط بدون نص لسرعة الاستخدام */
.qv-share .btn-text {
  display: none;
}

.qv-share {
  flex: 0 0 auto !important;
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
}

/* مواءمة عداد الكمية داخل QV مع الحجم المضغوط للأزرار */
.qv-info .qty-btn {
  width: 38px;
  height: 38px;
}

.qv-info .qty-value {
  min-width: 2rem;
  font-size: 0.95rem;
}

/* QV — الخيارات الثلاثة (السلة / الاستفسار / المشاركة) في صفّ أفقي واحد
   بجوار بعضها تحت الصورة/التفاصيل، لا عموداً فوق بعض (QV فقط، صفحة التفاصيل لا تتأثر). */
.qv-info .detail-actions {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
}

.qv-info .purchase-group,
.qv-info .secondary-actions {
  flex: 1 1 auto;
  min-width: 0;
}

/* أيقونات داخل الأزرار: تُعرض قبل النص (المسافة يوفّرها gap في .btn). */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.detail-error {
  text-align: center;
  padding: 3rem 1rem;
}

.detail-error-title {
  font-family: var(--font-arabic);
  font-size: 1.5rem;
  color: var(--color-gold-ink);
  margin-bottom: 0.5rem;
}

.detail-error-hint {
  color: var(--color-muted);
  margin-bottom: 1.5rem;
}

/* ---------- الفوتر ---------- */
.site-footer {
  position: relative;
  background: var(--color-surface);
  padding: 2.5rem 1rem 2.5rem;
  margin-top: auto;
}

/* خط ذهبي متدرج في أعلى الفوتر — خاتمة طبيعية للهوية */
.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(70%, 520px);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(242, 185, 13, 0.45), transparent);
}

.footer-grid {
  max-width: var(--max-width);
  margin-inline: auto;
  display: grid;
  gap: 1.75rem;
  grid-template-columns: 1fr;
}

.footer-brand-name {
  font-family: var(--font-arabic);
  color: var(--color-gold-ink);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.footer-tagline {
  color: var(--color-muted);
  font-size: 0.85rem;
  margin-bottom: 0.9rem;
  max-width: 22rem;
}

.footer-row {
  color: var(--color-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-block: 0.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.footer-row > span,
.footer-row > a {
  min-width: 0;
}

.footer-row b {
  color: var(--color-gold-ink);
  font-weight: 700;
  flex: none;
}

.footer-link {
  color: var(--color-gold-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-bottom {
  max-width: var(--max-width);
  margin-inline: auto;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.8rem;
  color: var(--color-muted);
  text-align: center;
}

/* M20 — مدخل الإدارة الهادئ في الفوتر (لا يجعل المتجر يبدو كلوحة إدارة) */
.admin-entry {
  display: inline-block;
  margin-inline-start: 0.6rem;
  color: var(--color-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.75;
}

.admin-entry:hover,
.admin-entry:focus-visible {
  color: var(--color-gold-ink);
  opacity: 1;
}

/* ---------- حركات ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@keyframes navIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- الشاشات المتوسطة ---------- */
@media (min-width: 600px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
  }

  .cat-chips {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .contact-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .info-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .spotlight {
    grid-template-columns: 2fr 1.4fr;
    align-items: stretch;
  }

  .spotlight-media {
    aspect-ratio: auto;
    min-height: 300px;
  }

  .spotlight-body {
    justify-content: center;
  }

  .footer-grid {
    grid-template-columns: 1.2fr 1fr 1fr;
  }
}

/* ---------- الشاشات الكبيرة ---------- */
@media (min-width: 900px) {
  :root {
    --header-h: 72px;
  }

  .brand-sub {
    display: block;
  }

  .nav-toggle {
    display: none;
  }

  .site-nav {
    display: contents;
    box-shadow: none;
    border: none;
    background: transparent;
    position: static;
    flex-direction: row;
    padding: 0;
    gap: 0.25rem;
  }

  .nav-open .site-nav {
    display: contents;
    animation: none;
  }

  .site-nav a {
    font-size: 0.95rem;
    padding: 0.45rem 0.9rem;
    color: var(--color-muted);
  }

  .site-nav a.is-active {
    background: transparent;
    color: var(--color-gold-ink);
  }

  .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .cat-chips {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .detail-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    align-items: start;
    gap: 2.5rem;
  }

  .detail-section {
    padding-top: 2.5rem;
  }

  .gallery-main {
    aspect-ratio: 4 / 4.2;
  }

  .hero {
    min-height: min(82vh, 660px);
  }
}

/* ---------- تفضيلات الحركة ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   M3 — السلة، التفضيلات، خطوط السعر، الصور العمودية
   ============================================================ */

/* -------- أداة إخفاء -------- */
.is-hidden {
  display: none !important;
}

/* -------- منع قصّ الصور العمودية (object-fit: contain) -------- */
.card-media img.fit-contain,
.gallery-main img.fit-contain,
.thumb img.fit-contain,
.cart-item-media img.fit-contain,
.spotlight-media img.fit-contain {
  object-fit: contain;
}

/* -------- أيقونة السلة في الهيدر -------- */
.cart-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-gold-ink);
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}

.cart-link:hover {
  background: var(--color-surface-raised);
}

.cart-link:active {
  transform: scale(0.96);
}

.cart-icon {
  width: 22px;
  height: 22px;
}

.cart-link.is-active {
  border-color: var(--color-gold-ink);
}

.cart-badge {
  position: absolute;
  top: -4px;
  inset-inline-end: -4px;
  min-width: 20px;
  height: 20px;
  padding-inline: 5px;
  border-radius: 999px;
  background: var(--color-danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--color-background);
}

/* -------- خطوط السعر -------- */
.price-line {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.card-price .price-line {
  display: flex;
}

.price-current {
  font-weight: 700;
  color: var(--color-text);
}

.card-price .price-current {
  color: var(--color-muted);
}

.price-old {
  font-size: 0.8em;
  color: var(--color-muted);
  text-decoration: line-through;
  opacity: 0.85;
}

.price-discount {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--color-danger);
  color: #fff;
}

.detail-price .price-line {
  align-items: center;
}

.detail-price .price-current {
  color: var(--color-gold-ink);
  font-family: var(--font-arabic);
  font-size: 1.35rem;
}

/* -------- تحكم الكمية -------- */
.qty-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.qty-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-muted);
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface-raised);
  overflow: hidden;
}

.qty-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--color-gold-ink);
  font-size: 1.2rem;
  font-weight: 700;
  transition: background 0.2s var(--ease);
}

.qty-btn:hover:not(:disabled) {
  background: rgba(242, 185, 13, 0.12);
}

.qty-btn:disabled {
  color: var(--color-muted);
  opacity: 0.4;
  cursor: not-allowed;
}

.qty-value {
  min-width: 2.4rem;
  text-align: center;
  font-weight: 700;
  color: var(--color-text);
}

.qty-stepper.is-disabled {
  opacity: 0.5;
}

.detail-unavailable {
  width: 100%;
  font-size: 0.85rem;
  color: var(--color-danger);
}

/* -------- Toast -------- */
.toast-root {
  position: fixed;
  inset-inline: 1rem;
  bottom: 1.25rem;
  z-index: 100;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 100%;
  padding: 0.8rem 1.1rem;
  border-radius: 999px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-gold);
  color: var(--color-text);
  font-size: 0.9rem;
  box-shadow: 0 14px 30px rgba(88, 66, 20, 0.2);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  pointer-events: auto;
}

.toast-show {
  opacity: 1;
  transform: none;
}

.toast-action {
  flex: none;
  color: var(--color-gold-ink);
  font-weight: 700;
  border-bottom: 1px solid var(--color-gold-deep);
  padding-bottom: 1px;
}

/* -------- صفحة السلة -------- */
.cart-section {
  padding: 1.5rem 1rem 3.5rem;
}

.cart-heading {
  font-family: var(--font-arabic);
  font-size: clamp(1.5rem, 5vw, 2.1rem);
  color: var(--color-gold-ink);
  margin-bottom: 1.25rem;
}

.cart-layout {
  display: grid;
  gap: 1.25rem;
  align-items: start;
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.cart-item {
  display: flex;
  gap: 0.9rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.9rem;
}

.cart-item-unavailable {
  opacity: 0.75;
}

.cart-item-media {
  flex: none;
  width: 88px;
  height: 88px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--stage-bg);
  border: 1px solid var(--color-border);
}

.cart-item-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cart-item-name {
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.35;
}

.cart-item-name:hover {
  color: var(--color-gold-ink);
}

.cart-item-cat {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-gold-deep);
}

.cart-item-price {
  font-size: 0.9rem;
  color: var(--color-muted);
}

.cart-item-warn {
  font-size: 0.8rem;
  color: var(--color-danger);
}

.cart-item-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.35rem;
}

.cart-item-total {
  font-weight: 700;
  color: var(--color-gold-ink);
}

.cart-remove {
  border: none;
  background: transparent;
  color: var(--color-danger);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.35rem 0.4rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
}

.cart-summary {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.cart-summary-title {
  font-family: var(--font-arabic);
  font-size: 1.15rem;
  color: var(--color-text);
}

.cart-summary-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
}

.sum-label {
  color: var(--color-muted);
}

.sum-value {
  font-weight: 700;
  color: var(--color-gold-ink);
  font-size: 1.2rem;
}

.cart-summary-note {
  font-size: 0.8rem;
  color: var(--color-muted);
}

.cart-summary-note.is-warn {
  color: var(--color-danger);
}

.cart-checkout {
  width: 100%;
}

.cart-clear {
  width: 100%;
}

.cart-empty {
  text-align: center;
  padding: 3rem 1rem;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.cart-empty-title {
  font-family: var(--font-arabic);
  font-size: 1.4rem;
  color: var(--color-gold-ink);
}

.cart-empty-hint {
  color: var(--color-muted);
  font-size: 0.92rem;
  margin-bottom: 0.75rem;
}

/* -------- السلة على الشاشات المتوسطة والكبيرة -------- */
@media (min-width: 600px) {
  .cart-item-media {
    width: 108px;
    height: 108px;
  }
}

@media (min-width: 900px) {
  .cart-layout {
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
    gap: 1.75rem;
  }

  .cart-summary {
    position: sticky;
    top: calc(var(--header-h) + 1rem);
  }
}

/* ============================================================
   M4 — طلب WhatsApp: حقول اختيارية + زر إتمام + زر جملة
   ============================================================ */

/* -------- زر إتمام الطلب -------- */
.cart-checkout {
  min-height: 52px;
  width: 100%;
  font-size: 1rem;
  justify-content: center;
}

/* -------- حقول اختيارية قبل فتح WhatsApp -------- */
.wa-fields {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.85rem 0 0.35rem;
  border-top: 1px solid var(--color-border);
}

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

.wa-field-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-muted);
}

.wa-field input,
.wa-field textarea {
  width: 100%;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 0.6rem;
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.92rem;
  padding: 0.7rem 0.9rem;
  transition: border-color 0.2s var(--ease);
}

.wa-field input {
  height: 46px;
}

.wa-field textarea {
  min-height: 58px;
  resize: vertical;
}

.wa-field input:focus,
.wa-field textarea:focus {
  outline: none;
  border-color: var(--color-gold-ink);
}

.wa-field input::placeholder,
.wa-field textarea::placeholder {
  color: var(--color-muted);
}

/* -------- زر استفسار الجملة -------- */
.btn-wholesale {
  min-height: 48px;
}

/* ============================================================
   M5 — صفحات About / Contact / 404
   ============================================================ */

.page-body {
  padding: 1.25rem 0 3rem;
}

.about-block {
  text-align: center;
  padding-top: 0.5rem;
}

.about-block .about-text {
  margin-bottom: 0.85rem;
}

.about-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0.85rem 0 0;
  padding: 0;
}

.about-list li {
  position: relative;
  padding-inline-start: 1rem;
  color: var(--color-muted);
  font-size: 0.95rem;
}

.about-list li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0.5em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-gold);
}

.info-note {
  margin-top: 0.6rem;
  font-size: 0.9rem;
  color: var(--color-gold-deep);
}

.about-section {
  text-align: center;
}

.branch-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 24rem;
  margin: 1.25rem auto 0;
  padding: 0;
}

.branch-list li {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-weight: 700;
  color: var(--color-text);
}

.contact-actions {
  display: flex;
  justify-content: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding: 0.5rem 0 3rem;
}

.contact-actions .btn {
  min-height: 48px;
}

.notfound {
  min-height: 55vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1rem;
  padding: 3rem 1rem;
}

.notfound-code {
  font-size: clamp(3rem, 14vw, 6rem);
  font-weight: 700;
  color: var(--color-gold-ink);
  line-height: 1;
  margin: 0;
}

.notfound-title {
  font-family: var(--font-arabic);
  font-size: clamp(1.5rem, 5vw, 2rem);
  color: var(--color-text);
  margin: 0;
}

.notfound-text {
  color: var(--color-muted);
  max-width: 30rem;
  margin: 0;
}

.notfound-actions {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.5rem;
}

.notfound-actions .btn {
  min-height: 48px;
}

/* ============================================================
   M6 — شرر الجمر والدخان الخفيف (طبقة خلفية جمالية)
   ============================================================ */

/* الطبقة: مثبتة خلف كل المحتوى، لا تتفاعل مع اللمس، لا تسبب overflow.
   z-index: -1 مع body.isolation يبقيها فوق خلفية الصفحة وتحت كل المحتوى. */
#embers-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  contain: layout paint style;
}

/* -------- شرر الجمر -------- */
#embers-layer .ember {
  position: absolute;
  bottom: -8px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, #ffe9a8 0%, #f2b90d 40%, rgba(242, 185, 13, 0) 72%);
  opacity: 0;
  animation: ember-rise var(--dur, 14s) linear var(--delay, 0s) infinite;
  will-change: transform, opacity;
}

#embers-layer .ember-amber {
  background:
    radial-gradient(circle at 35% 35%, #ffd9a0 0%, #e8962c 45%, rgba(232, 150, 44, 0) 72%);
}

#embers-layer .ember-glow {
  box-shadow:
    0 0 4px rgba(255, 190, 60, 0.55),
    0 0 10px rgba(242, 185, 13, 0.35);
}

@keyframes ember-rise {
  0% {
    transform: translate3d(0, 0, 0) scale(0.75);
    opacity: 0;
  }
  8% {
    opacity: min(var(--op, 0.6), 0.42);
  }
  72% {
    opacity: min(var(--op, 0.6), 0.42);
  }
  100% {
    transform: translate3d(var(--drift, 0), -118vh, 0) scale(1);
    opacity: 0;
  }
}

/* -------- الدخان الخفيف -------- */
#embers-layer .smoke {
  position: absolute;
  bottom: -24vmin;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(122, 100, 74, 0.2) 0%, rgba(122, 100, 74, 0.08) 45%, rgba(122, 100, 74, 0) 72%);
  opacity: 0;
  animation: smoke-rise var(--dur, 32s) ease-in-out var(--delay, 0s) infinite;
  will-change: transform, opacity;
}

@keyframes smoke-rise {
  0% {
    transform: translate3d(0, 0, 0) scale(0.65);
    opacity: 0;
  }
  18% {
    opacity: var(--op, 0.06);
  }
  72% {
    opacity: var(--op, 0.06);
  }
  100% {
    transform: translate3d(var(--drift, 0), -122vh, 0) scale(1.35);
    opacity: 0;
  }
}

/* تفضيل تقليل الحركة: أبطل الحركة تماماً (الطبقة تصبح بلا محتوى لأن
   JS لا ينشئ الجزيئات أصلاً، وهذه حماية إضافية). */
@media (prefers-reduced-motion: reduce) {
  #embers-layer {
    display: none;
  }
}

/* ============================================================
   M8 — Micro-interactions & Visual Polish
   ============================================================ */

/* --- الظهور التدريجي عند التمرير (مترقٍّ: لا يُخفى إلا مع JS) --- */
html.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}

html.js .reveal.is-inview {
  opacity: 1;
  transform: none;
}

html.js .reveal-stagger > * {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
  transition-delay: calc(var(--reveal-i, 0) * 55ms);
}

html.js .reveal-stagger.is-inview > * {
  opacity: 1;
  transform: none;
}

/* ستاجر أخف وأقصر على الجوال */
@media (max-width: 599px) {
  html.js .reveal-stagger > * {
    transition-delay: calc(var(--reveal-i, 0) * 30ms);
  }
}

/* --- تأثير الهيدر عند التمرير --- */
.site-header.is-scrolled {
  background: color-mix(in srgb, var(--color-background) 97%, transparent);
  box-shadow: 0 4px 18px rgba(88, 66, 20, 0.12);
}

/* --- رفعة خفيفة لأزرار الـCTA عند التحويم (سطح به hover فقط) --- */
@media (hover: hover) {
  .btn-gold:hover,
  .btn-outline:hover {
    transform: translateY(-1px);
  }
}

/* --- إحساس الضغط للعناصر الصغيرة --- */
.qty-btn:active:not(:disabled) {
  transform: scale(0.9);
}

.chip:active {
  transform: scale(0.96);
}

.cat-chip:active {
  transform: translateY(0) scale(0.98);
}

/* --- نقرة البطاقة --- */
.product-card:active {
  transform: translateY(-1px) scale(0.99);
}

/* --- نبضة عداد السلة عند التغيير --- */
@keyframes badgePop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.28); }
  100% { transform: scale(1); }
}

.cart-badge.pop {
  animation: badgePop 0.35s var(--ease);
}

/* --- تفضيل تقليل الحركة: إظهار كل شيء فوراً دون أي حركة --- */
@media (prefers-reduced-motion: reduce) {
  html.js .reveal,
  html.js .reveal-stagger > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .cart-badge.pop {
    animation: none;
  }
}

/* ============================================================
   M9 — صقل الهوية البصرية (لمسات تكاملية خفيفة)
   ============================================================ */

/* توازن بصري لعناوين اللغة الإنجليزية (serif أنيق دون تشتيت) */
html[lang="en"] .brand-name,
html[lang="en"] .section-title,
html[lang="en"] .page-title {
  letter-spacing: 0.02em;
}

/* بُعد تنفّس أكبر بين صفوف الفوتر على الجوال (فصل بالمسافة لا بالحدود) */
.footer-grid > div + div {
  padding-top: 0.25rem;
}

@media (min-width: 600px) {
  .footer-grid > div + div {
    padding-top: 0;
  }
}

/* ============================================================
   M12 — تصفح منتجات الرئيسية + المعاينة السريعة
   (شريط أفقي بسحب/تمرير، بدون تشغيل تلقائي)
   ============================================================ */

/* شريط المنتجات الأفقي */
.rail {
  display: flex;
  gap: 0.9rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0.2rem 0.15rem 0.7rem;
}

.rail::-webkit-scrollbar {
  display: none;
}

.rail.is-dragging {
  scroll-snap-type: none;
  scroll-behavior: auto;
  cursor: grabbing;
}

/* M13 — أثناء التمرير التلقائي الهادئ: تعطيل الـsnap مؤقتاً لحركة سلسة */
.rail.scroll-gentle {
  scroll-snap-type: none;
  scroll-behavior: auto;
}

.rail > .product-card {
  flex: none;
  width: clamp(150px, 42vw, 205px);
  scroll-snap-align: start;
}

.rail.is-dragging .product-card,
.rail.is-dragging .card-media img {
  user-select: none;
  /* ملاحظة (M15): لا نضبط pointer-events: none هنا إطلاقاً.
     لمّا كانت هذه القاعدة تُطبَّق عند pointerdown، كانت تعطّل استهداف البطاقة
     لنفس النقرة (mousedown/click) فتُفتح المعاينة أبداً بالنقر الفيزيائي.
     منع فتح المعاينة بعد سحب حقيقي يتمّ عبر didDrag + معالج النقر بالتقاط. */
  -webkit-user-drag: none;
}

.rail .card-media img {
  -webkit-user-drag: none;
}

button.product-card {
  font: inherit;
  text-align: start;
  cursor: pointer;
}

/* شرائح التصفية في الرئيسية (مطابقة لشريط فلتر صفحة المنتجات) */
.chip-row {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 0.4rem;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

/* أزرار عرض الكل / عرض أقل */
.browse-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.browse-actions .btn {
  min-width: clamp(130px, 40vw, 160px);
}

#browse-expanded {
  margin-top: 1.5rem;
}

/* ---------- M15 — بطاقة العرض الواحد المضغوطة (مميّز / وصل حديثاً) ----------
   حين يبقى عنصر واحد فقط، نعرضه كبطاقة مضغوطة متمركزة (لا تملأ العرض ولا
   تترك فراغاً كبيراً). الزر يفتح المعاينة السريعة. */
.feature-highlight {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 380px;
  margin-inline: auto;
  text-align: start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(88, 66, 20, 0.06);
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.feature-highlight:hover {
  transform: translateY(-2px);
  border-color: var(--color-gold-deep);
  box-shadow: 0 6px 20px rgba(88, 66, 20, 0.1);
}

.fh-media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--stage-bg);
}

.fh-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fh-media img.fit-contain {
  object-fit: contain;
}

.fh-body {
  padding: 1rem 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-start;
}

.fh-name {
  font-family: var(--font-arabic);
  font-size: 1.15rem;
  line-height: 1.3;
  color: var(--color-text);
}

.fh-desc {
  font-size: 0.88rem;
  color: var(--color-muted);
}

.fh-price {
  margin-top: 0.15rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-muted);
}

/* شريط بعنصر واحد: نمركز البطاقة ولا نجعلها تتمدد لملء الشريط */
.rail.is-single {
  display: flex;
  justify-content: center;
  overflow: visible;
  scroll-snap-type: none;
  scroll-behavior: auto;
  padding: 0;
}
.rail.is-single .feature-highlight {
  flex: 0 1 380px;
}

/* شبكة بعنصر واحد (مميّز): نمركز البطاقة ولا نترك فراغاً جانبي */
.product-grid.is-single {
  display: flex;
  justify-content: center;
}
.product-grid.is-single .feature-highlight {
  flex: 0 1 380px;
}

/* ---------- نافذة المعاينة السريعة Quick View ---------- */
.qv-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}

.qv-modal.is-open {
  opacity: 1;
}

.qv-modal[hidden],
.lightbox[hidden] {
  display: none;
}

.qv-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 5, 3, 0.72);
  backdrop-filter: blur(2px);
}

.qv-dialog {
  position: relative;
  width: 100%;
  max-width: 760px;
  max-height: 88vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -6px 40px rgba(0, 0, 0, 0.45);
  padding: 1.1rem 1rem 1.5rem;
}

.qv-close {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-inline-start: auto;
  margin-block-end: 0.35rem;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.qv-close:hover {
  border-color: var(--color-gold-ink);
  color: var(--color-gold-ink);
}

.qv-layout {
  display: grid;
  gap: 1.25rem;
}

/* ===== M16/QV media gallery fix (Quick View only) =====
   ONE main media area showing the current image OR the video (never both).
   The video is shown fully (object-fit: contain, natural aspect, no crop/overflow). */
.qv-media {
  width: 100%;
  min-width: 0;
}

.qv-media-main {
  position: relative;
  width: 100%;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--stage-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

/* الصورة والفيديو يحافظان على أبعادهما الطبيعية (لا تمدد، لا قص، لا إطار عريض زائد) */
.qv-media-main img,
.qv-media-main video {
  display: block;
  max-width: 100%;
  max-height: 420px;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center;
  background: #14100b;
}

.qv-media-main img.fit-contain {
  object-fit: contain;
}

/* الفيديو: عرض كامل داخل نفس الصندوق دون قص أو تجاوز */
.qv-media-main video {
  object-fit: contain;
  object-position: center;
  background: #14100b;
}

.qv-media-thumbs {
  margin-top: 0.6rem;
}

/* موضع نسبي فقط لأغراض شارة التشغيل على ظفر الفيديو (بدون تغيير مظهر) */
.qv-media-thumbs .thumb {
  position: relative;
}

/* شارة تشغيل صغيرة فوق ظفر الفيديو */
.thumb-video-badge {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.05rem;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.qv-info {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  align-items: flex-start;
}

.qv-name {
  font-family: var(--font-arabic);
  font-size: clamp(1.3rem, 4.5vw, 1.85rem);
  color: var(--color-text);
  line-height: 1.3;
}

.qv-desc {
  color: var(--color-muted);
  font-size: 0.95rem;
}

@media (min-width: 700px) {
  .qv-modal {
    align-items: center;
    padding: 1.5rem;
  }

  .qv-dialog {
    border-radius: var(--radius);
    max-height: 86vh;
  }

  .qv-layout {
    /* رجوع ثنائي الأعمدة على سطح المكتب: الصورة بجانب التفاصيل (المظهر الأصلي). */
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    align-items: start;
    gap: 1.5rem;
  }
}

/* ---------- Lightbox تكبير الصورة ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(3, 2, 1, 0.92);
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}

.lightbox.is-open {
  opacity: 1;
}

.lightbox-img {
  max-width: min(92vw, 1000px);
  max-height: 88vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  inset-inline-end: 1rem;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.lightbox-close:hover {
  border-color: var(--color-gold-ink);
  color: var(--color-gold-ink);
}

/* ---------- تقليل الحركة: المعاينة وlightbox تظهر فوراً ---------- */
@media (prefers-reduced-motion: reduce) {
  .qv-modal,
  .lightbox {
    opacity: 1 !important;
    transition: none !important;
  }

  .rail {
    scroll-behavior: auto;
  }
}