/* ============================================================================
   Heholinks - front-office styles (desktop + mobile menu)
   ============================================================================ */

:root {
  --heholinks-color: #333;
  --heholinks-bg: #fff;
  --heholinks-accent: #0056b3;
  --heholinks-hover-bg: #f5f5f5;
  --heholinks-submenu-bg: #fff;
  --heholinks-submenu-shadow: 0 4px 12px rgba(0, 0, 0, .12);
  --heholinks-submenu-radius: 4px;
  --heholinks-mobile-bg: #fff;
  --heholinks-mobile-overlay: transparent;
  --heholinks-mobile-width: 320px;
  --heholinks-transition: .25s ease;
  --heholinks-font-size: .9375rem;
  --heholinks-link-pad-y: .75rem;
  --heholinks-link-pad-x: 1rem;
  --heholinks-z: 1050;
}

/* ----- Desktop ----- */

.heholinks-desktop { position: relative; z-index: var(--heholinks-z); }

.heholinks-nav {
  display: flex;
  flex-wrap: wrap;
  row-gap: 2px;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  justify-content: center;
}

.heholinks-item { position: relative; }

.heholinks-link {
  display: block;
  padding: var(--heholinks-link-pad-y) var(--heholinks-link-pad-x);
  color: var(--heholinks-color);
  font-size: var(--heholinks-font-size);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--heholinks-transition), background-color var(--heholinks-transition);
}

a.heholinks-link:hover,
a.heholinks-link:focus {
  color: var(--heholinks-accent);
  background-color: var(--heholinks-hover-bg);
}

.heholinks-item--featured > .heholinks-link {
  font-weight: 700;
  color: var(--heholinks-accent);
}

.heholinks-item.has-submenu > .heholinks-link::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 6px;
  vertical-align: middle;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
}

.heholinks-submenu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: var(--heholinks-submenu-bg);
  border-radius: var(--heholinks-submenu-radius);
  box-shadow: var(--heholinks-submenu-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity var(--heholinks-transition),
              transform var(--heholinks-transition),
              visibility var(--heholinks-transition);
  z-index: calc(var(--heholinks-z) + 1);
  padding: .5rem 0;
}

.heholinks-item.has-submenu:hover > .heholinks-submenu,
.heholinks-item.has-submenu.heholinks-item--open > .heholinks-submenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Submenu (default template) */
.heholinks-linklist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.heholinks-linklist__item a,
.heholinks-linklist__item span {
  display: block;
  padding: .5rem 1.25rem;
  color: var(--heholinks-color);
  font-size: var(--heholinks-font-size);
  text-decoration: none;
  transition: color var(--heholinks-transition), background-color var(--heholinks-transition);
}

.heholinks-linklist__item a:hover,
.heholinks-linklist__item a:focus {
  color: var(--heholinks-accent);
  background-color: var(--heholinks-hover-bg);
}

/* Responsive shrink-to-fit tiers (mirrors legacy 1400/1200 breakpoints,
   floored at 13px per hehodev/frontend/theme-analysis/main-menu/main-menu.md) */
@media (min-width: 1200px) and (max-width: 1399.98px) {
  .heholinks-desktop {
    --heholinks-font-size: .875rem;
    --heholinks-link-pad-y: .5rem;
    --heholinks-link-pad-x: .625rem;
  }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
  .heholinks-desktop {
    --heholinks-font-size: .8125rem;
    --heholinks-link-pad-y: .4rem;
    --heholinks-link-pad-x: .4rem;
  }
}

/* ----- Mobile ----- */

.heholinks-mobile { position: relative; z-index: var(--heholinks-z); }

.heholinks-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
}

.heholinks-toggle__bar {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--heholinks-color);
  border-radius: 2px;
  transition: transform var(--heholinks-transition), opacity var(--heholinks-transition);
}

.heholinks-toggle[aria-expanded="true"] .heholinks-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.heholinks-toggle[aria-expanded="true"] .heholinks-toggle__bar:nth-child(2) { opacity: 0; }
.heholinks-toggle[aria-expanded="true"] .heholinks-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.heholinks-mobile__overlay {
  position: fixed;
  inset: 0;
  background: var(--heholinks-mobile-overlay);
  z-index: var(--heholinks-z);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--heholinks-transition), visibility var(--heholinks-transition);
}

.heholinks-mobile__overlay--visible {
  opacity: 1;
  visibility: visible;
}

.heholinks-mobile__panel {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--heholinks-mobile-width);
  max-width: 85vw;
  height: 100vh;
  height: 100dvh;
  background: var(--heholinks-mobile-bg);
  z-index: calc(var(--heholinks-z) + 1);
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform var(--heholinks-transition);
  box-shadow: 2px 0 8px rgba(0, 0, 0, .1);
}

.heholinks-mobile__panel[aria-hidden="false"] { transform: translateX(0); }

.heholinks-mobile__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e5e5e5;
  font-weight: 700;
  font-size: 1.1rem;
}

.heholinks-mobile__close {
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--heholinks-color);
}

.heholinks-mobile__nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.heholinks-mobile__item {
  border-bottom: 1px solid #f0f0f0;
}

.heholinks-mobile__item > a,
.heholinks-mobile__item > span {
  display: block;
  padding: .875rem 1.25rem;
  color: var(--heholinks-color);
  font-size: var(--heholinks-font-size);
  text-decoration: none;
}

.heholinks-mobile__item--featured > a,
.heholinks-mobile__item--featured > .heholinks-mobile__toggle {
  font-weight: 700;
  color: var(--heholinks-accent);
}

.heholinks-mobile__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: .875rem 1.25rem;
  background: none;
  border: none;
  font-size: var(--heholinks-font-size);
  color: var(--heholinks-color);
  cursor: pointer;
  text-align: left;
}

.heholinks-mobile__arrow {
  font-size: 1.25rem;
  line-height: 1;
  transition: transform var(--heholinks-transition);
}

.heholinks-mobile__toggle[aria-expanded="true"] .heholinks-mobile__arrow {
  transform: rotate(90deg);
}

.heholinks-mobile__submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
  background-color: #fafafa;
}

.heholinks-mobile__submenu[aria-hidden="false"] { max-height: 1000px; }

.heholinks-mobile__submenu .heholinks-linklist__item a,
.heholinks-mobile__submenu .heholinks-linklist__item span {
  padding-left: 2rem;
}

.heholinks-mobile__see-all {
  display: block;
  padding: .625rem 2rem;
  font-size: var(--heholinks-font-size);
  font-weight: 600;
  color: var(--heholinks-accent);
  text-decoration: none;
}

body.heholinks-noscroll { overflow: hidden; }

/* ============================================================================
   Legacy submenu template - full-width grey panel
   ============================================================================ */

/* Promote the LI to static so the panel can pin to the viewport */
.heholinks-desktop .heholinks-item.has-submenu:has(> .heholinks-submenu--legacy) {
  position: static;
}

.heholinks-desktop .heholinks-submenu--legacy {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  width: 100vw;
  max-width: 100vw;
  min-width: 0;
  margin-left: calc(50% - 50vw);
  background: #8e8e8e;
  box-shadow: 0 23px 21px rgba(28, 28, 28, .6);
  border-radius: 0;
  padding: 24px 30px 32px;
}

.heholinks-desktop .heholinks-submenu--legacy .heholinks-legacy {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px 16px;
  max-width: 1400px;
  margin: 0 auto;
}

.heholinks-desktop .heholinks-legacy__col {
  grid-column: span 3;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.heholinks-desktop .heholinks-legacy__header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  color: #fff;
  text-decoration: none;
  margin-bottom: 8px;
}

a.heholinks-legacy__header:hover,
a.heholinks-legacy__header:focus {
  color: #fff;
  text-decoration: none;
}

.heholinks-desktop .heholinks-legacy__thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 50%;
  padding: 10px;
  width: 70px;
  height: 70px;
  box-sizing: border-box;
}

.heholinks-desktop .heholinks-legacy__thumb img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  display: block;
}

.heholinks-desktop .heholinks-legacy__title {
  display: block;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-decoration: underline;
  margin: 4px 0 2px;
}

a.heholinks-legacy__header:hover .heholinks-legacy__title,
a.heholinks-legacy__header:focus .heholinks-legacy__title {
  color: #fff;
}

.heholinks-desktop .heholinks-legacy__children {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
}

.heholinks-desktop .heholinks-legacy__children li a,
.heholinks-desktop .heholinks-legacy__children li span {
  display: block;
  color: #fff;
  font-weight: 500;
  font-size: .875rem;
  padding: 3px 0;
  text-decoration: none;
  transition: margin-left .2s ease, color .2s ease;
}

.heholinks-desktop .heholinks-legacy__children li a:hover,
.heholinks-desktop .heholinks-legacy__children li a:focus {
  margin-left: 5px;
  color: #fff;
}

.heholinks-desktop .heholinks-legacy__child {
  position: relative;
}

/* n+2 grandchildren — float to the right of the parent on hover so the panel
   layout doesn't shift */
.heholinks-desktop .heholinks-legacy__grandchildren {
  position: absolute;
  top: 100%;
  left: 12px;
  min-width: 200px;
  list-style: none;
  padding: 8px 12px;
  margin: 4px 0 0;
  background: #8e8e8e;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
  border-radius: 4px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
  z-index: 2;
}

/* Hover bridge so the mouse can cross the 4px gap without closing the popup */
.heholinks-desktop .heholinks-legacy__grandchildren::before {
  content: '';
  position: absolute;
  top: -0.25rem;
  left: 0;
  width: 100%;
  height: 0.25rem;
}

.heholinks-desktop .heholinks-legacy__child:hover > .heholinks-legacy__grandchildren,
.heholinks-desktop .heholinks-legacy__child:focus-within > .heholinks-legacy__grandchildren {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.heholinks-desktop .heholinks-legacy__grandchildren li a,
.heholinks-desktop .heholinks-legacy__grandchildren li span {
  display: block;
  color: #fff;
  font-weight: 400;
  font-size: .8125rem;
  padding: 2px 0;
  text-decoration: none;
  transition: margin-left .15s ease;
}

.heholinks-desktop .heholinks-legacy__grandchildren li a:hover,
.heholinks-desktop .heholinks-legacy__grandchildren li a:focus {
  margin-left: 4px;
  color: #fff;
}

/* Mobile: flatten the grid, hide thumbs, render as the default accordion list */
.heholinks-mobile .heholinks-mobile__submenu--legacy .heholinks-legacy {
  display: block;
}

.heholinks-mobile .heholinks-mobile__submenu--legacy .heholinks-legacy__col {
  padding: .5rem 1.25rem;
  border-top: 1px solid #f0f0f0;
}

.heholinks-mobile .heholinks-mobile__submenu--legacy .heholinks-legacy__thumb {
  display: none;
}

.heholinks-mobile .heholinks-mobile__submenu--legacy .heholinks-legacy__header {
  display: block;
  color: var(--heholinks-color);
  text-decoration: none;
  margin: 0 0 .25rem;
}

.heholinks-mobile .heholinks-mobile__submenu--legacy .heholinks-legacy__title {
  display: block;
  color: var(--heholinks-color);
  font-weight: 700;
  font-size: var(--heholinks-font-size);
  text-decoration: none;
  margin: 0;
}

.heholinks-mobile .heholinks-mobile__submenu--legacy .heholinks-legacy__children {
  list-style: none;
  margin: 0;
  padding: 0 0 .25rem 1rem;
}

.heholinks-mobile .heholinks-mobile__submenu--legacy .heholinks-legacy__children li a {
  display: block;
  padding: .25rem 0;
  color: var(--heholinks-color);
  text-decoration: none;
  font-size: var(--heholinks-font-size);
}

/* Mobile: render grandchildren flat under their n+1 parent (no hover) */
.heholinks-mobile .heholinks-mobile__submenu--legacy .heholinks-legacy__grandchildren {
  list-style: none;
  margin: 0;
  padding: 0 0 .25rem 1rem;
}

.heholinks-mobile .heholinks-mobile__submenu--legacy .heholinks-legacy__grandchildren li a {
  display: block;
  padding: .2rem 0;
  color: var(--heholinks-color);
  text-decoration: none;
  font-size: .8125rem;
}
