/*
 * App-Rabatt-Abzeichen auf dem Bannerbild.
 *
 * Gehoert zu lib/features/app_rabatt_marke.php, gebaut nach dem Vorbild von
 * halal-marke.css. Die Lage steht hier und nicht am Element: Ein
 * style-Attribut waere ein Verstoss gegen die CSP und fiele auf einem Shop
 * mit strengem Kopfzeilensatz lautlos aus.
 *
 * Der umgebende Abschnitt bringt sein position: relative selbst mit
 * (.hero-slider-wrap, .cs-hero-section).
 *
 * 🔴 EIN UNTERSCHIED ZUR HALAL-MARKE: DIESES ZEICHEN IST ANKLICKBAR.
 *
 * Die Halal-Marke hat `pointer-events: none`, weil sie eine Aussage ist und
 * keinen Klick abfangen soll, der dem Banner gilt. Dieses Zeichen fuehrt auf
 * die Erklaerseite zum App-Rabatt - es MUSS Klicks annehmen.
 *
 * 🔴 FARBEN AUS DEM THEME, NICHT HARTCODIERT.
 *
 * --cta-background und --footer-background kommen aus
 * theme_farb_variablen() und stehen im <style>-Block der Seite. Die zweiten
 * Werte in var() sind Rueckfaelle fuer eine Instanz ohne diese Einstellung -
 * kein Entwurf, sondern eine Notbremse.
 */

.app-rabatt-marke {
    position: absolute;
    z-index: 11;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;

    /* Rund, wie die Halal-Marke - damit beide zusammen aussehen wie aus
       einem Haus, auch wenn sie in verschiedenen Ecken stehen. */
    width: 68px;
    height: 68px;
    border-radius: 9999px;
    box-sizing: border-box;
    padding: 6px;

    background: var(--cta-background, #f59e0b);
    color: #ffffff;
    text-decoration: none;
    text-align: center;
    line-height: 1.1;

    /* Auf hellen Bildern traegt die Flaeche allein nicht weit genug. */
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);

    /* 🔴 KEIN pointer-events: none - siehe Kopf. */
    user-select: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.app-rabatt-marke:hover,
.app-rabatt-marke:focus-visible {
    transform: scale(1.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    color: #ffffff;
}

/* Sichtbarer Fokus fuer die Tastatur - ein Verweis ohne erkennbaren Fokus
   ist fuer jeden unbrauchbar, der nicht mit der Maus arbeitet. */
.app-rabatt-marke:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 2px;
}

/* 🔴 Kein Umbruch: "bis zu 5 %" brach auf 68 px in zwei Zeilen, und die
   zweite war kaum lesbar. Auf dem Abzeichen steht der Satz, der volle
   Text liegt im title-Attribut. */
.app-rabatt-marke__wert,
.app-rabatt-marke__zusatz {
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-rabatt-marke__wert {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.app-rabatt-marke__zusatz {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.95;
}

.app-rabatt-marke--top-left {
    top: 16px;
    left: 16px;
}

.app-rabatt-marke--top-right {
    top: 16px;
    right: 16px;
}

.app-rabatt-marke--bottom-left {
    bottom: 16px;
    left: 16px;
}

.app-rabatt-marke--bottom-right {
    bottom: 16px;
    right: 16px;
}

/*
 * 🔴 Eine Reihe aus dem Weg.
 *
 * Steht in der gewaehlten Ecke schon etwas - die Halal-Marke, die
 * Pflichtangabe nach EU AI Act oder eine Angebots-Marke aus dem Bild -,
 * rueckt dieses Zeichen, und das Vorhandene bleibt, wo es ist. Die 100 px
 * sind die 68 px des Zeichens plus Abstand.
 */
.app-rabatt-marke--versetzt.app-rabatt-marke--top-left,
.app-rabatt-marke--versetzt.app-rabatt-marke--top-right {
    top: 100px;
}

.app-rabatt-marke--versetzt.app-rabatt-marke--bottom-left,
.app-rabatt-marke--versetzt.app-rabatt-marke--bottom-right {
    bottom: 100px;
}

/* Auf kleinen Geraeten ist das Banner niedriger - das Zeichen faellt mit. */
@media (max-width: 768px) {
    .app-rabatt-marke {
        width: 54px;
        height: 54px;
        padding: 4px;
    }

    .app-rabatt-marke__wert {
        font-size: 12px;
    }

    .app-rabatt-marke__zusatz {
        font-size: 7px;
    }

    .app-rabatt-marke--top-left,
    .app-rabatt-marke--top-right {
        top: 10px;
    }

    .app-rabatt-marke--bottom-left,
    .app-rabatt-marke--bottom-right {
        bottom: 10px;
    }

    .app-rabatt-marke--top-left,
    .app-rabatt-marke--bottom-left {
        left: 10px;
    }

    .app-rabatt-marke--top-right,
    .app-rabatt-marke--bottom-right {
        right: 10px;
    }

    .app-rabatt-marke--versetzt.app-rabatt-marke--top-left,
    .app-rabatt-marke--versetzt.app-rabatt-marke--top-right {
        top: 74px;
    }

    .app-rabatt-marke--versetzt.app-rabatt-marke--bottom-left,
    .app-rabatt-marke--versetzt.app-rabatt-marke--bottom-right {
        bottom: 74px;
    }
}

/* Wer Bewegung abbestellt hat, bekommt keine. */
@media (prefers-reduced-motion: reduce) {
    .app-rabatt-marke {
        transition: none;
    }

    .app-rabatt-marke:hover,
    .app-rabatt-marke:focus-visible {
        transform: none;
    }
}

/*
 * Vorschau im Verwaltungsbereich.
 *
 * 🔴 Dort steht das Zeichen in einer Kopfzeile, nicht auf einem Bild - ein
 * `position: absolute` riesse es aus dem Fluss und legte es in die Ecke des
 * Browserfensters. Der Betreiber soll es in Originalgroesse neben der
 * Ueberschrift sehen, so wie bei der Halal-Marke.
 */
.app-rabatt-marke--vorschau {
    position: static;
    cursor: default;
}

.app-rabatt-marke--vorschau:hover {
    transform: none;
}
