/* ==========================================================================
   WorkZen Child Theme — Mega-Menu (Lösungen-Flyout)
   Präfix: --wzmm-   (workzen-mega-menu.css)
   Voraussetzung: workzen-nav.css bereits geladen
   ========================================================================== */

:root {
  --wzmm-panel-bg:          var(--wz-bg);
  --wzmm-tile-radius:       10px;
  --wzmm-tile-border:       rgba(255, 255, 255, 0.08);
  --wzmm-tile-border-hv:    rgba(255, 255, 255, 0.22);
  /* Overlay: stärker als vorher, damit Eyebrow + Titel sicher lesbar bleiben */
  --wzmm-overlay-start:     rgba(20, 58, 58, 0.25);
  --wzmm-overlay-end:       rgba(20, 58, 58, 0.90);
  --wzmm-chip-bg:           rgba(255, 255, 255, 0.10);
  --wzmm-chip-bg-hv:        rgba(255, 255, 255, 0.18);
  --wzmm-chip-border:       rgba(255, 255, 255, 0.18);
  --wzmm-more-bg:           var(--wz-petrol);
  --wzmm-more-bg-hv:        var(--wz-petrol-dark);
  --wzmm-eyebrow-color:     var(--wz-petrol-light);
}

/* ========== Nav-Leiste: volle Höhe für reibungslosen Hover =============== */
.wz-nav__links {
  align-self: stretch;
}
.wz-nav__links > li {
  display: flex;
  align-items: center;
}
.wz-nav__links a.wzmm-link {
  display: inline-flex;
  align-items: center;
}

/* ========== Caret-Button ================================================= */
.wzmm-caret-btn {
  all: unset !important;
  display: inline-flex !important;
  align-items: center !important;
  padding: 6px 4px !important;
  margin-left: -2px !important;
  cursor: pointer !important;
  line-height: 1 !important;
}
.wzmm-caret-btn:focus-visible {
  outline: 2px solid var(--wz-petrol-light) !important;
  outline-offset: 2px !important;
}
.wzmm-caret-btn[aria-expanded="true"] .wz-caret {
  transform: rotate(225deg) translateY(2px);
}

/* ========== Akzentlinie bei offenem Panel ================================= */
.wz-nav.wzmm-panel-open::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: var(--wz-petrol-light);
  z-index: 501;
  pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
  .wz-nav:has(.wzmm-has-panel:hover)::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 3px;
    background: var(--wz-petrol-light);
    z-index: 501;
    pointer-events: none;
  }
}

/* ========== Panel-Wrapper ================================================= */
.wzmm-panel {
  position: fixed;
  top: 0; left: 0;
  width: 1512px;
  background: var(--wzmm-panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: none;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 500;
}
.wzmm-caret-btn[aria-expanded="true"] + .wzmm-panel {
  opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0);
}
@media (hover: hover) and (pointer: fine) {
  .wzmm-has-panel:hover .wzmm-panel {
    opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0);
  }
}

.wzmm-panel__inner {
  padding: 28px 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ========== Panel-Header ================================================== */
.wzmm-panel__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.wzmm-eyebrow {
  font-family: var(--wz-font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wzmm-eyebrow-color);
  white-space: nowrap;
}
.wzmm-panel__count {
  font-family: var(--wz-font);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
}
.wzmm-panel__count strong {
  color: #fff;
  font-weight: 600;
}

/* ========== Grid ========================================================== */
.wzmm-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  list-style: none;
  margin: 0; padding: 0;
}
.wzmm-cell {
  min-width: 0;
}

/* ========== Foto-Kacheln (1–3) =========================================== */
.wzmm-tile {
  display: block;
  position: relative;
  height: 220px;
  border-radius: var(--wzmm-tile-radius);
  overflow: hidden;
  border: 1px solid var(--wzmm-tile-border);
  text-decoration: none;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.wzmm-tile:hover,
.wzmm-tile:focus-visible {
  border-color: var(--wzmm-tile-border-hv);
  transform: translateY(-2px);
}
.wzmm-tile:focus-visible {
  outline: 2px solid var(--wz-petrol-light);
  outline-offset: 2px;
}

/* Hintergrundbild */
.wzmm-tile__bg {
  position: absolute;
  inset: 0;
  background-color: var(--wz-petrol-dark);
  background-size: cover;
  background-position: center;
  transition: transform 0.3s ease;
}
.wzmm-tile:hover .wzmm-tile__bg {
  transform: scale(1.04);
}
.wzmm-tile__bg--placeholder {
  background: linear-gradient(135deg, var(--wz-petrol-dark) 0%, var(--wz-petrol) 100%);
}

/* CI-Verlauf: stärker im oberen Bereich damit Eyebrow lesbar bleibt,
   sehr opak unten für Titel + Arrow */
.wzmm-tile__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    var(--wzmm-overlay-start) 0%,
    rgba(20, 58, 58, 0.55) 45%,
    var(--wzmm-overlay-end)   100%
  );
  pointer-events: none;
}

/* Text-Inhalte */
.wzmm-tile__content {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Eyebrow: eigener Hintergrund-Chip damit er auf jedem Foto lesbar bleibt */
.wzmm-tile__category {
  display: inline-block;
  font-family: var(--wz-font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wzmm-eyebrow-color);
  /* Leicht getönter Hintergrund als Lesbarkeits-Sicherung */
  background: rgba(20, 58, 58, 0.55);
  padding: 2px 6px;
  border-radius: 3px;
  align-self: flex-start;
  margin-bottom: 2px;
}

/* Titel: Umbruch erlaubt, damit lange Titel nicht abgeschnitten werden */
.wzmm-tile__title {
  font-family: var(--wz-font);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
  white-space: normal;     /* Umbruch erlauben */
  overflow-wrap: break-word;
  hyphens: auto;
}

.wzmm-tile__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 14px;
  margin-top: 8px;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.wzmm-tile:hover .wzmm-tile__arrow {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.6);
}

/* ========== 4. Kachel: Weitere Lösungen ================================== */
.wzmm-more {
  height: 220px;
  border-radius: var(--wzmm-tile-radius);
  background: var(--wzmm-more-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.wzmm-more__title {
  font-family: var(--wz-font);
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
  white-space: normal;
}

/* Chips: ausreichend Padding, saubere Lesbarkeit */
.wzmm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0; padding: 0;
  flex: 1;
  align-content: flex-start;
}
.wzmm-chip {
  display: inline-block;
  padding: 5px 12px;           /* mehr Luft als vorher */
  border-radius: 20px;
  background: var(--wzmm-chip-bg);
  border: 1px solid var(--wzmm-chip-border);
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--wz-font);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.wzmm-chip:hover,
.wzmm-chip:focus-visible {
  background: var(--wzmm-chip-bg-hv);
  color: #fff;
}
.wzmm-chip:focus-visible {
  outline: 2px solid var(--wz-petrol-light);
  outline-offset: 2px;
}

.wzmm-more__link {
  font-family: var(--wz-font);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  transition: opacity 0.15s ease;
}
.wzmm-more__link:hover { opacity: 0.75; }

/* ========== Panel-Footer ================================================== */
.wzmm-panel__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  gap: 16px;
}
.wzmm-panel__footer span {
  font-family: var(--wz-font);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}
.wzmm-panel__footer strong {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
}
.wzmm-panel__footer-link {
  font-family: var(--wz-font);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  padding: 8px 18px;
  border-radius: 8px;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.wzmm-panel__footer-link:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.05);
}

/* ========== Responsive ==================================================== */

@media (max-width: 1024px) and (min-width: 721px) {
  .wzmm-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .wzmm-tile { height: 180px; }
  .wzmm-more { height: 180px; }
}

@media (max-width: 720px) {
  /* Panel: standardmäßig versteckt, inline im Menü-Flow */
  .wzmm-panel {
    position: static;
    width: auto !important;
    left: auto !important;
    top: auto !important;
    background: rgba(255, 255, 255, 0.03);
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: none;
    border-radius: 0;
    transform: none !important;
    /* Versteckt bis Caret geöffnet */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.2s ease, max-height 0.25s ease, visibility 0.2s;
  }

  /* Geöffnet: per Caret-Button */
  .wzmm-caret-btn[aria-expanded="true"] + .wzmm-panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    max-height: 2000px; /* großzügig für alle Inhalte */
  }

  /* Hover-Regel auf Mobile deaktivieren */
  .wzmm-has-panel:hover .wzmm-panel {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
  /* Außer wenn Caret geöffnet */
  .wzmm-has-panel:has(.wzmm-caret-btn[aria-expanded="true"]) .wzmm-panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .wzmm-panel__inner {
    padding: 12px 20px 20px;
    gap: 12px;
  }
  .wzmm-panel__header {
    flex-direction: column;
    gap: 4px;
  }
  .wzmm-panel__count { white-space: normal; }
  .wzmm-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .wzmm-tile { height: 150px; }
  .wzmm-more { height: auto; min-height: 130px; }
  .wzmm-panel__footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* Fokus-Sichtbarkeit */
.wz-nav__links a.wzmm-tile:focus-visible {
  outline: 2px solid var(--wz-petrol-light);
  outline-offset: 2px;
}