/* ==========================================================================
   Top bar + sticky header + mobile menu
   ========================================================================== */

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: var(--z-header);
  background: rgba(246, 248, 251, 0.92);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.site-header.is-scrolled {
  border-bottom-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

/* Three columns: brand | centered links | actions.
   The outer columns share the leftover space equally, so the links sit in the true centre. */
.navbar {
  min-height: var(--header-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-4);
}

.navbar .brand {
  justify-self: start;
}

.nav-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Extra specificity so these beat .btn's display in buttons.css (loaded later) */
.nav-menu .nav-menu__cta {
  display: none;
}

/* Brand */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--color-navy);
}

.brand img {
  display: block;
  height: 52px !important;
  /* change this number to resize */
  width: auto !important;
  max-width: 200px;
  object-fit: contain;
}

.site-footer .brand img {
  height: 64px !important;
}

@media (max-width: 959px) {
  .site-header .brand img {
    height: 44px !important;
  }
}

.brand:hover {
  color: var(--color-navy);
}

.brand__mark {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  background: var(--color-navy);
  color: var(--color-orange);
  display: grid;
  place-items: center;
}

.brand__mark .icon {
  width: 1.4rem;
  height: 1.4rem;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.375rem;
  letter-spacing: -0.02em;
}

.brand__tag {
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* Links */
.nav-menu {
  justify-self: center;
  display: flex;
  align-items: center;
}

.nav-links {
  list-style: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2) clamp(1.25rem, 0.5rem + 1.5vw, 2rem);
}

.nav-links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--color-navy);
  text-decoration: none;
  font-weight: 500;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  height: 2px;
  background: var(--color-orange);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration) var(--ease);
}

.nav-links a:hover::after,
.nav-links a[aria-current]::after {
  transform: scaleX(1);
}

/* Toggle (mobile) */
.nav-toggle {
  display: none;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  color: var(--color-navy);
  align-items: center;
  justify-content: center;
}

.nav-toggle:hover {
  background: var(--color-surface-alt);
}

.nav-toggle .icon {
  width: 1.6rem;
  height: 1.6rem;
}

.nav-toggle .icon-close {
  display: none;
}

.nav-toggle[aria-expanded="true"] .icon-open {
  display: none;
}

.nav-toggle[aria-expanded="true"] .icon-close {
  display: block;
}

@media (max-width: 959px) {
  .nav-toggle {
    display: inline-flex;
  }

  /* backdrop-filter would trap the fixed menu inside the header, so use a solid bar on mobile */
  .site-header {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--color-bg);
  }

  .nav-menu {
    position: fixed;
    /* --menu-top is set by navbar.js to the header's bottom edge */
    inset: var(--menu-top, calc(var(--header-h) + env(safe-area-inset-top, 0px))) 0 0 0;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-6);
    padding: var(--space-6) max(1rem, env(safe-area-inset-right, 0px)) calc(var(--space-8) + env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px));
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease), visibility 0s linear var(--duration);
  }

  .nav-menu.is-open {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease);
  }

  .nav-links {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .nav-links li {
    border-bottom: 1px solid var(--color-border);
  }

  .nav-links a {
    width: 100%;
    min-height: 58px;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
  }

  .nav-links a::after {
    display: none;
  }

  .nav-links a[aria-current] {
    color: var(--color-blue);
  }

  .nav-menu .nav-menu__cta {
    display: inline-flex;
    width: 100%;
  }

  body.nav-open {
    overflow: hidden;
  }

  /* Mobile: brand left, actions right (the link list lives in the slide-down menu) */
  .navbar {
    display: flex;
    justify-content: space-between;
  }
}

/* Phones: the header "Get a quote" button moves into the menu */
@media (max-width: 479px) {
  .nav-actions .nav-cta {
    display: none;
  }
}

@media (max-width: 360px) {
  .brand__tag {
    display: none;
  }
}