/* Grouped website navigation. Loaded after all three themes so nested lists do
   not inherit the former full-width, twelve-link navigation layout. */
html[data-ui-theme] body.site { --header-h: 80px; }
html[data-ui-theme] .site .sh--grouped .sh__inner {
  display: flex; height: var(--header-h); max-width: 1680px; gap: 20px;
}
html[data-ui-theme] .site .sh--grouped .sh__brand { margin: 0; padding: 0; }
html[data-ui-theme] .site .sh--grouped .sh__brand::after { display: none; }
html[data-ui-theme] .site .sh--grouped .sh__menu {
  display: flex; flex: 1; align-items: center; justify-content: space-between; gap: 20px;
}
html[data-ui-theme] .site .sh--grouped .sh__nav { border: 0; padding: 0; min-width: 0; }
html[data-ui-theme] .site .sh--grouped .sh__primary {
  display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 4px;
}
html[data-ui-theme] .site .sh--grouped .sh__aside { flex-direction: row; align-items: center; gap: 4px; padding: 0; }
html[data-ui-theme] .site .sh--grouped .sh__toggle { display: none; }
html[data-ui-theme] .site .sh--grouped .sh__group { position: relative; }
html[data-ui-theme] .site .sh--grouped :is(.sh__nav-trigger, .sh__direct) {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; height: auto; padding: 10px 13px; margin: 0;
  font: 500 14px/24px var(--f); white-space: nowrap; list-style: none;
  color: var(--text-strong); background: transparent; border: 0; border-radius: 10px;
  cursor: pointer; text-decoration: none; box-shadow: none;
}
html[data-ui-theme] .site .sh--grouped .sh__nav-trigger::-webkit-details-marker { display: none; }
html[data-ui-theme] .site .sh--grouped :is(.sh__nav-trigger:hover, .sh__direct:hover),
html[data-ui-theme] .site .sh--grouped .sh__group[open] > .sh__nav-trigger {
  background: var(--bg-tint); color: var(--link);
}
html[data-ui-theme] .site .sh--grouped .sh__group.is-current > .sh__nav-trigger,
html[data-ui-theme] .site .sh--grouped .sh__direct.is-current {
  color: var(--link); text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px;
}
html[data-ui-theme] .site .sh--grouped .sh__nav-trigger > .icon { flex-shrink: 0; transition: transform .15s ease; }
html[data-ui-theme] .site .sh--grouped .sh__group[open] > .sh__nav-trigger > .icon { transform: rotate(180deg); }
html[data-ui-theme] .site .sh--grouped .sh__submenu {
  position: absolute; top: calc(100% + 10px); left: 0; z-index: 71;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px;
  width: 340px; max-width: calc(100vw - 48px); padding: 10px; margin: 0;
  max-height: calc(100dvh - var(--header-h) - 24px); overflow-y: auto;
  border: 1px solid var(--border); border-radius: 16px;
  background: var(--ui-surface-solid, #fff); box-shadow: var(--shadow-menu);
}
html[data-ui-theme] .site .sh--grouped .sh__submenu--wide {
  width: 620px; grid-template-columns: repeat(2, minmax(0, 1fr));
}
html[data-ui-theme] .site .sh--grouped .sh__submenu .sh__subitem {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  gap: 3px; padding: 13px 14px; min-height: 76px; height: auto;
  white-space: normal; border: 0; border-radius: 10px; text-align: left;
  background: transparent; color: var(--text-strong); text-decoration: none; box-shadow: none;
}
html[data-ui-theme] .site .sh--grouped .sh__submenu .sh__subitem:hover,
html[data-ui-theme] .site .sh--grouped .sh__submenu .sh__subitem:focus-visible,
html[data-ui-theme] .site .sh--grouped .sh__submenu .sh__subitem.is-current {
  background: var(--bg-tint); color: var(--link);
}
html[data-ui-theme] .site .sh--grouped .sh__item-title { font: 600 14px/22px var(--f); }
html[data-ui-theme] .site .sh--grouped .sh__item-description { font: 400 12px/19px var(--f); color: var(--text-2); }
html[data-ui-theme] .site .sh--grouped .sh__subitem.is-current .sh__item-title {
  text-decoration: underline; text-underline-offset: 4px;
}
html[data-ui-theme] .site .sh--grouped .sh__download {
  margin-left: 8px; padding-inline: 20px;
  background: var(--ui-primary-gradient, var(--teal-ink)); color: var(--ui-on-accent, #fff);
}
html[data-ui-theme] .site .sh--grouped .sh__download:hover,
html[data-ui-theme] .site .sh--grouped .sh__download.is-current {
  background: var(--ui-primary-gradient, var(--teal-ink)); color: var(--ui-on-accent, #fff);
  text-decoration: underline; text-underline-offset: 5px;
}

/* Native details remain usable without JavaScript; JS only enhances closing and
   the compact mobile drawer. A medium-width layout keeps every label readable. */
@media (min-width: 1181px) and (max-width: 1360px) {
  html[data-ui-theme] body.site { --header-h: 116px; }
  html[data-ui-theme] .site .sh--grouped .sh__inner { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 60px 56px; gap: 0; }
  html[data-ui-theme] .site .sh--grouped .sh__menu { display: contents; }
  html[data-ui-theme] .site .sh--grouped .sh__brand { grid-column: 1; grid-row: 1; }
  html[data-ui-theme] .site .sh--grouped .sh__aside { grid-column: 2; grid-row: 1; justify-content: flex-end; }
  html[data-ui-theme] .site .sh--grouped .sh__nav { grid-column: 1 / -1; grid-row: 2; border-top: 1px solid var(--border); padding-top: 5px; }
}
@media (max-width: 1180px) {
  html[data-ui-theme] body.site { --header-h: 68px; }
  html[data-ui-theme] .site .sh--grouped .sh__toggle { display: grid; }
  html[data-ui-theme] .site .sh--grouped .sh__menu { display: none; }
  html[data-ui-theme] .site .sh--grouped.is-open .sh__menu {
    display: block; position: absolute; inset: 100% 0 auto; padding: 12px var(--gutter) 24px;
    max-height: calc(100dvh - var(--header-h)); overflow-y: auto; overscroll-behavior: contain;
    background: var(--ui-surface-solid, #fff); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-menu);
  }
  html[data-ui-theme] .site .sh--grouped.is-open .sh__primary { flex-direction: column; align-items: stretch; gap: 6px; }
  html[data-ui-theme] .site .sh--grouped.is-open :is(.sh__nav-trigger, .sh__direct) {
    width: 100%; justify-content: space-between; padding: 12px 14px; min-height: 48px;
    font-size: 15px; border: 0; border-radius: 10px;
  }
  html[data-ui-theme] .site .sh--grouped.is-open .sh__submenu {
    position: static; grid-template-columns: minmax(0, 1fr); width: auto; max-width: none;
    max-height: none; overflow: visible; margin: 0 0 8px; padding: 4px;
    border: 0; border-left: 2px solid var(--border); border-radius: 0; box-shadow: none;
  }
  html[data-ui-theme] .site .sh--grouped.is-open .sh__submenu .sh__subitem { min-height: 68px; padding: 10px 14px; }
  html[data-ui-theme] .site .sh--grouped.is-open .sh__download { margin: 4px 0 0; justify-content: center; }
  html[data-ui-theme] .site .sh--grouped.is-open .sh__aside {
    display: flex; flex-direction: column; align-items: stretch; gap: 6px;
    margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border);
  }
  html[data-ui-theme] .site .sh--grouped.is-open :is(.sh__link, .sh__account, .theme-picker__trigger) {
    display: flex; width: 100%; min-height: 48px; height: auto; padding: 10px 14px;
    justify-content: flex-start; border-radius: 10px; font-size: 14px;
  }
  html[data-ui-theme] .site .sh--grouped.is-open .sh__account { justify-content: space-between; }
  html[data-ui-theme] .site .sh--grouped.is-open :is(.langs__list, .theme-picker__menu) {
    position: static; width: 100%; min-width: 0; margin: 4px 0; box-shadow: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  html[data-ui-theme] .site .sh--grouped .sh__nav-trigger > .icon { transition: none; }
}
