/* ==========================================================================
   Arabic pages (right-to-left). Loaded after main.css only when is_rtl()
   (inc/multilingual.php). Most styles already use logical properties
   (margin-inline-start, inset-inline-end...), which flip on their own;
   this file fixes the rest.

   Contents
     1. Arabic font and text
     2. Arrows and slide-in movements
     3. Panels and borders
     4. Discovery Search
   ========================================================================== */


/* 1. Arabic font and text
   ========================================================================== */

:root {
    --font: "IBM Plex Sans Arabic", "IBM Plex Sans", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
}
body { line-height: 1.75; }
h1, h2, h3, h4, .page-hero__title, .discovery__title { letter-spacing: 0; }
/* Latin words inside Arabic text (database names, e-mail addresses) keep their own direction */
a[href^="mailto:"], a[href^="tel:"], .footer-contacts dd { direction: ltr; unicode-bidi: isolate; }
/* English phone numbers and codes in tables stay left-to-right */
.entry-content td { unicode-bidi: plaintext; }


/* 2. Arrows and slide-in movements
   ========================================================================== */

/* "Forward" arrows point left in Arabic */
.icon--arrow { transform: scaleX(-1); }
.icon--trending { transform: scaleX(-1); } /* the rising line goes up towards the left */
.icon--back { transform: none; }

.help-option:hover .help-option__arrow:not(.icon--external),
.home-search__submit:hover .icon,
.home-search__advanced:hover .icon,
.contact-links a:hover .icon,
.ml-search:hover .icon { transform: scaleX(-1) translateX(3px); }
.trial-card:hover .trial-card__action .icon,
.news-card:hover .news-card__more .icon,
.service-link:hover .service-link__arrow { transform: scaleX(-1) translateX(4px); }
.home-search__submit .icon:not(.icon--arrow),
.home-search__submit:hover .icon:not(.icon--arrow),
.contact-links a:hover .icon:not(.icon--arrow),
.ml-search:hover .icon:not(.icon--arrow) { transform: none; }
.resource-tile__name .icon { transform: scaleX(-1) translateX(-4px); }
.resource-tile:hover .resource-tile__name .icon,
.resource-tile:focus-visible .resource-tile__name .icon { transform: scaleX(-1); }

/* Help panel slides in from the left (it sits on the left side in Arabic) */
.help-panel { transform: translateX(-100%); box-shadow: 12px 0 40px rgba(5, 25, 43, .2); }
.help-panel.is-open { transform: none; }
.help-tab { border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
.help-tab span { writing-mode: vertical-rl; transform: none; }


/* 3. Panels and borders
   ========================================================================== */

.entry-content .alignleft { float: right; margin: 0 0 1rem 1.5rem; }
.entry-content .alignright { float: left; margin: 0 1.5rem 1rem 0; }
.staff__lead { border-left: 1px solid var(--c-line); border-right: 4px solid var(--c-brand); }
.entry-content .hours__table th, .entry-content .hours__table td { text-align: right; }
.gform_wrapper select { background-position: left .8rem center; }
.gform_wrapper input[type="email"], .gform_wrapper input[type="tel"], .gform_wrapper input[type="url"] { direction: ltr; text-align: right; }


/* 4. Discovery Search
   ========================================================================== */

/* Moving bar while searching runs from right to left */
.search-progress::before { left: auto; right: -40%; animation-name: gl-progress-rtl; }
@keyframes gl-progress-rtl {
    from { right: -40%; }
    to { right: 100%; }
}
/* Details panel slides in from the left */
.record-panel { transform: translateX(-100%); box-shadow: 12px 0 40px rgba(5, 25, 43, .2); }
.record-panel.is-open { transform: none; }
.record-panel__title, .record-panel__abstract p, .record-panel__fields dd { unicode-bidi: plaintext; text-align: start; }
/* Filters panel on small screens slides in from the right */
@media (max-width: 900px) {
    .filters { transform: translateX(105%); }
    .filters-open .filters { transform: none; }
}
/* Titles, authors and abstracts can be English or Arabic: each line takes the direction of its own text */
.result__title, .result__title-button, .result__authors, .result__source, .result__abstract, .result__full-abstract,
.result__fields dd, .cite-dialog__output, .dsearch__input {
    unicode-bidi: plaintext;
    text-align: start;
}
