/* fremian.com — two languages: the AR | EN switch, the Arabic type, and the right-to-left mirror.
   Everything for Arabic is scoped to [dir="rtl"], so the English pages render exactly as before. */

/* Arabic letters come from IBM Plex Sans Arabic under the name "Inter": every rule that asks for
   Inter gets Plex for Arabic and Inter for Latin, with no font overrides anywhere else. */
@font-face { font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Inter"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }

/* ---------- the switch: a small segmented control, the teal thumb slides to the chosen side ---------- */
.nav-cta { margin-inline-start: auto; }
.lang {
  position: relative; flex: none; display: grid; grid-template-columns: 1fr 1fr; align-items: center;
  padding: 3px; border-radius: 999px; background: var(--ground-2);
  direction: ltr; isolation: isolate; -webkit-tap-highlight-color: transparent;
}
html .lang a {
  position: relative; z-index: 1; display: block; min-width: 34px; padding: 6px 0 5px; text-align: center;
  font: 600 11.5px/1 "Inter", system-ui, sans-serif; letter-spacing: .06em; text-decoration: none;
  color: var(--ink-soft); border-radius: 999px; transition: color .3s var(--ease);
}
.lang a::after { content: ""; position: absolute; inset: -9px -3px; } /* a thumb-sized tap target */
.lang a:hover { color: var(--ink); }
.lang a[aria-current] { color: #fff; }
.lang a:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 1px; }
.lang-thumb {
  position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px);
  border-radius: 999px; background: var(--accent);
  box-shadow: 0 1px 2px rgba(0,0,0,.14), 0 3px 10px -2px rgba(11,127,134,.45); /* taste-skill-ignore: the thumb lifts off its track */
  transition: transform .46s cubic-bezier(.32, 1.32, .42, 1);
}
.lang[data-on="en"] .lang-thumb { transform: translateX(100%); }
.lang a:active ~ .lang-thumb, .lang:active .lang-thumb { transition-duration: .5s; }

/* the hand-off: the page dims away while the thumb stays, then the other language fades in */
.lang-out :is(main, .foot, .subnav, .nav-cta, .wordmark, .skip, .wa-float) { opacity: 0; transition: opacity .24s ease; }
.lang-in :is(main, .foot, .subnav, .nav-cta, .wordmark) { animation: lang-in .5s ease both; }
@keyframes lang-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .lang-thumb { transition: none; }
  .lang-out :is(main, .foot, .subnav, .nav-cta, .wordmark, .skip, .wa-float) { transition-duration: .05s; }
  .lang-in :is(main, .foot, .subnav, .nav-cta, .wordmark) { animation: none; }
}
.nav-cta { display: inline-block; white-space: nowrap; }
@media (max-width: 400px) { .nav .wrap { gap: 12px; } .nav-cta.btn.small { padding-inline: 14px; } }
@media (max-width: 345px) { .cta-more { display: none; } }

/* ---------- WhatsApp: a floating button in the reading-end corner ---------- */
.wa-float {
  position: fixed; z-index: 40; inset-inline-end: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center; background: #25d366; color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.14), 0 10px 28px -6px rgba(0,0,0,.3); /* taste-skill-ignore: the button floats over the page */
  transition: transform .25s var(--ease), box-shadow .25s; -webkit-tap-highlight-color: transparent;
}
[dir="rtl"] .wa-float { inset-inline-end: max(20px, env(safe-area-inset-left)); }
.wa-float svg { width: 30px; height: 30px; fill: currentColor; }
.wa-float:hover { transform: translateY(-2px) scale(1.05); }
.wa-float:active { transform: scale(.94); }
.wa-float:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 3px; border-radius: 50%; }
.js .wa-float { animation: wa-in .6s var(--ease) .9s both; }
@keyframes wa-in { from { opacity: 0; transform: translateY(16px) scale(.9); } }
@media (max-width: 720px) { .wa-float { width: 52px; height: 52px; } .wa-float svg { width: 28px; height: 28px; } }
@media (prefers-reduced-motion: reduce) { .js .wa-float { animation: none; } .wa-float, .wa-float:hover { transition: none; transform: none; } }

/* ---------- Arabic type ---------- */
[dir="rtl"] body { line-height: 1.75; }
[dir="rtl"] :is(h1, h2, h3, p, li, a, b, strong, span, figcaption, label, button, output) { letter-spacing: 0; }
[dir="rtl"] :is(h1, h2) { line-height: 1.22; font-weight: 600; }
[dir="rtl"] h3 { line-height: 1.45; }
[dir="rtl"] .wordmark, [dir="rtl"] .subnav .name { letter-spacing: -0.02em; }
[dir="rtl"] bdi, [dir="rtl"] .ltr { unicode-bidi: isolate; direction: ltr; }

/* ---------- shared: mirrored ---------- */
[dir="rtl"] .link-more::after { content: " ‹"; }  /* the arrow points the way Arabic reads */
[dir="rtl"] .skip { left: auto; right: -9999px; }   /* off-screen on the side that never scrolls in RTL */
[dir="rtl"] .skip:focus { right: 8px; }
[dir="rtl"] .subnav .name { margin-right: 0; margin-left: auto; }
[dir="rtl"] [data-ui] { direction: ltr; }  /* app and Mac windows keep their own layout */
[dir="rtl"] [data-ui] [dir="rtl"] { direction: rtl; }

/* ---------- home ---------- */
[dir="rtl"] .tile-pic img { border-radius: 0 12px 0 0; }
[dir="rtl"] .tile-pic { direction: rtl; }
[dir="rtl"] .app-tile:hover .tile-pic img { transform: translateX(1.5%); }
[dir="rtl"] .intro h1 { max-width: 10em; }
@media (max-width: 820px) { [dir="rtl"] .tile-pic { padding-left: 0; padding-right: 24px; } }

/* ---------- Kavirel ---------- */
/* the stage keeps its diagonal cut on the side facing the words; the Mac window inside stays left-to-right */
[dir="rtl"] .stage {
  margin-left: 0; margin-right: clamp(20px, 10vw, 200px); direction: ltr;
  clip-path: polygon(0 0, calc(100% - clamp(64px, 8vw, 140px)) 0, 100% clamp(64px, 8vw, 140px), 100% 100%, 0 100%);
}
@media (min-width: 1100px) {
  [dir="rtl"] .hero-text { padding-left: 0; padding-right: max(var(--margin), calc((100vw - var(--max)) / 2 + var(--margin))); }
  [dir="rtl"] .stage { margin: 0; }
}
@media (max-width: 720px) {
  [dir="rtl"] .stage { margin-right: 0; clip-path: polygon(0 0, calc(100% - 72px) 0, 100% 72px, 100% 100%, 0 100%); }
}
[dir="rtl"] .mod { margin-left: 0; margin-right: clamp(0px, 14vw, 240px); }
@media (max-width: 900px) { [dir="rtl"] .mod { margin-right: 0; } }
[dir="rtl"] .ho-arrow { transform: scaleX(-1); }
[dir="rtl"] .figma-steps { padding-left: 0; padding-right: 22px; }
[dir="rtl"] .figma-steps li { padding-left: 0; padding-right: 6px; }
[dir="rtl"] .al-props { direction: rtl; }
[dir="rtl"] .install-track input { background-position: 100% 0; }
[dir="rtl"] .step-names li:nth-child(2) { transform: translateX(16%); }
[dir="rtl"] .step-names li:nth-child(3) { transform: translateX(-16%); }
[dir="rtl"] .step-names li:last-child { text-align: left; }
@media (max-width: 720px) { [dir="rtl"] .step-names li { text-align: right !important; } }

/* Fremian mark beside the wordmark (2026-11-25). The lockup stays icon-then-name in both languages. */
.wordmark { display: inline-flex; align-items: center; gap: 9px; direction: ltr; }
.wordmark .mark { width: 28px; height: 28px; flex: none; }
.mark-tile { fill: #111517; }
.mark-f { fill: #fff; }
.mark-dot { fill: #4cc3c9; }
html[data-theme="dark"] .mark-tile { fill: #0b7f86; }
html[data-theme="dark"] .mark-dot { fill: #c9f3f4; }
