/* Header and static three-level navigation. */
.header { padding: var(--padding-section); }
.header__content { display: flex; align-items: center; justify-content: space-between; }
.header__hamburger-menu { display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; padding: 0; cursor: pointer; }
.header__menu--contents {
    position: fixed; top: 0; right: -100%; width: 70vw; height: 100dvh;
    background: rgba(255,255,255,.92); z-index: 12; padding: 12px 24px;
    overflow-y: auto; box-sizing: border-box; display: flex; flex-direction: column;
    justify-content: space-between; backdrop-filter: blur(18px); transition: right .3s;
}
.header__menu--contents.on { right: 0; }
.header__menu--content { display: flex; flex-direction: column; gap: 18px; }
.header__navigation { width: 100%; }
.header__menu--items, .header__submenu { list-style: none; margin: 0; padding: 0; }
.header__menu--items { display: flex; flex-direction: column; gap: 20px; }
.header__menu--item { color: var(--color-primary-2); font-size: 14px; }
.header__menu--item > a, .header__menu--row > a {
    display: block; color: inherit; text-decoration: none; padding: 7px 0;
    white-space: normal;
}
.header__menu--row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.header__menu--row > a { flex: 1; min-width: 0; }
.header__menu--toggle {
    display: inline-flex; flex: none; justify-content: center; align-items: center;
    background: transparent; color: inherit; border: 0; cursor: pointer;
    width: 34px; height: 34px; padding: 8px;
}
.header__menu--toggle .arrow { transition: transform .2s ease; }
.header__menu--item.active > .header__menu--row > .header__menu--toggle .arrow { transform: rotate(180deg); }
.header__submenu { display: none; }
.header__menu--item.active > .header__submenu { display: block; }
.header__submenu--brands { margin-top: 4px; padding-right: 12px; border-right: 1px solid rgba(32,42,68,.18); }
.header__submenu--models { margin: 2px 12px 9px 0; padding-right: 12px; border-right: 1px solid rgba(32,42,68,.12); }
.header__submenu--models a { display: block; color: var(--color-primary-2); text-decoration: none; padding: 9px 4px; font-size: 12px; line-height: 1.5; }
.header__submenu--models a:hover, .header__submenu--models a:focus-visible, .header__menu--row > a:hover { color: #1463ba; }
.header__menu--head { display: flex; align-items: center; justify-content: space-between; }
.header__menu--head-link img { object-fit: cover; }
.header__menu--head-close { background: transparent; border: 0; padding: 0; cursor: pointer; }
.header__menu--auth { padding: 8px; text-align: center; border: 1px solid #202A44; border-radius: 12px; }
.header__icon { display: flex; gap: 15px; align-items: center; }
.header__icon--cart { display: none; }
.overlay__menu { position: fixed; inset: 0; background: rgb(0 0 0 / 50%); z-index: 11; opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; }
.overlay__menu.on { opacity: 1; visibility: visible; }
.header__menu--row a:focus-visible, .header__menu--toggle:focus-visible, .header__menu--item > a:focus-visible { outline: 2px solid #1463ba; outline-offset: 2px; }

@media (min-width: 768px) and (max-width: 1023px) { .header__menu--contents { width: 50vw; } }

@media (min-width: 1024px) {
    .header__hamburger-menu { display: none; }
    .header__menu--contents { display: flex; position: static; background: transparent; width: auto; height: auto; overflow: visible; padding: 0; backdrop-filter: none; }
    .header__menu--head, .header__menu--auth { display: none; }
    .header__menu--items { flex-direction: row; align-items: center; gap: 28px; }
    .header__menu--item { position: relative; white-space: nowrap; }
    .header__menu--row { gap: 2px; }
    .header__menu--row > a, .header__menu--item > a { padding: 7px 0; }
    .header__menu--toggle { width: 23px; height: 26px; padding: 4px; }
    .header__submenu { background: #fff; box-shadow: 0 3px 18px rgba(0,0,0,.12); border-radius: 8px; z-index: 15; }
    .header__submenu--brands { position: absolute; top: 100%; right: 0; min-width: 208px; margin: 0; padding: 6px; border: 0; }
    .header__submenu--brands > .header__menu--item { position: relative; }
    .header__submenu--brands > .header__menu--item > .header__menu--row { border-radius: 5px; padding: 1px 8px; }
    .header__submenu--brands > .header__menu--item:hover > .header__menu--row, .header__submenu--brands > .header__menu--item:focus-within > .header__menu--row { background: #f3f6fc; }
    .header__submenu--models { position: absolute; top: -6px; right: calc(100% - 3px); width: 450px; max-height: min(70vh, 530px); overflow-y: auto; margin: 0; padding: 10px 12px; border: 0; }
    .header__submenu--models a { font-size: 12px; padding: 8px 7px; white-space: normal; }
    .header__menu--item--has-children:hover > .header__submenu--brands,
    .header__menu--item--has-children:focus-within > .header__submenu--brands,
    .header__menu--item--has-children.active > .header__submenu--brands { display: block; }
    .header__menu--item--brand:hover > .header__submenu--models,
    .header__menu--item--brand:focus-within > .header__submenu--models,
    .header__menu--item--brand.active > .header__submenu--models { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
    .header__menu--item--has-children:hover > .header__menu--row .arrow,
    .header__menu--item--has-children:focus-within > .header__menu--row .arrow { transform: rotate(180deg); }
    .header__icon--cart { display: flex; width: 35px; height: 35px; background: #202A44; border-radius: 8px; padding: 8px; cursor: pointer; }
}
