/* BFK Core 3.0.1 — Right-to-left layout correction.
   This file is enqueued after the design system to resolve earlier physical-LTR rules.
   All overrides are limited to the BFK plugin UI and do not affect Elementor editors. */
body.bfk3-active .bfk3-page-nav {
  direction: rtl !important;
  text-align: right !important;
}
@media (min-width: 1101px) {
  body.bfk3-active .bfk3-page-nav {
    position: fixed !important;
    left: auto !important;
    right: 18px !important;
    top: 112px !important;
    width: 178px !important;
    min-width: 0 !important;
    max-width: 178px !important;
    z-index: 80 !important;
    max-height: calc(100dvh - 135px);
    overflow-y: auto;
    overflow-x: hidden;
  }
  /* Reserve space on the right where the TOC would overlap the page shell.
     Wide viewports already have sufficient exterior gutter. */
  body.bfk3-active .bfk3-section .bfk-shell,
  body.bfk3-active.bfk3-page-about .bfk3-section .bfk-shell {
    padding-left: 0 !important;
    padding-right: 206px !important;
    box-sizing: border-box !important;
  }
}
@media (min-width: 1820px) {
  body.bfk3-active .bfk3-section .bfk-shell,
  body.bfk3-active.bfk3-page-about .bfk3-section .bfk-shell {
    padding-right: 0 !important;
  }
}
@media (min-width: 1101px) and (max-width: 1300px) {
  body.bfk3-active .bfk3-page-nav {right: 12px !important;left: auto !important;width: 151px !important;max-width: 151px !important;}
  body.bfk3-active .bfk3-section .bfk-shell {padding-right: 174px !important; padding-left: 0 !important;}
}
@media (max-width: 1100px) {
  body.bfk3-active .bfk3-page-nav {
    position: sticky !important;
    top: 68px !important;
    right: auto !important;
    left: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    max-height: none !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    white-space: nowrap;
    padding-inline: 14px !important;
    box-sizing: border-box;
  }
  body.bfk3-active .bfk3-section .bfk-shell,
  body.bfk3-active.bfk3-page-about .bfk3-section .bfk-shell {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  /* In an RTL grid the first column is physically right: menu right, logo left. */
  body.bfk-canvas-page .bfk-global-header .bfk-header__inner,
  body.bfk3-active .bfk-global-header .bfk-header__inner {
    display: grid !important;
    direction: rtl !important;
    grid-template-areas: "toggle logo" !important;
    grid-template-columns: auto minmax(0,1fr) !important;
    gap: 8px !important;
  }
  body.bfk-canvas-page .bfk-global-header .bfk-menu-toggle,
  body.bfk3-active .bfk-global-header .bfk-menu-toggle {
    grid-area: toggle !important;
    justify-self: start !important;
    order: 0 !important;
    display: grid !important;
    visibility: visible !important;
  }
  body.bfk-canvas-page .bfk-global-header .bfk-logo,
  body.bfk3-active .bfk-global-header .bfk-logo {
    grid-area: logo !important;
    justify-self: end !important;
    order: 1 !important;
  }
  body.bfk-canvas-page .bfk-global-header .bfk-mobile-nav,
  body.bfk3-active .bfk-global-header .bfk-mobile-nav {
    right: 0 !important;
    left: auto !important;
    direction: rtl !important;
    text-align: right !important;
  }
}
/* Correct dark panel contrast: 3.0's global heading rule had greater specificity
   than the white heading rule for AI panels. */
body.bfk3-active .bfk3-section .bfk3-ai-cap .bfk3-heading h2,
body.bfk3-active .bfk3-section .bfk3-ai-cycle .bfk3-heading h2 {
  color: #f7fbff !important;
  opacity: 1 !important;
  text-shadow: none !important;
}
body.bfk3-active .bfk3-section .bfk3-ai-feature h3,
body.bfk3-active .bfk3-section .bfk3-ai-loop__node h3 {
  color: #f7fbff !important;
}
body.bfk3-active .bfk3-ai-cap .bfk3-heading,
body.bfk3-active .bfk3-ai-cycle .bfk3-heading {border-color: #315572 !important;}
/* Elementor fallback when JS is missing: original topic navigation must also be RTL. */
body.bfk-canvas-page .bfk-source-layout--with-toc {direction: rtl !important;}
body.bfk-canvas-page .bfk-source-toc {direction: rtl !important;text-align: right !important;}
@media (min-width: 1101px) {
  body.bfk-canvas-page .bfk-source-layout--with-toc {
    grid-template-columns: minmax(175px,220px) minmax(0,1fr) !important;
  }
}
