/* ════════════════════════════════════════════════════════════════
   Shared site navigation — single source of truth for the top bar
   on every sales-site page. Markup lives in templates/_nav.html,
   behavior in static/nav.js.

   Sizing: the bar and logo both follow --nav-height, and the mobile
   dropdown anchors to the bottom edge of the bar (top: 100%), so
   resizing the logo can never detach the hamburger menu. To resize,
   change --nav-height here (desktop) or in the mobile override —
   everything else follows.

   Relies on the page palette: --primary, --secondary, --accent.
   ════════════════════════════════════════════════════════════════ */

:root {
  --nav-height: 135px;
}

.site-nav {
  background: var(--secondary);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo img {
  height: var(--nav-height);
  width: auto;
  border-radius: 6px;
}

.nav-logo span {
  font-size: 1.4rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.nav-logo span em {
  color: var(--primary);
  font-style: normal;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
  list-style: none;
}

.nav-links a {
  color: #cbd5e0;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--primary);
  color: #ffffff;
}

.nav-cta {
  margin-left: 1rem;
  background: var(--accent) !important;
  color: #ffffff !important;
  padding: 0.5rem 1.2rem !important;
}

.nav-cta:hover {
  background: #219a52 !important;
}

/* Hamburger toggle — hidden on desktop, revealed under the breakpoint */
.nav-toggle {
  display: none;
  margin-left: auto;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 3px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

@media (max-width: 768px) {
  :root { --nav-height: 80px; }

  .site-nav { padding: 0 1rem; }
  .nav-logo { gap: 0.6rem; }
  .nav-logo img { height: calc(var(--nav-height) - 16px); }
  .nav-logo span { font-size: 1.15rem; }

  .nav-toggle { display: flex; }

  /* Collapse the link list into a slide-down panel glued to the bar's
     bottom edge. top: 100% tracks the bar height automatically. */
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    margin-left: 0;
    padding: 0.5rem 1rem 1rem;
    background: var(--secondary);
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    max-height: calc(100vh - var(--nav-height));
    overflow-y: auto;
    transform: translateY(-150%);
    visibility: hidden;
    /* visibility flips instantly on open, and only after the
       slide-up finishes on close (0s duration, 0.25s delay) */
    transition: transform 0.25s ease, visibility 0s linear 0.25s;
  }
  .nav-links.open {
    transform: translateY(0);
    visibility: visible;
    transition: transform 0.25s ease, visibility 0s;
  }
  .nav-links a {
    padding: 0.85rem 1rem 0.85rem 1.5rem;
    font-size: 1rem;
    position: relative;
  }

  /* In the hamburger menu the selected link gets a dot beside it,
     not the desktop's filled-button treatment. */
  .nav-links a:hover,
  .nav-links a.active {
    background: transparent;
    color: #ffffff;
  }
  .nav-links a.active::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f59e0b;
  }

  .nav-cta { margin-left: 0; text-align: center; }

  /* Animate hamburger into an X when the menu is open */
  .nav-toggle.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .nav-toggle.open span:nth-child(2) { opacity: 0; }
  .nav-toggle.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
}

/* Very narrow phones: drop the wordmark so logo + hamburger always fit */
@media (max-width: 480px) {
  .nav-logo span { display: none; }
}
