/* ==========================================================================
   دليل قابلية الاستخدام — أنماط أصلية، هوية فاتحة، دعم RTL كامل
   ========================================================================== */

:root {
  /* ألوان */
  --color-bg: #f6f7fb;
  --color-surface: #ffffff;
  --color-surface-alt: #f0f1f8;
  --color-border: #e3e5f0;
  --color-border-strong: #cdd0e3;

  --color-text: #1c1f2e;
  --color-text-muted: #5b5f78;
  --color-text-faint: #8b8fa8;

  --color-primary: #4338ca;
  --color-primary-hover: #362eab;
  --color-primary-soft: #eeecfd;
  --color-accent: #0d9488;
  --color-accent-soft: #e3f6f3;

  --color-danger: #dc2626;
  --color-danger-soft: #fdecec;
  --color-success: #0d9488;
  --color-success-soft: #e3f6f3;

  --shadow-sm: 0 1px 2px rgba(28, 31, 46, 0.06);
  --shadow-md: 0 6px 16px rgba(28, 31, 46, 0.08);
  --shadow-lg: 0 16px 40px rgba(28, 31, 46, 0.14);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --header-h: 72px;
  --sidebar-w: 272px;
  --content-max: 1180px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: "IBM Plex Sans Arabic", "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif;
  font-weight: 400;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

html[lang="en"] body {
  font-family: "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif;
  line-height: 1.65;
}

img, svg { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: 0; }

p { margin: 0; }

ul { margin: 0; padding: 0; list-style: none; }

button {
  font-family: inherit;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
}

input { font-family: inherit; }

/* ==========================================================================
   إمكانية الوصول: تخطي المحتوى + حالات التركيز
   ========================================================================== */

.skip-link {
  position: fixed;
  inset-inline-start: 12px;
  top: -60px;
  z-index: 999;
  background: var(--color-primary);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top 0.2s var(--ease);
}
.skip-link:focus {
  top: 12px;
}

:focus-visible {
  outline: 2.5px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(246, 247, 251, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  padding-inline: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  align-items: center;
}
.menu-toggle:hover { background: var(--color-surface-alt); }
.menu-toggle__bar {
  width: 20px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 0.25s var(--ease), opacity 0.2s var(--ease);
}
.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
}
.brand__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--color-primary);
  color: #fff;
  flex-shrink: 0;
}
.brand__text strong { color: var(--color-primary); }

.top-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-inline-start: 12px;
}
.top-nav a {
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  color: var(--color-text-muted);
  font-weight: 500;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.top-nav a:hover { background: var(--color-surface-alt); color: var(--color-text); }

.header-actions {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--color-text-faint);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.search-box:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.search-box input {
  border: none;
  outline: none;
  background: none;
  font-size: 14px;
  width: 170px;
  color: var(--color-text);
}
.search-box input::placeholder { color: var(--color-text-faint); }

/* ==========================================================================
   أزرار
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14.5px;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.15s var(--ease), border-color .18s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover { background: var(--color-primary-hover); box-shadow: var(--shadow-md); }

.btn--ghost {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border-strong);
}
.btn--ghost:hover { background: var(--color-surface-alt); border-color: var(--color-primary); }

.btn--lg { padding: 13px 26px; font-size: 15.5px; border-radius: var(--radius-md); }

.btn--lang {
  min-width: 78px;
  padding-inline: 14px;
}

/* ==========================================================================
   تخطيط: Sidebar + Main
   ========================================================================== */

.layout {
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  align-items: start;
  gap: 40px;
  padding-inline: 24px;
}

.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  align-self: start;
  padding: 22px 18px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-top: 24px;
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
}

.sidebar__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 4px 10px 10px;
}

.sidebar__list { display: flex; flex-direction: column; gap: 2px; }

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--color-text-muted);
  border-inline-start: 3px solid transparent;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.sidebar__icon { display: flex; color: var(--color-text-faint); transition: color 0.18s var(--ease); flex-shrink: 0; }
.sidebar__link:hover { background: var(--color-surface-alt); color: var(--color-text); }
.sidebar__link:hover .sidebar__icon { color: var(--color-primary); }
.sidebar__link.is-active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  border-inline-start-color: var(--color-primary);
}
.sidebar__link.is-active .sidebar__icon { color: var(--color-primary); }

.sidebar__progress {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
}
.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--color-surface-alt);
  overflow: hidden;
  margin: 0 10px 8px;
}
.progress-bar__fill {
  height: 100%;
  width: 0%;
  background: var(--color-accent);
  border-radius: 999px;
  transition: width 0.35s var(--ease);
}
.progress-text {
  display: block;
  margin: 0 10px;
  font-size: 12.5px;
  color: var(--color-text-faint);
}

.sidebar__section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
}


.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 28, 0.45);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.sidebar-overlay.is-visible { display: block; opacity: 1; }

main { min-width: 0; padding-block: 24px 80px; }

/* ==========================================================================
   Hero
   ========================================================================== */

.hero { padding-block: 12px 48px; }

.eyebrow {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.35;
  max-width: 780px;
  margin-bottom: 18px;
}

.hero__lead {
  max-width: 680px;
  font-size: 16.5px;
  color: var(--color-text-muted);
  margin-bottom: 28px;
}

.hero__actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 40px; }

/* ==========================================================================
   أقسام عامة
   ========================================================================== */

.section { padding-block: 56px; scroll-margin-top: calc(var(--header-h) + 16px); }
.section--muted {
  margin-inline: -24px;
  padding-inline: 24px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-lg);
}

.section__head { max-width: 640px; margin-bottom: 34px; }
.section__kicker {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}
.section__head h2 { font-size: clamp(22px, 3vw, 30px); margin-bottom: 12px; }
.section__desc { color: var(--color-text-muted); font-size: 15.5px; }

/* Reason grid */
.reason-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.reason-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.reason-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-strong);
}
.reason-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  margin-bottom: 16px;
}
.reason-card h3 { font-size: 16px; margin-bottom: 8px; }
.reason-card p { font-size: 14px; color: var(--color-text-muted); }

/* Principles grid */
.principles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.principle-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.principle-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-primary);
}
.principle-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.principle-card__num {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-faint);
  letter-spacing: 0.04em;
}
.principle-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--color-accent-soft);
  color: var(--color-accent);
}
.principle-card h3 { font-size: 16.5px; margin-bottom: 8px; }
.principle-card p { font-size: 14px; color: var(--color-text-muted); }
.principle-card--empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--color-text-faint);
  box-shadow: none;
  border-style: dashed;
}

.principle-card[role="button"] { cursor: pointer; }
.principle-card__more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
}
.principle-card__more svg { transition: transform 0.2s var(--ease); }
[dir="rtl"] .principle-card__more svg { transform: scaleX(-1); }
.principle-card:hover .principle-card__more svg { transform: translateX(-3px); }
[dir="rtl"] .principle-card:hover .principle-card__more svg { transform: scaleX(-1) translateX(-3px); }

/* ==========================================================================
   Modal: تفاصيل المبدأ + مثال تفاعلي
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 17, 28, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.22s var(--ease);
}
.modal-overlay.is-visible { opacity: 1; }
.modal-overlay[hidden] { display: none; }

.modal {
  position: relative;
  width: 100%;
  max-width: 980px;
  max-height: min(880px, 94vh);
  overflow-y: auto;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  transform: translateY(14px) scale(0.98);
  opacity: 0;
  transition: transform 0.24s var(--ease), opacity 0.24s var(--ease);
}
.modal-overlay.is-visible .modal { transform: translateY(0) scale(1); opacity: 1; }

.modal__close {
  position: absolute;
  top: 18px;
  inset-inline-end: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.modal__close:hover { background: var(--color-surface-alt); color: var(--color-text); }

.modal__header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.modal__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  flex-shrink: 0;
}
.modal__icon svg { width: 26px; height: 26px; }
.modal__badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: 12.5px;
  font-weight: 700;
}

.modal h3#modalTitle { font-size: 22px; margin-bottom: 12px; }
.modal__desc { color: var(--color-text-muted); font-size: 15px; margin-bottom: 26px; }

.modal__demo {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.modal__demo-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.modal__demo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
}
.modal__demo-body { padding: 22px; }

.modal__callouts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}
.modal__callout {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border: 1px solid var(--color-border);
}
.modal__callout--practice { background: var(--color-accent-soft); border-color: #a9e0d8; }
.modal__callout--mistake { background: var(--color-danger-soft); border-color: #f3c6c6; }
.modal__callout-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}
.modal__callout--practice .modal__callout-label { color: var(--color-success); }
.modal__callout--mistake .modal__callout-label { color: var(--color-danger); }
.modal__callout p { font-size: 13px; color: var(--color-text); margin: 0; line-height: 1.6; }

@media (max-width: 560px) {
  .modal__callouts { grid-template-columns: 1fr; }
}

/* --- عناصر مشتركة داخل الأمثلة التفاعلية --- */
.demo-scenario {
  font-size: 13px;
  color: var(--color-text-faint);
  font-style: italic;
  margin-bottom: 12px;
  padding-inline-start: 12px;
  border-inline-start: 3px solid var(--color-border-strong);
  line-height: 1.6;
}
.demo-note { font-size: 13.5px; color: var(--color-text-muted); margin-bottom: 16px; }
.demo-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.demo-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.demo-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-soft); }
kbd {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface-alt);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
}

/* حالة النظام */
.demo-status {
  margin-top: 14px;
  font-size: 14px;
  font-weight: 600;
  min-height: 20px;
  transition: color 0.16s var(--ease);
}
.demo-status.is-loading { color: var(--color-text-muted); }
.demo-status.is-success { color: var(--color-success); }

/* التطابق مع الواقع (سلة) */
.demo-cart { display: flex; align-items: center; gap: 12px; }
.demo-cart .btn { display: inline-flex; align-items: center; gap: 8px; }
.demo-cart__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--color-accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

/* حرية التحكم والتراجع */
.demo-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.demo-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: 14px;
  transition: opacity 0.2s var(--ease);
}
.demo-list__item[hidden] { display: none; }
.demo-list__delete {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-danger);
  transition: background 0.16s var(--ease);
}
.demo-list__delete:hover { background: var(--color-danger-soft); }
.demo-toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: #1c1f2e;
  color: #fff;
  font-size: 13.5px;
}
.demo-toast[hidden] { display: none; }
.demo-toast__undo { color: #93c5fd; font-weight: 700; }
.demo-toast__undo:hover { text-decoration: underline; }

/* الاتساق */
.demo-consistency { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.demo-consistency button { font-family: inherit; cursor: default; padding: 9px 16px; }
.demo-consistency[data-state="bad"] .demo-btn-a { background: #4338ca; color: #fff; border: none; border-radius: 4px; font-size: 13px; }
.demo-consistency[data-state="bad"] .demo-btn-b { background: #fff; color: #1c1f2e; border: 2px solid #1c1f2e; border-radius: 999px; font-size: 16px; font-weight: 700; }
.demo-consistency[data-state="bad"] .demo-btn-c { background: #0d9488; color: #fff; border: none; border-radius: 14px 2px; font-size: 12px; text-transform: uppercase; }
.demo-consistency[data-state="good"] button {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
}

/* منع الأخطاء */
.demo-stepper { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.demo-stepper__btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border-strong);
  font-size: 18px;
  font-weight: 700;
  transition: background 0.16s var(--ease), opacity 0.16s var(--ease);
}
.demo-stepper__btn:hover:not(:disabled) { background: var(--color-surface-alt); }
.demo-stepper__btn:disabled { opacity: 0.4; cursor: not-allowed; }
.demo-stepper__input {
  width: 64px;
  text-align: center;
  padding: 8px;
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
}
.demo-error { font-size: 13px; color: var(--color-danger); min-height: 18px; }
.demo-success-text { font-size: 13px; color: var(--color-success); min-height: 18px; }

/* التعرف بدلاً من التذكر */
.demo-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.demo-chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--color-border-strong);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease);
}
.demo-chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
.demo-chip.is-selected { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* المرونة والكفاءة */
.demo-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  margin-bottom: 12px;
}
.demo-textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-soft); }
.demo-hint { font-size: 13px; color: var(--color-success); font-weight: 600; }

/* البساطة والإفصاح التدريجي */
.demo-form-mini { display: flex; flex-direction: column; gap: 10px; }
.demo-form-mini label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--color-text-muted); }
.demo-advanced-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-primary);
  padding: 6px 2px;
}
.demo-advanced-toggle svg { transition: transform 0.2s var(--ease); }
.demo-advanced-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.demo-advanced-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}
.demo-advanced-panel[hidden] { display: none; }

/* تشخيص الأخطاء */
.demo-field { display: flex; gap: 10px; margin-bottom: 8px; }
.demo-field .demo-input { flex: 1; }

/* مقارنة خاطئ/صحيح داخل كل مثال تفاعلي */
.demo-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
.demo-compare-card {
  border-radius: var(--radius-sm);
  padding: 16px;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
}
.demo-compare-card--bad { border-color: #f3c6c6; background: var(--color-danger-soft); }
.demo-compare-card--good { border-color: #a9e0d8; background: var(--color-accent-soft); }
.demo-compare-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
}
.demo-compare-card--bad .demo-compare-tag { color: var(--color-danger); }
.demo-compare-card--good .demo-compare-tag { color: var(--color-success); }
.demo-mini-label { font-size: 12px; color: var(--color-text-muted); margin-bottom: 10px; line-height: 1.6; }

.demo-explain {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}
.demo-explain p { font-size: 13.5px; color: var(--color-text-muted); line-height: 1.75; }
.demo-explain strong { color: var(--color-text); }

@keyframes demoShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.demo-shake { animation: demoShake 0.28s var(--ease); }

@media (max-width: 560px) {
  .demo-compare-grid { grid-template-columns: 1fr; }
}

/* المساعدة والتوثيق */
.demo-help-row { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.demo-help-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--color-border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-muted);
  transition: background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.demo-help-btn::before { content: "؟"; }
.demo-help-btn:hover { background: var(--color-primary-soft); color: var(--color-primary); border-color: var(--color-primary); }
.demo-help-popover {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  font-size: 13.5px;
  color: var(--color-text-muted);
}
.demo-help-popover[hidden] { display: none; }

@media (max-width: 560px) {
  .modal { padding: 22px; max-height: 88vh; }
  .modal__header { gap: 10px; }
  .modal__icon { width: 44px; height: 44px; }
  .demo-consistency { gap: 8px; }
}

/* About section */
.about-section__panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  text-align: start;
}

.about-section__content {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  gap: 16px;
  width: 100%;
}

.about-section__header {
  display: flex;
  flex-direction: column;
  align-self: flex-start;
  gap: 3px;
  max-inline-size: 100%;
}

.about-section__name {
  font-size: 22px;
  line-height: 1.3;
}

.about-section__role {
  align-self: flex-start;
  color: var(--color-text-muted);
  display: inline-block;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.5;
  max-inline-size: 100%;
  text-align: start;
}

.about-section__prose {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.about-section__prose p {
  color: var(--color-text-muted);
  font-size: 15px;
  line-height: 1.8;
}

.about-section__prose strong { color: var(--color-text); }

.about-section__footer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}

.about-section__expertise {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.about-section__expertise-label {
  margin-bottom: 0;
}

.about-section__tags {
  margin-bottom: 0;
  row-gap: 10px;
  width: 100%;
}

.about-section__cta {
  align-self: flex-start;
  margin-top: 0;
}

.about-section__cta svg {
  flex-shrink: 0;
}

/* Checklist */
.checklist-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.checklist { display: flex; flex-direction: column; gap: 4px; }
.checklist__item label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.16s var(--ease);
}
.checklist__item label:hover { background: var(--color-surface-alt); }
.checklist__item input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.checklist__box {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  border-radius: 6px;
  border: 2px solid var(--color-border-strong);
  background: var(--color-surface);
  position: relative;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.checklist__box::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M5 13L9 17L19 7' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/60% no-repeat;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
}
.checklist__item input:checked + .checklist__box {
  background: var(--color-accent);
  border-color: var(--color-accent);
}
.checklist__item input:checked + .checklist__box::after { opacity: 1; transform: scale(1); }
.checklist__item input:focus-visible + .checklist__box { outline: 2.5px solid var(--color-primary); outline-offset: 2px; }
.checklist__text { font-size: 15px; color: var(--color-text); line-height: 1.6; }
.checklist__item input:checked ~ .checklist__text { color: var(--color-text-faint); text-decoration: line-through; text-decoration-color: var(--color-border-strong); }

.checklist-footer {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
}

/* Accordion */
.accordion {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.accordion__item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.accordion__item:has(.accordion__trigger[aria-expanded="true"]) {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}
.accordion__item h3 { margin: 0; }
.accordion__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  font-size: 15.5px;
  font-weight: 600;
  text-align: start;
  transition: background 0.16s var(--ease);
}
.accordion__trigger:hover { background: var(--color-surface-alt); }
.accordion__chev { color: var(--color-text-faint); transition: transform 0.25s var(--ease); flex-shrink: 0; }
.accordion__trigger[aria-expanded="true"] .accordion__chev { transform: rotate(180deg); color: var(--color-primary); }

.accordion__panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s var(--ease);
}
.accordion__panel > p {
  overflow: hidden;
  padding-inline: 22px;
  color: var(--color-text-muted);
  font-size: 14.5px;
}
.accordion__item:has(.accordion__trigger[aria-expanded="true"]) .accordion__panel {
  grid-template-rows: 1fr;
}
.accordion__item:has(.accordion__trigger[aria-expanded="true"]) .accordion__panel > p {
  padding-block: 0 20px;
}

/* ==========================================================================
   Back to top
   ========================================================================== */

.back-to-top {
  position: fixed;
  bottom: 28px;
  inset-inline-end: 28px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), background 0.18s var(--ease);
  z-index: 80;
}
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--color-primary-hover); }

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--color-border);
  margin-top: 40px;
  padding-block: 32px;
}
.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding-inline: 24px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: space-between;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--color-text-muted);
}
.footer-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-nav a { font-size: 13.5px; color: var(--color-text-muted); transition: color 0.16s var(--ease); }
.footer-nav a:hover { color: var(--color-primary); }
.footer-note { font-size: 12.5px; color: var(--color-text-faint); width: 100%; text-align: center; }
.footer-note a {
  color: var(--color-text-muted);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
  transition: color 0.16s var(--ease);
}
.footer-note a:hover { color: var(--color-primary); }

/* ==========================================================================
   Responsive: Tablet
   ========================================================================== */

@media (max-width: 1024px) {
  .top-nav { display: none; }
  .search-box input { width: 120px; }
  .reason-grid { grid-template-columns: repeat(2, 1fr); }
  .principles-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================================
   Responsive: Mobile — Sidebar يتحول لقائمة منسدلة من الجانب
   ========================================================================== */

@media (max-width: 860px) {
  .menu-toggle { display: flex; }
  .header-actions .search-box { display: none; }

  .layout { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    inset-inline-end: 0;
    inset-inline-start: auto;
    width: 82%;
    max-width: 320px;
    max-height: none;
    margin: 0;
    border-radius: 0;
    transform: translateX(100%);
    transition: transform 0.28s var(--ease);
    z-index: 95;
    padding-top: calc(var(--header-h) + 18px);
  }
  [dir="rtl"] .sidebar { transform: translateX(-100%); }
  .sidebar.is-open { transform: translateX(0); }

  .hero__actions { flex-direction: column; align-items: stretch; }
  .hero__actions .btn { justify-content: center; }

  .reason-grid,
  .principles-grid { grid-template-columns: 1fr; }

  .section--muted { margin-inline: -16px; padding-inline: 16px; }
}

@media (max-width: 560px) {
  .header-inner { padding-inline: 16px; gap: 12px; }
  .brand__text { display: none; }
  .layout { padding-inline: 16px; gap: 20px; }
  .hero h1 { font-size: 26px; }
  .btn--lg { padding: 12px 20px; font-size: 14.5px; }
  .checklist-card { padding: 18px; }
  .about-section__content { gap: 14px; width: 100%; }
  .about-section__name { font-size: 20px; }
  .about-section__role,
  .about-section__prose p { font-size: 14px; }
  .about-section__footer,
  .about-section__expertise { gap: 8px; }
  .back-to-top { inset-inline-end: 16px; bottom: 16px; width: 42px; height: 42px; }
}
