@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translate3d(0, -10px, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

html,
body {
  overflow-x: hidden;
}

html {
  scroll-padding-top: 96px;
}

/* Container & Layout */
.cnvp-nav-container {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  font-family: var(--e-global-typography-text-font-family), Sans-serif;
  transition: padding 0.35s ease;
}

/* Navigation List */
.cnvp-menu ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 25px;
}

.cnvp-menu ul li {
  color: var(--cnvp-color-navy);
  font-weight: 500;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.3s ease;
}

.cnvp-menu ul li.has-dropdown {
  position: relative;
  align-items: flex-start;
  flex-wrap: wrap;
}

.cnvp-menu-item-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cnvp-menu ul li a {
  color: var(--cnvp-color-navy);
  font-weight: 500;
}

/* Current page / ancestor (from WP menu classes) */
.cnvp-menu ul li.current-menu-item > a,
.cnvp-menu ul li.current-menu-item > .cnvp-menu-item-label,
.cnvp-menu ul li.current_page_item > a,
.cnvp-menu ul li.active > a,
.cnvp-menu ul li.active > .cnvp-menu-item-label {
  color: var(--cnvp-color-accent);
  font-weight: 600;
}

.cnvp-menu ul li.current-menu-ancestor > a,
.cnvp-menu ul li.current-menu-ancestor > .cnvp-menu-item-label,
.cnvp-menu ul li.current-menu-parent > a,
.cnvp-menu ul li.current-menu-parent > .cnvp-menu-item-label,
.cnvp-menu ul li.has-dropdown.current-menu-ancestor > .cnvp-menu-item-label,
.cnvp-menu ul li.has-dropdown.current-menu-parent > .cnvp-menu-item-label,
.cnvp-menu ul li.has-mega.current-menu-ancestor > .cnvp-menu-item-label,
.cnvp-menu ul li.has-mega.current-menu-parent > .cnvp-menu-item-label {
  color: var(--cnvp-color-accent);
  font-weight: 600;
}

.cnvp-menu .mega-panel .links a.current-menu-item,
.cnvp-menu .mega-panel .links a.active {
  color: var(--cnvp-color-accent);
  font-weight: 600;
}

/* Active State (When Mega Menu is Open) */
.cnvp-menu ul li.active-link {
  color: var(--cnvp-color-accent);
}

.cnvp-menu ul li i {
  font-size: 12px;
  transition: transform 0.3s ease;
}

/* Search Icon */
.cnvp-search {
  color: var(--cnvp-color-white);
  font-size: 20px;
  cursor: pointer;
}

/* --- Mega Menu Panel --- */
.mega-panel {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background-color: #f3f1e8;
  padding: 60px 80px;
  display: none;
  z-index: 999;
}

.mega-panel:after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 100vw;
  height: 100%;
  background: #e0eadc;
  transform: translateX(-50%);
  z-index: -1;
}

.mega-panel.is-active {
  display: flex;
  animation: fadeInDown 0.3s ease;
}

.panel-content {
  display: flex;
  align-items: flex-start;
  gap: 100px;
}

.panel-content h3 {
  color: var(--cnvp-color-accent);
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  min-width: 200px;
}

/* Link Column */
.panel-content .links {
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-left: 1px solid #d0d1db;
  padding-left: 40px;
}

.panel-content .links a {
  color: var(--cnvp-color-text);
  text-decoration: none;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.2s ease;
  font-weight: 600;
}

.panel-content .links a i {
  color: var(--cnvp-color-accent);
  font-size: 14px;
}

.panel-content .links a:hover {
  transform: translateX(5px);
  color: var(--cnvp-color-accent);
}

/* Search Overlay Specifics */
.search-flex {
  display: grid !important;
  grid-template-columns: 2fr 1fr;
  gap: 100px;
  width: 100%;
}

.cnvp-search-trigger svg {
  fill: var(--cnvp-color-navy);
  width: 30px;
  height: 30px;
  cursor: pointer;
}

.cnvp-search-trigger svg path {
  fill: white;
}

.cnvp-nav-actions {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-shrink: 0;
}

.cnvp-header-button__icon {
  display: none;
}

.cnvp-search-trigger {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  background-color: var(--cnvp-color-accent);
  border: none;
  outline: none;
  cursor: pointer;
  -webkit-transition: background-color .25s;
  transition: background-color .25s;
  padding: 0 10px;
}

.cnvp-header-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 25px;
  background-color: var(--cnvp-color-accent);
  color: var(--cnvp-color-white);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 4px;
  white-space: nowrap;
  transition: all 0.3s ease;
  gap: 10px;
}

.cnvp-header-button svg {
  width: 16px;
  height: 16px;
  transition: all 0.3s ease;
}

.cnvp-header-button svg path {
  fill: white;
  transition: all 0.3s ease;
}

.cnvp-header-button:hover {
  background-color: var(--cnvp-color-cta);
  color: var(--cnvp-color-text);
}

.cnvp-header-button:hover svg path {
  fill: var(--cnvp-color-text);
}

/* Search */
#search-overlay.search-panel {
  width: 100%;
  background: var(--cnvp-color-white);
  border-bottom: 1px solid var(--cnvp-color-border);
  padding: 60px 0;
  box-shadow: var(--cnvp-shadow-search);
}

.panel-content.search-full {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

.search-main h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--cnvp-color-muted);
  margin-bottom: 25px;
  font-weight: 700;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  position: relative;
  border-bottom: 2px solid var(--cnvp-color-border);
  transition: border-color 0.3s ease;
  width: 100%;
}

.search-input-wrapper:focus-within {
  border-color: var(--cnvp-color-focus);
}

.search-field {
  width: 100% !important;
  border: none !important;
  background: transparent !important;
  font-size: 42px;
  font-weight: 600;
  color: var(--cnvp-color-input);
  padding: 15px 60px 15px 0;
  outline: none !important;
  box-shadow: none !important;
}

.search-field::placeholder {
  color: var(--cnvp-color-placeholder);
  transition: color 0.3s ease;
}

.search-field:focus::placeholder {
  color: var(--cnvp-color-border);
}

.search-submit {
  position: absolute;
  right: 0;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  color: var(--cnvp-color-icon) !important;
  padding: 0 !important;
  transition:
    color 0.3s ease,
    transform 0.2s ease !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.search-submit svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.search-submit:hover {
  color: var(--cnvp-color-focus) !important;
  transform: scale(1.1);
}

.panel-content.search-full .search-main {
  width: 100%;
}

.panel-content.search-full form.search-form {
  width: 100%;
}

.panel-content.search-full .search-main h2 {
  display: none;
}

.search-field::-webkit-search-decoration,
.search-field::-webkit-search-cancel-button,
.search-field::-webkit-search-results-button,
.search-field::-webkit-search-results-decoration {
  display: none;
  -webkit-appearance: none;
}

.search-field::-ms-clear,
.search-field::-ms-reveal {
  display: none;
  width: 0;
  height: 0;
}

/* Popular Resources Column */
.popular-resources ul {
  list-style: none;
  padding: 0;
}

.popular-resources li {
  margin-bottom: 12px;
}

.popular-resources li a {
  color: var(--cnvp-color-white);
  text-decoration: underline;
  font-size: 14px;
  font-weight: 400;
}

.popular-resources li a:hover {
  color: var(--cnvp-color-accent);
}

/* Logo sizing */
.cnvp-logo img {
  max-height: 100%;
  width: 140px;
  object-fit: contain;
  object-position: left;
  transition: width 0.35s ease, max-height 0.35s ease;
}


.cnvp-logo a {
  display: block;
}

.mega-menu-image {
  margin-bottom: 0;
  max-width: 250px;
}

.mega-menu-image img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
}

.mega-menu-description {
  color: var(--cnvp-color-text);
  font-size: 14px;
  margin-top: 10px;
  line-height: 1.4;
  max-width: 250px;
}

.cnvp-menu ul li.has-mega svg,
.cnvp-menu ul li.has-dropdown svg {
  transition: 0.3s ease-in-out;
  width: 20px;
  height: 20px;
}

.cnvp-menu ul li.has-mega svg path, .cnvp-menu ul li.has-dropdown svg path {
  stroke: var(--cnvp-color-accent);
}

/* Dropdown submenu panel (compact, anchored to parent menu item) */
@media (min-width: 1281px) {
  .cnvp-menu ul li.has-dropdown > .dropdown-panel {
    position: absolute;
    top: calc(100% + 35px);
    left: 0;
    width: min(280px, 90vw);
    min-width: 280px;
    padding: 24px 28px;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
    z-index: 1001;
  }

  .sticky-header.cnvp-sticky-header.active .cnvp-menu ul li.has-dropdown > .dropdown-panel {
    top: calc(100% + 21px);
  }
}

@media (min-width: 1281px) and (max-width: 1320px) {
  .cnvp-menu ul {
    gap: 15px;
  }
}

.mega-panel.dropdown-panel:after {
  display: none;
}

.mega-panel.dropdown-panel .panel-content {
  flex-direction: column;
  gap: 16px;
}

.mega-panel.dropdown-panel .panel-content .links {
  border-left: 0;
  padding-left: 0;
  gap: 12px;
}

.cnvp-menu ul li.active-link svg {
  transform: rotate(180deg) !important;
}

.panel-content.search-full .search-submit svg path {
  fill: var(--cnvp-color-placeholder);
}

/* Sticky header — pinned on scroll, stays visible on all breakpoints */
.cnvp-sticky-header-placeholder {
  display: none;
  width: 100%;
  pointer-events: none;
  transition: height 0.35s ease;
}

.sticky-header.cnvp-sticky-header {
  position: relative;
  width: 100%;
  z-index: var(--cnvp-header-z-index);
  transition:
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.35s ease,
    background-color 0.35s ease,
    left 0.35s ease,
    width 0.35s ease;
  background: var(--cnvp-color-cream);
}

.sticky-header.cnvp-sticky-header .sticky-header__inner {
  width: 100%;
  max-width: var(--cnvp-container-max-width);
  margin-left: auto;
  margin-right: auto;
}

.sticky-header.cnvp-sticky-header.active,
.sticky-header.cnvp-sticky-header.active.scroll-up {
  position: fixed;
  top: 0;
  background-color: #F5F1E8;
  transform: translate3d(0, 0, 0);
  left: var(--cnvp-sticky-left, 0px);
  width: var(--cnvp-sticky-width, 100%);
  box-shadow: 0 6px 24px rgba(2, 3, 7, 0.08);
}

.sticky-header.cnvp-sticky-header.active .cnvp-nav-container {
  padding-top: 10px;
  padding-bottom: 10px;
}

.sticky-header.cnvp-sticky-header.active .cnvp-logo img {
  width: 90px;
}

.sticky-header.cnvp-sticky-header .cnvp-nav-container {
  position: relative;
}

/* -------------------------------------------------------------------------- */
/* Responsive: tablet & mobile                                                 */
/* -------------------------------------------------------------------------- */

.cnvp-menu-toggle {
  display: none;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: 0;
  padding: 10px;
  margin: 0;
  cursor: pointer;
  line-height: 0;
}

.cnvp-menu-toggle__icon {
  display: inline-block;
  width: 26px;
  height: 18px;
  position: relative;
}

.cnvp-menu-toggle__icon::before,
.cnvp-menu-toggle__icon::after,
.cnvp-menu-toggle__icon {
  background: transparent;
}

.cnvp-menu-toggle__icon::before,
.cnvp-menu-toggle__icon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--cnvp-color-navy);
  border-radius: 2px;
  transition: transform 0.2s ease, top 0.2s ease, opacity 0.2s ease;
}

.cnvp-menu-toggle__icon::before {
  top: 2px;
}

.cnvp-menu-toggle__icon::after {
  top: 14px;
}

.cnvp-menu-toggle__icon {
  position: relative;
}

.cnvp-menu-toggle__icon span {
  display: none;
}

/* middle bar */
.cnvp-menu-toggle__icon {
  background-image: linear-gradient(var(--cnvp-color-navy), var(--cnvp-color-navy));
  background-size: 100% 2px;
  background-repeat: no-repeat;
  background-position: center;
}

.sticky-header.cnvp-sticky-header.cnvp-mobile-open .cnvp-menu-toggle__icon {
  background-image: none;
}

.sticky-header.cnvp-sticky-header.cnvp-mobile-open .cnvp-menu-toggle__icon::before {
  top: 8px;
  transform: rotate(45deg);
}

.sticky-header.cnvp-sticky-header.cnvp-mobile-open .cnvp-menu-toggle__icon::after {
  top: 8px;
  transform: rotate(-45deg);
}

/* Stay above page sections that create their own stacking context (e.g. IFM archive) */
.sticky-header.cnvp-sticky-header.cnvp-mobile-open {
  z-index: calc(var(--cnvp-header-z-index) + 100);
}

@media (max-width: 1280px) {
  .cnvp-nav-container {
    gap: 12px;
  }

  .cnvp-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
  }

  /* Keep logo on the left, actions on the right */
  .cnvp-logo {
    flex: 0 0 auto;
  }

  .cnvp-nav-actions {
    margin-left: auto;
    gap: 14px;
  }

  /* order: IFM Platform, Search, Toggle */
  .cnvp-header-button--ifm {
    order: 1;
  }

  .cnvp-search-trigger {
    order: 2;
    border-radius: 4px;
  }

  .cnvp-menu-toggle {
    order: 3;
    background-color: transparent !important;
  }

  /* Collapse the primary nav into an off-canvas style dropdown */
  .cnvp-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--cnvp-color-cream);
    border-top: 1px solid var(--cnvp-color-border);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
    display: none;
    padding: 14px 20px 20px;
    z-index: 1000;
  }

  .sticky-header.cnvp-sticky-header.cnvp-mobile-open .cnvp-menu {
    display: block;
  }

  .cnvp-menu ul {
    flex-direction: column;
    gap: 12px;
  }

  .cnvp-menu ul li {
    font-size: 16px;
    justify-content: space-between;
    width: 100%;
  }

  .cnvp-menu ul li a {
    width: 100%;
    display: inline-flex;
  }


  .panel-content .links a {
    font-size: 15px;
    font-weight: 500;
  }

  /* Mega panels become in-flow accordions on tablet/mobile */
  .mega-panel {
    position: static;
    padding: 16px 0 0;
    background-color: transparent;
  }

  /* When panels are moved under a nav item, keep them visually inside dropdown */
  .cnvp-menu ul > .mega-panel,
  .cnvp-menu ul li.has-dropdown > .dropdown-panel {
    padding: 12px 0 0;
  }

  .cnvp-menu ul > .mega-panel .panel-content,
  .cnvp-menu ul li.has-dropdown > .dropdown-panel .panel-content {
    padding: 14px;
    border: 1px solid var(--cnvp-color-border);
    border-radius: 8px;
    background: var(--cnvp-color-white);
    width: 100%;
  }

  .cnvp-menu ul li.has-dropdown > .dropdown-panel {
    position: static;
    top: auto;
    left: auto;
    width: 100%;
    min-width: 0;
    box-shadow: none;
  }

  .panel-content-inner {
    width: 100%;
    max-width: none;
  }

  .mega-menu-image,
  .mega-menu-description {
    max-width: none;
    width: 100%;
  }

  /* IFM Platform: icon only on mobile/tablet */
  .cnvp-header-button--ifm .cnvp-header-button__text,
  .cnvp-header-button--ifm .cnvp-header-button__arrow {
    display: none;
  }

  .cnvp-header-button--ifm .cnvp-header-button__icon {
    display: inline-block;
    width: 25px;
    height: 25px;
  }

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

  .mega-panel.is-active {
    display: block;
    animation: none;
  }

  .panel-content {
    flex-direction: column;
    gap: 16px;
  }

  .panel-content .links {
    border-left: 0;
    padding-left: 0;
    gap: 12px;
  }

  .panel-content h3 {
    font-size: 20px;
    min-width: 0;
  }

  /* Search panel uses same dropdown, so it doesn't cover the page */
  #search-overlay.search-panel {
    padding: 16px 0 0;
    border-bottom: 0;
    box-shadow: none;
    position: absolute;
    background: #ffffff;
    padding: 16px 0px 20px;
  }

  .search-field {
    font-size: 24px;
  }
}

@media (max-width: 767px) {
  .cnvp-nav-container {
    padding: 12px 14px;
  }

  .cnvp-header-button {
    padding: 0.469rem;
    font-size: 14px;
  }

  .cnvp-header-button svg {
    width: 25px;
    height: 25px;
    transition: all 0.3s ease;
  }

  /* If the button exists, keep it but allow it to wrap/fit */
  .cnvp-nav-actions {
    gap: 10px;
  }

  .cnvp-logo img {
    width: 120px;
  }

  .sticky-header.cnvp-sticky-header.active .cnvp-logo img {
    width: 75px;
  }
}

body.cnvp-nav-lock {
  overflow: hidden;
  touch-action: none;
}

@media (max-width: 1280px) {
  html {
    scroll-padding-top: 88px;
  }
}
