/* ==============================================================
   صفحة الأخبار /news/{lang} وحدها (قرار المالك 2026-12-05). تُحمَّل في templates/news.php فقط، فوق Css/site.css.
   المرجع البصري المعتمد: ~/gatechx-phase2/previews/news/news-board-preview.html (القيم منقولة منه)، مع قرارات المالك:
   - اللوح بعرض 73vw (حتى 1500px) من أعلى 68px إلى أسفل 56px، و 94vw حتى 900px.
   - أشياء الأرض أمام اللوح، وأشياء الجدار تُخفى تحت 1500px، وكل الديكور تحت 1180px.
   - شبكة الأوراق auto-fill بحد أدنى 290px، والورقة الكبيرة عمودان.
   - الصفحة بمقاس الشاشة بلا تمرير خارجي؛ التمرير في .cork وحده، بشريط أزرق رفيع وتلاشٍ عند الحافتين.
   - CLS: اللوح بأبعاد ثابتة (مثبّت بحوافه)، وارتفاعات الأسطر ثابتة لا normal، والصور height:auto مع width/height.
   - الباب: يدور على مفصله الخارجي 33deg في 450ms عند المرور والتركيز، بلا حركة على اللمس ومع prefers-reduced-motion.
   الهوية: أسود خالص و #2E9BFF لون التمييز الوحيد، والأوراق رمادية فاتحة لأنها مطبوعة، والباقي معدني رمادي وأزرق.
   ============================================================== */

html:has(body.news-room) { height: 100%; overflow: hidden; scroll-behavior: auto; }
body.news-room {
  /* حافتا اللوح (المعاينة المعتمدة)، يقرؤهما اللوح والحد الأدنى للشاشات القصيرة */
  --board-top: 68px;
  --board-bottom: 56px;
  position: relative;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000;
  color: #e8edf3;
  font-family: 'Tajawal', 'Cairo', sans-serif;
  font-size: 16px;
  line-height: 1.6;
}
.news-room a { color: inherit; text-decoration: none; }
.news-room :focus-visible { outline: 3px solid #2E9BFF; outline-offset: 3px; }
/* التاريخ نص عربي بأرقام لاتينية: يتبع اتجاه الصفحة (site.css يجعل time باتجاه ltr عموماً؛ كـ .byline time في المقال) */
.news-room time { direction: inherit; unicode-bidi: isolate; display: inline; }

/* ---------- الجدار والديكور (aria-hidden) ---------- */
.news-room .scene {
  position: absolute;               /* بلا z-index: لا سياق تراكب، فأشياء الأرض (z 4) أمام اللوح (z 3) */
  inset: 0;
  pointer-events: none;             /* قرار المالك: الديكور لا يلتقط النقر، فالنقر على ورقة خلف المنضدة أو الطفاية يصل إلى رابطها */
  overflow: hidden;
  background:
    radial-gradient(circle, #18222c 1.2px, transparent 1.6px) 0 0/80px 400px,
    repeating-linear-gradient(90deg, #0b1015 0 38px, #04070a 38px 40px, #0d131a 40px 78px, #03060a 78px 80px);
}
.news-room .scene::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 60% 70% at 50% 28%, rgba(150,200,255,.14), transparent 70%), linear-gradient(90deg, rgba(0,0,0,.9), transparent 20%, transparent 80%, rgba(0,0,0,.9)); pointer-events: none; }
.news-room .pipe { position: absolute; inset-inline: 0; inset-block-start: 0; height: 16px; background: linear-gradient(#34424f, #16202a 45%, #0a1016); border-block-end: 3px solid #000; box-shadow: 0 8px 16px rgba(0,0,0,.8); z-index: 5; }
.news-room .pipe::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 240px, #1f2c38 240px 256px, #0a1016 256px 258px); }
.news-room .floor { position: absolute; inset-inline: 0; inset-block-end: 0; height: 128px; background: linear-gradient(#0c1116, #000); border-block-start: 6px solid #1b2631; z-index: 2; }
.news-room .floor::before { content: ""; position: absolute; inset-inline: 0; inset-block-end: 18px; height: 12px; background: repeating-linear-gradient(135deg, #2E9BFF 0 20px, #000 20px 40px); opacity: .9; }
.news-room .o { position: absolute; z-index: 4; display: block; filter: drop-shadow(0 10px 12px rgba(0,0,0,.8)); pointer-events: none; }
.news-room .robot { inset-block-end: 34px; inset-inline-start: 36px; }
.news-room .bench { inset-block-end: 30px; inset-inline-start: 236px; }
.news-room .extg { inset-block-end: 34px; inset-inline-end: 230px; }
.news-room .o.w { inset-block-start: 130px; }
.news-room .o.w.c { inset-inline-start: 70px; }
.news-room .o.w.p { inset-inline-end: 66px; }
/* الموضع بمحدد أدق من .o.w (أعلى 290px لا 130px)، والعرض بمحدد أدنى حتى تخفيه قاعدة 1500px */
.news-room .o.w.poster { inset-inline-start: 80px; inset-block-start: 290px; }
.news-room .poster { width: 120px; padding: 10px 8px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; background: #eef1f4; color: #0b1118; text-align: center; border-block-start: 8px solid #2E9BFF; transform: rotate(-1.5deg); }
.news-room .poster b { font: 800 17px/1.4 'Cairo', sans-serif; }

/* ---------- اللوحتان أعلى الجدار ---------- */
.news-room .plaque { position: absolute; z-index: 6; inset-block-start: 30px; display: inline-flex; align-items: center; min-height: 48px; padding: 6px 18px; background: linear-gradient(#17212b, #0a1016); border: 2px solid #34424f; border-radius: 6px; box-shadow: 0 10px 20px rgba(0,0,0,.8); }
.news-room .plaque::before, .news-room .plaque::after { content: ""; position: absolute; inset-block-start: 50%; width: 7px; height: 7px; margin-block-start: -3px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #8a9aa8, #1a232d); }
.news-room .plaque::before { inset-inline-start: 6px; }
.news-room .plaque::after { inset-inline-end: 6px; }
.news-room .plaque.logo { inset-inline-end: 40px; padding: 8px 20px; min-height: 52px; pointer-events: none; }
.news-room .plaque.logo img { display: block; width: auto; max-width: none; height: 33px; }
.news-room .plaque.back { inset-inline-start: 40px; padding-inline: 26px; border-color: #2E9BFF; color: #2E9BFF; font: 800 15px/1.5 'Cairo', sans-serif; }

/* ---------- اللوح: إطار معدني بأبعاد ثابتة (حوافه مثبّتة)، ولافتة h1 فوقه ---------- */
.news-room .board { position: absolute; z-index: 3; inset-block-start: var(--board-top); inset-block-end: var(--board-bottom); inset-inline: 0; margin-inline: auto; width: min(73vw, 1500px); padding: 16px; border-radius: 20px; background: linear-gradient(145deg, #1d2832, #0e151d 45%, #1a242e); box-shadow: 0 26px 70px rgba(0,0,0,.85), inset 0 0 0 1px #2e3d4c; }
.news-room .screw { position: absolute; pointer-events: none; width: 13px; height: 13px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #58697a, #1a232d 70%); box-shadow: 0 1px 2px #000; }
/* خصائص منطقية (review-council 2026-12-05)؛ البراغي متناظرة فلا يتغير الشكل */
.news-room .s1 { inset-block-start: 8px; inset-inline-start: 8px; } .news-room .s2 { inset-block-start: 8px; inset-inline-end: 8px; }
.news-room .s3 { inset-block-end: 8px; inset-inline-start: 8px; } .news-room .s4 { inset-block-end: 8px; inset-inline-end: 8px; }
.news-room .plate { position: absolute; z-index: 4; pointer-events: none; inset-block-start: -30px; inset-inline: 0; margin-inline: auto; width: max-content; padding: 4px 40px 6px; text-align: center; background: linear-gradient(#17212b, #0a1016); border: 2px solid #2E9BFF; border-radius: 8px; box-shadow: 0 10px 22px rgba(0,0,0,.8), 0 0 30px rgba(46,155,255,.2); }
.news-room .plate__sub { margin: 0; font: 600 12px/1.5 'Cairo', sans-serif; color: #2E9BFF; }
.news-room .plate h1 { margin: 0; font: 800 34px/1.2 'Cairo', sans-serif; color: #fff; }

/* مساحة التمرير الوحيدة: شريط أزرق رفيع وتلاشٍ خفيف عند الحافتين */
.news-room .cork {
  position: relative;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  border-radius: 12px;
  background-color: #05080b;
  background-image: radial-gradient(#16212c 1.4px, transparent 1.6px);
  background-size: 26px 26px;
  box-shadow: inset 0 6px 30px #000, inset 0 0 0 2px #0c131a;
  padding: 44px 34px 56px;
  scrollbar-width: thin;
  scrollbar-color: #2E9BFF #05080b;
  -webkit-mask-image: linear-gradient(transparent, #000 22px, #000 calc(100% - 22px), transparent);
  mask-image: linear-gradient(transparent, #000 22px, #000 calc(100% - 22px), transparent);
}
/* حلقة التركيز (قرار المالك 2026-12-05): احتياط CSS يعمل بلا السكربت: اللوح يترك حافتي التلاشي، والرابط يُظهر ما حوله
   من الورقة. السكربت المضمّن (gx-news-focus في templates/_news.php) يكمل فيُظهر الورقة كلها */
.news-room .cork { scroll-padding-block: 26px; }
.news-room .note__title a { scroll-margin-block: 26rem 12rem; }
.news-room .cork::-webkit-scrollbar { width: 10px; }
.news-room .cork::-webkit-scrollbar-track { background: #05080b; }
.news-room .cork::-webkit-scrollbar-thumb { background: #2E9BFF; border-radius: 6px; }
.news-room .cork:focus-visible { outline-offset: -3px; }

.news-room .intro { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; margin-block-end: 34px; padding-block-end: 18px; border-block-end: 2px dashed #1d2c3b; }
.news-room .intro__text { margin: 0; max-width: 560px; font-size: 17px; line-height: 1.8; color: #9aa8b8; }
.news-room .meta { display: flex; gap: 26px; margin: 0; font-family: 'Cairo', sans-serif; }
.news-room .meta dt { font-size: 13px; line-height: 1.5; color: #9aa8b8; }
.news-room .meta dd { margin: 4px 0 0; font-size: 18px; font-weight: 700; line-height: 1.5; color: #fff; }

/* ---------- الأشهر والأوراق ---------- */
.news-room .month + .month { margin-block-start: 40px; }
.news-room .month__bar { display: flex; align-items: center; gap: 16px; margin: 0 0 30px; }
.news-room .month__bar::after { content: ""; flex: 1; border-block-start: 2px dashed #1d2c3b; }
.news-room .tape { padding: 5px 20px; background: #2E9BFF; color: #000; font: 800 21px/1.5 'Cairo', sans-serif; border-radius: 4px; transform: rotate(-1deg); box-shadow: 0 6px 14px rgba(0,0,0,.6); }
.news-room .notes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 40px 30px; align-items: start; }
.news-room .notes > li.is-lead { grid-column: span 2; }
.news-room .notes > li:nth-child(2n) .note { transform: rotate(1.1deg); }
.news-room .notes > li:nth-child(3n) .note { transform: rotate(-1.4deg); }
.news-room .notes > li:nth-child(5n) .note { transform: rotate(.7deg); }

.news-room .note { position: relative; padding: 28px 22px 18px; background: #eef1f4; background-image: repeating-linear-gradient(180deg, transparent 0 31px, #dde3ea 31px 32px); color: #0b1118; border-radius: 3px; box-shadow: 0 16px 26px rgba(0,0,0,.75); }
.news-room .note--lead { padding: 30px 28px 22px; }
.news-room .pin { position: absolute; pointer-events: none; inset-block-start: -10px; inset-inline-start: calc(50% - 10px); width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #bfe1ff, #2E9BFF 50%, #0a4d8a); box-shadow: 0 5px 8px rgba(0,0,0,.65); }
.news-room .note__head { display: flex; justify-content: space-between; gap: 10px; margin: 0 0 12px; padding-block-end: 7px; border-block-end: 2px solid #0b1118; font: 700 12px/1.6 'Cairo', sans-serif; color: #3b4856; }
.news-room .note__photo { position: relative; display: block; margin-block-end: 14px; padding: 7px; background: #fff; box-shadow: 0 6px 12px rgba(0,0,0,.35); transform: rotate(-1deg); }
.news-room .note__photo::before { content: ""; pointer-events: none; position: absolute; inset-block-start: -11px; inset-inline-start: calc(50% - 44px); width: 88px; height: 22px; background: rgba(190,220,250,.55); transform: rotate(2deg); }
.news-room .note__img { display: block; width: 100%; max-width: 100%; height: auto; }
.news-room .note__title { margin: 0; font: 800 19px/1.55 'Cairo', sans-serif; color: #0b1118; }
.news-room .note--lead .note__title { font-size: 27px; line-height: 1.5; }
/* رابط واحد ممتد على الورقة كلها */
.news-room .note__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.news-room .note__title a:focus-visible { outline: none; }
.news-room .note__title a:focus-visible::after { outline: 3px solid #2E9BFF; outline-offset: 4px; }
.news-room .note__excerpt { margin: 8px 0 0; font-size: 15px; line-height: 1.95; color: #1f2a36; }
.news-room .stamp { position: absolute; z-index: 2; inset-block-start: -13px; inset-inline-end: 14px; padding: 2px 11px; background: #2E9BFF; color: #000; font: 800 13px/1.6 'Cairo', sans-serif; transform: rotate(-3deg); pointer-events: none; box-shadow: 0 4px 8px rgba(0,0,0,.35); }
.news-room .note__more { display: inline-flex; align-items: center; min-height: 44px; margin-block-start: 10px; font: 800 14px/1.5 'Cairo', sans-serif; border-block-end: 3px solid #2E9BFF; }
.news-room .note--empty .note__title { font-size: 21px; }

.news-room .pager { display: flex; justify-content: center; gap: 18px; margin-block-start: 44px; }
.news-room .pager a { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 22px; border: 2px solid #2E9BFF; border-radius: 6px; color: #2E9BFF; background: #0a1016; font: 800 15px/1.5 'Cairo', sans-serif; }

/* ---------- باب الخروج: رابط إلى الاستقبال، أمام اللوح ---------- */
.news-room .door { position: absolute; z-index: 4; inset-block-end: 28px; inset-inline-end: 36px; display: block; width: 150px; height: 300px; perspective: 800px; filter: drop-shadow(0 10px 12px rgba(0,0,0,.8)); }
.news-room .door .exit { position: absolute; inset-block-start: -46px; inset-inline: 0; margin-inline: auto; width: max-content; padding: 4px 16px; background: #2E9BFF; color: #000; font: 800 18px/1.5 'Cairo', sans-serif; border-radius: 4px; box-shadow: 0 0 24px rgba(46,155,255,.55); }
/* الفجوة خلف الباب: ضوء أزرق خافت يظهر حين ينفتح */
.news-room .door__gap { position: absolute; inset: 0; background: radial-gradient(ellipse 80% 60% at 50% 55%, rgba(46,155,255,.35), rgba(5,20,40,.95) 70%); border-radius: 4px 4px 0 0; }
.news-room .door .leaf { position: absolute; inset: 0; background: linear-gradient(#1b2631, #0e151c); border: 5px solid #34424f; border-radius: 4px 4px 0 0; transform-origin: left center; transition: transform 450ms cubic-bezier(.3,.7,.3,1); }
[dir="ltr"] .news-room .door .leaf { transform-origin: right center; }
.news-room .door .win { position: absolute; inset-block-start: 26px; inset-inline: 26px; height: 70px; background: linear-gradient(135deg, #0b1a28, #05080b); border: 3px solid #566676; }
.news-room .door .bar { position: absolute; inset-block-start: 150px; inset-inline: 22px; height: 14px; background: #9aa8b8; border-radius: 7px; box-shadow: 0 0 0 3px #2a3948; }
/* المفصل الخارجي: حافة الباب نحو طرف الشاشة (اليسار في RTL)، والوجه يدور نحو الزائر */
@media (hover: hover) and (pointer: fine) {
  .news-room .door:hover .leaf { transform: rotateY(-33deg); }
  [dir="ltr"] .news-room .door:hover .leaf { transform: rotateY(33deg); }
}
.news-room .door:focus-visible .leaf { transform: rotateY(-33deg); }
[dir="ltr"] .news-room .door:focus-visible .leaf { transform: rotateY(33deg); }
.news-room .door:focus-visible { outline-offset: 6px; }

@media (prefers-reduced-motion: reduce) {
  .news-room .door .leaf { transition: none; }
  /* بمحددات LTR أيضاً، وإلا غلبتها قواعد [dir="ltr"] الأدق في /en (review-council 2026-12-05) */
  .news-room .door:hover .leaf, .news-room .door:focus-visible .leaf,
  [dir="ltr"] .news-room .door:hover .leaf, [dir="ltr"] .news-room .door:focus-visible .leaf { transform: none; }
}

/* ---------- المقاسات ---------- */
@media (max-width: 1500px) {
  .news-room .o.w { display: none; }
  /* قرار المالك (ب): بين 1180 و 1500 تقف المنضدة على حافة إطار اللوح دون أوراقه: حافتها الداخلية عند الحافة الداخلية
     للإطار (اللوح 73vw، فحافته على 13.5vw من طرف الشاشة، والإطار 16px، والمنضدة 130px) */
  .news-room .bench { inset-inline-start: calc(13.5vw + 16px - 130px); }
}
@media (max-width: 1180px) { .news-room .o, .news-room .door { display: none; } }
@media (max-width: 900px) {
  .news-room .notes { grid-template-columns: 1fr; }
  .news-room .notes > li.is-lead { grid-column: auto; }
  body.news-room { --board-top: 84px; --board-bottom: 100px; }
  .news-room .board { width: 94vw; }
  .news-room .floor { height: 80px; }
  .news-room .cork { padding: 40px 16px 40px; }
  /* اللوحتان أصغر وأعلى على الجوال، فلا تتداخلان ولا تغطيان لافتة «الأخبار» (أعلاها عند 54px) */
  .news-room .plaque { inset-block-start: 12px; min-height: 40px; }
  .news-room .plaque.logo { inset-inline-end: 12px; padding: 6px 14px; min-height: 40px; }
  .news-room .plaque.logo img { height: 22px; }
  .news-room .plaque.back { inset-inline-start: 12px; padding-inline: 16px; font-size: 13px; }
}

/* الشاشات القصيرة (قرار المالك 2026-12-05): تتمرر الصفحة نفسها، وللوح حد أدنى 400px فلا تضيق مساحة القراءة، كما في الاستقبال
   (min-height لا height). اللوح مثبّت بحافتيه داخل body، فارتفاعه = ارتفاع body ناقص الحافتين. الحد 520px، و 583px للشاشات
   الضيقة (حافتاها 184px) حتى لا تبقى فجوة بين الحد والحد الأدنى. وحين يبلغ اللوح آخره ينتقل التمرير إلى الصفحة (review-council) */
@media (max-height: 520px) {
  html:has(body.news-room) { height: auto; overflow-y: auto; }
  body.news-room { height: auto; min-height: calc(var(--board-top) + var(--board-bottom) + 400px); overflow: visible; }
  .news-room .cork { overscroll-behavior: auto; }
}
@media (max-height: 583px) and (max-width: 900px) {
  html:has(body.news-room) { height: auto; overflow-y: auto; }
  body.news-room { height: auto; min-height: calc(var(--board-top) + var(--board-bottom) + 400px); overflow: visible; }
  .news-room .cork { overscroll-behavior: auto; }
}
