/* ════════════════════════════════════════════════════════════════
   global.css — الأنماط غير الحرجة (تُحمَّل بشكل غير معطّل للعرض)
   الأنماط الحرجة أعلى الطية مضمّنة inline داخل BaseLayout
   عند تعديل هذا الملف: ارفع رقم ?v= في BaseLayout لتجاوز الكاش
   ════════════════════════════════════════════════════════════════ */

/* ── الروابط والنصوص ── */
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 700; color: var(--ink-strong); }
mark { background: #fff2c2; color: #3a2e00; padding: 0 .15em; border-radius: 3px; }
:root[data-theme="dark"] mark { background: #4a3d10; color: #ffe9a8; }
em { font-style: normal; color: var(--gold-deep); font-weight: 600; }

/* ── الحاويات والتخطيط ── */
.wrap { width: 100%; max-width: 1100px; margin-inline: auto; padding-inline: 1rem; }
.prose { max-width: 760px; margin-inline: auto; }
.prose p { margin: 0 0 1.15rem; line-height: 1.95; font-size: 1.05rem; }
.prose h2 { font-size: 1.6rem; margin: 2.4rem 0 1rem; line-height: 1.4; scroll-margin-top: 80px; }
.prose h3 { font-size: 1.25rem; margin: 1.8rem 0 .8rem; }
.prose ul, .prose ol { margin: 0 0 1.3rem; padding-inline-start: 1.5rem; }
.prose li { margin-bottom: .55rem; line-height: 1.8; }
.prose ul li { list-style: none; position: relative; }
.prose ul li::before { content: "◆"; color: var(--gold); position: absolute; inset-inline-start: -1.5rem; font-size: .8em; top: .35em; }

/* ── البطاقات ── */
.grid { display: grid; gap: 1.1rem; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card {
  position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.3rem; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,.08); border-color: var(--gold); }
.card-ic {
  position: absolute; top: 1rem; left: 1rem; font-size: 1.3rem; line-height: 1;
  opacity: .8; filter: grayscale(0) drop-shadow(0 1px 1px rgba(0,0,0,.08));
}
[dir="rtl"] .card-ic { left: auto; inset-inline-end: 1rem; }
.card h3 { margin: 0 0 .5rem; font-size: 1.15rem; line-height: 1.5; }
.card h3 a { color: var(--ink-strong); }
.card p { margin: 0 0 .9rem; color: var(--ink-soft); font-size: .95rem; line-height: 1.75; }
.card .meta { font-size: .82rem; color: var(--muted); display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; }
.tag { display: inline-block; background: var(--gold-tint); color: var(--gold-deep); font-size: .78rem; padding: .2rem .6rem; border-radius: 999px; font-weight: 600; }

/* ── جداول الأسعار ── */
.table-scroll { overflow-x: auto; margin: 1.4rem 0; border-radius: 14px; border: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0,0,0,.05); }
table { width: 100%; border-collapse: collapse; min-width: 420px; background: var(--surface); }
caption { text-align: start; padding: .8rem 1.1rem; font-weight: 700; color: var(--ink-strong); background: var(--gold-tint); }
th, td { padding: .85rem 1.1rem; text-align: start; border-bottom: 1px solid var(--border); }
thead th { background: linear-gradient(135deg, var(--gold), var(--gold-deep)); color: #2a2100; font-weight: 700; font-size: .95rem; }
tbody tr { transition: background-color .15s ease; }
tbody tr:nth-child(even) { background: var(--surface-alt); }
tbody tr:hover { background: var(--gold-tint); }
tbody tr:last-child td { border-bottom: none; }
.price-up { color: #1a7f37; font-weight: 700; font-variant-numeric: tabular-nums; }
.price-down { color: #cf222e; font-weight: 700; font-variant-numeric: tabular-nums; }

/* صف عيار في جدول الأسعار: أيقونة + شارة نقاء */
.karat-cell { display: flex; align-items: center; gap: .55rem; }
.karat-badge {
  display: inline-grid; place-items: center; width: 30px; height: 30px; flex-shrink: 0;
  border-radius: 50%; background: linear-gradient(145deg, var(--gold), var(--gold-deep));
  color: #2a2100; font-weight: 800; font-size: .72rem;
}
.purity-bar { display: flex; align-items: center; gap: .5rem; min-width: 90px; }
.purity-bar .track { flex: 1; height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; }
.purity-bar .fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-deep)); border-radius: 999px; }
.purity-bar .pct { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.trend-badge { display: inline-flex; align-items: center; gap: .2rem; font-size: .74rem; font-weight: 700; padding: .1rem .45rem; border-radius: 999px; margin-inline-start: .4rem; vertical-align: middle; }
.trend-badge.trend-up { background: #e6f6ea; color: #1a7f37; }
.trend-badge.trend-down { background: #fdeceb; color: #cf222e; }
.trend-badge.trend-flat { background: var(--surface-alt); color: var(--muted); }
:root[data-theme="dark"] .trend-badge.trend-up { background: #10281d; }
:root[data-theme="dark"] .trend-badge.trend-down { background: #331616; }

/* ── صناديق التنبيه ── */
.callout { border-radius: 12px; padding: 1rem 1.2rem; margin: 1.5rem 0; border-inline-start: 4px solid; display: flex; gap: .7rem; }
.callout .ic { font-size: 1.2rem; flex-shrink: 0; }
.callout-info { background: #eef6ff; border-color: #3b82f6; }
.callout-tip  { background: #eefbf3; border-color: #10b981; }
.callout-warn { background: #fff7ed; border-color: #f59e0b; }
.callout b { display: block; margin-bottom: .2rem; }
:root[data-theme="dark"] .callout-info { background: #12233a; }
:root[data-theme="dark"] .callout-tip  { background: #10281d; }
:root[data-theme="dark"] .callout-warn { background: #2e2410; }

/* ── snippet box (Position Zero) ── */
.snippet-box {
  background: linear-gradient(135deg, var(--gold-tint), var(--surface));
  border: 1px solid var(--gold); border-radius: 14px;
  padding: 1.2rem 1.4rem; margin: 1.5rem 0; font-size: 1.08rem; line-height: 1.9;
  position: relative;
}
.snippet-box::before {
  content: "الإجابة السريعة"; position: absolute; top: -.7rem; inset-inline-start: 1.2rem;
  background: var(--gold); color: #2a2100; font-size: .72rem; font-weight: 700;
  padding: .15rem .7rem; border-radius: 999px;
}

/* ── blockquote ── */
blockquote { border-inline-start: 4px solid var(--gold); margin: 1.5rem 0; padding: .5rem 1.2rem; background: var(--surface-alt); border-radius: 8px; font-size: 1.05rem; }
blockquote cite { display: block; margin-top: .5rem; font-size: .85rem; color: var(--muted); font-style: normal; }

/* ── الفتات (Breadcrumbs) ── */
.crumbs { font-size: .85rem; color: var(--muted); margin: 1rem 0 1.5rem; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; padding: 0; margin: 0; }
.crumbs li::after { content: "‹"; margin-inline-start: .4rem; color: var(--border-strong); }
.crumbs li:last-child::after { content: ""; }
.crumbs a { color: var(--muted); }

/* ── FAQ accordion ── */
.faq { margin: 1.5rem 0; }
.faq details { border: 1px solid var(--border); border-radius: 10px; margin-bottom: .7rem; background: var(--surface); overflow: hidden; }
.faq summary { padding: 1rem 1.2rem; font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: flex-start; gap: .7rem; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--gold); font-size: 1.4rem; line-height: 1; flex-shrink: 0; margin-inline-start: auto; }
.faq details[open] summary::after { content: "−"; }
.faq details[open] summary { border-bottom: 1px solid var(--border); }
.faq .answer { padding: 1rem 1.2rem 1rem 3.1rem; color: var(--ink-soft); line-height: 1.9; }
.faq .q-ic { flex-shrink: 0; opacity: .85; }
.h2-ic { margin-inline-end: .5rem; }

/* ── الهيدر والتنقّل ── */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--surface); border-bottom: 1px solid var(--border); backdrop-filter: saturate(1.4) blur(6px); }
.nav-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 62px; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.15rem; color: var(--ink-strong); }
.brand .logo { width: 34px; height: 34px; display: grid; place-items: center; background: var(--gold); border-radius: 9px; color: #2a2100; font-weight: 900; }
.nav-links { display: flex; gap: .3rem; align-items: center; }
.nav-links a { padding: .5rem .8rem; border-radius: 8px; color: var(--ink); font-weight: 600; font-size: .95rem; }
.nav-links a:hover { background: var(--gold-tint); text-decoration: none; }
.nav-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; padding: .4rem .6rem; font-size: 1.3rem; cursor: pointer; color: var(--ink); }
.theme-btn { background: none; border: 1px solid var(--border); border-radius: 8px; width: 38px; height: 38px; cursor: pointer; font-size: 1.1rem; color: var(--ink); }

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute; top: 62px; inset-inline: 0; flex-direction: column;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: .6rem 1rem 1rem; gap: .1rem; display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: .8rem; width: 100%; }
}

/* ── الهيرو ── */
.hero { padding: 2.5rem 0 1.5rem; text-align: center; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.7rem); line-height: 1.35; margin: 0 0 1rem; }
.hero .lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 680px; margin: 0 auto 1.4rem; line-height: 1.9; }
.updated { display: inline-flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); background: var(--surface-alt); padding: .35rem .9rem; border-radius: 999px; border: 1px solid var(--border); }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 0 rgba(16,185,129,.5); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(16,185,129,0); } 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); } }

/* ── أزرار ── */
.btn { display: inline-block; background: var(--gold); color: #2a2100; font-weight: 700; padding: .7rem 1.4rem; border-radius: 10px; border: none; cursor: pointer; }
.btn:hover { background: var(--gold-deep); color: #fff; text-decoration: none; }
.btn-ghost { background: transparent; border: 1px solid var(--gold); color: var(--gold-deep); }

/* ── جدول المحتويات ── */
.toc { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 12px; padding: 1.1rem 1.3rem; margin: 1.5rem 0; }
.toc strong { display: block; margin-bottom: .6rem; }
.toc ol { margin: 0; padding-inline-start: 1.2rem; }
.toc li { margin-bottom: .35rem; }

/* ── قسم المقالات ذات الصلة ── */
.related { margin-top: 3rem; padding-top: 2rem; border-top: 2px solid var(--border); }

/* ── الفوتر ── */
.site-footer { background: var(--footer-bg); color: var(--footer-ink); margin-top: 4rem; padding: 3rem 0 1.5rem; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; margin-bottom: 2rem; }
.footer-grid h4 { color: #fff; margin: 0 0 .9rem; font-size: 1.05rem; }
.footer-grid a { color: #cbd2dc; display: block; padding: .3rem 0; font-size: .92rem; }
.footer-grid a:hover { color: var(--gold); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); padding-top: 1.3rem; font-size: .85rem; color: #97a1b0; text-align: center; }
.footer-brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; color: #fff; margin-bottom: .7rem; }

/* ── نموذج التواصل ── */
.form-field { margin-bottom: 1.1rem; }
.form-field label { display: block; margin-bottom: .4rem; font-weight: 600; }
.form-field input, .form-field textarea, .form-field select {
  width: 100%; padding: .7rem .9rem; border: 1px solid var(--border-strong);
  border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit;
}
.form-field input:focus, .form-field textarea:focus { outline: 2px solid var(--gold); border-color: var(--gold); }

/* ── مساعدات ── */
.text-center { text-align: center; }
.mt-2 { margin-top: 2rem; }
.section-title { text-align: center; font-size: 1.8rem; margin: 2.5rem 0 .5rem; }
.section-sub { text-align: center; color: var(--muted); margin: 0 auto 2rem; max-width: 600px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 1rem; margin: 1.5rem 0; }
.stat {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, var(--surface) 60%, var(--gold-tint) 150%);
  border: 1px solid var(--border); border-radius: 16px; padding: 1.3rem 1.1rem; text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.stat::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
}
.stat:hover { transform: translateY(-4px); box-shadow: 0 14px 34px rgba(0,0,0,.10); border-color: var(--gold); }
.stat .ic { font-size: 1.3rem; margin-bottom: .3rem; display: block; opacity: .85; }
.stat .num { font-size: 1.8rem; font-weight: 800; color: var(--gold-deep); font-variant-numeric: tabular-nums; display: flex; align-items: center; justify-content: center; gap: .3rem; }
.stat .lbl { font-size: .85rem; color: var(--muted); margin-top: .3rem; }
.stat .trend { font-size: .78rem; font-weight: 700; display: inline-flex; align-items: center; gap: .15rem; margin-top: .35rem; }
.trend-up { color: #1a7f37; }
.trend-down { color: #cf222e; }
.trend-flat { color: var(--muted); }

/* ── الرسم البياني لتطوّر السعر ── */
.chart-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 1.4rem 1.5rem 1.1rem; margin: 1.8rem 0; box-shadow: 0 4px 18px rgba(0,0,0,.05);
}
.chart-card h2 { margin: 0 0 1rem; font-size: 1.3rem; }
.chart-body { min-height: 120px; display: flex; align-items: center; justify-content: center; }
.chart-msg { color: var(--muted); text-align: center; font-size: .95rem; line-height: 1.8; max-width: 480px; margin: 1rem auto; }
.chart-svg-wrap { width: 100%; }

/* ── حاسبة سعر الذهب ── */
.calc-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 1.5rem; margin: 1.5rem 0 2rem; box-shadow: 0 4px 18px rgba(0,0,0,.05);
}
.calc-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem 1.2rem; margin-bottom: 1.2rem; }
@media (max-width: 560px) { .calc-grid { grid-template-columns: 1fr; } }
.calc-result { border-top: 2px dashed var(--border); padding-top: 1rem; }
.calc-row { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; font-size: .98rem; }
.calc-row span { color: var(--ink-soft); }
.calc-row strong { font-variant-numeric: tabular-nums; }
.calc-total { border-top: 1px solid var(--border); margin-top: .3rem; padding-top: .8rem; font-size: 1.2rem; }
.calc-total span { color: var(--ink-strong); font-weight: 700; }
.calc-total strong { color: var(--gold-deep); font-size: 1.35rem; }
.calc-note { font-size: .8rem; color: var(--muted); margin-top: 1rem; }

/* ── طباعة ── */
@media print { .site-header, .site-footer, .nav-toggle, .theme-btn { display: none; } }
