/**
 * Direction-aware layout overrides.
 * Loaded after kidkinder/style.css so template LTR reboot/utilities do not win.
 */

/* Site-wide: one step larger base font (16px → ~17px) so rem sizes stay proportional */
html {
  font-size: 106.25%;
}

/* English: one more step (Source Sans reads slightly smaller) */
html[lang="en"],
html[dir="ltr"] {
  font-size: 112.5%;
}

/* Formal English sans — Source Sans 3 (LTR / English only) */
html[lang="en"] body,
html[dir="ltr"] body {
  font-family: "Source Sans 3", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html[lang="en"] h1,
html[lang="en"] h2,
html[lang="en"] h3,
html[lang="en"] h4:not(.fa):not(.fas):not(.far):not(.fab),
html[lang="en"] h5,
html[lang="en"] h6,
html[lang="en"] .h1,
html[lang="en"] .h2,
html[lang="en"] .h3,
html[lang="en"] .h4:not(.fa):not(.fas):not(.far):not(.fab),
html[lang="en"] .h5,
html[lang="en"] .h6,
html[dir="ltr"] h1,
html[dir="ltr"] h2,
html[dir="ltr"] h3,
html[dir="ltr"] h4:not(.fa):not(.fas):not(.far):not(.fab),
html[dir="ltr"] h5,
html[dir="ltr"] h6,
html[dir="ltr"] .h1,
html[dir="ltr"] .h2,
html[dir="ltr"] .h3,
html[dir="ltr"] .h4:not(.fa):not(.fas):not(.far):not(.fab),
html[dir="ltr"] .h5,
html[dir="ltr"] .h6 {
  font-family: "Source Sans 3", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

/* Keep Font Awesome icons visible (English headings rule must not override icon font) */
.fa,
.fas,
.far,
.fab,
.fal,
[class^="fa-"],
[class*=" fa-"] {
  font-family: "Font Awesome 5 Free", "Font Awesome 5 Brands" !important;
}

.fab {
  font-family: "Font Awesome 5 Brands" !important;
}

.fas,
.fa {
  font-weight: 900;
}

.far {
  font-weight: 400;
}

html[dir="ltr"] body {
  text-align: left;
  direction: ltr;
}

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

/* Headings, paragraphs, lists, and nav inherit from body */
html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6,
html[dir="rtl"] p,
html[dir="rtl"] li,
html[dir="rtl"] .navbar,
html[dir="rtl"] .navbar-nav,
html[dir="rtl"] .nav-link {
  text-align: right;
}

html[dir="ltr"] h1,
html[dir="ltr"] h2,
html[dir="ltr"] h3,
html[dir="ltr"] h4,
html[dir="ltr"] h5,
html[dir="ltr"] h6,
html[dir="ltr"] p,
html[dir="ltr"] li,
html[dir="ltr"] .navbar,
html[dir="ltr"] .navbar-nav,
html[dir="ltr"] .nav-link {
  text-align: left;
}

/* Keep intentional centering (including nested headings/paragraphs) */
html[dir="rtl"] .text-center,
html[dir="ltr"] .text-center,
html[dir="rtl"] .text-center h1,
html[dir="rtl"] .text-center h2,
html[dir="rtl"] .text-center h3,
html[dir="rtl"] .text-center h4,
html[dir="rtl"] .text-center h5,
html[dir="rtl"] .text-center h6,
html[dir="rtl"] .text-center p,
html[dir="rtl"] .text-center li,
html[dir="ltr"] .text-center h1,
html[dir="ltr"] .text-center h2,
html[dir="ltr"] .text-center h3,
html[dir="ltr"] .text-center h4,
html[dir="ltr"] .text-center h5,
html[dir="ltr"] .text-center h6,
html[dir="ltr"] .text-center p,
html[dir="ltr"] .text-center li {
  text-align: center !important;
}

/*
 * Bootstrap 4 physical text utilities from kidkinder/style.css use !important
 * and ignore dir. Map them to logical start/end behavior.
 */
html[dir="rtl"] .text-left {
  text-align: right !important;
}

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

html[dir="ltr"] .text-left {
  text-align: left !important;
}

html[dir="ltr"] .text-right {
  text-align: right !important;
}

@media (min-width: 992px) {
  html[dir="rtl"] .text-lg-left {
    text-align: right !important;
  }

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

  html[dir="ltr"] .text-lg-left {
    text-align: left !important;
  }

  html[dir="ltr"] .text-lg-right {
    text-align: right !important;
  }
}

/*
 * Common BS4 spacing utilities used in this project (physical L/R).
 * Flip them under RTL so icon gaps and section padding stay correct.
 */
html[dir="rtl"] .pl-3 {
  padding-left: 0 !important;
  padding-right: 1rem !important;
}

html[dir="rtl"] .pl-4 {
  padding-left: 0 !important;
  padding-right: 1.5rem !important;
}

html[dir="rtl"] .pr-2 {
  padding-right: 0 !important;
  padding-left: 0.5rem !important;
}

html[dir="rtl"] .pr-5 {
  padding-right: 0 !important;
  padding-left: 3rem !important;
}

html[dir="rtl"] .mr-2 {
  margin-right: 0 !important;
  margin-left: 0.5rem !important;
}

html[dir="rtl"] .mr-3 {
  margin-right: 0 !important;
  margin-left: 1rem !important;
}

/* Logical Bootstrap 5 utilities (preferred going forward) */
html[dir="rtl"] .ps-3 {
  padding-right: 1rem !important;
  padding-left: 0 !important;
}

html[dir="rtl"] .ps-4 {
  padding-right: 1.5rem !important;
  padding-left: 0 !important;
}

html[dir="rtl"] .pe-2 {
  padding-left: 0.5rem !important;
  padding-right: 0 !important;
}

html[dir="rtl"] .pe-5 {
  padding-left: 3rem !important;
  padding-right: 0 !important;
}

html[dir="rtl"] .me-2 {
  margin-left: 0.5rem !important;
  margin-right: 0 !important;
}

html[dir="rtl"] .me-3 {
  margin-left: 1rem !important;
  margin-right: 0 !important;
}

/* Explicit LTR spacing — BS5 logical utilities + template mix */
html[dir="ltr"] .ps-3 {
  padding-left: 1rem !important;
  padding-right: 0 !important;
}

html[dir="ltr"] .ps-4 {
  padding-left: 1.5rem !important;
  padding-right: 0 !important;
}

html[dir="ltr"] .pe-2 {
  padding-right: 0.5rem !important;
  padding-left: 0 !important;
}

html[dir="ltr"] .pe-5 {
  padding-right: 3rem !important;
  padding-left: 0 !important;
}

html[dir="ltr"] .me-2 {
  margin-right: 0.5rem !important;
  margin-left: 0 !important;
}

html[dir="ltr"] .me-3 {
  margin-right: 1rem !important;
  margin-left: 0 !important;
}

/* Facility / contact flex cards — prevent English text overflow */
.card-fixed {
  height: auto !important;
  min-height: 160px;
  align-items: flex-start !important;
  overflow: hidden;
}

.card-fixed > img {
  flex-shrink: 0;
  margin-bottom: 0 !important;
}

.card-fixed > div {
  flex: 1 1 0;
  min-width: 0;
}

.card-fixed h4,
.card-fixed p {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

@media (min-width: 992px) {
  .card-fixed {
    min-height: 198px;
    align-items: center !important;
  }
}

/* Footer / contact icon rows */
.footer-contact-row,
.contact-info-row {
  align-items: flex-start;
}

.footer-contact-row > i,
.contact-info-row > i {
  flex-shrink: 0;
  width: 1.5rem;
  margin-top: 0.2rem;
  text-align: center;
}

html[dir="rtl"] .back-to-top {
  right: auto;
  left: 30px;
}

/* Footer / list chevrons point toward the text start in RTL */
html[dir="rtl"] .fa-angle-right {
  transform: scaleX(-1);
}

/* Dropdown menus from template reboot */
html[dir="rtl"] .dropdown-menu {
  text-align: right;
}

html[dir="ltr"] .dropdown-menu {
  text-align: left;
}

/* Brand blue — unify btn-primary (back-to-top, contact send, etc.) with site #094e9d */
.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: #094e9d;
  --bs-btn-border-color: #094e9d;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #073a75;
  --bs-btn-hover-border-color: #073a75;
  --bs-btn-focus-shadow-rgb: 9, 78, 157;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #073a75;
  --bs-btn-active-border-color: #073a75;
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: #094e9d;
  --bs-btn-disabled-border-color: #094e9d;
  color: #fff;
  background-color: #094e9d;
  border-color: #094e9d;
}

.btn-primary:hover {
  color: #fff;
  background-color: #073a75;
  border-color: #073a75;
}

.btn-primary:focus,
.btn-primary.focus {
  color: #fff;
  background-color: #073a75;
  border-color: #073a75;
  box-shadow: 0 0 0 0.2rem rgba(9, 78, 157, 0.35);
}

.btn-primary:active,
.btn-primary.active,
.btn-primary:not(:disabled):not(.disabled):active,
.btn-primary:not(:disabled):not(.disabled).active {
  color: #fff;
  background-color: #073a75;
  border-color: #073a75;
}

.btn-primary:disabled,
.btn-primary.disabled {
  color: #fff;
  background-color: #094e9d;
  border-color: #094e9d;
  opacity: 0.75;
}
