#hd .nav-inner > ul.dm-primary-menu--desktop { display: grid; grid-column: 4 / -1; grid-row: 1; grid-template-columns: subgrid; margin: 0; padding: 0; list-style: none; }
    #n-mobile-nav > ul.dm-primary-menu,
    #n-mobile-nav ul.sub-menu { margin: 0; padding: 0; list-style: none; }
    @media (min-width: 769px) {
      #hd .nav-inner > ul.dm-primary-menu--desktop > li:nth-child(-n+4) { grid-row: 1; align-self: center; justify-self: start; white-space: nowrap; }
      #hd .nav-inner > ul.dm-primary-menu--desktop > li:nth-child(1) { grid-column: 1 / 3; }
      #hd .nav-inner > ul.dm-primary-menu--desktop > li:nth-child(2) { grid-column: 3 / 5; }
      #hd .nav-inner > ul.dm-primary-menu--desktop > li:nth-child(3) { grid-column: 5 / 8; }
      #hd .nav-inner > ul.dm-primary-menu--desktop > li:nth-child(4) { grid-column: 8 / 10; }
      #hd .nav-inner > ul.dm-primary-menu--desktop > li > a.n-item { display: inline-flex; min-height: 44px; align-items: center; white-space: nowrap; }
    }
    @media (max-width: 768px) {
      #hd .nav-inner > ul.dm-primary-menu { display: none !important; }
      body.nav-open #n-mobile-nav.open > ul.dm-primary-menu > li + li { border-top: 1px solid #e9e4e8; }
      body.nav-open #n-mobile-nav.open > ul.dm-primary-menu > li.menu-item-has-children { margin-bottom: 8px; }
      body.nav-open #n-mobile-nav.open ul.sub-menu > li > a.n-sub-item { justify-content: space-between; }
      body.nav-open #n-mobile-nav.open ul.sub-menu > li > a.n-sub-item::after { content: "→" / ""; flex: 0 0 auto; margin-left: 8px; color: currentColor; }
    }

/* Shared primary navigation and its compact breakpoint. */
@media (width > 1280px) {
  body #hd .n-termin {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    gap: 0;
    overflow: visible;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    color: #0a0909 !important;
    box-shadow: none;
    white-space: nowrap;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 7px;
  }

  body #hd .n-termin-label {
    display: inline;
    color: inherit !important;
    font: inherit;
    letter-spacing: inherit;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 7px;
  }

  body #hd .n-termin :is(.button__icon, .button__icon-wrapper) {
    display: none !important;
  }

  body #hd .n-termin:focus-visible {
    outline: 2px solid #6e17c7;
    outline-offset: 3px;
  }

  body #hd .n-termin-label::after {
    content: " →";
  }

  @media (hover: hover) {
    body #hd .n-termin:hover { color: #6e17c7 !important; }
  }
}

@media (max-width: 1280px) {
  body #hd .n-hamburger {
    width: max-content;
    white-space: nowrap;
  }

  html:has(body.nav-open #hd .dm-primary-menu--desktop),
  body.nav-open:has(#hd .dm-primary-menu--desktop) {
    overflow: hidden;
  }

  body.nav-open #hd,
  body.nav-open #n-mobile-nav.open {
    background: #fff !important;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  body.nav-open #hd .n-logo,
  body.nav-open #hd .n-hamburger {
    color: #0a0909 !important;
    opacity: 1 !important;
  }

  body.nav-open #hd .n-hamburger {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    color: #6e17c7 !important;
  }

  body.nav-open #hd .n-ham-arr { color: inherit !important; }

  body.nav-open #n-mobile-nav.open {
    max-height: calc(100vh - var(--nav-h, 64px));
    max-height: calc(100dvh - var(--nav-h, 64px));
    padding: 16px var(--margin, 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  body.nav-open #n-mobile-nav.open > ul.dm-primary-menu > li + li {
    border-top: 0 !important;
  }

  body.nav-open #n-mobile-nav.open .n-item {
    display: flex;
    box-sizing: border-box;
    min-height: 44px;
    width: 100%;
    align-items: center;
    padding: 0;
    border: 0;
    background-image: none;
    color: #0a0909 !important;
    opacity: 1 !important;
    font-size: 17px;
    line-height: 24px;
    letter-spacing: .3px;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 7px;
  }

  body.nav-open #n-mobile-nav.open > ul.dm-primary-menu > li > a.n-item .dm-text-link-label {
    text-decoration-line: underline !important;
    text-decoration-thickness: 1px !important;
    text-underline-offset: 7px !important;
  }

  body.nav-open #n-mobile-nav.open .n-sub-item {
    display: flex;
    box-sizing: border-box;
    width: calc(100% - 16px);
    min-width: 0;
    min-height: 44px;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin-inline-start: 16px;
    padding: 8px 0;
    border: 0 !important;
    color: #0a0909 !important;
    font: var(--fw-u, 100) 17px / 24px var(--fm);
    letter-spacing: .3px;
    white-space: normal;
    overflow-wrap: anywhere;
    text-decoration: none;
  }

  body.nav-open #n-mobile-nav.open .n-sub-item:has(+ .n-item) { margin-bottom: 8px; }

  body.nav-open #n-mobile-nav.open .n-sub-label {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  body.nav-open #n-mobile-nav.open .n-sub-arrow {
    flex: 0 0 auto;
    color: currentColor;
  }

  body.nav-open #n-mobile-nav.open .n-termin {
    display: flex;
    min-height: 48px;
    width: 100%;
    margin: 0;
    align-items: center;
    padding: 0;
    border: 0;
    background: transparent !important;
    color: #0a0909 !important;
    box-shadow: none;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 7px;
  }

  body.nav-open #n-mobile-nav.open .n-termin-label {
    color: inherit !important;
    font: inherit;
    letter-spacing: inherit;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 7px;
  }

  body.nav-open #n-mobile-nav.open .n-termin-label::after {
    content: " →";
  }

  @media (hover: hover) {
    body.nav-open #n-mobile-nav.open .n-termin:hover { color: #6e17c7 !important; }
  }

  body.nav-open #n-mobile-nav.open .n-termin :is(.button__icon, .button__icon-wrapper) {
    display: none !important;
  }

  body.nav-open #n-mobile-nav.open :is(a, button):focus-visible,
  body.nav-open #hd :is(a, button):focus-visible {
    outline: 2px solid #6e17c7;
    outline-offset: 3px;
  }
}

/* Reuse the compact header before the desktop subgrid fits, with the wider page margins. */
@media (width > 768px) and (width <= 1280px) {
  body #hd:has(.dm-primary-menu--desktop),
  body #hd.hidden:has(.dm-primary-menu--desktop) {
    position: fixed;
    transform: none;
  }

  body #hd.on:has(.dm-primary-menu--desktop) {
    background: rgb(255 255 255 / 88%);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }

  body #hd.on:has(.dm-primary-menu--desktop) :is(.n-logo, .n-hamburger, .n-ham-arr) {
    color: #0a0909 !important;
    opacity: 1 !important;
  }

  body #hd .nav-inner > ul.dm-primary-menu--desktop {
    display: none !important;
  }

  body #hd:has(.dm-primary-menu--desktop) .n-hamburger {
    display: inline-flex;
    grid-row: 1;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-inline-start: auto;
  }

  body:has(#hd .dm-primary-menu--desktop) #n-mobile-nav {
    box-sizing: border-box;
    position: fixed;
    inset: var(--nav-h, 64px) 0 auto;
    z-index: 99;
    transform: translateY(-100%) translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: transform .4s var(--ease), opacity .3s;
  }

  body:has(#hd .dm-primary-menu--desktop) #n-mobile-nav.open {
    inset-block-end: 0;
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  body #n-mobile-nav.open > ul.dm-primary-menu > li.menu-item-has-children {
    margin-bottom: 8px;
  }

  body #n-mobile-nav.open ul.sub-menu > li > a.n-sub-item::after {
    content: "→" / "";
    flex: 0 0 auto;
    margin-left: 8px;
    color: currentColor;
  }

  body #n-mobile-nav .dm-florarium-lab-item {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  body #n-mobile-nav.open .dm-florarium-lab-item > a.n-item {
    flex: 0 1 auto;
    width: auto;
    min-width: 0;
    white-space: normal;
  }
}

@media (width > 1280px) {
  body:has(#hd .dm-primary-menu--desktop) #n-mobile-nav {
    display: none !important;
  }
}
