/*
 * RC5 accepted global header.
 *
 * This stylesheet is intentionally loaded last on every HTML route. Legacy
 * templates define their own header widths, buttons and breakpoints; keeping
 * the accepted homepage shell here prevents those page-level rules from
 * changing the header while navigating around the site.
 */

.topbar {
  position: sticky !important;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid #dfe5dc !important;
  background: rgba(255, 255, 255, .9) !important;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.topbar .container {
  width: min(1280px, calc(100% - 32px)) !important;
  max-width: none !important;
  margin-inline: auto !important;
}

.topbar-row {
  display: flex !important;
  min-height: 76px;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 16px !important;
  padding: 12px 0 !important;
  flex-wrap: nowrap !important;
}

.topbar .brand {
  display: flex !important;
  flex: 0 0 auto !important;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.topbar .brand img,
.topbar-row > a:first-child img {
  display: block !important;
  width: 150px !important;
  height: auto !important;
  max-height: 50px !important;
  object-fit: contain !important;
}

.topbar .top-nav {
  display: flex !important;
  flex: 1 1 auto !important;
  align-items: center !important;
  gap: clamp(14px, 1.55vw, 24px) !important;
  margin-left: 6px !important;
  color: #1f2e22 !important;
  font-size: .9rem !important;
  font-weight: 600 !important;
  white-space: nowrap;
}

.topbar .top-nav a {
  color: inherit;
  text-decoration: none;
  transition: color .18s ease, opacity .18s ease;
}

.topbar .top-nav a:hover,
.topbar .top-nav a:focus-visible,
.topbar .top-nav a.active,
.topbar .top-nav a[aria-current="page"] {
  color: #2e7d32 !important;
}

.topbar .header-actions {
  display: flex !important;
  flex: 0 0 auto !important;
  align-items: center !important;
  gap: 10px !important;
  margin-left: auto !important;
}

.topbar .rc5-search {
  display: inline-flex !important;
  min-width: 196px;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  padding: 0 16px !important;
  border: 1px solid #dfe7df !important;
  border-radius: 999px !important;
  background: #fff !important;
  color: #526057 !important;
  font-size: .9rem !important;
  font-weight: 500 !important;
  text-decoration: none;
  transition: border-color .18s ease, box-shadow .18s ease, color .18s ease;
}

.topbar .rc5-search:hover,
.topbar .rc5-search:focus-visible {
  border-color: rgba(46, 125, 50, .45) !important;
  color: #2e7d32 !important;
  box-shadow: 0 0 0 4px rgba(46, 125, 50, .08);
}

.topbar .rc5-search svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.topbar .btn {
  display: inline-flex !important;
  min-height: 46px !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px !important;
  border: 1px solid transparent !important;
  border-radius: 10px !important;
  font-family: inherit;
  font-size: .95rem !important;
  font-weight: 700 !important;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, background-color .18s ease,
    border-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.topbar .btn-primary {
  border-color: #2e7d32 !important;
  background: #2e7d32 !important;
  color: #fff !important;
}

.topbar .btn-primary:hover,
.topbar .btn-primary:focus-visible {
  border-color: #236428 !important;
  background: #236428 !important;
  color: #fff !important;
  box-shadow: 0 10px 20px rgba(46, 125, 50, .18);
  transform: translateY(-1px);
}

.topbar .btn-danger {
  border-color: #6b4f38 !important;
  background: #6b4f38 !important;
  color: #fff !important;
}

.topbar .btn-danger:hover,
.topbar .btn-danger:focus-visible {
  border-color: #523b2b !important;
  background: #523b2b !important;
  color: #fff !important;
  box-shadow: 0 10px 20px rgba(74, 52, 35, .2);
  transform: translateY(-1px);
}

.topbar .category-row {
  overflow-x: auto;
  padding: 4px 0 !important;
  border-top: 1px solid rgba(46, 125, 50, .08) !important;
  border-bottom: 1px solid rgba(46, 125, 50, .08) !important;
  background: #e3f2e5 !important;
  scrollbar-width: none;
}

.topbar .category-row::-webkit-scrollbar {
  display: none;
}

.topbar .main-categories {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0 !important;
  padding: 6px 0 !important;
  font-weight: 700 !important;
  white-space: nowrap;
}

.topbar .main-categories a {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  color: #2f3a31 !important;
  font-size: 1rem !important;
  text-decoration: none;
}

.topbar .main-categories a + a {
  position: relative;
  margin-left: 26px !important;
  padding-left: 26px !important;
}

.topbar .main-categories a + a::before {
  position: absolute;
  top: 50%;
  left: 0;
  width: 1px;
  height: 18px;
  background: rgba(47, 58, 49, .2);
  content: "";
  transform: translateY(-50%);
}

.topbar .main-categories a:hover,
.topbar .main-categories a:focus-visible,
.topbar .main-categories a.active,
.topbar .main-categories a[aria-current="page"] {
  color: #2e7d32 !important;
}

.topbar .tablet-cats {
  display: none !important;
}

.topbar .hamburger {
  display: none !important;
  min-width: 42px;
  min-height: 42px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-left: 4px !important;
  padding: 9px !important;
  border: 0 !important;
  background: transparent !important;
  color: #203126;
  cursor: pointer;
}

.topbar .hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: currentColor !important;
  transition: transform .2s ease, opacity .2s ease;
}

.topbar .hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.topbar .hamburger.open span:nth-child(2) {
  opacity: 0;
}

.topbar .hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* The mobile panel is part of the same accepted header, although it follows
   the <header> node in the document. */
.mobile-nav {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  z-index: 10001 !important;
  display: flex !important;
  visibility: hidden;
  width: min(320px, 88vw) !important;
  height: 100dvh !important;
  flex-direction: column !important;
  gap: 0 !important;
  overflow-y: auto !important;
  padding: 68px 26px 28px !important;
  background: #fff !important;
  box-shadow: -8px 0 30px rgba(0, 0, 0, .15) !important;
  transform: translateX(105%);
  transition: transform .25s ease, visibility .25s;
}

.mobile-nav.open {
  visibility: visible;
  transform: translateX(0);
}

body.nav-open {
  overflow: hidden;
}

.mobile-nav-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 10000 !important;
  display: block !important;
  visibility: hidden;
  opacity: 0;
  background: rgba(0, 0, 0, .35) !important;
  pointer-events: none;
  transition: opacity .2s ease, visibility .2s ease;
}

.mobile-nav-overlay.open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.mobile-nav-close {
  position: absolute !important;
  top: 16px !important;
  right: 18px !important;
  width: 42px !important;
  height: 42px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: #203126 !important;
  font-size: 2rem !important;
  line-height: 1 !important;
  cursor: pointer;
}

.mobile-nav-section-label {
  padding: 16px 0 6px !important;
  color: #526057 !important;
  font-size: .72rem !important;
  font-weight: 800 !important;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.mobile-nav-divider {
  height: 1px !important;
  margin: 8px 0 !important;
  background: rgba(0, 0, 0, .1) !important;
}

.mobile-nav a {
  display: flex !important;
  min-height: 44px;
  align-items: center;
  padding: 10px 0 !important;
  border-bottom: 1px solid rgba(0, 0, 0, .08) !important;
  color: #203126 !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  text-decoration: none;
}

.mobile-nav a.cat-link {
  color: #2f3a31 !important;
  font-size: .95rem !important;
  font-weight: 700 !important;
}

.mobile-nav a:hover,
.mobile-nav a:focus-visible,
.mobile-nav a.active,
.mobile-nav a[aria-current="page"] {
  color: #2e7d32 !important;
}

.mobile-nav .mobile-nav-cta-wrap {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0 2px;
}

.mobile-nav .mobile-nav-cta {
  justify-content: center;
  min-height: 44px;
  padding: 10px 12px !important;
  border: 0 !important;
  border-radius: 10px;
  color: #fff !important;
  font-size: .9rem !important;
  font-weight: 700 !important;
  text-align: center;
}

.mobile-nav .mobile-nav-cta--shop {
  background: #2e7d32 !important;
}

.mobile-nav .mobile-nav-cta--register {
  background: #6b4f38 !important;
}

.mobile-nav .mobile-nav-search {
  display: flex !important;
  min-height: 44px;
  align-items: center;
  margin: 8px 0 4px !important;
  padding: 10px 0 !important;
  border-bottom: 0 !important;
  color: #2e7d32 !important;
  font-size: .95rem !important;
  font-weight: 700 !important;
}

.mobile-nav .mobile-nav-search::before {
  margin-right: 8px;
  content: "→" !important;
}

@media (max-width: 1180px) {
  .topbar .rc5-search {
    min-width: 164px;
    padding-inline: 13px !important;
  }

  .topbar .top-nav {
    gap: 14px !important;
    font-size: .85rem !important;
  }
}

/* The complete eight-item category row is wider than the content container at
   constrained desktop widths. Anchor it at the scroll origin so the first
   category never disappears beyond the left edge. */
@media (min-width: 1025px) and (max-width: 1360px) {
  .topbar .main-categories {
    justify-content: flex-start !important;
  }
}

@media (max-width: 1024px) {
  .topbar .top-nav,
  .topbar .rc5-search,
  .topbar .category-row {
    display: none !important;
  }

  .topbar-row {
    min-height: 66px;
    gap: 8px !important;
    flex-wrap: wrap !important;
  }

  .topbar .header-actions {
    gap: 8px !important;
  }

  .topbar .tablet-cats {
    display: flex !important;
    flex: 0 1 auto;
    align-items: center;
    gap: 0;
    margin-left: 16px;
    overflow-x: auto;
    padding: 0 4px;
    border-radius: 8px;
    background: rgba(63, 174, 73, .16);
    font-size: .9rem;
    font-weight: 700;
    scrollbar-width: none;
  }

  .topbar .tablet-cats::-webkit-scrollbar {
    display: none;
  }

  .topbar .tablet-cats a {
    position: relative;
    flex-shrink: 0;
    padding: 8px 14px;
    color: #2f3a31;
    white-space: nowrap;
  }

  .topbar .tablet-cats a + a::before {
    position: absolute;
    top: 50%;
    left: 0;
    width: 1px;
    height: 16px;
    background: rgba(47, 58, 49, .2);
    content: "";
    transform: translateY(-50%);
  }

  .topbar .hamburger {
    display: flex !important;
  }
}

@media (max-width: 768px) {
  .topbar .container {
    width: calc(100% - 24px) !important;
  }

  .topbar .tablet-cats {
    display: none !important;
  }

  .topbar-row {
    flex-wrap: nowrap !important;
  }

  .topbar .brand img,
  .topbar-row > a:first-child img {
    width: 128px !important;
    max-height: 44px !important;
  }
}

@media (max-width: 480px) {
  .topbar-row {
    min-height: 60px;
    padding: 8px 0 !important;
  }

  .topbar .brand img,
  .topbar-row > a:first-child img {
    width: 116px !important;
  }

  .topbar .header-actions > .btn {
    display: none !important;
  }

  .mobile-nav {
    width: min(340px, 92vw) !important;
  }
}

@media (max-width: 380px) {
  .topbar .brand img,
  .topbar-row > a:first-child img {
    width: 94px !important;
  }

  .topbar .header-actions {
    gap: 4px !important;
  }

  .topbar .hamburger {
    margin-left: 2px !important;
    padding-inline: 4px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .topbar *,
  .mobile-nav,
  .mobile-nav-overlay {
    transition-duration: .01ms !important;
  }
}
