/*
 * CARS responsive public header and market switcher.
 * This file intentionally does not modify the homepage hero/banner.
 */

:root {
    --crs-header-control-height: 44px;
    --crs-header-gap: clamp(10px, 1.2vw, 22px);
}

.site-header,
.crs-site-header,
.platform-header,
header[role="banner"] {
    position: relative;
    z-index: 80;
}

.site-header__inner,
.crs-site-header__inner,
.platform-header__inner,
.crs-public-header__inner {
    min-width: 0;
}

.site-header__inner > *,
.crs-site-header__inner > *,
.platform-header__inner > *,
.crs-public-header__inner > * {
    min-width: 0;
}

.site-header .brand,
.crs-site-header .brand,
.platform-header .brand,
.crs-public-header .brand {
    flex: 0 0 auto;
}

.site-header .main-nav,
.site-header .crs-site-nav,
.crs-site-header nav,
.platform-header nav,
.crs-public-header nav {
    min-width: 0;
}

.header-actions,
.crs-site-header__actions,
.platform-header__actions,
.crs-public-header__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 0 0 auto;
}

.crs-market-switcher {
    position: relative;
    flex: 0 0 auto;
    font-family: inherit;
    direction: rtl;
}

html[dir="ltr"] .crs-market-switcher {
    direction: ltr;
}

.crs-market-switcher__button {
    min-height: var(--crs-header-control-height);
    max-width: 245px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 13px;
    border: 1px solid rgba(0, 108, 53, 0.18);
    border-radius: 12px;
    background: #fff;
    color: #102b1d;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 5px 18px rgba(16, 43, 29, 0.07);
}

.crs-market-switcher__button:hover,
.crs-market-switcher__button:focus-visible,
.crs-market-switcher.is-open .crs-market-switcher__button {
    border-color: rgba(0, 108, 53, 0.52);
    outline: none;
}

.crs-market-switcher__flag {
    font-size: 18px;
    line-height: 1;
}

.crs-market-switcher__label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.crs-market-switcher__chevron {
    width: 7px;
    height: 7px;
    border-inline-end: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 160ms ease;
    opacity: 0.72;
}

.crs-market-switcher.is-open .crs-market-switcher__chevron {
    transform: rotate(225deg) translate(-2px, -1px);
}

.crs-market-switcher__menu {
    position: absolute;
    inset-block-start: calc(100% + 8px);
    inset-inline-start: 0;
    z-index: 999;
    width: min(300px, calc(100vw - 24px));
    padding: 8px;
    border: 1px solid rgba(0, 108, 53, 0.14);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 48px rgba(15, 40, 27, 0.18);
}

.crs-market-switcher__menu[hidden] {
    display: none !important;
}

.crs-market-switcher__option {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 11px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #173326;
    text-align: start;
    font: inherit;
    cursor: pointer;
}

.crs-market-switcher__option:hover,
.crs-market-switcher__option:focus-visible {
    background: #f0faf4;
    outline: none;
}

.crs-market-switcher__option.is-active {
    background: #eaf7ef;
    color: #006c35;
}

.crs-market-switcher__option-label {
    min-width: 0;
}

.crs-market-switcher__option-label strong,
.crs-market-switcher__option-label small {
    display: block;
}

.crs-market-switcher__option-label strong {
    font-size: 14px;
}

.crs-market-switcher__option-label small {
    margin-top: 3px;
    color: #718077;
    font-size: 11px;
    direction: ltr;
}

.crs-market-switcher__check {
    width: 20px;
    text-align: center;
    font-weight: 900;
}

.crs-market-switcher__option:not(.is-active)
.crs-market-switcher__check {
    visibility: hidden;
}

/*
 * Medium desktop/tablet:
 * activate the existing mobile navigation before links collide.
 */
@media (max-width: 1180px) {
    .site-header__inner,
    .crs-site-header__inner,
    .platform-header__inner,
    .crs-public-header__inner {
        gap: 12px !important;
    }

    .site-header .main-nav,
    .site-header .crs-site-nav,
    .crs-site-header nav:not(.crs-mobile-drawer__nav),
    .platform-header nav:not(.crs-mobile-drawer__nav),
    .crs-public-header nav:not(.crs-mobile-drawer__nav) {
        display: none !important;
    }

    .crs-mobile-menu-toggle {
        display: inline-flex !important;
        flex: 0 0 auto;
    }

    .header-actions,
    .crs-site-header__actions,
    .platform-header__actions,
    .crs-public-header__actions {
        margin-inline-start: auto;
    }
}

@media (max-width: 760px) {
    :root {
        --crs-header-control-height: 40px;
    }

    .site-header__inner,
    .crs-site-header__inner,
    .platform-header__inner,
    .crs-public-header__inner {
        min-height: 66px;
        padding-inline: 14px !important;
        gap: 8px !important;
    }

    .site-header .brand-logo-approved,
    .site-header .brand img,
    .crs-site-header .brand img,
    .platform-header .brand img,
    .crs-public-header .brand img {
        max-width: 128px !important;
        max-height: 46px !important;
        object-fit: contain;
    }

    .header-actions > .button,
    .crs-site-header__actions > .button,
    .platform-header__actions > .button,
    .crs-public-header__actions > .button {
        display: none !important;
    }

    .crs-market-switcher__button {
        max-width: 158px;
        padding-inline: 10px;
        font-size: 12px;
    }

    .crs-market-switcher__flag {
        font-size: 16px;
    }

    .crs-market-switcher__menu {
        position: fixed;
        inset-inline: 12px;
        inset-block-start: 74px;
        width: auto;
    }
}

@media (max-width: 430px) {
    .site-header__inner,
    .crs-site-header__inner,
    .platform-header__inner,
    .crs-public-header__inner {
        padding-inline: 10px !important;
    }

    .site-header .brand-logo-approved,
    .site-header .brand img,
    .crs-site-header .brand img,
    .platform-header .brand img,
    .crs-public-header .brand img {
        max-width: 105px !important;
    }

    .crs-market-switcher__button {
        max-width: 132px;
    }

    .crs-market-switcher__label {
        max-width: 78px;
    }
}
