/* ==========================================================================
   Base — reset, typography, layout primitives, RTL rules
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  font-size: calc(100% * var(--text-scale));
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-en);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

img, svg, video { display: block; max-width: 100%; height: auto; }
/* `svg { display:block }` above outranks the UA `[hidden]` rule, so hidden
   inline SVGs would still paint. Restore the expected behaviour. */
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 { line-height: var(--lh-tight); font-weight: var(--fw-semi); letter-spacing: -0.011em; }
h1 { font-size: var(--fs-3xl); letter-spacing: -0.021em; }
h2 { font-size: var(--fs-2xl); letter-spacing: -0.017em; }
h3 { font-size: var(--fs-lg); }

/* Focus — always visible, never removed. Spec 6.7 */
:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
:root[data-theme="dark"] :focus-visible { outline-color: var(--brand-500); }

.skip-link {
  position: absolute; inset-inline-start: var(--s-4); top: -100px; z-index: 200;
  background: var(--brand-500); color: var(--text-on-accent);
  padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: var(--s-4); }

/* .screen-reader-text is WordPress core's own name for this, emitted by
   the_posts_pagination(), comment forms and the search form among
   others. Without it core's "hidden" headings render as visible text:
   the listings pages were showing a stray "Pakistan navigation"
   heading above the page numbers. */
.visually-hidden,
.screen-reader-text {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- Layout ------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--s-4);
}
@media (min-width: 768px) { .container { padding-inline: var(--s-6); } }

.section-block { padding-block: var(--s-10); }
@media (min-width: 768px) { .section-block { padding-block: var(--s-12); } }

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s-4); margin-bottom: var(--s-6);
}
.section-head__text { min-width: 0; }
.section-head h2 { font-size: var(--fs-xl); }
@media (min-width: 768px) { .section-head h2 { font-size: var(--fs-2xl); } }
.section-head p {
  color: var(--text-muted); font-size: var(--fs-sm); margin-top: var(--s-1);
}
.section-head__link {
  flex: none; font-size: var(--fs-sm); font-weight: var(--fw-medium);
  color: var(--brand-500); white-space: nowrap;
  display: inline-flex; align-items: center; gap: var(--s-1);
}
.section-head__link:hover { text-decoration: underline; }
.section-head__link svg { transition: transform var(--dur) var(--ease); }
.section-head__link:hover svg { transform: translateX(2px); }
[dir="rtl"] .section-head__link svg { transform: scaleX(-1); }
[dir="rtl"] .section-head__link:hover svg { transform: scaleX(-1) translateX(2px); }

/* --- Section accent theming ---------------------------------------------
   Any subtree can adopt a section's identity by carrying [data-section].
   Components below only ever reference --accent / --accent-soft.          */
[data-section="scholarships"] { --accent: var(--sec-scholarships); --accent-soft: var(--sec-scholarships-soft); }
[data-section="local"]        { --accent: var(--sec-local);        --accent-soft: var(--sec-local-soft); }
[data-section="internships"]  { --accent: var(--sec-internships);  --accent-soft: var(--sec-internships-soft); }
[data-section="overseas"]     { --accent: var(--sec-overseas);     --accent-soft: var(--sec-overseas-soft); }
[data-section="visas"]        { --accent: var(--sec-visas);        --accent-soft: var(--sec-visas-soft); }
[data-section="news"]         { --accent: var(--sec-news);         --accent-soft: var(--sec-news-soft); }
:root { --accent: var(--brand-500); --accent-soft: var(--brand-100); }

/* --- RTL ----------------------------------------------------------------
   Urdu views set dir="rtl" on <html> and load the Urdu face. Logical
   properties above (padding-inline, margin-inline) mirror automatically;
   these handle what cannot. Spec 4.3                                      */
[dir="rtl"] body { font-family: var(--font-ur); line-height: 2.1; }
[dir="rtl"] .icon-chevron { transform: scaleX(-1); }
