.tmm-root {
  position: relative;
  display: inline-block;
  font-family: inherit;
}

li.menu-item.tmm-has-mega {
  position: relative;
}

/*
 * Nav mega: when closed, takes no flow space (no empty box).
 * On open, JS moves the panel to document.body + fixed; ancestor transform no longer breaks position.
 */
.tmm-root.tmm-in-nav:not(.tmm-is-open) {
  display: none !important;
}

.tmm-root.tmm-in-nav.tmm-is-open {
  display: block !important;
}

.tmm-root.tmm-in-nav {
  z-index: 100000;
  box-sizing: border-box;
}

.tmm-root.tmm-in-nav .tmm-dropdown {
  position: relative;
  left: auto;
  right: auto;
  top: auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  box-sizing: border-box;
  border-radius: 0 0 8px 8px;
  border-left-width: 0;
  border-right-width: 0;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
  background: #fff;
}

/* Full width: no narrow inner column / grey side gutters */
.tmm-root.tmm-in-nav .tmm-dropdown-inner {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 1rem clamp(12px, 3vw, 40px);
  box-sizing: border-box;
}

/* Reduce double white frame / extra vertical padding */
.tmm-root.tmm-in-nav .tmm-panels {
  min-height: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}

.tmm-root.tmm-in-nav .tmm-panel-content {
  min-height: 0;
}

.tmm-root.tmm-in-nav .tmm-panel-content .elementor {
  max-width: 100%;
}

/*
 * Nav mega: no left “button” column — tabs on top; Elementor / panel full width.
 */
.tmm-root.tmm-in-nav .tmm-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  grid-template-columns: unset;
  min-width: 0;
  width: 100%;
}

.tmm-root.tmm-in-nav .tmm-tabs {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1.25rem;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0 0 0.75rem;
  border-bottom: 1px solid #e8e8e8;
  box-sizing: border-box;
}

.tmm-root.tmm-in-nav .tmm-tab {
  text-align: left;
  border: none;
  border-radius: 0;
  padding: 0.25rem 0;
  background: transparent;
  box-shadow: none;
}

.tmm-root.tmm-in-nav .tmm-tab:hover,
.tmm-root.tmm-in-nav .tmm-tab:focus-visible {
  background: transparent;
  border: none;
  outline: none;
}

.tmm-root.tmm-in-nav .tmm-tab:focus-visible {
  outline: 2px solid #2271b1;
  outline-offset: 2px;
}

.tmm-root.tmm-in-nav .tmm-tab[aria-selected='true'] {
  background: transparent;
  border: none;
  box-shadow: none;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.25em;
}

.tmm-root.tmm-in-nav .tmm-panels {
  width: 100%;
  max-width: 100%;
}

/* Single tab: hide top bar — content only */
.tmm-root.tmm-in-nav .tmm-tabs:has(> .tmm-tab:only-child) {
  display: none;
}

.tmm-root.tmm-in-nav .tmm-layout:has(.tmm-tabs:has(> .tmm-tab:only-child)) {
  gap: 0;
}

.tmm-trigger {
  cursor: pointer;
  border: 1px solid #c8c8c8;
  background: #fff;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font: inherit;
}

.tmm-trigger:hover,
.tmm-trigger:focus-visible {
  border-color: #888;
  outline: 2px solid #2271b1;
  outline-offset: 1px;
}

.tmm-dropdown {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 100000;
  min-width: min(960px, 92vw);
  max-width: 96vw;
  background: #f0f0f1;
  border: 1px solid #dcdcde;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  box-sizing: border-box;
}

.tmm-dropdown-inner {
  padding: 1.25rem 1.5rem;
  box-sizing: border-box;
}

.tmm-layout {
  display: grid;
  grid-template-columns: minmax(180px, min(260px, 32vw)) 1fr;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  align-items: stretch;
  min-width: 0;
}

@media (max-width: 782px) {
  .tmm-layout {
    grid-template-columns: 1fr;
  }

  .tmm-tabs {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

@media (max-width: 600px) {
  .tmm-mega-children-list {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.65rem;
  }
}

.tmm-tabs {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tmm-tab {
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.tmm-tab:hover,
.tmm-tab:focus-visible {
  background: rgba(255, 255, 255, 0.7);
  border-color: #dcdcde;
  outline: none;
}

.tmm-tab[aria-selected='true'] {
  background: #fff;
  border-color: #c3c4c7;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.tmm-tab-title {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
}

.tmm-tab-desc {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.8rem;
  opacity: 0.72;
  line-height: 1.35;
}

.tmm-panels {
  min-height: 200px;
  background: #fff;
  border: 1px solid #dcdcde;
  border-radius: 8px;
  padding: 1rem;
  min-width: 0;
  box-sizing: border-box;
}

.tmm-panel[hidden] {
  display: none !important;
}

.tmm-panel.is-active {
  display: block;
}

.tmm-panel-content {
  min-height: 120px;
}

.tmm-panel-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #50575e;
}

.tmm-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid #dcdcde;
  border-top-color: #2271b1;
  border-radius: 50%;
  animation: tmm-spin 0.7s linear infinite;
}

.tmm-panel-content.tmm-is-fetching .tmm-spinner {
  display: inline-block;
}

@keyframes tmm-spin {
  to {
    transform: rotate(360deg);
  }
}

.tmm-root .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tmm-error,
.tmm-notice,
.tmm-empty {
  margin: 0;
  padding: 0.5rem;
  color: #50575e;
  font-size: 0.9rem;
}

/* WordPress child menu items (optional image/HTML in Screen Options → Description) */
.tmm-mega-children {
  margin-bottom: 1rem;
}

.tmm-mega-children-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.tmm-mega-child-item {
  margin: 0;
}

.tmm-mega-child-link {
  display: block;
  font-weight: 600;
  text-decoration: none;
  color: inherit;
}

.tmm-mega-child-link:hover,
.tmm-mega-child-link:focus-visible {
  text-decoration: underline;
}

.tmm-mega-child-desc {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  line-height: 1.35;
  opacity: 0.92;
}

.tmm-mega-child-desc img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

.tmm-layout.tmm-has-child-links {
  margin-top: 0.5rem;
  border-top: 1px solid #dcdcde;
  padding-top: 1rem;
}

.tmm-dropdown-inner.tmm-mega-children-only .tmm-mega-children {
  margin-bottom: 0;
}

/* Visibility: hide theme sub-menu (li) and portaled mega root (.tmm-root) */

@media (min-width: 992px) {
  li.menu-item.tmm-has-mega.tmm-mega-show-desktop > ul.sub-menu {
    display: none !important;
  }

  .tmm-root.tmm-in-nav.tmm-mega-hide-desktop {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

@media (max-width: 991.98px) {
  .tmm-root.tmm-in-nav.tmm-mega-hide-mobile {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .tmm-root.tmm-in-nav.tmm-mega-show-mobile.tmm-is-open {
    display: block !important;
    visibility: visible !important;
  }

  li.menu-item.tmm-has-mega.tmm-mega-show-mobile > ul.sub-menu {
    display: none !important;
  }
}
