/**
 * Mobile Menü Slide-Out — netzwerkweites Styling
 * ------------------------------------------------
 * Adaptiert aus dem Dachseite-WPCode-Snippet #3458 — generisch gemacht für
 * alle Sites (Dachseite, kath-au, kath-heerbrugg, kath-berneck). Aktiviert
 * sich automatisch sobald ein Elementor-Popup geöffnet wird (body-Class
 * .sh-mobile-menu-open + Popup-Class .sh-popup-open werden vom JS gesetzt).
 *
 * Selektoren-Konvention:
 *   .elementor-popup-modal          — alle Elementor-Popups (alle 4 Sites)
 *   .elementor-element-bdd86e0      — das geklonte Mega-Menu-Widget (selbe
 *                                     ID in allen 4 Popups, da als 1:1-Klon
 *                                     aus der Dachseite übernommen)
 *   .icon-burger-menu               — alle Burger-Icons im Header (generisch
 *                                     statt der ursprünglich hardcoded
 *                                     Element-ID 6a728e5)
 */

/* ============================================================
   Hamburger zu X Morph
   3 Span-Bars werden per JS in jeden .icon-burger-menu eingefügt.
   Body-Class .sh-mobile-menu-open triggert die Transformation.
   ============================================================ */

/* Font-Icon-Glyph der ElementsKit (.icon-burger-menu) IMMER ausblenden,
   nicht erst nach JS-Inject — sonst Flicker beim Page-Load (Standard-
   Burger erscheint kurz, bevor die sh-bars per JS injiziert werden). */
.icon-burger-menu {
    font-size: 0 !important;
    display: inline-block !important;
    width: 40px !important;
    height: 26px !important;
    position: relative !important;
    vertical-align: middle !important;
    background: none !important;
}

.icon-burger-menu::before,
.icon-burger-menu::after {
    display: none !important;
    content: none !important;
}

.icon-burger-menu .sh-bar {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    width: 100%;
    height: 2.5px;
    background: currentColor;
    transition:
        top 0.3s cubic-bezier(0.5, 0, 0.3, 1),
        transform 0.3s cubic-bezier(0.5, 0, 0.3, 1),
        opacity 0.2s ease;
}

.icon-burger-menu .sh-bar:nth-child(1) { top: 0; }
.icon-burger-menu .sh-bar:nth-child(2) { top: 12px; }
.icon-burger-menu .sh-bar:nth-child(3) { top: 24px; }

/* Open: Bars zu X morphen */
body.sh-mobile-menu-open .icon-burger-menu .sh-bar:nth-child(1) {
    top: 7px;
    transform: rotate(45deg);
}

body.sh-mobile-menu-open .icon-burger-menu .sh-bar:nth-child(2) {
    opacity: 0;
}

body.sh-mobile-menu-open .icon-burger-menu .sh-bar:nth-child(3) {
    top: 7px;
    transform: rotate(-45deg);
}

/* ============================================================
   Popup: Vollbild, Slide-In von rechts, Slide-Out nach rechts
   ============================================================ */

.elementor-popup-modal.sh-popup-managed {
    background: rgba(0, 0, 0, 0.35) !important;
    transition: background 0.4s ease;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    /* Falls Elementor das Modal aus dem Sticky-Header-Kontext rendert, an
       die fixed-Position des Viewports binden, damit der Popup nicht mit
       dem Hintergrund scrollt. */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 99995 !important;
}

.elementor-popup-modal.sh-popup-managed .dialog-message {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-bottom: 120px !important;
    -webkit-overflow-scrolling: touch;
    align-items: flex-start !important;
    justify-content: flex-start !important;
}

.elementor-popup-modal.sh-popup-managed .dialog-widget-content,
.elementor-popup-modal.sh-popup-managed .dialog-message {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
    /* Bevorzugt dynamic-viewport-height für Mobile-Safari (Adressleiste) */
    height: 100dvh !important;
    width: 100vw !important;
    max-width: none !important;
    margin: 0 !important;
    background: #fff !important;
    background-color: #fff !important;
    transform: translateX(100%);
    opacity: 0;
    transition:
        transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.25s ease;
    will-change: transform, opacity;
    /* Eigener Stacking-Context, damit nichts dahinter durchschimmert */
    isolation: isolate;
    z-index: 1;
}

.elementor-popup-modal.sh-popup-managed .dialog-widget-content {
    align-items: flex-start !important;
    justify-content: flex-start !important;
}

/* Mit Admin-Bar Offset (nur Desktop — auf Mobile zeigt WP keine Admin-Bar) */
@media (min-width: 783px) {
    body.admin-bar .elementor-popup-modal.sh-popup-managed .dialog-widget-content,
    body.admin-bar .elementor-popup-modal.sh-popup-managed .dialog-message {
        top: 32px !important;
        height: calc(100vh - 32px) !important;
        height: calc(100dvh - 32px) !important;
    }
}

/* Open: in Position sliden + einblenden */
.elementor-popup-modal.sh-popup-managed.sh-popup-open .dialog-widget-content,
.elementor-popup-modal.sh-popup-managed.sh-popup-open .dialog-message {
    transform: translateX(0);
    opacity: 1;
}

/* Closing: zurück nach rechts + ausblenden */
.elementor-popup-modal.sh-popup-managed.sh-popup-closing .dialog-widget-content,
.elementor-popup-modal.sh-popup-managed.sh-popup-closing .dialog-message {
    transform: translateX(100%) !important;
    opacity: 0 !important;
}

.elementor-popup-modal.sh-popup-managed.sh-popup-closing {
    background: rgba(0, 0, 0, 0) !important;
}

/* ============================================================
   Close-Button (✕) — Touch-Area + Positionierung
   Wird vom Elementor selbst oder dem Custom-HTML im Popup
   gerendert. CSS hebt es nach oben rechts.
   ============================================================ */

.elementor-popup-modal.sh-popup-managed .dialog-close-button,
.elementor-popup-modal.sh-popup-managed .custom-popup-close {
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: absolute !important;
    top: 12px;
    right: 12px;
    z-index: 20 !important;
    min-width: 48px;
    min-height: 48px;
    cursor: pointer;
    background: none;
    border: 0;
    border-radius: 50%;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    pointer-events: auto !important;
    --sh-close-size: 36px;
    font-size: var(--sh-close-size) !important;
    line-height: 1;
    color: #333;
}

.elementor-popup-modal.sh-popup-managed .dialog-close-button svg,
.elementor-popup-modal.sh-popup-managed .dialog-close-button i {
    width: var(--sh-close-size);
    height: var(--sh-close-size);
    font-size: var(--sh-close-size);
    pointer-events: none;
    fill: currentColor;
}

/* ============================================================
   Mega-Menu im Popup: vertikales Item-Layout
   Greift auf das geklonte Mega-Menu mit ID bdd86e0
   ============================================================ */

.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-toggle {
    display: none !important;
}

.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu {
    position: relative !important;
}

.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-wrapper {
    display: block !important;
    width: 100% !important;
    transform: none !important;
}

.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-heading {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    padding: 0 24px 16px 24px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-item {
    width: 100% !important;
}

/* Hauptmenü padding-top, damit Items nicht hinter dem Logo verschwinden
   (Logo ist im Popup-Container, nicht fixed — wir pushen das Mega-Menu
   um genug Höhe, damit "Aktuelles" sichtbar bleibt). */
body.sh-mobile-menu-open .elementor-popup-modal .elementor-element-bdd86e0:not(.sh-drill-active) .e-n-menu-heading {
    padding-top: 12px !important;
}

/* Mindestabstand zwischen Logo-Container und Mega-Menu — auf den
   Subsites ist das Logo höher als bei der Dachseite, deshalb mehr
   Luft, damit "Aktuelles" nicht hinter dem Logo verschwindet. */
.elementor-popup-modal .elementor-element-bdd86e0 {
    margin-top: 32px !important;
}

/* Trennlinie zwischen Items */
.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-heading > .e-n-menu-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding: 0.35em 0 !important;
    margin: 0 !important;
}

.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-heading > .e-n-menu-item:last-child {
    border-bottom: none;
}

/* Kompaktere Items */
.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-heading > .e-n-menu-item .e-n-menu-title {
    padding-top: 9px !important;
    padding-bottom: 9px !important;
}

/* ============================================================
   Mega-Menu Items: Stagger Fade-In von links beim Popup-Open
   ============================================================ */

.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-item {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.elementor-popup-modal.sh-popup-open .elementor-element-bdd86e0 .e-n-menu-item {
    opacity: 1;
    transform: translateX(0);
}

/* Kompaktere Delays — Popup-Slide ist bei ~0.3s fertig, dann starten Items */
.elementor-popup-modal.sh-popup-open .elementor-element-bdd86e0 .e-n-menu-item:nth-child(1) { transition-delay: 0.10s; }
.elementor-popup-modal.sh-popup-open .elementor-element-bdd86e0 .e-n-menu-item:nth-child(2) { transition-delay: 0.15s; }
.elementor-popup-modal.sh-popup-open .elementor-element-bdd86e0 .e-n-menu-item:nth-child(3) { transition-delay: 0.20s; }
.elementor-popup-modal.sh-popup-open .elementor-element-bdd86e0 .e-n-menu-item:nth-child(4) { transition-delay: 0.25s; }
.elementor-popup-modal.sh-popup-open .elementor-element-bdd86e0 .e-n-menu-item:nth-child(5) { transition-delay: 0.30s; }
.elementor-popup-modal.sh-popup-open .elementor-element-bdd86e0 .e-n-menu-item:nth-child(6) { transition-delay: 0.35s; }
.elementor-popup-modal.sh-popup-open .elementor-element-bdd86e0 .e-n-menu-item:nth-child(7) { transition-delay: 0.40s; }

/* Im Drill-Active keine Delays */
.elementor-popup-modal .elementor-element-bdd86e0.sh-drill-active .e-n-menu-item {
    transition-delay: 0s !important;
}

/* ============================================================
   2-Ebenen Drill-Down: per-Item-Hiding
   Wenn ein Dropdown-Item geöffnet wird (.sh-drill-active),
   verstecken alle anderen Top-Level-Items und der eigene Title.
   ============================================================ */

/* Single-Column Submenu Items */
.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-content .e-con,
.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-content .e-con-inner,
.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-content .elementor-element,
.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-content .elementor-widget,
.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-content .elementor-widget-wrap,
.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-content .elementor-widget-container,
.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-content .e-flex,
.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-content .elementor-column {
    width: 100% !important;
    max-width: 100% !important;
    flex-basis: 100% !important;
    flex-direction: column !important;
}

/* Submenu-Container Default-Display */
.elementor-popup-modal .elementor-element-bdd86e0 .sh-active-item .e-n-menu-content {
    display: block !important;
}

/* Submenu Inhalt aus absolute heraus in flow zwingen */
.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-content {
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    max-width: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-content .e-con-inner {
    padding: 0 !important;
}

/* Icon-list im Submenu untereinander */
.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-content .elementor-widget-icon-list {
    display: block !important;
    visibility: visible !important;
}

.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-content .elementor-icon-list-items {
    display: flex !important;
    flex-direction: column !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
}

.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-content .elementor-icon-list-item {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 8px 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-content .elementor-icon-list-item a {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
}

/* Hidden-on-mobile etc. ignorieren */
.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-content .elementor-hidden-mobile,
.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-content .elementor-hidden-tablet,
.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-content .elementor-hidden-tablet_extra,
.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-content .elementor-hidden-laptop,
.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-content .elementor-hidden-desktop {
    display: block !important;
}

/* Items smooth collapse */
.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-heading > .e-n-menu-item {
    overflow: hidden !important;
    transition:
        opacity 0.25s ease,
        max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        padding 0.3s ease,
        margin 0.3s ease,
        border 0.2s ease !important;
    max-height: 200px;
}

.elementor-popup-modal .elementor-element-bdd86e0.sh-drill-active .sh-active-item {
    overflow: visible !important;
    max-height: none !important;
}

.elementor-popup-modal .elementor-element-bdd86e0.sh-drill-active .e-n-menu-heading > .e-n-menu-item:not(.sh-active-item) {
    opacity: 0 !important;
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    pointer-events: none !important;
}

.elementor-popup-modal .elementor-element-bdd86e0.sh-drill-active .sh-active-item .e-n-menu-title {
    opacity: 0 !important;
    max-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    transition:
        opacity 0.2s ease,
        max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        padding 0.3s ease,
        margin 0.3s ease !important;
}

.elementor-popup-modal .elementor-element-bdd86e0 .sh-active-item .e-n-menu-title {
    overflow: hidden;
    max-height: 200px;
    transition: opacity 0.2s ease, max-height 0.3s ease !important;
}

.elementor-popup-modal .elementor-element-bdd86e0.sh-drill-active .sh-active-item .e-n-menu-content {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 5 !important;
    background: inherit !important;
    opacity: 1;
    transition-delay: 0.1s;
}

.elementor-popup-modal .elementor-element-bdd86e0.sh-drill-active .e-n-menu-content {
    padding-bottom: 20px !important;
}

.elementor-popup-modal .elementor-element-bdd86e0 .e-n-menu-item .e-n-menu-content {
    padding: 0 !important;
    margin: 0 !important;
}

.elementor-popup-modal .elementor-element-bdd86e0 .e-active {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 24px 80px 24px !important;
}

/* ============================================================
   Zurück-Button im Drill-Down — oberhalb des Submenus,
   fixed unterhalb des Close-X
   ============================================================ */

.sh-drill-back {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 14px 0 !important;
    margin: 0 0 20px 0 !important;
    background: none !important;
    border: 0 !important;
    border-bottom: none !important;
    border-radius: 0 !important;
    font-family: inherit !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    color: currentColor !important;
    cursor: pointer !important;
    width: 100% !important;
    text-align: left !important;
    box-shadow: none !important;
    outline: none !important;
    -webkit-appearance: none;
    appearance: none;
    opacity: 0;
    transform: translateX(-20px);
    transition:
        opacity 0.35s ease,
        transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
    transition-delay: 0.15s;
}

.sh-drill-back,
.sh-drill-back:link,
.sh-drill-back:visited,
.sh-drill-back:focus,
.sh-drill-back span,
.elementor-popup-modal .elementor-element-bdd86e0 .sh-drill-back {
    color: currentColor !important;
}

.sh-drill-back::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-left: 4px;
}

.elementor-popup-modal .elementor-element-bdd86e0.sh-drill-active .sh-drill-back {
    opacity: 1;
    transform: translateX(0);
}

/* Fixed oben — unter dem Close-X */
body.sh-mobile-menu-open .sh-drill-back {
    position: fixed !important;
    top: 54px !important;
    left: 7px !important;
    right: 80px !important;
    width: auto !important;
    z-index: 100 !important;
    background: #fff !important;
    margin: 0 !important;
    padding: 12px 16px !important;
    border-bottom: none !important;
}

body.admin-bar.sh-mobile-menu-open .sh-drill-back {
    top: 100px !important;
}

body.sh-mobile-menu-open .elementor-popup-modal .elementor-element-bdd86e0.sh-drill-active .sh-active-item .e-n-menu-content {
    padding-top: 90px !important;
}

/* ============================================================
   Pfarrei-Standorte: 3 Links nebeneinander am unteren Rand
   ============================================================ */

.elementor-popup-modal .pfarrei-standorte {
    margin-top: auto !important;
    padding-top: 12px !important;
    padding-bottom: 10px !important;
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    background: #fff !important;
    width: 100% !important;
}

.elementor-popup-modal .pfarrei-standorte .elementor-icon-list-items {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-around !important;
    align-items: stretch !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
}

.elementor-popup-modal .pfarrei-standorte .elementor-icon-list-item {
    flex: 1 1 0 !important;
    display: flex !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

.elementor-popup-modal .pfarrei-standorte .elementor-icon-list-item:not(:last-child)::after {
    display: none !important;
}

.elementor-popup-modal .pfarrei-standorte .elementor-icon-list-item + .elementor-icon-list-item {
    border-left: 1px solid rgba(0, 0, 0, 0.08) !important;
}

.elementor-popup-modal .pfarrei-standorte .elementor-icon-list-item a {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    width: 100% !important;
    padding: 6px 4px !important;
    color: rgb(126, 107, 89) !important;
    text-decoration: none !important;
    font-size: 14px !important;
    line-height: 1.2 !important;
    transition: opacity 0.2s ease !important;
}

.elementor-popup-modal .pfarrei-standorte .elementor-icon-list-item a:hover,
.elementor-popup-modal .pfarrei-standorte .elementor-icon-list-item a:active {
    opacity: 0.65 !important;
}

.elementor-popup-modal .pfarrei-standorte .elementor-icon-list-icon {
    margin: 0 !important;
}

.elementor-popup-modal .pfarrei-standorte .elementor-icon-list-icon svg,
.elementor-popup-modal .pfarrei-standorte .elementor-icon-list-icon i {
    width: 30px !important;
    height: 30px !important;
    color: rgb(126, 107, 89) !important;
    fill: rgb(126, 107, 89) !important;
}

/* Im Drill-Down ausblenden, damit Submenu nicht überlappt */
.elementor-popup-modal .e-con-inner:has(.sh-drill-active) .pfarrei-standorte {
    display: none !important;
}

/* Body-Scroll-Lock wenn Popup offen */
body.sh-mobile-menu-open {
    overflow: hidden;
}

/* Reduzierte Animation für Nutzer mit "prefers-reduced-motion" */
@media (prefers-reduced-motion: reduce) {
    .elementor-popup-modal .e-n-menu-item,
    .icon-burger-menu .sh-bar,
    .elementor-popup-modal.sh-popup-managed .dialog-widget-content,
    .elementor-popup-modal.sh-popup-managed .dialog-message {
        transition: none !important;
        animation: none !important;
        transform: none !important;
        opacity: 1 !important;
    }
}
