/* Nested nav dropdowns — pairs with nested-nav.js and NavWidget markup.
   Structural only: colors/weights come from the active theme.
   Shipped as NavItemsField runtimeAssets (guests + editors).

   Breakpoint token (override in theme :root):
     --nav-mobile-max: 900px;
   nested-nav.js reads it and toggles html.db-nav-compact (custom props cannot
   appear inside @media). Top-level row layout stays with the theme.
   Compact accordion rules below use html.db-nav-compact only — never a fixed
   @media px that disagrees with a theme's --nav-mobile-max.
   FOUC before nested-nav.js: accepted; see nested-nav.js header. */

:root {
  --nav-mobile-max: 900px;
}

.main-nav > .nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
}

.main-nav > .nav-links > li {
  position: relative;
}

.main-nav > .nav-links > li > a {
  display: inline-block;
  text-decoration: none;
}

.main-nav > .nav-links > li:has(> .nav-links) > a::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 0.35rem;
  vertical-align: middle;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform 0.22s ease;
}

.main-nav > .nav-links > li.open > a::after,
.main-nav > .nav-links > li:hover > a::after {
  transform: rotate(180deg);
}

.main-nav > .nav-links > li > .nav-links {
  display: block;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 12rem;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #d4cfc8);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 200;
  visibility: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  pointer-events: none;
}

.main-nav > .nav-links > li > .nav-links::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -10px;
  height: 10px;
}

.main-nav > .nav-links > li.open > .nav-links,
.main-nav > .nav-links > li:hover > .nav-links {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.main-nav > .nav-links > li > .nav-links a {
  display: block;
  padding: 0.45rem 1rem;
  text-decoration: none;
  font-size: 0.9rem;
  white-space: normal;
}

/* Compact mode (html.db-nav-compact from nested-nav.js / --nav-mobile-max):
   convert flyout submenus into inline accordions in the shell header drawer.
   Do not apply to hub_menu / other .main-nav instances outside the header. */
html.db-nav-compact .site-header .main-nav > .nav-links > li > .nav-links,
html.db-nav-compact .header .main-nav > .nav-links > li > .nav-links {
  position: static;
  box-shadow: none;
  border: none;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: none;
  padding: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}

html.db-nav-compact .site-header .main-nav > .nav-links > li.open > .nav-links,
html.db-nav-compact .header .main-nav > .nav-links > li.open > .nav-links {
  max-height: 24rem;
  opacity: 1;
  visibility: visible;
  padding: 0.25rem 0 0.5rem 1rem;
}

html.db-nav-compact .site-header .main-nav > .nav-links > li:hover > .nav-links,
html.db-nav-compact .header .main-nav > .nav-links > li:hover > .nav-links {
  opacity: 0;
  max-height: 0;
}

html.db-nav-compact .site-header .main-nav > .nav-links > li.open:hover > .nav-links,
html.db-nav-compact .header .main-nav > .nav-links > li.open:hover > .nav-links {
  opacity: 1;
  max-height: 24rem;
}
