/* ============================================================
   نيوز فيد — قصص متطوّرة · «الملفّ المفتوح»
   منقولٌ عن لوح فيغما (أ — الملفّ) رقماً رقماً.

   القسم داخل العمود الرئيس بجانب الشريط الجانبي — عرضه ٩٨٠px.
   ولون كل ملفّ يأتي من القاعدة عبر --fc على العنصر نفسه، فالورقة
   لا تعرف الألوان الخمسة ولا تحتاج أن تعرفها.
   ============================================================ */

.nfe { margin: 0 0 var(--nf-section-gap, 38px); }

/* ---- الشريط: نسخة أشرطة الأقسام ---- */
.nfe-rail { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.nfe-rail-mark { flex: none; width: 4px; height: 19px; border-radius: 2px; background: var(--accent, #5B7F3B); }
.nfe-rail-title {
  margin: 0; font-family: inherit;
  font-size: var(--nf-rail-title, 17px); font-weight: 800; line-height: 1.5;
  color: var(--text, #2C2416); white-space: nowrap;
}
.nfe-rail-rule { flex: 1 1 auto; min-width: 12px; height: 1px; background: var(--border, #E7E1D4); }
.nfe-rail-note { font-size: 11.5px; font-weight: 600; color: var(--muted-2, #968B78); white-space: nowrap; }
.nfe-rail-note b { color: var(--text-2, #4A4030); font-weight: 800; }
.nfe-rail-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 800; color: var(--accent-2, #3D5A28);
  text-decoration: none; white-space: nowrap; padding: 4px 2px; border-radius: 8px;
}
.nfe-rail-link svg { opacity: .6; }

/* ---- الجسم ---- */
.nfe-body { display: grid; grid-template-columns: minmax(0, 1fr) 266px; gap: 16px; align-items: stretch; }

/* لون الملفّ للنصّ في الداكن: ألوان القاعدة فيها البنّي #7C2D12
   والرمادي #475569 — تعمل على الورق وتختفي على سطحٍ داكن. النصّ
   يأخذ مشتقّاً مفتوحاً، والعلامات الصلبة تبقى على اللون الأصلي. */
.nfe-open, .nfe-side, .nfe-sw, .nfe-cross { --fc-txt: var(--fc, #3D5A28); }
[data-theme="dark"] .nfe-open, [data-theme="dark"] .nfe-side,
[data-theme="dark"] .nfe-sw,   [data-theme="dark"] .nfe-cross,
[data-theme="auto"] .nfe-open, [data-theme="auto"] .nfe-side,
[data-theme="auto"] .nfe-sw,   [data-theme="auto"] .nfe-cross {
  --fc-txt: color-mix(in srgb, var(--fc, #3D5A28) 42%, #E9E5DA);
}

.nfe-open {
  position: relative; overflow: hidden;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #E7E1D4);
  border-radius: var(--radius-lg, 18px);
  padding: 0 22px 16px;
}
.nfe-edge { position: absolute; inset-inline: 0; top: 0; height: 3px; background: var(--fc-txt); }

/* ---- الرأس الطباعي ---- */
.nfe-head { padding: 19px 0 13px; }
.nfe-kick { display: flex; align-items: center; gap: 9px; margin: 0 0 7px; font-size: 11.5px; font-weight: 800; color: var(--muted, #7A6E5D); }
.nfe-kick-sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .5; }
.nfe-live { display: inline-flex; align-items: center; gap: 6px; color: var(--red, #CE1126); }
.nfe-live i { width: 6.5px; height: 6.5px; border-radius: 50%; background: currentColor; flex: none; }
.nfe-name { margin: 0; font-family: inherit; font-size: 28px; font-weight: 900; line-height: 1.3; color: var(--text, #2C2416); }
.nfe-lede { margin: 6px 0 0; max-width: 62ch; font-size: 14px; line-height: 1.8; color: var(--text-2, #4A4030); }

/* ---- حياة الملفّ: ١٤٠ يوماً ---- */
.nfe-life { margin-bottom: 4px; }
.nfe-pins { position: relative; height: 18px; }
.nfe-pin {
  position: absolute; bottom: 0; transform: translateX(50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--surface, #fff); border: 1.5px solid var(--border-2, #D7CEBC);
}
.nfe-pin b { font-size: 9px; font-weight: 900; color: var(--muted, #7A6E5D); }
.nfe-pin.is-now { background: var(--fc, #3D5A28); border-color: var(--fc, #3D5A28); }
.nfe-pin.is-now b { color: #fff; }
/* الرسم SVG: مئةٌ وأربعون عموداً في عقدةٍ واحدة بدل مئةٍ وأربعين
   عنصراً في DOM، وتتمدّد بلا حساب عرضٍ في CSS. */
.nfe-bars { display: block; width: 100%; height: 42px; fill: var(--fc-txt); }
.nfe-b0 { fill: var(--border-2, #D7CEBC); }

/* ---- الشريط تفاعليّ: يقول ما في اليوم، ويفتح تقاريره ---- */
.nfe-chart { position: relative; display: block; border-radius: 4px; }
.nfe-chart:focus-visible { outline: 2px solid var(--fc-txt); outline-offset: 4px; }
.nfe-chart.has-day { cursor: pointer; }
.nfe-cursor {
  position: absolute; top: 0; bottom: 0; width: 1px; transform: translateX(-50%);
  background: var(--fc-txt); opacity: .55; pointer-events: none;
}
.nfe-tip {
  position: absolute; bottom: calc(100% + 7px); transform: translateX(-50%);
  padding: 5px 10px; border-radius: 8px; white-space: nowrap; pointer-events: none;
  font-size: 11px; font-weight: 700; line-height: 1.5;
  color: var(--surface, #fff); background: var(--text, #2C2416);
  box-shadow: 0 4px 14px -6px rgba(0, 0, 0, .5); z-index: 2;
}
[data-theme="dark"] .nfe-tip, [data-theme="auto"] .nfe-tip { color: var(--bg, #1E1F18); background: var(--text, #E9E5DA); }
/* اليوم المفتوح يبقى معلَّماً بعد ذهاب المؤشّر — بعلامةٍ عليه لا
   بتعتيم الشريط كلّه: التعتيم يطفئ مئةً وأربعين يوماً ليقول شيئاً عن
   يومٍ واحد، ولا يقول أين هو. */
.nfe-pick {
  position: absolute; top: -3px; bottom: -3px; width: 3px; transform: translateX(-50%);
  border-radius: 2px; background: var(--fc-txt); pointer-events: none;
}
.nfe-pick::after {
  content: ""; position: absolute; left: 50%; top: -4px;
  width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--fc-txt);
}

/* ---- رأس اليوم المفتوح ---- */
.nfe-dayhead {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding: 9px 12px; border-radius: 10px;
  background: var(--bg-3, #EFEAE0);
}
.nfe-dayhead-t { font-size: 12px; font-weight: 600; color: var(--text-2, #4A4030); }
.nfe-dayhead-t b { font-weight: 900; color: var(--text, #2C2416); }
.nfe-dayhead-n { color: var(--muted-2, #968B78); font-weight: 600; }
.nfe-dayback {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  padding: 0; border: 0; background: none; cursor: pointer; font-family: inherit;
  font-size: 12px; font-weight: 800; color: var(--fc-txt);
}
.nfe-dayback svg { opacity: .7; }
.nfe-thread.is-day .nfe-when { font-variant-numeric: tabular-nums; padding-top: 16px; }
.nfe-thread.is-day .nfe-node { background: none; }
.nfe-thread.is-day .nfe-node::before, .nfe-thread.is-day .nfe-node::after { display: none; }

/* ---- الجلب جارٍ ---- */
.nfe-body.is-loading { opacity: .45; transition: opacity .12s ease; }
.nfe-body.is-loading .nfe-open, .nfe-body.is-loading .nfe-side { pointer-events: none; }
.nfe-body:focus { outline: none; }
.nfe-axis {
  display: flex; justify-content: space-between; margin-top: 5px;
  font-size: 9.5px; font-weight: 700; color: var(--muted-2, #968B78);
}
.nfe-axis .is-now { color: var(--fc-txt); font-weight: 900; }

/* ---- الخيط: ثلاث محطّات على شعرة ---- */
.nfe-thread { list-style: none; margin: 12px 0 0; padding: 0; }
.nfe-moment { display: grid; grid-template-columns: 88px 17px minmax(0, 1fr); align-items: stretch; gap: 0 9px; }
.nfe-moment + .nfe-moment { border-top: 1px solid var(--border, #E7E1D4); }
.nfe-when {
  display: flex; align-items: flex-start; justify-content: flex-start; gap: 6px;
  padding-top: 15px; font-size: 10.5px; font-weight: 800; color: var(--muted, #7A6E5D); white-space: nowrap;
}
.nfe-when b {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 14px; height: 14px; border-radius: 50%; font-size: 8.5px; font-weight: 900;
  background: var(--bg-3, #EFEAE0); color: var(--muted, #7A6E5D);
}
.nfe-moment.is-now .nfe-when { color: var(--fc-txt); }
.nfe-moment.is-now .nfe-when b { background: var(--fc, #3D5A28); color: #fff; }
/* الشعرة تُبنى من العقدة نفسها: خطٌّ فوقها وخطٌّ تحتها يمتدّان بارتفاع
   الصفّ، فتتّصل المحطّات بلا عنصرٍ مطلقٍ يحتاج ارتفاعاً مخمَّناً. */
.nfe-node { position: relative; display: block; }
.nfe-node::before, .nfe-node::after {
  content: ""; position: absolute; inset-inline-start: 50%; width: 1px;
  background: var(--border-2, #D7CEBC); transform: translateX(-50%);
}
.nfe-node::before { top: 0; height: 19px; }
.nfe-node::after  { top: 30px; bottom: 0; }
.nfe-moment:first-child .nfe-node::before { display: none; }
.nfe-moment:last-child  .nfe-node::after  { display: none; }
.nfe-node i, .nfe-node::marker { display: none; }
.nfe-moment .nfe-node {
  background:
    radial-gradient(circle at 50% 24.5px, var(--fc-txt) 0 4.5px, transparent 4.6px);
}
.nfe-moment:not(.is-now) .nfe-node {
  background:
    radial-gradient(circle at 50% 24.5px, var(--surface, #fff) 0 3px, var(--border-2, #D7CEBC) 3.1px 4.5px, transparent 4.6px);
}
.nfe-mt { display: flex; gap: 14px; padding: 13px 0 14px; color: inherit; text-decoration: none; min-width: 0; }
.nfe-mt-img { flex: 0 0 110px; align-self: flex-start; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--bg-3, #EFEAE0); }
.nfe-mt-i { width: 100%; height: 100%; max-width: none; object-fit: cover; display: block; }
.nfe-mt-txt { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.nfe-mt-title {
  font-size: 14.5px; font-weight: 700; line-height: 1.62; color: var(--text, #2C2416);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.nfe-moment.is-now .nfe-mt-title { font-size: 18px; font-weight: 800; line-height: 1.5; -webkit-line-clamp: 3; }
.nfe-mt:hover .nfe-mt-title { color: var(--fc-txt); }
.nfe-mt-meta { display: flex; align-items: center; gap: 9px; font-size: 11px; font-weight: 600; color: var(--muted, #7A6E5D); }
.nfe-src {
  display: inline-flex; align-items: center; font-size: 10.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; background: var(--bg-3, #EFEAE0); color: var(--text-2, #4A4030);
}

/* ---- الاقتباس: مُسنَد لا معلَّق ---- */
.nfe-quote {
  margin: 13px 0 0; padding: 13px 16px;
  background: var(--surface-2, #FBF9F4);
  border-inline-start: 2px solid var(--fc-txt);
  border-radius: 0 12px 12px 0;
}
.nfe-quote blockquote { margin: 0; font-size: 14px; line-height: 1.85; color: var(--text-2, #4A4030); }
.nfe-quote blockquote::before { content: "”"; color: var(--fc-txt); font-weight: 900; font-size: 21px; line-height: 0; margin-inline-end: 6px; vertical-align: -5px; }
.nfe-quote figcaption { margin-top: 7px; font-size: 10.5px; font-weight: 600; color: var(--muted-2, #968B78); }
.nfe-quote figcaption b { color: var(--text-2, #4A4030); font-weight: 900; }

/* ---- الكيانات: روابط لا شارات ---- */
.nfe-ents { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.nfe-ents-lbl { font-size: 10.5px; font-weight: 800; color: var(--muted-2, #968B78); }
.nfe-ent {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; text-decoration: none;
  font-size: 11.5px; font-weight: 700; padding: 5px 10px; border-radius: 999px;
  background: var(--bg-3, #EFEAE0); color: var(--text-2, #4A4030);
  transition: background .16s ease, color .16s ease;
}
.nfe-ent b { font-weight: 900; color: var(--fc-txt); font-variant-numeric: tabular-nums; }
.nfe-ent:hover { background: var(--fc, #3D5A28); color: #fff; }
.nfe-ent:hover b { color: #fff; }
.nfe-ents-more { font-size: 10.5px; font-weight: 600; color: var(--muted-2, #968B78); }
.nfe-ents-more b { color: var(--text-2, #4A4030); font-weight: 800; }

.nfe-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--border, #E7E1D4);
}
.nfe-nums { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 11.5px; font-weight: 600; color: var(--muted, #7A6E5D); }
.nfe-nums b { color: var(--text-2, #4A4030); font-weight: 900; font-variant-numeric: tabular-nums; }
.nfe-go { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 800; color: var(--fc-txt); text-decoration: none; }
.nfe-go svg { opacity: .7; }

/* ---- العمود الجانبي: أربعة ملفّات بمحتوى ---- */
/* العمود ينتهي عند محتواه ولا يتمدّد بارتفاع الملفّ المفتوح.
   والتمدّد جُرّب مرّتين وسقط مرّتين: بـmargin-top:auto على التقاطع
   يتجمّع الفائض ثقباً فوقه، وبتقاسمه بين البطاقات يصير كلٌّ منها
   ضِعف محتواها حين يُفتح يومٌ بستّة تقارير — والفارق يبلغ أربعمئة
   بكسل. عمودٌ أقصر من جاره تخطيطٌ عاديّ، والثقب يُقرأ عطباً. */
.nfe-side {
  display: flex; flex-direction: column; align-self: start;
  background: var(--surface, #fff); border: 1px solid var(--border, #E7E1D4);
  border-radius: var(--radius-lg, 18px); overflow: hidden;
}
.nfe-side-lbl {
  margin: 0; padding: 12px 14px 11px;
  font-size: 11px; font-weight: 800; color: var(--muted-2, #968B78);
  background: var(--surface-2, #FBF9F4); border-bottom: 1px solid var(--border, #E7E1D4);
}
.nfe-sw {
  display: flex; flex-direction: column; justify-content: center; flex: 0 0 auto;
  padding: 12px 13px 13px; color: inherit; text-decoration: none; transition: background .16s ease;
}
.nfe-sw + .nfe-sw { border-top: 1px solid var(--border, #E7E1D4); }
.nfe-sw:hover, .nfe-sw:focus-visible { background: var(--surface-2, #FBF9F4); }
/* شعرةٌ تنبت عند الحافّة الداخلية: الملفّ يُفتح هنا، فالإشارة إلى
   الداخل لا إلى صفحةٍ أخرى. */
.nfe-sw { position: relative; }
.nfe-sw::before {
  content: ""; position: absolute; inset-block: 0; inset-inline-end: 0; width: 0;
  background: var(--fc-txt); transition: width .16s ease;
}
.nfe-sw:hover::before, .nfe-sw:focus-visible::before { width: 3px; }
.nfe-sw-top { display: flex; align-items: center; gap: 8px; }
.nfe-sw-bar { width: 3px; height: 16px; border-radius: 2px; background: var(--fc-txt); flex: none; }
.nfe-sw-name { font-size: 13px; font-weight: 800; color: var(--text, #2C2416); white-space: nowrap; }
.nfe-sw-num { margin-inline-start: auto; font-size: 10px; font-weight: 600; color: var(--muted-2, #968B78); white-space: nowrap; }
.nfe-sw-num b { font-size: 13.5px; font-weight: 900; color: var(--fc-txt); font-variant-numeric: tabular-nums; }
.nfe-sw-dev {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin: 7px 0 8px; font-size: 12px; font-weight: 600; line-height: 1.6; color: var(--text-2, #4A4030);
}
.nfe-sw:hover .nfe-sw-dev { color: var(--fc-txt); }
.nfe-sw-cells { display: flex; gap: 2px; }
.nfe-sw-cells i { flex: 1 1 0; height: 10px; border-radius: 2px; background: color-mix(in srgb, var(--fc-txt) calc(var(--a) * 100%), transparent); }

/* ---- التقاطع: يملأ ما تبقّى ويقول ما لا يقوله ملفٌّ وحده ---- */
.nfe-cross {
  display: flex; flex-direction: column; gap: 7px;
  padding: 13px; text-decoration: none;
  border-top: 1px solid var(--border, #E7E1D4);
  background: var(--surface-2, #FBF9F4);
  transition: background .16s ease;
}
.nfe-cross:hover { background: var(--bg-3, #EFEAE0); }
.nfe-cross-lbl { font-size: 10.5px; font-weight: 800; color: var(--muted-2, #968B78); }
.nfe-cross-pair { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nfe-cross-a { position: relative; padding-inline-start: 9px; font-size: 12px; font-weight: 800; color: var(--text, #2C2416); }
.nfe-cross-a::before { content: ""; position: absolute; inset-inline-start: 0; top: 50%; margin-top: -6.5px; width: 3px; height: 13px; border-radius: 2px; background: var(--c); }
.nfe-cross-x { font-size: 11px; font-weight: 700; color: var(--muted-2, #968B78); }
[data-theme="dark"] .nfe-cross-a::before,
[data-theme="auto"] .nfe-cross-a::before { background: color-mix(in srgb, var(--c) 42%, #E9E5DA); }
.nfe-cross-txt { font-size: 11px; font-weight: 600; line-height: 1.65; color: var(--text-2, #4A4030); }

/* ---- التركيز ---- */
.nfe a:focus-visible { outline: 2px solid var(--accent, #5B7F3B); outline-offset: 3px; border-radius: 8px; }

/* ---- الاستجابة ---- */
@media (max-width: 900px) {
  .nfe-body { grid-template-columns: minmax(0, 1fr); }
  .nfe-name { font-size: 23px; }
  .nfe-moment.is-now .nfe-mt-title { font-size: 16px; }
  .nfe-mt-img { flex-basis: 88px; }
}
@media (max-width: 640px) {
  .nfe-rail { gap: 10px; margin-bottom: 12px; }
  .nfe-rail-note { display: none; }
  .nfe-open { padding: 0 15px 14px; }
  .nfe-name { font-size: 21px; }
  .nfe-nums { gap: 5px 12px; }
  /* عمود التاريخ يأكل ربع الشاشة على الهاتف، فيبقى للعنوان ١٠٧px
     بجانب الصورة — سطران بكلمتين. فيهبط التاريخ فوق العنوان ويبقى
     عمود الخيط وحده جانبياً، فيتضاعف عرض النصّ. */
  .nfe-moment { grid-template-columns: 15px minmax(0, 1fr); grid-template-rows: auto auto; gap: 0 9px; }
  .nfe-node { grid-column: 1; grid-row: 1 / span 2; }
  .nfe-when { grid-column: 2; grid-row: 1; align-items: center; padding-top: 13px; }
  .nfe-mt   { grid-column: 2; grid-row: 2; padding-top: 6px; gap: 11px; }
  .nfe-mt-img { flex-basis: 82px; }
  .nfe-mt-meta { flex-wrap: wrap; gap: 6px 9px; }
  /* دائرة العقدة مرسومةٌ على ٢٤٫٥px من أعلى الصفّ — وقد صار فوقها
     سطر التاريخ، فتنزل معه. */
  .nfe-moment .nfe-node { background: radial-gradient(circle at 50% 21px, var(--fc-txt) 0 4.5px, transparent 4.6px); }
  .nfe-moment:not(.is-now) .nfe-node {
    background: radial-gradient(circle at 50% 21px, var(--surface, #fff) 0 3px, var(--border-2, #D7CEBC) 3.1px 4.5px, transparent 4.6px);
  }
  .nfe-node::before { height: 15.5px; }
  .nfe-node::after  { top: 26.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .nfe-ent, .nfe-sw, .nfe-sw::before, .nfe-cross, .nfe-body { transition: none; }
}
