/* ============================================================
   المركز العراقي لتوثيق الجرائم — صفحة النشاطات (الأخبار)
   Activities page — news section, featured story, cards grid, pagination
   ------------------------------------------------------------
   يبني هذا الملف على style.css ولا يعدّله:
   مكوّن بطاقة الخبر (.news-card) معرّف هناك ويُستخدم أيضاً في الصفحة
   الرئيسية، لذا كل تحسينات هذه الصفحة محصورة داخل `.act-news`
   حتى لا تتأثر بطاقات الصفحة الرئيسية.

   Builds on style.css without touching it: the .news-card component
   lives there and is shared with the home page, so every override
   below is scoped to `.act-news` and cannot leak.

   الاتجاه: نستخدم الخصائص المنطقية (inset-inline / margin-inline /
   text-align: start) فيعمل التخطيط في RTL و LTR دون تكرار القواعد.
   Direction: logical properties throughout, so RTL and LTR both work
   from one rule set.
   ============================================================ */

.act-news {
  /* مقاسات موحّدة للصفحة */
  --act-max: 87.5rem;
  --act-gutter: clamp(1.25rem, 4vw, 3.5rem);
  --act-radius: 1rem;
  --act-radius-sm: 0.75rem;
  --act-ring: rgba(180, 146, 88, .28);

  position: relative;
  /* الترويسة والشريط العلوي كلاهما fixed، فنعوّض ارتفاعهما هنا
     لأن هذا القسم أصبح أول عنصر في الصفحة. */
  padding-top: calc(var(--pm-subnav-h) + var(--header-h) + 2.75rem);
  padding-bottom: clamp(3.5rem, 6vw, 6rem);
  /* خلفية ورقية فاتحة تُبرز البطاقات البيضاء */
  background: var(--bg);
  scroll-margin-top: calc(var(--pm-subnav-h) + var(--header-h));
}

.act-news__inner {
  max-width: var(--act-max);
  margin: 0 auto;
  padding-inline: var(--act-gutter);
}

/* ============================================================
   SECTION HEAD — عنوان القسم
   ============================================================ */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.875rem 1.5rem;
  margin-bottom: clamp(1.625rem, 3vw, 2.5rem);
}

.section-head__title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  font-size: clamp(1.4375rem, 2.6vw, 2.125rem);
  font-weight: 900;
  line-height: 1.35;
  letter-spacing: -0.025rem;
  color: var(--primary-dark);
}

/* الشريط الذهبي قبل العنوان — يتبع جهة القراءة تلقائياً */
.section-head__title::before {
  content: "";
  flex: 0 0 auto;
  width: 0.375rem;
  height: 1.875rem;
  border-radius: 0.25rem;
  background: linear-gradient(180deg, var(--accent), var(--primary));
}

.section-head__desc {
  margin: 0.625rem 0 0;
  font-size: 0.90625rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

/* ============================================================
   GRID — شبكة البطاقات
   ============================================================ */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19.375rem, 1fr));
  gap: clamp(1.25rem, 2.2vw, 1.875rem);
  align-items: stretch;
}

/* ============================================================
   NEWS CARD — تحسينات محصورة بهذه الصفحة
   ============================================================ */
.act-news .news-card {
  display: flex;
  height: 100%;
  border: 0.0625rem solid var(--border-color1);
  border-radius: var(--act-radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow:
    0 0.0625rem 0.125rem rgba(42, 62, 5, .04),
    0 0.875rem 2.125rem -1.5rem rgba(42, 62, 5, .38);
  transition:
    transform .4s var(--ease),
    box-shadow .4s var(--ease),
    border-color .4s var(--ease);
}

.act-news .news-card:hover,
.act-news .news-card:focus-within {
  transform: translateY(-0.375rem);
  border-color: var(--act-ring);
  box-shadow:
    0 0.0625rem 0.125rem rgba(42, 62, 5, .04),
    0 1.625rem 3rem -1.625rem rgba(42, 62, 5, .46);
}

.act-news .news-card-link {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  text-align: start;
}

.act-news .news-card-link:focus-visible {
  outline: 0.125rem solid var(--primary);
  outline-offset: -0.1875rem;
  border-radius: var(--act-radius);
}

/* ---------- الصورة ---------- */
.act-news .news-card-top {
  position: relative;
  height: auto;              /* بدل الارتفاع الثابت في style.css */
  aspect-ratio: 16 / 10;     /* نسبة ثابتة ⇒ شبكة منتظمة */
  margin: 0.5625rem 0.5625rem 0;         /* إطار داخلي يُظهر الحواف المستديرة */
  border-radius: var(--act-radius-sm);
  overflow: hidden;
  background: var(--surface-alt);
  flex: 0 0 auto;
}

.act-news .news-card-top img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform .7s var(--ease);
}

.act-news .news-card:hover .news-card-top img { transform: scale(1.07); }

/* ---------- الشارة ---------- */
/* style.css يثبّتها بـ right: 12px (خاصية فيزيائية) فتبقى يميناً حتى في LTR.
   نستبدلها بخاصية منطقية فتلتصق دائماً بزاوية بداية القراءة:
   يمين الصورة في العربية، ويسارها في الإنجليزية — تماماً كشارة الخبر الأبرز. */
.act-news .news-badge {
  inset-block-start: 0.875rem;
  inset-inline-start: 0.875rem;
  inset-inline-end: auto;
  padding: 0.3125rem 0.8125rem;
  border-radius: 62.4375rem;
  font-size: 0.71875rem;
  font-weight: 700;
  letter-spacing: .01em;
  background: rgba(42, 62, 5, .9);
  backdrop-filter: blur(0.375rem);
  box-shadow: 0 0.25rem 0.875rem -0.375rem rgba(30, 30, 30, .6);
}

/* ---------- النص ---------- */
.act-news .news-card-bottom {
  flex: 1 1 auto;
  padding: 1.125rem 1.25rem 1rem;
  background: transparent;
  text-align: start;
}

/* style.css يرفع النص عند المرور لكشف الشريط السفلي؛
   هنا الشريط ثابت في مكانه فنلغي الإزاحة حتى لا يُقصّ الوصف. */
.act-news .news-card:hover .news-card-bottom { transform: none; }

.act-news .news-card-meta {
  margin-bottom: 0.75rem;
  font-size: 0.78125rem;
  color: var(--secondary);
}

.act-news .news-card-date { letter-spacing: .01em; }

.act-news .news-card-title {
  margin: 0 0 0.625rem;
  font-size: clamp(1.03125rem, 1.35vw, 1.15625rem);
  font-weight: 800;
  line-height: 1.7;
  letter-spacing: -0.0125rem;
  color: var(--primary-dark);
  -webkit-line-clamp: 2;
  /* سطران محجوزان دائماً ⇒ العناوين والأوصاف تتحاذى عبر الشبكة */
  min-height: calc(2 * 1.7em);
  transition: color .3s var(--ease);
}

.act-news .news-card:hover .news-card-title { color: var(--primary); }

.act-news .news-card-desc {
  margin: 0;
  font-size: 0.875rem;
  line-height: 2;
  color: var(--text-secondary);
  -webkit-line-clamp: 3;
}

/* ---------- شريط "اقرأ المزيد" ---------- */
/* في style.css هو طبقة مخفية تظهر بالمرور؛ هنا نجعله تذييلاً ثابتاً
   للبطاقة: أوضح للمستخدم ولا يغطّي نصّ الوصف. */
.act-news .news-card-reveal {
  position: static;
  transform: none;
  height: auto;
  margin-top: auto;
  padding: 0.8125rem 1.25rem;
  border-top: 0.0625rem solid var(--border-color1);
  background: transparent;
  transition: background .35s var(--ease), border-color .35s var(--ease);
}

.act-news .news-reveal-text {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--primary);
  transition: color .35s var(--ease);
}

.act-news .news-card-reveal svg {
  width: 0.9375rem;
  height: 0.9375rem;
  stroke: var(--primary);
  /* لا ننتقل على transform: قلب السهم عند تبديل اللغة يجب أن يكون فورياً */
  transition: stroke .35s var(--ease);
}

.act-news .news-card:hover .news-card-reveal {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.act-news .news-card:hover .news-reveal-text { color: #fff; }
.act-news .news-card:hover .news-card-reveal svg { stroke: #fff; }

/* ---------- لمعة خفيفة تمرّ على البطاقة عند المرور ---------- */
.act-news .news-card-shine {
  inset-inline-start: -100%;
  transition: none;
}

.act-news .news-card:hover .news-card-shine {
  animation: act-shine .9s var(--ease) 1;
}

@keyframes act-shine {
  from { transform: translateX(0); opacity: 0; }
  30%  { opacity: 1; }
  to   { transform: translateX(260%); opacity: 0; }
}

/* ============================================================
   PAGINATION — ترقيم الصفحات
   ============================================================ */
.act-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: clamp(2.25rem, 4vw, 3.5rem);
}

.act-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4375rem;
  min-width: 2.75rem;
  height: 2.75rem;
  padding-inline: 0.875rem;
  border: 0.0625rem solid var(--border-color1);
  border-radius: var(--act-radius-sm);
  background: var(--surface);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition:
    background .3s var(--ease),
    color .3s var(--ease),
    border-color .3s var(--ease),
    transform .3s var(--ease);
}

.act-page:hover {
  transform: translateY(-0.125rem);
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.act-page.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  cursor: default;
  transform: none;
}

.act-page.is-disabled {
  opacity: .45;
  pointer-events: none;
}

.act-page svg {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}

/* ============================================================
   DIRECTION — الأسهم تتبع جهة القراءة
   ------------------------------------------------------------
   أيقونات السهم مرسومة باتجاه RTL في الـ HTML، فنعكسها في LTR فقط.
   The chevrons are authored for RTL, so mirror them in LTR only.
   ============================================================ */
html[dir="ltr"] .act-news .section-head__link svg,
html[dir="ltr"] .act-news .news-card-reveal svg,
html[dir="ltr"] .act-pagination .act-page__arrow svg {
  transform: scaleX(-1);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .news-grid { grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr)); }
}

@media (max-width: 640px) {
  .act-news {
    padding-top: calc(var(--pm-subnav-h) + var(--header-h) + 1.625rem);
    background: var(--bg-body);
  }

  .section-head { align-items: flex-start; }
  .section-head__title { font-size: 1.375rem; }
  .section-head__title::before { height: 1.5rem; width: 0.3125rem; }

  .news-grid { grid-template-columns: 1fr; }

  .act-news .news-card-top { aspect-ratio: 16 / 9; }
  .act-news .news-card-title { font-size: 1.03125rem; }

  .act-page { min-width: 2.5rem; height: 2.5rem; padding-inline: 0.6875rem; font-size: 0.84375rem; }
}

/* ============================================================
   تفضيل تقليل الحركة
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .act-news .news-card,
  .act-news .news-card-top img,
  .news-featured,
  .news-featured__media img,
  .act-page {
    transition: none;
  }

  .act-news .news-card:hover,
  .act-news .news-card:focus-within,
  .news-featured:hover,
  .act-page:hover { transform: none; }

  .act-news .news-card:hover .news-card-top img,
  .news-featured:hover .news-featured__media img { transform: none; }

  .act-news .news-card:hover .news-card-shine { animation: none; }
}
