/* ============================================================
   QUANTA ADVISORY — RTL / ARABIC OVERRIDES
   Applied when html[dir="rtl"] is set (Arabic pages)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700&display=swap');

/* === BASE === */
html[dir="rtl"] {
  direction: rtl;
}

html[dir="rtl"] body {
  font-family: 'Cairo', system-ui, sans-serif;
  letter-spacing: 0;
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5 {
  font-family: 'Cairo', system-ui, sans-serif;
  letter-spacing: 0;
}

html[dir="rtl"] body { font-size: 1.0625rem; }
html[dir="rtl"] h1   { font-size: clamp(2.5rem, 5.5vw, 5rem); }
html[dir="rtl"] h2   { font-size: clamp(1.875rem, 3.5vw, 3rem); }

/* === LOGO ===
   LTR: [quanta] [▟bars]
   RTL: [bars▟]  [quanta]  — mirrored, bars on left ascending left→right
   Remove row-reverse so RTL natural flow puts text RIGHT, bars LEFT.
   Reverse bars internally so they still ascend left→right.
*/
html[dir="rtl"] .logo {
  flex-direction: row;   /* RTL default: text (first) → right, bars (second) → left */
}

html[dir="rtl"] .logo-bars {
  /* no override — RTL natural flow: lb3(tall) on left, lb1(short) on right = biggest left, smallest right */
}

/* === SECTION BARS — right-aligned; RTL direction naturally puts sb1(short) on right, sb3(tall) on left === */
html[dir="rtl"] .section-bar {
  width: fit-content;   /* collapse so margin-left:auto can push to right edge */
  margin-left: auto;
  margin-right: 0;
}

html[dir="rtl"] .about-label-row {
  flex-direction: row-reverse;
}

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

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

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

html[dir="rtl"] .lang-switcher {
  padding-left: 0;
  margin-left: 0;
  border-left: none;
  padding-right: 1rem;
  margin-right: 0.5rem;
  border-right: 1px solid var(--rim-light);
}

html[dir="rtl"] .lang-globe {
  flex-direction: row;
}

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

html[dir="rtl"] .nav-link::after {
  right: 0;
  left: auto;
  transform-origin: right;
}

/* === MOBILE OVERLAY === */
html[dir="rtl"] .nav-overlay {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .nav-overlay-links {
  align-items: flex-end;
}

/* === HERO ===
   Grid: in RTL, column 1 is RIGHT, column 2 is LEFT.
   Hero-left (text) is first in DOM → appears on RIGHT (correct for Arabic reading).
   Hero-right (chart) is second → appears on LEFT.
   No order override needed — natural RTL grid flow is correct.
*/
html[dir="rtl"] .hero-inner {
  grid-template-columns: 1fr 1fr;
}

html[dir="rtl"] .hero-right {
  order: 0; /* let natural RTL grid handle it */
}

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

html[dir="rtl"] .hero-eyebrow {
  flex-direction: row-reverse;
  animation-name: eyebrowInRtl;
}

html[dir="rtl"] .hero-eyebrow-line {
  transform: scaleX(-1);
}

html[dir="rtl"] .hero-heading,
html[dir="rtl"] .hero-subheadline,
html[dir="rtl"] .hero-eyebrow-text {
  text-align: right;
}

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

html[dir="rtl"] .hero-stats {
  flex-direction: row-reverse;
  text-align: right;
  justify-content: flex-start;
  right: auto;
  left: 0;
  padding: 0 1rem;
}

html[dir="rtl"] .hero-stat {
  align-items: flex-end;
}

/* === PAGE HERO === */
html[dir="rtl"] .page-hero-inner {
  text-align: right;
}

html[dir="rtl"] .page-hero-heading,
html[dir="rtl"] .page-hero-sub {
  text-align: right;
}

/* === DICTIONARY DEFINITION === */
html[dir="rtl"] .quant-definition-header,
html[dir="rtl"] .dictionary-entry {
  text-align: right;
}

html[dir="rtl"] .dictionary-entry {
  direction: rtl;
}

html[dir="rtl"] .dictionary-reveal-toggle {
  direction: rtl;
}

/* === PILLARS === */
html[dir="rtl"] .pillars-inner {
  direction: rtl;
}

html[dir="rtl"] .pillar-item {
  align-items: flex-end;
  text-align: right;
}

html[dir="rtl"] .pillar-item::after {
  background: linear-gradient(270deg, transparent, var(--signal) 40%, var(--signal-soft) 60%, transparent);
  transform-origin: right;
}

/* === SERVICES INTRO === */
html[dir="rtl"] .services-intro-inner {
  direction: rtl;
}

html[dir="rtl"] .services-intro-heading,
html[dir="rtl"] .services-intro-body {
  text-align: right;
}

/* === SERVICE GROUPS === */
html[dir="rtl"] .service-group-inner {
  direction: rtl;
}

html[dir="rtl"] .service-group-num,
html[dir="rtl"] .service-group-title,
html[dir="rtl"] .service-group-for {
  text-align: right;
}

html[dir="rtl"] .service-detail {
  text-align: right;
}

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

html[dir="rtl"] .service-value-tag {
  text-align: right;
}

/* === SERVICE CARDS (homepage) === */
html[dir="rtl"] .service-card {
  text-align: right;
}

html[dir="rtl"] .service-card-link {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

/* === WHY SECTION === */
html[dir="rtl"] .why-item {
  text-align: right;
}

html[dir="rtl"] .why-item-grid {
  direction: rtl;
}

/* why-header: override RTL defaults so bar + label + heading stay centred */
html[dir="rtl"] .why-header {
  text-align: center;
}

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

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

html[dir="rtl"] .why-header .section-bar {
  margin-left: auto;
  margin-right: auto;
}

/* === SPECIAL PROJECTS === */
html[dir="rtl"] .special-preview-inner,
html[dir="rtl"] .special-initiatives .container {
  direction: rtl;
}

html[dir="rtl"] .special-cap-item {
  flex-direction: row-reverse;
}

html[dir="rtl"] .initiative-card {
  text-align: right;
}

html[dir="rtl"] .initiative-title,
html[dir="rtl"] .initiative-desc {
  text-align: right;
}

/* === PHILOSOPHY / ABOUT === */
html[dir="rtl"] .philosophy-inner {
  direction: rtl;
}

html[dir="rtl"] .philosophy-left {
  text-align: right;
}

html[dir="rtl"] .philosophy-block {
  text-align: right;
  border-left: none;
  border-right: 1px solid var(--border-light);
  padding-left: 0;
  padding-right: var(--sp-6);
}

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

/* === APPROACH === */
html[dir="rtl"] .approach-steps {
  direction: rtl;
}

html[dir="rtl"] .approach-step {
  text-align: right;
  border-left: none;
  border-right: 1px solid var(--border-light);
  padding-left: 0;
  padding-right: var(--sp-6);
}

html[dir="rtl"] .approach-step-num {
  text-align: right;
}

html[dir="rtl"] .approach-step:hover {
  box-shadow: inset -3px 0 0 var(--signal);
}

/* === CASE STUDIES / WORK === */
html[dir="rtl"] .case-study {
  direction: rtl;
}

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

html[dir="rtl"] .case-study-heading,
html[dir="rtl"] .case-block-label,
html[dir="rtl"] .case-block-text,
html[dir="rtl"] .case-outcome-label,
html[dir="rtl"] .case-outcome-text {
  text-align: right;
}

html[dir="rtl"] .case-study-tag {
  text-align: right;
  display: block;
}

/* === CTA BANNER === */
html[dir="rtl"] .cta-banner-eyebrow {
  flex-direction: row-reverse;
}

html[dir="rtl"] .cta-banner-eyebrow-line {
  transform: scaleX(-1);
}

html[dir="rtl"] .cta-banner-heading,
html[dir="rtl"] .cta-banner-sub {
  text-align: center;
}

html[dir="rtl"] .cta-banner-actions {
  flex-direction: row-reverse;
}

/* === CONTACT === */
html[dir="rtl"] .contact-inner {
  direction: rtl;
}

html[dir="rtl"] .contact-heading,
html[dir="rtl"] .contact-body {
  text-align: right;
}

html[dir="rtl"] .contact-detail {
  direction: rtl;
}

html[dir="rtl"] .contact-detail-item {
  flex-direction: row-reverse;
  text-align: right;
}

html[dir="rtl"] .contact-detail-label,
html[dir="rtl"] .contact-detail-value {
  text-align: right;
}

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

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

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

html[dir="rtl"] .form-select {
  background-position: left 1rem center;
  padding-right: 1rem;
  padding-left: 2.5rem;
  text-align: right;
}

html[dir="rtl"] .form-submit {
  align-self: flex-end;
}

/* === INSIGHTS === */
html[dir="rtl"] .insights-placeholder .container {
  direction: rtl;
}

/* === FOOTER === */
html[dir="rtl"] .footer-inner {
  flex-direction: row-reverse;
  text-align: right;
}

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

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

html[dir="rtl"] .footer-col {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

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

html[dir="rtl"] .footer-links {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

html[dir="rtl"] .footer-link {
  text-align: right;
  display: block;
}

html[dir="rtl"] .footer-link:hover {
  transform: translateX(-3px);
}

html[dir="rtl"] .footer-bottom {
  flex-direction: row-reverse;
}

html[dir="rtl"] .footer-legal {
  flex-direction: row-reverse;
}

/* === BUTTON ARROWS === */
html[dir="rtl"] .btn-text::after,
html[dir="rtl"] .btn-text-light::after {
  content: ' ←';
}

html[dir="rtl"] .btn-text:hover::after,
html[dir="rtl"] .btn-text-light:hover::after {
  transform: translateX(-4px);
}

/* === SHIMMER DIRECTION FLIP === */
html[dir="rtl"] .btn-primary::before {
  transform: translateX(120%) skewX(15deg);
}
html[dir="rtl"] .btn-primary:hover::before {
  transform: translateX(-220%) skewX(15deg);
}
html[dir="rtl"] .btn-ghost::before {
  transform: translateX(120%) skewX(15deg);
}
html[dir="rtl"] .btn-ghost:hover::before {
  transform: translateX(-220%) skewX(15deg);
}

/* === FINAL RTL PRIMARY CTA STYLE ===
   Keep after older RTL button overrides so Arabic CTAs match the premium signal buttons. */
html[dir="rtl"] .btn-text::after,
html[dir="rtl"] .btn-text-light::after {
  content: ' \2190';
}

html[dir="rtl"] .btn-primary {
  --signal-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='11' viewBox='0 0 18 11' fill='none'><path d='M17 5.5H2.5M6.75 1.25L2.5 5.5L6.75 9.75' stroke='%23F7FAFF' stroke-width='1.35' stroke-linecap='round' stroke-linejoin='round'/><path d='M17 5.5H12.5' stroke='%238AB4FF' stroke-width='1.35' stroke-linecap='round'/></svg>");
  color: #fff;
  font-family: 'Cairo', var(--font-body), system-ui, sans-serif;
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  text-shadow: 0 1px 12px rgba(255, 255, 255, 0.14);
  background-color: #17306f;
  background-image:
    var(--signal-arrow),
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 34%),
    linear-gradient(135deg, #5e8bf5 0%, #3d6ff0 44%, #1f45b0 100%);
  background-repeat: no-repeat;
  background-position: left 1.18rem center, 0 0, 0 0;
  background-size: 18px 11px, 100% 100%, 155% 100%;
  border: 1px solid rgba(138, 180, 255, 0.38);
  border-radius: 6px;
  padding: 0.875rem 1.65rem 0.875rem 3.15rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    0 10px 26px rgba(4, 10, 28, 0.38),
    0 0 24px rgba(61, 111, 240, 0.24);
}

html[dir="rtl"] .btn-primary::before,
html[dir="rtl"] .btn-primary::after {
  content: none;
  display: none;
}

html[dir="rtl"] .btn-primary:hover {
  background-color: #101a38;
  background-image:
    var(--signal-arrow),
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.02) 36%),
    linear-gradient(135deg, #14295f 0%, #182f74 48%, #0b1430 100%);
  background-position: left 0.68rem center, 0 0, 0 0;
  border-color: rgba(168, 198, 255, 0.95);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 0 0 1px rgba(138, 180, 255, 0.22),
    inset 0 -10px 22px rgba(61, 111, 240, 0.14),
    0 12px 28px rgba(4, 10, 28, 0.46),
    0 0 0 1px rgba(126, 174, 255, 0.3),
    0 0 36px rgba(61, 111, 240, 0.48);
  filter: saturate(1.12) brightness(1.03);
  transform: translateY(-2px);
}

html[dir="rtl"] .nav-cta .btn-primary {
  font-size: 0.76rem;
  line-height: 1;
  border-radius: 5px;
  padding: 0.68rem 1.05rem 0.68rem 2.35rem;
  background-position: left 0.92rem center, 0 0, 0 0;
  background-size: 15px 9px, 100% 100%, 155% 100%;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 -1px 0 rgba(0, 0, 0, 0.16),
    0 7px 18px rgba(4, 10, 28, 0.34),
    0 0 16px rgba(61, 111, 240, 0.18);
}

html[dir="rtl"] .nav-cta .btn-primary:hover {
  background-position: left 0.58rem center, 0 0, 0 0;
}

/* === HERO BAR CHART — mirror layout and stats order === */
html[dir="rtl"] .hero-visual-wrap {
  mask-image: linear-gradient(to right, transparent 0%, black 6%, black 94%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 6%, black 94%, transparent 100%);
}

html[dir="rtl"] .bar-composition {
  flex-direction: row-reverse;
  left: 0;
  right: 0;
  padding: 0 1rem 0 0.75rem;
}

html[dir="rtl"] .hero-visual-bars-side .bar-composition {
  left: 0;
  right: 36%;
  padding: 0 1rem 0 0.75rem;
}

/* === EYEBROW ANIMATION === */
@keyframes eyebrowInRtl {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* === LABEL ELEMENTS === */
html[dir="rtl"] .label,
html[dir="rtl"] .label-light {
  text-align: right;
  display: block;
}

/* === SECTION BAR IN LABEL ROW — stays adjacent to text, no far-right push === */
html[dir="rtl"] .about-label-row .section-bar {
  width: auto;
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 0;
}

/* === SERVICE DETAIL — slide from left in RTL (mirror of LTR slide-from-right) === */
html[dir="rtl"] .service-group-right [data-reveal] {
  transform: translateX(-40px);
}

html[dir="rtl"] .service-group-right [data-reveal].revealed {
  transform: translateX(0);
}

@media (max-width: 768px) {
  html[dir="rtl"] .service-group-right [data-reveal] {
    transform: translateX(-24px);
  }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  html[dir="rtl"] .lang-switcher {
    padding-right: 0.75rem;
    margin-right: 0;
  }
}
