/**
 * Canonical cross-site Navbar recipe.
 *
 * My Website is the accepted Bits & Bolts visual reference. Consumers retain
 * their routes and product behavior while this recipe owns navbar presentation,
 * responsive navigation, and placement behavior.
 */

@import url("./scrollbar.css");
@import url("./brand-mark.css");

.bb-navbar,
.bb-navbar *,
.bb-navbar *::before,
.bb-navbar *::after {
  box-sizing: border-box;
}

.bb-navbar,
.bb-navbar__spacer {
  height: var(--bb-navbar-height, 4rem);
}

.bb-navbar {
  position: relative;
  z-index: 999;
  display: flex;
  width: 100%;
  align-items: center;
  background: color-mix(in srgb, var(--bb-marketing-chrome-background) 50%, transparent);
}

.bb-navbar[data-placement="sticky"] {
  position: sticky;
  top: 0;
}

.bb-navbar[data-placement="hide-on-scroll"] {
  position: fixed;
  inset: 0 0 auto;
  transition: opacity 300ms ease, transform 300ms ease;
}

.bb-navbar[data-placement="hide-on-scroll"][data-hidden="true"] {
  pointer-events: none;
  opacity: 0;
  transform: translateY(-100%);
}

.bb-navbar__inner {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 0 2vw;
}

.bb-navbar__brand {
  appearance: none;
  position: relative;
  z-index: 0;
  display: flex;
  align-items: center;
  padding: 0;
  border: 0;
  color: var(--bb-v2-identity-primary);
  background: transparent;
  font: inherit;
  text-align: left;
  text-decoration: none;
  transition: color 300ms ease;
}

.bb-navbar__brand::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  background: var(--bb-v2-identity-primary);
  content: "";
  filter: blur(16px);
  opacity: 0;
  transition: opacity 300ms ease;
}

.bb-navbar__brand:hover::before,
.bb-navbar__brand:focus-visible:where(:root:not([data-bb-focus-origin="pointer"]) *)::before {
  opacity: 0.6;
}

.bb-navbar__brand img,
.bb-navbar__brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  flex: none;
  object-fit: contain;
}

.bb-navbar__brand-mark {
  color: var(--bb-v2-identity-primary);
}

.bb-navbar__brand-mark--monochrome {
  --bb-brand-mark-image: var(--bb-navbar-brand-mark-image);
}

.bb-navbar__brand[data-bb-brand-layout="wordmark"] :is(img, .bb-navbar__brand-mark) {
  width: 12.5rem;
  height: 2.5rem;
}

.bb-navbar__brand > span:last-child {
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: var(--bb-v2-identity-primary);
  font-family: var(--bb-v2-type-display-family);
  font-weight: var(--bb-v2-type-display-font-weight, var(--bb-font-weight-semibold));
  line-height: var(--bb-v2-type-display-line-height, 1.1);
}

.bb-navbar__brand strong {
  font-size: clamp(0.8rem, 1.2vw, 1rem);
  font-weight: inherit;
  letter-spacing: var(--bb-v2-type-display-letter-spacing, 0);
}

.bb-navbar__brand small {
  font-family: var(--bb-v2-type-caption-family);
  font-size: 0.7rem;
  font-weight: var(--bb-v2-type-caption-font-weight, var(--bb-font-weight-regular));
  line-height: var(--bb-v2-type-caption-line-height, 1.1);
  letter-spacing: var(--bb-v2-type-caption-letter-spacing, 0);
}

.bb-navbar__links {
  display: flex;
  height: 100%;
  flex: 1;
  flex-wrap: wrap;
  justify-content: space-around;
}

.bb-navbar:not(:has(.bb-navbar__action-wrapper)) .bb-navbar__links {
  flex: 0 1 auto;
  justify-content: flex-end;
  margin-left: auto;
}

.bb-navbar__link {
  appearance: none;
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  border: 0;
  border-radius: 6px;
  color: color-mix(in srgb, var(--bb-marketing-chrome-navigation) 60%, transparent);
  background: transparent;
  font-family: var(--bb-v2-type-label-family);
  font-size: var(--bb-v2-type-label-font-size, 1rem);
  font-weight: var(--bb-v2-type-label-font-weight, var(--bb-font-weight-semibold));
  line-height: var(--bb-v2-type-label-line-height, normal);
  letter-spacing: var(--bb-v2-type-label-letter-spacing, 0);
  text-align: center;
  text-decoration: none;
  transition: background 200ms ease;
}

.bb-navbar__link:hover,
.bb-navbar__link:focus-visible:where(:root:not([data-bb-focus-origin="pointer"]) *) {
  color: var(--bb-marketing-chrome-navigation);
  text-shadow: 0 0 5px var(--bb-v2-identity-primary), 0 0 10px var(--bb-v2-identity-primary),
    0 0 20px var(--bb-v2-identity-primary), 0 0 40px var(--bb-v2-identity-primary),
    0 0 60px var(--bb-marketing-portfolio-glow-far), 0 0 80px var(--bb-marketing-portfolio-glow-far);
}

.bb-navbar__action-wrapper {
  display: flex;
  height: calc(var(--bb-navbar-height, 4rem) * 0.75);
  transform: scale(0.8);
}

.bb-navbar__action {
  appearance: none;
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
  border: 0;
  border-radius: 6px;
  color: var(--bb-v2-identity-primary-foreground);
  background: var(--bb-v2-identity-primary);
  font-family: var(--bb-v2-type-display-large-family);
  font-size: var(--bb-v2-type-title-font-size, 1.25rem);
  font-weight: var(--bb-theme-typography-signature-font-weight, var(--bb-v2-type-display-large-font-weight, var(--bb-font-weight-semibold)));
  font-style: var(--bb-theme-typography-signature-font-style, normal);
  line-height: var(--bb-v2-type-label-line-height, normal);
  letter-spacing: var(--bb-v2-type-label-letter-spacing, 0);
  text-align: center;
  text-decoration: var(--bb-theme-typography-signature-text-decoration, none);
  cursor: pointer;
  transition: transform 200ms ease;
}

.bb-navbar__action:hover,
.bb-navbar__action:focus-visible:where(:root:not([data-bb-focus-origin="pointer"]) *) {
  color: var(--bb-v2-identity-primary-foreground);
  transform: scale(1.2);
}

.bb-navbar :is(a, button).bb-navbar__brand,
.bb-navbar :is(a, button).bb-navbar__link,
.bb-navbar :is(a, button).bb-navbar__action,
.bb-navbar button:is(.bb-navbar__toggle, .bb-navbar__close) {
  cursor: pointer;
}

.bb-navbar__toggle,
.bb-navbar__close {
  padding: 0;
  border: 0;
  color: var(--bb-v2-identity-primary);
  background: transparent;
  cursor: pointer;
}

.bb-navbar__toggle {
  display: none;
  font-size: 1.5rem;
}

.bb-navbar__close {
  display: none;
}

.bb-navbar__icon {
  display: inline-block;
  height: 1em;
  overflow: visible;
  vertical-align: -0.125em;
}

.bb-navbar__toggle .bb-navbar__icon {
  width: 0.875em;
}

.bb-navbar[data-layout="compact"] .bb-navbar__links {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2000;
  display: none;
  width: auto;
  height: 100vh;
  flex: none;
  flex-direction: column;
  align-items: stretch;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 1rem;
  margin-left: 0;
  padding: 0.4rem 1rem 0;
  background: var(--bb-marketing-portfolio-panel);
  opacity: 0.95;
}

.bb-navbar[data-layout="compact"][data-open="true"] .bb-navbar__links {
  display: flex;
}

.bb-navbar[data-layout="compact"] .bb-navbar__link {
  justify-content: flex-start;
  padding: 0.5rem 1rem;
}

.bb-navbar[data-layout="compact"] .bb-navbar__close {
  display: flex;
  width: 1.8rem;
  height: 1.8rem;
  align-items: center;
  justify-content: center;
  align-self: flex-end;
  border-radius: var(--bb-radius-full);
  background: color-mix(in srgb, var(--bb-v2-color-surface-scrim) 50%, transparent);
  font-size: 1.3rem;
  transition: background 200ms ease, transform 200ms ease;
}

.bb-navbar[data-layout="compact"] .bb-navbar__close:hover,
.bb-navbar[data-layout="compact"] .bb-navbar__close:focus-visible:where(:root:not([data-bb-focus-origin="pointer"]) *) {
  opacity: 1;
  transform: scale(1.1);
}

.bb-navbar[data-layout="compact"] .bb-navbar__toggle {
  display: block;
}

.bb-navbar[data-layout="compact"] .bb-navbar__brand {
  justify-content: center;
}

.bb-navbar:not(:has(.bb-navbar__action-wrapper))[data-layout="compact"] .bb-navbar__inner {
  position: relative;
}

.bb-navbar:not(:has(.bb-navbar__action-wrapper))[data-layout="compact"] .bb-navbar__brand {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.bb-navbar[data-layout="compact"] :is(.bb-navbar__brand img, .bb-navbar__brand-mark) {
  width: 3.5rem;
  height: 3.5rem;
}

.bb-navbar[data-layout="compact"] .bb-navbar__brand[data-bb-brand-layout="wordmark"] :is(img, .bb-navbar__brand-mark) {
  width: min(48vw, 11.5rem);
  height: 2.2rem;
}

.bb-navbar[data-layout="compact"] .bb-navbar__brand strong {
  font-size: clamp(1rem, 2.4vw, 1.2rem);
}

.bb-navbar[data-layout="compact"] .bb-navbar__brand small {
  font-size: clamp(0.6rem, 1.8vw, 0.9rem);
}

.bb-navbar[data-bb-navbar-specimen][data-layout="compact"] .bb-navbar__links {
  position: absolute;
  top: 100%;
  height: 9.5rem;
  max-height: 9.5rem;
  gap: 0.25rem;
  overflow-y: auto;
}

@media (max-width: 1025px) {
  .bb-navbar[data-layout="auto"] .bb-navbar__links {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2000;
    display: none;
    width: auto;
    height: 100vh;
    flex: none;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 1rem;
    margin-left: 0;
    padding: 0.4rem 1rem 0;
    background: var(--bb-marketing-portfolio-panel);
    opacity: 0.95;
  }

  .bb-navbar[data-layout="auto"][data-open="true"] .bb-navbar__links {
    display: flex;
  }

  .bb-navbar[data-layout="auto"] .bb-navbar__link {
    justify-content: flex-start;
    padding: 0.5rem 1rem;
  }

  .bb-navbar[data-layout="auto"] .bb-navbar__close {
    display: flex;
    width: 1.8rem;
    height: 1.8rem;
    align-items: center;
    justify-content: center;
    align-self: flex-end;
    border-radius: var(--bb-radius-full);
    background: color-mix(in srgb, var(--bb-v2-color-surface-scrim) 50%, transparent);
    font-size: 1.3rem;
    transition: background 200ms ease, transform 200ms ease;
  }

  .bb-navbar[data-layout="auto"] .bb-navbar__close:hover,
  .bb-navbar[data-layout="auto"] .bb-navbar__close:focus-visible:where(:root:not([data-bb-focus-origin="pointer"]) *) {
    opacity: 1;
    transform: scale(1.1);
  }

  .bb-navbar[data-layout="auto"] .bb-navbar__toggle {
    display: block;
  }

  .bb-navbar[data-layout="auto"] .bb-navbar__brand {
    justify-content: center;
  }

  .bb-navbar:not(:has(.bb-navbar__action-wrapper))[data-layout="auto"] .bb-navbar__inner {
    position: relative;
  }

  .bb-navbar:not(:has(.bb-navbar__action-wrapper))[data-layout="auto"] .bb-navbar__brand {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }

  .bb-navbar[data-layout="auto"] .bb-navbar__brand img,
  .bb-navbar[data-layout="auto"] .bb-navbar__brand-mark {
    width: 3.5rem;
    height: 3.5rem;
  }

  .bb-navbar[data-layout="auto"] .bb-navbar__brand[data-bb-brand-layout="wordmark"] :is(img, .bb-navbar__brand-mark) {
    width: min(48vw, 11.5rem);
    height: 2.2rem;
  }

  .bb-navbar[data-layout="auto"] .bb-navbar__brand strong {
    font-size: clamp(1rem, 2.4vw, 1.2rem);
  }

  .bb-navbar[data-layout="auto"] .bb-navbar__brand small {
    font-size: clamp(0.6rem, 1.8vw, 0.9rem);
  }
}

@media (max-width: 560px) {
  .bb-navbar[data-layout="auto"] .bb-navbar__inner {
    padding: 0 2vw;
  }

  .bb-navbar[data-layout="auto"] .bb-navbar__brand[data-bb-brand-layout="wordmark"] :is(img, .bb-navbar__brand-mark) {
    width: min(40vw, 11.5rem);
  }

  .bb-navbar[data-layout="auto"] .bb-navbar__action {
    font-size: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bb-navbar,
  .bb-navbar * {
    transition-duration: 0.01ms !important;
  }
}

/* Native hidden state remains authoritative under responsive navigation rules. */
.bb-navbar :is(a, button)[hidden] { display: none !important; }
