/* Footer sitemap -> mobile accordion (<=479px).
   Replaces Breakdance's per-column hamburger collapse with a clean chevron
   accordion driven by each column heading. Above 480px the footer keeps its
   normal expanded multi-column layout untouched.

   NOTE: the collapse is driven by toggling the menu BODY's display, not by an
   animated max-height on the .footer-wp-menu wrapper -- max-height on that
   wrapper proved unreliable (it stayed clamped to 0 even against a more specific
   / inline-!important override), so display toggling is used for robustness. */
@media (max-width: 479px) {

  /* stack the sections flush as one accordion list */
  .footer-sitemap-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0 !important;
    border-bottom: 1px solid rgba(0, 0, 0, .12);
  }

  /* hide Breakdance's hamburger toggle for the footer menus */
  .footer-sitemap-grid .footer-wp-menu .breakdance-menu-toggle {
    display: none !important;
  }

  /* the column heading becomes the accordion trigger */
  .footer-sitemap-grid .footer-sitemap-col-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0;
    padding: 17px 2px;
    cursor: pointer;
    border-top: 1px solid rgba(0, 0, 0, .12);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }

  /* chevron: points down when closed */
  .footer-sitemap-grid .footer-sitemap-col-heading::after {
    content: "";
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    margin: -3px 2px 0 0;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform .25s ease;
  }

  /* chevron: points up when open */
  .footer-sitemap-grid > div.footer-col--open .footer-sitemap-col-heading::after {
    transform: rotate(-135deg);
    margin-top: 3px;
  }

  /* collapsible body: hidden by default, shown when the column is open */
  .footer-sitemap-grid .footer-wp-menu {
    overflow: hidden;
  }
  .footer-sitemap-grid .footer-wp-menu .breakdance-menu {
    display: none !important;
    position: static !important;
    background: transparent !important;
  }
  .footer-sitemap-grid > div.footer-col--open .footer-wp-menu .breakdance-menu {
    display: block !important;
  }

  /* neutralise Breakdance's mobile off-canvas so the shown list flows inline.
     (Does NOT touch display of the menu body -- that is the open/close switch.) */
  .footer-sitemap-grid .footer-wp-menu .breakdance-menu-list,
  .footer-sitemap-grid .footer-wp-menu .breakdance-menu--enabled .breakdance-menu-list,
  .footer-sitemap-grid .footer-wp-menu .breakdance-menu--default .breakdance-menu-list:not(.is-visible),
  .footer-sitemap-grid .footer-wp-menu .breakdance-menu--accordion .breakdance-menu-list:not(.is-visible) {
    display: flex !important;
    flex-direction: column !important;
    position: static !important;
    inset: auto !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: auto !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
    background: transparent !important;
    background-color: transparent !important;
    z-index: auto !important;
    gap: 0 !important;
    padding: 2px 0 16px 2px !important;
  }

  /* footer links: black, no per-link borders / oversized mobile padding */
  .footer-sitemap-grid .footer-wp-menu .breakdance-menu .breakdance-menu-link {
    display: block !important;
    color: var(--color-black) !important;
    background: transparent !important;
    border: 0 !important;
    padding: 7px 0 !important;
    font-size: 15px !important;
    line-height: 1.3 !important;
    white-space: normal !important;
    justify-content: flex-start !important;
  }
  .footer-sitemap-grid .footer-wp-menu .breakdance-menu-list > :last-child {
    border-bottom: 0 !important;
  }
  .footer-sitemap-grid .footer-wp-menu .breakdance-menu-link:hover {
    color: var(--color-red) !important;
  }
}
