/* =====================================================================
   Top utility bar + main navigation
   ===================================================================== */
.topbar {
  background: var(--color-navy-900);
  color: var(--color-slate-300);
  font-size: var(--text-xs);
}
.topbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}
.topbar a { color: var(--color-slate-300); }
.topbar a:hover { color: var(--color-white); }
.topbar-item + .topbar-item { margin-left: var(--space-5); }
.topbar-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-orange-500) !important;
  font-weight: 600;
}
@media (max-width: 640px) {
  .topbar .topbar-item.hide-mobile { display: none; }
}

/* ---- Main nav ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
}
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  flex-wrap: nowrap;
  gap: var(--space-3);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--color-navy-900);
  min-width: 0; /* allows the flex item to shrink instead of forcing overflow */
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--color-navy-700);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-name span { color: var(--color-orange-500); }

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.nav-links a {
  color: var(--color-ink);
  font-weight: 500;
  font-size: var(--text-sm);
  padding: var(--space-2) 0;
  position: relative;
}
.nav-links a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--color-orange-500);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-base) var(--ease-out);
}
.nav-links a:hover::after,
.nav-links a.active::after {
  transform: scaleX(1);
}
.nav-links a.active { color: var(--color-navy-700); }

/* Mobile-only CTA row inside the dropdown — hidden on desktop and on the
   960px tablet breakpoint, only appears at the ~480px breakpoint below. */
.nav-cta-mobile { display: none; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.nav-toggle {
  display: none;
  background: none;
  border: none;
  padding: var(--space-2);
  color: var(--color-navy-900);
  /* comfortable tap target on touch devices, regardless of icon size */
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}
.nav-toggle svg { width: 26px; height: 26px; }

/* ---- Tablet / mobile: collapse into a dropdown ---- */
@media (max-width: 960px) {
  .nav-links {
    /* Positioned relative to .site-header (nearest positioned ancestor),
       so it always sits flush under the actual header — no more guessing
       the topbar's height with a hardcoded offset. */
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-white);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: all var(--duration-base) var(--ease-out);
    /* keep the menu usable on short / landscape phone screens instead of
       letting it run off the bottom of the viewport unreachably */
    max-height: calc(100vh - var(--header-height));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav-links.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .nav-links a { width: 100%; padding: var(--space-3) 0; }
  .nav-toggle { display: inline-flex; }
}

/* ---- Small phones: header row is too tight for brand + CTA + toggle ---- */
@media (max-width: 480px) {
  .brand-name { font-size: var(--text-base); }
  .brand-mark { width: 32px; height: 32px; }
  .brand-mark svg { width: 18px; height: 18px; }

  /* Drop the header-level CTA and rely on the one inside the dropdown
     instead, so the collapsed header only ever holds brand + toggle. */
  .nav-actions > a.btn-primary { display: none; }

  .nav-cta-mobile {
    display: block;
    width: 100%;
    margin-top: var(--space-3);
  }
  .nav-cta-mobile .btn { width: 100%; text-align: center; }
}