html {
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  font-size: var(--text-base);
  transition: background-color var(--transition-normal), color var(--transition-normal);
  position: relative;
  width: 100%;
  margin: 0;
}

html[lang="ar"],
html[dir="rtl"] {
  font-family: var(--font-arabic);
  direction: rtl;
}

/* Container */
.tf-container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-4);
  box-sizing: border-box;
}

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

@media (min-width: 1200px) {
  .tf-container {
    padding-inline: var(--space-8);
  }
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6 {
  letter-spacing: 0;
  line-height: 1.4;
}

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

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

p {
  color: var(--text-muted);
  line-height: 1.65;
}

/* Focus Visible (Accessible Keyboard Outline) */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Skip Link */
.skip-link {
  position: absolute;
  top: -100px;
  inset-inline-start: var(--space-4);
  background: var(--primary);
  color: var(--text-inverse);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  z-index: 9999;
  font-weight: 600;
  font-size: var(--text-sm);
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-4);
}

/* Selection */
::selection {
  background-color: var(--primary);
  color: #FFFFFF;
}

/* Numbers & Data Readouts */
.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* SVG Icon Base */
.tf-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  stroke: currentColor;
}

/* RTL Icon Mirroring for Directional Arrows */
html[dir="rtl"] .tf-icon-dir {
  transform: scaleX(-1);
}

/* Visually Hidden Utility */
.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;
}
