/* EOSP Chancery Masthead — active release layer.
 * This stylesheet intentionally loads last. It translates the approved footer
 * to the upper edge without introducing cards, dividers, or a second identity.
 */

@media (min-width: 1181px) {
  :root {
    --eosp-chancery-header-height: 118px;
    --cerax-approved-header-height: 118px;
  }

  html:not([dir]) body.eosp-chancery-header .desktop-header,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header {
    box-sizing: border-box !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 60 !important;
    display: grid !important;
    grid-template-columns: 92px minmax(0, 1fr) !important;
    grid-template-rows: 1fr !important;
    grid-template-areas: "brand nav" !important;
    column-gap: 28px !important;
    row-gap: 0 !important;
    align-content: center !important;
    align-items: center !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 118px !important;
    min-height: 118px !important;
    margin: 0 !important;
    padding: 13px calc(280px + 22px) 13px clamp(34px, 2.7vw, 54px) !important;
    overflow: hidden !important;
    background: #031a30 !important;
    border: 0 !important;
    border-top: 2px solid #b57b2f !important;
    border-bottom: 1px solid rgba(181, 123, 47, .82) !important;
    box-shadow: none !important;
  }

  html[dir="rtl"] body.eosp-chancery-header .desktop-header {
    grid-template-columns: minmax(0, 1fr) 92px !important;
    grid-template-areas: "nav brand" !important;
    padding: 13px clamp(34px, 2.7vw, 54px) 13px calc(280px + 42px) !important;
  }

  body.eosp-chancery-header .desktop-header::before,
  body.eosp-chancery-header .desktop-header::after,
  body.eosp-chancery-header .desktop-header .desktop-brand::before,
  body.eosp-chancery-header .desktop-header .desktop-brand::after {
    display: none !important;
    content: none !important;
  }

  html:not([dir]) body.eosp-chancery-header .desktop-header .desktop-brand,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .desktop-brand {
    grid-area: brand !important;
    z-index: 1 !important;
    display: block !important;
    align-self: center !important;
    justify-self: start !important;
    width: 92px !important;
    min-width: 92px !important;
    height: 92px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: transparent !important;
    border: 0 !important;
    border-inline-end: 0 !important;
    box-shadow: none !important;
  }

  html[dir="rtl"] body.eosp-chancery-header .desktop-header .desktop-brand { justify-self: end !important; }

  html:not([dir]) body.eosp-chancery-header .desktop-header .desktop-crest-image,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .desktop-crest-image {
    display: block !important;
    width: 92px !important;
    height: 92px !important;
    margin: 0 !important;
    padding: 0 !important;
    object-fit: contain !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    filter: none !important;
  }

  html:not([dir]) body.eosp-chancery-header .desktop-header .desktop-wordmark,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .desktop-wordmark,
  html:not([dir]) body.eosp-chancery-header .desktop-header .desktop-tools,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .desktop-tools { display: none !important; }

  html:not([dir]) body.eosp-chancery-header .desktop-header .desktop-primary,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .desktop-primary {
    grid-area: nav !important;
    z-index: 2 !important;
    position: static !important;
    display: grid !important;
    grid-template-columns: 1.19fr 1.21fr 1.13fr 1fr 1.44fr 1.15fr .64fr !important;
    grid-template-rows: auto !important;
    align-self: center !important;
    align-items: start !important;
    justify-items: center !important;
    justify-self: center !important;
    width: min(100%, 72vw) !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: clamp(6px, .55vw, 10px) !important;
    overflow: visible !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  html[dir="rtl"] body.eosp-chancery-header .desktop-header .desktop-primary { justify-items: center !important; }

  html:not([dir]) body.eosp-chancery-header .desktop-header .desktop-primary > a,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .desktop-primary > a {
    position: static !important;
    box-sizing: border-box !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    color: #cda65d !important;
    font-family: Georgia, "Times New Roman", serif !important;
    font-size: inherit !important;
    font-weight: 400 !important;
    line-height: normal !important;
    text-align: center !important;
    text-decoration: none !important;
    text-transform: none !important;
    white-space: normal !important;
    background: transparent !important;
    border: 0 !important;
    border-inline-start: 0 !important;
    border-inline-end: 0 !important;
    border-block-end: 0 !important;
    box-shadow: none !important;
  }

  html:not([dir]) body.eosp-chancery-header .desktop-header .desktop-primary > a::before,
  html:not([dir]) body.eosp-chancery-header .desktop-header .desktop-primary > a::after,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .desktop-primary > a::before,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .desktop-primary > a::after {
    display: none !important;
    content: none !important;
  }

  html:not([dir]) body.eosp-chancery-header .desktop-header .desktop-primary > a + a,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .desktop-primary > a + a {
    border-inline-start: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
  }

  html:not([dir]) body.eosp-chancery-header .desktop-header .eosp-nav-title,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .eosp-nav-title {
    display: block !important;
    min-width: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    color: #cda65d !important;
    font-family: Georgia, "Times New Roman", serif !important;
    font-size: clamp(10px, .9vw, 11.5px) !important;
    font-weight: 400 !important;
    line-height: 1.18 !important;
    letter-spacing: 0 !important;
    text-align: center !important;
    text-overflow: clip !important;
    text-transform: none !important;
    white-space: nowrap !important;
  }

  html:not([dir]) body.eosp-chancery-header .desktop-header .eosp-nav-meta,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .eosp-nav-meta {
    display: block !important;
    min-width: 0 !important;
    margin: 8px 0 0 !important;
    overflow: visible !important;
    color: #ad8540 !important;
    font-family: Georgia, "Times New Roman", serif !important;
    font-size: clamp(6.4px, .55vw, 7px) !important;
    font-weight: 400 !important;
    line-height: 1.2 !important;
    letter-spacing: 0 !important;
    text-align: center !important;
    text-overflow: clip !important;
    text-transform: uppercase !important;
    white-space: nowrap !important;
  }

  html[dir="rtl"] body.eosp-chancery-header .desktop-header .desktop-primary > a,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .eosp-nav-title,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .eosp-nav-meta {
    font-family: "IBM Plex Sans Arabic", "Noto Kufi Arabic", Tahoma, Arial, sans-serif !important;
    letter-spacing: 0 !important;
    text-align: center !important;
    text-transform: none !important;
  }

  html[dir="rtl"] body.eosp-chancery-header .desktop-header .eosp-nav-title { font-size: clamp(10px, .9vw, 11.5px) !important; font-weight: 600 !important; line-height: 1.28 !important; }
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .eosp-nav-meta { font-size: clamp(6px, .51vw, 6.7px) !important; line-height: 1.28 !important; }

  body.eosp-chancery-header .desktop-header[data-active] .desktop-primary > a,
  body.eosp-chancery-header .desktop-header .desktop-primary > a:hover,
  body.eosp-chancery-header .desktop-header .desktop-primary > a:focus-visible { border-block-end-color: transparent !important; outline: none !important; }

  html:not([dir]) body.eosp-chancery-header .desktop-header .eosp-header-secondary,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .eosp-header-secondary {
    display: none !important;
  }

  html:not([dir]) body.eosp-chancery-header .desktop-header .eosp-header-palace,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .eosp-header-palace {
    position: absolute !important;
    z-index: 0 !important;
    inset-inline-end: 0 !important;
    bottom: 0 !important;
    display: block !important;
    width: 280px !important;
    max-width: 21.875vw !important;
    height: 118px !important;
    margin: 0 !important;
    padding: 0 !important;
    object-fit: fill !important;
    object-position: center bottom !important;
    opacity: 1 !important;
    pointer-events: none !important;
    border: 0 !important;
    filter: none !important;
    -webkit-mask-image: none !important;
    mask-image: none !important;
  }

  html[dir="rtl"] body.eosp-chancery-header .desktop-header .eosp-header-palace {
    left: 0 !important;
    right: auto !important;
    inset-inline-end: auto !important;
    transform: scaleX(-1) !important;
  }

  body.eosp-chancery-header .desktop-header::after {
    content: "" !important;
    display: block !important;
    position: absolute !important;
    inset: 0 0 0 auto !important;
    z-index: 1 !important;
    width: 340px !important;
    pointer-events: none !important;
    background: linear-gradient(90deg, #031a30 0%, #031a30 9%, rgba(3, 26, 48, .88) 24%, rgba(3, 26, 48, .30) 55%, rgba(3, 26, 48, 0) 78%) !important;
  }

  html[dir="rtl"] body.eosp-chancery-header .desktop-header::after {
    inset: 0 auto 0 0 !important;
    background: linear-gradient(270deg, #031a30 0%, #031a30 9%, rgba(3, 26, 48, .88) 24%, rgba(3, 26, 48, .30) 55%, rgba(3, 26, 48, 0) 78%) !important;
  }

  body.eosp-chancery-header .desktop-header .desktop-brand { z-index: 2 !important; }
  body.eosp-chancery-header .site-mega-menu { top: 118px !important; max-height: calc(100vh - 118px) !important; }
  body.eosp-chancery-header .site-mega-scrim { inset: 118px 0 0 !important; }
  body.eosp-chancery-header [id] { scroll-margin-top: 132px !important; }
}

/* The mobile masthead keeps the same navy-and-gold chancery identity while
 * reserving its limited width for the official seal, language switcher and
 * menu.  It is intentionally a compact counterpart to the desktop panel. */
@media (max-width: 1180px) {
  :root {
    --eosp-chancery-header-height: 72px;
    --cerax-approved-header-height: 72px;
  }

  html:not([dir]) body.eosp-chancery-header .mobile-header,
  html[dir="rtl"] body.eosp-chancery-header .mobile-header {
    box-sizing: border-box !important;
    height: 72px !important;
    min-height: 72px !important;
    padding: 0 clamp(14px, 4vw, 22px) !important;
    background: #031a30 !important;
    border-top: 2px solid #b57b2f !important;
    border-bottom: 1px solid rgba(181, 123, 47, .82) !important;
    box-shadow: none !important;
  }

  html:not([dir]) body.eosp-chancery-header .mobile-header .brand,
  html[dir="rtl"] body.eosp-chancery-header .mobile-header .brand {
    gap: 10px !important;
  }

  html:not([dir]) body.eosp-chancery-header .mobile-header .mobile-crest-image,
  html[dir="rtl"] body.eosp-chancery-header .mobile-header .mobile-crest-image,
  html:not([dir]) body.eosp-chancery-header .mobile-menu .mobile-crest-image,
  html[dir="rtl"] body.eosp-chancery-header .mobile-menu .mobile-crest-image {
    box-sizing: border-box !important;
    width: 52px !important;
    height: 52px !important;
    padding: 0 !important;
    object-fit: contain !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    filter: none !important;
  }

  html:not([dir]) body.eosp-chancery-header .mobile-header .brand .wordmark small,
  html[dir="rtl"] body.eosp-chancery-header .mobile-header .brand .wordmark small,
  html:not([dir]) body.eosp-chancery-header .mobile-menu .wordmark small,
  html[dir="rtl"] body.eosp-chancery-header .mobile-menu .wordmark small {
    color: #cda65d !important;
    font-size: 11px !important;
    font-weight: 600 !important;
  }

  html:not([dir]) body.eosp-chancery-header .mobile-header .mobile-actions,
  html[dir="rtl"] body.eosp-chancery-header .mobile-header .mobile-actions {
    gap: 10px !important;
  }

  html:not([dir]) body.eosp-chancery-header .mobile-header .mobile-actions > a,
  html[dir="rtl"] body.eosp-chancery-header .mobile-header .mobile-actions > a {
    color: #cda65d !important;
    font-family: Georgia, "Times New Roman", serif !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    letter-spacing: .04em !important;
  }

  html[dir="rtl"] body.eosp-chancery-header .mobile-header .mobile-actions > a {
    font-family: "IBM Plex Sans Arabic", "Noto Kufi Arabic", Tahoma, Arial, sans-serif !important;
    letter-spacing: 0 !important;
  }

  html:not([dir]) body.eosp-chancery-header .mobile-header .hamburger,
  html[dir="rtl"] body.eosp-chancery-header .mobile-header .hamburger {
    box-sizing: border-box !important;
    display: grid !important;
    width: 40px !important;
    height: 38px !important;
    padding: 0 !important;
    place-content: center !important;
    gap: 4px !important;
    background: transparent !important;
    border: 1px solid #b57b2f !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  html:not([dir]) body.eosp-chancery-header .mobile-header .hamburger i,
  html[dir="rtl"] body.eosp-chancery-header .mobile-header .hamburger i {
    display: block !important;
    width: 17px !important;
    height: 1px !important;
    margin: 0 !important;
    background: #cda65d !important;
  }

  html:not([dir]) body.eosp-chancery-header .mobile-menu,
  html[dir="rtl"] body.eosp-chancery-header .mobile-menu,
  html:not([dir]) body.eosp-chancery-header .mobile-menu .menu-head,
  html[dir="rtl"] body.eosp-chancery-header .mobile-menu .menu-head,
  html:not([dir]) body.eosp-chancery-header .mobile-menu .mobile-mega-panels,
  html[dir="rtl"] body.eosp-chancery-header .mobile-menu .mobile-mega-panels {
    background: #031a30 !important;
  }

  html:not([dir]) body.eosp-chancery-header .mobile-menu .menu-head,
  html[dir="rtl"] body.eosp-chancery-header .mobile-menu .menu-head {
    min-height: 72px !important;
    padding: 10px clamp(14px, 4vw, 22px) !important;
    border-bottom: 1px solid rgba(181, 123, 47, .82) !important;
  }

  html:not([dir]) body.eosp-chancery-header .mobile-menu .menu-links > a,
  html[dir="rtl"] body.eosp-chancery-header .mobile-menu .menu-links > a {
    color: #dec078 !important;
    font-family: Georgia, "Times New Roman", serif !important;
    border-bottom-color: rgba(181, 123, 47, .48) !important;
  }

  html[dir="rtl"] body.eosp-chancery-header .mobile-menu .menu-links > a {
    font-family: "IBM Plex Sans Arabic", "Noto Kufi Arabic", Tahoma, Arial, sans-serif !important;
  }

  html:not([dir]) body.eosp-chancery-header .mobile-menu .menu-links > a span,
  html[dir="rtl"] body.eosp-chancery-header .mobile-menu .menu-links > a span {
    color: #ad8540 !important;
  }

  html:not([dir]) body.eosp-chancery-header .mobile-menu .menu-close,
  html[dir="rtl"] body.eosp-chancery-header .mobile-menu .menu-close {
    color: #cda65d !important;
    background: transparent !important;
    border: 1px solid #b57b2f !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
}

@media (max-width: 360px) {
  html:not([dir]) body.eosp-chancery-header .mobile-header .brand .wordmark,
  html[dir="rtl"] body.eosp-chancery-header .mobile-header .brand .wordmark {
    display: none !important;
  }
}

/* GLOBAL 1.3.0 RELEASE LAYER
 * This is printed after the theme's Custom CSS, so the same approved header
 * wins on every public page and archive rather than only on uncached views.
 * A restrained language control uses a short upper row and leaves the seven
 * approved navigation groups their full horizontal space. */
@media (min-width: 1181px) {
  :root {
    --eosp-chancery-header-height: 118px;
    --cerax-approved-header-height: 118px;
  }

  html:not([dir]) body.eosp-chancery-header .desktop-header,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header {
    grid-template-columns: 92px minmax(0, 1fr) !important;
    grid-template-rows: 22px minmax(0, 1fr) !important;
    grid-template-areas: "brand tools" "brand nav" !important;
    align-content: stretch !important;
    align-items: stretch !important;
    column-gap: 28px !important;
    row-gap: 0 !important;
  }

  html[dir="rtl"] body.eosp-chancery-header .desktop-header {
    grid-template-columns: minmax(0, 1fr) 92px !important;
    grid-template-areas: "tools brand" "nav brand" !important;
  }

  html:not([dir]) body.eosp-chancery-header .desktop-header .desktop-brand,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .desktop-brand {
    align-self: center !important;
  }

  html:not([dir]) body.eosp-chancery-header .desktop-header .desktop-primary,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .desktop-primary {
    align-self: center !important;
    justify-self: center !important;
  }

  html:not([dir]) body.eosp-chancery-header .desktop-header .desktop-tools,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .desktop-tools {
    grid-area: tools !important;
    z-index: 3 !important;
    display: flex !important;
    align-items: center !important;
    align-self: start !important;
    justify-content: flex-end !important;
    justify-self: end !important;
    width: auto !important;
    min-width: 0 !important;
    height: 22px !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
    overflow: visible !important;
    background: transparent !important;
    border: 0 !important;
  }

  html:not([dir]) body.eosp-chancery-header .desktop-header .desktop-tools .desktop-search,
  html:not([dir]) body.eosp-chancery-header .desktop-header .desktop-tools .desktop-contact,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .desktop-tools .desktop-search,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .desktop-tools .desktop-contact {
    display: none !important;
  }

  html:not([dir]) body.eosp-chancery-header .desktop-header .desktop-tools .desktop-language,
  html[dir="rtl"] body.eosp-chancery-header .desktop-header .desktop-tools .desktop-language {
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 22px !important;
    margin: 0 !important;
    padding: 0 0 0 10px !important;
    color: #dec078 !important;
    background: transparent !important;
    border: 0 !important;
    border-inline-start: 1px solid rgba(181, 123, 47, .72) !important;
    font-family: Georgia, "Times New Roman", serif !important;
    font-size: 9px !important;
    font-weight: 600 !important;
    letter-spacing: .035em !important;
    line-height: 1 !important;
    text-decoration: none !important;
    text-transform: none !important;
    white-space: nowrap !important;
  }

  html[dir="rtl"] body.eosp-chancery-header .desktop-header .desktop-tools .desktop-language {
    padding: 0 10px 0 0 !important;
    font-family: "IBM Plex Sans Arabic", "Noto Kufi Arabic", Tahoma, Arial, sans-serif !important;
    letter-spacing: 0 !important;
  }

  body.eosp-chancery-header .desktop-header .desktop-tools .desktop-language:hover,
  body.eosp-chancery-header .desktop-header .desktop-tools .desktop-language:focus-visible {
    color: #f0c876 !important;
    outline: none !important;
  }
}
