/**
 * Resaneh Logical & Typography Utilities — MVP-004 (v0.4.0), WBS Tasks 7-8.
 *
 * Two things live here, and nothing else:
 *
 *   1. Logical-property utility classes for CUSTOM markup (SS5, the
 *      non-negotiable rule set): margin-inline-*, padding-inline-*,
 *      border-inline-*, text-align: start/end. Never left/right.
 *      Bootstrap's own vendored utilities (ms-*, me-*, text-start,
 *      text-end, ...) already ship this way in both the LTR and RTL
 *      builds and are used directly where they suffice - these classes
 *      exist only for the cases a page needs outside Bootstrap's set.
 *
 *   2. Typography-tier classes that apply the SS3 type scale tokens
 *      (docs/DESIGN_SYSTEM.md SS3.3 Editorial, SS3.5 Directory density),
 *      switching automatically on [lang] because the two scripts carry
 *      DIFFERENT measured px/line-height pairs - there is no universal
 *      per-script adjustment rule (SS3.3's governing rule).
 *
 * What is deliberately NOT here, per SS4.1: "No unicode-bidi CSS is used
 * for these cases." Bidirectional isolation is achieved by explicit
 * dir + lang markup alone (see app/Support/helpers.php: bidi_ltr() /
 * bidi_rtl()), never by a CSS class. A CSS class that set
 * unicode-bidi: isolate would invite exactly the markup-free shortcut
 * SS4.1 rules out.
 */

/* ---- Logical-property utilities (SS5) --------------------------- */
.u-text-start { text-align: start; }
.u-text-end   { text-align: end; }

.u-ms-auto { margin-inline-start: auto; }
.u-me-auto { margin-inline-end: auto; }

.u-border-is { border-inline-start: 1px solid var(--border-container); }
.u-border-ie { border-inline-end: 1px solid var(--border-container); }

.u-pis-1 { padding-inline-start: 0.25rem; }
.u-pie-1 { padding-inline-end: 0.25rem; }

/* ---- Editorial type scale (D-46) --------------------------------- */
.text-display { font-size: var(--type-display-size-en); line-height: var(--type-display-lh-en); font-weight: 600; }
.text-h1      { font-size: var(--type-h1-size-en);      line-height: var(--type-h1-lh-en);      font-weight: 600; }
.text-h2      { font-size: var(--type-h2-size-en);      line-height: var(--type-h2-lh-en);      font-weight: 600; }
.text-h3      { font-size: var(--type-h3-size-en);      line-height: var(--type-h3-lh-en);      font-weight: 600; }
.text-lead    { font-size: var(--type-lead-size-en);    line-height: var(--type-lead-lh-en);    font-weight: 400; }
.text-body    { font-size: var(--type-body-size-en);    line-height: var(--type-body-lh-en);    font-weight: 400; }
.text-small   { font-size: var(--type-small-size-en);   line-height: var(--type-small-lh-en);   font-weight: 400; }
.text-micro   { font-size: var(--type-micro-size-en);   line-height: var(--type-micro-lh-en);   font-weight: 500; }

html[lang='fa'] .text-display { font-size: var(--type-display-size-fa); line-height: var(--type-display-lh-fa); }
html[lang='fa'] .text-h1      { font-size: var(--type-h1-size-fa);      line-height: var(--type-h1-lh-fa); }
html[lang='fa'] .text-h2      { font-size: var(--type-h2-size-fa);      line-height: var(--type-h2-lh-fa); }
html[lang='fa'] .text-h3      { font-size: var(--type-h3-size-fa);      line-height: var(--type-h3-lh-fa); }
html[lang='fa'] .text-lead    { font-size: var(--type-lead-size-fa);    line-height: var(--type-lead-lh-fa); }
html[lang='fa'] .text-body    { font-size: var(--type-body-size-fa);    line-height: var(--type-body-lh-fa); }
html[lang='fa'] .text-small   { font-size: var(--type-small-size-fa);   line-height: var(--type-small-lh-fa); }
html[lang='fa'] .text-micro   { font-size: var(--type-micro-size-fa);   line-height: var(--type-micro-lh-fa); }

/* SS3.6 (D-49): body text never shrinks on small screens; only
   Display, H1 and H2 take fluid treatment, and only because both are
   already comfortably above the readable floor - no fluid clamp() is
   introduced here since no approved mockup has yet demonstrated a
   concrete need beyond the fixed values above (D-49 exception clause). */

/* ---- Directory density variant (D-48) ---------------------------- */
.text-card-title { font-size: var(--type-card-title-size-en); line-height: var(--type-card-title-lh-en); font-weight: 600; }
.text-dir-body   { font-size: var(--type-dir-body-size-en);   line-height: var(--type-dir-body-lh-en);   font-weight: 400; }
.text-metadata   { font-size: var(--type-metadata-size-en);   line-height: var(--type-metadata-lh-en);   font-weight: 400; }
.text-chip       { font-size: var(--type-chip-size-en);       line-height: var(--type-chip-lh-en);       font-weight: 500; }

html[lang='fa'] .text-card-title { font-size: var(--type-card-title-size-fa); line-height: var(--type-card-title-lh-fa); }
html[lang='fa'] .text-dir-body   { font-size: var(--type-dir-body-size-fa);   line-height: var(--type-dir-body-lh-fa); }
html[lang='fa'] .text-metadata   { font-size: var(--type-metadata-size-fa);   line-height: var(--type-metadata-lh-fa); }
html[lang='fa'] .text-chip       { font-size: var(--type-chip-size-fa);       line-height: var(--type-chip-lh-fa); }

/* ---- Editorial measure (D-47) ------------------------------------ */
.u-measure { max-width: var(--measure-en); }
html[lang='fa'] .u-measure { max-width: var(--measure-fa); }

/* SS3.6 (D-49): Persian is right-aligned and ragged-left; full
   justification is not approved. Direction is already supplied by the
   `dir` attribute on <html>, so no `text-align` override is applied
   here - overriding it would fight the logical `start` alignment
   Bootstrap's own two builds already provide. */

/* ---- Neutral surfaces, exposed as classes for /style-guide ------- */
.bg-surface-canvas  { background-color: var(--surface-canvas); }
.bg-surface-subtle  { background-color: var(--surface-subtle); }
.bg-surface-warm    { background-color: var(--surface-warm); }
.bg-surface-premium { background-color: var(--surface-premium); }
.text-muted-token    { color: var(--text-muted); }
.text-secondary-token{ color: var(--text-secondary); }
.text-strong-token   { color: var(--text-strong); }
