/* KBX floating pill header. Spec: master plan section 11.2.
   Owns .kbx-header, .kbx-skip, .kbx-overlay, .kbx-burger and the shared .kbx-btn. */

.kbx-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--kbx-white);
  color: var(--kbx-black);
  padding: 12px 20px;
  border-radius: var(--kbx-radius-card);
  font-family: var(--kbx-font-body);
  font-weight: 600;
}

.kbx-skip:focus {
  left: 16px;
  top: 16px;
  outline: 2px solid var(--kbx-blue);
  outline-offset: 2px;
}

.kbx-header {
  position: fixed;
  top: 16px;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 16px;
  font-family: var(--kbx-font-body);
}

.kbx-header__pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: var(--kbx-max);
  height: var(--kbx-pill-h);
  margin: 0 auto;
  padding: 0 24px;
  border-radius: var(--kbx-radius-pill);
  background-color: rgba(255, 255, 255, 0.96);
  background-image: linear-gradient(90deg, rgba(82, 113, 255, 0.06), rgba(82, 113, 255, 0) 42%);
  box-shadow: var(--kbx-shadow-soft);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.kbx-header__logo {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  text-decoration: none;
}

.kbx-header__logo img {
  display: block;
  height: 28px;
  width: auto;
}

.kbx-header__nav {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
}

.kbx-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.kbx-nav__item {
  position: relative;
}

.kbx-nav__link {
  position: relative;
  display: block;
  padding: 8px 0;
  color: var(--kbx-black);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

.kbx-nav__link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  height: 2px;
  width: 0;
  background: var(--kbx-blue);
  transform: translateX(-50%);
}

.kbx-nav__link:hover,
.kbx-nav__link:focus-visible,
.kbx-nav__link[aria-current="page"] {
  color: var(--kbx-blue);
}

.kbx-nav__link:hover::after,
.kbx-nav__link:focus-visible::after,
.kbx-nav__link[aria-current="page"]::after {
  width: 100%;
}

.kbx-nav__link:focus-visible,
.kbx-panel__link:focus-visible,
.kbx-header__logo:focus-visible,
.kbx-iconbtn:focus-visible,
.kbx-btn:focus-visible,
.kbx-burger:focus-visible {
  outline: 2px solid var(--kbx-blue);
  outline-offset: 3px;
}

/* Services dropdown */
.kbx-panel {
  position: absolute;
  top: calc(100% + 18px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 340px;
  padding: 12px;
  border-radius: var(--kbx-radius-card);
  background: var(--kbx-white);
  box-shadow: var(--kbx-shadow-soft);
  visibility: hidden;
  opacity: 0;
}

.kbx-nav__item--has-panel:hover .kbx-panel,
.kbx-nav__item--has-panel:focus-within .kbx-panel,
.kbx-panel.kbx-panel--open {
  visibility: visible;
  opacity: 1;
}

.kbx-panel__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.kbx-panel__link {
  display: block;
  padding: 12px;
  border-radius: 12px;
  text-decoration: none;
}

.kbx-panel__link:hover,
.kbx-panel__link:focus-visible {
  background: var(--kbx-blue-tint);
}

.kbx-panel__title {
  display: block;
  color: var(--kbx-black);
  font-size: 0.9375rem;
  font-weight: 600;
}

.kbx-panel__desc {
  display: block;
  margin-top: 2px;
  color: var(--kbx-ink-3);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.kbx-panel__foot {
  margin-top: 8px;
  padding: 12px;
  border-top: 1px solid var(--kbx-line);
}

.kbx-panel__login {
  color: var(--kbx-blue);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
}

.kbx-panel__login:hover {
  text-decoration: underline;
}

/* Actions */
.kbx-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.kbx-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--kbx-radius-pill);
  border: 1px solid var(--kbx-line);
  color: var(--kbx-black);
  background: var(--kbx-white);
  text-decoration: none;
}

.kbx-iconbtn svg {
  width: 18px;
  height: 18px;
}

.kbx-iconbtn:hover {
  border-color: var(--kbx-black);
}

.kbx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: var(--kbx-radius-pill);
  font-family: var(--kbx-font-body);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
}

.kbx-btn--primary {
  background: var(--kbx-blue);
  color: var(--kbx-white);
}

.kbx-btn--primary:hover {
  background: var(--kbx-blue-dark);
  transform: translateY(-1px);
}

.kbx-btn__icon {
  width: 18px;
  height: 18px;
}

.kbx-header__cta-short {
  display: none;
}

@media (max-width: 1199px) {
  .kbx-nav {
    gap: 18px;
  }
  .kbx-header__cta-long {
    display: none;
  }
  .kbx-header__cta-short {
    display: inline;
  }
}

/* Scrolled state */
.kbx-header--scrolled .kbx-header__pill {
  height: var(--kbx-pill-h-small);
  box-shadow: 0 10px 34px rgba(10, 10, 10, 0.12);
}

.kbx-header--scrolled .kbx-header__logo img {
  height: 25.2px;
}

/* Burger and overlay */
.kbx-burger {
  display: none;
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--kbx-line);
  border-radius: var(--kbx-radius-pill);
  background: var(--kbx-white);
  cursor: pointer;
}

.kbx-burger__bar {
  position: absolute;
  left: 13px;
  width: 18px;
  height: 2px;
  background: var(--kbx-black);
}

.kbx-burger__bar:nth-child(1) {
  top: 18px;
}

.kbx-burger__bar:nth-child(2) {
  top: 24px;
}

.kbx-burger[aria-expanded="true"] .kbx-burger__bar:nth-child(1) {
  top: 21px;
  transform: rotate(45deg);
}

.kbx-burger[aria-expanded="true"] .kbx-burger__bar:nth-child(2) {
  top: 21px;
  transform: rotate(-45deg);
}

.kbx-overlay {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 40px;
  padding: 96px 24px 40px;
  background: var(--kbx-white);
  overflow-y: auto;
}

.kbx-overlay[hidden] {
  display: none;
}

.kbx-overlay__nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.kbx-overlay__nav li + li {
  margin-top: 20px;
}

.kbx-overlay__nav a {
  color: var(--kbx-black);
  font-family: var(--kbx-font-headline);
  font-size: 2rem;
  font-weight: 700;
  text-decoration: none;
}

.kbx-overlay__nav a:hover,
.kbx-overlay__nav a[aria-current="page"] {
  color: var(--kbx-blue);
}

.kbx-overlay__foot {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: flex-start;
}

.kbx-overlay__phone,
.kbx-overlay__login {
  color: var(--kbx-ink-2);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
}

.kbx-overlay__cta {
  width: 100%;
}

.kbx-body-locked {
  overflow: hidden;
}

@media (max-width: 1023px) {
  .kbx-header {
    top: 12px;
  }
  .kbx-header__pill {
    height: var(--kbx-pill-h-small);
    padding: 0 16px;
  }
  .kbx-header__logo img {
    height: 24px;
  }
  .kbx-header__nav,
  .kbx-header__cta {
    display: none;
  }
  .kbx-burger {
    display: block;
  }
}

@media (min-width: 1024px) {
  .kbx-overlay {
    display: none;
  }
}

/* All motion is opt-in. With reduced motion nothing animates. */
@media (prefers-reduced-motion: no-preference) {
  .kbx-header__pill,
  .kbx-header__logo img {
    transition: height 240ms ease-out, box-shadow 240ms ease-out;
  }
  .kbx-nav__link,
  .kbx-nav__link::after,
  .kbx-panel,
  .kbx-iconbtn,
  .kbx-btn,
  .kbx-burger__bar {
    transition: width 160ms ease-out, color 160ms ease-out, opacity 160ms ease-out,
      visibility 160ms ease-out, background-color 160ms ease-out, transform 160ms ease-out,
      border-color 160ms ease-out, top 160ms ease-out;
  }
  .kbx-overlay__nav li {
    opacity: 0;
    transform: translateY(12px);
  }
  .kbx-overlay--open .kbx-overlay__nav li {
    opacity: 1;
    transform: none;
    transition: opacity 320ms ease-out, transform 320ms ease-out;
  }
  .kbx-overlay--open .kbx-overlay__nav li:nth-child(1) { transition-delay: 0ms; }
  .kbx-overlay--open .kbx-overlay__nav li:nth-child(2) { transition-delay: 60ms; }
  .kbx-overlay--open .kbx-overlay__nav li:nth-child(3) { transition-delay: 120ms; }
  .kbx-overlay--open .kbx-overlay__nav li:nth-child(4) { transition-delay: 180ms; }
  .kbx-overlay--open .kbx-overlay__nav li:nth-child(5) { transition-delay: 240ms; }
  .kbx-overlay--open .kbx-overlay__nav li:nth-child(6) { transition-delay: 300ms; }
}
