/* =========================================
   دار المحبرة — الأساس والتصفير
   ========================================= */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  direction: rtl;
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  hanging-punctuation: first last;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-ink);
  background-color: var(--bg-page);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ضمان اختفاء أي عنصر يحمل خاصية hidden فعلياً،
   حتى لو كان له display مخصص في مكان آخر (مثل عدّادات الهيدر) */
[hidden] {
  display: none !important;
}

/* --- الروابط --- */
a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible {
  outline: 2px solid var(--color-sage);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* --- الصور --- */
img, svg {
  display: block;
  max-inline-size: 100%;
}

/* --- القوائم --- */
ul, ol {
  list-style: none;
}

/* --- الأزرار --- */
button {
  font-family: var(--font-body);
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

button:focus-visible {
  outline: 2px solid var(--color-sage);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* --- حقول الإدخال --- */
input, select, textarea {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-ink);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-sage);
  outline-offset: 0;
}

/* --- العناوين --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--color-ink);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md); }
h6 { font-size: var(--text-base); }

/* --- الفواصل --- */
hr {
  border: none;
  border-block-start: var(--border-subtle);
  margin-block: var(--space-6);
}

/* --- إخفاء بصري للشاشة --- */
.sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- حالة التحميل --- */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-sage-light) 25%,
    rgba(199, 211, 192, 0.5) 50%,
    var(--color-sage-light) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-pulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- شريط التمرير --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--color-sage-light);
}
::-webkit-scrollbar-thumb {
  background: var(--color-sage);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-sage-dark);
}

/* --- مرئية التركيز للوحة المفاتيح --- */
:focus:not(:focus-visible) {
  outline: none;
}

/* --- تحديد النص --- */
::selection {
  background-color: var(--color-gold-light);
  color: var(--color-ink);
}
