/* Typography Styles for Arabic (RTL) */

body {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-text-primary);
  margin-block-end: var(--spacing-md);
}

h1 {
  font-size: var(--font-size-5xl);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--font-size-4xl);
  letter-spacing: -0.01em;
}

h3 {
  font-size: var(--font-size-3xl);
}

h4 {
  font-size: var(--font-size-2xl);
}

h5 {
  font-size: var(--font-size-xl);
}

h6 {
  font-size: var(--font-size-lg);
}

/* Paragraphs */
p {
  margin-block-end: var(--spacing-md);
  line-height: var(--line-height-relaxed);
}

p:last-child {
  margin-block-end: 0;
}

/* Links */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-dark);
}

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

/* Strong and Bold */
strong,
b {
  font-weight: var(--font-weight-bold);
}

/* Emphasis */
em,
i {
  font-style: italic;
}

/* Small text */
small {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

/* Lists */
ul,
ol {
  margin-block-end: var(--spacing-md);
  padding-inline-start: var(--spacing-lg);
}

ul {
  list-style-type: disc;
}

ol {
  list-style-type: decimal;
}

li {
  margin-block-end: var(--spacing-sm);
  line-height: var(--line-height-relaxed);
}

li:last-child {
  margin-block-end: 0;
}

/* Blockquotes */
blockquote {
  margin: var(--spacing-lg) 0;
  padding: var(--spacing-md);
  padding-inline-start: var(--spacing-lg);
  border-inline-start: 4px solid var(--color-primary);
  background-color: var(--color-background-alt);
  font-style: italic;
  color: var(--color-text-secondary);
}

/* Code */
code {
  font-family: 'Courier New', monospace;
  font-size: var(--font-size-sm);
  padding: var(--spacing-xs) var(--spacing-sm);
  background-color: var(--color-gray-100);
  border-radius: var(--radius-sm);
  color: var(--color-error);
}

pre {
  margin: var(--spacing-md) 0;
  padding: var(--spacing-md);
  background-color: var(--color-gray-900);
  color: var(--color-white);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* Horizontal Rule */
hr {
  margin: var(--spacing-xl) 0;
  border: none;
  border-block-start: 1px solid var(--color-border);
}

/* Text Utilities */
.text-center {
  text-align: center;
}

.text-start {
  text-align: start;
}

.text-end {
  text-align: end;
}

.text-primary {
  color: var(--color-primary);
}

.text-secondary {
  color: var(--color-text-secondary);
}

.text-muted {
  color: var(--color-text-muted);
}

.text-error {
  color: var(--color-error);
}

.text-success {
  color: var(--color-success);
}

/* Font Weight Utilities */
.font-light {
  font-weight: var(--font-weight-light);
}

.font-normal {
  font-weight: var(--font-weight-normal);
}

.font-semibold {
  font-weight: var(--font-weight-semibold);
}

.font-bold {
  font-weight: var(--font-weight-bold);
}

/* Font Size Utilities */
.text-xs {
  font-size: var(--font-size-xs);
}

.text-sm {
  font-size: var(--font-size-sm);
}

.text-base {
  font-size: var(--font-size-base);
}

.text-lg {
  font-size: var(--font-size-lg);
}

.text-xl {
  font-size: var(--font-size-xl);
}

.text-2xl {
  font-size: var(--font-size-2xl);
}

/* Arabic-specific adjustments */
@supports (font-feature-settings: "ss01") {
  body {
    font-feature-settings: "ss01"; /* Stylistic alternates for better Arabic rendering */
  }
}

/* Responsive Typography */
@media (max-width: 768px) {
  h1 {
    font-size: var(--font-size-4xl);
  }

  h2 {
    font-size: var(--font-size-3xl);
  }

  h3 {
    font-size: var(--font-size-2xl);
  }

  h4 {
    font-size: var(--font-size-xl);
  }
}
