/* ------------------------------------------------------------
 * Aktionsbutton (Startseite) + Pop-up
 * Eigene Datei, wird nur geladen wenn der Aktionsbutton aktiv ist
 * (siehe inc/aktionsbutton.php)
 * ---------------------------------------------------------- */

/* Runder Button, fix unten rechts am Bildschirmrand */
.ges-aktion {
    --ges-aktion-size: 170px;
    position: fixed;
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, env(safe-area-inset-bottom));
    z-index: 9000; /* über Inhalt/Menü, unter dem Preloader (9999) */
    animation: ges-aktion-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 1s both;
}

@media (min-width: 782px) {
    .ges-aktion {
        --ges-aktion-size: 260px;
        right: 2rem;
        bottom: 2rem;
    }
}

@keyframes ges-aktion-pop {
    from { opacity: 0; transform: scale(0.4); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .ges-aktion { animation: none; }
}

.ges-aktion__open {
    /* Alle Größen im Kreis hängen an dieser Schriftgröße (em) und
       skalieren so automatisch mit der Kreisgröße mit. */
    --ges-grad: linear-gradient(90deg, #775698 0%, #CF007F 50%, #E63812 100%);
    position: relative;
    width: var(--ges-aktion-size);
    height: var(--ges-aktion-size);
    padding: 0;
    border: 2px solid #CF007F;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    font-family: inherit;
    font-size: calc(var(--ges-aktion-size) / 10);
    text-align: center;
    cursor: pointer;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.22);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ges-aktion__open:hover,
.ges-aktion__open:focus-visible {
    transform: scale(1.05);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.ges-aktion__open:focus-visible {
    outline: 3px solid #775698;
    outline-offset: 4px;
}

/* Textblock im oberen, weißen Bereich */
.ges-aktion__text {
    position: absolute;
    inset: 12% 0 29% 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ges-aktion__text > span {
    display: block;
    background: var(--ges-grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    white-space: nowrap;
    /* Keine Silbentrennung/Wortumbrüche im Kreis – lange Wörter
       werden stattdessen vom Script kleiner gerechnet */
    -webkit-hyphens: none;
    hyphens: none;
    word-break: keep-all;
    overflow-wrap: normal;
}

.ges-aktion__line {
    display: block;
    white-space: nowrap;
}

.ges-aktion__heading {
    /* Box ist immer genau so breit wie der Text – der Farbverlauf
       deckt so jeden Buchstaben ab (nichts wird abgeschnitten) */
    width: max-content;
    max-width: none;
    font-size: 0.66em;
    font-weight: 300;
    line-height: 1.1;
}

.ges-aktion__big {
    font-size: 3.3em;
    font-weight: 700;
    line-height: 0.95;
    letter-spacing: -0.03em;
    margin: 0.02em 0 0.04em;
}

.ges-aktion__pct {
    font-size: 0.5em;
    letter-spacing: 0;
    margin-left: 0.04em;
}

.ges-aktion__sub {
    width: max-content;
    max-width: none;
    font-size: 0.66em;
    font-weight: 300;
    line-height: 1.1;
}

/* Magenta-Welle unten mit "MEHR ERFAHREN." */
.ges-aktion__footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 26%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 4%;
}

.ges-aktion__wave {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    fill: #CF007F;
}

.ges-aktion__label {
    position: relative;
    color: #fff;
    font-size: 0.52em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
}

/* Handy: Button nicht fix, sondern zentriert auf der Kante zwischen
   Header-Cover und erstem Abschnitt (scrollt mit). Desktop: nur die
   fixe Variante unten rechts. */
.ges-aktion--inline {
    display: none;
}

@media (max-width: 781px) {
    .ges-aktion--fixed:not(.ges-aktion--no-slot) {
        display: none;
    }

    .ges-aktion--inline {
        display: flex;
        justify-content: center;
        position: relative;
        right: auto;
        bottom: auto;
        z-index: 5;
        height: 0;
        animation: none;
    }

    .ges-aktion--inline .ges-aktion__open {
        margin-top: calc(var(--ges-aktion-size) / -2);
    }

    /* Im Cover: rechts oben auf der Welle zwischen Bild und Text */
    .wp-block-cover__inner-container > .ges-aktion--inline {
        position: absolute;
        top: calc(var(--ges-aktion-size) * -1 + 5px);
        right: 1rem;
        height: auto;
        display: block;
        z-index: 5;
    }

    .wp-block-cover__inner-container > .ges-aktion--inline .ges-aktion__open {
        margin-top: 0;
    }
}

/* Scrollen der Seite sperren, solange das Pop-up offen ist */
html.ges-aktion-open,
html.ges-aktion-open body {
    overflow: hidden !important;
}

/* Pop-up */
.ges-aktion-dialog {
    width: min(900px, calc(100vw - 2rem));
    max-height: calc(100dvh - 2rem);
    padding: 0;
    border: none;
    border-radius: 1.25rem;
    background: #fff;
    color: inherit;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.ges-aktion-dialog[open] {
    display: flex;
    flex-direction: column;
    animation: ges-aktion-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Abgedunkelter Hintergrund */
.ges-aktion-dialog::backdrop {
    background: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    animation: ges-aktion-fade 0.3s ease;
}

.ges-aktion-dialog__content {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 3rem 1.5rem 2rem;
}

@media (min-width: 782px) {
    .ges-aktion-dialog__content {
        padding: 4rem 3.5rem 3rem;
    }
}

/* Abschnitte der Aktionsseite im Pop-up nicht mit dem großen
   Seiten-Padding darstellen */
.ges-aktion-dialog__content section {
    padding: 0;
}

.ges-aktion-dialog__content > *:first-child {
    margin-top: 0;
}

.ges-aktion-dialog__content > *:last-child {
    margin-bottom: 0;
}

.ges-aktion-dialog__content img {
    max-width: 100%;
    height: auto;
}

.ges-aktion-dialog__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 1;
    width: 2.75rem;
    height: 2.75rem;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #775698, #CF007F, #E63812);
    color: #fff;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.ges-aktion-dialog__close:hover,
.ges-aktion-dialog__close:focus-visible {
    transform: scale(1.08);
}

@keyframes ges-aktion-in {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: none; }
}

@keyframes ges-aktion-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .ges-aktion-dialog[open],
    .ges-aktion-dialog::backdrop {
        animation: none;
    }
}


/* ------------------------------------------------------------
 * Weihnachts-Deko im Pop-up
 * Aktiv, wenn auf der Aktionsseite eine Gruppe mit der Klasse
 * "christmas-ani" vorkommt. Die Kugeln hängen an der Oberkante
 * des Pop-ups, fallen beim Öffnen herein und baumeln leicht.
 * ---------------------------------------------------------- */
.christmas-deco {
    position: absolute;
    top: 0;
    left: 0.5rem;
    z-index: 2;
    height: 180px;
    width: auto;
    aspect-ratio: 80.01 / 485.51;
    overflow: visible;
    pointer-events: none;
}

@media (min-width: 782px) {
    /* Desktop: Kugeln größer, oberer Teil der Schnüre verschwindet
       über der Oberkante des Pop-ups (wird abgeschnitten) */
    .christmas-deco {
        left: 1rem;
        top: -150px;
        height: 460px;
    }
}

/* Gespiegelte Kugeln rechts, links neben dem Schließen-Button */
.christmas-deco--right {
    left: auto;
    right: 4.5rem;
}

@media (min-width: 782px) {
    .christmas-deco--right {
        left: auto;
        right: 6.5rem;
    }
}

/* Rechts etwas anderer Takt, damit beide Seiten nicht synchron schwingen */
.christmas-deco--right .christmas-deco__ball-1 { animation-duration: 3.5s; animation-delay: -0.7s; }
.christmas-deco--right .christmas-deco__ball-2 { animation-duration: 3s;   animation-delay: -1.9s; }
.christmas-deco--right .christmas-deco__ball-3 { animation-duration: 4.1s; animation-delay: -1.2s; }

/* Mindesthöhe, damit die Kugeln bei wenig Text nicht abgeschnitten werden */
.ges-aktion-dialog.has-christmas {
    min-height: 220px;
}

@media (min-width: 782px) {
    .ges-aktion-dialog.has-christmas {
        min-height: 340px;
    }
}

/* Platz für die Kugeln, damit sie den Text nicht verdecken */
.ges-aktion-dialog.has-christmas .ges-aktion-dialog__content {
    padding-right: 7rem;
}

@media (min-width: 782px) {
    .ges-aktion-dialog.has-christmas .ges-aktion-dialog__content {
        padding-right: 12rem;
    }
}

.ges-aktion-dialog[open] .christmas-deco {
    animation: christmas-drop 0.9s cubic-bezier(0.34, 1.4, 0.64, 1) 0.15s both;
}

.christmas-deco__ball {
    transform-box: view-box;
    animation: christmas-swing 3s ease-in-out infinite alternate;
}

.christmas-deco__ball-1 { animation-duration: 3.2s; animation-delay: -1.1s; }
.christmas-deco__ball-2 { animation-duration: 3.8s; animation-delay: -0.4s; }
.christmas-deco__ball-3 { animation-duration: 2.7s; animation-delay: -2s; }

@keyframes christmas-drop {
    from { transform: translateY(-100%); }
    to   { transform: translateY(0); }
}

@keyframes christmas-swing {
    from { transform: rotate(-4deg); }
    to   { transform: rotate(4deg); }
}

@media (prefers-reduced-motion: reduce) {
    .ges-aktion-dialog[open] .christmas-deco,
    .christmas-deco__ball {
        animation: none;
    }
}


/* ------------------------------------------------------------
 * Pillen im Pop-up – Look wie .referenz-category-badge
 * (Verlauf gefüllt, weiße Großbuchstaben), nebeneinander.
 * Aufbau: Gruppe mit Klasse "job-category" (oder "badges"),
 * darin je Pille ein Absatz.
 * ---------------------------------------------------------- */
.ges-aktion-dialog .job-category,
.ges-aktion-dialog .badges,
.ges-aktion-dialog .job-category > .wp-block-group__inner-container,
.ges-aktion-dialog .badges > .wp-block-group__inner-container {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-start;
    gap: 0.5rem !important;
}

.ges-aktion-dialog .job-category p,
.ges-aktion-dialog .badges p {
    display: inline-block;
    flex: 0 0 auto;
    width: auto !important;
    margin: 0 !important;
    padding: 0.5rem 1.2rem;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, #775698, #CF007F, #E63812);
    color: #fff !important;
    font-weight: 500;
    font-size: 0.9rem;
    text-transform: uppercase;
    line-height: 1;
}

/* Kein Fokus-Rahmen um das ganze Pop-up beim Öffnen */
.ges-aktion-dialog:focus,
.ges-aktion-dialog:focus-visible {
    outline: none;
}

/* Überschriften im Pop-up: das Theme gibt H2 am Desktop 5rem Abstand
   nach oben – im Pop-up soll die Überschrift direkt unter dem Text
   davor stehen (z. B. "Weihnachtsaktion …:" → "-15% auf Malerarbeiten") */
.ges-aktion-dialog__content h1,
.ges-aktion-dialog__content h2,
.ges-aktion-dialog__content h3 {
    margin-top: 0.25rem !important;
    margin-bottom: 1.5rem;
}

.ges-aktion-dialog__content p + h1,
.ges-aktion-dialog__content p + h2,
.ges-aktion-dialog__content p + h3 {
    margin-top: 0 !important;
}

.ges-aktion-dialog__content p:has(+ h1),
.ges-aktion-dialog__content p:has(+ h2),
.ges-aktion-dialog__content p:has(+ h3) {
    margin-bottom: 0.25rem;
}


/* ------------------------------------------------------------
 * Handy-Anpassungen fürs Pop-up
 * ---------------------------------------------------------- */
@media (max-width: 781px) {

    .ges-aktion-dialog__content {
        padding: 3rem 1.25rem 1.75rem;
    }

    /* Kugeln kleiner, oben rechts neben dem ×. Kein breiter Freiraum
       rechts mehr – sonst bleibt für Text/Pillen/Liste zu wenig Platz. */
    /* Kugeln am rechten Rand, die Schnüre laufen hinter dem
       Schließen-Button durch */
    .christmas-deco,
    .christmas-deco--right {
        top: -25px;
        height: 175px;
        right: 1rem;
    }

    .ges-aktion-dialog.has-christmas {
        min-height: 0;
    }

    .ges-aktion-dialog.has-christmas .ges-aktion-dialog__content {
        padding-right: 3.25rem;
        padding-top: 1.75rem;
    }

    .ges-aktion-dialog__content h2 {
        font-size: 2.2rem;
        line-height: 1.15;
    }

    /* Abstandhalter aus dem Editor am Handy begrenzen */
    .ges-aktion-dialog__content .wp-block-spacer {
        max-height: 1.5rem;
    }

    /* Pillen etwas kompakter, damit mehrere in eine Zeile passen */
    .ges-aktion-dialog .job-category p,
    .ges-aktion-dialog .badges p {
        font-size: 0.78rem;
        padding: 0.45rem 0.9rem;
    }

    /* Liste mit Verlaufs-Strichen: kürzere Striche, weniger Einzug */
    .ges-aktion-dialog__content .wp-block-list {
        padding-left: calc(28px + 0.6rem);
        margin: 1rem 0;
    }

    .ges-aktion-dialog__content .wp-block-list li {
        font-size: 1rem;
        margin: 0.4rem 0;
    }

    .ges-aktion-dialog__content .wp-block-list li:before {
        width: 28px;
        height: 3px;
        left: calc(-28px - 0.6rem);
        margin-top: 0.6em;
    }
}

/* Schließen-Button liegt immer über den Kugeln */
.ges-aktion-dialog__close {
    z-index: 3;
}


/* ------------------------------------------------------------
 * Standortauswahl im Pop-up (bei Klick auf E-Mail/Telefon)
 * Kacheln mit Ort, Adresse und zwei Buttons "E-Mail" / "Anrufen".
 * Der zuvor angeklickte Typ ist gefüllt hervorgehoben.
 * ---------------------------------------------------------- */
.ges-aktion-dialog [hidden] {
    display: none !important;
}

.ges-aktion-dialog__content .ges-aktion-standorte__title {
    display: block;
    margin: 0 0 1.5rem !important;
    color: #775698;
    font-size: 1.6rem;
    line-height: 1.2;
    font-weight: 500;
}

.ges-aktion-standorte__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.ges-aktion-standort {
    padding: 1.1rem 1.2rem 1.15rem;
    border: 1.5px solid transparent;
    border-radius: 1rem;
    background: linear-gradient(white, white) padding-box,
        linear-gradient(135deg, #775698, #CF007F, #E63812) border-box;
}

.ges-aktion-standort__name {
    margin: 0 0 0.15rem;
    color: #CF007F;
    font-size: 1.05rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ges-aktion-standort__name span {
    margin-left: 0.35rem;
    color: #775698;
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.ges-aktion-standort__adresse {
    margin: 0 0 0.9rem;
    color: #8a8a89;
    font-size: 0.85rem;
}

.ges-aktion-standort__buttons {
    display: flex;
    gap: 0.5rem;
}

.ges-aktion-standort__btn {
    flex: 1 1 0;
    padding: 0.45rem 0.75rem;
    border: 1.5px solid transparent;
    border-radius: 50em;
    background: linear-gradient(white, white) padding-box,
        linear-gradient(135deg, #775698, #CF007F, #E63812) border-box;
    color: #CF007F;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-decoration: none;
    transition: transform 0.2s ease, color 0.2s ease;
}

/* Hervorheben, je nachdem ob E-Mail oder Telefon geklickt wurde
   (und beim Drüberfahren) */
.ges-aktion-standorte[data-mode="tel"] .is-tel,
.ges-aktion-standorte[data-mode="mail"] .is-mail,
.ges-aktion-standort__btn:hover,
.ges-aktion-standort__btn:focus-visible {
    background: linear-gradient(135deg, #775698, #CF007F, #E63812) border-box;
    color: #fff;
}

.ges-aktion-standort__btn:hover {
    transform: translateY(-1px);
}

.ges-aktion-standorte__back {
    margin-top: 1.25rem;
    padding: 0.25rem 0;
    border: none;
    background: none;
    color: #775698;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.ges-aktion-standorte__back:hover {
    color: #CF007F;
}

@media (max-width: 781px) {
    .ges-aktion-dialog__content .ges-aktion-standorte__title {
        font-size: 1.25rem;
        margin-bottom: 1rem !important;
    }

    .ges-aktion-standorte__grid {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }

    .ges-aktion-standort {
        padding: 0.9rem 1rem 0.95rem;
    }

    .ges-aktion-standort__adresse {
        margin-bottom: 0.7rem;
    }
}


/* ------------------------------------------------------------
 * Schließen-Button: X als SVG, damit es unabhängig von der
 * Schrift immer genau mittig im Kreis sitzt
 * ---------------------------------------------------------- */
.ges-aktion-dialog__close {
    padding: 0;
    margin: 0;
    font-size: 0;
    line-height: 0;
}

.ges-aktion-dialog__close svg {
    display: block;
    width: 42%;
    height: 42%;
    flex: none;
}


/* ------------------------------------------------------------
 * Fokus im Design: statt Browser-Standardrahmen ein Ring im
 * Magenta der Aktion mit weißem Abstand (nur bei Tastatur)
 * ---------------------------------------------------------- */
.ges-aktion__open:focus,
.ges-aktion-dialog button:focus,
.ges-aktion-dialog a:focus {
    outline: none;
}

.ges-aktion__open:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px #fff, 0 0 0 6px #CF007F, 0 16px 40px rgba(0, 0, 0, 0.28);
}

.ges-aktion-dialog__close:focus-visible,
.ges-aktion-standort__btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px #CF007F;
}

.ges-aktion-dialog__content a:focus-visible,
.ges-aktion-standorte__back:focus-visible {
    outline: 2px solid #CF007F;
    outline-offset: 3px;
    border-radius: 4px;
}


/* ------------------------------------------------------------
 * Keine automatische Silbentrennung im Pop-up (Safari am Handy
 * hat sonst z. B. "Privatkun-den" getrennt). Wörter brechen nur
 * zwischen den Wörtern um.
 * ---------------------------------------------------------- */
.ges-aktion-dialog,
.ges-aktion-dialog * {
    -webkit-hyphens: manual !important;
    hyphens: manual !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
}
