.sunpal-mega-media.home {
  background-image: url('../images/menu-home-energy.webp');
}

.sunpal-mega-media.mobility {
  background-image: url('../images/menu-lifepo4-100ah-designed.webp');
}

.sunpal-mega-media.support {
  background-image: url('../images/menu-customer-support.webp');
}

.sunpal-mega-media.solar {
  background-image: url('../images/menu-solar-panels.webp');
}

.sunpal-mega-media.inverter {
  background-image: url('../images/menu-off-grid-inverter-designed.webp');
}

.sunpal-mega-media.hybrid {
  background-image: url('../images/menu-hybrid-inverters-designed.webp');
}

.sunpal-mega-media.charge {
  background-image: url('../images/menu-solar-charge-controller-designed.webp');
}

.sunpal-product-card img {
  object-fit: contain;
  background: #f3f4f4;
}

.sunpal-product-rail-expanded {
  grid-template-columns: 1.05fr .9fr 1.05fr;
  align-items: start;
}

.sunpal-menu-column {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.sunpal-menu-column .sunpal-product-card {
  min-height: 0;
}

.sunpal-menu-column .sunpal-product-card img {
  aspect-ratio: 1.55;
  object-fit: contain;
}

.sunpal-menu-column-featured .sunpal-product-card {
  border-color: rgba(24, 139, 59, .42);
  box-shadow: 0 14px 36px rgba(9, 11, 13, .07);
}

.sunpal-menu-product-lines {
  display: grid;
  gap: 7px;
}

.sunpal-menu-product-lines a {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid #e5e8e6;
  background: #fff;
  color: #090b0d;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.sunpal-menu-product-lines strong {
  font-size: 13px;
  line-height: 1.15;
  letter-spacing: 0;
}

.sunpal-menu-product-lines span {
  color: #666d70;
  font-size: 12px;
  line-height: 1.3;
}

.sunpal-menu-product-lines a:hover,
.sunpal-menu-product-lines a:focus-visible {
  border-color: rgba(24, 139, 59, .45);
  background: #f4fbf6;
  outline: 0;
  transform: translateY(-1px);
}

.sunpal-menu-product-lines a.is-highlighted {
  border-color: rgba(24, 139, 59, .6);
  background: #eef8f1;
}

@media (max-width: 900px) {
  .sunpal-product-rail-expanded {
    grid-template-columns: 1fr 1fr;
  }

  .sunpal-product-card {
    min-height: 0;
    padding: 12px;
  }

  .sunpal-product-card img {
    aspect-ratio: 1.25;
    margin: 8px 0 12px;
  }
}

@media (max-width: 560px) {
  .sunpal-smart-cards,
  .sunpal-product-rail {
    grid-template-columns: 1fr 1fr;
  }

  .sunpal-product-rail-expanded {
    grid-template-columns: 1fr;
  }

  .sunpal-smart-card {
    min-height: 132px;
    padding: 16px;
  }

  .sunpal-product-card {
    min-height: 0;
  }
}

/* v1.13.0 Tesla-style desktop mega-menu proportions and motion */
@media (min-width: 901px) {
  body.sunpal-mega-open { overflow: hidden; }

  .sunpal-mega {
    height: clamp(520px, 76dvh, 760px);
    max-height: calc(100dvh - 70px);
    overflow: hidden;
    transform: translateY(-14px);
    transform-origin: center top;
    box-shadow: 0 34px 80px rgba(9, 11, 13, .15);
    transition: opacity .3s ease, transform .42s cubic-bezier(.22, .75, .18, 1), visibility 0s linear .42s;
  }

  .sunpal-mega.open {
    transform: translateY(0);
    transition-delay: 0s;
  }

  .sunpal-mega-panel {
    height: 100%;
    min-height: 0;
    padding-top: 30px;
    padding-bottom: 30px;
    overflow: hidden;
  }

  .sunpal-mega-panel.active {
    animation: sunpal-mega-panel-smooth .48s cubic-bezier(.22, .75, .18, 1) both;
  }

  .sunpal-mega-panel.active > * {
    animation: sunpal-mega-item-smooth .48s cubic-bezier(.22, .75, .18, 1) both;
  }

  .sunpal-mega-panel.active > :nth-child(2) { animation-delay: .045s; }
  .sunpal-mega-panel.active > :nth-child(3) { animation-delay: .09s; }

  .sunpal-mega-copy {
    align-self: start;
    padding-top: 5px;
  }

  .sunpal-mega-copy h2 {
    font-size: clamp(30px, 2.65vw, 43px);
    letter-spacing: 0;
  }

  .sunpal-smart-cards,
  .sunpal-product-rail-expanded {
    min-height: 0;
    max-height: 100%;
    padding-right: 9px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: rgba(22, 139, 61, .48) transparent;
    scrollbar-width: thin;
  }

  .sunpal-smart-cards::-webkit-scrollbar,
  .sunpal-product-rail-expanded::-webkit-scrollbar { width: 5px; }
  .sunpal-smart-cards::-webkit-scrollbar-thumb,
  .sunpal-product-rail-expanded::-webkit-scrollbar-thumb {
    border-radius: 5px;
    background: rgba(22, 139, 61, .45);
  }

  .sunpal-product-rail-expanded {
    align-content: start;
    height: 100%;
  }

  .sunpal-product-card {
    min-height: 0;
    padding: 12px;
  }

  .sunpal-product-card img {
    aspect-ratio: 1.65;
    margin: 7px 0 11px;
    object-fit: contain;
  }

  .sunpal-product-card strong { font-size: 16px; }
  .sunpal-product-card span:last-child {
    margin-top: 5px;
    font-size: 12px;
  }

  .sunpal-menu-product-lines { gap: 5px; }
  .sunpal-menu-product-lines a { padding: 8px 10px; }
  .sunpal-menu-product-lines strong { font-size: 12px; }
  .sunpal-menu-product-lines span { font-size: 11px; }
  .sunpal-mega-media {
    align-self: stretch;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    background-size: cover;
    transition: background-size .7s cubic-bezier(.22, .75, .18, 1), filter .3s ease, transform .5s cubic-bezier(.22, .75, .18, 1);
  }

  .sunpal-mega-media:hover {
    background-size: 104%;
    transform: translateY(-2px);
  }

  .sunpal-mega-backdrop {
    background: rgba(9, 11, 13, .34);
    backdrop-filter: blur(4px);
    transition: opacity .32s ease, visibility 0s linear .32s;
  }
}

@keyframes sunpal-mega-panel-smooth {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes sunpal-mega-item-smooth {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .sunpal-mega-panel.active,
  .sunpal-mega-panel.active > * { animation: none !important; }
}

/* === menu-v18 (world-class bar) merged === */

/**
 * 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;
}

/* Header actions: keep Cart + toggle on one optical midline. */
.sunpal-header-actions {
  align-items: center;
}

/* Kill Tailwind/browser button chrome — open state must stay a clean ink X. */
.sunpal-menu-toggle {
  appearance: none;
  -webkit-appearance: none;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  color: var(--ink, #090b0d) !important;
  box-shadow: none !important;
  cursor: pointer;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.sunpal-menu-toggle:hover,
.sunpal-menu-toggle:focus-visible {
  color: var(--nav-green, #168b3d) !important;
  background: transparent !important;
}

.sunpal-menu-toggle[aria-expanded="true"] {
  background: transparent !important;
  border: 0 !important;
  color: var(--ink, #090b0d) !important;
}

.sunpal-menu-toggle i {
  background: currentColor !important;
}

/* —— 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;
  }

  /* Beat page CSS (home/product) that compresses desktop nav labels. */
  body.sunpal-menu-open .sunpal-nav > a,
  body.sunpal-menu-open .sunpal-nav-trigger {
    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;
  }
}

/* Bottom mobile navigation bar */
.sunpal-bottom-nav {
  display: none;
}

@media (max-width: 900px) {
  .sunpal-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 64px;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(9,11,13,.08);
    box-shadow: 0 -4px 20px rgba(9,11,13,.06);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .sunpal-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    padding: 8px 12px;
    position: relative;
    transition: color 0.2s ease;
  }

  .sunpal-bottom-nav-item.active,
  .sunpal-bottom-nav-item:hover {
    color: var(--green);
  }

  .sunpal-bottom-nav-item svg {
    width: 24px;
    height: 24px;
  }

  .sunpal-bottom-nav-cart {
    position: relative;
  }

  .sunpal-bottom-nav-count {
    position: absolute;
    top: 2px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--green);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: grid;
    place-items: center;
    padding: 0 4px;
    line-height: 1;
  }

  /* Add padding to page content so it doesn't hide behind bottom nav */
  body {
    padding-bottom: 80px;
  }

  /* Hide bottom nav when mobile menu is open */
  body.sunpal-menu-open .sunpal-bottom-nav,
  body.sunpal-mega-open .sunpal-bottom-nav {
    display: none;
  }
}
