/* ==========================================================================
   Green Door — Work card component  (.gd-work-card)
   "باب كامل": قوس فاطمي بلون البراند + طبق نجمي خفيف + ميدالية مثمنة
   + إفريز نجوم متشابكة في آخر الكارد.

   الـ component مسؤول عن الشكل بس. لون البراند بييجي من الكارد نفسه،
   وباقي الألوان من الـ section (وفيه fallbacks من الـ palette).
   ==========================================================================

   الـ API:
     --brand            لون البراند (على كل كارد)          fallback: #5E8C7F
     --brand-mute       نسبة تهدية لون البراند بالرملي       default: 15%
     --card-surface     خلفية الـ body                       fallback: #F4EFE6
     --card-ink         لون العنوان والوصف                   fallback: #3A5E54
     --card-muted       لون الاسم اللاتيني والمنصات          fallback: #5E8C7F
     --card-accent      لون التصنيف (tag)                    fallback: #8C6A2E
     --card-sand        الرملي (حلقة الميدالية + النجمة)      fallback: #C9A66B
     --head-pattern     وضوح باترن الهيدر                    default: 0.16
     --frieze-opacity   وضوح الإفريز                         default: 0.6

   الملفات المطلوبة (المسارات هنا relative لمكان الملف: css/components/):
     ../../assets/ornaments/gd-arch-mask.svg
     ../../assets/ornaments/gd-arch-line.svg
     ../../assets/patterns/gd-pattern-tabaq.svg
     ../../assets/patterns/gd-frieze-tabaq.svg
   ========================================================================== */

.gd-work-card {
  --_brand:   color-mix(in srgb, var(--brand, #5E8C7F), #C9A66B var(--brand-mute, 15%));
  --_surface: var(--card-surface, #F4EFE6);
  --_ink:     var(--card-ink, #3A5E54);
  --_muted:   var(--card-muted, #5E8C7F);
  --_accent:  var(--card-accent, #8C6A2E);
  --_sand:    var(--card-sand, #C9A66B);

  --_seal:   80px;

  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 380px;
  margin: 0;
}

/* ---------- Head: the arch ---------- */
.gd-work-card__head {
  position: relative;
  aspect-ratio: 2 / 1;          /* القوس بيكبر مع عرض الكارد من غير ما يتفلطح */
  max-height: 200px;
  background: var(--_brand);
  /* الـ mask مضمّن data URI: المتصفح بيمنع mask بصورة خارجية لو الصفحة اتفتحت من file://
     (المصدر: assets/ornaments/gd-arch-mask.svg) */
  --_arch-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='340' height='170' viewBox='0 0 340 170' preserveAspectRatio='none'%3E%3Cpath d='M0,170 L0,78 C0,46 96,32 170,2 C244,32 340,46 340,78 L340,170 Z' fill='%23000'/%3E%3C/svg%3E");
  -webkit-mask: var(--_arch-mask) center / 100% 100% no-repeat;
          mask: var(--_arch-mask) center / 100% 100% no-repeat;
}

/* الطبق النجمي — بيختفي تدريجياً عند الميدالية */
.gd-work-card__head::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../../assets/patterns/gd-pattern-tabaq.svg") 0 0 / 34px 34px repeat;
  opacity: var(--head-pattern, 0.16);
  -webkit-mask-image: radial-gradient(ellipse 70% 120% at 50% 100%, transparent 22%, #000 85%);
          mask-image: radial-gradient(ellipse 70% 120% at 50% 100%, transparent 22%, #000 85%);
}

/* إطار القوس الداخلي */
.gd-work-card__head::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../../assets/ornaments/gd-arch-line.svg") center / 100% 100% no-repeat;
}

/* ---------- Seal: octagon medallion on the arch's base ----------
   (أول عنصر جوه الـ body، وبيطلع لفوق على حد القوس) */
.gd-work-card__seal {
  --_oct: polygon(29.29% 0, 70.71% 0, 100% 29.29%, 100% 70.71%,
                  70.71% 100%, 29.29% 100%, 0 70.71%, 0 29.29%);
  position: absolute;
  z-index: 1;
  top: calc(var(--_seal) * -0.725);
  left: 50%;
  translate: -50% 0;
  width: var(--_seal);
  height: var(--_seal);
  display: grid;
  place-items: center;
  background: var(--_surface);          /* الحلقة الكريمي */
  clip-path: var(--_oct);
}
.gd-work-card__seal::before,
.gd-work-card__seal::after {
  content: "";
  position: absolute;
  clip-path: var(--_oct);
}
.gd-work-card__seal::before { inset: 4px;   background: var(--_sand); }   /* خط رملي */
.gd-work-card__seal::after  { inset: 5.2px; background: var(--_brand); }  /* لون البراند */

.gd-work-card__seal > img,
.gd-work-card__seal > svg {
  position: relative;
  z-index: 1;
  width: 44%;
  height: 44%;
  object-fit: contain;
}
/* لوجو حقيقي ملوّن (PNG شفاف) بدل الأيقونة البيضا */
.gd-work-card__seal--logo > img {
  width: 56%;
  height: 56%;
}

/* ---------- Body ---------- */
.gd-work-card__body {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: calc(var(--_seal) * 0.7) 24px 0;
  background: var(--_surface);
  color: var(--_ink);
}

.gd-work-card__tag {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--_accent);
}

.gd-work-card__title {
  margin: 0.5rem 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.625rem;
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--_ink);
}
.gd-work-card__title small {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--_muted);
}

.gd-work-card__desc {
  margin: 0.625rem 0 0;
  font-size: 1rem;
  line-height: 1.8;
  text-wrap: pretty;
}

/* المنصات: Android ✦ iOS */
.gd-work-card__platforms {
  margin: auto 0 0;            /* بيلزق تحت لو الكروت مختلفة الطول */
  padding: 0.875rem 0 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--_muted);
}
.gd-work-card__platforms li { display: flex; align-items: center; gap: 0.625rem; }
.gd-work-card__platforms li + li::before {
  content: "";
  width: 9px;
  height: 9px;
  background: var(--_sand);
  clip-path: polygon(50% 0, 64.64% 14.64%, 85.36% 14.64%, 85.36% 35.36%, 100% 50%,
                     85.36% 64.64%, 85.36% 85.36%, 64.64% 85.36%, 50% 100%,
                     35.36% 85.36%, 14.64% 85.36%, 14.64% 64.64%, 0 50%,
                     14.64% 35.36%, 14.64% 14.64%, 35.36% 14.64%);
}

/* الإفريز: نص النجوم المتشابكة على حافة الكارد بالظبط */
.gd-work-card__body::after {
  content: "";
  display: block;
  height: 17px;
  margin: 1.25rem -24px 0;
  background: url("../../assets/patterns/gd-frieze-tabaq.svg") center bottom / 22px 17px repeat-x;
  opacity: var(--frieze-opacity, 0.6);
}

/* ---------- Grid helper للسكشن ---------- */
.gd-work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 2.5rem 2rem;
  justify-items: center;
  align-items: stretch;
}

.gd-work-card__platforms a { color: inherit; text-decoration: none; }
.gd-work-card__platforms a:hover { text-decoration: underline; }
