/* Header — fixed glass-pill site header, dealer nav (BEM prefix .header__) */

.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 0;
  z-index: 999999;
  user-select: none;
  font-family: var(--font-base);
}

.header__filter-defs {
  position: absolute;
  width: 0;
  height: 0;
}

.header__pc { display: block; }
.header__mob { display: none; }

/* ---------- Desktop pill ---------- */

.header__container {
  position: relative;
  top: 16px;
  left: 48px;
  width: calc(100% - 96px);
  max-height: 64px;
  box-sizing: border-box;
  padding: 16px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 666px;
  background-color: rgba(0, 0, 0, 0.22);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2), inset 0 1px 6px rgba(255, 255, 255, 0.4), inset 0 -5px 5px rgba(0, 0, 0, 0.1);
  isolation: isolate;
  transition: 0.3s ease-in-out, background-color 0.3s, box-shadow 0.3s;
}

/* header--dark-text: pill is over a light section, switch to dark text/glass */
.header__container.header--dark-text {
  background-color: var(--color-glass);
  box-shadow: inset 0 1px 6px rgba(255, 255, 255, 0.4), inset 0 -5px 5px rgba(0, 0, 0, 0.1), 0 6px 24px rgba(0, 0, 0, 0.12);
}

.header__container::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 666px;
  transition: border-radius 0.3s ease-in-out, background 0.3s;
  padding: 2px;
  background: linear-gradient(178deg, rgba(255, 255, 255, 0.66) 0%, rgba(0, 0, 0, 0.2) 75%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box exclude, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box exclude, linear-gradient(#fff 0 0);
  pointer-events: none;
  z-index: 1;
}

.header__container.header--dark-text::before {
  background: linear-gradient(178deg, rgba(224, 224, 224, 0.5) 0%, rgba(255, 255, 255, 0.2) 75%);
}

.header__container::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 666px;
  transition: border-radius 0.3s ease-in-out, opacity 0.3s ease-in-out;
  backdrop-filter: blur(8px) brightness(1.15) contrast(0.92) saturate(1.15);
  -webkit-backdrop-filter: blur(8px) brightness(1.15) contrast(0.92) saturate(1.15);
  filter: url("#glass-distortion_header");
  isolation: isolate;
  pointer-events: none;
  z-index: 0;
}

.header__left {
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1;
  column-gap: 32px;
  min-width: 0;
}

.header__logo { display: flex; align-items: center; column-gap: 8px; width: fit-content; height: fit-content; flex-shrink: 0; }
.header__logo svg { display: block; width: 94px; height: 32px; }
.header__logo svg.header__logo-icon--dark,
.header__container.header--dark-text .header__logo svg.header__logo-icon--light { display: none; }
.header__container.header--dark-text .header__logo svg.header__logo-icon--dark { display: block; }

.header__logo-text {
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: #fff;
  white-space: nowrap;
  transition: color 0.3s ease-in-out;
}

.header__container.header--dark-text .header__logo-text { color: var(--color-text-strong); }

.header__nav-list { display: flex; align-items: center; margin: 0; padding: 0; list-style: none; flex-wrap: wrap; }

.header__nav-item {
  padding: 6px 0;
  margin: 0 10px;
  display: block;
  width: fit-content;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  position: relative;
  color: #fff;
  text-decoration: none;
  transition: color 0.3s ease-in-out;
}

.header__nav-item::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: #fff;
  transition: width 0.2s ease-out;
}

.header__nav-item.is-active::after,
.header__nav-item:hover::after { width: 100%; }

.header__container.header--dark-text .header__nav-item { color: var(--color-text-strong); }
.header__container.header--dark-text .header__nav-item::after { background: var(--color-text-strong); }

.header__right { display: flex; column-gap: 20px; align-items: center; position: relative; z-index: 1; flex-shrink: 0; }

.header__hotline {
  display: flex;
  align-items: center;
  column-gap: 6px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.3s ease-in-out;
}

.header__hotline-icon { display: block; width: 18px; height: 18px; flex-shrink: 0; }

.header__container.header--dark-text .header__hotline { color: var(--color-text-strong); }

.header__button-list { display: flex; align-items: center; column-gap: 20px; }

.header__button {
  display: block;
  width: fit-content;
  height: fit-content;
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  color: #fff;
  padding: 7px 20px;
  border-radius: 666px;
  border: 1px solid #fff;
  text-decoration: none;
  white-space: nowrap;
  transition: 0.3s ease-in-out;
}

.header__button:hover { background-color: #fff; color: #000; }

.header__container.header--dark-text .header__button { color: var(--color-text-strong); border-color: var(--color-text-strong); }
.header__container.header--dark-text .header__button:hover { background-color: var(--color-text-strong); color: #fff; }

/* ---------- Mobile burger + drawer ---------- */

.header__burger {
  display: none;
  cursor: pointer;
  width: 24px;
  height: 100%;
  padding: 12px 0;
  flex-shrink: 0;
  border: 0;
  background: transparent;
  position: relative;
}

.header__burger-line,
.header__burger-line::before,
.header__burger-line::after {
  background-color: #fff;
  width: 16px;
  height: 2px;
  transition: all 0.3s;
}

.header__burger-line { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); }
.header__burger-line::before { content: ""; position: absolute; top: -5px; left: 50%; transform: translateX(-50%); }
.header__burger-line::after { content: ""; position: absolute; bottom: -5px; left: 50%; transform: translateX(-50%); }

.header__burger[aria-expanded="true"] .header__burger-line { background-color: transparent; }
.header__burger[aria-expanded="true"] .header__burger-line::before { top: 0; transform: translateX(-50%) rotate(45deg); }
.header__burger[aria-expanded="true"] .header__burger-line::after { bottom: 0; transform: translateX(-50%) rotate(-45deg); }

.header__mob-drawer {
  box-sizing: border-box;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-height: calc(100vh - 80px);
  max-height: calc(100dvh - 80px);
  border-radius: 0 0 24px 24px;
  overflow: hidden;
  box-shadow: 0 4px 11px 0 rgba(0, 0, 0, 0.14);
}

.header__mob-drawer[hidden] { display: none; }

.header__mob-drawer-inner {
  height: 100%;
  max-height: calc(100vh - 80px);
  max-height: calc(100dvh - 80px);
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-sizing: border-box;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  row-gap: 20px;
}

.header__mob-nav-list { margin: 0; padding: 0; list-style: none; }

.header__mob-nav-link {
  display: block;
  padding: 14px 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  color: #1a1d25;
  text-decoration: none;
  border-bottom: 1px solid #eaebec;
}

.header__mob-nav-list li:last-child .header__mob-nav-link { border-bottom: 0; }

.header__mob-hotline {
  display: flex;
  align-items: center;
  column-gap: 10px;
  padding: 16px 20px;
  background-color: rgba(0, 0, 0, 0.04);
  border-radius: 12px;
  color: #1a1d25;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
}

.header__button--mob { text-align: center; color: #1a1d25; border-color: #1a1d25; padding: 12px 20px; font-size: 14px; }
.header__button--mob:hover { background-color: #1a1d25; color: #fff; }

/* ---------- Responsive switch ---------- */

@media (max-width: 767px) {
  .header__pc { display: none; }
  .header__mob { display: block; }

  .header__container--mob {
    position: relative;
    top: 16px;
    left: 32px;
    width: calc(100% - 64px);
    max-height: 48px;
    min-height: 48px;
    padding: 8px 20px;
    border-radius: 666px;
    background-color: rgba(0, 0, 0, 0.22);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2), inset 0 1px 6px rgba(255, 255, 255, 0.4), inset 0 -5px 5px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
    isolation: isolate;
    transition: transform 0.3s ease-in-out;
  }

  .header__container--mob.header--dark-text {
    background-color: var(--color-glass);
    box-shadow: inset 0 1px 6px rgba(255, 255, 255, 0.4), inset 0 -5px 5px rgba(0, 0, 0, 0.1), 0 6px 24px rgba(0, 0, 0, 0.12);
  }

  .header__container--mob::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 666px;
    padding: 1px;
    background: linear-gradient(178deg, rgba(255, 255, 255, 0.66) 0%, rgba(0, 0, 0, 0.2) 75%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box exclude, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box exclude, linear-gradient(#fff 0 0);
    pointer-events: none;
    z-index: 1;
  }

  .header__container--mob.header--dark-text::before {
    background: linear-gradient(178deg, rgba(224, 224, 224, 0.5) 0%, rgba(255, 255, 255, 0.2) 75%);
  }

  .header__container--mob::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 666px;
    backdrop-filter: blur(8px) brightness(1.15) contrast(0.92) saturate(1.15);
    -webkit-backdrop-filter: blur(8px) brightness(1.15) contrast(0.92) saturate(1.15);
    filter: url("#glass-distortion_header");
    isolation: isolate;
    pointer-events: none;
    z-index: 0;
  }

  .header__container--mob.is-open {
    background-color: #fff;
    border-radius: 24px 24px 0 0;
    width: calc(100% - 32px);
    left: 16px;
    box-shadow: 0 4px 11px 0 rgba(0, 0, 0, 0.14);
  }

  .header__container--mob.is-open::before,
  .header__container--mob.is-open::after { border-radius: 24px 24px 0 0; background: unset; }
  .header__container--mob.is-open::after { opacity: 0; }

  .header__container--mob .header__left { position: relative; z-index: 1; min-width: 0; }
  .header__container--mob .header__logo svg { width: 84px; height: 16px; }
  .header__container--mob .header__logo-text { font-size: 12px; }

  .header__container--mob.header--dark-text .header__logo-text,
  .header__container--mob.is-open .header__logo-text { color: var(--color-text-strong); }

  .header__container--mob.header--dark-text .header__logo-icon--light,
  .header__container--mob.is-open .header__logo-icon--light { display: none; }
  .header__container--mob.header--dark-text .header__logo-icon--dark,
  .header__container--mob.is-open .header__logo-icon--dark { display: block; }

  .header__container--mob.header--dark-text .header__burger-line,
  .header__container--mob.header--dark-text .header__burger-line::before,
  .header__container--mob.header--dark-text .header__burger-line::after,
  .header__container--mob.is-open .header__burger-line,
  .header__container--mob.is-open .header__burger-line::before,
  .header__container--mob.is-open .header__burger-line::after { background-color: var(--color-text-strong); }

  .header__container--mob .header__right {
    position: relative;
    z-index: 1;
    display: flex;
    column-gap: 16px;
    align-items: center;
  }

  .header__burger { display: block; }

  /* Collapse the mobile header pill down to just the round burger button
     while the model nav bar's floating anchor pill is shown (ModelNavBar.js
     toggles this on <body> in sync with its own scroll-show state). */
  body.header-collapsed .header__container--mob {
    position: fixed;
    top: 17px;
    left: auto;
    right: 16px;
    width: 40px;
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
    background-color: #fff;
    box-shadow: 0 4px 11px 0 rgba(0, 0, 0, 0.14);
  }

  body.header-collapsed .header__container--mob::before,
  body.header-collapsed .header__container--mob::after {
    display: none;
  }

  body.header-collapsed .header__container--mob .header__left,
  body.header-collapsed .header__container--mob .header__button {
    display: none;
  }
}

@media (max-width: 767px) {
  /* Collapsed header = white round button: burger lines must be dark. */
  body.header-collapsed .header__container--mob .header__burger-line,
  body.header-collapsed .header__container--mob .header__burger-line::before,
  body.header-collapsed .header__container--mob .header__burger-line::after { background-color: var(--color-text-strong); }
}
