/*
 * Resets, base typography, and layout primitives.
 *
 * Everything here reads design tokens from tokens.css — no literal colour
 * values — so light/dark and LTR/RTL both work with zero changes in this
 * file. Physical `left`/`right` are avoided in favour of CSS logical
 * properties so the whole layout mirrors automatically under `dir="rtl"`.
 */

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

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

body {
  margin: 0;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  line-height: 1.6;
  transition: background-color 0.15s ease, color 0.15s ease;
}

/* Urdu pages get the display face by default for headings/quotes; UI chrome
   (nav, buttons, labels) stays on Noto Naskh Arabic — see components.css. */
html[lang="ur"] body {
  font-family: "Noto Naskh Arabic", var(--font-body);
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  margin-block: 0 var(--space-2);
  text-wrap: balance;
}

html[lang="ur"] h1,
html[lang="ur"] h2,
html[lang="ur"] h3,
html[lang="ur"] h4,
html[lang="ur"] h5,
html[lang="ur"] h6 {
  font-family: var(--font-urdu-display);
  font-weight: 400;
  line-height: 1.6;
}

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

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

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

h4,
h5,
h6 {
  font-size: var(--font-size-md);
}

p {
  margin-block: 0 var(--space-2);
}

a {
  color: var(--color-brand-deep);
}

@media (prefers-color-scheme: dark) {
  a {
    color: var(--color-pale-aqua);
  }
}

:root[data-theme="dark"] a {
  color: var(--color-pale-aqua);
}

:root[data-theme="light"] a {
  color: var(--color-teal-deep);
}

a:hover {
  color: var(--color-teal-bright);
}

small,
.text-faint {
  color: var(--color-text-faint);
  font-size: var(--font-size-xs);
}

.uppercase-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: var(--font-size-xs);
}

ul,
ol {
  padding-inline-start: var(--space-3);
}

/* --- Skip link -------------------------------------------------------------
   Visually hidden until focused; the first focusable element on every page,
   letting keyboard users jump past the header straight to <main>. */
.skip-link {
  position: absolute;
  inset-inline-start: var(--space-2);
  top: -3rem;
  z-index: 100;
  background-color: var(--color-brand-deep);
  color: #fff;
  padding: var(--space-1) var(--space-2);
  border-radius: 0 0 6px 6px;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0;
}

/* --- Focus visibility --------------------------------------------------- */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- Reduced motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Layout primitives --------------------------------------------------- */
.site {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

.wrapper {
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: var(--space-2);
}

.prose {
  max-width: var(--reading-width);
  margin-inline: auto;
  padding-block: var(--space-4);
}

.prose :is(h1, h2, h3) {
  margin-block-start: var(--space-4);
}

section {
  padding-block: var(--space-4);
}

.section-tinted {
  background-color: var(--color-accent-soft-bg);
}
