/*!
 * direction.css — the platform's direction rules, in one place.
 *
 * Arabic and Kurdish are not English with the sides swapped. What is here is the
 * small set of things the cascade cannot infer on its own: a glyph that must
 * mirror because its direction is semantic, and an isolation boundary for values
 * that are Latin no matter what language surrounds them.
 *
 * WHAT IS DELIBERATELY NOT HERE. There is no [dir="rtl"] block flipping margins
 * and paddings back the other way. That is the mirror-switch approach, and it
 * means every layout decision is written twice with the second copy silently
 * wrong the moment somebody edits the first. Where a rule needs to know which
 * side the reader starts on, the rule itself says so — margin-inline-start,
 * border-inline-end, text-align:start — and the browser resolves it.
 */

/* ── technical values ──────────────────────────────────────────────────────
 * The tv directive and the tv component both emit <bdi dir="ltr">, which is
 * already isolated by the standard's own default. This rule exists so the
 * isolation cannot be lost by a stylesheet that sets unicode-bidi on a parent,
 * and so a value never becomes a flex item that stretches or shrinks: it is
 * text, and it should behave like the text around it. */
bdi,
.tv {
    unicode-bidi: isolate;
}

/* A technical value inside a monospace cell keeps its own alignment: a column of
 * codes reads as a column, and a right-to-left page does not make an AWB number
 * start at the other end. */
.tv-block {
    display: block;
    direction: ltr;
    text-align: start;
    unicode-bidi: isolate;
}

/* ── directional glyphs ────────────────────────────────────────────────────
 * The component picks the CHARACTER, so nothing needs transforming. This rule
 * only guarantees the glyph is its own inline box, so a font's own bearing
 * cannot pull it into the label beside it. */
.dir-glyph {
    display: inline-block;
    unicode-bidi: isolate;
}

/* For a glyph a character cannot express — an icon font, an inline SVG, a
 * background image. Mirrored only when direction is SEMANTIC, and applied by
 * hand: a play triangle, a download arrow, an external-link mark and a brand
 * must never carry this class, because mirroring them does not translate them,
 * it changes what they say. */
.dir-flip {
    display: inline-block;
}

[dir="rtl"] .dir-flip {
    transform: scaleX(-1);
}

/* The legal vertical had already solved this locally as .lf-arr. Kept as an
 * alias so that theme keeps working, and so there is one rule rather than two
 * implementations drifting apart. */
.lf-arr {
    display: inline-block;
}

[dir="rtl"] .lf-arr {
    transform: scaleX(-1);
}
