/* ==========================================================================
   المقال — الصفحة الرئيسية  (كل القواعد محصورة داخل .am-home و .am-bare)
   لا يغيّر أي شيء خارج الصفحة الرئيسية.
   ========================================================================== */

/* إزالة صندوق Jannah الأبيض حول بلوك الكود */
.am-bare .section-item,
.am-bare .mag-box,
.am-bare .container-wrapper,
.am-bare .mag-box-container,
.am-bare .entry {
  background: none !important; border: 0 !important; box-shadow: none !important;
  padding: 0 !important; margin-top: 0 !important; margin-bottom: 0 !important; border-radius: 0 !important;
}
.am-bare .mag-box-title, .am-bare .block-head-1, .am-bare .the-global-title { display: none !important; }

.am-home {
  --ink: #0b1b3a; --blue: #1456b8; --blue-d: #0c3a85; --blue-soft: #e9f0fc;
  --accent: #0ea5c6; --text: #4a5870; --muted: #5f6c82; --line: #e5e9f1; --bg: #f3f5fa;
  --card: #fff; --deep: #0b1b3a; --r: 18px; --shadow: 0 1px 2px rgba(11,27,58,.05), 0 8px 24px rgba(11,27,58,.07);
  --shadow-h: 0 2px 4px rgba(11,27,58,.06), 0 18px 40px rgba(11,27,58,.15);
  font-family: "Cairo", system-ui, sans-serif; color: var(--text); line-height: 1.8;
  padding: 8px 0 24px; border-top: 20px solid transparent; direction: rtl; text-align: right;
}
.am-home *, .am-home *::before, .am-home *::after { box-sizing: border-box; }
.am-home :where(h2, h3, h4, p, ol, ul, article, header, section, nav, aside) {
  margin: 0; padding: 0; border: 0; background: none; float: none; font-family: inherit; letter-spacing: 0;
}
.am-home a { color: inherit; text-decoration: none; border: 0; box-shadow: none; }
.am-home h2::before, .am-home h2::after, .am-home h3::before, .am-home h3::after { content: none; display: none; }
.am-home img { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; border-radius: 0; margin: 0; }
.am-ph { display: block; width: 100%; height: 100%; background: linear-gradient(135deg, var(--blue-d), var(--blue)); }

/* ---------- عناصر مشتركة ---------- */
.am-pill {
  display: inline-block; font-size: 12px; font-weight: 800; line-height: 1; padding: 7px 13px; border-radius: 999px;
  background: var(--blue-soft); color: var(--blue); transition: background .2s, color .2s;
}
.am-pill:hover { background: var(--blue); color: #fff; }
.am-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.am-meta i { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }
.am-by { color: var(--ink); font-weight: 800; }

.am-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.am-head h2 { font-size: 27px; font-weight: 900; color: var(--ink); line-height: 1.3; display: flex; align-items: center; gap: 12px; }
.am-head h2::before {
  content: "" !important; display: block !important; width: 6px; height: 28px; border-radius: 6px;
  background: linear-gradient(var(--accent), #67d8ee);
}
.am-head p { margin-top: 4px; font-size: 14px; color: var(--muted); padding-right: 18px; }
.am-all {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; color: var(--blue);
  padding: 9px 16px; border-radius: 999px; background: var(--blue-soft); white-space: nowrap; transition: all .25s;
}
.am-all svg { transition: transform .25s; }
.am-all:hover { background: var(--blue); color: #fff; }
.am-all:hover svg { transform: translateX(-4px); }

/* ---------- بطاقات تغطية الصورة ---------- */
.am-ov { position: relative; overflow: hidden; border-radius: var(--r); background: var(--deep); isolation: isolate; box-shadow: var(--shadow); }
.am-ov-media { position: absolute; inset: 0; z-index: -2; }
.am-ov-media img { transition: transform .9s cubic-bezier(.2,.7,.2,1); }
.am-ov:hover .am-ov-media img { transform: scale(1.06); }
.am-ov::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to top, rgba(6,14,32,.92) 0%, rgba(6,14,32,.55) 38%, rgba(6,14,32,0) 72%);
}
.am-ov-body { position: absolute; inset-inline: 0; bottom: 0; padding: 22px 24px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.am-ov .am-pill { background: var(--blue); color: #fff; box-shadow: 0 4px 14px rgba(20,86,184,.45); }
.am-ov .am-pill:hover { background: #fff; color: #0b1b3a; }
.am-ov h3 { font-weight: 900; line-height: 1.5; color: #fff; text-shadow: 0 2px 14px rgba(0,0,0,.35); }
.am-ov h3 a:hover { color: #cdeffa; }
.am-ov .am-meta { color: rgba(255,255,255,.78); }
.am-ov .am-by { color: #fff; }

/* ---------- الهيرو ---------- */
.am-hero { display: grid; grid-template-columns: 1.7fr 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 14px; height: 560px; margin-bottom: 26px; }
.am-hero .is-main { grid-row: 1 / 3; }
.am-hero .is-main h3 { font-size: 31px; }
.am-hero .is-main .am-ov-body { padding: 32px; gap: 14px; }
.am-hero .is-sm h3 { font-size: 16.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.am-hero .is-sm .am-ov-body { padding: 16px 18px; gap: 8px; }
.am-hero .is-sm .am-by, .am-hero .is-sm .am-meta i:first-of-type { display: none; }

/* ---------- شريط التصنيفات ---------- */
.am-chips { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 28px; }
.am-chips a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 16px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink); transition: all .25s; box-shadow: 0 1px 2px rgba(11,27,58,.04);
}
.am-chips b { font-size: 14px; font-weight: 800; }
.am-chips small { font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--bg); padding: 2px 9px; border-radius: 999px; }
.am-chips a:hover { background: var(--blue); border-color: var(--blue); color: #fff; transform: translateY(-2px); box-shadow: 0 8px 18px rgba(20,86,184,.28); }
.am-chips a:hover small { background: rgba(255,255,255,.2); color: #fff; }

/* ---------- التخطيط: آخر المقالات + الشريط الجانبي ---------- */
.am-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 36px; align-items: start; margin-bottom: 64px; }
.am-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.am-card {
  display: flex; flex-direction: column; background: var(--card); border-radius: var(--r); overflow: hidden;
  border: 1px solid var(--line); transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .35s;
}
.am-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-h); }
.am-card-media { display: block; aspect-ratio: 16 / 10; overflow: hidden; }
.am-card-media img { transition: transform .8s cubic-bezier(.2,.7,.2,1); }
.am-card:hover .am-card-media img { transform: scale(1.07); }
.am-card-body { padding: 20px 22px 18px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; flex: 1; }
.am-card h3 { font-size: 19px; font-weight: 800; line-height: 1.6; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.am-card h3 a:hover { color: var(--blue); }
.am-card p { font-size: 14.5px; line-height: 1.9; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.am-card .am-meta { margin-top: auto; padding-top: 14px; width: 100%; border-top: 1px dashed var(--line); }
.am-more { text-align: center; margin-top: 34px; }
.am-btn {
  display: inline-block; padding: 14px 38px; border-radius: 999px; font-weight: 900; font-size: 15.5px;
  background: var(--deep); color: #fff !important; transition: all .3s;
}
.am-btn:hover { background: var(--blue); transform: translateY(-3px); box-shadow: 0 12px 26px rgba(20,86,184,.35); }

/* ---------- الشريط الجانبي ---------- */
.am-side { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 24px; }
.am-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; }
.am-box-t { font-size: 20px; font-weight: 900; color: var(--ink); margin-bottom: 14px !important; display: flex; align-items: center; gap: 10px; }
.am-box-t::before { content: "" !important; display: block !important; width: 5px; height: 20px; border-radius: 5px; background: var(--accent); }
.am-pop { list-style: none; counter-reset: pop; }
.am-pop li { counter-increment: pop; display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--line); }
.am-pop li:first-child { border-top: 0; padding-top: 4px; }
.am-pop li::before {
  content: counter(pop); flex: none; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center;
  font-size: 17px; font-weight: 900; background: var(--blue-soft); color: var(--blue);
}
.am-pop li:nth-child(-n+3)::before { background: var(--blue); color: #fff; }
.am-pop a { font-size: 15px; font-weight: 800; line-height: 1.7; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.am-pop a:hover { color: var(--blue); }

.am-news { background: linear-gradient(145deg, var(--deep), var(--blue-d)); border: 0; color: #dbe6fb; }
.am-news .am-box-t { color: #fff; }
.am-news p { font-size: 14.5px; margin-bottom: 16px; color: #c7d6f3; }
.am-news form { margin: 0; }
.am-news input[type="email"], .am-news input[type="text"] {
  width: 100%; height: 48px; border-radius: 12px; border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.1);
  color: #fff; padding: 0 16px; margin-bottom: 10px; font-family: inherit; font-size: 15px;
}
.am-news input::placeholder { color: rgba(255,255,255,.65); }
.am-news input[type="submit"], .am-news button {
  width: 100%; height: 48px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 900; font-size: 15.5px;
  font-family: inherit; cursor: pointer; transition: all .25s;
}
.am-news input[type="submit"]:hover, .am-news button:hover { background: #fff; color: #0b1b3a; }
.am-news label, .am-news .tnp-field-label { color: #c7d6f3; font-size: 13px; }
.am-news .tnp-field { margin-bottom: 0; }

/* ---------- أقسام التصنيفات ---------- */
.am-cat { margin-bottom: 64px; }
.am-cat .is-feat { min-height: 430px; }
.am-cat .is-feat h3 { font-size: 26px; }
.am-cat .is-feat .am-ov-body { padding: 28px; gap: 12px; }
.am-rows { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 22px; }
.am-row { display: grid; grid-template-columns: 104px 1fr; gap: 16px; align-items: center; padding: 15px 0; border-top: 1px solid var(--line); flex: 1; }
.am-row:first-child { border-top: 0; }
.am-row-media { display: block; width: 104px; height: 78px; border-radius: 12px; overflow: hidden; }
.am-row-media img { transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.am-row:hover .am-row-media img { transform: scale(1.1); }
.am-row h4 { font-size: 16px; font-weight: 800; line-height: 1.65; color: var(--ink); margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.am-row h4 a:hover { color: var(--blue); }

/* ---------- الجوال والتابلت ---------- */
@media (max-width: 900px) {
  .am-hero { height: auto; grid-template-columns: 1fr 1fr; grid-template-rows: 420px 220px 220px; }
  .am-hero .is-main { grid-column: 1 / 3; grid-row: 1; }
  .am-hero .is-main h3 { font-size: 25px; }
  .am-cat-grid,   .am-cat .is-feat { min-height: 340px; }
}
@media (max-width: 640px) {
  .am-home { padding-top: 0; }
  .am-hero { grid-template-rows: 340px 200px 200px; gap: 10px; }
  .am-hero .is-main .am-ov-body { padding: 20px; }
  .am-hero .is-main h3 { font-size: 21px; }
  .am-hero .is-sm h3 { font-size: 14.5px; -webkit-line-clamp: 3; }
  .am-hero .is-sm .am-ov-body { padding: 12px 14px; }
  .am-head h2 { font-size: 22px; }
  .am-head p { display: none; }
  .am-cards { grid-template-columns: 1fr; gap: 18px; }
  .am-side { grid-template-columns: 1fr; }
  .am-layout, .am-cat { margin-bottom: 44px; }
  .am-rows { padding: 4px 16px; }
  .am-row { grid-template-columns: 88px 1fr; gap: 12px; }
  .am-row-media { width: 88px; height: 68px; }
}
@media (prefers-reduced-motion: reduce) { .am-home * { transition: none !important; } }

/* ---------- الضغط على أي مكان في البطاقة يفتح المقال ---------- */
.am-card, .am-row { position: relative; }
.am-ov h3 a::after, .am-card h3 a::after, .am-row h4 a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.am-pill { position: relative; z-index: 3; }
.am-card-media, .am-ov-media, .am-row-media { cursor: pointer; }

/* ---------- نسخة أكثر كثافة ---------- */
.am-home { padding-top: 0; }
.am-hero { height: 440px; gap: 12px; margin-bottom: 20px; }
.am-hero .is-main h3 { font-size: 26px; }
.am-hero .is-main .am-ov-body { padding: 26px; gap: 10px; }
.am-hero .is-sm h3 { font-size: 15px; }
.am-hero .is-sm .am-ov-body { padding: 14px 16px; gap: 7px; }
.am-head { margin-bottom: 16px; }
.am-head h2 { font-size: 23px; }
.am-head h2::before { height: 24px; }
.am-layout { grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; margin-bottom: 44px; }
.am-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.am-card-media { aspect-ratio: 16 / 9.5; }
.am-card-body { padding: 14px 16px 14px; gap: 8px; }
.am-card h3 { font-size: 16.5px; line-height: 1.6; }
.am-card p { font-size: 13.5px; line-height: 1.8; -webkit-line-clamp: 2; }
.am-card .am-meta { padding-top: 10px; font-size: 12px; }
.am-more { margin-top: 26px; }
.am-box { padding: 18px 20px; }
.am-box-t { font-size: 18px; margin-bottom: 8px !important; }
.am-pop li { padding: 10px 0; gap: 12px; }
.am-pop li::before { width: 30px; height: 30px; border-radius: 10px; font-size: 14.5px; }
.am-pop a { font-size: 14px; line-height: 1.65; -webkit-line-clamp: 2; }

/* أقسام التصنيفات: 3 في الصف */
.am-cats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.am-cat { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.am-cat .am-head { margin: 0; }
.am-cat .am-head h2 { font-size: 20px; }
.am-cat .am-head h2::before { height: 20px; width: 5px; }
.am-cat .am-all { padding: 6px 12px; font-size: 12.5px; }
.am-cat .is-feat { min-height: 0; height: 190px; box-shadow: none; border-radius: 14px; }
.am-cat .is-feat h3 { font-size: 16px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.am-cat .is-feat .am-ov-body { padding: 14px 16px; gap: 7px; }
.am-cat .is-feat .am-by, .am-cat .is-feat .am-meta i:first-of-type { display: none; }
.am-rows { background: none; border: 0; padding: 0; display: flex; flex-direction: column; }
.am-row { grid-template-columns: 76px 1fr; gap: 12px; padding: 10px 0; }
.am-row-media { width: 76px; height: 56px; border-radius: 10px; }
.am-row h4 { font-size: 14px; line-height: 1.6; margin-bottom: 2px; }
.am-row .am-meta { font-size: 11.5px; }

/* صفحة آخر المقالات */
.am-latest .am-cards-3 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.am-pager ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; list-style: none; margin: 34px 0 0; padding: 0; }
.am-pager li { margin: 0; }
.am-pager a, .am-pager span { display: grid; place-items: center; min-width: 42px; height: 42px; padding: 0 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-weight: 800; color: var(--ink); transition: all .2s; }
.am-pager a:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
.am-pager .current { background: var(--deep); color: #fff; border-color: var(--deep); }
.am-pager .dots { background: none; border: 0; }

@media (max-width: 1100px) {
  .am-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .am-latest .am-cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .am-layout { grid-template-columns: minmax(0, 1fr); }
  .am-side { position: static; display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .am-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .am-hero { height: auto; grid-template-columns: 1fr 1fr; grid-template-rows: 340px 190px 190px; }
  .am-hero .is-main { grid-column: 1 / 3; grid-row: 1; }
  .am-latest .am-cards-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .am-hero { grid-template-rows: 300px 180px 180px; gap: 10px; }
  .am-hero .is-main h3 { font-size: 20px; }
  .am-chips { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding: 2px 16px 10px; scrollbar-width: none; }
  .am-chips::-webkit-scrollbar { display: none; }
  .am-chips a { flex: none; }
  .am-side { grid-template-columns: 1fr; }
  .am-cards, .am-latest .am-cards-3 { grid-template-columns: 1fr; gap: 16px; }
  .am-cats { grid-template-columns: 1fr; }
  .am-pop li:nth-child(n+6) { display: none; }
}

@media (max-width: 1000px) { .am-chips { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .am-chips { display: flex; }
  .am-chips a { justify-content: flex-start; }
}

/* ---------- الوضع الليلي (Jannah: .dark-skin) ---------- */
.dark-skin .am-home {
  --ink: #eaf1ff; --text: #b4c1da; --muted: #8493b0; --line: #253452; --bg: #0f1830; --card: #121d36;
  --blue-soft: #19305c; --blue: #3b82f6; --blue-d: #1d4fb0; --deep: #0a1226;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  --shadow-h: 0 2px 4px rgba(0,0,0,.4), 0 18px 40px rgba(0,0,0,.55);
}
.dark-skin .am-pill { color: #9ec5ff; }
.dark-skin .am-ov .am-pill { color: #fff; }
.dark-skin .am-pill:hover, .dark-skin .am-all:hover, .dark-skin .am-chips a:hover { color: #fff; }
.dark-skin .am-all { color: #9ec5ff; }
.dark-skin .am-chips a { box-shadow: none; }
.dark-skin .am-card:hover, .dark-skin .am-chips a:hover { box-shadow: var(--shadow-h); }
.dark-skin .am-pop li::before { color: #9ec5ff; }
.dark-skin .am-pop li:nth-child(-n+3)::before { color: #fff; }
.dark-skin .am-pop a:hover, .dark-skin .am-card h3 a:hover, .dark-skin .am-row h4 a:hover { color: #7fb3ff; }
.dark-skin .am-btn { background: var(--blue); }
.dark-skin .am-btn:hover { background: #fff; color: #0b1b3a !important; box-shadow: none; }
.dark-skin .am-pager .current { background: var(--blue); border-color: var(--blue); }
.dark-skin .am-news { background: linear-gradient(145deg, #0a1226, #123a80); border: 1px solid #1d3466; }
.dark-skin .am-ph { background: linear-gradient(135deg, #123a80, #1d5ad0); }
.dark-skin .am-bare .container-wrapper, .dark-skin .am-bare .entry { background: none !important; }

/* شريط التصنيفات: للأجهزة العريضة فقط، يُخفى على الجوال */
@media (max-width: 640px) { .am-chips { display: none !important; } }
