/*
 * Arabic layer. Loaded ONLY on the Arabic page, never on the English one.
 *
 * ============================================================================
 * WHY THIS FILE EXISTS AND WHAT IT IS ALLOWED TO DO
 * ============================================================================
 * The design was drawn in English and site.css is that design, byte for byte. Arabic needs
 * two things it cannot supply:
 *
 *   1. TYPE. "Bebas Neue Custom" and "DM Sans" are Latin-only. Arabic set in them falls
 *      through to whatever the device happens to have, which is a different face on every
 *      phone. Cairo is substituted for both roles — it carries the weights the design uses
 *      and it is a condensed-friendly companion for the display sizes.
 *
 *   2. DIRECTION. `dir="rtl"` on <html> mirrors the flow automatically, but a handful of
 *      rules in site.css are written in physical terms — `right`, `border-right`,
 *      `translateX`, `margin-left` — and those have to be mirrored by hand.
 *
 * It changes NOTHING ELSE. No colour, no size, no spacing, no order. If a rule here is not
 * about the Arabic script or about direction, it does not belong in this file.
 * ============================================================================
 */

/* ---------------------------------------------------------------- type */

[dir="rtl"] body,
[dir="rtl"] .footer-form input,
[dir="rtl"] .footer-form textarea,
[dir="rtl"] .modal-nav button {
    font-family: "Cairo", "DM Sans", Arial, sans-serif;
}

/* Every element the design sets in Bebas Neue. Listed explicitly rather than with a wildcard
   so that adding a heading to the design without adding it here is a visible mismatch and
   not a silent one. */
[dir="rtl"] .hero h1,
[dir="rtl"] .display,
[dir="rtl"] .visual-content h3,
[dir="rtl"] .feature h3,
[dir="rtl"] .step h4,
[dir="rtl"] .final-cta h2,
[dir="rtl"] .hero-card h3,
[dir="rtl"] .metric strong,
[dir="rtl"] .brand strong,
[dir="rtl"] .modal-title,
[dir="rtl"] .experience-card h3,
[dir="rtl"] .relive-card h3,
[dir="rtl"] .footer-title {
    font-family: "Cairo", Impact, sans-serif !important;
    font-weight: 700 !important;
}

/* Bebas Neue is a condensed face with a very short line height and negative tracking. Cairo
   is neither, so Arabic headings need their own leading or the descenders collide. These are
   the only two numbers in this file, and they exist because the script demands them. */
[dir="rtl"] .hero h1,
[dir="rtl"] .display {
    line-height: 1.1 !important;
    letter-spacing: 0 !important;
}

[dir="rtl"] .visual-content h3,
[dir="rtl"] .hero-card h3,
[dir="rtl"] .step h4,
[dir="rtl"] .experience-card h3,
[dir="rtl"] .relive-card h3,
[dir="rtl"] .footer-title,
[dir="rtl"] .modal-title,
[dir="rtl"] .metric strong,
[dir="rtl"] .brand strong,
[dir="rtl"] .final-cta h2 {
    line-height: 1.25 !important;
}

/* Arabic has no case, so `text-transform:uppercase` does nothing to it — except to the Latin
   words that appear inside Arabic copy, which it shouts. */
[dir="rtl"] .hero h1,
[dir="rtl"] .display,
[dir="rtl"] .modal-title,
[dir="rtl"] .hero-card h3,
[dir="rtl"] .visual-content h3,
[dir="rtl"] .feature h3,
[dir="rtl"] .step h4,
[dir="rtl"] .final-cta h2,
[dir="rtl"] .metric strong,
[dir="rtl"] .brand strong,
[dir="rtl"] .experience-card h3,
[dir="rtl"] .relive-card h3,
[dir="rtl"] .footer-title {
    text-transform: none;
}

/* The design tracks its small uppercase labels apart. Arabic letters join, and letter-spacing
   breaks the joins, so it is removed wherever Arabic actually appears. */
[dir="rtl"] .utility,
[dir="rtl"] .nav,
[dir="rtl"] .btn,
[dir="rtl"] .kicker,
[dir="rtl"] .section-no,
[dir="rtl"] .big-link,
[dir="rtl"] .metric span,
[dir="rtl"] .hero-card .label,
[dir="rtl"] .event-row small,
[dir="rtl"] .step b,
[dir="rtl"] .experience-row-title,
[dir="rtl"] .experience-card .card-label,
[dir="rtl"] .relive-year,
[dir="rtl"] .relive-link,
[dir="rtl"] .footer-kicker,
[dir="rtl"] .footer-detail,
[dir="rtl"] .footer-button,
[dir="rtl"] .footer a,
[dir="rtl"] .modal-count,
[dir="rtl"] .modal-label,
[dir="rtl"] .sector-list span,
[dir="rtl"] .modal-nav button,
[dir="rtl"] .ticker {
    letter-spacing: 0;
}

/* Arabic justifies too.
 *
 * This used to force `text-align: right`, on the reasoning that Arabic cannot hyphenate and
 * so has nothing to absorb the slack in a justified line. The owner asked for it justified,
 * and the reasoning had a hole in it: the rivers that prompted the rule were the COLUMN,
 * not the language. Arabic paragraphs were being justified into 217px on a phone, because an
 * unconditional rule in the design was overruling the design's own phone rule. At the full
 * width they behave, and measured they behave better than the English does -- Arabic words
 * are shorter, so there are more of them on a line to share the slack out between.
 *
 * `text-justify: inter-word` rather than the design's `inter-word` by inheritance, stated
 * here because Arabic is the one place it matters: the alternative browsers might pick is
 * inter-character, which stretches Arabic by pulling letters apart inside a word. */
[dir="rtl"] p,
[dir="rtl"] .step p,
[dir="rtl"] .modal-description {
    text-align: justify;
    text-justify: inter-word;

    /* The last line of a justified paragraph is not stretched -- it sits against one end.
     * The design says which end in PHYSICAL terms, `text-align-last: left`, which is the
     * start of the line in English and the WRONG end of it in Arabic: every Arabic
     * paragraph finished hard against the left margin with the gap on the right, where the
     * reader's eye starts. Measured on /about-us/, /exhibit/ and /visit/ -- ten paragraphs,
     * all ten of them at the left.
     *
     * This is the case the file's own note at the top is about: the handful of design rules
     * written physically are mirrored here by hand. */
    text-align-last: right;
}

/* ------------------------------------------------------------ direction */

/* Absolutely positioned decoration. The design pins each of these to the right edge; in
   Arabic they belong on the left. */
[dir="rtl"] .step i {
    right: auto;
    left: 22px;
}

[dir="rtl"] .visual-card:after {
    right: auto;
    left: 38px;
}

[dir="rtl"] .experience-card .card-icon,
[dir="rtl"] .experience-card:not(:first-child) .card-icon {
    right: auto;
    left: 26px;
}

[dir="rtl"] .modal-close {
    right: auto;
    left: 18px;
}

[dir="rtl"] .modal-top {
    padding: 34px 38px 30px 72px;
}

[dir="rtl"] .experience-card .card-label {
    padding-right: 0;
    padding-left: 58px;
}

/* Grid and flex borders that separate cells. `dir="rtl"` reverses the visual order of the
   columns but not which physical edge each rule drew, so the open edge moves to the wrong
   side without this. */
[dir="rtl"] .metric {
    border-right: 0;
    border-left: 1px solid rgba(255, 255, 255, .13);
}

[dir="rtl"] .metric:last-child {
    border-left: 0;
}

[dir="rtl"] .journey-grid {
    border-left: 0;
    border-right: 1px solid rgba(255, 255, 255, .2);
}

[dir="rtl"] .step {
    border-right: 0;
    border-left: 1px solid rgba(255, 255, 255, .2);
}

[dir="rtl"] .footer-main {
    border-left: 0;
    border-right: 1px solid rgba(255, 255, 255, .13);
    border-radius: 8px 8px 0 0;
}

[dir="rtl"] .footer-column {
    border-right: 0;
    border-left: 1px solid rgba(255, 255, 255, .13);
}

[dir="rtl"] .modal-nav button + button {
    border-left: 0;
    border-right: 1px solid #e1d9e7;
}

/* Motion. The ticker scrolls toward the reader in both directions; the hover nudges follow
   the reading direction too. */
[dir="rtl"] .ticker-track {
    animation-direction: reverse;
}

[dir="rtl"] .ticker span:after {
    margin-left: 0;
    margin-right: 38px;
}

[dir="rtl"] .step:hover p,
[dir="rtl"] .step:focus p {
    transform: translateX(-4px);
}

[dir="rtl"] .step:hover i,
[dir="rtl"] .step:focus i {
    transform: translate(-3px, -3px);
}

[dir="rtl"] .relive-card:hover .relive-link span {
    transform: translateX(-5px);
}

/* The arrow glyphs in the markup point the way the design drew them, which is the wrong way
   in Arabic. Flipping the glyph keeps one string in the database instead of two. */
[dir="rtl"] .big-link span,
[dir="rtl"] .relive-link span,
[dir="rtl"] .step i,
[dir="rtl"] .visual-card:after {
    display: inline-block;
    transform: scaleX(-1);
}

[dir="rtl"] .step:hover i,
[dir="rtl"] .step:focus i {
    transform: translate(-3px, -3px) scaleX(-1);
}

[dir="rtl"] .relive-card:hover .relive-link span {
    transform: translateX(-5px) scaleX(-1);
}

/* The hero's gradient runs dark-to-light from the left, so the text sits on the dark end.
   In Arabic the text moves to the right, and the gradient has to follow it. */
[dir="rtl"] .hero {
    background-position: center;
}

[dir="rtl"] .hero-grid {
    direction: rtl;
}
