/* Knowledge navigation: the concept panel uses its own light surface. */
.mega-menu-knowledge {
  --knowledge-line: #e9e9e9;
  left: calc(50% - min(481px, (100vw - 2 * var(--gutter)) / 2) + clamp(0px, (100vw - 2 * var(--gutter) - 962px) / 2, 23.5px));
  width: min(962px, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100dvh - 5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--line) #fdfcfa;
  grid-template-columns: minmax(0, 1fr);
  border: 0;
  border-radius: 0 0 12px 12px;
  background: #fdfcfa;
  box-shadow: 0 24px 64px rgb(11 17 19 / 16%);
  transform-origin: top center;
}

.knowledge-columns {
  display: grid;
  grid-template-columns: minmax(0, 424fr) minmax(0, 490fr);
  min-height: 34.25rem;
  padding: 2rem 1.5rem 1rem;
}

.knowledge-popular,
.knowledge-topics {
  min-width: 0;
}

.knowledge-popular {
  position: relative;
  padding: 0 2.5rem 0 0.5rem;
}

.knowledge-popular::after {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0.625rem;
  width: 1px;
  background: var(--knowledge-line);
  content: "";
}

.knowledge-topics {
  padding-left: 1.375rem;
}

.mega-menu-knowledge .knowledge-heading {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.mega-menu-knowledge p:not(.knowledge-heading) {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
  text-wrap: pretty;
}

.knowledge-topics > p {
  margin-left: 1rem;
}

.knowledge-guides {
  margin-top: 0.5rem;
}

.knowledge-guide {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 1.4375rem;
  min-height: 5.5rem;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
}

.knowledge-guide + .knowledge-guide {
  border-top: 1px solid var(--knowledge-line);
}

.knowledge-guide img {
  width: 80px;
  height: 60px;
  object-fit: contain;
}

.knowledge-arrow {
  width: 18px;
  height: 18px;
  color: var(--ink);
  transition: transform 160ms ease;
}

.knowledge-topic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.875rem;
  margin-top: 1.75rem;
}

.knowledge-topic {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  min-height: 11.75rem;
  padding-bottom: 0.9375rem;
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
}

.knowledge-topic img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  flex: 0 0 auto;
}

.knowledge-topic span {
  white-space: nowrap;
}

.knowledge-topic:nth-child(-n + 3) {
  border-bottom: 1px solid var(--knowledge-line);
}

.knowledge-topic:not(:nth-child(3n))::after {
  position: absolute;
  top: 0;
  right: -0.4375rem;
  bottom: 0.9375rem;
  width: 1px;
  background: var(--knowledge-line);
  content: "";
}

.knowledge-shortcuts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 0.9fr);
  margin-inline: 1.5rem;
  padding-block: 1rem;
  border-top: 1px solid var(--knowledge-line);
}

.knowledge-shortcut {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 1.5rem;
  min-width: 0;
  min-height: 3.75rem;
  padding-inline: 0.5rem;
  text-decoration: none;
}

.knowledge-shortcut + .knowledge-shortcut {
  border-left: 1px solid var(--knowledge-line);
  padding-left: 1.5rem;
}

.knowledge-shortcut-icon {
  --icon-stroke-width: 1.3;
  width: 36px;
  height: 36px;
}

.knowledge-shortcut-copy {
  display: grid;
  gap: 0.125rem;
  min-width: 0;
}

.knowledge-shortcut strong {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
}

.knowledge-shortcut-copy > span {
  color: var(--muted);
  font-size: 0.78125rem;
  line-height: 1.5;
  white-space: nowrap;
}

.knowledge-shortcut .knowledge-arrow {
  align-self: start;
  margin-top: 0.625rem;
}

.mega-menu-knowledge a {
  transition: color 160ms ease, background 160ms ease;
}

.mega-menu-knowledge a:is(:hover, :focus-visible) {
  background: var(--hover-tint);
  color: var(--accent);
}

.mega-menu-knowledge a:is(:hover, :focus-visible) .knowledge-arrow {
  transform: translateX(3px);
}

.mega-menu-knowledge a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}

.mega-menu-knowledge a:active {
  background: var(--secondary-tint);
}

/* Four desktop items share the existing header without wrapping. */
@media (min-width: 921px) {
  .nav-links {
    gap: clamp(0.75rem, 1.5vw, 1.5rem);
    padding-inline: 1.5rem;
  }

  .nav-links :is(summary, .nav-link) {
    gap: 0.5rem;
    padding-inline: 0.5rem;
    margin-inline: -0.5rem;
    white-space: nowrap;
    min-height: 44px;
  }

  .nav-links > li:first-child summary {
    padding-inline-start: 1.5rem;
    margin-inline-start: -1.5rem;
  }
}

@media (min-width: 921px) and (max-width: 1180px) {
  .nav-main {
    grid-template-columns: 170px minmax(0, 1fr) auto;
  }

  .nav-links {
    gap: 0.625rem;
    padding-inline: 1rem;
  }

  .nav-links > li:first-child summary {
    padding-inline-start: 1rem;
    margin-inline-start: -1rem;
  }

  .nav-links :is(summary, .nav-link) > .nav-icon {
    display: none;
  }

  .nav-actions :is(.nav-primary, .nav-secondary):not(.nav-cart-link) > .nav-icon {
    display: none;
  }

  .nav-actions {
    gap: 0.375rem;
  }

  .nav-actions :is(.nav-primary, .nav-secondary) {
    padding-inline: 0.625rem;
  }

  .knowledge-shortcut {
    gap: 0.75rem;
    grid-template-columns: 28px minmax(0, 1fr) 18px;
  }

  .knowledge-shortcut-icon {
    width: 28px;
    height: 28px;
  }

  .knowledge-shortcut + .knowledge-shortcut {
    padding-left: 0.75rem;
  }

  .knowledge-shortcut-copy > span {
    white-space: normal;
    text-wrap: pretty;
  }
}

@media (max-width: 920px) {
  .mobile-menu {
    max-height: calc(100dvh - 5rem);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mega-menu-knowledge,
  .mega-menu-knowledge a,
  .knowledge-arrow {
    transition: none;
  }
}
