/**
 * Sunpal top menu — world-class bar (v18)
 * Loads after theme.css + menu-v17.css
 */

:root {
  --nav-ink: #14201a;
  --nav-muted: #5c6b63;
  --nav-line: rgba(20, 32, 26, 0.08);
  --nav-green: #168b3d;
  --nav-bg: rgba(255, 255, 255, 0.86);
  --nav-bg-scrolled: rgba(255, 255, 255, 0.94);
  --nav-height: 74px;
  --nav-font: "Manrope", system-ui, sans-serif;
  --nav-shadow: 0 14px 40px rgba(20, 32, 26, 0.08);
}

/* —— Bar chrome —— */
.sunpal-header {
  font-family: var(--nav-font);
  background:
    linear-gradient(180deg, rgba(243, 246, 244, 0.55), transparent 70%),
    var(--nav-bg);
  border-bottom-color: var(--nav-line);
  transition: background 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

.sunpal-header.is-scrolled {
  background: var(--nav-bg-scrolled);
  box-shadow: var(--nav-shadow);
  border-bottom-color: transparent;
}

.sunpal-header.is-mega-open {
  background: #fff;
  box-shadow: none;
}

.sunpal-header-inner {
  height: var(--nav-height);
  max-width: min(1380px, 100%);
  padding: 0 clamp(18px, 3vw, 32px);
}

.sunpal-brand {
  width: auto;
  max-width: 170px;
}

.sunpal-brand img,
.custom-logo {
  width: auto;
  max-width: 170px;
  max-height: 48px;
  transition: transform 0.35s cubic-bezier(0.22, 0.75, 0.18, 1);
}

.sunpal-header.is-scrolled .sunpal-brand img,
.sunpal-header.is-scrolled .custom-logo {
  transform: scale(0.96);
}

/* —— Primary nav —— */
.sunpal-nav {
  gap: clamp(22px, 2.4vw, 36px);
  height: var(--nav-height);
}

.sunpal-nav > a,
.sunpal-nav-trigger {
  height: var(--nav-height);
  color: var(--nav-ink);
  font: 700 14px/1 var(--nav-font);
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
}

.sunpal-nav > a:hover,
.sunpal-nav-trigger:hover,
.sunpal-nav > a:focus-visible,
.sunpal-nav-trigger:focus-visible,
.sunpal-nav-trigger[aria-expanded="true"] {
  color: var(--nav-green);
}

.sunpal-nav-indicator {
  height: 2px;
  bottom: 12px;
  border-radius: 2px;
  background: var(--nav-green);
}

/* —— Actions —— */
.sunpal-header-actions {
  gap: 14px;
  align-items: center;
}

.sunpal-header-search input[type="search"] {
  width: 132px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--nav-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--nav-ink);
  font: 600 13px/1 var(--nav-font);
  transition: width 0.28s cubic-bezier(0.22, 0.75, 0.18, 1), border-color 0.2s, box-shadow 0.2s;
}

.sunpal-header-search input[type="search"]:focus {
  width: 200px;
  border-color: rgba(22, 139, 61, 0.45);
  box-shadow: 0 0 0 3px rgba(22, 139, 61, 0.12);
}

.sunpal-header-account {
  font: 700 13px/1 var(--nav-font);
  color: var(--nav-muted);
  transition: color 0.2s ease;
}

.sunpal-header-account:hover,
.sunpal-header-account:focus-visible {
  color: var(--nav-ink);
}

.sunpal-header .sunpal-cart {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 2px;
  font: 700 13px/1 var(--nav-font);
  color: var(--nav-ink);
}

/* theme.css historically styled ALL .sunpal-cart span as a black pill —
   that turned the "Cart" label into a cramped circle. Scope to count only. */
.sunpal-header .sunpal-cart .sunpal-cart-label {
  display: inline;
  position: static;
  width: auto;
  min-width: 0;
  height: auto;
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  clip: auto;
  overflow: visible;
}

.sunpal-header .sunpal-cart .sunpal-cart-count {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--nav-green);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.sunpal-menu-toggle {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.sunpal-menu-toggle:hover,
.sunpal-menu-toggle:focus-visible,
.sunpal-menu-toggle[aria-expanded="true"] {
  background: rgba(22, 139, 61, 0.06);
  border-color: rgba(22, 139, 61, 0.18);
}

/* —— Mega copy + quicklinks —— */
.sunpal-mega-copy span {
  color: var(--nav-green);
  font: 800 11px/1 var(--nav-font);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sunpal-mega-copy h2 {
  font-family: var(--nav-font);
  font-weight: 800;
  letter-spacing: -0.035em;
}

.sunpal-mega-quicklinks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.sunpal-mega-quicklinks a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--nav-line);
  border-radius: 999px;
  background: #fff;
  color: var(--nav-ink);
  font: 700 12px/1 var(--nav-font);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.sunpal-mega-quicklinks a:hover,
.sunpal-mega-quicklinks a:focus-visible {
  border-color: rgba(22, 139, 61, 0.4);
  background: #f4fbf6;
  transform: translateY(-1px);
  outline: 0;
}

.sunpal-smart-cards--support {
  grid-template-columns: 1fr 1fr;
}

.sunpal-mega-support-aside {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

.sunpal-mega-aside-links {
  display: grid;
  gap: 8px;
}

.sunpal-mega-aside-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--nav-line);
  border-radius: 12px;
  background: #fff;
  color: var(--nav-ink);
  font: 700 13px/1 var(--nav-font);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.sunpal-mega-aside-links a:hover,
.sunpal-mega-aside-links a:focus-visible {
  border-color: rgba(22, 139, 61, 0.4);
  background: #f4fbf6;
  outline: 0;
}

.sunpal-mega-aside-links a::after {
  content: "→";
  color: var(--nav-green);
  font-weight: 800;
}

/* Product lines: quieter hover (less noise) */
.sunpal-menu-product-lines a {
  border-radius: 12px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.sunpal-menu-product-lines a:hover,
.sunpal-menu-product-lines a:focus-visible {
  transform: none;
}

.sunpal-smart-card,
.sunpal-product-card {
  border-radius: 14px;
}

@media (min-width: 901px) {
  .sunpal-mega {
    top: var(--nav-height);
    max-height: calc(100dvh - var(--nav-height));
    border-top: 1px solid var(--nav-line);
    box-shadow: 0 40px 90px rgba(20, 32, 26, 0.14);
  }

  .sunpal-nav {
    height: var(--nav-height);
  }

  /* Presence motions */
  .sunpal-header.is-scrolled {
    animation: sunpal-nav-settle 0.45s cubic-bezier(0.22, 0.75, 0.18, 1) both;
  }

  .sunpal-mega.open {
    animation: sunpal-mega-rise 0.42s cubic-bezier(0.22, 0.75, 0.18, 1) both;
  }
}

@keyframes sunpal-nav-settle {
  from { transform: translateY(-2px); }
  to { transform: translateY(0); }
}

@keyframes sunpal-mega-rise {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .sunpal-header-inner {
    height: var(--nav-height);
  }

  /*
   * Sticky header uses backdrop-filter, which becomes a containing block for
   * position:fixed descendants. With inset bottom:0 the panel height collapses
   * to ~0 inside the 74px bar — labels overflow onto the hero with no fill.
   * Drop the filter while open and size the sheet against the viewport.
   */
  body.sunpal-menu-open .sunpal-header,
  body.sunpal-mega-open .sunpal-header {
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    overflow: visible;
  }

  .sunpal-nav {
    top: var(--nav-height);
    right: 0;
    bottom: auto;
    left: 0;
    width: 100%;
    height: calc(100dvh - var(--nav-height));
    min-height: calc(100dvh - var(--nav-height));
    z-index: 7;
    padding: 18px 22px 110px;
    background: #fff;
    overscroll-behavior: contain;
  }

  .sunpal-nav.open {
    background: #fff;
  }

  .sunpal-nav > a,
  .sunpal-nav-trigger {
    font-family: var(--nav-font);
    font-size: clamp(26px, 7vw, 34px);
    font-weight: 800;
    letter-spacing: -0.04em;
    padding: 18px 0;
  }

  .sunpal-mega {
    top: var(--nav-height);
    right: 0;
    bottom: auto;
    left: 0;
    width: 100%;
    height: calc(100dvh - var(--nav-height));
    min-height: calc(100dvh - var(--nav-height));
    z-index: 8;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateX(100%);
    background: #fff;
    overscroll-behavior: contain;
  }

  .sunpal-mega.open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .sunpal-mega-panel {
    display: none;
  }

  .sunpal-mega-panel.active {
    display: grid;
  }

  .sunpal-mega-mobile-back {
    height: 52px;
    font: 700 14px/1 var(--nav-font);
  }

  /* Keep chat / social toasts from covering menu taps */
  body.sunpal-menu-open .sunpal-chat,
  body.sunpal-mega-open .sunpal-chat,
  body.sunpal-menu-open .sunpal-social-toast-host,
  body.sunpal-mega-open .sunpal-social-toast-host {
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .sunpal-header-actions > a.sunpal-header-account {
    display: none;
  }

  .sunpal-mega-support-aside {
    order: 3;
  }

  .sunpal-smart-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .sunpal-brand img,
  .custom-logo {
    max-width: 132px;
    max-height: 40px;
  }

  .sunpal-header-search input[type="search"] {
    width: 96px;
  }

  .sunpal-header-search input[type="search"]:focus {
    width: 140px;
  }

  .sunpal-mega-quicklinks a {
    min-height: 32px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sunpal-header.is-scrolled,
  .sunpal-mega.open,
  .sunpal-brand img,
  .custom-logo {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}
