.navbar {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
  height: var(--navbar-height);
  padding: 0;
  display: flex;
  align-items: center;
  transition: transform 0.28s ease;
  will-change: transform;
}

.navbar.navbar--hidden {
  transform: translateY(-100%);
  pointer-events: none;
}

.navbar-spacer {
  height: var(--navbar-height);
  flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
  .navbar {
    transition: none;
  }

  .navbar.navbar--hidden {
    transform: none;
    pointer-events: auto;
  }
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 3rem; /* Padding for the far left placement */
  position: relative;
  width: 100%;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.logo-image {
  height: 40px; /* Reverted to default size */
  width: auto;
  display: block;
  filter: drop-shadow(0 6px 4px rgba(0, 0, 0, 0.25));
}

.logo-image--mark {
  width: 40px;
  object-fit: contain;
}

.nav-links-wrapper {
  display: flex;
  align-items: center;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.nav-link-group--product {
  display: flex;
  align-items: center;
}

.nav-link-parent {
  display: inline-block;
  border: none;
  background: none;
  font: inherit;
  cursor: default;
}

.nav-link {
  font-weight: 500;
  color: #111111; /* Constant solid black text color */
  position: relative;
  display: inline-block;
  padding: 0.5rem 0;
  transition: none;
}

.nav-link__hit {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  z-index: 1;
}

.nav-link__hit--left {
  left: 0;
}

.nav-link__hit--right {
  right: 0;
}

.nav-link__text {
  position: relative;
  z-index: 0;
  pointer-events: none;
}

.nav-link:hover {
  color: #111111;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--color-accent-primary); /* Brand electric blue underline */
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left bottom;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:has(.nav-link__hit--right:hover)::after,
.nav-link:has(.nav-link__hit--right:focus-visible)::after {
  transform-origin: right bottom;
}

.nav-link:hover::after {
  transform: scaleX(1);
}

.nav-link.active {
  color: #111111; /* Keep text black even when active */
}

.nav-link.active:hover {
  color: #111111;
}

.nav-link.active::after {
  transform: scaleX(1);
}

.mobile-menu-btn {
  display: none;
  color: var(--color-text-primary);
  z-index: 1001;
}

/* --- Product Mega Menu (Dark) --- */
.product-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  width: min(1100px, calc(100vw - 4rem));
  background: #0a0e18;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
  z-index: 999;
  animation: dropdown-enter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  gap: 0;
}

.product-dropdown::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 12px;
}

@keyframes dropdown-enter {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.product-dropdown-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 320px;
  padding: 2rem 1.5rem;
}

.product-dropdown-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 2.5rem;
  border-radius: 0;
  position: relative;
  overflow: hidden;
  background: 
    radial-gradient(ellipse at 30% 50%, rgba(99, 102, 241, 0.2) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
    #12162a;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.product-dropdown-panel {
  display: none;
  flex-direction: column;
  justify-content: center;
  height: 100%;
}

.product-dropdown-panel.is-default {
  display: flex;
}

.product-dropdown:has(.product-dropdown-item[data-product-id='presence2']:hover) .product-dropdown-panel[data-product-panel='presence2'],
.product-dropdown:has(.product-dropdown-item[data-product-id='presence2']:focus-visible) .product-dropdown-panel[data-product-panel='presence2'],
.product-dropdown:has(.product-dropdown-item[data-product-id='usb-stick']:hover) .product-dropdown-panel[data-product-panel='usb-stick'],
.product-dropdown:has(.product-dropdown-item[data-product-id='usb-stick']:focus-visible) .product-dropdown-panel[data-product-panel='usb-stick'],
.product-dropdown:has(.product-dropdown-item[data-product-id='cv-solutions']:hover) .product-dropdown-panel[data-product-panel='cv-solutions'],
.product-dropdown:has(.product-dropdown-item[data-product-id='cv-solutions']:focus-visible) .product-dropdown-panel[data-product-panel='cv-solutions'] {
  display: flex;
}

.product-dropdown:has(.product-dropdown-item:hover) .product-dropdown-panel.is-default,
.product-dropdown:has(.product-dropdown-item:focus-visible) .product-dropdown-panel.is-default {
  display: none;
}

.product-dropdown-right-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 0.6rem;
  display: block;
}

.product-dropdown-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border: none;
  background: none;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.product-dropdown-item:hover,
.product-dropdown-item.active {
  background: rgba(255, 255, 255, 0.05);
}

.product-dropdown-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #818cf8;
  flex-shrink: 0;
  margin-top: 2px;
}

.product-dropdown-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #f1f5f9;
  transition: color 0.2s ease;
  display: block;
}

.product-dropdown-item > div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.product-dropdown-item-desc {
  font-size: 0.85rem;
  color: #dbeafe;
  margin-top: 2px;
  line-height: 1.45;
  display: block;
}

.product-dropdown-item:hover .product-dropdown-name,
.product-dropdown-item.active .product-dropdown-name {
  color: #ffffff;
}

.product-dropdown-desc {
  font-size: 1rem;
  color: #e2e8f0;
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.product-dropdown-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.product-dropdown-tag {
  font-size: 0.7rem;
  font-weight: 500;
  color: #e2e8f0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  letter-spacing: 0.2px;
  transition: border-color 0.2s ease;
}

.product-dropdown-tag:hover {
  border-color: rgba(255, 255, 255, 0.4);
}

/* Mobile product sub-links (hidden on desktop) */
.nav-mobile-product-list {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* --- Responsive Media Queries --- */
@media (max-width: 768px) {
  .nav-container {
    padding: 0 1rem;
  }

  .mobile-menu-btn {
    display: block;
  }

  .mobile-menu-btn.mobile-menu-btn--open {
    color: #ffffff;
  }

  .product-dropdown {
    display: none;
  }

  .product-megamenu-shell {
    display: none !important;
  }

  .nav-links-wrapper {
    position: fixed;
    top: 0;
    right: 0;
    width: min(280px, 85vw);
    height: 100vh;
    height: 100dvh;
    background-color: rgba(11, 15, 25, 0.95);
    backdrop-filter: blur(15px);
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: calc(var(--navbar-height) + 1.5rem) 1.25rem 2rem;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    border-left: 1px solid var(--color-border);
    gap: 1.25rem;
    z-index: 1000;
    visibility: hidden;
  }

  .nav-links-wrapper.mobile-open {
    transform: translateX(0);
    visibility: visible;
  }

  .nav-links {
    position: static;
    transform: none;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    width: 100%;
  }

  .nav-link-group--product {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
  }

  .nav-link-parent {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.72);
    padding: 0;
    cursor: default;
    text-align: center;
    width: 100%;
  }

  .nav-link-parent::after {
    display: none;
  }

  .nav-link-parent.active {
    color: #ffffff;
  }

  .nav-mobile-product-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .nav-mobile-product-list li {
    text-align: center;
  }

  .nav-mobile-product-list li::before {
    content: '• ';
    color: rgba(255, 255, 255, 0.88);
  }

  .nav-mobile-product-link {
    display: inline;
    padding: 0;
    border: none;
    border-radius: 0;
    background: none;
    color: rgba(255, 255, 255, 0.88);
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: color 0.2s ease;
  }

  .nav-mobile-product-link:hover,
  .nav-mobile-product-link:focus-visible {
    color: #ffffff;
    outline: none;
  }

  .nav-link {
    font-size: 1.25rem;
    color: #ffffff;
    text-align: center;
    width: 100%;
  }

  .nav-link__hit {
    display: none;
  }

  .nav-link:hover {
    color: #ffffff;
  }

  .nav-link.active {
    color: #ffffff;
  }

  .nav-contact-btn-mobile {
    margin-top: 0.5rem;
    align-self: center;
    text-align: center;
  }
}

/* --- Static HTML: checkbox mobile menu + CSS product dropdown --- */
.nav-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mobile-menu-btn {
  display: none;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 0;
}

.mobile-menu-icon {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-toggle:checked ~ .nav-links-wrapper {
  transform: translateX(0);
  visibility: visible;
}

.nav-toggle:checked + .mobile-menu-btn .mobile-menu-icon--open {
  display: none;
}

.nav-toggle:not(:checked) + .mobile-menu-btn .mobile-menu-icon--close {
  display: none;
}

@media (min-width: 769px) {
  .nav-toggle,
  .mobile-menu-btn {
    display: none !important;
  }

  /* Shell overlaps navbar bottom — keeps megamenu open while moving from Product into the panel */
  .product-megamenu-shell {
    display: none;
    position: fixed;
    top: calc(var(--navbar-height) - 20px);
    left: 50%;
    transform: translateX(-50%);
    width: min(1100px, calc(100vw - 4rem));
    padding-top: 20px;
    z-index: 999;
    pointer-events: none;
  }

  .navbar:has(.nav-link-group--product:hover) .product-megamenu-shell,
  .navbar:has(.nav-link-group--product:focus-within) .product-megamenu-shell,
  .navbar:has(.product-megamenu-shell:hover) .product-megamenu-shell,
  .navbar:has(.product-megamenu-shell:focus-within) .product-megamenu-shell {
    display: block;
    pointer-events: auto;
  }

  .navbar.navbar--product-menu-dismissed .product-megamenu-shell {
    display: none !important;
    pointer-events: none !important;
  }

  .product-megamenu-shell .product-dropdown {
    display: flex;
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: 100%;
    animation: dropdown-enter-shell 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes dropdown-enter-shell {
    from {
      opacity: 0;
      transform: translateY(-6px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .product-dropdown-item {
    text-decoration: none;
    color: inherit;
  }

  .nav-mobile-product-list a {
    color: rgba(255, 255, 255, 0.88);
    font-size: 1rem;
    font-weight: 500;
  }

  .nav-mobile-product-list a:hover {
    color: #ffffff;
  }
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: block;
  }

  .nav-mobile-product-list a {
    display: inline;
    color: rgba(255, 255, 255, 0.88);
    font-size: 1rem;
    font-weight: 500;
  }
}
