/* ============================================================
   SIDJIL — سِجِل : التصميم العصري الشامل
   Modern Cultural & Archival Digital Portal
   - تصميم هادئ، خفيف، ذكي وعصري
   - نظام لوني متناسق مع تبديل ليلي/نهاري فائق النعومة
   - شعاع ضوئي متحرك حول الشعار (Logo Ambient Light Ray)
   - محاذاة هندسية دقيقة وتناسق كامل لجميع العناصر والبطاقات
   - تجاوب مثالي مع الهواتف والأجهزة اللوحية وشاشات الحواسيب
   ============================================================ */

/* ---------- 0. الخطوط المحلية (بدون أي CDN خارجي) ----------
   Noto Kufi Arabic (متغير 100-900) للعناوين
   IBM Plex Sans Arabic (400/500/600/700) للنصوص والواجهة */
@font-face {
  font-family: 'Noto Kufi Arabic';
  src: url('/fonts/noto-kufi-arabic-var.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  src: url('/fonts/ibm-plex-sans-arabic-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  src: url('/fonts/ibm-plex-sans-arabic-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  src: url('/fonts/ibm-plex-sans-arabic-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  src: url('/fonts/ibm-plex-sans-arabic-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- 1. المتغيرات ونظام الألوان (Design Tokens) ---------- */
:root {
  /* الخطوط */
  --font-head: 'Noto Kufi Arabic', 'Amiri', 'Traditional Arabic', serif;
  --font-body: 'IBM Plex Sans Arabic', 'Tajawal', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* النمط النهاري (ألوان هادئة مستوحاة من الهوية التشادية الأصيلة) */
  --ink: #16202e;
  --ink-secondary: #425268;
  --muted: #64748b;
  --muted-light: #94a3b8;

  --paper: #fbfaf7;
  --paper-2: #f2eee3;
  --card: #ffffff;
  --chrome: rgba(255, 255, 255, 0.92);

  --line: #e6e0d2;
  --line-subtle: #f0ebe0;
  --line-strong: #d5cbba;

  /* ألوان الهوية: كحلي ملكي + ذهبي ترابي هادئ + لمسة تشادية وقورة */
  --teal: #1a365d;
  --teal-dark: #0f233f;
  --teal-light: #e8f0fe;
  --teal-soft: #2a4c80;

  --gold: #bfa150;
  --gold-soft: #dfc989;
  --gold-deep: #8c7128;
  --gold-glow: rgba(191, 161, 80, 0.38);

  --flag-red: #c14b45;
  --danger: #c14b45;

  /* التأثيرات والظلال */
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --radius-pill: 9999px;
  --shape-control: 16px;
  --shape-card: 24px;
  --shape-pill: 9999px;

  --shadow-sm: 0 1px 3px rgba(22, 32, 46, 0.04), 0 1px 2px rgba(22, 32, 46, 0.02);
  --shadow: 0 4px 18px -2px rgba(22, 32, 46, 0.06), 0 1px 3px rgba(22, 32, 46, 0.03);
  --shadow-hover: 0 12px 28px -4px rgba(22, 54, 93, 0.12), 0 4px 10px -2px rgba(22, 54, 93, 0.04);
  --shadow-lg: 0 18px 40px -8px rgba(22, 32, 46, 0.14);

  --code-bg: #f3efe4;
  --flag-stripe: linear-gradient(to right, #1a365d 0 33.3%, #c99f36 33.3% 66.6%, #c14b45 66.6% 100%);
  --header-blur: saturate(180%) blur(16px);
  color-scheme: light;
}

/* ---------- النمط الليلي (Dark Mode) ---------- */
[data-theme="dark"] {
  --ink: #f1f5f9;
  --ink-secondary: #cbd5e1;
  --muted: #94a3b8;
  --muted-light: #64748b;

  --paper: #0b1019;
  --paper-2: #121a28;
  --card: #152032;
  --chrome: rgba(18, 26, 40, 0.9);

  --line: #223147;
  --line-subtle: #192537;
  --line-strong: #2f4464;

  --teal: #5b8fe4;
  --teal-dark: #b8d2fc;
  --teal-light: rgba(91, 143, 228, 0.12);
  --teal-soft: #7da8ee;

  --gold: #e2b855;
  --gold-soft: #eccf8b;
  --gold-deep: #e2b855;
  --gold-glow: rgba(226, 184, 85, 0.45);

  --flag-red: #d9756f;
  --danger: #d9756f;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.45), 0 1px 4px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 14px 34px rgba(0, 0, 0, 0.6), 0 0 18px rgba(91, 143, 228, 0.12);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.7);

  --code-bg: #101724;
  --flag-stripe: linear-gradient(to right, #3867b3 0 33.3%, #e2b855 33.3% 66.6%, #d9756f 66.6% 100%);
  color-scheme: dark;
}

/* تأثير التبديل السلس بين الوضعين */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition: background-color 0.32s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.32s cubic-bezier(0.4, 0, 0.2, 1),
              color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.32s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* ---------- 2. التهيئة العامة والأساسيات ---------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.7;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

h1, h2, h3, h4, .brand-name, .hero-title, .section-title {
  font-family: var(--font-head);
  line-height: 1.35;
  color: var(--ink);
  margin-top: 0;
  font-weight: 700;
}

img, svg {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

a {
  color: var(--teal);
  text-decoration: none;
  transition: color 0.18s ease, opacity 0.18s ease;
}

a:hover {
  color: var(--gold-deep);
  text-decoration: none;
}

.wrap {
  width: 100%;
  max-width: 1220px;
  margin-inline: auto;
  padding-inline: 24px;
}

.skip {
  position: absolute;
  inset-inline-start: 16px;
  top: -80px;
  z-index: 999;
  background: var(--teal);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: top 0.2s ease;
}
.skip:focus {
  top: 16px;
}

/* ---------- 3. الشعاع الضوئي المتحرك حول الشعار (Logo Moving Ray) ---------- */
@keyframes logoRaySpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes logoPulseAura {
  0% {
    opacity: 0.45;
    transform: scale(0.96);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.06);
  }
  100% {
    opacity: 0.45;
    transform: scale(0.96);
  }
}

.brand-logo-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

/* الشعاع المداري المحيط بالشعار */
.brand-logo-wrap::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(191, 161, 80, 0.7) 45deg,
    rgba(91, 143, 228, 0.7) 90deg,
    transparent 140deg,
    transparent 180deg,
    rgba(191, 161, 80, 0.65) 225deg,
    rgba(91, 143, 228, 0.6) 270deg,
    transparent 320deg,
    transparent 360deg
  );
  filter: blur(5px);
  animation: logoRaySpin 7s linear infinite;
  pointer-events: none;
  z-index: 0;
}

/* هالة النبض الخفيفة */
.brand-logo-wrap::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(226, 184, 85, 0.3) 0%, rgba(26, 54, 93, 0.12) 60%, transparent 75%);
  animation: logoPulseAura 3.6s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.brand-logo {
  position: relative;
  z-index: 1;
  height: 36px;
  width: auto;
  filter: drop-shadow(0 2px 5px rgba(22, 32, 46, 0.18));
  transition: transform 0.25s ease;
}

.brand:hover .brand-logo {
  transform: scale(1.05);
}

/* شعاع الشعار الكبير في قسم البطل (Hero Seal) */
.hero-seal {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.hero-logo-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
}

.hero-logo-wrap::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(191, 161, 80, 0.8) 45deg,
    rgba(91, 143, 228, 0.75) 90deg,
    transparent 135deg,
    transparent 180deg,
    rgba(191, 161, 80, 0.75) 225deg,
    rgba(91, 143, 228, 0.7) 270deg,
    transparent 315deg,
    transparent 360deg
  );
  filter: blur(10px);
  animation: logoRaySpin 9s linear infinite;
  pointer-events: none;
  z-index: 0;
}

.hero-logo-wrap::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(226, 184, 85, 0.4) 0%, rgba(26, 54, 93, 0.2) 65%, transparent 80%);
  animation: logoPulseAura 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.hero-logo-wrap img {
  position: relative;
  z-index: 1;
  height: 84px;
  width: auto;
  filter: drop-shadow(0 4px 14px rgba(22, 32, 46, 0.25));
}

/* شعاع التذييل */
.footer-logo-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}
.footer-logo-wrap::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent, rgba(226, 184, 85, 0.45), transparent);
  filter: blur(4px);
  animation: logoRaySpin 8s linear infinite;
  pointer-events: none;
}
.footer-logo-wrap img {
  position: relative;
  z-index: 1;
  height: 32px;
  width: auto;
  max-width: 32px;
  display: block;
}

/* ---------- 4. الترويسة والتنقل (Site Header & Nav) ---------- */
.site-header {
  background: var(--chrome);
  backdrop-filter: var(--header-blur);
  -webkit-backdrop-filter: var(--header-blur);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.site-header::before {
  content: "";
  display: block;
  height: 3px;
  background: var(--flag-stripe);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-block: 10px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  flex-shrink: 0;
}
.brand:hover {
  text-decoration: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--teal-dark);
  letter-spacing: -0.01em;
}
[data-theme="dark"] .brand-name {
  color: var(--ink);
}

.brand-latin {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--gold-deep);
  font-family: var(--font-body);
  text-transform: uppercase;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  justify-content: flex-start;
  margin-inline: 14px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.4;
  transition: all 0.16s ease;
}

.nav-link:hover {
  background: var(--paper-2);
  color: var(--teal);
  text-decoration: none;
}

.nav-link.active {
  background: var(--teal);
  color: #ffffff;
  font-weight: 600;
}
[data-theme="dark"] .nav-link.active {
  background: var(--teal-light);
  color: var(--teal);
  border-color: var(--teal);
}

/* القائمة المنسدلة */
.nav-drop {
  position: relative;
}

.drop-caret {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
  opacity: 0.75;
}

.nav-drop.open .drop-caret,
.nav-drop:hover .drop-caret {
  transform: rotate(180deg);
}

.nav-drop-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-start: 0;
  min-width: 200px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 120;
  animation: dropMenuIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropMenuIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.nav-drop.open .nav-drop-menu,
.nav-drop:hover .nav-drop-menu,
.nav-drop:focus-within .nav-drop-menu {
  display: block;
}

.nav-drop-menu .nav-link {
  display: flex;
  width: 100%;
  padding: 9px 12px;
  border-radius: 6px;
}

/* حقل البحث بالترويسة */
.header-searchbox {
  display: flex;
  align-items: center;
  margin-inline-start: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--paper);
  padding: 3px 5px 3px 12px;
  width: 100%;
  max-width: 240px;
  transition: all 0.2s ease;
}

.header-searchbox:focus-within {
  border-color: var(--gold);
  background: var(--card);
  box-shadow: 0 0 0 3px var(--gold-glow);
  max-width: 270px;
}

.header-searchbox input[type="search"] {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 6px 8px;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--ink);
}

.header-searchbox input[type="search"]:focus {
  outline: none;
}

.header-searchbox button {
  border: 0;
  background: var(--teal);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.18s ease;
}

.header-searchbox button:hover {
  background: var(--gold-deep);
  transform: scale(1.05);
}

.header-searchbox button svg {
  width: 15px;
  height: 15px;
}

/* أدوات الترويسة */
.header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
  border-color: var(--gold);
  color: var(--gold);
  transform: rotate(18deg) scale(1.06);
}

.theme-toggle svg {
  width: 19px;
  height: 19px;
  transition: transform 0.2s ease;
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.lang-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  color: var(--teal);
  background: var(--card);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: all 0.18s ease;
}

.lang-switch:hover {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}

.nav-toggle {
  display: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  margin: 4px 0;
  border-radius: 2px;
  transition: 0.2s ease;
}

/* ---------- 5. قسم البطل (Hero Section) ---------- */
.hero {
  background:
    radial-gradient(900px 380px at 50% -40px, var(--gold-glow), transparent 70%),
    radial-gradient(600px 300px at 85% 20%, rgba(26, 54, 93, 0.05), transparent 70%),
    linear-gradient(180deg, var(--paper-2) 0%, var(--paper) 100%);
  color: var(--ink);
  text-align: center;
  padding: 56px 0 64px;
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .hero {
  background:
    radial-gradient(900px 380px at 50% -60px, rgba(226, 184, 85, 0.14), transparent 70%),
    radial-gradient(600px 300px at 80% 20%, rgba(91, 143, 228, 0.08), transparent 70%),
    linear-gradient(180deg, #111a28 0%, #0b1019 100%);
}

.hero-inner {
  max-width: 800px;
  margin-inline: auto;
  position: relative;
  z-index: 2;
}

.hero-title {
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  margin: 0.15em 0 0.1em;
  color: var(--teal-dark);
  letter-spacing: -0.02em;
}
[data-theme="dark"] .hero-title {
  color: var(--ink);
}

.hero-sub, .hero-latin {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gold-deep);
  margin-bottom: 0.6em;
}
[dir="ltr"] .hero-sub, [dir="ltr"] .hero-latin {
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.hero-tagline {
  font-family: var(--font-head);
  font-size: clamp(1.2rem, 3.2vw, 1.7rem);
  color: var(--teal);
  margin: 0.4em 0 0.5em;
  font-weight: 600;
}
[data-theme="dark"] .hero-tagline {
  color: var(--teal-soft);
}

.hero-desc {
  color: var(--ink-secondary);
  max-width: 650px;
  margin: 0 auto 2em;
  font-size: 1.05rem;
  line-height: 1.75;
}

.hero-search {
  display: flex;
  align-items: stretch;
  gap: 10px;
  max-width: 640px;
  margin-inline: auto;
  background: var(--card);
  padding: 6px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.hero-search:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px var(--gold-glow), var(--shadow);
}

.hero-input {
  flex: 1;
  min-width: 0;
  padding: 12px 18px;
  font-size: 1.05rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
}

.hero-input:focus {
  outline: none;
}

.hero-input::placeholder {
  color: var(--muted);
}

/* ---------- 6. الأزرار وعناصر التحكم (Buttons) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.5;
  text-decoration: none;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--teal);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--teal-dark);
  color: #ffffff;
}
[data-theme="dark"] .btn-primary {
  background: var(--teal);
  color: #ffffff;
}
[data-theme="dark"] .btn-primary:hover {
  background: #4679cb;
}

.btn-ghost {
  background: var(--card);
  border-color: var(--line);
  color: var(--ink);
}
.btn-ghost:hover {
  border-color: var(--gold);
  color: var(--gold-deep);
  background: var(--paper-2);
}

.btn-lg {
  padding: 13px 30px;
  font-size: 1.02rem;
  border-radius: var(--radius);
}

.btn-small {
  padding: 5px 14px;
  font-size: 0.85rem;
  border-radius: 6px;
}

/* ---------- 7. الأقسام والعناوين الموحدة (Sections & Titles) ---------- */
.section {
  padding-block: 48px 12px;
}
.section:last-of-type {
  padding-bottom: 70px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.section-title {
  font-size: 1.65rem;
  margin: 0;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

/* علامة ذهبية مميزة لكل عنوان قسم */
.section-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 22px;
  background: var(--gold);
  border-radius: 2px;
}

.section:not(:has(.section-head)) .section-title {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  width: 100%;
}

.more-link {
  white-space: nowrap;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--teal);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.18s ease;
}
.more-link:hover {
  color: var(--gold-deep);
  transform: translateX(-3px);
}
[dir="ltr"] .more-link:hover {
  transform: translateX(3px);
}

/* ---------- 8. شريط أقسام سِجِل السبعة (Sections Strip) ---------- */
.sections-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.section-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 16px 14px;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 96px;
}

.section-tile:hover {
  text-decoration: none;
  transform: translateY(-4px);
  border-color: var(--gold);
  box-shadow: var(--shadow-hover);
}

.section-tile-title {
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--teal-dark);
  line-height: 1.25;
}
[data-theme="dark"] .section-tile-title {
  color: var(--ink);
}

.section-tile-count {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}

/* ---------- 9. شبكة الوصول السريع (Quick Access) ---------- */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.quick-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 14px;
  text-align: center;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.quick-card:hover {
  text-decoration: none;
  transform: translateY(-4px);
  border-color: var(--gold);
  box-shadow: var(--shadow-hover);
}

.quick-icon {
  font-size: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--paper-2);
  margin-bottom: 4px;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.quick-card:hover .quick-icon {
  transform: scale(1.1);
  background: var(--teal-light);
}

.quick-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--ink);
}

.quick-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-pill);
  padding: 1px 10px;
}

/* ---------- 10. بطاقات المواد والأرشيف (Archive Cards Grid) ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: all 0.24s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
  border-color: var(--gold-soft);
}

.card-link {
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
}
.card-link:hover {
  text-decoration: none;
}

.card-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  transition: transform 0.35s ease;
}

.card:hover .card-thumb {
  transform: scale(1.02);
}

.card-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 1.35rem;
  background: repeating-linear-gradient(
    45deg,
    var(--paper-2),
    var(--paper-2) 12px,
    var(--line-subtle) 12px,
    var(--line-subtle) 24px
  );
}

.card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.card-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
}

.badge-type {
  background: var(--teal);
  color: #ffffff;
}
[data-theme="dark"] .badge-type {
  background: var(--teal-light);
  color: var(--teal);
  border: 1px solid var(--teal);
}

.badge-ark {
  background: var(--paper-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.card-title {
  font-size: 1.2rem;
  margin: 0 0 6px;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.35;
}

.card-orig {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 8px;
  line-height: 1.4;
}

.card-snippet {
  font-size: 0.88rem;
  color: var(--ink-secondary);
  margin: 8px 0;
  line-height: 1.6;
}

.card-snippet mark {
  background: #fde8a0;
  color: #3b2c00;
  border-radius: 3px;
  padding: 1px 4px;
}
[data-theme="dark"] .card-snippet mark {
  background: #7a5d13;
  color: #fff9e6;
}

/* محاذاة البيانات الوصفية بدقة في أسفل البطاقة */
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.card-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ---------- 11. المناطق والمجموعات (Regions & Collections) ---------- */
.region-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.region-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.region-chip:hover {
  text-decoration: none;
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.region-count {
  background: var(--paper-2);
  border-radius: var(--radius-pill);
  padding: 1px 10px;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.collections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.collection-card {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  border-top: 4px solid var(--teal);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
  box-shadow: var(--shadow-sm);
  transition: all 0.24s cubic-bezier(0.4, 0, 0.2, 1);
}

.collection-card:hover {
  text-decoration: none;
  border-top-color: var(--gold);
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.collection-card-title {
  font-family: var(--font-head);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--teal-dark);
}
[data-theme="dark"] .collection-card-title {
  color: var(--ink);
}

.collection-card-desc {
  color: var(--ink-secondary);
  font-size: 0.92rem;
  flex: 1 1 auto;
  line-height: 1.6;
}

.collection-card-count {
  color: var(--gold-deep);
  font-size: 0.85rem;
  font-weight: 600;
}

.collection-card-go {
  color: var(--teal);
  font-weight: 600;
  font-size: 0.92rem;
}

/* ---------- 12. الإعلانات والتنبيهات (Announcements) ---------- */
.announcements {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-block: 16px 8px;
}

.announcement {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 14px 48px 14px 18px;
  box-shadow: var(--shadow-sm);
}

[dir="ltr"] .announcement {
  padding: 14px 18px 14px 48px;
}

.announcement h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  color: var(--ink);
}

.announcement p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-secondary);
  line-height: 1.6;
}

.announcement .ann-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--teal);
}

.ann-dismiss {
  position: absolute;
  inset-inline-end: 12px;
  top: 12px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.18s ease;
}

.ann-dismiss:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* ---------- 13. شريط التصفية والبحث المتقدم (Filters & Search) ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-block: 18px 24px;
  box-shadow: var(--shadow-sm);
}

.filter-q {
  flex: 2 1 240px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--paper);
  color: var(--ink);
}
.filter-q:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
}

.filter-field select {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  background: var(--paper);
  color: var(--ink);
  min-width: 150px;
}
.filter-field select:focus {
  outline: none;
  border-color: var(--gold);
}

.big-search {
  display: flex;
  gap: 12px;
  max-width: 680px;
  margin-block: 16px;
}

.big-search input[type="search"] {
  flex: 1;
  padding: 12px 18px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-family: inherit;
  background: var(--card);
  color: var(--ink);
}
.big-search input[type="search"]:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.adv-form {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 860px;
}

.adv-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 0.95rem;
}

.adv-field input, .adv-field select {
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  background: var(--paper);
  color: var(--ink);
}

.adv-field input:focus, .adv-field select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.adv-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.adv-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* ترقيم الصفحات */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-block: 36px;
}

.pg-btn, .pg-num {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 500;
}
.pg-btn:hover, .pg-num:hover {
  border-color: var(--gold);
  color: var(--gold-deep);
  text-decoration: none;
}

.pg-cur {
  background: var(--teal);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.92rem;
  font-weight: 600;
}

.pg-info {
  margin-inline-start: auto;
  color: var(--muted);
  font-size: 0.88rem;
}

/* ---------- 14. صفحة المادة الأرشيفية (Document Detail View) ---------- */
.doc {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 42px);
  margin-block: 16px 60px;
}

.doc-head {
  border-bottom: 2px solid var(--line);
  padding-bottom: 20px;
  margin-bottom: 12px;
}

.doc-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.doc-title {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  margin: 0 0 6px;
  color: var(--ink);
}

.doc-title-orig {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0;
}

.doc-section {
  padding-block: 24px;
  border-bottom: 1px solid var(--line);
}
.doc-section:last-child {
  border-bottom: 0;
}

.doc-section-title {
  font-size: 1.45rem;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0 32px;
  margin: 0 0 16px;
}

.meta-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.95rem;
  align-items: baseline;
}

.meta-row dt {
  color: var(--muted);
  font-weight: 600;
}

.meta-row dd {
  margin: 0;
  color: var(--ink);
}

.ref {
  background: var(--paper-2);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: var(--font-mono);
}

.chip-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.chip-group-label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.chip, .tag-chip {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 4px 14px;
  font-size: 0.88rem;
  color: var(--ink);
  transition: all 0.18s ease;
}

.chip:hover, .tag-chip:hover {
  border-color: var(--gold);
  background: var(--card);
  text-decoration: none;
}

/* شارات موثوقية المعلومة */
.conf {
  font-size: 0.75rem;
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  border: 1px solid;
  white-space: nowrap;
}
.conf-confirmed { color: #15803d; border-color: #86efac; background: #f0fdf4; }
.conf-approximate, .conf-probable { color: #b45309; border-color: #fde68a; background: #fefce8; }
.conf-unknown { color: var(--muted); border-color: var(--line); background: var(--paper); }
[data-theme="dark"] .conf-confirmed { color: #86efac; border-color: #166534; background: #052e16; }
[data-theme="dark"] .conf-approximate, [data-theme="dark"] .conf-probable { color: #fde047; border-color: #854d0e; background: #422006; }

/* معرض الصور وعارض الوثائق */
.version-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.ver-tab {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--radius-pill);
  padding: 7px 18px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink);
  transition: all 0.18s ease;
}

.ver-tab:hover {
  border-color: var(--gold);
}

.ver-tab.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  font-weight: 600;
}

.gallery-main {
  background: #0f141c;
  border-radius: var(--radius);
  overflow: hidden;
  text-align: center;
  box-shadow: var(--shadow);
}

.gallery-main img {
  max-height: 72vh;
  width: auto;
  max-width: 100%;
  display: inline-block;
}

/* مقارنة قبل/بعد */
.compare-wrap {
  margin-top: 28px;
}

.compare {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: #0f141c;
  user-select: none;
  box-shadow: var(--shadow);
}

.compare-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 72vh;
  object-fit: contain;
  background: #0f141c;
  pointer-events: none;
}

.compare-before {
  position: absolute;
  inset: 0;
  overflow: hidden;
  width: 50%;
  border-inline-end: 3px solid var(--gold);
}

.compare-before img {
  width: 100vw;
  max-width: none;
  height: 100%;
  object-fit: contain;
}

.compare-label {
  position: absolute;
  top: 14px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(15, 20, 28, 0.85);
  backdrop-filter: blur(4px);
  color: #fff;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  pointer-events: none;
}
.label-before { inset-inline-start: 14px; }
.label-after { inset-inline-end: 14px; }

.compare-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
  margin: 0;
}

.compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gold);
  inset-inline-start: 50%;
  transform: translateX(50%);
  pointer-events: none;
}
[dir="ltr"] .compare-handle {
  transform: translateX(-50%);
}

.compare-handle::after {
  content: "◂ ▸";
  position: absolute;
  top: 50%;
  inset-inline-start: 50%;
  transform: translate(50%, -50%);
  background: var(--gold);
  color: #fff;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
[dir="ltr"] .compare-handle::after {
  transform: translate(-50%, -50%);
}

/* التنبيهات وإخلاء المسؤولية */
.disclaimers {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.disclaimer {
  background: #fef9ed;
  border: 1px solid #fae4ad;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 0.92rem;
  color: #7a5d13;
  line-height: 1.6;
}
[data-theme="dark"] .disclaimer {
  background: #2b220e;
  border-color: #634b15;
  color: #f7e3af;
}

/* النصوص المفرغة والترجمة الموازية */
.text-block {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  white-space: pre-wrap;
  font-size: 1rem;
  max-height: 500px;
  overflow: auto;
  line-height: 1.8;
}

.side-by-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.seg-table {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.seg-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
}

.seg-col {
  padding: 16px 20px;
  line-height: 1.75;
}

.seg-src {
  background: var(--paper);
  border-inline-end: 1px solid var(--line);
}

.seg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.seg-num { font-family: var(--font-mono); font-size: 0.8em; opacity: 0.6; }
.seg-page { font-size: 0.8em; opacity: 0.75; }

/* شارات حالات الترجمة */
.status-badge {
  font-size: 0.78rem;
  border-radius: var(--radius-pill);
  padding: 3px 12px;
  border: 1px solid;
  font-weight: 500;
}
.status-none { color: var(--muted); border-color: var(--line); background: var(--paper); }
.status-machine { color: #b45309; border-color: #fde68a; background: #fefce8; }
.status-in_review { color: #0369a1; border-color: #bae6fd; background: #f0f9ff; }
.status-reviewed { color: #15803d; border-color: #bbf7d0; background: #f0fdf4; }
.status-approved { color: #fff; border-color: var(--teal); background: var(--teal); }

/* الاستشهاد الأكاديمي */
.citation-text {
  background: var(--paper-2);
  border-inline-start: 4px solid var(--teal);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  font-size: 1rem;
  margin: 0 0 16px;
  line-height: 1.7;
}

.citation-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* صندوق المشاركة — أيقونات */
.share-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-block: 18px;
  padding: 14px 20px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.share-title {
  font-weight: 700;
  font-size: 1.08rem;
  color: var(--ink);
  margin: 0;
}

.share-icons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.share-ic {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 1px solid var(--line);
  cursor: pointer;
  padding: 0;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.share-ic svg {
  width: 21px;
  height: 21px;
  fill: #6b7482;
  transition: fill 0.18s ease;
}

.share-ic img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: block;
}

.share-ic:hover,
.share-ic:focus-visible {
  background: var(--sc, var(--gold));
  border-color: var(--sc, var(--gold));
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
  text-decoration: none;
  outline: none;
}

.share-ic:hover svg,
.share-ic:focus-visible svg {
  fill: #fff;
}

.share-ic.is-copied {
  background: #1c7c4a;
  border-color: #1c7c4a;
}

.share-ic.is-copied svg {
  fill: #fff;
}

/* أزرار أيقونات دائرية محايدة (الاستشهاد والإجراءات) */
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  background: var(--card);
  border: 1px solid var(--line);
  color: #6b7482;
  cursor: pointer;
  padding: 0;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.icon-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
  text-decoration: none;
  outline: none;
}

.icon-btn.is-copied {
  background: #1c7c4a;
  border-color: #1c7c4a;
  color: #fff;
}

/* قانون عام للمنصة: النصوص والمقالات والاقتباسات متحاذية الأطراف تمامًا */
.doc-desc,
.text-block,
.citation-text,
.page-desc,
blockquote {
  text-align: justify;
}

/* ---------- 15. المجلة والأعداد (Journal) ---------- */
.journal-hero {
  text-align: center;
  margin-block: 12px 28px;
}

.journal-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 48px;
}

.journal-issue-card {
  display: flex;
  gap: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  align-items: flex-start;
  transition: all 0.22s ease;
}

.journal-issue-card:hover {
  text-decoration: none;
  border-color: var(--gold);
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.journal-issue-cover {
  width: 130px;
  flex: 0 0 130px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.journal-issue-cover img {
  width: 100%;
  height: auto;
  display: block;
}

.journal-issue-cover.placeholder {
  aspect-ratio: 3 / 4;
  background: var(--paper-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  color: var(--gold);
  font-family: var(--font-head);
}

.journal-issue-body h3 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  color: var(--ink);
}

.journal-issue-body p {
  margin: 0 0 10px;
  color: var(--ink-secondary);
  font-size: 0.94rem;
  line-height: 1.6;
}

/* عارض PDF */
.hidden { display: none !important; }

.pdf-viewer {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #1e2229;
  box-shadow: var(--shadow);
}

.pdf-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #13171e;
  color: #eee;
}

.pdf-pageinfo {
  color: #eee;
  font-size: 0.9rem;
  min-width: 80px;
  text-align: center;
}

.pdf-sep {
  flex: 0 0 1px;
  align-self: stretch;
  background: #444;
  margin: 2px 4px;
}

.pdf-canvas-wrap {
  overflow: auto;
  max-height: 80vh;
  display: flex;
  justify-content: center;
  padding: 16px;
  direction: ltr !important;
  unicode-bidi: isolate;
}

.pdf-canvas-wrap canvas {
  background: #fff;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  max-width: 100%;
  height: auto;
  direction: ltr !important;
  unicode-bidi: isolate;
}

.pdf-reading-page,
.pdf-reading-page canvas {
  direction: ltr !important;
  unicode-bidi: isolate;
}

.pdf-reading-pages { max-height: min(82vh, 960px); overflow: auto; padding: .75rem; background: #252a31; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scroll-behavior: smooth; }
.pdf-reading-page { display: grid; justify-items: center; margin: 0 auto .8rem; width: max-content; min-width: 100%; }
.pdf-reading-page canvas { display: block; max-width: none; background: #fff; box-shadow: 0 3px 14px rgba(0,0,0,.35); }
.pdf-viewer.pdf-mobile-fullscreen,
.pdf-viewer:fullscreen { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; width: 100vw; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; background: #171b21; }
.pdf-viewer.pdf-mobile-fullscreen .pdf-toolbar,
.pdf-viewer:fullscreen .pdf-toolbar { position: sticky; top: 0; z-index: 2; flex: none; }
.pdf-viewer.pdf-mobile-fullscreen .pdf-canvas-wrap,
.pdf-viewer:fullscreen .pdf-canvas-wrap,
.pdf-viewer.pdf-mobile-fullscreen .pdf-reading-pages,
.pdf-viewer:fullscreen .pdf-reading-pages { flex: 1; width: 100%; max-height: none; min-height: 0; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
@media (max-width: 640px) {
  .pdf-viewer { width: 100%; max-width: 100%; border-radius: 14px; }
  .pdf-toolbar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; overscroll-behavior-inline: contain; padding: 8px; scrollbar-width: thin; }
  .pdf-toolbar > * { flex: 0 0 auto; }
  .pdf-toolbar .pdf-sep { display: none; }
  .pdf-pageinfo { min-width: 58px; }
  .pdf-canvas-wrap { width: 100%; max-height: 72dvh; min-height: 56dvh; padding: 5px; overflow: auto; align-items: flex-start; justify-content: center; touch-action: pan-x pan-y; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .pdf-canvas-wrap canvas { flex: none; max-width: none; }
  .pdf-reading-pages { max-height: 74dvh; padding: .4rem 0; scroll-snap-type: y proximity; }
  .pdf-reading-page { min-width: 100%; margin-bottom: .5rem; scroll-snap-align: start; }
  .pdf-reading-page canvas { max-width: 100%; height: auto; }
  .pdf-viewer.pdf-mobile-fullscreen .pdf-toolbar,
  .pdf-viewer:fullscreen .pdf-toolbar { overflow-x: auto; }
}

/* ---------- 16. بطاقات القوائم والتصنيفات (Lists & Categories) ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.cat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 18px;
  text-align: center;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: all 0.22s ease;
}

.cat-card:hover {
  text-decoration: none;
  border-color: var(--gold);
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.cat-icon {
  font-size: 2.4rem;
  display: block;
  margin-bottom: 10px;
}

.cat-name {
  display: block;
  font-family: var(--font-head);
  font-size: 1.3rem;
  font-weight: 700;
}

.cat-count {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 4px;
  display: block;
}

.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.list-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.list-card:hover {
  text-decoration: none;
  border-color: var(--gold);
  transform: translateY(-2px);
}

.list-card-title {
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 700;
}

.list-card-meta {
  color: var(--muted);
  font-size: 0.86rem;
}

/* صفحة الأقسام العامة */
.section-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  height: 100%;
  margin-bottom: 0;
  transition: all 0.2s ease;
}

.section-card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-hover);
}

.section-card h2 {
  margin: 0;
  font-size: 1.55rem;
}

.section-card h2 a {
  color: var(--ink);
}

.section-card h2 a:hover {
  color: var(--teal);
}

.section-card p {
  margin: 0;
  color: var(--ink-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.section-card .sec-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
}

.section-count {
  font-size: 0.88rem;
  color: var(--muted);
}

/* ---------- 17. التذييل (Site Footer) ---------- */
.site-footer {
  background: #0f1c33;
  color: #c9d5e8;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .site-footer {
  background: #080d16;
  border-top: 1px solid var(--line);
}

.site-footer::before {
  content: "";
  display: block;
  height: 3px;
  background: var(--flag-stripe);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 36px;
  padding-block: 44px 30px;
}

.footer-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.footer-brand img {
  height: 32px !important;
  width: auto !important;
  max-width: 34px !important;
  display: block;
}

.footer-name {
  font-family: var(--font-head);
  font-size: 1.4rem;
  color: #ffffff;
  font-weight: 700;
}

.footer-name .latin {
  font-family: var(--font-body);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  color: var(--gold-soft);
  text-transform: uppercase;
}

.footer-tag {
  font-size: 0.88rem;
  color: var(--gold-soft);
}

.footer-about {
  font-size: 0.92rem;
  max-width: 440px;
  color: #a8b8d4;
  line-height: 1.7;
}

.footer-col h3 {
  color: #ffffff;
  font-size: 1.1rem;
  margin: 0 0 14px;
  font-weight: 700;
}

.footer-col a {
  display: block;
  color: #c0d0ec;
  font-size: 0.92rem;
  margin-bottom: 8px;
  transition: all 0.18s ease;
}

.footer-col a:hover {
  color: #ffffff;
  transform: translateX(-3px);
}
[dir="ltr"] .footer-col a:hover {
  transform: translateX(3px);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-block: 16px;
  font-size: 0.85rem;
  color: #90a3c4;
}

/* ---------- 18. التجاوب الكامل للشاشات (Responsive Design) ---------- */

/* الحواسيب اللوحية وما دون (Tablet & Mobile <= 900px) */
@media (max-width: 900px) {
  .nav-toggle {
    display: block;
    margin-inline-start: auto;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    inset-inline: 0;
    background: var(--card);
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 16px 20px 22px;
    border-bottom: 2px solid var(--gold);
    box-shadow: var(--shadow-lg);
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    margin-inline: 0;
    z-index: 99;
  }

  .main-nav.open {
    display: flex;
    animation: dropMenuIn 0.2s ease;
  }

  .header-searchbox {
    order: -1;
    max-width: none;
    flex: none;
    margin: 0 0 10px;
    background: var(--paper);
  }

  .main-nav .nav-link {
    padding: 12px 14px;
    font-size: 1rem;
    width: 100%;
    justify-content: flex-start;
    border-radius: var(--radius-sm);
  }

  .nav-drop-menu {
    position: static;
    box-shadow: none;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 6px;
    min-width: 0;
    margin-top: 4px;
  }

  .header-inner {
    flex-wrap: wrap;
    row-gap: 8px;
    position: relative;
  }

  .header-tools {
    margin-inline-start: 0;
  }

  .side-by-side {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .adv-row {
    grid-template-columns: 1fr;
  }

  .meta-row {
    grid-template-columns: 120px 1fr;
  }

  .hero-search {
    flex-direction: column;
    padding: 10px;
  }

  .hero-search .btn-lg {
    width: 100%;
  }

  .hero {
    padding: 44px 0 52px;
  }

  .journal-issue-card {
    flex-direction: column;
  }

  .journal-issue-cover {
    width: 100%;
    flex: none;
    max-width: 200px;
  }
}

/* شاشات الهواتف المتوسطة (<= 640px) */
@media (max-width: 640px) {
  .wrap {
    padding-inline: 16px;
  }

  .cards-grid {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  .card-body {
    padding: 12px 14px 14px;
  }

  .card-title {
    font-size: 1.05rem;
  }

  .quick-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .sections-strip {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .collections-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .section-card {
    padding: 16px 14px;
    gap: 8px;
  }

  .section-card h2 {
    font-size: 1.2rem;
  }

  .section-card p {
    font-size: 0.88rem;
    line-height: 1.5;
  }

  .section-card .sec-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding-top: 8px;
  }

  .section {
    padding-block: 36px 8px;
  }

  .doc {
    padding: 20px 16px;
    margin-block: 10px 40px;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-field select {
    width: 100%;
    min-width: 0;
  }

  .pg-info {
    width: 100%;
    margin: 0;
  }

  .seg-row {
    grid-template-columns: 1fr;
  }

  .seg-src {
    border-inline-end: 0;
    border-bottom: 1px solid var(--line);
  }

  .pdf-canvas-wrap {
    max-height: 70vh;
    padding: 8px;
  }
}

/* شاشات الهواتف الصغيرة (<= 440px) */
@media (max-width: 440px) {
  .cards-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .card-thumb {
    aspect-ratio: 16 / 9;
  }

  .brand-latin {
    display: none;
  }

  .brand-name {
    font-size: 1.35rem;
  }

  .hero {
    padding: 34px 0 42px;
  }

  .hero-logo-wrap {
    width: 80px;
    height: 80px;
  }
  .hero-logo-wrap img {
    height: 70px;
  }

  .meta-row {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 8px 0;
  }

  .section-title {
    font-size: 1.4rem;
  }

  .sections-strip {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px;
  }

  .section-tile {
    padding: 12px 10px;
    min-height: 80px;
    gap: 6px;
  }

  .section-tile-title {
    font-size: 1.05rem;
  }

  .section-tile-count {
    font-size: 0.78rem;
  }

  .collections-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px;
  }

  .section-card {
    padding: 14px 10px;
    gap: 6px;
  }

  .section-card h2 {
    font-size: 1.05rem;
  }

  .section-card p {
    font-size: 0.82rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .section-card .sec-foot {
    font-size: 0.8rem;
    gap: 4px;
    padding-top: 6px;
  }

  .quick-grid {
    grid-template-columns: 1fr 1fr;
  }

  .announcement {
    padding: 12px 38px 12px 14px;
  }
  [dir="ltr"] .announcement {
    padding: 12px 14px 12px 38px;
  }
}

/* طباعة (Print) */
@media print {
  .site-header, .site-footer, .citation-actions, .version-tabs, .compare-wrap, .share-box {
    display: none !important;
  }
  .doc {
    box-shadow: none !important;
    border: 0 !important;
  }
}

/* ============================================================
   خريطة سِجِل التفاعلية (SVG)
   ============================================================ */
.smap-root {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 8px 28px rgba(22, 32, 46, 0.06);
}
.smap-loading, .smap-error, .smap-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
  font-size: 0.95rem;
}
.smap-error { color: #b3261e; }

.smap-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  margin-bottom: 12px;
}
.smap-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--ink-secondary);
}
.smap-select {
  font: inherit;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 12px;
  cursor: pointer;
}
.smap-kinds { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.smap-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 0.86rem;
  color: var(--ink-secondary);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 13px;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s, border-color 0.15s;
}
.smap-chip.is-on { opacity: 1; border-color: var(--gold); }

.smap-dot {
  width: 11px; height: 11px; border-radius: 50%;
  display: inline-block; flex: none;
}
.smap-dot-city   { background: #c0392b; box-shadow: 0 0 0 3px rgba(192,57,43,0.18); }
.smap-dot-region { background: #1a7a6d; }
.smap-dot-site   { background: #bfa150; border-radius: 3px; }

.smap-stage {
  position: relative;
  max-width: 620px;
  margin: 0 auto;
}
.smap-svg { width: 100%; height: auto; display: block; }
.smap-province {
  fill: var(--paper-2);
  stroke: var(--line-strong);
  stroke-width: 1.1;
}
.smap-province:hover { fill: var(--teal-light); }
.smap-label { pointer-events: none; }
.smap-label-ar {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  fill: var(--ink-secondary);
  paint-order: stroke;
  stroke: var(--card);
  stroke-width: 3px;
}
.smap-label-fr {
  font-size: 9.5px;
  fill: var(--muted);
  paint-order: stroke;
  stroke: var(--card);
  stroke-width: 3px;
}
.smap-label-anchor { fill: var(--gold-deep); }
.smap-label-leader { stroke: var(--gold-deep); stroke-width: 1; }

.smap-pt { cursor: pointer; outline: none; }
.smap-pt .smap-ring {
  fill: none;
  stroke: #c0392b;
  stroke-width: 2;
  opacity: 0.85;
}
.smap-pt-city .smap-dotc   { fill: #c0392b; stroke: #fff; stroke-width: 1.5; }
.smap-pt-region .smap-dotc { fill: #1a7a6d; stroke: #fff; stroke-width: 1.5; }
.smap-pt-site .smap-dotc   { fill: #bfa150; stroke: #fff; stroke-width: 1.5; }
.smap-pt:hover .smap-dotc, .smap-pt:focus .smap-dotc { stroke: var(--gold); stroke-width: 2.5; }

.smap-tip {
  position: absolute;
  z-index: 5;
  max-width: 260px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(22, 32, 46, 0.18);
  padding: 12px 14px;
  font-size: 0.86rem;
  pointer-events: auto;
}
.smap-tip-place {
  font-size: 0.75rem;
  color: var(--gold-deep);
  font-weight: 700;
  margin-bottom: 2px;
}
.smap-tip-title { font-weight: 700; margin-bottom: 4px; line-height: 1.5; }
.smap-tip-date { font-size: 0.78rem; color: var(--muted); margin-bottom: 6px; }
.smap-tip-sum { margin: 0 0 8px; color: var(--ink-secondary); line-height: 1.6; font-size: 0.82rem; }
.smap-tip-link {
  color: var(--teal-soft);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.84rem;
}
.smap-tip-link:hover { text-decoration: underline; }

.smap-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}
.smap-legend { display: inline-flex; gap: 14px; flex-wrap: wrap; }
.smap-leg { display: inline-flex; align-items: center; gap: 6px; }

@media (max-width: 640px) {
  .smap-root { padding: 12px; }
  .smap-label-ar { font-size: 11px; }
  .smap-label-fr { font-size: 8px; }
  .smap-tip { max-width: 210px; }
}

/* ============================================================
   19. طبقة التحسين الشامل (Design Refresh Layer)
   - سلم طباعي مرن، إيقاع عمودي موحد
   - انتقالات موحدة 200ms، حالات تركيز مرئية
   - تلميع البطاقات/الأزرار/النماذج/الشارات/الترقيم
   - دعم prefers-reduced-motion، تلميع الوضع الليلي
   ملاحظة: هذه الطبقة تُحسّن فقط — لا تغيّر أسماء الأصناف.
   ============================================================ */

/* ---------- 19.1 رموز الطباعة والحركة ---------- */
:root {
  --fs-xs: 0.78rem;
  --fs-sm: 0.88rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: clamp(1.25rem, 1.1rem + 0.8vw, 1.5rem);
  --fs-2xl: clamp(1.5rem, 1.25rem + 1.4vw, 2rem);
  --fs-3xl: clamp(1.9rem, 1.5rem + 2.2vw, 2.75rem);
  --leading-tight: 1.35;
  --leading-base: 1.7;
  --leading-loose: 1.9;
  --tr: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --focus-ring: 0 0 0 3px var(--gold-glow);
  --tap: 44px;
  --section-gap: clamp(36px, 5vw, 64px);
}

/* ---------- 19.2 إيقاع عمودي موحد ---------- */
.section {
  padding-block: var(--section-gap) 12px;
}
.section-head {
  margin-bottom: 22px;
}
.page-title {
  font-size: var(--fs-2xl);
  line-height: var(--leading-tight);
  letter-spacing: 0;
  text-wrap: balance;
}
.section-title {
  font-size: var(--fs-xl);
  line-height: var(--leading-tight);
  text-wrap: balance;
}
.hero-title {
  font-size: var(--fs-3xl);
  line-height: 1.4;
  text-wrap: balance;
}
.doc-desc, .text-block, .page-desc {
  line-height: var(--leading-loose);
}

/* ---------- 19.3 انتقالات موحدة 200ms ---------- */
.btn, .card, .nav-link, .pg-btn, .pg-num, .chip, .tag-chip,
.section-tile, .quick-tile, .collection-card, .section-card,
.icon-btn, .share-ic, .theme-toggle, .lang-switch, .more-link,
.region-chip, .ver-tab, .smap-chip {
  transition: background-color var(--tr), border-color var(--tr),
              color var(--tr), box-shadow var(--tr), transform var(--tr),
              opacity var(--tr);
}

/* ---------- 19.4 حلقة تركيز مرئية وموحدة (لوحة المفاتيح) ---------- */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}
.btn:focus-visible, .pg-btn:focus-visible, .pg-num:focus-visible,
.icon-btn:focus-visible, .share-ic:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  box-shadow: var(--focus-ring);
}

/* ---------- 19.5 الأزرار: محاذاة وملمس عصري ---------- */
.btn {
  min-height: 42px;
  letter-spacing: 0;
}
.btn-small {
  min-height: 0;
}
.btn-primary {
  box-shadow: 0 2px 10px -2px rgba(26, 54, 93, 0.35);
}
.btn-primary:hover {
  box-shadow: 0 6px 18px -4px rgba(26, 54, 93, 0.45);
}
.btn:active {
  transform: translateY(1px);
}
.btn[disabled], .btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ---------- 19.6 البطاقات: عمق أنعم وحدود أدق ---------- */
.card, .section-card, .collection-card, .section-tile, .quick-tile {
  border: 1px solid var(--line);
}
.card:hover, .section-card:hover, .collection-card:hover {
  border-color: var(--line-strong);
}
.card-title {
  line-height: 1.55;
  text-wrap: pretty;
}

/* ---------- 19.7 النماذج: إيقاع وحلقة تركيز ----------
   (مقصورة على سياقات النماذج القياسية حتى لا تتأثر صناديق البحث المركبة) */
.adv-field input, .adv-field select,
.filter-field input, .filter-field select {
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  min-height: 42px;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.adv-field input:focus, .adv-field select:focus,
.filter-field input:focus, .filter-field select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: var(--focus-ring);
}
.adv-field input::placeholder, .filter-field input::placeholder {
  color: var(--muted);
  opacity: 0.9;
}
.adv-field, .filter-field {
  font-weight: 600;
}
.adv-field > span:first-child, .filter-field > span:first-child {
  margin-bottom: 2px;
}

/* ---------- 19.8 الشارات والرقائق ---------- */
.badge, .chip, .tag-chip {
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.6;
}

/* ---------- 19.9 مسار التنقل (breadcrumbs) ---------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-bottom: 10px;
}
.breadcrumb a {
  color: var(--teal-soft);
  font-weight: 600;
}
.breadcrumb a:hover {
  color: var(--gold-deep);
  text-decoration: underline;
}
.breadcrumb > *:not(:last-child)::after {
  content: "/";
  margin-inline-start: 8px;
  color: var(--muted-light);
  font-weight: 400;
}
[dir="ltr"] .breadcrumb > *:not(:last-child)::after {
  content: "/";
}

/* ---------- 19.10 ترقيم الصفحات ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-block: 28px 8px;
}
.pg-btn, .pg-num {
  min-width: var(--tap);
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
  font-size: var(--fs-sm);
}
.pg-btn:hover, .pg-num:hover {
  border-color: var(--gold);
  color: var(--gold-deep);
  transform: translateY(-1px);
}
.pg-num.current, .pg-num[aria-current="page"] {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  cursor: default;
}
.pg-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* ---------- 19.11 الترويسة: محاذاة دقيقة للجوال ---------- */
.header-inner {
  min-height: 68px;
  align-items: center;
}
.nav-toggle {
  min-width: var(--tap);
  min-height: var(--tap);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0;
}
.nav-toggle span {
  transition: transform var(--tr), opacity var(--tr);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ---------- 19.12 شبكات مرنة موحدة (سطح المكتب فأعلى) ---------- */
@media (min-width: 641px) {
  .cards-grid, .collections-grid, .sections-strip, .quick-grid {
    display: grid;
    gap: 18px;
  }
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  }
  .collections-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  }
}

/* ---------- 19.13 جداول عامة داخل حاوية تمرير ---------- */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.table-scroll table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.table-scroll th, .table-scroll td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-subtle);
  text-align: start;
  vertical-align: middle;
}
.table-scroll th {
  background: var(--paper-2);
  font-weight: 700;
  white-space: nowrap;
}
.table-scroll tr:last-child td {
  border-bottom: 0;
}

/* ---------- 19.14 تلميع الوضع الليلي ---------- */
[data-theme="dark"] .card,
[data-theme="dark"] .section-card,
[data-theme="dark"] .collection-card {
  border-color: var(--line);
}
[data-theme="dark"] .btn-ghost:hover {
  color: var(--gold-soft);
}
[data-theme="dark"] input:focus, [data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  box-shadow: 0 0 0 3px rgba(226, 184, 85, 0.28);
}
[data-theme="dark"] .pg-num.current,
[data-theme="dark"] .pg-num[aria-current="page"] {
  background: var(--gold);
  border-color: var(--gold);
  color: #14100a;
}

/* ---------- 19.15 احترام تقليل الحركة ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html.theme-transitioning,
  html.theme-transitioning *,
  html.theme-transitioning *::before,
  html.theme-transitioning *::after {
    transition: none !important;
  }
}

/* ---------- 19.16 أهداف لمس مريحة على الشاشات الصغيرة ---------- */
@media (max-width: 640px) {
  .btn {
    min-height: var(--tap);
  }
  .nav-link {
    min-height: var(--tap);
  }
  .pg-btn, .pg-num {
    min-width: var(--tap);
    min-height: var(--tap);
  }
  .page-title {
    font-size: var(--fs-xl);
  }
  .section {
    padding-block: 32px 8px;
  }
}

/* ---------- 19.17 تحسينات LTR (النسخة الفرنسية) ---------- */
[dir="ltr"] body {
  letter-spacing: 0;
}
[dir="ltr"] .page-title,
[dir="ltr"] .section-title,
[dir="ltr"] .hero-title,
[dir="ltr"] .card-title {
  line-height: 1.3;
}
[dir="ltr"] input, [dir="ltr"] select, [dir="ltr"] textarea {
  text-align: left;
}

/* بوابة الدخول الاجتماعية للنقاشات */
.social-auth-page { min-height: 62vh; display: grid; place-items: center; padding: 3rem 1rem 5rem; }
.social-auth-card { width: min(100%, 470px); padding: 2.1rem 2rem; background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg); text-align: center; }
.social-auth-brand { display: flex; align-items: center; justify-content: center; gap: .7rem; margin: 0 auto 1rem; color: var(--ink); font-size: 1.15rem; font-weight: 800; }
.social-auth-brand img { display: block; width: 52px; height: 52px; flex: none; object-fit: contain; }
.social-auth-welcome { margin: -.25rem 0 .65rem; color: var(--muted); font-size: .88rem; }
.social-auth-card h1 { margin: .35rem 0 .55rem; font-size: clamp(1.3rem, 4vw, 1.8rem); }
.social-auth-intro { color: var(--muted); line-height: 1.9; margin: 0 auto 1.25rem; }
.social-auth-form { display: grid; gap: .75rem; text-align: start; }
.social-auth-form input { width: 100%; min-height: 48px; padding: .75rem .9rem; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; }
.social-auth-divider { display: flex; align-items: center; gap: .7rem; margin: 1.1rem 0; color: var(--muted); font-size: .82rem; }
.social-auth-divider::before, .social-auth-divider::after { content: ''; height: 1px; flex: 1; background: var(--line); }
.btn-google { display: inline-flex; align-items: center; justify-content: center; gap: .7rem; min-height: 50px; color: #26344a; background: #fff; border: 1px solid #c9d0da; border-radius: 12px; box-shadow: 0 2px 5px rgba(31,47,70,.06); font-weight: 700; transition: background .18s, border-color .18s, box-shadow .18s, transform .18s; }
.btn-google::before { content: none; }
.btn-google:hover { color: #1f4276; background: #f7f9fc; border-color: #aeb8c7; box-shadow: 0 5px 14px rgba(31,47,70,.11); transform: translateY(-1px); }
.btn-google:focus-visible { outline: 3px solid rgba(66,133,244,.28); outline-offset: 2px; }
.google-mark { display: block; width: 21px; height: 21px; flex: none; }
.social-auth-note { color: var(--muted); font-size: .76rem; line-height: 1.7; margin: .75rem 0 1.1rem; }
.social-auth-register { border-top: 1px solid var(--line-soft); padding-top: 1rem; color: var(--muted); font-size: .86rem; }
.social-auth-register a { font-weight: 700; }
.researcher-login-only { min-height: 100vh; min-height: 100svh; }
.researcher-login-header { position: fixed; z-index: 20; inset: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 68px; padding: .8rem clamp(1rem, 4vw, 2.5rem); background: transparent; border: 0; box-shadow: none; backdrop-filter: none; pointer-events: none; }
.researcher-login-brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--ink); text-decoration: none; font-size: 1.05rem; font-weight: 800; }
.researcher-login-brand, .researcher-login-controls { pointer-events: auto; }
.researcher-login-brand img { display: block; width: 42px; height: 42px; object-fit: contain; }
.researcher-login-controls { display: flex; align-items: center; gap: .5rem; }
.researcher-login-control { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink); font: inherit; font-size: .78rem; font-weight: 800; cursor: pointer; transition: color .18s, background .18s; }
.researcher-login-control:hover { color: var(--teal); background: color-mix(in srgb, var(--teal) 9%, transparent); }
.researcher-login-control:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.login-theme-sun { display: none; }
[data-theme="dark"] .login-theme-moon { display: none; }
[data-theme="dark"] .login-theme-sun { display: inline; }
.researcher-login-main { min-height: 100vh; min-height: 100svh; padding: 86px 1rem 2rem; display: grid; place-items: center; }
.researcher-register-main { display: block; padding-top: 86px; }
.researcher-login-main .social-auth-page { width: 100%; min-height: 0; padding: 1rem; }
.researcher-login-main .social-auth-card { width: min(100%, 460px); }
[data-theme="dark"] .btn-google { color: #26344a; background: #fff; border-color: #c9d0da; }
@media (max-width: 640px) {
  .social-auth-page { min-height: calc(100svh - 9rem); padding: 1rem .75rem 1.5rem; }
  .social-auth-card { width: 100%; max-width: 420px; padding: 1.35rem 1rem; border-radius: 17px; }
  .social-auth-brand { gap: .55rem; margin-bottom: .75rem; font-size: 1.04rem; }
  .social-auth-brand img { width: 44px; height: 44px; }
  .social-auth-card h1 { font-size: clamp(1.2rem, 6vw, 1.5rem); }
  .social-auth-form input { font-size: 16px; }
  .researcher-login-header { min-height: 60px; padding-inline: .85rem; }
  .researcher-login-brand { gap: .45rem; font-size: .98rem; }
  .researcher-login-brand img { width: 36px; height: 36px; }
  .researcher-login-controls { gap: .35rem; }
  .researcher-login-control { width: 37px; height: 37px; }
  .researcher-login-main { padding: 70px .5rem 1rem; }
  .researcher-register-main { padding: 70px .5rem 1rem; }
  .researcher-login-main .social-auth-page { padding: .6rem .25rem; }
}
/* نموذج تسجيل الباحث — واضح ومريح على الشاشات الصغيرة والكبيرة */
.page-register .page-head { max-width: 760px; margin-inline: auto; }
.register-card { width: min(100%, 760px); margin: 2rem auto 4rem; padding: 0; overflow: hidden; border-radius: 24px; box-shadow: var(--shadow-lg); }
.register-card-head { display: flex; align-items: center; gap: .9rem; padding: 1.5rem 1.6rem; background: linear-gradient(135deg, color-mix(in srgb, var(--teal) 14%, var(--card)), var(--card)); border-bottom: 1px solid var(--line); }
.register-card-head h2 { margin: .2rem 0 0; font-size: 1.3rem; }
.register-card-mark { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; flex: 0 0 auto; background: var(--teal); color: #fff; font-family: var(--font-head); font-size: 1.25rem; font-weight: 800; box-shadow: 0 8px 20px color-mix(in srgb, var(--teal) 28%, transparent); }
.register-form-section { padding: 1.45rem 1.6rem 1.65rem; border-bottom: 1px solid var(--line-soft); }
.register-section-title { display: flex; align-items: center; gap: .65rem; margin: 0 0 1.15rem; font-size: 1.05rem; }
.register-section-title span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--gold-soft); color: var(--gold-deep); font-size: .82rem; }
.register-fields { display: grid; gap: 1.05rem; }
.register-contact-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.register-account-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.register-field { min-width: 0; }
.register-field > label { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; margin-bottom: .42rem; color: var(--ink); font-weight: 700; }
.register-label-main b { color: #b04636; font-size: .9em; }
.register-field > label small { color: var(--muted); font-size: .76rem; font-weight: 500; white-space: nowrap; }
.register-control { position: relative; }
.register-control input, .register-control textarea { display: block; width: 100%; min-height: 50px; padding: .78rem .9rem; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); color: var(--ink); font: inherit; line-height: 1.6; transition: border-color .18s, box-shadow .18s, background .18s; }
.register-control textarea { min-height: 122px; resize: vertical; }
.register-control input::placeholder { color: var(--muted); opacity: .75; }
.register-control input:focus, .register-control textarea:focus { outline: 0; border-color: var(--teal); background: var(--card); box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 13%, transparent); }
.register-help { margin: .35rem 0 0; color: var(--muted); font-size: .76rem; line-height: 1.65; }
.register-password-control input { padding-inline-end: 3.2rem; }
.password-toggle { position: absolute; inset-inline-end: .55rem; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; font-size: 1rem; }
.password-toggle:hover, .password-toggle:focus-visible { background: var(--line-soft); color: var(--teal); outline: 0; }
.register-form-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.3rem 1.6rem .5rem; }
.register-login-return { display: flex; width: max-content; margin: .25rem auto 2rem; }
.register-form-actions .form-msg { flex: 1; margin: 0; }
.register-submit { min-width: 160px; }
.register-card > .social-auth-divider, .register-card > .btn-google, .register-card > .social-auth-note { margin-inline: 1.6rem; }
.register-card > .social-auth-divider { margin-top: .7rem; }
.register-card > .btn-google { width: calc(100% - 3.2rem); }
.register-card > .social-auth-note { padding-bottom: 1.25rem; }
@media (max-width: 640px) {
  .register-card { margin-top: 1.2rem; border-radius: 18px; }
  .register-card-head, .register-form-section { padding-inline: 1rem; }
  .register-contact-fields { grid-template-columns: 1fr; }
  .register-account-fields { grid-template-columns: 1fr; }
  .register-form-actions { align-items: stretch; flex-direction: column; padding-inline: 1rem; }
  .register-submit { width: 100%; }
  .register-card > .social-auth-divider, .register-card > .btn-google, .register-card > .social-auth-note { margin-inline: 1rem; }
  .register-card > .btn-google { width: calc(100% - 2rem); }
}
.notice-error { border: 1px solid #e7b9b4; border-radius: 10px; padding: .65rem .8rem; color: #9a342c; background: #fff0ee; margin: .8rem 0; font-size: .86rem; }
.notice-success { border-color: #9bc9aa; color: #236b3d; background: #eff9f1; }
[data-theme="dark"] .notice-success { border-color: #3d7850; color: #a8dfb6; background: #172b1d; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.social-page-head { margin-bottom: 1rem; }
.social-feed-intro { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; margin-bottom: 1rem; }
.social-feed-intro strong { color: var(--teal); white-space: nowrap; }
.social-feed-intro span { color: var(--muted); font-size: .9rem; }
.material-feed { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.material-post { overflow: hidden; padding: 1rem; }
.material-post .post-head { margin-bottom: .75rem; }
.material-post .post-kind { margin-inline-start: auto; color: var(--muted); font-size: .7rem; }
.material-post .post-avatar { width: 34px; height: 34px; overflow: hidden; }
.post-avatar-image { display: block; width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.material-post .brand-avatar { background: #fff; }
.material-post .brand-avatar .post-avatar-image { object-fit: contain; padding: 3px; }
.post-avatar { width: 42px; height: 42px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; background: var(--teal); color: #fff; font-weight: 800; }
.material-post-title { display: block; color: var(--ink); font-family: var(--font-head); font-size: 1rem; font-weight: 700; line-height: 1.7; margin-bottom: .75rem; }
.material-post-title:hover { color: var(--teal); }
.material-post-image { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 12px; background: var(--surface-2); }
.material-post-placeholder { display: grid; place-items: center; color: var(--muted); font-size: .9rem; }
.material-post-text { color: var(--ink-secondary); line-height: 1.75; font-size: .86rem; margin: .75rem 0 0; }
.material-post .post-actions { margin-top: .75rem; }
.social-section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 1.2rem 0 .75rem; }
.social-section-head h2 { margin: 0; font-size: 1.25rem; }
.social-section-head p { color: var(--muted); margin: .25rem 0 0; font-size: .86rem; }
@media (max-width: 900px) { .material-feed { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .social-auth-card { padding: 1.5rem 1rem; }
  .social-feed-intro { align-items: flex-start; flex-direction: column; gap: .35rem; }
  .material-feed { grid-template-columns: 1fr; }
  .social-section-head { align-items: stretch; flex-direction: column; }
  .social-section-head .btn { width: 100%; }
}

/* ============================================================
   مجلس سِجِل — النقاشات العلمية
   ============================================================ */

.page-head { margin: 1.2rem 0 1rem; }
.page-head h1 { font-family: var(--font-head); font-size: clamp(1.5rem, 4vw, 2.1rem); margin: 0 0 .4rem; }
.page-desc { color: var(--muted); max-width: 60ch; line-height: 1.8; }

.chip-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.2rem; }
.chip { display: inline-block; padding: .35rem .95rem; border-radius: var(--radius-pill); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: .85rem; background: var(--paper); transition: all .2s; }
.chip:hover { border-color: var(--gold); }
.chip.active { background: var(--teal); color: #fff; border-color: var(--teal); }

.d-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.d-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .55rem; transition: transform .2s, box-shadow .2s; }
.d-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.d-card-top { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.d-meta { color: var(--muted); font-size: .78rem; }
.d-author { font-weight: 600; color: var(--ink); }
.d-card-title { margin: 0; font-size: 1.08rem; line-height: 1.6; }
.d-card-title a { color: var(--ink); text-decoration: none; }
.d-card-title a:hover { color: var(--gold-deep); }
.d-card-excerpt { color: var(--muted); font-size: .92rem; line-height: 1.8; margin: 0; }
.d-card-mat { font-size: .82rem; margin: 0; color: var(--muted); }
.d-card-mat a { color: var(--teal); }
.d-card-foot { display: flex; align-items: center; gap: 1rem; margin-top: auto; padding-top: .4rem; border-top: 1px dashed var(--line); }
.d-count { font-size: .85rem; color: var(--muted); }
.d-more { margin-inline-start: auto; text-decoration: none; font-size: 1.2rem; color: var(--gold-deep); }

.kind-badge { font-size: .72rem; }
.k-comment { background: #e8eef7; color: #2c4a73; }
.k-review { background: #e6f4ec; color: #1d6b3c; }
.k-critique { background: #fdeee3; color: #a3541b; }
.k-idea { background: #f3e8f7; color: #6b2d8f; }
.k-text { background: #fdeaea; color: #a33327; }
[data-theme="dark"] .k-comment { background: #1c2a44; color: #9db9e8; }
[data-theme="dark"] .k-review { background: #163024; color: #8fd0a8; }
[data-theme="dark"] .k-critique { background: #3a2a18; color: #e8b47e; }
[data-theme="dark"] .k-idea { background: #2e1d3d; color: #c9a2e8; }
[data-theme="dark"] .k-text { background: #3d1d1d; color: #e89a9a; }

.verification-mark { display: inline-flex; flex: none; width: 1.1em; height: 1.1em; vertical-align: -.18em; margin-inline-start: .2em; }
.verification-mark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.verification-mark svg circle { fill: currentColor; }
.verification-mark svg path { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.verification-mark--research { color: #efc51b; }
.verification-mark--administrative { color: #9a9a9a; }
.verification-mark--participation { color: #31a866; }
.d-author { display: inline-flex; align-items: center; gap: .18rem; }

/* صفحة النقاش الكاملة */
.page-discussion .d-full { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; margin-bottom: 1.4rem; }
.d-title { font-family: var(--font-head); font-size: clamp(1.3rem, 3.5vw, 1.7rem); margin: .6rem 0; line-height: 1.7; }
.d-body { font-size: 1.02rem; line-height: 2; margin: 1rem 0; text-align: justify; }
.d-quote { border-inline-start: 3px solid var(--gold); background: var(--paper-2); margin: 1rem 0; padding: .9rem 1.1rem; border-radius: 0 var(--radius) var(--radius) 0; font-size: .95rem; line-height: 1.9; }
.d-quote-label { font-size: .75rem; font-weight: 700; color: var(--gold-deep); margin-bottom: .3rem; }
.d-quote-position-link { display: block; width: fit-content; margin-top: .55rem; color: var(--teal); font-size: .82rem; font-weight: 700; text-decoration: none; }
.d-quote-position-link:hover { text-decoration: underline; }
.pdf-quote-anchor { position: absolute; z-index: 2; border: 2px solid #d88900; border-radius: 3px; background: rgba(255, 204, 70, .22); box-shadow: 0 0 0 9999px rgba(14, 19, 27, .13); pointer-events: none; }

.react-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.react-btn { display: inline-flex; align-items: center; gap: .4rem; padding: .42rem .9rem; border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--paper); cursor: pointer; font-family: var(--font-body); font-size: .85rem; color: var(--ink); transition: all .18s; }
.react-btn:hover { border-color: var(--gold); transform: translateY(-1px); }
.react-btn.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.react-btn:disabled { opacity: .6; cursor: wait; }
.react-count { font-weight: 700; min-width: 1.2em; text-align: center; }

.d-replies { margin: 1.6rem 0; }
.d-replies h2 { font-size: 1.15rem; margin-bottom: 1rem; }
.d-reply { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: .95rem 1.1rem; margin-bottom: .8rem; }
.d-reply.nested { margin-inline-start: 1.6rem; background: var(--paper-2); }
.d-reply-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .4rem; }
.d-reply-body { line-height: 1.9; font-size: .95rem; text-align: justify; }
.d-children { margin-top: .8rem; }
.d-reply-form { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; margin-bottom: 2rem; }
.d-reply-form h3 { margin-top: 0; }
.reply-to-line { font-size: .85rem; background: var(--paper-2); padding: .4rem .8rem; border-radius: var(--radius); }

.d-list-mini { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.d-mini { display: flex; align-items: center; gap: .7rem; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); background: var(--paper); transition: border-color .18s; }
.d-mini:hover { border-color: var(--gold); }
.d-mini-title { font-weight: 600; font-size: .92rem; flex: 1; }
.d-mini-meta { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.d-cta { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.notice { background: #fff8e6; border: 1px solid var(--gold-soft); border-radius: var(--radius); padding: .9rem 1.1rem; }
[data-theme="dark"] .notice { background: #2a2415; }
.notice-card { border-color: var(--gold-soft); }

.form-card { max-width: 620px; padding: 1.4rem; }
.form-msg { min-height: 1.4em; font-size: .9rem; }
.form-msg.ok { color: #1d6b3c; }
.form-msg.err { color: #a33327; }

/* ترجمة المحتوى داخل العارض */
.btn-translate { border-color: var(--gold); color: var(--gold-deep); }
.content-translate-actions { display:flex; align-items:center; gap:.65rem; margin-top:.8rem; flex-wrap:wrap; }
.translate-inline-status { color:var(--muted); font-size:.86rem; }
.translation-action-modal { display:none; position:fixed; inset:0; z-index:120; align-items:center; justify-content:center; padding:1rem; }
.translation-action-modal.is-open { display:flex; }
.translation-action-backdrop { position:absolute; inset:0; background:rgba(10,18,30,.58); }
.translation-action-card { position:relative; width:min(640px,100%); max-height:min(90vh,720px); overflow:auto; background:var(--paper); border:1px solid var(--line); border-radius:var(--radius); padding:1.35rem; box-shadow:0 24px 80px rgba(0,0,0,.24); }
.translation-action-card h2 { margin-top:0; }
.translation-action-card label { display:grid; gap:.35rem; margin:.75rem 0; font-weight:600; }
.translation-action-card select { width:100%; min-height:2.6rem; padding:.5rem .7rem; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--paper-2); color:var(--ink); font:inherit; }
.translation-action-grid { display:grid; grid-template-columns:1fr 1fr; gap:.8rem; }
.translation-action-close { position:absolute; inset-inline-end:.7rem; top:.5rem; border:0; background:none; color:var(--muted); font-size:1.8rem; cursor:pointer; }
.translation-action-result { margin-top:1rem; border-top:1px solid var(--line); padding-top:1rem; }
.translation-action-result.hidden { display:none; }
.translation-action-result .text-block {
  direction:ltr;
  unicode-bidi:plaintext;
  text-align:start;
  font-family:var(--font-body), 'IBM Plex Sans Arabic', system-ui, sans-serif;
  font-variant-numeric:tabular-nums;
  overflow-wrap:anywhere;
  word-break:normal;
}
.translation-action-result .text-block.translation-output-rtl {
  direction:rtl;
  text-align:right;
}
[data-theme="dark"] .translation-action-backdrop { background:rgba(0,0,0,.72); }
@media (max-width:640px) { .translation-action-grid { grid-template-columns:1fr; gap:0; } .translation-action-card { padding:1.1rem; } }

/* مساحة الترجمة الحية: الأصل والترجمة في لوحتين متزامنتين */
body.translation-workspace-open { overflow: hidden; }
.translation-workspace-card { width:min(1500px, 98vw); max-width:none; height:min(94vh, 980px); max-height:94vh; padding:0; overflow:hidden; border-radius:18px; }
.translation-workspace { display:flex; flex-direction:column; height:100%; min-height:0; background:var(--paper); color:var(--ink); }
.translation-workspace-head { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.85rem 1rem; border-bottom:1px solid var(--line); background:color-mix(in srgb, var(--paper) 92%, var(--gold) 8%); }
.translation-workspace-heading { display:flex; align-items:center; gap:.75rem; min-width:0; }
.translation-workspace-heading h2 { margin:0; font-size:1.05rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.translation-workspace-kicker { color:var(--gold-deep); font-weight:700; font-size:.78rem; }
.translation-workspace-page { color:var(--muted); font-size:.8rem; white-space:nowrap; }
.translation-workspace-actions { display:flex; align-items:center; justify-content:flex-end; gap:.45rem; flex-wrap:wrap; }
.translation-language { display:flex; align-items:center; gap:.35rem; margin:0 !important; font-size:.78rem; font-weight:600; white-space:nowrap; }
.translation-language select { min-height:2.15rem !important; width:auto !important; padding:.3rem .55rem !important; }
.translation-arrow { color:var(--gold-deep); font-weight:800; }
.translation-workspace .translation-action-close { position:static; font-size:1.65rem; line-height:1; padding:.15rem .35rem; }
.translation-workspace-panels { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:1px; min-height:0; flex:1; overflow:hidden; background:var(--line); direction:ltr; }
.translation-pane { display:flex; flex-direction:column; min-width:0; min-height:0; background:var(--paper-2); direction:rtl; }
.translation-pane-head { display:flex; align-items:center; justify-content:space-between; gap:.6rem; padding:.65rem .85rem; border-bottom:1px solid var(--line); background:var(--paper); font-size:.88rem; }
.translation-pane-head span { color:var(--muted); font-size:.75rem; font-weight:400; }
.translation-pane-scroll { min-height:0; overflow:auto; overscroll-behavior:contain; padding:.85rem; scroll-behavior:smooth; }
.translation-page-card { width:min(100%, 760px); margin:0 auto 1rem; border:1px solid var(--line); border-radius:12px; background:var(--paper); box-shadow:var(--shadow-sm); overflow:hidden; scroll-margin-top:.5rem; }
.translation-page-label { display:flex; align-items:center; justify-content:space-between; gap:.75rem; padding:.45rem .7rem; border-bottom:1px solid var(--line); color:var(--muted); font-size:.76rem; background:color-mix(in srgb, var(--paper) 90%, var(--gold) 10%); }
.translation-page-label strong { color:var(--ink-secondary); font-size:.78rem; }
.translation-page-label span { color:var(--gold-deep); }
.translation-pdf-canvas { display:block; max-width:100%; height:auto; margin:0 auto; background:#fff; direction:ltr !important; unicode-bidi:isolate; }
.translation-page-text { min-height:180px; padding:1.15rem 1.25rem 1.35rem; white-space:pre-wrap; line-height:1.95; font-family:var(--font-body); font-size:1rem; text-align:justify; color:var(--ink); }
.translation-page-text.is-loading { opacity:.56; }
.translation-workspace-status { min-height:2.15rem; display:flex; align-items:center; padding:.45rem .9rem; border-top:1px solid var(--line); color:var(--muted); font-size:.8rem; }
.translation-workspace-status a { color:var(--gold-deep); font-weight:700; }
.translation-progress-wrap { display:flex; align-items:center; gap:.65rem; padding:.45rem 1rem; border-bottom:1px solid var(--line); background:color-mix(in srgb, var(--paper) 94%, var(--gold) 6%); }
.translation-progress-track { flex:1; height:.42rem; overflow:hidden; border-radius:999px; background:color-mix(in srgb, var(--line) 70%, var(--paper) 30%); }
.translation-progress-bar { width:0; height:100%; border-radius:inherit; background:linear-gradient(90deg,var(--gold),#1e7a62); transition:width .35s ease; }
.translation-progress-label { min-width:3.4rem; color:var(--muted); font-size:.78rem; font-variant-numeric:tabular-nums; text-align:center; }
.translation-page-placeholder { padding:3rem 1rem; color:var(--muted); text-align:center; line-height:1.8; }
.translation-pdf-canvas-translated { background:#fff; }
[data-theme="dark"] .translation-workspace-head { background:#1c2330; }
[data-theme="dark"] .translation-page-card, [data-theme="dark"] .translation-pane { background:#1a202b; }
[data-theme="dark"] .translation-progress-wrap { background:#1c2330; }
.translation-workspace-mobile-tabs { display:none; }
@media (max-width:900px) {
  .translation-workspace-head { align-items:flex-start; flex-direction:column; }
  .translation-workspace-actions { width:100%; justify-content:flex-start; }
}
@media (max-width:700px) {
  .translation-action-modal { align-items:stretch; padding:0; }
  .translation-workspace-card { width:100vw; height:100dvh; max-height:100dvh; border-radius:0; border:0; }
  .translation-workspace { min-height:0; }
  .translation-workspace-head { flex:0 0 auto; gap:.45rem; padding:calc(.45rem + env(safe-area-inset-top, 0px)) .65rem .55rem; }
  .translation-workspace-heading { width:100%; gap:.45rem; padding-inline-end:2rem; }
  .translation-workspace-heading h2 { flex:1; min-width:0; font-size:.88rem; }
  .translation-workspace-kicker { font-size:.68rem; white-space:nowrap; }
  .translation-workspace-page { font-size:.68rem; }
  .translation-workspace-actions { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); width:100%; gap:.35rem; align-items:center; justify-content:stretch; }
  .translation-language { display:grid; grid-template-columns:minmax(0,1fr); min-width:0; gap:.15rem; font-size:.66rem; }
  .translation-language > span { line-height:1.1; }
  .translation-language select { width:100% !important; max-width:none; min-width:0; min-height:2rem !important; padding:.25rem .35rem !important; font-size:.76rem; }
  .translation-arrow { padding-inline:.1rem; font-size:.82rem; }
  .translation-workspace-actions .btn { min-height:2rem; padding:.3rem .45rem; border-radius:999px; font-size:.68rem; line-height:1.2; white-space:normal; }
  .translation-workspace-actions [data-ta-download-original] { grid-column:1; }
  .translation-workspace-actions [data-ta-download-translation] { grid-column:2; }
  .translation-workspace-actions [data-ta-create-pdf] { grid-column:3; }
  .translation-workspace .translation-action-close { position:absolute; top:calc(.35rem + env(safe-area-inset-top, 0px)); inset-inline-end:.5rem; width:2rem; height:2rem; padding:0; border:1px solid var(--line); border-radius:50%; background:var(--paper); font-size:1.35rem; }
  .translation-progress-wrap { flex:0 0 auto; gap:.45rem; padding:.35rem .65rem; }
  .translation-progress-track { height:.3rem; }
  .translation-progress-label { min-width:2.5rem; font-size:.68rem; }
  .translation-workspace-mobile-tabs { display:grid; grid-template-columns:1fr 1fr; gap:.25rem; flex:0 0 auto; padding:.35rem .65rem; border-bottom:1px solid var(--line); background:var(--paper); }
  .translation-workspace-mobile-tabs button { min-height:2rem; border:1px solid transparent; border-radius:999px; background:transparent; color:var(--muted); font:inherit; font-size:.76rem; font-weight:700; }
  .translation-workspace-mobile-tabs button[aria-selected="true"] { border-color:color-mix(in srgb, var(--gold) 50%, var(--line)); background:color-mix(in srgb, var(--gold) 13%, var(--paper)); color:var(--gold-deep); }
  .translation-workspace-panels { display:flex; flex:1 1 auto; min-height:0; overflow:hidden; }
  .translation-pane { display:none; width:100%; min-height:0; }
  .translation-pane.is-mobile-active { display:flex; }
  .translation-pane-head { flex:0 0 auto; gap:.4rem; padding:.45rem .65rem; font-size:.78rem; }
  .translation-pane-head span { font-size:.67rem; }
  .translation-pane-scroll { flex:1 1 auto; min-height:0; max-height:none; padding:.5rem; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
  .translation-page-card { width:100%; margin-bottom:.6rem; border-radius:10px; }
  .translation-page-label { gap:.35rem; padding:.35rem .5rem; font-size:.68rem; }
  .translation-page-label strong { font-size:.7rem; }
  .translation-page-text { min-height:100px; padding:.7rem .75rem .85rem; font-size:.9rem; line-height:1.8; text-align:start; }
  .translation-workspace-status { flex:0 0 auto; min-height:2rem; padding:.35rem .65rem max(.35rem, env(safe-area-inset-bottom, 0px)); font-size:.7rem; line-height:1.45; }
}

/* شريط سفلي للتطبيق (وضع standalone) */
.pwa-bar { display: none; }
@media (display-mode: standalone) {
  .pwa-bar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 60; background: var(--paper); border-top: 1px solid var(--line); padding: .4rem .6rem calc(.4rem + env(safe-area-inset-bottom)); justify-content: space-around; }
  .pwa-bar a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: .68rem; padding: .25rem .6rem; }
  .pwa-bar a.active { color: var(--gold-deep); }
  .pwa-bar svg { width: 22px; height: 22px; }
  body { padding-bottom: 64px; }
}

/* الجوال */
@media (max-width: 640px) {
  .d-grid { grid-template-columns: 1fr; }
  .page-discussion .d-full { padding: 1rem; }
  .react-label { display: none; }
  .react-btn { padding: .42rem .7rem; }
  .d-reply.nested { margin-inline-start: .8rem; }
}

/* قواعد الحواف المستديرة الموحدة لعناصر الموقع والتطبيق */
.btn,
button:not([data-square-control]),
[role="button"],
.tab,
.chip,
[class*="-tab"] { border-radius: var(--shape-pill); }
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
select,
textarea { border-radius: var(--shape-control); }
.card,
[class*="-card"],
[class*="-panel"],
[class*="-dropdown"],
[class*="-menu"],
[class*="-dialog"],
[role="dialog"],
.panel,
.dropdown,
.popover,
.modal,
.notice,
.table-wrap,
.table-container { border-radius: var(--shape-card); }
