/*
 * Typography normalization for Radius Smart.
 *
 * Loaded once from app.blade.php + guest.blade.php right after theme-tokens
 * (which defines --rs-font-en / --rs-font-ar). Goals:
 *
 *   1. Symmetric font-smoothing: -webkit-font-smoothing was already set on
 *      .rs-body, but its Firefox/macOS counterpart (-moz-osx-font-smoothing)
 *      was missing — that asymmetry is what made Firefox text look thinner
 *      than Chrome on the same page.
 *   2. text-rendering: optimizeLegibility for kerning + ligatures.
 *   3. Force form controls + tables to inherit the project font. Browsers
 *      (notably Firefox + some Safari builds) do NOT inherit font-family on
 *      <input>/<select>/<textarea>/<button> from <body>; they fall back to
 *      the user-agent stylesheet, which on many systems is a thin sans
 *      that reads "weak". This was the most visible cause of the issue.
 *   4. Floor body weight at 500. UI is dense + dark mode amplifies the
 *      thinning effect of antialiasing; the previous default of 400 read
 *      anemic against #070b14. Headings/buttons/badges keep their stronger
 *      explicit weights.
 *   5. Slightly bump --rs-muted in dark mode (#8a97ad → #9aa8be) — the
 *      original color was borderline against the very dark surface.
 *
 * Intentionally surgical: no padding/margin/size/color changes beyond #5,
 * no !important, no class renames. Existing per-blade <style> blocks that
 * declare their own font-weight (e.g. .rs-page-title=700) keep winning via
 * normal specificity.
 */

/* ----- 1 + 2: smoothing + rendering, applied to the whole document ----- */
html, body, .rs-body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ----- 3: explicit font-family inheritance, English default ----- */
html, body, .rs-body,
input, select, textarea, button, optgroup,
table, th, td, label,
.modal, .rs-drawer, .rs-dropdown, .rs-dropdown-menu {
    font-family: var(--rs-font-en, 'Inter', system-ui, -apple-system, sans-serif);
}

/* ----- 3b: same for Arabic + Kurdish ----- */
html[lang="ar"], html[lang="ar"] body, html[lang="ar"] .rs-body,
html[lang="ar"] input, html[lang="ar"] select, html[lang="ar"] textarea, html[lang="ar"] button,
html[lang="ar"] table, html[lang="ar"] th, html[lang="ar"] td, html[lang="ar"] label,
html[lang="ar"] .modal, html[lang="ar"] .rs-drawer, html[lang="ar"] .rs-dropdown,
html[lang="ku"], html[lang="ku"] body, html[lang="ku"] .rs-body,
html[lang="ku"] input, html[lang="ku"] select, html[lang="ku"] textarea, html[lang="ku"] button,
html[lang="ku"] table, html[lang="ku"] th, html[lang="ku"] td, html[lang="ku"] label,
html[lang="ku"] .modal, html[lang="ku"] .rs-drawer, html[lang="ku"] .rs-dropdown {
    font-family: var(--rs-font-ar, 'IBM Plex Sans Arabic', 'Tajawal', system-ui, sans-serif);
}

/* ----- 4: base reading weight 500 (was 400 by inheritance) ----- */
.rs-body { font-weight: 500; }

/* Tables — denser content, needs slightly more weight to stay legible. */
.rs-rep-table td, .rs-table td { font-weight: 500; }
.rs-rep-table th, .rs-table th { font-weight: 700; }

/* Form controls — same weight as body so user input doesn't read thin. */
input, select, textarea,
.form-control, .form-select {
    font-weight: 500;
}

/* Sidebar / topbar / dropdowns / pagination / report toolbars — inherit
 * the body font cleanly. (Most already do, but a few partials were missing
 * the cascade because they sit outside .rs-body in the DOM.) */
.rs-sidebar, .rs-sidebar *,
.rs-topbar, .rs-topbar *,
.rs-dropdown, .rs-dropdown *,
.rs-rep-toolbar, .rs-rep-toolbar *,
.rs-rep-pagination, .rs-rep-pagination *,
.rs-rep-chip, .rs-rep-count-badge {
    font-family: inherit;
}

/* Buttons + nav links: inherit font (their explicit font-weight wins). */
.rs-btn, .rs-icon-btn, .rs-dropdown-item,
.rs-tabs a, .nav-link,
.btn, .dropdown-item, .pagination, .badge {
    font-family: inherit;
}

/* ----- 5: muted color one notch stronger on dark mode ----- */
html[data-rs-theme="dark"] {
    --rs-muted: #9aa8be;
}
