/* إلغاء الارتفاع الثابت لحاويات بنرات الصور */
[class*="embla"]:has(.embla__slide > .absolute > picture > img) {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
}

/* جعل ارتفاع كل بنر تابعًا لصورة البانر */
.embla__slide:has(> .absolute > picture > img) {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  padding: 0 !important;
}

/* إبقاء المحتوى فوق صورة البانر */
.embla__slide:has(> .absolute > picture > img) > * {
  grid-area: 1 / 1 !important;
}

/* إدخال الصورة في حساب ارتفاع البانر */
.embla__slide > .absolute:has(> picture > img) {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  height: auto !important;
  z-index: 0 !important;
}

/* عرض الصور كاملة دون قص أو تمديد */
.embla__slide > .absolute > picture:has(> img),
.embla__slide > .absolute > picture > img {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  object-position: center !important;
}
/* ==============================
   ألوان وهوية متجر الفايد للعود
============================== */

:root {
  --alfayed-burgundy: #4f1c1f;
  --alfayed-burgundy-light: #6b2a2f;
  --alfayed-beige: #cfbfb0;
  --alfayed-background: #f7f2ec;
  --alfayed-card: #fffaf7;
  --alfayed-text: #321416;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--alfayed-background) !important;
  color: var(--alfayed-text);
}

main,
.home {
  background:
    radial-gradient(
      circle at 100% 0%,
      rgba(207, 191, 176, 0.3),
      transparent 34rem
    ),
    linear-gradient(
      180deg,
      #fbf8f5 0%,
      var(--alfayed-background) 100%
    ) !important;
}

/* الهيدر */

header {
  background-color: rgba(255, 250, 247, 0.96) !important;
  border-bottom: 1px solid rgba(79, 28, 31, 0.1);
  box-shadow: 0 4px 20px rgba(79, 28, 31, 0.05);
  backdrop-filter: blur(10px);
}

/* الفوتر */

footer {
  background-color: var(--alfayed-burgundy) !important;
  color: #fffaf7 !important;
}

footer :is(h2, h3, h4, p, a, span, li) {
  color: #fffaf7 !important;
}

footer a:hover {
  color: var(--alfayed-beige) !important;
}

footer img {
  filter: none !important;
}

/* ==============================
   قسم التصنيفات
   العود الطبيعي + العود المحسن
============================== */

/* وضع التصنيفين بجوار بعض */

main :is(div, ul):has(a[href*="/categories/"][href*="طبيع"]:has(img)):has(a[href*="/categories/"][href*="محسن"]:has(img)):not(:has(> :is(div, ul):has(a[href*="/categories/"][href*="طبيع"]:has(img)):has(a[href*="/categories/"][href*="محسن"]:has(img)))) {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: clamp(12px, 2vw, 24px) !important;
  width: min(100%, 720px) !important;
  margin-inline: auto !important;
  padding: 24px 14px !important;
}

/* إلغاء المقاسات القديمة للكروت */

main :is(div, ul):has(a[href*="/categories/"][href*="طبيع"]:has(img)):has(a[href*="/categories/"][href*="محسن"]:has(img)):not(:has(> :is(div, ul):has(a[href*="/categories/"][href*="طبيع"]:has(img)):has(a[href*="/categories/"][href*="محسن"]:has(img)))) > * {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* شكل كارت التصنيف المربع */

main a[href*="/categories/"][href*="طبيع"]:has(img),
main a[href*="/categories/"][href*="محسن"]:has(img) {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  aspect-ratio: 1 / 1 !important;
  overflow: hidden !important;
  border-radius: 22px !important;
  background: var(--alfayed-beige) !important;
  border: 1px solid rgba(79, 28, 31, 0.12);
  box-shadow: 0 10px 28px rgba(79, 28, 31, 0.1);
  isolation: isolate;
}

/* ضبط الصورة 1000×1000 داخل الكارت */

main a[href*="/categories/"][href*="طبيع"] picture,
main a[href*="/categories/"][href*="محسن"] picture {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
}

main a[href*="/categories/"][href*="طبيع"] img,
main a[href*="/categories/"][href*="محسن"] img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* طبقة خفيفة لظهور العنوان */

main a[href*="/categories/"][href*="طبيع"]::before,
main a[href*="/categories/"][href*="محسن"]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(30, 8, 10, 0.04),
    rgba(30, 8, 10, 0.38)
  );
}

/* عنوان التصنيف في منتصف الصورة */

main a[href*="/categories/"][href*="طبيع"]::after,
main a[href*="/categories/"][href*="محسن"]::after {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  transform: translate(-50%, -50%);
  padding: 10px 18px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  background: rgba(79, 28, 31, 0.82);
  color: #ffffff;
  font-size: clamp(15px, 2vw, 21px);
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(5px);
}

main a[href*="/categories/"][href*="طبيع"]::after {
  content: "العود الطبيعي";
}

main a[href*="/categories/"][href*="محسن"]::after {
  content: "العود المحسن";
}

/* إخفاء العنوان القديم داخل الكارت إن وُجد */

main a[href*="/categories/"][href*="طبيع"] :is([class*="title"], [class*="name"], figcaption),
main a[href*="/categories/"][href*="محسن"] :is([class*="title"], [class*="name"], figcaption) {
  display: none !important;
}

/* ==============================
   قسم مميزات المتجر
============================== */

main :is(
  .features-grid,
  .features-list,
  .feature-grid,
  .feature-list,
  [class*="features__grid"],
  [class*="features__list"]
),
main :is(div, ul):has(> :is([class*="feature-card"], [class*="feature-item"], [class*="benefit"]):nth-child(3)) {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  align-items: stretch !important;
  gap: 18px !important;
  width: min(100%, 660px) !important;
  margin-inline: auto !important;
}

/* كروت المميزات والثالث يظهر في المنتصف */

main :is(
  .features-grid,
  .features-list,
  .feature-grid,
  .feature-list,
  [class*="features__grid"],
  [class*="features__list"]
) > *,
main :is(div, ul):has(> :is([class*="feature-card"], [class*="feature-item"], [class*="benefit"]):nth-child(3)) > :is([class*="feature-card"], [class*="feature-item"], [class*="benefit"]) {
  flex: 0 1 300px !important;
  max-width: 300px !important;
  margin-inline: auto !important;
  padding: 22px 16px !important;
  text-align: center !important;
  background: rgba(255, 250, 247, 0.78);
  border: 1px solid rgba(79, 28, 31, 0.09);
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(79, 28, 31, 0.07);
}

/* تصغير صور المميزات */

main :is(
  .features-grid,
  .features-list,
  .feature-grid,
  .feature-list,
  [class*="features__grid"],
  [class*="features__list"]
) img,
main :is(div, ul):has(> :is([class*="feature-card"], [class*="feature-item"], [class*="benefit"]):nth-child(3)) img {
  display: block !important;
  width: 82px !important;
  height: 82px !important;
  object-fit: contain !important;
  margin: 0 auto 14px !important;
}

/* ==============================
   حركة بسيطة واحترافية
============================== */

@keyframes alfayedFadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  main a[href*="/categories/"][href*="طبيع"]:has(img),
  main a[href*="/categories/"][href*="محسن"]:has(img) {
    animation: alfayedFadeUp 0.65s ease both;
    transition:
      transform 0.35s ease,
      box-shadow 0.35s ease;
  }

  main a[href*="/categories/"][href*="طبيع"] img,
  main a[href*="/categories/"][href*="محسن"] img {
    transition: transform 0.5s ease;
  }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  main a[href*="/categories/"][href*="طبيع"]:hover,
  main a[href*="/categories/"][href*="محسن"]:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 38px rgba(79, 28, 31, 0.16);
  }

  main a[href*="/categories/"][href*="طبيع"]:hover img,
  main a[href*="/categories/"][href*="محسن"]:hover img {
    transform: scale(1.045);
  }
}

/* الموبايل: يظل التصنيفان بجوار بعض */

@media (max-width: 640px) {
  main a[href*="/categories/"][href*="طبيع"]:has(img),
  main a[href*="/categories/"][href*="محسن"]:has(img) {
    border-radius: 15px !important;
  }

  main a[href*="/categories/"][href*="طبيع"]::after,
  main a[href*="/categories/"][href*="محسن"]::after {
    padding: 7px 10px;
    font-size: 13px;
  }
}
/* تموّج بسيط أعلى الفوتر */

footer {
  position: relative !important;
  margin-top: 60px !important;
  overflow: visible !important;
}

footer::before {
  content: "";
  position: absolute;
  top: -59px;
  right: 0;
  left: 0;
  width: 100%;
  height: 60px;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 120' preserveAspectRatio='none'%3E%3Cpath fill='%234F1C1F' d='M0,78 C240,25 480,25 720,68 C960,112 1200,105 1440,58 L1440,120 L0,120 Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: bottom center;
  background-size: 100% 100%;
}

/* تموّج أصغر على الهاتف */

@media (max-width: 640px) {
  footer {
    margin-top: 38px !important;
  }

  footer::before {
    top: -37px;
    height: 38px;
  }
}
/* توسيط عنوان قسم التصنيفات */

main :is(section, [section-id]):has(a[href*="/categories/"][href*="طبيع"]):has(a[href*="/categories/"][href*="محسن"]) :is(h1, h2, h3, .section-title) {
  display: block !important;
  width: 100% !important;
  margin: 0 auto 24px !important;
  text-align: center !important;
  color: #4f1c1f !important;
  font-weight: 700 !important;
}
/* توسيط الميزة الثالثة في الصف الثاني */

main .grid:has(> :nth-child(3):last-child) > :nth-child(3):last-child,
main [class*="grid-cols-2"]:has(> :nth-child(3):last-child) > :nth-child(3):last-child {
  grid-column: 1 / -1 !important;
  justify-self: center !important;
  width: min(100%, 280px) !important;
  margin-right: auto !important;
  margin-left: auto !important;
  text-align: center !important;
}
/* المميزات على الموبايل:
   ميزتان بالأعلى والثالثة في المنتصف */

@media (max-width: 1023px) {
  .grid.grid-cols-2:has(img[alt="دفع على راحتك"]):has(img[alt="تنوّع يليق بذوقك"]) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .grid.grid-cols-2:has(img[alt="دفع على راحتك"]):has(img[alt="تنوّع يليق بذوقك"]) > div:nth-child(3) {
    grid-column: 1 / -1 !important;
    justify-self: center !important;
    width: min(100%, 280px) !important;
    margin-inline: auto !important;
  }
}

/* الثلاث مميزات بجوار بعضها على الكمبيوتر فقط */

@media screen and (min-width: 768px) {
  body div.grid.grid-cols-2.gap-4.text-center[class~="lg:grid-cols-4"] {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    justify-items: center !important;
    align-items: start !important;
    column-gap: 40px !important;
    width: 100% !important;
  }

  body div.grid.grid-cols-2.gap-4.text-center[class~="lg:grid-cols-4"] > div {
    grid-column: auto !important;
    grid-row: auto !important;
    justify-self: center !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    text-align: center !important;
  }
}
/* توسيط قسم التصنيفات على الكمبيوتر فقط */

@media screen and (min-width: 768px) {
  body div.grid.grid-cols-2:has(a[href*="/categories/"]) {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 320px)) !important;
    justify-content: center !important;
    justify-items: stretch !important;
    gap: 24px !important;
    width: 100% !important;
    max-width: 760px !important;
    margin-right: auto !important;
    margin-left: auto !important;
  }

  body div.grid.grid-cols-2:has(a[href*="/categories/"]) > * {
    width: 100% !important;
    margin: 0 !important;
  }
}
/* بنرات الصور الرئيسية فقط */
main > section:not(:has(video)) > a,
main > section:not(:has(video)) > picture,
main > section:not(:has(video)) > .theme-container > a,
main > section:not(:has(video)) > .theme-container > picture {
    display: block !important;
    margin-bottom: 24px !important;
    border-radius: 14px !important;
    overflow: hidden !important;
}

/* الصورة داخل البنر */
main > section:not(:has(video)) > a img,
main > section:not(:has(video)) > picture img,
main > section:not(:has(video)) > .theme-container > a img,
main > section:not(:has(video)) > .theme-container > picture img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    border-radius: 14px !important;
}

/* بنرات المتجر العريضة فقط */
main img[src*="media.zid.store"][class*="w-full"]:not([class*="aspect-square"]):not([class*="aspect-[4/5]"]) {
    display: block !important;
    width: calc(100% - 32px) !important;
    max-width: 1200px !important;
    height: auto !important;

    margin: 28px auto !important;
    border-radius: 18px !important;
    overflow: hidden !important;

    object-fit: contain !important;
}

/* إلغاء أي قص أو حواف مربعة من العنصر المحيط */
main a:has(> img[src*="media.zid.store"][class*="w-full"]),
main picture:has(> img[src*="media.zid.store"][class*="w-full"]),
main div:has(> img[src*="media.zid.store"][class*="w-full"]) {
    border-radius: 18px !important;
    overflow: visible !important;
}

/* الهاتف */
@media (max-width: 768px) {
    main img[src*="media.zid.store"][class*="w-full"]:not([class*="aspect-square"]):not([class*="aspect-[4/5]"]) {
        width: calc(100% - 24px) !important;
        margin: 18px auto !important;
        border-radius: 12px !important;
    }
}