/* Shared, crawlable category navigation on product and customer-order pages. */
.category-header :is(.top-inner, .topin, .top-in) {
  min-height: 72px;
  gap: 20px;
}

.category-header .nav {
  flex-wrap: wrap;
  max-width: none;
  gap: 8px 20px;
  overflow: visible;
}

.category-header .nav a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
}

.category-header .nav .lang-switch { order: 0; }

.category-nav-surface {
  border-top: 1px solid #d9e2d4;
  background: #edf3e9;
  color: #263e2c;
}

.category-nav-inner {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding-block: 10px;
}

.category-nav-heading {
  flex-shrink: 0;
  padding-top: 10px;
  color: #4b604d;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
}

.category-menu {
  position: relative;
  flex: 1;
  min-width: 0;
}

.category-menu > .category-menu-toggle { display: none; }

.category-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.category-links a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 7px 13px;
  border: 1px solid #d3dfcd;
  border-radius: 6px;
  color: #263e2c;
  background: #f9fbf7;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
  text-align: center;
  text-decoration: none;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.category-links a:hover {
  border-color: #93ab87;
  background: #e1ebda;
}

.category-links a[aria-current] {
  border-color: #36553c;
  color: #fff;
  background: #36553c;
}

.category-header :is(a, summary):focus-visible {
  outline: 2px solid #36553c;
  outline-offset: 3px;
}

/* The measured header keeps direct customer-order and quote anchors visible. */
.category-header + main [id] {
  scroll-margin-top: calc(var(--category-header-height, 210px) + 16px) !important;
}

@media (max-width: 900px) {
  .category-header :is(.top-inner, .topin, .top-in) {
    min-height: 70px;
    gap: 12px;
  }

  .category-header .nav {
    gap: 6px 14px;
    font-size: 12px;
  }

  .category-nav-inner { padding-block: 0; }
  .category-nav-heading { display: none; }

  .category-menu > .category-menu-toggle {
    display: flex;
    min-height: 46px;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    cursor: pointer;
    list-style: none;
    font-size: 13px;
    line-height: 1.5;
  }

  .category-menu-toggle::-webkit-details-marker { display: none; }
  .category-menu-label { font-weight: 750; }
  .category-menu-context {
    overflow: hidden;
    color: #50604c;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .category-menu-toggle::after {
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    margin: -4px 4px 0 auto;
    border-right: 2px solid #36553c;
    border-bottom: 2px solid #36553c;
    content: "";
    transform: rotate(45deg);
  }

  .category-menu[open] .category-menu-toggle::after {
    margin-top: 4px;
    transform: rotate(225deg);
  }

  .category-links {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    max-height: min(60vh, 390px);
    max-height: min(calc(100svh - var(--category-header-height, 180px) - 24px), 390px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px;
    border: 1px solid #cfdbc8;
    border-radius: 0 0 8px 8px;
    background: #edf3e9;
    box-shadow: 0 16px 28px rgb(28 52 29 / 12%);
  }

  .category-links a {
    min-height: 44px;
    padding: 9px 7px;
    font-size: 13px;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 520px) {
  .category-header :is(.top-inner, .topin, .top-in) {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding-block: 10px 6px;
  }

  .category-header .logo {
    font-size: 14px;
    letter-spacing: 0.04em;
  }

  .category-header .nav {
    width: 100%;
    justify-content: flex-start;
    gap: 4px 16px;
    padding-top: 4px;
    border-top: 0;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .category-links a { transition: none; }
}
