/*
 * Persian site-wide RTL — Nilades Catalogue Repair
 *
 * Every selector is prefixed with `body.ncr-fa-site`, a class added only when
 * WPML reports Persian. English pages match nothing here.
 *
 * Two things this file deliberately does not do:
 *   - It never mirrors a container with `transform: scaleX(-1)`, so photographs,
 *     tile renders and logos are never flipped.
 *   - It does not touch sliders' internal transforms. Swiper and Owl position
 *     slides with inline `translate3d` in pixels; changing direction underneath
 *     them makes slides jump. Their track is pinned to LTR and only the text
 *     inside each slide is flipped.
 */

/* ===========================================================================
   1. Document flow
   ======================================================================== */

body.ncr-fa-site {
  direction: rtl !important;
  text-align: right !important;
}

body.ncr-fa-site main,
body.ncr-fa-site section,
body.ncr-fa-site article,
body.ncr-fa-site aside,
body.ncr-fa-site header,
body.ncr-fa-site footer,
body.ncr-fa-site .container,
body.ncr-fa-site .container-fluid,
body.ncr-fa-site .row,
body.ncr-fa-site .site-content,
body.ncr-fa-site .entry-content,
body.ncr-fa-site .footer-content,
body.ncr-fa-site .elementor,
body.ncr-fa-site .elementor-section,
body.ncr-fa-site .elementor-container,
body.ncr-fa-site .elementor-column,
body.ncr-fa-site .elementor-widget-container {
  direction: rtl !important;
  text-align: right !important;
}

body.ncr-fa-site h1,
body.ncr-fa-site h2,
body.ncr-fa-site h3,
body.ncr-fa-site h4,
body.ncr-fa-site h5,
body.ncr-fa-site h6,
body.ncr-fa-site p,
body.ncr-fa-site li,
body.ncr-fa-site dd,
body.ncr-fa-site dt,
body.ncr-fa-site blockquote,
body.ncr-fa-site figcaption,
body.ncr-fa-site label,
body.ncr-fa-site th,
body.ncr-fa-site td {
  direction: rtl !important;
  text-align: right !important;
}

/* Persian has no capital letters, so tracking meant for Latin small-caps only
   pulls the letterforms apart. */
body.ncr-fa-site h1,
body.ncr-fa-site h2,
body.ncr-fa-site h3,
body.ncr-fa-site h4,
body.ncr-fa-site h5,
body.ncr-fa-site h6,
body.ncr-fa-site .subtitle,
body.ncr-fa-site .sub-title,
body.ncr-fa-site .section-subtitle,
body.ncr-fa-site .small-title {
  letter-spacing: 0 !important;
}

/* Persian needs more leading than Latin at the same size. */
body.ncr-fa-site p,
body.ncr-fa-site li {
  line-height: 2 !important;
}

/* ===========================================================================
   2. Navigation
   ======================================================================== */

body.ncr-fa-site .navbar,
body.ncr-fa-site .navbar-nav,
body.ncr-fa-site .main-menu,
body.ncr-fa-site .menu,
body.ncr-fa-site .elementor-nav-menu,
body.ncr-fa-site .elementor-nav-menu--dropdown {
  direction: rtl !important;
  text-align: right !important;
}

body.ncr-fa-site .navbar-nav,
body.ncr-fa-site ul.menu,
body.ncr-fa-site .elementor-nav-menu {
  flex-direction: row !important;
}

/* Submenus open toward the start of the line, which is now the right. */
body.ncr-fa-site .navbar-nav .dropdown-menu,
body.ncr-fa-site .menu .sub-menu,
body.ncr-fa-site .elementor-nav-menu .sub-menu {
  right: 0 !important;
  left: auto !important;
  text-align: right !important;
}

body.ncr-fa-site .navbar-brand,
body.ncr-fa-site .site-logo {
  margin-right: 0 !important;
  margin-left: auto !important;
}

/* ===========================================================================
   3. Lists and directional spacing
   ======================================================================== */

body.ncr-fa-site ul,
body.ncr-fa-site ol {
  padding-right: 1.2em;
  padding-left: 0;
}

body.ncr-fa-site .elementor-icon-list-item {
  flex-direction: row !important;
  text-align: right !important;
}

body.ncr-fa-site .elementor-icon-list-icon {
  margin-left: 8px;
  margin-right: 0;
}

/* Anything that leans on a left border as a decorative rule leans right. */
body.ncr-fa-site blockquote {
  border-left: 0 !important;
  border-right: 3px solid currentColor;
  padding-left: 0;
  padding-right: 18px;
}

/* ===========================================================================
   4. Forms
   ======================================================================== */

body.ncr-fa-site input,
body.ncr-fa-site textarea,
body.ncr-fa-site select,
body.ncr-fa-site option,
body.ncr-fa-site button,
body.ncr-fa-site .wpcf7-form,
body.ncr-fa-site .wpcf7-form-control {
  direction: rtl !important;
  text-align: right !important;
}

/* Email, telephone and URL fields hold Latin data and read wrong when forced. */
body.ncr-fa-site input[type="email"],
body.ncr-fa-site input[type="tel"],
body.ncr-fa-site input[type="url"],
body.ncr-fa-site input[type="number"] {
  direction: ltr !important;
  text-align: right !important;
}

/* ===========================================================================
   5. Things that must stay left to right
   ======================================================================== */

/* Icon glyphs are positioned, not read. */
body.ncr-fa-site .social-icon,
body.ncr-fa-site .social-icons a,
body.ncr-fa-site .elementor-social-icon,
body.ncr-fa-site .footer-social-link,
body.ncr-fa-site .footer-social-link li,
body.ncr-fa-site .footer-social-link li > a {
  direction: ltr !important;
  text-align: center !important;
}

/* Slider tracks are positioned with inline pixel transforms; flipping the
   container underneath them makes slides land in the wrong place. */
body.ncr-fa-site .swiper-wrapper,
body.ncr-fa-site .swiper-container,
body.ncr-fa-site .owl-stage,
body.ncr-fa-site .owl-stage-outer,
body.ncr-fa-site .elementor-slides,
body.ncr-fa-site .elementor-image-carousel {
  direction: ltr !important;
}

/* …but the copy inside each slide still reads right to left. */
body.ncr-fa-site .swiper-slide,
body.ncr-fa-site .owl-item,
body.ncr-fa-site .elementor-slide-contents {
  direction: rtl !important;
  text-align: right !important;
}

/* Latin data keeps its own run order inside Persian sentences. */
body.ncr-fa-site code,
body.ncr-fa-site kbd,
body.ncr-fa-site pre,
body.ncr-fa-site samp,
body.ncr-fa-site .price,
body.ncr-fa-site .amount,
body.ncr-fa-site time,
body.ncr-fa-site [dir="ltr"] {
  direction: ltr !important;
  unicode-bidi: isolate;
  text-align: right;
}

/* Media is never mirrored. */
body.ncr-fa-site img,
body.ncr-fa-site svg:not(.ncr-flip),
body.ncr-fa-site video,
body.ncr-fa-site iframe {
  transform: none;
}

/* ===========================================================================
   6. Back-to-top and floating controls move to the reading-start corner
   ======================================================================== */

body.ncr-fa-site .totop,
body.ncr-fa-site .back-to-top,
body.ncr-fa-site .scroll-top {
  right: auto !important;
  left: 30px !important;
}

/* ===========================================================================
   7. Project filters stay centred in both languages
   ======================================================================== */

body.ncr-fa-site ul.arcprime-project-filter {
  direction: rtl !important;
  justify-content: center !important;
  text-align: center !important;
}

/* ===========================================================================
   8. Persian header spacing
   The English menu leans on the theme's own left-side rhythm. In RTL that
   spacing lands on the wrong side and the items crowd together, so it is
   restated as a logical property: `margin-inline-end` is the right in RTL and
   the left in LTR, which keeps one rule correct in both.
   ======================================================================== */

body.ncr-fa-site .navbar-nav > li > .nav-link,
body.ncr-fa-site .navbar-nav .menu-item > .nav-link,
body.ncr-fa-site .main-menu > li > a,
body.ncr-fa-site .elementor-nav-menu > li > .elementor-item {
  margin-inline-end: 20px !important;
  margin-inline-start: 0 !important;
  padding-inline-end: 0;
}

body.ncr-fa-site .navbar-nav > li:last-child > .nav-link,
body.ncr-fa-site .main-menu > li:last-child > a {
  margin-inline-end: 0 !important;
}

/* ===========================================================================
   9. Single product, Persian
   ======================================================================== */

/* Highlight rows.
   Markup is <div><span>رنگ</span><strong>قهوه‌ای</strong></div> and must read
   "رنگ  قهوه‌ای" — label first at the right edge, value beside it — with every
   row starting at the same place and the whole block aligned to the text edge
   of the column, not floating in the middle of it. */
body.ncr-fa-site .aps-editorial-specs {
  direction: rtl !important;
  text-align: right !important;
  align-items: stretch !important;
  width: 100%;
  margin-inline-start: 0 !important;
  margin-inline-end: 0 !important;
}

body.ncr-fa-site .aps-editorial-specs > div {
  direction: rtl !important;
  flex-direction: row !important;
  justify-content: flex-start !important;
  text-align: right !important;
  width: 100%;
}

body.ncr-fa-site .aps-editorial-specs > div > span {
  order: 0 !important;
  text-align: right !important;
}

body.ncr-fa-site .aps-editorial-specs > div > strong {
  order: 1 !important;
  text-align: right !important;
  unicode-bidi: plaintext;
}

/* Section headings centred, as in the English layout. */
body.ncr-fa-site .aps-tabs,
body.ncr-fa-site .aps-description-heading,
body.ncr-fa-site .aps-description-heading h2,
body.ncr-fa-site .aps-description-lead,
body.ncr-fa-site .aps-modular-copy h2 {
  text-align: center !important;
}

body.ncr-fa-site .aps-tabs {
  flex-direction: row !important;
  justify-content: center !important;
}

/* Specification tables read right to left, with Latin values isolated. */
body.ncr-fa-site .aps-spec-table,
body.ncr-fa-site .aps-modular-table {
  direction: rtl !important;
  text-align: right !important;
}

body.ncr-fa-site .aps-spec-table b,
body.ncr-fa-site .aps-modular-table b,
body.ncr-fa-site .aps-format-shape span {
  unicode-bidi: plaintext;
}

/* Face captions follow the text direction; the images never flip. */
body.ncr-fa-site .aps-face span {
  direction: rtl !important;
  text-align: right !important;
}

body.ncr-fa-site .aps-face img {
  transform: none !important;
}

/* ===========================================================================
   10. Breadcrumb
   The markup order is Home / Products / Title. Left to right that puts Home
   first; on an RTL page the container must also be RTL, otherwise Home lands on
   the far left and the line reads "تنیا / محصولات / خانه" to a Persian reader.
   ======================================================================== */

body.ncr-fa-site .aps-breadcrumb,
body.ncr-fa-site nav.aps-breadcrumb,
body.ncr-fa-site .aps-shell.aps-breadcrumb {
  direction: rtl !important;
  flex-direction: row !important;
  justify-content: flex-start !important;
  text-align: right !important;
}

/* The "/" separators are bidi-neutral; isolating them stops the algorithm
   pulling them to the wrong side of an adjacent Latin word. */
body.ncr-fa-site .aps-breadcrumb > span {
  unicode-bidi: isolate;
}

body.ncr-fa-site .aps-breadcrumb > * {
  direction: rtl !important;
}

/* ===========================================================================
   11. Colour swatches, Persian
   Asked for explicitly: the row sits at the left in Persian and at the right in
   English. That is the opposite of each language's text edge, so it is stated
   here rather than left to a logical property, which would follow the text.
   ======================================================================== */

body.ncr-fa-site .ncr-swatch-row {
  /* `direction: ltr` first, so `flex-start` means the physical left whatever
     the surrounding text direction is. */
  direction: ltr !important;
  justify-content: flex-start !important;
  padding-inline: 0 2px;
}

body.ncr-fa-site .ncr-swatches {
  align-items: stretch;
}

body.ncr-fa-site .ncr-swatches-title {
  direction: rtl !important;
  text-align: right !important;
  letter-spacing: 0 !important;
  text-transform: none;
  align-self: stretch;
}

/* Description copy keeps the full width of its column in Persian too. */
body.ncr-fa-site .aps-description-layout > .aps-description-heading h2 {
  margin-inline: 0 !important;
  text-align: right !important;
}

body.ncr-fa-site .aps-single .aps-description-lead,
body.ncr-fa-site .aps-description-lead {
  text-align: right !important;
}
