/* Modernes Menü (Menü-Stil "modern", siehe assets/js/menu-modern.js). Nur geladen, wenn aktiv.
   Eigene Datei statt header-menu.css: theme-complete.css wird pro Domain nur beim Theme-Speichern
   gebaut und nicht deployt -- diese Datei kommt mit jedem Deploy direkt an.
   Alle Werte als Variablen, pro Domain per eigenem CSS überschreibbar. */
:root {
  --mm-bg: #ffffff;
  --mm-text: #1e293b;
  --mm-muted: #64748b;
  --mm-line: #efefef;
  --mm-card-bg: #f6f5fa;
  --mm-active-bg: #f6f5fa;
  --mm-accent: var(--color-secondary, #6d28d9);
  --mm-link: var(--color-menu-link, #0f766e);
  --mm-title-size: 21px;
  --mm-row-size: 16px;
  --mm-row-height: 48px;
  --mm-sub-size: 15px;
  --mm-mega-width: 1200px;
}
:root[data-a11y-theme="dark"] {
  --mm-bg: #0f172a;
  --mm-text: #e2e8f0;
  --mm-muted: #94a3b8;
  --mm-line: #1e293b;
  --mm-card-bg: #1e293b;
  --mm-active-bg: #1e293b;
  --mm-accent: #c4b5fd;
  --mm-link: #7dd3fc;
}

.mm-drill, .mm-mega { display: none; color: var(--mm-text); }
.mm-drill button, .mm-mega button { font: inherit; color: inherit; background: none; border: 0; margin: 0; cursor: pointer; text-align: left; }
.mm-drill ul, .mm-mega ul { list-style: none; margin: 0; padding: 0; }
.mm-chev { flex-shrink: 0; color: var(--mm-muted); }

/* Karte (Kategorie-Kopf) */
.mm-card { background: var(--mm-card-bg); border-radius: 12px; padding: 14px 16px; margin: 0 0 14px; }
.mm-card-title { font-weight: 700; font-size: 17px; line-height: 1.3; display: flex; align-items: center; gap: 8px; }
.mm-card-title img, .mm-card-title svg { height: 1.2em; width: auto; }
.mm-card-desc { color: var(--mm-muted); font-size: 14px; line-height: 1.45; margin-top: 4px; }
.mm-card-desc p { margin: 0 0 6px; }
.mm-card-desc p:last-child { margin-bottom: 0; }
.mm-card-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-weight: 600; font-size: 15px; color: var(--mm-accent) !important; text-decoration: none; }
.mm-card-link:hover { text-decoration: underline; }

/* ── Mobil: Drill-Down ───────────────────────────────────────────────── */
@media screen and (max-width: 955px) {
  body.apx-menu-modern #horiznav, body.apx-menu-modern #horiznav.active { display: none !important; }
  body.apx-menu-modern.menu-open .mm-drill {
    display: block;
    position: fixed;
    /* .site-header hat backdrop-filter und ist damit Bezugsrahmen für position:fixed -- daher
       Höhe statt bottom:0 (bottom würde an der 70px-Kopfleiste enden) */
    top: var(--site-header-height, 70px);
    left: 0; right: 0;
    height: calc(100vh - var(--site-header-height, 70px));
    height: calc(100dvh - var(--site-header-height, 70px));
    background: var(--mm-bg);
    z-index: 1001;
    overflow: hidden;
  }
  .mm-panel {
    position: absolute; inset: 0;
    background: var(--mm-bg);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transform: translateX(100%);
    transition: transform .28s ease;
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
  }
  .mm-panel.is-active { transform: translateX(0); }
  .mm-panel.is-behind { transform: translateX(-30%); }
  .mm-panel.mm-root { transform: translateX(0); }
  .mm-panel.mm-root.is-behind { transform: translateX(-30%); }
  @media (prefers-reduced-motion: reduce) { .mm-panel { transition: none; } }
  :root[data-a11y-motion="reduced"] .mm-panel { transition: none; }

  .mm-back {
    position: sticky; top: 0; z-index: 2;
    display: flex !important; align-items: center; gap: 8px; width: 100%;
    padding: 14px 20px; font-size: 15px; font-weight: 500;
    color: var(--mm-link) !important;
    background: var(--mm-card-bg) !important;
    border-bottom: 1px solid var(--mm-line) !important;
  }
  .mm-panel-inner { padding: 18px 20px 0; }
  .mm-panel-title { font-weight: 700; font-size: var(--mm-title-size); line-height: 1.25; margin: 4px 0 14px; outline: none; }

  .mm-row {
    display: flex !important; align-items: center; justify-content: space-between; gap: 12px;
    width: 100%; min-height: var(--mm-row-height);
    padding: 10px 0; font-size: var(--mm-row-size); font-weight: 500;
    color: var(--mm-text) !important; text-decoration: none;
  }
  .mm-item { border-bottom: 1px solid var(--mm-line); }
  .mm-item:last-child { border-bottom: 0; }
  .mm-acc .mm-chev-down { display: none; }
  .mm-acc.open .mm-chev-down { display: block; }
  .mm-acc.open .mm-acc-toggle > .mm-chev:not(.mm-chev-down) { display: none; }
  .mm-sub { display: none; padding: 0 0 10px 18px !important; }
  .mm-acc.open > .mm-sub { display: block; }
  .mm-sub-link { display: flex; align-items: center; min-height: 40px; font-size: var(--mm-sub-size); font-weight: 400; color: var(--mm-text) !important; text-decoration: none; }
}

/* ── Desktop: Mega-Menü ──────────────────────────────────────────────── */
@media screen and (min-width: 956px) {
  body.apx-menu-modern #horiznav > li.mm-mega-item > ul { display: none !important; }
  body.apx-menu-modern #horiznav > li.mm-mega-item.mm-open > a { color: var(--color-menu-link-hover); }
  body.apx-menu-modern #horiznav > li.mm-mega-item.mm-open > a::after { transform: rotate(180deg); }
  .mm-mega {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: min(var(--mm-mega-width), calc(100vw - 32px));
    background: var(--mm-bg);
    border-radius: 0 0 14px 14px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, .16), 0 2px 6px rgba(15, 23, 42, .08);
    z-index: 1002;
  }
  .mm-mega.is-open { display: block; }
  .mm-mega-inner {
    display: grid;
    grid-template-columns: 240px 280px 1fr;
    max-height: calc(100vh - var(--site-header-height, 70px) - 24px);
  }
  .mm-mega-inner.mm-no-col3 { grid-template-columns: 240px 1fr 0; }
  .mm-col { padding: 20px; overflow-y: auto; }
  .mm-col1 { border-right: 1px solid var(--mm-line); }
  .mm-col2 { border-right: 1px solid var(--mm-line); }
  .mm-no-col3 .mm-col2 { border-right: 0; }
  .mm-no-col3 .mm-col3 { padding: 0; }

  .mm-row1, .mm-row2 {
    display: flex !important; align-items: center; justify-content: space-between; gap: 10px;
    width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 8px;
    font-size: 15px; font-weight: 500; color: var(--mm-text) !important; text-decoration: none;
  }
  .mm-row1:hover, .mm-row2:hover, .mm-row1.is-active, .mm-row2.is-active { background: var(--mm-active-bg) !important; }
  .mm-row1.is-active, .mm-row2.is-active { font-weight: 600; }

  .mm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 28px; margin-top: 4px; }
  .mm-grid-title { display: block; font-weight: 600; font-size: 15px; color: var(--mm-text) !important; text-decoration: none; margin-bottom: 6px; }
  a.mm-grid-title:hover { color: var(--mm-accent) !important; }
  .mm-grid-list li a { display: block; padding: 3px 0; font-size: 14px; color: var(--mm-muted) !important; text-decoration: none; }
  .mm-grid-list li a:hover { color: var(--mm-accent) !important; }
}
