/*
  rtl.css: the Arabic layer (lang="ar", dir="rtl") over the taste-skill kit and R3's page CSS.
  Linked last, after /assets/pages/site.css, on the ar locale only. No kit file is edited.
  Every rule repeats the kit selector it corrects with :root[dir="rtl"] in front, so it always weighs one
  attribute more than the rule it replaces.

  Already right under dir="rtl", so nothing here touches them: the 12-column grid (span-N, start-N and
  grid-column count from the inline start, so text on span-5 sits on the right and the picture on
  span-6 start-7 on the left), flex rows and their space-between / flex-end, margin-inline, the nav
  sheet's grid, the mega menu, the down chevrons (.chev, .nav__expand), the tab pill (motion.js measures
  offsetLeft, which is physical).
  Left physical on purpose: anything placed on a photograph or a drawing (.ly-spot, .ly-float,
  .drawing__dim, .hero--collage's window, .frame--lit's words), media controls (.loop-pause, the play
  disc), .stat__unit (a Latin or % unit stays right of its digits), and the UI fragments, which show
  left-to-right product UI: give their .stage dir="ltr".
*/

/* ---------------------------------------------------------------- Arabic type */
:root[dir="rtl"] {
  /* Schibsted Grotesk and IBM Plex Mono have no Arabic: Latin words and digits stay in them, Arabic
     letters fall through to IBM Plex Sans Arabic (loaded for ar only; next/font may set --font-ar) */
  --font-display: "Schibsted Grotesk", var(--font-ar, "IBM Plex Sans Arabic"), system-ui, sans-serif;
  --font-text: "Schibsted Grotesk", var(--font-ar, "IBM Plex Sans Arabic"), system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", var(--font-ar, "IBM Plex Sans Arabic"), ui-monospace, "SFMono-Regular", Menlo, monospace;
  /* a joined script: tracking pulls the joins apart (or overlaps them) */
  --display-tracking: 0;
  --display-tracking-xl: 0;
  /* 13px Arabic is too small to read; 14 is the scale's next step */
  --t-label: 14px;
  /* two Arabic weights are loaded (400, 500): never a faked bold or a slanted Arabic */
  font-synthesis: none;
}
/* emphasis tops out at 500, the heaviest Arabic weight loaded (zero weight: every kit rule still wins) */
:where(:root[dir="rtl"]) :where(strong, b) { font-weight: 500; }
:root[dir="rtl"] :is(h4, .t-card, .t-label, .card > h3, .card__title, .tile__head > h3, .tile__head > h4, .quote) { letter-spacing: 0; }

/* Arabic needs room above and below the line (tall alef and lam, hamza, dots and descenders under it):
   the kit's 1.02 to 1.16 display leading makes lines collide */
:root[dir="rtl"] body { line-height: 1.7; }
:root[dir="rtl"] :is(.t-lead, .t-body, .t-small, .section-head p, .hero .hero__lead, .card > p, .card__text, .stat__label, .result__cap) { line-height: 1.7; }
:root[dir="rtl"] :is(h1, .t-h1) { line-height: 1.3; }
:root[dir="rtl"] :is(h2, .t-h2) { line-height: 1.35; }
:root[dir="rtl"] :is(h3, .t-h3) { line-height: 1.4; }
:root[dir="rtl"] :is(h4, .t-card) { line-height: 1.45; }
:root[dir="rtl"] .hero h1 { line-height: 1.25; }
:root[dir="rtl"] :is(.hero--editorial, .hero--word, .hero--triptych) h1 { line-height: 1.2; }
:root[dir="rtl"] :is(.mo-wh__text, [data-moment="word-highlight"] > .container > p) { line-height: 1.45; }
:root[dir="rtl"] :is(.footer__lede, .quote, .quote blockquote) { line-height: 1.5; }
:root[dir="rtl"] .close__word { line-height: 1.2; letter-spacing: 0; }

/* ---------------------------------------------------------------- words start on the right line */
:root[dir="rtl"] :is(.section-head--center, .cta-type, .ly-play) { text-align: start; }
:root[dir="rtl"] .rows__value { text-align: end; }
:root[dir="rtl"] .visit__rows > li > :last-child { text-align: end; }
:root[dir="rtl"] .hero__facts--col dd { text-align: end; }
@media (max-width: 1023px) { :root[dir="rtl"] .hero__facts--col dd { text-align: start; } }
@media (max-width: 639px) { :root[dir="rtl"] .visit__rows > li > :last-child { text-align: start; } }

/* ---------------------------------------------------------------- arrows point the reading way
   scale (not transform) mirrors them, so the kit's own hover and focus nudge, translateX(3px), lands
   3px to the left with no further rule, and reduced motion (transform: none) keeps them mirrored */
:root[dir="rtl"] :is(.link, .btn--arrow)::after,
:root[dir="rtl"][data-buttons="pill"] .btn--primary::after,
:root[dir="rtl"][data-buttons="arrow"] :is(.btn--primary, .btn--secondary)::after,
:root[dir="rtl"] .m-arrow,
:root[dir="rtl"] .card__link svg { scale: -1 1; }
/* the glyph's -2px pull goes to the button's end, now its left */
:root[dir="rtl"][data-buttons="pill"] .btn--primary::after,
:root[dir="rtl"][data-buttons="arrow"] :is(.btn--primary, .btn--secondary)::after,
:root[dir="rtl"] .m-arrow { margin-right: 0; margin-left: -2px; }
/* a switch mirrors whole: the knob rests on the right and slides left when on */
:root[dir="rtl"] .m-switch { scale: -1 1; }

/* ---------------------------------------------------------------- underlines draw from the right
   motion.css grows the ink line from the start on hover and lets it leave toward the end */
:root[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%;
}
:root[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%;
}
:root[dir="rtl"] .nav__link::before { transform-origin: left; }
:root[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; }

/* ---------------------------------------------------------------- the header */
/* the logo lockup is a brand mark and is never mirrored: the R3 mark stays left of its name */
:root[dir="rtl"] :is(.nav__logo, .footer__mark) { direction: ltr; }
:root[dir="rtl"] .skip-link { left: auto; right: max(var(--gut), (100% - var(--container)) / 2); }
@media (max-width: 1023px) {
  /* the bar's main button and the menu button go to the left line, not next to the logo */
  :root[dir="rtl"] .nav__toggle { margin-left: 0; margin-right: auto; }
  :root[dir="rtl"] .nav:not(.is-open) .nav__actions { margin-left: 0; margin-right: auto; }
  :root[dir="rtl"] .nav:not(.is-open) .nav__actions + .nav__toggle { margin-right: 0; }
  /* the sheet: the page-you-are-on bar sits under the word's first letter, on the right */
  :root[dir="rtl"] .nav.is-open .nav__link[aria-current="page"]::after { left: auto; right: 0; }
}
@media (max-width: 639px) {
  :root[dir="rtl"]:has(> body > nav.actionbar) .nav:not(.is-open) .nav__toggle { margin-left: 0; margin-right: auto; }
}
@media (scripting: none) and (max-width: 1023px) {
  :root[dir="rtl"] .nav__links { margin-right: 0; padding-right: 0; border-right: 0; margin-left: var(--s-3); padding-left: var(--s-2); border-left: 1px solid var(--line); }
}
/* nav--split (not on R3's pages yet): its first word starts on the right line */
@media (min-width: 1024px) {
  :root[dir="rtl"] .nav--split .nav__links > .nav__item:nth-child(1 of .nav__item) > .nav__link { padding-left: var(--s-3); padding-right: 0; }
  :root[dir="rtl"] .nav--split .nav__links > .nav__item:nth-child(1 of .nav__item) > .nav__link::before,
  :root[dir="rtl"] .nav--split .nav__links > .nav__item:nth-child(1 of .nav__item) > .nav__link[aria-current="page"]::after { left: var(--s-3); right: 0; }
}
@media (min-width: 1024px) and (max-width: 1279px) {
  :root[dir="rtl"] .nav--split .nav__links > .nav__item:nth-child(1 of .nav__item) > .nav__link { padding-left: var(--s-2); }
  :root[dir="rtl"] .nav--split .nav__links > .nav__item:nth-child(1 of .nav__item) > .nav__link::before,
  :root[dir="rtl"] .nav--split .nav__links > .nav__item:nth-child(1 of .nav__item) > .nav__link[aria-current="page"]::after { left: var(--s-2); }
}

/* ---------------------------------------------------------------- one-sided margins, mirrored */
:root[dir="rtl"] .field__error::before { margin-right: 0; margin-left: var(--s-2); }
:root[dir="rtl"] .card--plan h3 .badge { margin-left: 0; margin-right: var(--s-2); }
:root[dir="rtl"] .footer__nav .socials { margin-left: 0; margin-right: auto; }
:root[dir="rtl"] .hours dt.is-today::after,
:root[dir="rtl"] [data-peek-to] .rows__name::after,
:root[dir="rtl"] .credits > summary::after { margin-left: 0; margin-right: var(--s-2); }
:root[dir="rtl"] .pl-photo--end > img,
:root[dir="rtl"] .pl-photo--end > picture > img { margin-left: 0; margin-right: auto; }
:root[dir="rtl"] .ic-stack > * { margin-left: 0; margin-right: -10px; }
:root[dir="rtl"] .ic-stack > :first-child { margin-right: 0; }
:root[dir="rtl"] .result { padding-left: 0; padding-right: 40px; border-left: 0; border-right: 1px solid var(--c-border); }
@media (max-width: 1023px) { :root[dir="rtl"] .result { padding-right: 0; border-right: 0; } }
/* the photo credits line says "Credits" and "Hide" in CSS (system.css): words for a native speaker to set
:root[dir="rtl"] .credits > summary::after { content: "..."; }
:root[dir="rtl"] .credits[open] > summary::after { content: "..."; }
*/

/* ---------------------------------------------------------------- a photograph keeps its calm side
   the same photograph runs in every language, so the words stay where it is calm (layout.css puts them
   at the inline start, which is the right under dir="rtl") */
@media (min-width: 1024px) {
  :root[dir="rtl"] .hero--photo:not([data-calm="right"]) .hero__text { margin-right: auto; }
}

/* ---------------------------------------------------------------- the hero's entrance
   motion.js sets each h1 word in a clipping mask the line's height; Arabic marks rise above it */
:root[dir="rtl"] .hero[data-enter] .m-w { padding-top: .2em; margin-top: -.2em; }

/* ---------------------------------------------------------------- forms and contact details */
/* an address, an e-mail or a phone number is typed and read left to right, aligned to the right line
   (the +XXX placeholder keeps its plus in front) */
:root[dir="rtl"] .field :is(input[type="email"], input[type="tel"], input[type="url"], input[inputmode="url"], input[inputmode="email"], input[inputmode="tel"]) {
  direction: ltr; text-align: right;
}
/* a phone number in running text keeps its groups in order; inside a .link or a button, wrap the number
   in <bdi dir="ltr"> in the markup instead, so the arrow stays at the reading end */
:root[dir="rtl"] a[href^="tel:"]:not(.btn, .link) { direction: ltr; unicode-bidi: isolate; }

/* ---------------------------------------------------------------- R3 ortak CSS (site.css)
   better still: write these with logical properties in site.css (padding-inline-start, inset-inline-start,
   border-start-start-radius ...) and drop this block */
:root[dir="rtl"] .mono-label { font-size: var(--t-small); line-height: 1.6; }
/* the threshold bar runs from the right (good) to the left (poor); its rounded ends follow */
:root[dir="rtl"] .mplan__bar > span:first-child { border-radius: 0 999px 999px 0; }
:root[dir="rtl"] .mplan__bar > span:last-child { border-radius: 999px 0 0 999px; }
/* the request path's line runs through the icons, now on the right of each row */
:root[dir="rtl"] .layers::before { left: auto; right: 25px; }
:root[dir="rtl"] .layers__row { padding-left: var(--s-4); padding-right: var(--s-3); }
:root[dir="rtl"] .layers__icons { padding-left: 0; padding-right: 2px; }

/* ---------------------------------------------------------------- R3 kabuğu (KitNav, KitFooter) */
:root[dir="rtl"] .nav__link[aria-current="true"]::after { left: var(--s-3); right: var(--s-3); }
@media (max-width: 1023px) { :root[dir="rtl"] .nav.is-open .nav__link[aria-current="true"]::after { left: auto; right: 0; } }
/* gezinme yolunun ayracı Arapçada da "/" kalır (site.css): aynalanmış hali ters bölü gibi okunuyordu */

/* ---------------------------------------------------------------- pinned-chapters (moment.css)
   the moment puts each step's line on the physical left (padding-left, border-left); on a right-to-left page
   the line and the live accent sit on the right, where the step's words start. From 640px the static rows
   keep the kit's top hairline. (The same as hakkimizda.css does for its own #calisma, for every page.) */
:root[dir="rtl"] [data-moment="pinned-chapters"] .mo-pc__step { padding-left: 0; padding-right: var(--s-5); border-left: 0; border-right: 2px solid var(--line); }
:root[dir="rtl"] [data-moment="pinned-chapters"].is-live .mo-pc__step { border-left: 0; border-right-color: var(--line); }
:root[dir="rtl"] [data-moment="pinned-chapters"].is-live .mo-pc__step.is-on { border-right-color: var(--accent); }
@media (min-width: 640px) {
  :root[dir="rtl"] [data-moment="pinned-chapters"]:not(.is-live) .mo-pc__step { border-right: 0; padding: var(--s-6) 0 0; }
}
