/**
 * base.css — الأساسيات، التصفير، وإعدادات RTL والطباعة لمنصة لَقْطة
 */

@import url('https://fonts.googleapis.com/css2?family=Alexandria:wght@400;500;600;700;800&family=Noto+Sans+Arabic:wght@400;500;600;700&display=swap');

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  direction: rtl;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--lh-normal);
  color: var(--color-text-main);
  background-color: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

/* تخطي إلى المحتوى لسهولة الوصول بلوحة المفاتيح */
.skip-link {
  position: absolute;
  top: -100px;
  right: var(--space-md);
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  z-index: 9999;
  font-weight: 600;
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-md);
  outline: 3px solid var(--color-accent);
}

/* فئات إمكانية الوصول */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* مؤشرات التركيز المتاحة */
:focus-visible {
  outline: 2.5px solid var(--color-primary);
  outline-offset: 2px;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2.5px solid var(--color-primary);
  outline-offset: 2px;
}

/* إعدادات النصوص والعناوين */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: var(--lh-tight);
  color: var(--color-text-main);
  letter-spacing: 0; /* تجنب تفريق الحروف في الخط العربي */
}

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

@media (min-width: 768px) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }
}

p {
  max-width: 75ch; /* الحفاظ على طول سطر مريح للقراءة */
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

img, svg, picture, video {
  display: block;
  max-width: 100%;
  height: auto;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  border: none;
  background: none;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

ul, ol {
  list-style: none;
}

bdi, .bdi-num {
  unicode-bidi: isolate;
  direction: ltr;
  display: inline-block;
}

/* الحاوية الأساسية */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin-inline: auto;
  padding-inline: var(--space-md);
}

@media (min-width: 768px) {
  .container {
    padding-inline: var(--space-xl);
  }
}

/* شريط التمرير الناعم */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-surface-subtle);
}

::-webkit-scrollbar-thumb {
  background: #C4CFC7;
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: #AAB9AD;
}

/* تذييل الصفحة يبقى دائماً في الأسفل */
main {
  flex: 1 0 auto;
}
