/*
 * base.css - إعادة الضبط والطباعة والأدوات العامة
 * يعمل بالكامل باتجاه RTL.
 */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  font-size: var(--bt-fs-base);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  direction: rtl;
  text-align: right;
  font-family: var(--bt-font);
  font-weight: var(--bt-fw-normal);
  line-height: var(--bt-lh);
  color: var(--bt-text);
  background: var(--bt-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--bt-sp-3);
  font-weight: var(--bt-fw-bold);
  line-height: var(--bt-lh-tight);
  color: var(--bt-text);
}

h1 { font-size: var(--bt-fs-h1); }
h2 { font-size: var(--bt-fs-h2); }
h3 { font-size: var(--bt-fs-h3); }

p { margin: 0 0 var(--bt-sp-4); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--bt-primary);
  text-decoration: none;
  transition: color var(--bt-transition);
}
a:hover { color: var(--bt-secondary); }

img, picture, video, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol { margin: 0 0 var(--bt-sp-4); padding-inline-start: 1.25rem; }
ul:last-child, ol:last-child { margin-bottom: 0; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  direction: rtl;
}

button { cursor: pointer; }

table { width: 100%; border-collapse: collapse; }

:focus-visible {
  outline: 2px solid var(--bt-primary);
  outline-offset: 2px;
}

/* ---------- التخطيط ---------- */

.bt-container {
  width: 100%;
  max-width: var(--bt-container);
  margin-inline: auto;
  padding-inline: var(--bt-gutter);
}

.bt-section { padding-block: var(--bt-section-y); }
.bt-section--alt { background: var(--bt-bg-alt); }

.bt-grid { display: grid; gap: var(--bt-sp-5); }
.bt-grid--2 { grid-template-columns: repeat(2, 1fr); }
.bt-grid--3 { grid-template-columns: repeat(3, 1fr); }
.bt-grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 991px) {
  .bt-grid--3,
  .bt-grid--4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 575px) {
  .bt-grid--2,
  .bt-grid--3,
  .bt-grid--4 { grid-template-columns: 1fr; }
}

/* ---------- أدوات مساعدة ---------- */

.bt-hidden { display: none !important; }

/* يعلو على أي قاعدة display في المكوّنات، مثل النوافذ المنبثقة */
[hidden] { display: none !important; }

.bt-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* يُخفى بالإزاحة للأعلى لا للجانب، لأن الإزاحة الجانبية تصنع تمريرًا أفقيًا في اتجاه RTL */
.bt-skip-link {
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  z-index: var(--bt-z-popup);
  padding: var(--bt-sp-3) var(--bt-sp-4);
  background: var(--bt-primary);
  color: var(--bt-text-invert);
  transform: translateY(-120%);
  transition: transform var(--bt-transition);
}
.bt-skip-link:focus { transform: translateY(0); }

.bt-clamp-2,
.bt-clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bt-clamp-2 { -webkit-line-clamp: 2; }
.bt-clamp-3 { -webkit-line-clamp: 3; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- خلفيات الأقسام: صورة خلف المحتوى ---------- */

/*
 * القسم صاحب الخلفية يصبح حاوية موضعية، والمحتوى يعلو طبقة الخلفية.
 * كل الطبقات ألوان صريحة بلا أي تدرج لوني.
 */
.bt-section--bg {
  position: relative;
  isolation: isolate;
}

.bt-section--bg > .bt-container { position: relative; z-index: 2; }

/*
 * زخارف خفيفة: طائرتان ومساران متقطعان في أطراف القسم.
 * تأخذ لون الهوية تلقائيًا، ولا تغطي القسم كله حتى لا تزاحم المحتوى.
 */
.bt-section__deco {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  color: var(--bt-primary);
  pointer-events: none;
}

.bt-deco {
  position: absolute;
  display: block;
  opacity: .14;
}

.bt-deco__svg {
  display: block;
  width: 100%;
  height: auto;
  fill: currentColor;
}

.bt-deco--plane-a {
  inset-block-start: 6%;
  inset-inline-start: 3%;
  width: 62px;
  transform: rotate(28deg);
}

.bt-deco--plane-b {
  inset-block-end: 9%;
  inset-inline-end: 5%;
  width: 48px;
  opacity: .12;
  transform: rotate(-142deg);
}

.bt-deco--route-a {
  inset-block-start: 4%;
  inset-inline-end: 4%;
  width: 195px;
  opacity: .16;
}

.bt-deco--route-b {
  inset-block-end: 6%;
  inset-inline-start: 2%;
  width: 165px;
  opacity: .14;
  transform: rotate(180deg);
}

/* على التابلت تصغر الزخارف، وعلى الجوال يبقى عنصران فقط حتى لا تزدحم الشاشة */
@media (max-width: 991px) {
  .bt-deco--plane-a { width: 46px; }
  .bt-deco--plane-b { width: 36px; }
  .bt-deco--route-a { width: 140px; }
  .bt-deco--route-b { width: 118px; }
}

@media (max-width: 575px) {
  .bt-deco--plane-b,
  .bt-deco--route-b { display: none; }
  .bt-deco--plane-a { width: 38px; inset-inline-start: 2%; }
  .bt-deco--route-a { width: 104px; }
}

@media (prefers-reduced-motion: no-preference) {
  .bt-deco--plane-a { animation: bt-deco-float-a 7s ease-in-out infinite; }
  .bt-deco--plane-b { animation: bt-deco-float-b 9s ease-in-out infinite; }
}

@keyframes bt-deco-float-a {
  0%, 100% { transform: rotate(28deg) translateY(0); }
  50%      { transform: rotate(28deg) translateY(-10px); }
}

@keyframes bt-deco-float-b {
  0%, 100% { transform: rotate(-142deg) translateY(0); }
  50%      { transform: rotate(-142deg) translateY(-8px); }
}

/* صورة خلف القسم مع طبقة لون فوقها تحافظ على وضوح النص */
.bt-section__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bt-section__bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bt-section__veil {
  position: absolute;
  inset: 0;
  background: rgba(var(--bt-bg-rgb, 255, 255, 255), var(--bt-sec-veil, .9));
}

/* في الأقسام ذات الخلفية المتبادلة تكون الطبقة بلون تلك الخلفية */
.bt-section--alt .bt-section__veil {
  background: rgba(var(--bt-bg-alt-rgb, 245, 248, 249), var(--bt-sec-veil, .9));
}

/* ---------- الدرجة الداكنة: الصورة واضحة والنص أبيض ---------- */

.bt-section--bg-dark .bt-section__veil,
.bt-section--alt.bt-section--bg-dark .bt-section__veil {
  background: rgba(var(--bt-dark-rgb, 8, 22, 28), var(--bt-sec-veil, .72));
}

.bt-section--bg-dark .bt-section-head__title,
.bt-section--bg-dark .bt-section-head__desc,
.bt-section--bg-dark .bt-results__count,
.bt-section--bg-dark .bt-label { color: #fff; }

.bt-section--bg-dark .bt-section-head__desc { color: rgba(255, 255, 255, .85); }

.bt-section--bg-dark .bt-section-head__sub {
  background: rgba(255, 255, 255, .16);
  color: #fff;
}

.bt-section--bg-dark .bt-btn--ghost {
  border-color: rgba(255, 255, 255, .55);
  color: #fff;
}

.bt-section--bg-dark .bt-btn--ghost:hover,
.bt-section--bg-dark .bt-btn--ghost:focus-visible {
  background: #fff;
  border-color: #fff;
  color: var(--bt-primary);
}

/* ---------- مقاسات الموبايل ---------- */

/*
 * تصغير النص على الشاشات الصغيرة، مبني على متغير الخط القادم من لوحة التحكم
 * فلا يُلغى اختيار المدير. مقاسات الأزرار في components.css بعد تعريفها.
 */
@media (max-width: 767px) {
  body { font-size: calc(var(--bt-fs-base) * .95); }
}

@media (max-width: 575px) {
  body { font-size: calc(var(--bt-fs-base) * .92); }
}
