/*
  Right-to-left pages (html[dir="rtl"], Arabic). Grid and flex rows already flip with the document direction, so
  this file only turns round what the kit and the site set with physical left and right: the bar's lines and
  underlines, arrows and chevrons, text alignment, the footer and FAQ rules, the cookie banner, the header menus
  and the knowledge-base search. Pictures never mirror: the logo, Parktelligence's own screens, photographs, video,
  diagrams and licence plates keep their left-to-right drawing (they are pictures of things, not text).
*/

/* ---------------------------------------------------------------- pictures stay as drawn */
[dir="rtl"] :is(.ui, .pt-app, .pt-piece, .pt-stack, .stage, .ly-collage, .hero__art, .hero__window, .dg, .pt-plate, .pc-plate, .nav__logo, .footer__mark, .pt-consent__logo) {
  direction: ltr;
}
/* a screen's own text inside a card still reads in the page's order around it */
[dir="rtl"] :is(.card, .menu-card) > :is(h3, p, .t-card, .t-small, .card__link) { direction: rtl; }

/* ---------------------------------------------------------------- arrows and chevrons point the reading way */
[dir="rtl"] :is(.m-arrow, .chev) { transform: scaleX(-1); }
[dir="rtl"] .m-arrow { margin-right: 0; margin-left: -2px; }
[dir="rtl"] :is(.btn--primary, .btn--secondary)::after { margin-right: 0; margin-left: -2px; transform: scaleX(-1); }
@media (hover: hover) and (pointer: fine) {
  [dir="rtl"]:is([data-buttons="pill"], [data-buttons="arrow"]) .btn:hover::after { transform: scaleX(-1) translateX(3px); }
}
[dir="rtl"] :is(a, button):is(:hover, :focus-visible) > .m-arrow .m-arrow__head { transform: translateX(3px); }

/* ---------------------------------------------------------------- the bar */
[dir="rtl"] .skip-link { left: auto; right: max(var(--gut), (100% - var(--container)) / 2); }
[dir="rtl"] .nav__link::before { transform-origin: left; }
[dir="rtl"] :is(.nav__link:hover, .nav__link:focus-visible, .nav__item:hover > .nav__link, .nav__item:focus-within > .nav__link)::before { transform-origin: right; }
@media (max-width: 1023px) {
  [dir="rtl"] .nav__toggle { margin-left: 0; margin-right: auto; }
  [dir="rtl"] .nav:not(.is-open) .nav__actions { margin-left: 0; margin-right: auto; }
  [dir="rtl"] .nav:not(.is-open) .nav__actions + .nav__toggle { margin-right: 0; }
  [dir="rtl"] .nav.is-open .nav__link[aria-current="page"]::after { left: auto; right: 0; }
}
[dir="rtl"] .menu-col a, [dir="rtl"] .menu-card { text-align: right; }

/* ---------------------------------------------------------------- links draw from the reading start */
[dir="rtl"]:not([data-motion="off"]) :is(.link, .m-link, p a:not([class]), .footer ul a, .footer .link) {
  background-position: left 0 bottom 0, 100% 100%;
}
[dir="rtl"]:not([data-motion="off"]) :is(.link, .m-link, p a:not([class]), .footer ul a, .footer .link):is(:hover, :focus-visible) {
  background-position: right 0 bottom 0, 100% 100%;
}

/* ---------------------------------------------------------------- text and rules */
[dir="rtl"] :is(.section-head--center, .faq, .rows, .footer, .pt-doc, .pt-list) { text-align: right; }
[dir="rtl"] .rows__value { text-align: left; }
[dir="rtl"] .rows--spec .rows__name, [dir="rtl"] .rows__name { text-align: right; }
[dir="rtl"] .footer__mark .mark, [dir="rtl"] .footer .nav__logo .mark { margin-right: 0; margin-left: 0.18em; }
[dir="rtl"] .frame--lit > .frame__text { margin-right: 0; margin-left: auto; }
[dir="rtl"] .loop-pause { right: auto; left: 12px; }
[dir="rtl"] .ly-float { left: auto; right: var(--s-5); }
[dir="rtl"] .pt-prose :is(ul, ol) { padding-left: 0; padding-right: 1.3em; }
[dir="rtl"] .pt-prose blockquote, [dir="rtl"] .pt-note { border-left: 0; padding-left: 0; border-right: 2px solid var(--action); padding-right: var(--s-5); }
[dir="rtl"] .pt-note { border-right-color: var(--line-strong); padding-right: var(--s-4); }
[dir="rtl"] .pt-prose :is(th, td) { text-align: right; }
[dir="rtl"] .pt-prose :is(pre, code) { direction: ltr; text-align: left; }
[dir="rtl"] .pt-facts, [dir="rtl"] .pt-crumbs, [dir="rtl"] .pt-aside { text-align: right; }

/* ---------------------------------------------------------------- the cookie banner and its dialog */
[dir="rtl"] .pt-consent { left: auto; right: max(var(--gut), calc((100vw - var(--container)) / 2)); }
@media (max-width: 639px) { [dir="rtl"] .pt-consent { right: 0; left: 0; } }
[dir="rtl"] .pt-legal__btn { text-align: right; }
[dir="rtl"] .pt-consent-dialog__head { padding-right: 0; padding-left: var(--s-8); }
[dir="rtl"] .pt-consent-dialog__close { right: auto; left: var(--s-4); }
[dir="rtl"] .pt-consent-cat__services { padding-left: 0; padding-right: 1.2em; }
/* the switch keeps its knob's travel: off on the reading start, on at the end */
[dir="rtl"] .pt-switch::before { left: auto; right: 3px; }
[dir="rtl"] .pt-switch:checked::before { transform: translateX(-20px); }

/* ---------------------------------------------------------------- the header menus */
[dir="rtl"] .pt-ctl__menu { right: auto; left: 0; }
[dir="rtl"] .pt-ctl__item { text-align: right; }
@media (max-width: 1023px) {
  [dir="rtl"] .nav.is-open .pt-ctl__menu { left: 50%; right: auto; transform: translateX(-50%); }
}

/* ---------------------------------------------------------------- the knowledge base search */
[dir="rtl"] .pt-kb__field { padding: 0 var(--s-4) 0 var(--s-2); }
[dir="rtl"] .pt-kb input[type="search"] { text-align: right; }
