/* ==========================================================================
   Base — Reset, Typography, Utilities
   ========================================================================== */

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-family);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--neutral-800);
  background: var(--neutral-100);
  min-height: 100vh;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  color: var(--neutral-900);
  line-height: var(--leading-tight);
  font-weight: var(--font-semibold);
}

h1 { font-size: var(--text-2xl); margin-bottom: var(--space-5); }
h2 { font-size: var(--text-xl);  margin-bottom: var(--space-4); }
h3 { font-size: var(--text-lg);  margin-bottom: var(--space-3); }
h4 { font-size: var(--text-md);  margin-bottom: var(--space-2); }

p { margin-bottom: var(--space-3); }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--primary-hover); text-decoration: underline; }

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--neutral-200);
  padding: 0.1em 0.3em;
  border-radius: var(--radius-sm);
}

pre {
  font-family: var(--font-mono);
  background: var(--neutral-200);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin-bottom: var(--space-3);
}
pre code { background: none; padding: 0; }

hr {
  border: none;
  border-top: 1px solid var(--neutral-300);
  margin: var(--space-6) 0;
}

/* --- Utility Classes --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--neutral-600); }
.text-sm     { font-size: var(--text-sm); }
.text-xs     { font-size: var(--text-xs); }

.hidden { display: none !important; }
.visible { display: flex; }

/* --- RTL Support --- */
[dir="rtl"] {
  font-family: 'Noto Nastaliq Urdu', 'Noto Sans', var(--font-family);
  word-break: normal;
  overflow-wrap: break-word;
}
[dir="rtl"] .item-badge { margin-left: 0; margin-right: 8px; }
[dir="rtl"] code, [dir="rtl"] pre { direction: ltr; text-align: left; }
