/* ==========================================================================
   PINVOICE — HEADER & MEGA MENU
   Driven by the primary WordPress menu via Pinvoice_Mega_Walker.
   Panel width comes from --pv-panel-w, set per-panel by the walker
   (Features 580, Industries 600, Free Tools 300, Download 230).
   ========================================================================== */

/* ---- Sticky translucent header ----------------------------------------- */
#masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 12, 14, 0.82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--pv-border);
}

#masthead .site-main-header-inner-wrap {
  min-height: 64px;
}

#masthead .site-header-item {
  margin-right: 0;
}

/* logo → nav gap */
#masthead .site-branding {
  margin-right: 32px;
}

#masthead .site-branding img {
  height: 30px;
  width: auto;
}

/* ---- Nav list ----------------------------------------------------------- */
.pv-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pv-nav-item {
  position: relative;
  display: flex;
  align-items: center;
}

/* Scoped to #masthead so these beat Kadence's own
   `.secondary-navigation .secondary-menu-container > ul > li.menu-item > a`
   (0,3,3), which otherwise wins on the element-count tiebreak and reimposes
   its em-based padding and palette colour. */
#masthead .pv-nav .pv-nav-link,
#masthead .pv-nav .pv-nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: auto;
  padding: 8px 12px;
  background: none;
  border: 0;
  border-radius: var(--pv-r-menu);
  color: var(--pv-text-2);
  font-family: var(--pv-font-body);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease;
}

#masthead .pv-nav .pv-nav-link:hover,
#masthead .pv-nav .pv-nav-toggle:hover,
#masthead .pv-nav .pv-nav-item.is-open > .pv-nav-toggle {
  color: var(--pv-secondary);
  background: rgba(255, 255, 255, 0.05);
}

.pv-nav-toggle:focus-visible,
.pv-nav-link:focus-visible,
.pv-mega-link:focus-visible {
  outline: 2px solid var(--pv-accent);
  outline-offset: 2px;
}

.pv-chev {
  width: 15px;
  height: 15px;
  transition: transform 150ms ease;
}

.pv-nav-item.is-open .pv-chev {
  transform: rotate(180deg);
}

/* "Log in" reads as a quieter text link */
#masthead .pv-nav .pv-nav-item.pv-nav-login > .pv-nav-link {
  padding: 0 8px;
  color: var(--pv-text-3);
  font-size: 14px;
  font-weight: 600;
}

#masthead .pv-nav .pv-nav-item.pv-nav-login > .pv-nav-link:hover {
  color: var(--pv-secondary);
  background: none;
}

/* account actions sit 8px apart, per the spec */
.pv-nav-actions {
  gap: 8px;
}

/* ---- Header CTA button (size md) --------------------------------------- */

/* header CTA is the design system's `sm` button: 34px tall, 13px text */
#masthead .pv-nav .pv-nav-item.pv-nav-cta > .pv-nav-link {
  justify-content: center;
  height: 34px;
  padding: 0 14px;
  background: var(--pv-secondary);
  border: 1px solid transparent;
  border-radius: var(--pv-r-btn);
  color: var(--pv-secondary-text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

#masthead .pv-nav .pv-nav-item.pv-nav-cta > .pv-nav-link:hover {
  background: var(--pv-secondary-hover);
  border-color: transparent;
  color: var(--pv-secondary-text);
}

/* both actions share one optical baseline */
#masthead .pv-nav-actions .pv-nav-item {
  align-items: center;
}

/* ---- Dropdown panel ----------------------------------------------------- */
.pv-mega-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  display: none;
  grid-template-columns: 1fr;
  gap: 2px;
  width: var(--pv-panel-w, 300px);
  padding: 8px;
  background: var(--pv-card-2);
  border: 1px solid var(--pv-border);
  border-radius: var(--pv-r-menu);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.pv-mega-panel[data-cols="2"] {
  grid-template-columns: 1fr 1fr;
  padding: 12px;
}

.pv-mega-panel[data-cols="3"] {
  grid-template-columns: repeat(3, 1fr);
  padding: 12px;
}

.pv-nav-item.is-open > .pv-mega-panel {
  display: grid;
}

/* keep trailing panels inside the viewport */
.pv-nav-item:nth-last-child(-n + 3) > .pv-mega-panel {
  left: auto;
  right: 0;
}

/* ---- Panel entries ------------------------------------------------------ */
.pv-mega-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--pv-r-menu);
  color: inherit;
  text-decoration: none;
  transition: background-color 150ms ease;
}

.pv-mega-link:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Link to the section's own index page, at the foot of the panel. Spans every
   column so it reads as a footer rather than another entry in the grid. */
.pv-mega-all {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 10px 12px;
  border-top: 1px solid var(--pv-border);
  color: var(--pv-accent-text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 var(--pv-r-menu) var(--pv-r-menu);
  transition: background-color 150ms ease;
}

.pv-mega-all:hover {
  color: var(--pv-secondary);
  background: rgba(255, 255, 255, 0.05);
}

.pv-mega-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: var(--pv-r-menu);
  background: var(--pv-brand-tint);
  border: 1px solid var(--pv-brand-border);
  color: var(--pv-accent-text);
}

.pv-mega-ico svg {
  width: 18px;
  height: 18px;
}

.pv-mega-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pv-mega-t {
  color: var(--pv-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.pv-mega-s {
  margin-top: 2px;
  color: var(--pv-text-3);
  font-size: 12px;
  line-height: 1.4;
}

/* ---- Mobile ------------------------------------------------------------- */
@media (max-width: 1024px) {
  .pv-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .pv-mega-panel,
  .pv-mega-panel[data-cols="2"],
  .pv-mega-panel[data-cols="3"] {
    position: static;
    width: 100%;
    grid-template-columns: 1fr;
    padding: 0 0 0 8px;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .pv-nav-item.pv-nav-cta {
    margin-left: 0;
  }

  /*
   * Drawer only: stack the toggle above its panel. Desktop #masthead keeps
   * row layout + absolute panels unchanged.
   */
  .mobile-navigation .pv-nav-item {
    flex-direction: column;
    align-items: stretch;
  }

  .mobile-navigation .pv-nav-toggle,
  .mobile-navigation .pv-nav-link {
    display: flex;
    width: 100%;
    justify-content: space-between;
    background: none;
    border: 0;
    padding-left: 0;
    box-shadow: none;
    color: var(--pv-text-2);
    font-family: var(--pv-font-body);
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
  }

  .mobile-navigation .pv-mega-link {
    display: flex !important;
  }

  .mobile-navigation .pv-nav-item.is-open > .pv-nav-toggle {
    color: var(--pv-accent-text);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pv-nav-link,
  .pv-nav-toggle,
  .pv-chev,
  .pv-mega-link {
    transition: none;
  }
}
