/* Mobile CMS page menu (Hem / Dokument / …).
   Overrides site-local style.css without editing it.
   Desktop keep unchanged; only max-width 768px. */

@media (max-width: 768px) {
  .top-header {
    position: relative;
    overflow: visible;
  }

  /* Menu column uses full top bar width on phone */
  .top-header .row > .col-10,
  .top-header .row > .col-sm-8,
  .top-header .row > .col-md-7 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .top-header .custom-menu {
    display: block;
    width: 100%;
    position: relative;
  }

  .top-header .hamburger-menu {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 12px 10px;
    margin: 0;
    box-sizing: border-box;
    z-index: 1001;
  }

  .top-header .hamburger-menu span {
    display: block;
    width: 22px;
    height: 2px;
    margin: 0;
    background-color: currentColor;
    border-radius: 1px;
    transition: transform 0.2s ease, opacity 0.2s ease;
    transform-origin: center;
  }

  /* Open panel: full width, same surface as top-header (no black box) */
  .top-header .custom-menu-items {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    width: 100%;
    max-width: 100%;
    margin: 4px 0 0;
    padding: 4px 0 8px !important;
    background-color: transparent !important;
    box-shadow: none !important;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    box-sizing: border-box;
  }

  .top-header .custom-menu-items .custom-menu-link {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 12px 4px !important;
    font-size: 15px;
    line-height: 1.3;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  .top-header .custom-menu-items .custom-menu-item:last-child .custom-menu-link {
    border-bottom: 0;
  }

  .top-header .custom-menu-items .dropdown-menu {
    position: static;
    width: 100%;
    background: transparent;
    box-shadow: none;
    border: 0;
    padding: 0 0 0 12px;
  }

  /* Hamburger → X while the list is open (jQuery sets inline display) */
  .top-header .custom-menu.is-open .hamburger-menu span:nth-child(1),
  .top-header .custom-menu:has(.custom-menu-items[style*="display: block"]) .hamburger-menu span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .top-header .custom-menu.is-open .hamburger-menu span:nth-child(2),
  .top-header .custom-menu:has(.custom-menu-items[style*="display: block"]) .hamburger-menu span:nth-child(2) {
    opacity: 0;
  }

  .top-header .custom-menu.is-open .hamburger-menu span:nth-child(3),
  .top-header .custom-menu:has(.custom-menu-items[style*="display: block"]) .hamburger-menu span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .top-header .hamburger-menu span {
    transition: none;
  }
}
