/*
    Almas ERP - global base rules (Wave 12A.2).

    Only rules that apply to the whole document belong here: body rendering,
    heading typography, links, the focus-visible foundation, text selection
    and the one bidirectional-text helper (.almas-ltr, see the end of this
    file). Bootstrap's Reboot already supplies box-sizing, the body's
    font/colour/background (read from the --bs-* variables mapped in
    tokens.css) and form-control font inheritance, so none of that is
    repeated. No layout, no authentication/shell layout, no page-specific and
    no component rules - those stay in almas-ui.css until their own slices.

    Loaded after Bootstrap and almas/tokens.css, before almas-ui.css.

    Direction discipline: nothing here uses a physical (left/right) property.
    Direction comes only from html[dir], resolved by the application from its
    localization context; this file never inspects a language code.
    No letter-spacing is applied to running text: it breaks the joining of
    Arabic-script letters.
*/

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   Headings. The .almas-h1..h3 / .almas-heading helper classes share the
   element rules so a heading can be styled independently of its tag level.
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6,
.almas-heading {
    font-weight: var(--almas-font-weight-semibold);
    color: var(--almas-color-text);
    line-height: var(--almas-line-height-snug);
}

h1, .almas-h1 { font-size: var(--almas-font-size-2xl); }
h2, .almas-h2 { font-size: var(--almas-font-size-xl); }
h3, .almas-h3 { font-size: var(--almas-font-size-lg); }
h4, h5 { font-size: var(--almas-font-size-md); }
h6 { font-size: var(--almas-font-size-sm); }

/* --------------------------------------------------------------------------
   Links: colour and hover colour come from Bootstrap's --bs-link-* variables
   (mapped to the Almas link tokens). Only the underline placement is set.
   -------------------------------------------------------------------------- */
a {
    text-underline-offset: .18em;
}

/* --------------------------------------------------------------------------
   Focus-visible foundation - a consistent, always-visible focus indicator,
   never suppressed. The explicit selector list (rather than a bare
   :focus-visible) deliberately keeps the same specificity as Bootstrap's
   .btn:focus-visible so the outline is not lost on buttons.
   -------------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: var(--almas-focus-ring-width) solid var(--almas-focus-ring-color);
    outline-offset: var(--almas-focus-ring-offset);
}

/* --------------------------------------------------------------------------
   Text selection
   -------------------------------------------------------------------------- */
::selection {
    background-color: rgba(var(--almas-color-link-rgb), .28);
}

/* --------------------------------------------------------------------------
   Bidirectional text helper. Keeps technical values (phone numbers, e-mail
   addresses, codes, document numbers, UUIDs, URLs) readable, left-to-right,
   inside an RTL interface. Apply it to an INLINE element (e.g. a span
   around the value), not to a table cell or block, so the surrounding text
   keeps the page's alignment. unicode-bidi: isolate stops the value from
   reordering neighbouring RTL text. A technical form control uses
   .almas-input-ltr (components.css, section 6) instead; user-entered names
   and free text should use the native dir="auto" or <bdi>, not this class.

   overflow-wrap: break-word lets a value longer than its container (a URL, a
   UUID or an IBAN on a narrow screen) break at the container edge instead of
   widening the page. Unlike "anywhere" it does not shrink the value's
   min-content width, so a table column keeps the whole value and the table
   wrapper scrolls, as before (values in tables are also white-space: nowrap).
   -------------------------------------------------------------------------- */
.almas-ltr {
    direction: ltr;
    overflow-wrap: break-word;
    unicode-bidi: isolate;
}
