/* ==========================================================================
   الصفحة الرئيسية — التصميم الجديد (نوفمبر 2026) · public/js/home.js
   مبني على دراسة 60 موقع منافس (docs/redesign/competitor-analysis.html)
   الحركة: خلفية الواجهة بتتحرك ببطء، السلايدر والكاروسيل بيتقلبوا لوحدهم، الكروت بتتفاعل مع الماوس،
   وكل ده بيقف لو الجهاز مفعّل "تقليل الحركة" (آخر الملف).
   ========================================================================== */

/* ---------- الواجهة (الهيرو) ---------- */
.hero.hx { padding: 46px 0 60px; }
.hero.hx .container { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 44px; }
.hx h1 { font-size: clamp(1.55rem, 2.8vw, 2.4rem); line-height: 1.38; margin: 14px 0 12px; }
.hx p { font-size: 1rem; color: #c9cfe6; opacity: 1; max-width: 48ch; margin: 0 0 22px; }
.hx .hero-highlight {
  background: linear-gradient(90deg, #e3c07f 0%, #c9973f 30%, #f6e2b3 50%, #c9973f 70%, #e3c07f 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none;
  animation: hxShimmer 7s linear infinite;
}
@keyframes hxShimmer { to { background-position: -250% 0; } }

.hx-trust { list-style: none; margin: 24px 0 0; padding: 18px 0 0; display: flex; flex-wrap: wrap; gap: 14px 24px; border-top: 1px solid rgba(255, 255, 255, .12); }
.hx-trust li { display: flex; align-items: center; gap: 10px; font-size: .8rem; color: #c9cfe6; line-height: 1.45; }
.hx-trust strong { display: block; color: #fff; font-size: .9rem; }
.hx-ic { width: 38px; height: 38px; border-radius: 12px; background: rgba(255, 255, 255, .08); display: grid; place-items: center; color: var(--brand-accent-light); flex: none; transition: transform .35s var(--ease), background .35s; }
.hx-ic .ico { width: 19px; height: 19px; }
.hx-trust li:hover .hx-ic { transform: translateY(-3px) rotate(-8deg); background: rgba(201, 151, 63, .22); }

/* ---------- سلايدر الواجهة ---------- */
.hslider { position: relative; min-width: 0; perspective: 1200px; }
.hslider[hidden] { display: none; }
.hs-stage {
  position: relative; background: #fff; border-radius: 26px; overflow: hidden;
  box-shadow: 0 34px 70px -28px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .06);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .45s var(--ease);
}
.hs-track { display: flex; transition: transform .75s cubic-bezier(.22, .8, .2, 1); }
.hs-slide { flex: 0 0 100%; min-width: 0; display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 10px; padding: 18px; color: var(--text); min-height: 340px; }
.hs-img { aspect-ratio: 1; background: linear-gradient(135deg, #f6f2e8, #fdfbf6); border-radius: 18px; display: grid; place-items: center; padding: 14px; overflow: hidden; }
.hs-img img { width: 100%; height: 100%; object-fit: contain; transform: scale(1); transition: transform 5.2s linear; }
.hs-slide.is-active .hs-img img { transform: scale(1.07); }
.hs-info { padding: 8px 12px; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.hs-info > * { opacity: 0; transform: translateY(14px); transition: opacity .55s var(--ease), transform .55s var(--ease); }
.hs-slide.is-active .hs-info > * { opacity: 1; transform: none; }
.hs-slide.is-active .hs-info > :nth-child(2) { transition-delay: .08s; }
.hs-slide.is-active .hs-info > :nth-child(3) { transition-delay: .16s; }
.hs-slide.is-active .hs-info > :nth-child(4) { transition-delay: .24s; }
.hs-slide.is-active .hs-info > :nth-child(5) { transition-delay: .32s; }
.hs-tag { align-self: flex-start; font-size: .75rem; font-weight: 700; color: var(--brand-accent-dark); background: #fbf3e3; border: 1px solid #f0dfbb; border-radius: 999px; padding: 2px 11px; }
.hs-name { font-family: var(--font-heading); font-weight: 700; font-size: 1.15rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hs-desc { color: var(--text-muted); font-size: .86rem; line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hs-price { display: flex; align-items: baseline; gap: 6px; }
.hs-price small { color: var(--text-muted); font-size: .82rem; }
.hs-price b { font-family: var(--font-heading); font-size: 1.4rem; color: var(--brand-primary); font-variant-numeric: tabular-nums; }
.hs-cta { align-self: flex-start; }
.hs-cta { transition: gap .3s var(--ease), background .2s, transform .2s var(--ease); }
.hs-slide:hover .hs-cta { gap: 14px; }
.hs-nav {
  position: absolute; top: 50%; translate: 0 -50%; z-index: 2;
  width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .96); box-shadow: var(--shadow); color: var(--brand-primary);
  display: grid; place-items: center; cursor: pointer; opacity: 0;
  transition: opacity .25s, background .2s, color .2s, scale .2s var(--ease);
}
.hs-nav[hidden] { display: none !important; }
.hs-stage:hover .hs-nav, .hs-nav:focus-visible { opacity: 1; }
.hs-nav:hover { background: var(--brand-primary); color: #fff; scale: 1.08; }
.hs-prev { inset-inline-start: 10px; }
.hs-next { inset-inline-end: 10px; }
@media (hover: none) { .hs-nav { opacity: .92; width: 36px; height: 36px; } }
.hs-thumbs { display: flex; gap: 8px; margin-top: 14px; justify-content: center; flex-wrap: wrap; }
.hs-thumbs button { width: 54px; height: 54px; border-radius: 12px; border: 2px solid transparent; background: #fff; padding: 4px; cursor: pointer; opacity: .55; transition: opacity .25s, border-color .25s, transform .3s var(--ease), box-shadow .3s; }
.hs-thumbs button:hover { opacity: .9; transform: translateY(-3px); }
.hs-thumbs button.on { opacity: 1; border-color: var(--brand-accent); transform: translateY(-3px); box-shadow: 0 10px 20px -10px rgba(201, 151, 63, .9); }
.hs-thumbs img { width: 100%; height: 100%; object-fit: contain; }
.hs-progress { height: 3px; max-width: 220px; margin: 12px auto 0; background: rgba(255, 255, 255, .15); border-radius: 3px; overflow: hidden; }
.hs-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand-accent-light), var(--brand-accent)); }
.hs-static .hs-progress { display: none; }
.hs-skel .hs-img { display: block; width: 100%; }
.hs-skel .hs-info > * { opacity: 1; transform: none; }

/* ---------- شريط المميزات ---------- */
.vals-band { background: #fff; border-bottom: 1px solid var(--border); }
.vals-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; padding-top: 26px; padding-bottom: 26px; }
.val { display: flex; gap: 14px; align-items: flex-start; }
.val-ic { width: 48px; height: 48px; border-radius: 14px; background: #fbf3e3; color: var(--brand-accent-dark); display: grid; place-items: center; flex: none; animation: hxBob 4.2s ease-in-out infinite; animation-delay: calc(var(--d, 0) * .55s); }
.val-ic .ico { width: 22px; height: 22px; }
.val strong { display: block; font-size: .95rem; font-family: var(--font-heading); }
.val span { font-size: .84rem; color: var(--text-muted); line-height: 1.55; }
@keyframes hxBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* ---------- الأقسام ---------- */
.hcats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.hcat {
  position: relative; background: #fff; border: 1px solid var(--border); border-radius: 20px; overflow: hidden;
  display: flex; flex-direction: column; color: var(--text); box-shadow: var(--shadow-sm);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s;
}
.hcat:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.hcat-media { position: relative; aspect-ratio: 1; background: #fff; padding: 12px; border-bottom: 1px solid var(--border); display: grid; place-items: center; overflow: hidden; }
.hcat-media img { width: 100%; height: 100%; object-fit: contain; transition: transform .7s var(--ease); }
.hcat:hover .hcat-media img { transform: scale(1.08) rotate(-1.5deg); }
.hcat-ico .ico { width: 54px; height: 54px; color: var(--brand-accent); }
.hcat-count { position: absolute; top: 10px; inset-inline-start: 10px; background: rgba(22, 34, 79, .9); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 999px; padding: 2px 9px; }
.hcat-body { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: 1; }
.hcat-text { min-width: 0; }
.hcat h3 { margin: 0; font-size: .95rem; line-height: 1.4; }
.hcat small { display: block; color: var(--text-muted); font-size: .8rem; margin-top: 2px; }
.hcat small b { color: var(--brand-primary); }
.hcat-go { width: 32px; height: 32px; border-radius: 50%; background: var(--bg); color: var(--brand-primary); display: grid; place-items: center; flex: none; transition: background .25s, color .25s, transform .3s var(--ease); }
.hcat-go .ico { width: 16px; height: 16px; }
.hcat:hover .hcat-go { background: var(--brand-primary); color: #fff; transform: translateX(-3px); }
[dir="ltr"] .hcat:hover .hcat-go { transform: translateX(3px); }
.hcat-all { align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 22px 14px; background: linear-gradient(150deg, var(--brand-primary), var(--brand-primary-dark)); color: #fff; border-color: transparent; }
.hcat-all h3 { color: #fff; }
.hcat-all small { color: #c9cfe6; }
.hcat-all .hcat-go { background: rgba(255, 255, 255, .12); color: #fff; }
.hcat-all-ic { width: 58px; height: 58px; border-radius: 17px; background: rgba(201, 151, 63, .2); color: var(--brand-accent-light); display: grid; place-items: center; animation: hxBob 4s ease-in-out infinite; }
.hcat-all-ic .ico { width: 26px; height: 26px; }

/* ---------- قسم الشركات ---------- */
.b2b {
  position: relative; overflow: hidden; border-radius: 28px; padding: 44px; color: #fff;
  background: linear-gradient(120deg, var(--brand-primary-dark), var(--brand-primary) 55%, var(--brand-primary-light));
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 36px; align-items: center;
}
.b2b > :not(.hx-orbs) { position: relative; z-index: 1; }
.b2b h2 { color: #fff; font-size: clamp(1.35rem, 2.2vw, 1.75rem); margin: 12px 0 10px; }
.b2b p { color: #c9cfe6; margin: 0 0 18px; }
.b2b-list { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 10px; }
.b2b-list li { display: flex; gap: 10px; align-items: center; }
.b2b-list .ico { color: var(--brand-accent-light); width: 18px; height: 18px; }
.b2b-card { background: #fff; color: var(--text); border-radius: 20px; padding: 22px; box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .5); animation: hxCardFloat 6s ease-in-out infinite; }
.b2b-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-family: var(--font-heading); }
.b2b-dot { width: 10px; height: 10px; border-radius: 50%; background: #16a34a; animation: hxDot 2s infinite; }
.b2b-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: .88rem; }
.b2b-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b2b-row b { white-space: nowrap; color: var(--brand-primary); font-variant-numeric: tabular-nums; }
.b2b.is-in .b2b-row { animation: hxRowIn .6s var(--ease) both; animation-delay: calc(.25s + var(--d, 0) * .22s); }
.b2b-total { display: flex; justify-content: space-between; margin-top: 10px; font-family: var(--font-heading); font-weight: 700; font-size: 1.1rem; color: var(--brand-primary); }
.b2b-card small { display: block; margin-top: 8px; color: var(--text-muted); font-size: .75rem; }
@keyframes hxCardFloat { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-10px) rotate(.6deg); } }
@keyframes hxDot { 0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .5); } 70%, 100% { box-shadow: 0 0 0 10px rgba(22, 163, 74, 0); } }
@keyframes hxRowIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- آراء العملاء (شريط متحرك) ---------- */
.greviews-marquee { overflow: hidden; margin-top: 24px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.greviews-marquee .greviews-track { display: flex; gap: 16px; width: max-content; margin: 0; padding: 6px 0 12px; grid-template-columns: none; }
.greviews-marquee .greview { width: 320px; flex: none; transition: transform .3s var(--ease), box-shadow .3s; }
.greviews-marquee .greview:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.greviews-marquee .greview blockquote { display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; }
.greviews-marquee.is-moving .greviews-track { animation: marqueeRtl var(--dur, 60s) linear infinite; }
[dir="ltr"] .greviews-marquee.is-moving .greviews-track { animation-name: marquee; }
.greviews-marquee.is-moving:hover .greviews-track { animation-play-state: paused; }
.greviews-marquee.is-static { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }

/* ---------- الموبايل والتابلت ---------- */
@media (max-width: 1100px) {
  .hcats { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 980px) {
  .hero.hx { padding: 30px 0 42px; }
  .hero.hx .container { grid-template-columns: 1fr; gap: 28px; }
  .hs-slide { grid-template-columns: 1fr; min-height: 0; padding: 12px; gap: 6px; }
  .hs-img { aspect-ratio: 4 / 3; }
  .hs-info { padding: 4px 6px 8px; }
  .vals-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .hcats { grid-template-columns: repeat(3, 1fr); }
  .b2b { grid-template-columns: 1fr; padding: 30px 22px; gap: 26px; }
}
@media (max-width: 600px) {
  .hx h1 { font-size: 1.5rem; }
  .hx p { font-size: .92rem; margin-bottom: 18px; }
  .hx .hero-actions { flex-wrap: nowrap; gap: 10px; }
  .hx .hero-actions .btn { flex: 1; width: auto; padding: 13px 10px; font-size: .92rem; }
  .hx-trust { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 20px; padding-top: 16px; }
  .hx-trust li { flex-direction: column; text-align: center; gap: 6px; font-size: .72rem; }
  .hx-trust strong { font-size: .8rem; }
  .hs-thumbs button { width: 42px; height: 42px; }
  /* السلايدر على الموبايل: الصورة جنب الكلام عشان ميطولش */
  .hs-slide { grid-template-columns: 46% minmax(0, 1fr); gap: 10px; padding: 10px; align-items: center; }
  .hs-img { aspect-ratio: 1; padding: 8px; border-radius: 14px; }
  .hs-info { padding: 0; gap: 7px; }
  .hs-desc { display: none; }
  .hs-tag { font-size: .68rem; padding: 1px 8px; }
  .hs-name { font-size: .92rem; -webkit-line-clamp: 3; }
  .hs-price b { font-size: 1.12rem; }
  .hs-cta { padding: 7px 12px; font-size: .78rem; }
  .hs-nav { display: none !important; } /* على الموبايل: سحب بالإصبع + الصور الصغيرة تحت */
  .vals-grid { gap: 12px 10px; padding-top: 16px; padding-bottom: 16px; }
  .val { align-items: center; gap: 9px; }
  .val-ic { width: 38px; height: 38px; border-radius: 11px; }
  .val-ic .ico { width: 19px; height: 19px; }
  .val strong { font-size: .84rem; }
  .val div > span { display: none; } /* على الموبايل العنوان بس عشان الشريط يفضل قصير */
  /* الأقسام على الموبايل: صفين بيتسحبوا بالعرض بدل عمود طويل */
  .hcats { grid-template-columns: none; grid-template-rows: auto auto; grid-auto-flow: column; grid-auto-columns: 44%; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin-inline: -20px; padding: 4px 20px 10px; scroll-padding-inline: 20px; }
  .hcats::-webkit-scrollbar { display: none; }
  .hcat { scroll-snap-align: start; }
  .hcat-body { padding: 10px; }
  .hcat h3 { font-size: .86rem; }
  .hcat-go { display: none; }
  .greviews-marquee .greview { width: 270px; }
}

/* ---------- تقليل الحركة ---------- */
@media (prefers-reduced-motion: reduce) {
  .hx-orbs i, .hx .hero-highlight, .val-ic, .hcat-all-ic, .b2b-card, .b2b-dot, .b2b.is-in .b2b-row { animation: none !important; }
  .hs-track, .hs-img img, .hs-info > *, .hs-stage { transition: none !important; }
  .hs-slide.is-active .hs-img img, .hs-stage { transform: none !important; }
}
