/* ==============================================
   SCROLL-TOP BUTTON (Neo-Brutalism)
   Mitlaufender "Nach oben"-Pfeil, unten links —
   spiegelt die FAB-Position (fabs.css) auf der
   freien Seite. Erzeugt von scroll_top.js.
   ============================================== */

.scroll-top-btn {
    position: fixed;
    bottom: 115px;
    /* Mobile: über Bottom-Nav / Gast-Leiste, wie .fab-speed-dial-container */
    left: 1.5rem;
    /* Über der Gast-Leiste (z-index 1000), damit der Button auf gleicher
       Höhe wie der FAB rechts sichtbar bleibt — aber unter dem
       FAB-Overlay (9990), das bei offenem Speed-Dial alles abdunkelt. */
    z-index: 1001;

    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;

    background: var(--bg-card);
    color: var(--color-ink);
    border: 2px solid var(--color-ink);
    box-shadow: 4px 4px 0 var(--color-ink);
    border-radius: 0;
    cursor: pointer;
    font-size: 1.5rem;

    /* Versteckt, bis gescrollt wurde */
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.scroll-top-btn.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Press-Muster wie .btn */
.scroll-top-btn:hover,
.scroll-top-btn:active {
    background: var(--color-yellow);
    color: var(--color-text-on-yellow);
    transform: translate(2px, 2px);
    box-shadow: none;
}

.scroll-top-btn:focus-visible {
    outline: 3px solid var(--color-yellow);
    outline-offset: 2px;
}

/* Auf gleicher Mittelachse wie der schwebende Knopf rechts.
   Der ist je nach Anmeldestatus ein anderer, deshalb zwei Fälle:
   - Gäste:      KIM-Teaser-Blase, 56px, bottom 90px  → Mitte 118px
   - Eingeloggt: FAB, 64px, bottom 115px bzw. 2rem    → Mitte 147px bzw. 64px
   Der Hoch-Button ist 48px hoch, sein bottom also jeweils Mitte minus 24px.
   Unter 768px hat die rechte Seite keinen Knopf — dort bleibt es beim
   Basiswert über Bottom-Nav und Gast-Leiste. */
@media (min-width: 768px) {
    body:has(.kim-teaser-bubble) .scroll-top-btn {
        bottom: 94px;
    }

    body:has(.fab-speed-dial-container) .scroll-top-btn {
        bottom: 123px;
    }
}

@media (min-width: 900px) {
    .scroll-top-btn {
        left: 3rem;
    }

    body:has(.fab-speed-dial-container) .scroll-top-btn {
        bottom: 40px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .scroll-top-btn {
        transition: none;
    }
}
