/* ============================================================
   RTL — Arabic / Right-to-Left layout
   Mirrors padding, margins, text-align, float, flex-direction
   for [dir="rtl"] pages.
   ============================================================ */

/* ============================================================
   BASE OVERRIDES
   ============================================================ */

[dir="rtl"] body {
  font-family: 'Tajawal', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: 0; /* Arabic doesn't use letter-spacing */
  line-height: 1.7;
}

[dir="rtl"] body#yakeen-page h1,
[dir="rtl"] body#yakeen-page h2,
[dir="rtl"] body#yakeen-page h3,
[dir="rtl"] body#yakeen-page h4,
[dir="rtl"] body#yakeen-page h5,
[dir="rtl"] body#yakeen-page h6 {
  font-family: 'Tajawal', 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.25;
}

[dir="rtl"] em,
[dir="rtl"] i {
  font-style: normal;
  font-family: 'Tajawal', 'Inter', sans-serif;
}

[dir="rtl"] p,
[dir="rtl"] li,
[dir="rtl"] span {
  letter-spacing: 0;
  line-height: 1.8;
}

/* Micro-labels: Arabic is a connected script — uppercase and tracking break
   the joins, so both must be neutralised on every RTL micro-label.
   The matchers use naming-convention substrings (eyebrow / -label / -tag)
   instead of an enumerated list of classes, so a newly added label variant
   can never slip through again. `!important` is required: scoped page rules
   such as `body#yakeen-page .home-hero-eyebrow` (1,1,1) or
   `.gcc-country-page .knowledge-tag` (0,2,0) otherwise outrank these resets
   and silently re-apply tracking. */
[dir="rtl"] [class*="eyebrow"],
[dir="rtl"] [class*="-label"],
[dir="rtl"] [class*="-tag"] {
  font-family: var(--font-arabic) !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

/* ============================================================
   CONTRAST BOOST — Arabic text is more detailed, needs higher contrast
   (Principle 2.4: 对比度是底线)
   ============================================================ */

/* Dark backgrounds — raise opacity for better legibility */
[dir="rtl"] .hero-subtitle,
[dir="rtl"] .home-cta-desc {
  color: rgba(255, 255, 255, 0.92) !important;
}

/* Small eyebrow / label text on dark — use brighter gold */
[dir="rtl"] .home-cta-left .home-section-label {
  color: #F0D68A !important;
}
/* Gold text on dark — slow shimmer for Arabic, no white flash */
[dir="rtl"] .home-cta-title {
  background: linear-gradient(
    135deg,
    var(--color-gold-pale) 0%,
    var(--color-gold-light) 25%,
    var(--color-gold-bright) 50%,
    var(--color-gold-light) 75%,
    var(--color-gold-pale) 100%
  ) !important;
  background-size: 200% auto !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  animation: cta-title-shimmer 16s ease-in-out infinite !important;
}

/* Tertiary/muted text — boost contrast for Arabic detail */
[dir="rtl"] .stat-label,
[dir="rtl"] .journal-meta {
  color: var(--color-text-secondary) !important;
}

/* Form placeholder — lighter but still readable */
[dir="rtl"] .form-input::placeholder,
[dir="rtl"] .form-textarea::placeholder {
  color: rgba(61, 58, 51, 0.6) !important;
  opacity: 1;
}

/* Hero title — ensure minimum weight */
[dir="rtl"] .hero-title {
  font-weight: 800 !important;
}

/* Nav links on transparent nav — slightly bolder for readability */
body#yakeen-page[dir="rtl"] .nav--transparent .nav-link {
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ============================================================
   NAVIGATION
   ============================================================ */

[dir="rtl"] .nav-inner {
  flex-direction: row-reverse;
}

[dir="rtl"] .nav-links {
  flex-direction: row-reverse;
}

[dir="rtl"] .nav-logo {
  flex-direction: row;
}

[dir="rtl"] .nav-dropdown-menu {
  left: auto;
  right: 50%;
  transform: translateX(50%) translateY(8px);
  text-align: right;
}

[dir="rtl"] .nav-dropdown:hover .nav-dropdown-menu,
[dir="rtl"] .nav-dropdown.is-open .nav-dropdown-menu {
  transform: translateX(50%) translateY(0);
}

[dir="rtl"] .nav-dropdown-item {
  text-align: right;
}

[dir="rtl"] .nav-dropdown-item--featured::before {
  left: auto;
  right: 0;
}

/* ============================================================
   MOBILE MENU (RTL)
   ============================================================ */

[dir="rtl"] .mobile-menu {
  right: auto;
  left: 0;
  transform: translateX(-100%);
}

[dir="rtl"] .mobile-menu.is-open {
  transform: translateX(0);
}

[dir="rtl"] .mobile-close {
  right: auto;
  left: 20px;
}

[dir="rtl"] .mobile-link,
[dir="rtl"] .mobile-group-label {
  text-align: right;
}

/* ============================================================
   HERO
   ============================================================ */

[dir="rtl"] .hero-content {
  text-align: right;
}

[dir="rtl"] .hero-actions {
  justify-content: flex-start;
}

/* ============================================================
   SECTION HEADERS
   ============================================================ */

[dir="rtl"] .eyebrow {
  text-align: right;
}

[dir="rtl"] .section-title {
  text-align: right;
}

[dir="rtl"] .section-header {
  text-align: right;
}

[dir="rtl"] .section-header.center {
  text-align: center;
}

/* ============================================================
   SPLIT SECTIONS — swap visual and content sides
   ============================================================ */

[dir="rtl"] .split-section {
  flex-direction: row-reverse;
}

[dir="rtl"] .split-content {
  text-align: right;
}

/* ============================================================
   BUTTONS — flip arrow direction
   ============================================================ */

[dir="rtl"] .btn span {
  transform: scaleX(-1);
  display: inline-block;
}

/* ============================================================
   FEATURE LIST — mirror checkmarks
   ============================================================ */

[dir="rtl"] .feature-list {
  text-align: right;
}

[dir="rtl"] .feature-check {
  margin-left: 12px;
  margin-right: 0;
}

/* ============================================================
   CARDS & GRIDS
   ============================================================ */

[dir="rtl"] .value-card,
[dir="rtl"] .product-card,
[dir="rtl"] .project-card,
[dir="rtl"] .journal-card,
[dir="rtl"] .wgcc-card,
[dir="rtl"] .philosophy-item,
[dir="rtl"] .team-member,
[dir="rtl"] .cert-card,
[dir="rtl"] .process-step {
  text-align: right;
}

/* Cap card — flip golden accent bar */
[dir="rtl"] .cap-card::before,
[dir="rtl"] .app-card::before,
[dir="rtl"] .resource-link-item::before {
  left: auto;
  right: 24px;
}

[dir="rtl"] .cap-card:hover .cap-link {
  transform: translateX(-4px);
}

/* Philosophy number — flip from right to left */
[dir="rtl"] .philosophy-number {
  right: auto;
  left: 0;
}

/* Project index / tag position */
[dir="rtl"] .project-index {
  left: auto;
  right: 16px;
}

[dir="rtl"] .project-category,
[dir="rtl"] .project-title,
[dir="rtl"] .project-location,
[dir="rtl"] .project-scope {
  text-align: right;
}

/* ============================================================
   PROCESS TIMELINE
   ============================================================ */

[dir="rtl"] .process-timeline {
  direction: rtl;
}

/* ============================================================
   STATS
   ============================================================ */

[dir="rtl"] .stat-number {
  text-align: right;
}

/* ============================================================
   FORMS
   ============================================================ */

[dir="rtl"] .form-label {
  text-align: right;
}

[dir="rtl"] .form-input,
[dir="rtl"] .form-select,
[dir="rtl"] .form-textarea {
  text-align: right;
  direction: rtl;
}

[dir="rtl"] .form-input::placeholder,
[dir="rtl"] .form-select::placeholder,
[dir="rtl"] .form-textarea::placeholder {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] select {
  text-align: right;
  direction: rtl;
}

/* The select arrow is painted at the physical right by cta.css. With RTL
   right-aligned text the chevron would sit against the first character, so
   mirror it to the leading (left) edge and swap the padding with it. */
[dir="rtl"] .form-select {
  background-position: left 16px center;
  padding-right: 16px;
  padding-left: 40px;
}

[dir="rtl"] .form-row {
  direction: rtl;
}

[dir="rtl"] .ar-form-title {
  text-align: right;
}

[dir="rtl"] .ar-form-input-rtl {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .ar-form-note {
  text-align: right;
}

[dir="rtl"] .ar-steps-item {
  text-align: right;
}

[dir="rtl"] .ar-steps-content {
  margin-right: 0;
  margin-left: 0;
}

[dir="rtl"] .ar-contact-item {
  text-align: right;
}

/* Uppercase is meaningless for Arabic script */
[dir="rtl"] .ar-contact-label {
  text-transform: none;
  letter-spacing: 0;
  font-family: 'Tajawal', sans-serif;
}

/* ============================================================
   ACCORDION
   ============================================================ */

[dir="rtl"] .accordion-header {
  text-align: right;
  flex-direction: row-reverse;
}

[dir="rtl"] .accordion-icon {
  margin-right: auto;
  margin-left: 0;
}

[dir="rtl"] .accordion-content {
  text-align: right;
}

/* ============================================================
   HOME HERO — RTL
   ============================================================ */

[dir="rtl"] body#yakeen-page .home-hero {
  text-align: right;
  justify-content: flex-end;
}

[dir="rtl"] body#yakeen-page .home-hero-inner {
  text-align: right;
  margin-left: 0;
  margin-right: auto;
}

[dir="rtl"] body#yakeen-page .home-hero-copy {
  text-align: right;
  margin-left: auto;
  margin-right: 0;
}

[dir="rtl"] .home-hero-overlay {
  background:
    linear-gradient(-110deg, rgba(18, 14, 10, 0.5) 0%, rgba(18, 14, 10, 0.35) 25%, rgba(18, 14, 10, 0.15) 50%, rgba(18, 14, 10, 0.05) 75%, rgba(18, 14, 10, 0) 100%),
    linear-gradient(180deg, rgba(18, 14, 10, 0.1) 0%, rgba(18, 14, 10, 0) 30%, rgba(18, 14, 10, 0.15) 80%, rgba(18, 14, 10, 0.4) 100%) !important;
}

[dir="rtl"] body#yakeen-page .home-hero::before {
  background: 
    radial-gradient(ellipse 50% 60% at 82% 50%, rgba(200, 160, 90, 0.18), transparent 65%),
    radial-gradient(ellipse 30% 40% at 30% 30%, rgba(180, 140, 70, 0.08), transparent 70%) !important;
}

/* Hero eyebrow with line decoration — RTL mirror.
   In RTL the text starts at the right edge, so the gold rule must sit on
   the right and the 40px offset must move with it; the previous value
   zeroed both paddings, which left the rule stranded at the far left,
   detached from the text. */
[dir="rtl"] .home-hero-eyebrow {
  padding-left: 0 !important;
  padding-right: 40px !important;
}

[dir="rtl"] .home-hero-eyebrow::before {
  left: auto !important;
  right: 0 !important;
}

/* ============================================================
   SECTION HEADINGS — RTL
   ============================================================ */

[dir="rtl"] .home-section-label {
  justify-content: flex-start;
  flex-direction: row-reverse;
}

[dir="rtl"] .glance-eyebrow {
  padding-left: 0 !important;
  padding-right: 40px !important;
}

[dir="rtl"] .glance-eyebrow::before {
  left: auto !important;
  right: 0 !important;
}

[dir="rtl"] .glance-header {
  text-align: right;
}

[dir="rtl"] .glance-card {
  padding-right: 0 !important;
  padding-left: 24px !important;
  text-align: right;
}

[dir="rtl"] .glance-card:nth-child(even) {
  padding-left: 0 !important;
  padding-right: 24px !important;
  border-right: 1px solid var(--color-border) !important;
  border-left: none !important;
}

/* ============================================================
   PRODUCTS BENTO — RTL
   ============================================================ */

[dir="rtl"] .products-bento .hp-card-content {
  text-align: right;
}

[dir="rtl"] .products-bento .hp-card-link {
  flex-direction: row-reverse;
}

[dir="rtl"] .products-bento .hp-card-link::after {
  content: '\2190';
}

[dir="rtl"] .products-bento .hp-card-link span {
  display: none;
}

/* ============================================================
   PROJECTS EDITORIAL — RTL
   ============================================================ */

[dir="rtl"] .projects-editorial.home-projects-grid {
  direction: rtl;
}

[dir="rtl"] .projects-editorial .hproj-card.featured-project .hproj-info {
  text-align: right;
}

[dir="rtl"] .projects-editorial .side-projects .hproj-info {
  text-align: right;
}

[dir="rtl"] .home-section-head {
  text-align: center;
}

/* Card headings are not micro-labels, so they are not covered by the
   eyebrow/-label/-tag matchers above and need their own reset. */
[dir="rtl"] .glance-card h3 {
  text-transform: none !important;
  letter-spacing: 0 !important;
}

/* ============================================================
   TEAM
   ============================================================ */

[dir="rtl"] .team-avatar {
  margin: 0 auto 16px auto;
}

[dir="rtl"] .team-member h3,
[dir="rtl"] .team-role,
[dir="rtl"] .team-member p {
  text-align: center;
}

/* ============================================================
   FOOTER
   ============================================================ */

[dir="rtl"] .footer-col {
  text-align: right;
}

[dir="rtl"] .footer-col ul {
  padding-right: 0;
}

[dir="rtl"] .footer-bottom {
  text-align: right;
}

/* ============================================================
   CTA SECTION
   ============================================================ */

[dir="rtl"] .cta-section {
  text-align: right;
}

[dir="rtl"] .cta-actions {
  justify-content: flex-start;
}

/* ============================================================
   ARTICLE / BLOG
   ============================================================ */

[dir="rtl"] .article-body {
  text-align: right;
}

[dir="rtl"] .article-body ul,
[dir="rtl"] .article-body ol {
  padding-right: 24px;
  padding-left: 0;
}

[dir="rtl"] .article-meta {
  text-align: right;
}

/* ============================================================
   JOURNAL PAGE
   ============================================================ */

[dir="rtl"] .journal-category {
  text-align: right;
}

[dir="rtl"] .journal-meta {
  text-align: right;
}

/* ============================================================
   PAGE HERO (sub-pages)
   ============================================================ */

[dir="rtl"] .page-hero-inner {
  text-align: right;
}

[dir="rtl"] .page-hero .hero-actions {
  justify-content: flex-start;
}

/* ============================================================
   HERO STATS BAR — RTL mirror (added 2026-10-21)
   EN: 4产品 | 100%终检 | 6市场 | 48h回复
   AR: 48h回复 | 6市场 | 100%终检 | 4产品  (right-to-left)
   ============================================================ */

[dir="rtl"] .hero-stats-bar {
  flex-direction: row-reverse;
}

[dir="rtl"] .hero-stats-bar .hero-stat-divider {
  /* divider order follows flex row-reverse automatically */
}

/* ============================================================
   MARQUEE — reverse scroll direction for RTL (added 2026-10-21)
   EN: scrolls left → right... no wait EN is translateX(0) to translateX(-50%)
   meaning it scrolls from right edge to left edge (seamless loop).
   For RTL we flip: from left edge to right edge (translateX(0) to translateX(50%)).
   ============================================================ */

[dir="rtl"] .marquee-track {
  animation-direction: reverse;
}

/* ============================================================
   SUBMIT BUTTON ARROW — flip to ← in RTL
   HTML wraps arrow in <span class="btn-arrow">&rarr;</span>.
   ============================================================ */

[dir="rtl"] .submit-btn .btn-arrow {
  transform: scaleX(-1);
  display: inline-block;
}

/* ============================================================
   HERO STAT NUMBERS — Arabic-Indic digits (added 2026-10-21)
   GCC countries use Arabic-Indic numerals (٠١٢٣٤٥٦٧٨٩) in local
   contexts, not Western digits (0123456789). The data-target JS
   writes Western digits into the span; flip them via CSS font.
   Actually simplest: override the span content with ::after
   and hide the original with color: transparent.
   ============================================================ */

/* Arabic-Indic numeral map: Western → Arabic-Indic
   0→٠, 1→١, 2→٢, 3→٣, 4→٤, 5→٥, 6→٦, 7→٧, 8→٨, 9→٩ */
[dir="rtl"] .hero-stats-bar .hero-stat__num[data-target="4"] {
  color: transparent;
}
[dir="rtl"] .hero-stats-bar .hero-stat__num[data-target="4"]::after {
  content: '\0664'; /* ٤ */
  color: var(--color-gold-bright);
}
[dir="rtl"] .hero-stats-bar .hero-stat__num[data-target="100"] {
  color: transparent;
}
[dir="rtl"] .hero-stats-bar .hero-stat__num[data-target="100"]::after {
  content: '\0661\0660\0660'; /* ١٠٠ */
  color: var(--color-gold-bright);
}
[dir="rtl"] .hero-stats-bar .hero-stat__num[data-target="6"] {
  color: transparent;
}
[dir="rtl"] .hero-stats-bar .hero-stat__num[data-target="6"]::after {
  content: '\0666'; /* ٦ */
  color: var(--color-gold-bright);
}
[dir="rtl"] .hero-stats-bar .hero-stat__num[data-target="48"] {
  color: transparent;
}
[dir="rtl"] .hero-stats-bar .hero-stat__num[data-target="48"]::after {
  content: '\0664\0668'; /* ٤٨ */
  color: var(--color-gold-bright);
}

/* ============================================================
   TEXT-ALIGN GAPS — audit 2026-10-21
   Components that hard-code text-align in LTR files and were never
   mirrored. Rule of thumb: LTR `left` → RTL `right`, and the few
   deliberate right-aligned blocks (section-header-right / spec-metric)
   flip to `left`.
   ============================================================ */

[dir="rtl"] .faq-question {
  text-align: right;
}

/* Deliberately right-aligned in LTR → mirrors to the leading edge (left) */
[dir="rtl"] .section-header-right {
  text-align: left;
}

[dir="rtl"] .quick-ref-table th,
[dir="rtl"] .quick-ref-table td {
  text-align: right;
}

[dir="rtl"] .product-tested-section .tested-card {
  text-align: right;
}

/* Deliberately right-aligned in LTR → mirrors to the leading edge (left) */
[dir="rtl"] .spec-metric-value {
  text-align: left;
}

[dir="rtl"] .boom-features {
  text-align: right;
}

[dir="rtl"] .beam-table th {
  text-align: right;
}

[dir="rtl"] .qc-note {
  text-align: right;
}

[dir="rtl"] .section-cta {
  text-align: right;
}

[dir="rtl"] body#yakeen-page .hero-global {
  text-align: right;
}

[dir="rtl"] .compare-table .row-label {
  text-align: right;
}

[dir="rtl"] .quote-hero-inner {
  text-align: right;
}

/* ============================================================
   MOBILE RTL ADJUSTMENTS (≤ 768px)
   ============================================================ */

@media (max-width: 768px) {
  [dir="rtl"] .split-section {
    flex-direction: column-reverse;
  }
}
