.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; }
}
