/*
 * Language switcher + LTR locale (Kerge Template pattern: sidebar left).
 * Loaded after main.css + site-layout.css; rtl.css is disabled for LTR.
 */

/* Soft locale swap */
.sjs-locale-shell {
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.35s ease,
    transform 0.35s ease;
}

.sjs-locale-shell.is-visible {
  opacity: 1;
  transform: none;
}

.sjs-locale-shell.is-loading {
  pointer-events: none;
}

html.locale-switching {
  cursor: progress;
}

html.locale-switching .lang-switcher .lang-btn {
  pointer-events: none;
}

/* ========== Language switcher (flags: mono → color on hover; theme line when active) ========== */
.lang-switcher {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  justify-content: center;
  align-items: center;
  margin: 10px 0 8px;
  padding: 0 6px;
  white-space: nowrap;
}

.lang-switcher .lang-btn,
.lang-switcher .lang-btn:hover,
.lang-switcher .lang-btn:focus,
.lang-switcher .lang-btn:focus-visible,
.lang-switcher .lang-btn:active {
  appearance: none;
  position: relative;
  border: none;
  outline: 0;
  box-shadow: none;
  background: transparent;
  padding: 2px 0;
  margin: 0;
  line-height: 0;
  cursor: pointer;
  border-radius: 0;
  flex: 0 0 auto;
}

.lang-switcher .lang-btn .lang-flag {
  display: block;
  width: 20px;
  height: 13px;
  object-fit: cover;
  border-radius: 1px;
  filter: grayscale(1);
  opacity: 0.72;
  transition: filter 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.lang-switcher .lang-btn:hover .lang-flag,
.lang-switcher .lang-btn.active .lang-flag {
  filter: none;
  opacity: 1;
}

/* خط رنگ تم فقط برای زبان فعال — هاور فقط رنگ پرچم را برمی‌گرداند */
.lang-switcher .lang-btn.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 1px;
  background: var(--theme-accent, #b3454f);
  pointer-events: none;
}

.lang-switcher--mobile {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  padding: 0;
  z-index: 5;
  gap: 6px;
}

html[dir="rtl"] .lang-switcher--mobile {
  left: 48px;
  right: auto;
}

html[dir="ltr"] .lang-switcher--mobile {
  right: 48px;
  left: auto;
}

.mobile-header {
  position: relative;
}

/* نوار بالای موبایل باید ثابت بماند؛ position:relative باعث می‌شد با اسکرول اولیه از صفحه خارج شود */
@media (max-width: 991px) {
  .mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1002;
    box-sizing: border-box;
    height: calc(50px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    background-color: #fff;
  }

  .site-main {
    top: calc(50px + env(safe-area-inset-top));
  }
}

@media (max-width: 1024px) {
  .header .lang-switcher:not(.lang-switcher--mobile) {
    display: none;
  }
}

@media (min-width: 1025px) {
  .lang-switcher--mobile {
    display: none;
  }
}

/* ========== LTR: Template-style left sidebar ========== */
html.locale-ltr,
html.locale-ltr body {
  direction: ltr;
  text-align: left;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

html.locale-ltr body,
html.locale-ltr body p,
html.locale-ltr h1,
html.locale-ltr h2,
html.locale-ltr h3,
html.locale-ltr h4,
html.locale-ltr h5,
html.locale-ltr h6,
html.locale-ltr .btn,
html.locale-ltr .form-control,
html.locale-ltr .site-title,
html.locale-ltr .hp-main-title,
html.locale-ltr .sp-subtitle,
html.locale-ltr .site-main-menu,
html.locale-ltr .block-title,
html.locale-ltr .section-title,
html.locale-ltr .section-description,
html.locale-ltr .item-title,
html.locale-ltr .item-period,
html.locale-ltr .item-company,
html.locale-ltr .name,
html.locale-ltr .category,
html.locale-ltr .desc,
html.locale-ltr .button,
html.locale-ltr input,
html.locale-ltr textarea,
html.locale-ltr select {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif !important;
  letter-spacing: normal;
}

html.locale-ltr .section-inner.start-page-full-width .hp-text-block {
  text-align: left;
}

html.locale-ltr .hp-role-tags {
  direction: ltr;
  justify-content: flex-start;
}

/* Active menu bar on the content side (right edge of left sidebar) — Template default */
html.locale-ltr .site-main-menu li a:hover:after,
html.locale-ltr .site-main-menu li a.active:after {
  left: auto;
  right: 0;
}

@media only screen and (min-width: 992px) {
  html.locale-ltr .header {
    left: 0;
    right: auto;
    border-right: 1px solid #eee;
    border-left: none;
  }

  html.locale-ltr .site-main {
    margin-left: 160px !important;
    margin-right: 0 !important;
  }

  html.locale-ltr .pt-page,
  html.locale-ltr .pt-page.start-page,
  html.locale-ltr .single-page-content {
    padding-left: 15px;
    padding-right: 0;
  }

  /*
   * Keep scroll on #page (same as Persian) so .pt-trigger menu handlers work.
   * Only flip sidebar side / text direction for LTR — do not move scroll to body.
   */
  html.locale-ltr,
  html.locale-ltr body {
    overflow: hidden !important;
    height: 100%;
  }

  html.locale-ltr #page.one-page-style {
    height: 100%;
    max-height: 100vh;
    overflow-x: hidden;
    overflow-y: scroll;
    direction: ltr;
    -webkit-overflow-scrolling: touch;
  }

  html.locale-ltr .lmpixels-scroll-to-top {
    right: 20px;
    left: auto;
  }
}

@media only screen and (max-width: 991px) {
  html.locale-ltr .lmpixels-scroll-to-top {
    right: 16px;
    left: auto;
  }

  html.locale-ltr .header {
    left: 0;
    right: auto;
    margin-left: 0;
  }

  html.locale-ltr .mobile-menu-hide {
    left: 0;
    right: auto;
    margin-left: -100%;
    margin-right: 0;
  }

  html.locale-ltr .header:not(.mobile-menu-hide) {
    margin-left: 0;
  }

  html.locale-ltr .site-main {
    margin-left: 0;
    margin-right: 0;
  }
}

/* Timeline / resume reading direction */
html.locale-ltr #resume .timeline .left-part,
html.locale-ltr #resume .timeline .right-part {
  text-align: left;
}

html.locale-ltr .block-title,
html.locale-ltr .section-title,
html.locale-ltr .section-description,
html.locale-ltr .info-list-w-icon,
html.locale-ltr .ci-text,
html.locale-ltr .portfolio-filters,
html.locale-ltr .contact-form {
  text-align: left;
}

html.locale-ltr .portfolio-filters {
  direction: ltr;
}

html.locale-ltr #portfolio .portfolio-grid figure .desc {
  text-align: left;
  direction: ltr;
}

