/**
 * Sarv Catalyst — FA desktop navigation, one aligned row.
 *
 * 1024–1439 CSS px: brand mark, eight first-level destinations, language
 * selector on the SAME row (RTL). Below 1024 the original keyboard-accessible
 * hamburger retains control. >=1440 the established single-row global header
 * remains. No consultation CTA in Persian; removed in header PHP markup.
 *
 * IMPORTANT: Do not reintroduce the previous grid/two-row workaround.
 */

/* An actual separator in the flex flow is reliable at every desktop zoom
 * level. It sits between brand and first nav link; never overlaid on Home. */
html[lang="fa-IR"] .sc-site-header--editorial .sc-site-header__brand-divider {
  display: none;
}

@media (min-width: 1024px) {
  html[lang="fa-IR"] .sc-site-header--editorial .sc-site-header__brand-divider {
    display: block;
    flex: 0 0 3px;
    align-self: center;
    inline-size: 3px;
    block-size: 42px;
    background: var(--sc-gm-blue, #0b79be);
    pointer-events: none;
  }
}

@media (min-width: 1024px) and (width < 90rem) {
  html[lang="fa-IR"] .sc-site-header--editorial {
    position: relative;
    z-index: 30;
    block-size: 94px;
    min-block-size: 94px;
    overflow: visible;
  }

  html[lang="fa-IR"] .sc-site-header--editorial > .sc-container {
    max-inline-size: none;
    block-size: 100%;
    padding-inline: clamp(22px, 2.6vw, 38px);
  }

  html[lang="fa-IR"] .sc-site-header--editorial .sc-site-header__inner {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    inline-size: 100%;
    block-size: 100%;
    min-block-size: 0;
    margin: 0;
    padding: 0;
    /* Real divider is a distinct flex item between logo and nav. */
    gap: clamp(14px, 1.5vw, 20px);
  }

  html[lang="fa-IR"] .sc-site-header--editorial .sc-site-header__branding {
    flex: 0 0 auto;
    align-self: center;
    position: relative;
    margin: 0;
    padding: 0;
  }

  html[lang="fa-IR"] .sc-site-header--editorial .sc-primary-nav__list > .current-menu-item > a,
  html[lang="fa-IR"] .sc-site-header--editorial .sc-primary-nav__list > .current_page_item > a,
  html[lang="fa-IR"] .sc-site-header--editorial .sc-primary-nav__list > li > a[aria-current] {
    box-shadow: none;
    text-decoration: underline;
    text-decoration-color: var(--sc-gm-blue, #0b79be);
    text-underline-offset: 8px;
    text-decoration-thickness: 2px;
  }

  html[lang="fa-IR"] .sc-site-header--editorial .sc-site-header__logo,
  html[lang="fa-IR"] .sc-site-header--editorial .sc-site-header__logo img,
  html[lang="fa-IR"] .sc-site-header--editorial .custom-logo,
  html[lang="fa-IR"] .sc-site-header--editorial .custom-logo-link {
    display: block;
    inline-size: clamp(162px, 15vw, 198px);
    max-inline-size: 198px;
    block-size: auto;
    max-block-size: 68px;
  }

  html[lang="fa-IR"] .sc-site-header--editorial .sc-nav-toggle {
    display: none;
  }

  html[lang="fa-IR"] .sc-site-header--editorial .sc-site-header__nav,
  html[lang="fa-IR"] .sc-site-header--editorial .sc-site-header__nav:not([hidden]) {
    position: static;
    flex: 1 1 0;
    display: flex;
    flex-flow: row nowrap;
    justify-content: space-between;
    align-items: center;
    min-inline-size: 0;
    inline-size: auto;
    max-block-size: none;
    overflow: visible;
    gap: clamp(8px, 1vw, 15px);
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    animation: none;
  }

  html[lang="fa-IR"] .sc-site-header--editorial .sc-primary-nav {
    flex: 0 1 auto;
    min-inline-size: 0;
  }

  html[lang="fa-IR"] .sc-site-header--editorial .sc-primary-nav__list {
    display: flex;
    flex-flow: row nowrap;
    justify-content: flex-start;
    align-items: center;
    gap: clamp(7px, .95vw, 14px);
    margin: 0;
    padding: 0;
    min-inline-size: 0;
  }

  html[lang="fa-IR"] .sc-site-header--editorial .sc-primary-nav__list > li {
    flex: 0 0 auto;
    position: relative;
    border: 0;
  }

  html[lang="fa-IR"] .sc-site-header--editorial .sc-primary-nav__list > li > a {
    display: inline-flex;
    align-items: center;
    min-block-size: 44px;
    padding: 7px 0;
    /* Approved Persian desktop hierarchy: the previous 12–13.5px labels
       were too small. Typography is responsive, not a miniature nav. */
    font-size: clamp(14px, calc(1.34vw - 2px), 15px);
    line-height: 1.45;
    white-space: nowrap;
    border-radius: 0;
  }

  html[lang="fa-IR"] .sc-site-header--editorial .sc-primary-nav__list .sub-menu {
    position: absolute;
    z-index: 150;
    inset-block-start: 100%;
    inset-inline-start: 0;
    min-inline-size: 245px;
    display: block;
    padding: 8px;
    border: 1px solid var(--sc-color-border);
    border-radius: 3px;
    background: var(--sc-color-surface);
    box-shadow: var(--sc-shadow-md);
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 140ms ease, visibility 140ms ease;
  }

  html[lang="fa-IR"] .sc-site-header--editorial .sc-primary-nav__list > .menu-item-has-children:hover > .sub-menu,
  html[lang="fa-IR"] .sc-site-header--editorial .sc-primary-nav__list > .menu-item-has-children:focus-within > .sub-menu {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }

  html[lang="fa-IR"] .sc-site-header--editorial .sc-primary-nav__list .sub-menu li {
    border: 0;
  }

  html[lang="fa-IR"] .sc-site-header--editorial .sc-primary-nav__list .sub-menu a {
    display: flex;
    min-block-size: 44px;
    padding: 8px 12px;
    white-space: normal;
  }

  html[lang="fa-IR"] .sc-site-header--editorial .sc-site-header__languages,
  html[lang="fa-IR"] .sc-site-header--editorial .sc-language-switcher {
    flex: 0 0 auto;
    inline-size: auto;
    margin: 0;
    padding: 0;
    border: 0;
  }

  html[lang="fa-IR"] .sc-site-header--editorial .sc-language-switcher__list {
    display: flex;
    flex-wrap: nowrap;
    gap: 3px;
  }

  html[lang="fa-IR"] .sc-site-header--editorial .sc-language-switcher__link {
    min-inline-size: 26px;
    min-block-size: 42px;
    padding-inline: 2px;
    font-size: 12px;
  }
}

/* Nested research destinations must remain readable alongside enlarged
 * primary labels, without changing the approved dropdown structure. */
@media (min-width: 1024px) {
  html[lang="fa-IR"] .sc-site-header--editorial .sc-primary-nav__list .sub-menu a {
    font-size: 13.5px;
    line-height: 1.5;
  }
}

/* The original >=1440px fidelity layer also used 13–14px labels.
 * Set a readable middle-ground for Persian navigation alone; EN/RU reference layouts are untouched. */
@media (min-width: 1440px) {
  html[lang="fa-IR"] .sc-site-header--editorial .sc-primary-nav__list > li > a {
    font-size: 15px;
    line-height: 1.4;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[lang="fa-IR"] .sc-site-header--editorial .sc-primary-nav__list .sub-menu {
    transition: none;
  }
}
