/* ==========================================================================
   وضح — دليل الاستخدام
   يُحمَّل **بعد** ‎/assets/styles.css‎ ويشتقّ منه كل ألوانه ومسافاته: لا لون
   حرفيّ هنا. الفصل مقصود — شكل الدليل يتغيّر كثيراً في أثناء الكتابة، وإبطالُ
   ذاكرة تخزين الموقع كلّه عند كل تعديلٍ فيه ثمنٌ لا داعي له.
   وله رقم نسخةٍ خاصّ (‎ASSET_V‎ في ‎tools/build_guide.py‎) — بدّله متى عدّلت هنا.
   ========================================================================== */

/* ---------- الرأس ---------- */

/* عرضٌ واحد لكل الدليل: الرأس والفهرس والمقال والتذييل على خطٍّ واحد.
   بلا هذا تختلف الحافة بين قسمٍ وآخر بـ‎60px‎ فتبدو الصفحة مهتزّة. */
.guide .wrap { max-width: 1060px; }

.g-head { padding: calc(var(--nav-h) + 30px) var(--pad-x) 30px; background: var(--sand-deep); border-bottom: 1px solid var(--line); }
.g-head--home { padding-bottom: 44px; }
.g-head .lede { max-width: 800px; }
.g-title { font-size: clamp(1.9rem, 5vw, 2.875rem); }

.g-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-top: 4px; }
.g-meta__d { font-size: 0.8125rem; color: var(--muted-2); font-variant-numeric: tabular-nums; }

/* رابط الشاشة نفسها على الواجهة الأخرى — أكثر ما يُنقر في الدليل، لأن السائل
   غالباً يقرأ على جواله ويشتغل على الكمبيوتر. */
.g-twin {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line-firm);
  font-size: 0.8125rem; font-weight: 600; color: var(--ink-2);
  transition: border-color var(--dur-fast) ease-out, color var(--dur-fast) ease-out;
}
.g-twin:hover { color: var(--brand-deep); border-color: var(--brand-edge); }
.g-twin svg { color: var(--brand); flex: none; }

/* ---------- هيكل الصفحة ---------- */

.g-body { padding: 40px var(--pad-x) var(--pad-y); }
.g-body__grid { display: grid; grid-template-columns: 1fr; gap: 34px; }
@media (min-width: 980px) { .g-body__grid { grid-template-columns: minmax(0, 1fr) 268px; gap: 52px; align-items: start; } }

.g-article { min-width: 0; }
.g-aside { display: flex; flex-direction: column; gap: 18px; }
@media (min-width: 980px) { .g-aside { position: sticky; top: calc(var(--nav-h) + 20px); } }

/* ---------- نصّ الشرح ---------- */

.g-h2 { font-size: 1.5rem; font-weight: 600; line-height: 1.4; margin: 34px 0 12px; scroll-margin-top: calc(var(--nav-h) + 20px); }
.g-h2:first-child { margin-top: 0; }
.g-h3 { font-size: 1.0625rem; font-weight: 600; color: var(--ink-2); margin: 22px 0 8px; }
.g-p { font-size: 1.0625rem; line-height: 1.95; color: var(--ink-2); margin-bottom: 14px; }
.g-article code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.875em; background: var(--sand); border: 1px solid var(--line-soft); border-radius: 6px; padding: 1px 6px; color: var(--ink); }
.g-article a:not(.btn):not(.g-twin) { text-decoration: underline; text-underline-offset: 3px; }

.g-list { margin: 0 0 16px; padding-inline-start: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; }
.g-list li { position: relative; padding-inline-start: 22px; font-size: 1.0625rem; line-height: 1.85; color: var(--ink-2); }
.g-list li::before { content: ""; position: absolute; inset-inline-start: 4px; top: 13px; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-lite); }

/* الخطوات مرقّمة بأرقامٍ ظاهرة لا بنقاط: من يتبع خطوةً يحتاج أن يعرف أين وقف. */
.g-steps { margin: 0 0 18px; padding-inline-start: 0; list-style: none; counter-reset: g; display: flex; flex-direction: column; gap: 12px; }
.g-steps li { counter-increment: g; position: relative; padding-inline-start: 40px; font-size: 1.0625rem; line-height: 1.85; color: var(--ink-2); min-height: 28px; }
.g-steps li::before {
  content: counter(g); position: absolute; inset-inline-start: 0; top: 2px;
  width: 27px; height: 27px; border-radius: 50%;
  background: var(--brand-tint); border: 1px solid var(--brand-edge); color: var(--brand-deep);
  font-family: var(--display); font-size: 0.8125rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums;
}

.g-note { border-radius: var(--radius-card); background: var(--brand-tint); border: 1px solid var(--brand-edge); padding: 16px 18px; margin: 20px 0; }
.g-note .g-p { margin-bottom: 0; color: var(--ink); font-size: 1rem; }
.g-note .g-p + .g-p { margin-top: 10px; }
.g-note__t { display: block; font-family: var(--display); font-size: 0.8125rem; font-weight: 700; color: var(--brand-deep); padding-bottom: 6px; }
.g-note--warn { background: var(--gold-tint); border-color: var(--gold-edge); }
.g-note--warn .g-note__t { color: var(--gold-ink); }

.g-shot { margin: 22px 0; display: flex; flex-direction: column; gap: 9px; }
.g-shot img { width: 100%; border-radius: var(--radius-card); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); }
.g-shot figcaption { font-size: 0.8125rem; color: var(--muted-2); }

/* ---------- وين تلاقيها ---------- */

.g-where {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 15px 17px; border-radius: var(--radius-card);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  margin-bottom: 30px;
}
.g-where svg { color: var(--brand); flex: none; margin-top: 3px; }
.g-where__t { display: block; font-family: var(--display); font-size: 0.78125rem; font-weight: 700; color: var(--muted); padding-bottom: 3px; }
.g-where__d { display: block; font-size: 1rem; line-height: 1.7; color: var(--ink); font-weight: 500; }

/* ---------- الجانب ---------- */

.g-toc { border-inline-start: 2px solid var(--line); padding-inline-start: 15px; }
.g-toc__t { display: block; font-family: var(--display); font-size: 0.78125rem; font-weight: 700; color: var(--muted); padding-bottom: 9px; }
.g-toc ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.g-toc a { font-size: 0.9375rem; color: var(--ink-2); }
.g-toc a:hover { color: var(--brand-deep); }

.g-help { border-radius: var(--radius-card); background: var(--sand); border: 1px solid var(--line); padding: 17px; display: flex; flex-direction: column; gap: 7px; align-items: flex-start; }
.g-help__t { font-family: var(--display); font-size: 0.9375rem; font-weight: 600; }
.g-help__d { font-size: 0.875rem; line-height: 1.7; color: var(--muted); padding-bottom: 5px; }

.g-back { font-size: 0.875rem; font-weight: 600; color: var(--muted); }
.g-back:hover { color: var(--brand-deep); }

/* ---------- السابق والتالي ---------- */

.g-prevnext { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 44px; padding-top: 26px; border-top: 1px solid var(--line); }
@media (min-width: 620px) { .g-prevnext { grid-template-columns: 1fr 1fr; } }
.g-prevnext__c {
  display: flex; flex-direction: column; gap: 3px;
  padding: 14px 16px; border-radius: var(--radius-card);
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color var(--dur-fast) ease-out, box-shadow var(--dur-fast) ease-out;
}
.g-prevnext__c:hover { border-color: var(--line-firm); box-shadow: var(--shadow-sm); }
.g-prevnext__c span { font-size: 0.75rem; color: var(--muted-2); }
.g-prevnext__c strong { font-family: var(--display); font-size: 1rem; font-weight: 600; color: var(--ink); }
.g-prevnext__c--n { text-align: end; }

/* ---------- الفهرس ---------- */

.g-index { padding: 44px var(--pad-x) var(--pad-y); }
.g-group__t { font-size: clamp(1.375rem, 3vw, 1.75rem); padding-bottom: 18px; }
.g-cards { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 700px)  { .g-cards { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1050px) { .g-cards { grid-template-columns: repeat(3, 1fr); } }

.g-card {
  display: flex; flex-direction: column; gap: 7px;
  padding: 19px; border-radius: var(--radius-card);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  transition: border-color var(--dur-fast) ease-out, box-shadow var(--dur-fast) ease-out, translate var(--dur-fast) ease-out;
}
.g-card:hover { color: var(--ink); border-color: var(--brand-edge); box-shadow: var(--shadow-md); translate: 0 -2px; }
.g-card__go { display: inline-flex; align-items: center; gap: 5px; margin-top: auto; padding-top: 9px; font-size: 0.8125rem; font-weight: 600; color: var(--brand-deep); }
.g-card__go svg { rotate: 90deg; }

/* ---------- البوابة ---------- */

.g-doors { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 760px) { .g-doors { grid-template-columns: 1fr 1fr; } }
.g-door {
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
  padding: 30px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur-fast) ease-out, box-shadow var(--dur-fast) ease-out, translate var(--dur-fast) ease-out;
}
.g-door:hover { color: var(--ink); border-color: var(--brand-edge); box-shadow: var(--shadow-md); translate: 0 -3px; }
.g-door .pill { margin-top: 6px; }

/* لقطة الجوال تُعرض بعرض الهاتف نفسه (‎351px‎ كما التُقطت) لا بعرض المقال:
   تمديدها إلى ‎900px‎ يجعلها ضبابيةً ويوهم القارئ بشاشةٍ أوسع مما عنده. */
.g-shot--phone img { max-width: 351px; }
.g-shot--phone { align-items: flex-start; }
