/* ==========================================================================
   MultiServe — primitives
   المكوّنات الأساسية المشتركة بين صفحة الهبوط (site/) وواجهة المنتج (app/).
   مصدر واحد للأزرار والبطاقات والشارات وإطار الأيقونة ورؤوس الأقسام —
   حتى لا يشعر الزائر أنه غادر منتجًا ودخل آخر.

   يعتمد على tokens.css فقط. لا ألوان صريحة هنا إلا عبر التوكنز.
   دليل الهوية (الأزرار 15/16 وزن 500 · فعل أول) · §07 (مضاعفات 4) ·
   §09 (أيقونات outline 1.5px ترث لون النص) · §11 (خطوط شعرية للبنية، الظل للرفع فقط).
   ========================================================================== */

/* ---- أيقونات (Lucide) ---------------------------------------------------- */
.ic {
  width: 24px;
  height: 24px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ic-16 {
  width: 16px;
  height: 16px;
}
.ic-20 {
  width: 20px;
  height: 20px;
}
.ic-32 {
  width: 32px;
  height: 32px;
}

/* أيقونة داخل إطار — لبطاقات المسارات وخطوات «كيف يعمل» والمقاييس */
.icon-badge {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--radius-lg);
  background: var(--i50);
  color: var(--interactive);
  border: 1px solid color-mix(in srgb, var(--interactive) 14%, transparent);
}
.icon-badge--neutral {
  background: var(--surface-3);
  color: var(--text-2);
  border-color: var(--line);
}
.icon-badge--lg {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
}
:root[data-theme='dark'] .icon-badge {
  background: color-mix(in srgb, var(--interactive) 14%, transparent);
}

/* ---- أزرار ---------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 var(--space-xs);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--text-button);
  line-height: var(--leading-button);
  font-weight: 500;
  letter-spacing: var(--track-button);
  cursor: pointer;
  background: transparent;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  transition:
    background-color var(--motion-fast) var(--ease),
    border-color var(--motion-fast) var(--ease),
    color var(--motion-fast) var(--ease),
    transform var(--motion-fast) var(--ease);
}
.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.55;
  cursor: default;
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn .ic {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: var(--interactive-fill);
  color: var(--text-on-fill);
}
.btn-primary:hover:not(:disabled) {
  background: var(--interactive-hover);
}
.btn-ghost {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--surface-1);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-3);
}
.btn-quiet {
  color: var(--interactive);
  padding-inline: var(--space-3xs);
}
.btn-quiet:hover:not(:disabled) {
  background: var(--i50);
}
:root[data-theme='dark'] .btn-quiet:hover:not(:disabled) {
  background: color-mix(in srgb, var(--interactive) 12%, transparent);
}
.btn-danger {
  color: var(--error-text);
}
.btn-lg {
  min-height: 52px;
  padding-inline: var(--space-md);
  font-size: 16px;
}
.btn-sm {
  min-height: 36px;
  padding-inline: var(--space-2xs);
  font-size: var(--text-body-s);
}
.btn-icon {
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  color: var(--text-2);
}
.btn-icon:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--text);
}

/* ---- بطاقات وأسطح ---------------------------------------------------------- */
.card {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}
.card--interactive {
  cursor: pointer;
  text-align: start;
  color: inherit;
  font: inherit;
  transition:
    border-color var(--motion-fast) var(--ease),
    background-color var(--motion-fast) var(--ease),
    box-shadow var(--motion-base) var(--ease);
}
.card--interactive:hover {
  border-color: var(--line-strong);
}
.card--selected,
.card--interactive[aria-pressed='true'],
.card--interactive[aria-checked='true'] {
  border-color: var(--interactive);
  background: var(--i50);
  box-shadow: 0 0 0 1px var(--interactive);
}
:root[data-theme='dark'] .card--selected,
:root[data-theme='dark'] .card--interactive[aria-pressed='true'] {
  background: color-mix(in srgb, var(--interactive) 10%, var(--surface-1));
}

/* ---- رأس قسم -------------------------------------------------------------- */
.section-head {
  max-width: 62ch;
}
.section-head--center {
  margin-inline: auto;
  text-align: center;
}
.section-head .kicker,
.label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: var(--text-label);
  line-height: var(--leading-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--interactive);
  margin-block-end: var(--space-2xs);
}
/* العربية: لا uppercase ولا تباعد حروف ولا خط لاتيني — تسمية صغيرة بخط النص */
html[lang='ar'] .section-head .kicker,
html[lang='ar'] .label {
  font-family: var(--font-body);
  font-size: var(--text-body-s);
  line-height: var(--leading-body-s);
  text-transform: none;
  font-weight: 500;
}
.section-head .kicker::before {
  content: '';
  width: 20px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}
.section-head h2 {
  font-size: var(--text-h2);
  line-height: var(--leading-h2);
  letter-spacing: var(--track-h2);
  font-weight: 600;
  margin: 0;
}
.section-head p {
  margin: var(--space-2xs) 0 0;
  color: var(--text-2);
  font-size: var(--text-body-l);
  line-height: var(--leading-body-l);
}

/* ---- شارات الحالة (لون + نص دائمًا، لا لون وحده) -------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-caption);
  line-height: 20px;
  font-weight: 500;
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.badge-ok {
  background: var(--success-surface);
  color: var(--success-text);
}
.badge-warn {
  background: var(--warning-surface);
  color: var(--warning-text);
}
.badge-info {
  background: var(--info-surface);
  color: var(--info-text);
}
.badge-err {
  background: var(--error-surface);
  color: var(--error-text);
}
.badge-soon {
  background: var(--surface-3);
  color: var(--mute);
  border: 1px dashed var(--line-strong);
}
.badge-soon::before {
  display: none;
}
.badge-live::before {
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent);
}

/* ---- رقاقة صغيرة ------------------------------------------------------------ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-caption);
  line-height: 20px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  color: var(--text-2);
}
/* رقاقة قابلة للنقر — اقتراح يملأ حقلًا (أسئلة مقترحة، عيّنات التجربة، أنواع النشاط) */
.chip--action {
  min-height: 36px;
  padding: 6px 12px;
  font-size: var(--text-body-s);
  line-height: 22px;
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition:
    border-color var(--motion-fast) var(--ease),
    background-color var(--motion-fast) var(--ease);
}
.chip--action:hover {
  background: var(--surface-3);
  border-color: var(--interactive);
}
.chip--action[aria-pressed='true'],
.chip--action.is-on {
  background: var(--i50);
  border-color: var(--interactive);
  color: var(--i700);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3xs);
}

/* ---- بطاقات المسار (نوع النشاط) — مشتركة بين الهبوط وخطوة «نوع نشاطك» ---------- */
/* ثلاث بطاقات على سطح المكتب، عمودية على الجوال. الأيقونة فوق، العنوان سطر مستقل،
   سطران قصيران تحته، وعلامة الاختيار في الزاوية لا فوق النص. */
.paths {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-xs);
}
.path {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-xs);
  width: 100%;
  padding: var(--space-md);
  min-height: 100%;
}
.path .icon-badge {
  width: 44px;
  height: 44px;
}
.path-body {
  display: grid;
  gap: var(--space-4xs);
}
.path-n {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: var(--text-h4);
  line-height: var(--leading-h4);
  font-weight: 600;
}
.path-l {
  color: var(--text);
  font-size: var(--text-body-s);
  line-height: var(--leading-body-s);
}
.path-a {
  color: var(--text-2);
  font-size: var(--text-body-s);
  line-height: var(--leading-body-s);
}
.path-mark {
  position: absolute;
  top: var(--space-2xs);
  inset-inline-start: var(--space-2xs);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--interactive);
  opacity: 0;
  transform: scale(0.6);
  transition:
    opacity var(--motion-fast) var(--ease),
    transform var(--motion-base) var(--ease-out);
}
.path[aria-checked='true'] .path-mark,
.path[aria-pressed='true'] .path-mark {
  opacity: 1;
  transform: none;
}
.path[aria-checked='true'] .icon-badge,
.path[aria-pressed='true'] .icon-badge {
  background: var(--interactive);
  color: #fff;
  border-color: transparent;
}
@media (max-width: 1023px) {
  .paths {
    grid-template-columns: 1fr;
  }
  .path {
    min-height: 0;
  }
}

/* ---- مقياس ---------------------------------------------------------------- */
.metric {
  display: grid;
  gap: 4px;
  padding: var(--space-xs) var(--space-md);
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.metric .metric-v {
  font-family: var(--font-ui);
  font-size: var(--text-h2);
  line-height: var(--leading-h2);
  font-weight: 600;
  letter-spacing: -0.01em;
  direction: ltr;
}
.metric .metric-l {
  color: var(--text-2);
  font-size: var(--text-body-s);
  line-height: var(--leading-body-s);
}
.metric--warn .metric-v {
  color: var(--warning-text);
}

/* ---- أرقام الخطوات (Space Grotesk، كما في المرجع) ------------------------- */
.step-n {
  font-family: var(--font-ui);
  font-size: var(--text-body-s);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--interactive);
  direction: ltr;
}

/* ---- خطوط شعرية ------------------------------------------------------------- */
.hr {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 0;
}

/* ---- الحركة: كشف عند الظهور — تُعطَّل مع reduced-motion --------------------- */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity var(--motion-slow) var(--ease-out),
    transform var(--motion-slow) var(--ease-out);
}
.reveal.is-in {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .btn,
  .card--interactive,
  .path-mark,
  .chip--action {
    transition: none;
  }
}

/* ---- تركيز موحّد ------------------------------------------------------------- */
.btn:focus-visible,
.card--interactive:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
