/* Header component for Buildmaterialpl
   Relies on base.css for resets, colors, and layout helpers. */

.bm-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #0b1220;
  color: #f9fafb;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  backdrop-filter: blur(10px);
}

.bm-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.bm-header__brand {
  display: flex;
  align-items: center;
}

.bm-header__logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
}

.bm-header__logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: linear-gradient(135deg, #1d4ed8, #0ea5e9);
  position: relative;
  overflow: hidden;
}

.bm-header__logo-mark::before,
.bm-header__logo-mark::after {
  content: "";
  position: absolute;
  inset: 20%;
  border-radius: 3px;
  border: 2px solid rgba(15, 23, 42, 0.85);
}

.bm-header__logo-mark::after {
  inset: 35% 10% 10% 35%;
}

.bm-header__logo-text {
  font-family: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.9rem;
  color: #e5e7eb;
}

/* Navigation */

.bm-header__nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1.75rem;
}

.bm-header__nav-list {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.bm-header__nav-link {
  font-family: "Roboto", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: #e5e7eb;
  text-decoration: none;
  padding: 0.3rem 0;
  position: relative;
}

.bm-header__nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: #38bdf8;
  transition: width 0.18s ease-out;
}

.bm-header__nav-link:hover::after,
.bm-header__nav-link:focus-visible::after {
  width: 100%;
}

.bm-header__nav-link:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 3px;
  border-radius: 3px;
}

.bm-header__cta-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.bm-header__support-link {
  font-family: "Roboto", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.9rem;
  text-decoration: none;
  color: #cbd5f5;
}

.bm-header__support-link:hover,
.bm-header__support-link:focus-visible {
  color: #e5e7eb;
}

.bm-header__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid #1d4ed8;
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: #f9fafb;
  font-family: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.45);
}

.bm-header__cta-icon {
  display: inline-flex;
}

.bm-header__cta:hover {
  filter: brightness(1.05);
}

.bm-header__cta:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 3px;
}

/* Mobile toggle */

.bm-header__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.85);
  cursor: pointer;
  padding: 0;
}

.bm-header__toggle-bar {
  width: 1.4rem;
  height: 2px;
  border-radius: 999px;
  background: #e5e7eb;
  transition: transform 0.2s ease, opacity 0.2s ease, width 0.2s ease;
}

.bm-header__toggle-bar:nth-child(1) {
  transform: translateY(-6px);
}

.bm-header__toggle-bar:nth-child(3) {
  transform: translateY(6px);
}

.bm-header__toggle:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 3px;
}

/* Toggle open state */

.bm-header--menu-open .bm-header__toggle-bar:nth-child(1) {
  transform: translateY(2.5px) rotate(45deg);
  
}

.bm-header--menu-open .bm-header__toggle-bar:nth-child(2) {
  opacity: 0;
  width: 0;
}

.bm-header--menu-open .bm-header__toggle-bar:nth-child(3) {
  transform: translateY(-2.5px) rotate(-45deg);
}

/* Responsive layout */

@media (max-width: 768px) {
  .bm-header__inner {
    padding-inline: 1rem;
  }

  .bm-header__toggle {
    display: inline-flex;
  }

  .bm-header__nav {
    position: absolute;
    inset-inline: 0;
    top: 100%;
    background: #020617;
    border-bottom: 1px solid rgba(148, 163, 184, 0.4);
    display: block;
    transform-origin: top;
  }

  .bm-header__nav-list {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 1rem 0.5rem;
    gap: 0.3rem;
  }

  .bm-header__nav-link {
    display: block;
    width: 100%;
    padding: 0.45rem 0.25rem;
  }

  .bm-header__cta-group {
    display: none;
    padding: 0 1rem 0.85rem;
    border-top: 1px solid rgba(30, 64, 175, 0.6);
  }

  .bm-header--menu-open .bm-header__nav-list,
  .bm-header--menu-open .bm-header__cta-group {
    display: flex;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bm-header__nav-link::after,
  .bm-header__toggle-bar {
    transition: none;
  }
}
