/**
 * Products mega menu — desktop panel with continuous hover hit-area.
 *
 * Do NOT use the legacy `.sub-menu` class on the mega grid.
 * Critical: when closed, descendants must NOT re-enable visibility/pointer-events
 * (that made an invisible hit-box cover the hero and open the menu on hover).
 */

.wh-header-bar {
  position: relative;
  z-index: 10040;
}

.wh-nav-menu > li.menu-item--mega {
  position: static;
}

.wh-nav-menu > li.menu-item--mega > a {
  position: relative;
  z-index: 2;
}

/*
 * Panel anchors to the header bar bottom and overlaps upward into the nav
 * so the cursor never leaves the open hit-area when moving into the menu.
 */
.wh-nav-menu > li.menu-item--mega > .wh-mega {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  width: min(var(--tx-mega-width, 900px), calc(100vw - var(--tx-mega-gutter, 40px)));
  margin: 0;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.16s ease, visibility 0.16s ease;
  z-index: 10080;
}

/* Closed: lock descendants so the inert panel cannot steal hover over the hero */
.wh-nav-menu > li.menu-item--mega:not(:hover):not(:focus-within):not(.is-open):not(.is-mega-open) > .wh-mega,
.wh-nav-menu > li.menu-item--mega:not(:hover):not(:focus-within):not(.is-open):not(.is-mega-open) > .wh-mega * {
  pointer-events: none !important;
  visibility: inherit !important;
}

/* Overlap bridge — only active while open (inherits pointer-events from panel) */
.wh-mega__bridge {
  position: absolute;
  left: 0;
  right: 0;
  top: -12px;
  height: 12px;
  background: transparent;
}

.wh-mega__inner {
  position: relative;
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 16px;
  box-shadow: 0 28px 60px rgba(15, 23, 42, 0.16);
  padding: 18px;
  overflow: hidden;
}

.wh-nav-menu > li.menu-item--mega:hover > .wh-mega,
.wh-nav-menu > li.menu-item--mega:focus-within > .wh-mega,
.wh-nav-menu > li.menu-item--mega.is-open > .wh-mega,
.wh-nav-menu > li.menu-item--mega.is-mega-open > .wh-mega {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.wh-nav-menu > li.menu-item--mega:hover > .wh-mega *,
.wh-nav-menu > li.menu-item--mega:focus-within > .wh-mega *,
.wh-nav-menu > li.menu-item--mega.is-open > .wh-mega *,
.wh-nav-menu > li.menu-item--mega.is-mega-open > .wh-mega * {
  pointer-events: auto !important;
}

.wh-mega__grid {
  display: grid !important;
  grid-template-columns: repeat(var(--tx-mega-cols, 3), minmax(0, 1fr));
  gap: 12px;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  position: static !important;
  left: auto !important;
  top: auto !important;
  min-width: 0 !important;
  width: 100% !important;
  max-width: none !important;
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  /* Do NOT force opacity/visibility/pointer-events — closed panel must stay inert */
  transform: none !important;
  flex-direction: unset !important;
}

.wh-mega__grid > li,
.wh-mega__item {
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
  position: relative;
  min-width: 0;
}

.wh-mega__card {
  display: flex !important;
  flex-direction: column;
  height: 100%;
  text-decoration: none !important;
  color: inherit;
  border-radius: 12px;
  overflow: hidden;
  background: #f7f7f5;
  border: 1px solid #ececec;
  padding: 0 !important;
  white-space: normal !important;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.wh-mega__card:hover,
.wh-mega__card:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(200, 16, 46, 0.35);
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.1);
  background: #f7f7f5 !important;
  color: inherit !important;
}

.wh-mega__media {
  display: block;
  aspect-ratio: 4 / 3;
  background: linear-gradient(145deg, #1a1a1a 0%, #2e2e2e 55%, #4a4a4a 100%);
  overflow: hidden;
}

.wh-mega__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.35s ease;
}

.wh-mega__card:hover .wh-mega__media img {
  transform: scale(1.05);
}

.wh-mega__copy {
  display: grid;
  gap: 6px;
  padding: 12px 12px 14px;
  background: #f7f7f5;
}

.wh-mega__title {
  font-family: var(--tx-font-heading, Syne, sans-serif);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #111;
  line-height: 1.25;
}

.wh-mega__desc {
  font-size: 12px;
  line-height: 1.4;
  color: #6b7280;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wh-mega__cta {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tx-accent, #c8102e);
  margin-top: 2px;
}

.wh-mega__footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #ececec;
}

.wh-mega__all {
  font-family: var(--tx-font-heading, Syne, sans-serif);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #111;
  text-decoration: none;
}

.wh-mega__all:hover {
  color: var(--tx-accent, #c8102e);
}

.wh-nav-menu > li.menu-item--mega > .sub-menu {
  display: none !important;
}

@media (max-width: 1100px) {
  .wh-mega__grid {
    grid-template-columns: repeat(min(3, var(--tx-mega-cols, 3)), minmax(0, 1fr));
  }
}

/* Keep header nav stretch working on desktop */
@media (min-width: 1101px) {
  .wh-header-bar-inner {
    align-items: stretch;
  }

  .wh-header-logo,
  .wh-header-actions {
    display: flex;
    align-items: center;
  }
}

@media (max-width: 1100px) {
  .wh-nav-menu > li.menu-item--mega > .wh-mega {
    display: none !important;
  }

  .wh-nav-menu > li > a {
    min-height: 0;
    height: auto;
    padding: 10px 14px;
  }
}

.wh-mobile-drawer .terea-cat-drawer-item > .terea-cat-drawer-row > a {
  gap: 12px;
}

.wh-mobile-drawer .terea-cat-drawer-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  background: #f3f4f6;
  flex: 0 0 auto;
}

.wh-mobile-drawer .terea-cat-drawer-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
