/* ==========================================================================
   Adilet.kz — site header
   Utility strip over a sticky main bar with a standing search field.
   Reworked 2026-09-09; the markup contract is the {% comment %} at the top of
   templates/core/base.html and core/tests/test_navbar.py.

   Loaded AFTER style.css. Everything the old header styled has been moved
   here — style.css no longer carries a header rule — so this file is the one
   place to change the bar. Palette is unchanged: the #730C0B band, #5C0A0A for
   the strip and tabs, #F2C93E for the active accent, white text.

   Three things here are load-bearing:

   1. <header> is the sticky element and it sticks at a NEGATIVE top: minus the
      utility strip's height, so the strip rolls off and the bar alone stays
      pinned. Making .header-top sticky instead does not work — a sticky box is
      confined to its parent's, and <header> is only ~100px tall, so the bar
      unpins the moment you scroll past it. That is also why the search row, the
      drawer and the listings sub-menu are siblings of <header> rather than
      children: anything left inside gets pinned along with the bar.

   2. --app-header-h is the bar's measured height, written by navbar.js. Sticky
      sidebars in style.css and the law reader's docbar offset read it. The
      values declared here are only the pre-JS fallback; do not treat them as
      the source of truth.

   3. The active nav item is marked by a gold underline AND a weight change.
      The predecessor set a transparent background and the same weight, which
      is why nothing on the site showed where you were.
   ========================================================================== */

:root {
    --nav-band: #730c0b;
    --nav-band-deep: #5c0a0a;
    --nav-accent: #f2c93e;
    --nav-on-band: #ffffff;
    --nav-on-band-dim: rgba(255, 255, 255, 0.74);
    --nav-fill: rgba(255, 255, 255, 0.12);
    --nav-fill-strong: rgba(255, 255, 255, 0.18);
    --nav-hairline: rgba(255, 255, 255, 0.18);

    --nav-bar-h: 64px;

    /* --nav-strip-h is an OUTPUT: navbar.js measures the strip into it and
       .header-main's negative top is its only consumer. Nothing that affects
       the strip's own size may read it — .site-utility-inner did, and each
       measurement then grew the strip it had just measured, one pixel per
       frame, forever. The strip's own height is --nav-strip-min-h. */
    --nav-strip-min-h: 36px;
    --nav-strip-h: 37px;
    --nav-radius: 999px;
}

/* ==========================================================================
   1. Shell
   ========================================================================== */

/* .header-main keeps its name: law-reader.css hides it in @media print and
   law_version_compare.html hides it for the full-screen diff. It also keeps the
   negative-margin bleed that cancels the 50px side padding style.css puts on
   <body>. */
.header-main {
    background: var(--nav-band);
    position: sticky;
    top: calc(-1 * var(--nav-strip-h));
    z-index: 1000;
    width: calc(100% + 100px);
    margin-left: -50px;
    margin-right: -50px;
    padding-left: 50px;
    padding-right: 50px;
    overflow: visible;
}

.header-main .container {
    max-width: 100%;
    width: 100%;
    padding-left: 15px;
    padding-right: 15px;
    overflow: visible;
}

/* ==========================================================================
   2. Utility strip
   Secondary destinations, language, session. Deliberately NOT sticky: none of
   it is needed mid-page, and keeping it out of the sticky block is what lets
   the bar stay 64px. "Register my firm" lives here because it used to render
   only on the lawyers listings, where most visitors never go.
   ========================================================================== */
.site-utility {
    background: var(--nav-band-deep);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.site-utility-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: var(--nav-strip-min-h);
}

.site-utility-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    min-width: 0;
    flex: 1 1 auto;
}

.site-utility-links a {
    color: var(--nav-on-band-dim);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    padding: 0.25rem 0;
    border-bottom: 1px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.site-utility-links a:hover {
    color: var(--nav-on-band);
    border-bottom-color: var(--nav-accent);
}

.site-utility-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 auto;
}

.site-utility-divider {
    width: 1px;
    height: 16px;
    background: var(--nav-hairline);
}

.site-utility-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: transparent;
    border: 0;
    padding: 0.25rem 0.5rem;
    border-radius: var(--nav-radius);
    color: var(--nav-on-band-dim);
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.site-utility-btn:hover {
    color: var(--nav-on-band);
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

/* ==========================================================================
   3. The bar
   ========================================================================== */
.header-top {
    background: var(--nav-band);
}

/* navbar.js adds .is-stuck once the page has scrolled past the strip. The bar
   sits directly on white content, so without this the boundary disappears.
   It goes on the header, whose bottom edge IS the bar's once the strip has
   rolled off. */
.header-main {
    transition: box-shadow 0.18s ease;
}

.header-main.is-stuck {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.site-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: var(--nav-bar-h);
    flex-wrap: nowrap;
}

.site-bar-spacer {
    flex: 1 1 auto;
    min-width: 0.25rem;
}

.navbar-brand-logo {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
    margin-right: 0.25rem;
}

.navbar-brand-logo:hover {
    opacity: 0.92;
}

.navbar-logo-img {
    height: 28px;
    width: auto;
    display: block;
    pointer-events: none;
}

.site-caret {
    font-size: 0.6875rem;
    opacity: 0.7;
}

/* --- All services trigger --- */
.site-services-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--nav-fill);
    border: 0;
    border-radius: var(--nav-radius);
    color: var(--nav-on-band);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 0.875rem;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.site-services-btn:hover,
.site-services-btn[aria-expanded="true"] {
    background: var(--nav-fill-strong);
    color: var(--nav-on-band);
}

/* --- Primary navigation --- */
/* The nav does not shrink and the search field does. Sharing the squeeze
   proportionally is what clipped «Статьи» behind the search pill at 1440px:
   a destination that is half-visible is worse than a field that is 60px
   narrower. Three links is also the most that fits beside the field in
   Russian, where «Законодательство» is twice the width of «Заңнама». */
.site-nav {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    flex: 0 0 auto;
}

.site-nav-link {
    position: relative;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: var(--nav-radius);
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.site-nav-link:hover {
    color: var(--nav-on-band);
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.site-nav-link.active {
    color: var(--nav-on-band);
    font-weight: 650;
    background: rgba(255, 255, 255, 0.13);
}

/* The gold rule is the answer to "which section am I in". It hangs off the
   bottom of the bar, so it must not be clipped: .header-top has no overflow
   rule for exactly this reason. */
.site-nav-link.active::after {
    content: "";
    position: absolute;
    left: 0.75rem;
    right: 0.75rem;
    bottom: -0.75rem;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--nav-accent);
}

/* ==========================================================================
   4. Search
   A plain GET form to core:site_search. The scope select is a native <select>
   on purpose — it is keyboard- and screen-reader-correct for free, which a
   scripted dropdown here would have to re-earn.
   ========================================================================== */
.site-search-slot {
    flex: 0 1 320px;
    min-width: 240px;
}

.site-search {
    display: flex;
    align-items: center;
    width: 100%;
    height: 40px;
    background: #ffffff;
    border-radius: var(--nav-radius);
    padding: 0 0.25rem 0 0.75rem;
    gap: 0.25rem;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.site-search:focus-within {
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06), 0 0 0 3px rgba(242, 201, 62, 0.55);
}

.site-search-scope {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin: 0;
}

.site-search-scope-select {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: #f1eeee;
    border-radius: var(--nav-radius);
    color: #5c4b4b;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.3125rem 1.5rem 0.3125rem 0.625rem;
    cursor: pointer;
    max-width: 8.5rem;
    text-overflow: ellipsis;
}

.site-search-scope-select:focus-visible {
    outline: 2px solid var(--nav-band);
    outline-offset: 1px;
}

.site-search-scope-caret {
    position: absolute;
    right: 0.5rem;
    font-size: 0.625rem;
    color: #8a7a7a;
    pointer-events: none;
}

.site-search-input {
    flex: 1 1 auto;
    /* Not 0. The scope select and the submit button are fixed width, so a
       zero minimum here lets the field shrink until there is no room left to
       type in — which is what it did at 1024px before the field moved to its
       own row below xl. */
    min-width: 5rem;
    border: 0;
    background: transparent;
    font-size: 0.875rem;
    color: #343235;
    padding: 0 0.25rem;
}

.site-search-input::placeholder {
    color: #9b9295;
}

.site-search-input:focus {
    outline: none;
}

/* Chrome and Safari draw their own clear button on type=search; it collides
   with the submit button inside a pill this tight. */
.site-search-input::-webkit-search-decoration,
.site-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.site-search-submit {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: var(--nav-band);
    color: #ffffff;
    display: grid;
    place-items: center;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.site-search-submit:hover {
    background: #8b0000;
}

/* Mobile: the field gets its own row under the bar. It scrolls away with the
   page; only the bar itself is sticky. */
.site-search-row {
    background: var(--nav-band);
    padding-bottom: 0.75rem;
}

.site-search-row .site-search {
    height: 42px;
    /* On a 1199px tablet the row is the full container; a search field that
       wide reads as a page element rather than a control. */
    max-width: 640px;
}

/* ==========================================================================
   5. Account / register
   ========================================================================== */
.site-account {
    flex-shrink: 0;
}

.site-account-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 0;
    border-radius: var(--nav-radius);
    padding: 0.25rem 0.5rem 0.25rem 0.25rem;
    color: var(--nav-on-band);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.site-account-btn:hover,
.site-account-btn[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.12);
}

.site-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
    display: grid;
    place-items: center;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    flex-shrink: 0;
}

.site-account-meta {
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
    max-width: 10rem;
}

.site-account-name {
    font-size: 0.8125rem;
    font-weight: 600;
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-account-role {
    font-size: 0.6875rem;
    color: var(--nav-on-band-dim);
}

.site-register-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--nav-accent);
    border: 0;
    border-radius: var(--nav-radius);
    color: #3d2c00;
    font-size: 0.875rem;
    font-weight: 650;
    padding: 0.5rem 1rem;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s ease;
}

.site-register-btn:hover,
.site-register-btn[aria-expanded="true"] {
    background: #e5b82e;
    color: #3d2c00;
}

.site-account-menu {
    min-width: 232px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
    padding: 0.375rem;
    margin-top: 0.5rem;
}

.site-account-menu-head {
    padding: 0.5rem 0.75rem 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-account-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: #343235;
}

.site-account-menu .dropdown-item i {
    font-size: 1rem;
    color: #8b7f7f;
    width: 1rem;
    text-align: center;
}

.site-account-menu .dropdown-item:hover,
.site-account-menu .dropdown-item:focus {
    background: #f6f3f3;
    color: var(--nav-band);
}

.site-account-menu .dropdown-item:hover i,
.site-account-menu .dropdown-item:focus i {
    color: var(--nav-band);
}

.site-account-menu .site-account-logout:hover,
.site-account-menu .site-account-logout:hover i {
    color: #b3261e;
}

/* ==========================================================================
   6. Language dropdown
   ========================================================================== */
.language-switcher {
    position: relative;
}

.language-dropdown-menu {
    min-width: 190px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
    padding: 0.375rem;
    margin-top: 0.5rem;
}

.language-dropdown-menu .language-form {
    margin: 0;
}

.language-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    border: 0;
    background: transparent;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: #343235;
    text-align: left;
}

.language-item:hover,
.language-item:focus {
    background: #f6f3f3;
    color: var(--nav-band);
}

.language-item.active {
    background: #fdf3f3;
    color: var(--nav-band);
    font-weight: 600;
}

.language-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.language-check {
    color: var(--nav-band);
}

.flag-icon {
    font-size: 1.05rem;
    line-height: 1;
}

/* ==========================================================================
   7. All services mega menu
   Opens on hover (desktop pointer), on click, and on Enter/Space. The
   predecessor was hover-only, which made it unreachable by keyboard and on
   every touchscreen.
   ========================================================================== */
.services-dropdown {
    position: relative;
}

.services-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.625rem);
    left: 0;
    min-width: 680px;
    max-width: 780px;
    background: #ffffff;
    border: 0;
    border-radius: 16px;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
    padding: 0;
    z-index: 1060;
    overflow: hidden;
}

.services-dropdown-menu.show {
    display: block;
}

.services-dropdown-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #efeaea;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.services-dropdown-title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: #343235;
    margin: 0;
}

.services-search-wrapper {
    position: relative;
}

.services-search {
    width: 100%;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    border: 1px solid #e5e0e0;
    border-radius: 10px;
    font-size: 0.9375rem;
    background: #faf8f8;
}

.services-search:focus {
    border-color: var(--nav-band);
    box-shadow: 0 0 0 3px rgba(115, 12, 11, 0.1);
    outline: none;
    background: #ffffff;
}

.services-search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9b9295;
    pointer-events: none;
}

.services-dropdown-body {
    padding: 1.25rem 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.625rem;
}

.service-card {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    background: #f7f5f5;
    border-radius: 12px;
    padding: 0.75rem;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.service-card:hover {
    background: #efe9e9;
    transform: translateY(-1px);
    text-decoration: none;
    color: inherit;
}

.service-card.hidden {
    display: none;
}

.service-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #ffffff;
}

.service-icon i {
    font-size: 1.25rem;
    color: var(--nav-band);
}

.service-content {
    min-width: 0;
}

.service-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #343235;
    line-height: 1.3;
}

/* ==========================================================================
   8. Listings sub-menu (lawyers / advocates / mediators / firms)
   Its own row, below the sticky bar, so it scrolls away with the listing it
   belongs to.
   ========================================================================== */
.header-submenu {
    background: var(--nav-band-deep);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.header-submenu-inner {
    min-height: 46px;
}

.header-submenu-left,
.header-submenu-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.site-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.4375rem;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.75rem 0.875rem;
    white-space: nowrap;
    transition: color 0.15s ease;
}

.site-tab:hover {
    color: #ffffff;
    text-decoration: none;
}

.site-tab.active {
    color: #ffffff;
    font-weight: 650;
}

.site-tab.active::after {
    content: "";
    position: absolute;
    left: 0.875rem;
    right: 0.875rem;
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--nav-accent);
}

/* ==========================================================================
   9. Mobile drawer
   Ids and .mobile-menu-item are contracts with navbar.js — do not rename.
   ========================================================================== */
.mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    background: var(--nav-fill);
    border: 0;
    border-radius: 10px;
    color: #ffffff;
    font-size: 1.25rem;
    cursor: pointer;
}

.mobile-menu-toggle:hover {
    background: var(--nav-fill-strong);
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 8, 8, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
    visibility: visible;
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 86%;
    max-width: 340px;
    height: 100dvh;
    background: #ffffff;
    z-index: 1050;
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
}

.mobile-menu.active {
    display: block;
    transform: translateX(0);
}

/* Keep the drawer out of the way on desktop even mid-transition. */
@media (min-width: 992px) {
    .mobile-menu,
    .mobile-menu.active,
    .mobile-menu-overlay,
    .mobile-menu-overlay.active {
        display: none !important;
    }
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    background: var(--nav-band);
    position: sticky;
    top: 0;
    z-index: 1;
}

.mobile-menu-close {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    background: var(--nav-fill);
    border: 0;
    border-radius: 10px;
    color: #ffffff;
    font-size: 1rem;
    cursor: pointer;
}

.mobile-menu-close:hover {
    background: var(--nav-fill-strong);
}

.mobile-menu-body {
    padding: 0.75rem 0 2rem;
}

.mobile-menu-section + .mobile-menu-section {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f1ecec;
}

.mobile-menu-section-title {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9b9295;
    padding: 0 1.25rem;
    margin: 0.5rem 0 0.375rem;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1.25rem;
    color: #343235;
    text-decoration: none;
    font-size: 0.9375rem;
    background: transparent;
    border: 0;
    border-left: 3px solid transparent;
    text-align: left;
}

.mobile-menu-item:hover {
    background: #faf7f7;
    color: var(--nav-band);
    text-decoration: none;
}

.mobile-menu-item.active {
    background: #fdf3f3;
    border-left-color: var(--nav-band);
    color: var(--nav-band);
    font-weight: 600;
}

.mobile-menu-item i {
    font-size: 1.125rem;
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

.mobile-language-switcher form {
    margin: 0;
}

.mobile-language-item {
    justify-content: space-between;
}

/* ==========================================================================
   10. Focus
   The chips and links used to have no visible focus state at all. Gold reads
   on the band; the band reads on the white menus.
   ========================================================================== */
.header-main a:focus-visible,
.header-main button:focus-visible,
.header-main select:focus-visible,
.header-main input:focus-visible {
    outline: 2px solid var(--nav-accent);
    outline-offset: 2px;
    border-radius: 6px;
}

.services-dropdown-menu a:focus-visible,
.site-account-menu .dropdown-item:focus-visible,
.language-dropdown-menu button:focus-visible,
.mobile-menu a:focus-visible,
.mobile-menu button:focus-visible {
    outline: 2px solid var(--nav-band);
    outline-offset: -2px;
}

/* ==========================================================================
   11. Responsive
   The bar carries logo + services + five links + a 320px field + the account
   control. Rather than hide a destination as the viewport narrows, the
   discretionary parts shrink in this order: search width, link padding, the
   services label, the account name.
   ========================================================================== */
@media (max-width: 1399.98px) {
    .site-search-slot {
        flex-basis: 270px;
    }

    .site-nav-link {
        padding-left: 0.625rem;
        padding-right: 0.625rem;
    }

    .site-nav-link.active::after {
        left: 0.625rem;
        right: 0.625rem;
    }
}

/* Below xl the search has its own row, so the bar has room for the services
   label again and only the links need tightening. */
@media (max-width: 1199.98px) {
    .site-nav-link {
        font-size: 0.8625rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .site-nav-link.active::after {
        left: 0.5rem;
        right: 0.5rem;
    }

    .site-utility-links {
        gap: 0.875rem;
    }
}

@media (max-width: 991.98px) {
    :root {
        --nav-bar-h: 56px;
        /* No strip below lg, so nothing to roll off: the header pins at 0.
           navbar.js measures the same 0; this is the pre-JS fallback. */
        --nav-strip-h: 0px;
    }

    /* style.css drops the body side padding here, so the bleed goes with it. */
    .header-main {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
    }

    .header-main .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .navbar-logo-img {
        height: 24px;
    }

    .header-submenu {
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .header-submenu::-webkit-scrollbar {
        display: none;
    }

    .header-submenu-inner {
        min-width: max-content;
    }
}

@media (max-width: 575.98px) {
    /* Wide enough for «Специалисты», the longest scope label in either
       language. Truncating it to «Специал…» left the control ambiguous — it
       is the thing that decides which corpus the query reaches. */
    .site-search-scope-select {
        max-width: 7.75rem;
        font-size: 0.75rem;
    }

    .site-account-menu,
    .language-dropdown-menu {
        min-width: 200px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .header-main,
    .mobile-menu,
    .mobile-menu-overlay,
    .service-card {
        transition: none;
    }
}

/* Full-bleed bands -----------------------------------------------------
 * The document keeps 50px page gutters for the content system. Navigation
 * bands are viewport chrome, however, so they must escape those gutters at
 * every desktop breakpoint (including the listings submenu, which is a
 * sibling of the header). The inner .container still controls alignment.
 */
.header-main,
.header-submenu {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

.header-main {
    padding-left: 50px;
    padding-right: 50px;
}

.header-submenu > .container {
    width: 100%;
    max-width: 100%;
    padding-left: 15px;
    padding-right: 15px;
}

@media (max-width: 991.98px) {
    .header-main,
    .header-submenu {
        width: 100vw;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
    }

    .header-main {
        padding-left: 0;
        padding-right: 0;
    }
}

@media print {
    .header-main {
        display: none !important;
    }
}
