/**
 * Шапка — Figma 2_index_1440 / 1_index_1900, высота 138px.
 * .header: padding-top 26 (y=0…26), без padding-bottom.
 * .header__top: 56px (y=26…82).
 * .header__inner: 56px (y=82…138), полоса Rectangle 2 с y=100, меню Frame 720 y=118 h=20.
 */

@media (min-width: 1280px) {
  .header {
    box-sizing: border-box;
    min-height: 138px;
    height: 138px;
    max-height: 138px;
    padding-top: 26px;
    padding-bottom: 0;
    box-shadow: none;
    border-bottom: 1px solid var(--c-line);
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  .header > .container.header__top,
  .header > .container.header__inner {
    padding: 0 120px !important;
    box-sizing: border-box;
    max-width: none;
    width: 100%;
    margin: 0;
  }

  .header > .container.header__top {
    position: relative;
    z-index: 3;
    flex: 0 0 56px;
    border-bottom: 0;
  }

  .header > .container.header__inner {
    position: relative;
    z-index: 2;
    flex: 0 0 56px;
    overflow: visible;
  }

  /* Верхняя строка — одна линия по центру (56px) */
  .header__top {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    height: 56px;
    min-height: 56px;
    max-height: 56px;
    padding: 0 !important;
    margin: 0;
    border-bottom: 0 !important;
    flex: 0 0 56px;
    gap: 0;
  }

  .header__top .logo {
    flex: 0 0 240px;
    width: 240px;
    max-width: 240px;
    margin: 0 47px 0 0;
    min-width: 0;
    align-self: center;
  }

  .header__top .logo__img.logo__img--home-strip {
    display: block;
    width: 240px;
    height: 31px;
    max-width: 240px;
    max-height: 31px;
  }

  .header__top .header__contact {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    flex: 0 0 185px !important;
    width: 185px;
    max-width: 185px;
    min-width: 185px;
    margin: 0 47px 0 0;
    text-align: left !important;
    align-self: center;
    overflow: hidden;
  }

  .header__contact-label {
    font-family: var(--font);
    font-size: 12px;
    font-weight: 500;
    line-height: 15px;
    color: #686a73;
    margin: 0 0 2px;
    white-space: nowrap;
  }

  .header__top .header__contact-phone {
    font-family: var(--font);
    font-size: 24px;
    font-weight: 500;
    line-height: 29px;
    letter-spacing: 0;
    color: #0d0d0d;
  }

  .header__rst {
    flex: 0 0 50px;
    width: 50px;
    height: 50px;
    margin: 0 71px 0 0;
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .header__rst img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    display: block;
  }

  .header__search {
    flex: 0 0 229px;
    width: 229px;
    max-width: 229px;
    min-width: 229px;
    height: 42px;
    min-height: 42px;
    max-height: 42px;
    margin: 0 72px 0 0;
    padding: 0 14px 0 19px;
    border: 0 !important;
    border-radius: 50px;
    background: #f5f5f5 !important;
    box-sizing: border-box;
    align-self: center;
    position: relative;
    z-index: 4;
  }

  .header__search input {
    padding: 0;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 500;
    line-height: normal;
    color: #0d0d0d;
  }

  .header__search input::placeholder {
    color: #686a73;
    font-weight: 500;
  }

  .header__top .header__search-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 0;
    background: transparent !important;
    background-color: transparent !important;
    color: inherit;
  }

  .header__top .header__search-btn:hover {
    background: transparent !important;
    opacity: 0.75;
  }

  .header__search-icon {
    width: 20px;
    height: 20px;
    max-width: 20px;
    max-height: 20px;
    object-fit: contain;
    display: block;
    opacity: 1;
  }

  .header__utilities {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    margin: 0;
    min-width: 0;
    align-self: center;
    height: 42px;
  }

  .header__lang {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin: 0;
  }

  .header__lang-btn {
    width: 50px !important;
    min-width: 50px !important;
    height: 50px !important;
    min-height: 50px !important;
    max-width: 50px !important;
    max-height: 50px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }

  /* Перебиваем стили из styles.css: более специфично (.header__top .header__lang-btn) */
  .header__top .header__lang-btn {
    width: 50px !important;
    min-width: 50px !important;
    height: 50px !important;
    min-height: 50px !important;
    max-width: 50px !important;
    max-height: 50px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    place-items: center !important;
    box-sizing: border-box;
  }

  .header__lang-inner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 6px;
    line-height: 0;
  }

  .header__flag {
    display: block;
    width: 35px;
    height: 20px;
    max-width: 35px;
    max-height: 20px;
    object-fit: contain;
    object-position: center center;
  }

  .header__lang-chevron {
    width: 6px;
    height: 3px;
    max-width: 6px;
    max-height: 3px;
    flex-shrink: 0;
    display: block;
    object-fit: contain;
  }

  .header__quick {
    display: inline-flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
    height: 42px;
  }

  /* Кружки a11y / карта сайта / ЛК = высота поля поиска (42px) */
  .header__quick-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    max-width: 42px;
    max-height: 42px;
    padding: 0;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    box-sizing: border-box;
    overflow: hidden;
  }

  .header__quick-btn--search {
    display: none !important;
  }

  .header__quick-img,
  .header__quick-btn--search .header__quick-img--search {
    width: 42px !important;
    height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;
    object-fit: contain;
    object-position: center center;
    display: block;
  }

  /* Нижняя зона 56px: Frame 720 — текст по центру полосы (Figma y=118, h=20 в band 56px) */
  .header__inner {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: stretch;
    gap: 0;
    height: 56px;
    min-height: 56px;
    max-height: 56px;
    margin: 0;
    padding: 18px 0 0 !important;
    border-bottom: 0;
    box-sizing: border-box;
    background: transparent;
    box-shadow: none;
  }

  /* Figma: 18px между верхней строкой (y=82) и полосой Rectangle 2 (y=100) */
  .header__inner::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 18px;
    bottom: 0;
    pointer-events: none;
    box-shadow: 0 -5px 15px rgba(57, 59, 65, 0.1);
    z-index: 0;
  }

  .header__inner .nav {
    position: relative;
    z-index: 2;
    display: flex;
    flex: 1 1 100%;
    align-self: stretch;
    width: 100%;
    max-width: none;
    min-width: 0;
    height: 20px;
    min-height: 20px;
    max-height: 20px;
    margin: 0 !important;
    padding: 0;
    justify-content: space-between;
    align-items: center;
    gap: 0;
    flex-wrap: nowrap;
    box-sizing: border-box;
  }

  .header__inner .nav__item {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 20px;
  }

  .header__inner .nav__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0 !important;
    margin: 0;
    height: 20px;
    min-height: 20px;
    font-family: var(--font);
    font-size: 16px;
    font-weight: 500;
    line-height: 20px;
    color: #020203;
    text-align: center;
    white-space: nowrap;
    background: transparent;
    box-sizing: border-box;
  }

  .header__inner .nav__link svg {
    display: none !important;
  }

  .header__inner .nav__link:hover,
  .header__inner .nav__item.is-active > .nav__link {
    opacity: 0.75;
    background: transparent;
    color: #0d0d0d;
  }

}

/* Планшет 1024–1279: двухрядная шапка без бургера, гибкий поиск */
@media (min-width: 1024px) and (max-width: 1279px) {
  .header {
    box-sizing: border-box;
    min-height: 156px;
    height: 156px;
    max-height: 156px;
    padding-top: 26px;
    padding-bottom: 18px;
    box-shadow: none;
    border-bottom: 1px solid var(--c-line);
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  .header > .container.header__top,
  .header > .container.header__inner {
    padding: 0 clamp(24px, 4vw, 40px) !important;
    box-sizing: border-box;
    max-width: none;
    width: 100%;
    margin: 0;
  }

  .header > .container.header__top {
    position: relative;
    z-index: 3;
    flex: 0 0 56px;
    border-bottom: 0;
  }

  .header > .container.header__inner {
    position: relative;
    z-index: 2;
    flex: 0 0 56px;
    overflow: visible;
  }

  .header__top {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    height: 56px;
    min-height: 56px;
    max-height: 56px;
    padding: 0 !important;
    margin: 0;
    border-bottom: 0 !important;
    flex: 0 0 56px;
    gap: clamp(8px, 1.2vw, 14px);
    min-width: 0;
  }

  .header__top .logo {
    flex: 0 1 auto;
    width: clamp(140px, 18vw, 185px);
    max-width: 185px;
    min-width: 0;
    margin: 0;
    align-self: center;
  }

  .header__top .logo__img.logo__img--home-strip {
    display: block;
    width: 100%;
    max-width: 185px;
    height: auto;
    max-height: 24px;
    object-fit: contain;
    object-position: left center;
  }

  .header__top .header__contact {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    flex: 0 1 auto;
    width: auto;
    min-width: 0;
    max-width: 9.5rem;
    margin: 0;
    text-align: left !important;
    align-self: center;
    overflow: hidden;
  }

  .header__contact-label {
    font-family: var(--font);
    font-size: 10px;
    font-weight: 500;
    line-height: 12px;
    color: #686a73;
    margin: 0 0 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .header__top .header__contact-phone {
    font-family: var(--font);
    font-size: clamp(14px, 1.6vw, 17px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0;
    color: #0d0d0d;
    white-space: nowrap;
  }

  .header__rst {
    display: none;
  }

  .header__search {
    flex: 1 1 0 !important;
    width: auto;
    min-width: 0 !important;
    max-width: none !important;
    height: 42px;
    min-height: 42px;
    max-height: 42px;
    margin: 0;
    padding: 0 12px 0 16px;
    border: 0 !important;
    border-radius: 50px;
    background: #f5f5f5 !important;
    box-sizing: border-box;
    align-self: center;
    position: relative;
    z-index: 4;
  }

  .header__search input {
    padding: 0;
    min-width: 0;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 500;
    line-height: normal;
    color: #0d0d0d;
  }

  .header__search input::placeholder {
    color: #686a73;
    font-weight: 500;
  }

  .header__top .header__search-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 0;
    background: transparent !important;
    background-color: transparent !important;
    color: inherit;
    flex-shrink: 0;
  }

  .header__search-icon {
    width: 18px;
    height: 18px;
    max-width: 18px;
    max-height: 18px;
    object-fit: contain;
    display: block;
    opacity: 1;
  }

  .header__utilities {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(6px, 0.9vw, 10px);
    margin: 0;
    min-width: 0 !important;
    align-self: center;
    height: 42px;
  }

  .header__lang {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin: 0;
  }

  .header__lang-btn,
  .header__top .header__lang-btn {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box;
  }

  .header__lang-inner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 4px;
    line-height: 0;
  }

  .header__flag {
    display: block;
    width: 32px;
    height: 18px;
    max-width: 32px;
    max-height: 18px;
    object-fit: contain;
    object-position: center center;
  }

  .header__lang-chevron {
    width: 6px;
    height: 3px;
    max-width: 6px;
    max-height: 3px;
    flex-shrink: 0;
    display: block;
    object-fit: contain;
  }

  .header__quick {
    display: inline-flex;
    align-items: center;
    gap: clamp(6px, 0.9vw, 10px);
    flex-shrink: 0;
    height: 42px;
  }

  .header__quick-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    max-width: 36px;
    max-height: 36px;
    padding: 0;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    box-sizing: border-box;
    overflow: hidden;
  }

  .header__quick-btn--search {
    display: none !important;
  }

  .header__quick-img,
  .header__quick-btn--search .header__quick-img--search {
    width: 30px !important;
    height: 30px !important;
    max-width: 30px !important;
    max-height: 30px !important;
    object-fit: contain;
    object-position: center center;
    display: block;
  }

  .header__inner {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: stretch;
    gap: 0;
    height: 56px;
    min-height: 56px;
    max-height: 56px;
    margin: 0;
    padding: 18px 0 0 !important;
    border-bottom: 0;
    box-sizing: border-box;
    background: transparent;
    box-shadow: none;
  }

  .header__inner::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 18px;
    bottom: 0;
    pointer-events: none;
    box-shadow: 0 -5px 15px rgba(57, 59, 65, 0.1);
    z-index: 0;
  }

  .header__inner .nav {
    position: relative;
    z-index: 2;
    display: flex;
    flex: 1 1 100%;
    align-self: stretch;
    width: 100%;
    max-width: none;
    min-width: 0;
    height: 20px;
    min-height: 20px;
    max-height: 20px;
    margin: 0 !important;
    padding: 0;
    justify-content: space-between;
    align-items: center;
    gap: clamp(4px, 0.6vw, 8px);
    flex-wrap: nowrap;
    box-sizing: border-box;
  }

  .header__inner .nav__item {
    flex: 0 1 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 20px;
    min-width: 0;
  }

  .header__inner .nav__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0 !important;
    margin: 0;
    height: 20px;
    min-height: 20px;
    font-family: var(--font);
    font-size: clamp(12px, 1.25vw, 14px);
    font-weight: 500;
    line-height: 20px;
    color: #020203;
    text-align: center;
    white-space: nowrap;
    background: transparent;
    box-sizing: border-box;
  }

  .header__inner .nav__link svg {
    display: none !important;
  }

  .header__inner .nav__link:hover,
  .header__inner .nav__item.is-active > .nav__link {
    opacity: 0.75;
    background: transparent;
    color: #0d0d0d;
  }
}

@media (min-width: 1900px) {
  .header > .container.header__top,
  .header > .container.header__inner {
    padding-inline: 120px;
  }

  /* Figma Frame 720 @1900: 1677px, justify-between (node 12974:11196 / 10006:9903) */
  .header__inner .nav {
    width: 100%;
    max-width: 1677px;
    margin-inline: 0 !important;
    justify-content: space-between;
  }

  .header__top .logo {
    margin-right: 130px;
  }

  .header__top .header__contact {
    margin-right: 130px;
  }

  .header__rst {
    margin-right: 130px;
  }

  .header__search {
    flex: 0 0 423px;
    width: 423px;
    max-width: 423px;
    min-width: 423px;
    margin-right: 130px;
  }

}

@media (min-width: 1024px) and (max-width: 1439px) {
  .header > .container.header__top,
  .header > .container.header__inner {
    padding: 0 clamp(40px, calc((100vw - 1200px) / 2), 120px) !important;
  }

  .header__inner .nav {
    width: 100%;
    max-width: none;
  }
}

/* Figma 1_index_1900 / внутренние L1: шапка 138px + 18px зазор до контента (y=156) */
@media (min-width: 1024px) {
  .header {
    min-height: 156px;
    height: 156px;
    max-height: 156px;
    padding-bottom: 18px;
    box-sizing: border-box;
  }
}

/* Language selector dropdown & Mobile switch */
.header__lang {
  position: relative;
}
.header__lang-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #ffffff;
  border: 1px solid #e8eaef;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 220ms ease, transform 220ms ease, visibility 220ms ease;
  z-index: 450;
  min-width: 110px;
}
.header__lang.is-open .header__lang-dropdown,
.header__lang:hover .header__lang-dropdown,
.header__lang:focus-within .header__lang-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.header__lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #333333;
  transition: background 150ms ease, color 150ms ease;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
}
.header__lang-option:hover {
  background: #f1f3f7;
  color: var(--c-brand);
}
.header__lang-option.is-active {
  background: rgba(0, 40, 100, 0.08);
  color: var(--c-brand);
  font-weight: 600;
}
.header__lang-option img {
  border-radius: 2px;
  object-fit: cover;
  display: block;
  width: 24px;
  height: 14px;
}

.mobile-panel__lang-wrap {
  margin-top: auto;
  padding: 24px 20px;
  border-top: 1px solid var(--c-line);
  background: #f8f9fa;
  display: flex;
  justify-content: center;
}

/* Audit fixes (2026-06-18): cross-page spacing/layout normalization. */
@media (min-width: 1024px) and (max-width: 1279px) {
  /* Standardization hero: fluid catalog inside 1024px viewport (no 1200px overflow). */
  body.page-standardization .hero--standardization .catalog-block {
    width: 100% !important;
    max-width: 100% !important;
    margin-inline: 0 !important;
  }

  body.page-standardization .catalog-block__tiles.std-grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: clamp(17px, 2.5vw, 33px) !important;
    justify-content: stretch !important;
  }

  body.page-standardization .catalog-block__tiles .std-card {
    width: 100% !important;
    max-width: none !important;
    min-height: 197px !important;
  }

  body.page-standardization .catalog-block__art {
    width: min(200px, 28vw) !important;
  }
}

@media (min-width: 1280px) and (max-width: 1439px) {
  /* Standardization catalog: 4-column rhythm when viewport fits content area. */
  body.page-standardization .hero--standardization .catalog-block {
    width: 100% !important;
    max-width: 1200px !important;
    margin-inline: 0 !important;
  }

  body.page-standardization .catalog-block__tiles.std-grid--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 33px !important;
    justify-content: start !important;
  }

  body.page-standardization .catalog-block__tiles .std-card {
    width: 100% !important;
    max-width: none !important;
    min-height: 197px !important;
  }
}

@media (min-width: 1248px) {
  /* L3 personnel page: restore two-column composition and content width. */
  body.page-certification-voluntary-personnel .section--subpage-l3 > .container.subpage-l3,
  body.page-certification-voluntary-personnel main#main > section#content > .container.subpage-l3 {
    display: grid !important;
    grid-template-columns: 240px minmax(0, 1fr) !important;
    gap: 48px !important;
    max-width: none !important;
    padding-left: max(24px, calc((100vw - 1200px) / 2)) !important;
    padding-right: max(24px, calc((100vw - 1200px) / 2)) !important;
  }

  body.page-certification-voluntary-personnel .section--subpage-l3 .subpage-l3__body {
    grid-column: 2 !important;
    width: 100% !important;
    max-width: none !important;
  }
}

@media (min-width: 1900px) {
  body.page-certification-voluntary-personnel .section--subpage-l3 .subpage-l3__body {
    max-width: 1200px !important;
  }
}

@media (min-width: 1024px) {
  /* Education hero: align typography with inner-page Figma scale. */
  body.page-education .hero--education .hero__title {
    font-size: 36px !important;
    line-height: 1.35 !important;
    letter-spacing: -0.02em !important;
  }

  body.page-education .hero--education .hero__lead {
    font-size: 20px !important;
    line-height: 1.3 !important;
  }
}

/* Audit fixes (2026-06-18): remove vertical drift below first fold. */
@media (min-width: 1024px) {
  body.page-standardization .section--std-defense {
    margin-top: 56px !important;
  }

  body.page-standardization .section--std-sto {
    margin-top: 56px !important;
  }

  body.page-standardization .section--std-tk {
    margin-top: 24px !important;
  }

  body.page-standardization .section--std-compliance {
    margin-top: 40px !important;
  }

  /* Keep dense section rhythm on content-heavy pages. */
  body.page-education #postgraduate,
  body.page-education #dpo,
  body.page-education #arm,
  body.page-education #certification,
  body.page-education #partners,
  body.page-education #conferences,
  body.page-education #publications,
  body.page-science #quote,
  body.page-science #research,
  body.page-science #ckp,
  body.page-science #nir,
  body.page-science #council,
  body.page-science #publications,
  body.page-science #conferences,
  body.page-science #featured-event,
  body.page-science #international,
  body.page-science #postgraduate,
  body.page-science #competition {
    margin-top: 0 !important;
  }
}
