/* ==========================================================================
   Tutorial-Streifen am unteren Rand (#707)

   Das Feedback einer Nutzerin: zu viel Text. Statt des Banners oben mit
   Aufgabenliste, Belohnung und Schrittreihe steht hier unten eine Zeile —
   Symbol, „Tutorial", eine Aufgabe. In der App sitzt sie direkt ueber der
   Reiterleiste (sie liegt im `native-page-area`, der genau dort endet), im
   Browser schwebt sie ueber dem Seiteninhalt.

   Sie pulsiert leise, damit man sie sieht, ohne dass sie zappelt.
   ========================================================================== */

.quest-overlay {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 150;
    display: flex;
    justify-content: center;
    padding: 0 0.75rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
    pointer-events: none;
}

/* In der App endet die Seitenflaeche genau ueber der Reiterleiste — der
   Streifen haengt sich an deren Unterkante, statt eine Hoehe nachzurechnen,
   die sich mit jedem Geraet aendert. */
.native-app-layout .quest-overlay {
    position: absolute;
    padding-bottom: 0.75rem;
}

.quest-overlay__bar {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 40rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.75rem;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color);
    box-shadow: 0 0.5rem 1.25rem rgba(var(--app-black-rgb), 0.35);
    animation: quest-overlay-pulse 2.4s ease-in-out infinite;
    /* The slide down from the middle after a new step's introduction (#749). */
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1),
                max-width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Der Puls ist ein Ring in der Akzentfarbe, keine Groessenaenderung: eine
   Leiste, die atmet, schiebt den Seiteninhalt darunter nicht herum. */
@keyframes quest-overlay-pulse {
    0%, 100% {
        box-shadow: 0 0.5rem 1.25rem rgba(var(--app-black-rgb), 0.35),
                    0 0 0 0 rgba(var(--bs-info-rgb), 0.55);
    }
    50% {
        box-shadow: 0 0.5rem 1.25rem rgba(var(--app-black-rgb), 0.35),
                    0 0 0 0.5rem rgba(var(--bs-info-rgb), 0);
    }
}

.quest-overlay__icon {
    flex: 0 0 auto;
    font-size: 1.35rem;
    color: var(--bs-info);
}

.quest-overlay__text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    flex: 1 1 auto;
}

.quest-overlay__title {
    font-size: 0.65rem;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--bs-info-text-emphasis);
}

.quest-overlay__task {
    font-weight: 600;
    line-height: 1.2;
}

.quest-overlay__go,
.quest-overlay__claim {
    flex: 0 0 auto;
    white-space: nowrap;
}

.quest-overlay__collapse {
    flex: 0 0 auto;
}

/* Eingeklappt bleibt nur das Symbol stehen — klein, am Rand, und weiterhin
   pulsierend, damit der Weg zurueck sichtbar ist. */
.quest-overlay--collapsed {
    justify-content: flex-end;
}

.quest-overlay__expand {
    pointer-events: auto;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    font-size: 1.2rem;
    box-shadow: 0 0.35rem 0.9rem rgba(var(--app-black-rgb), 0.35);
    animation: quest-overlay-pulse 2.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    .quest-overlay__bar,
    .quest-overlay__expand {
        animation: none;
    }
}

/* A new step introduces itself (#749): the strip stands big in the middle of
   the screen for two seconds, then the class comes off and it slides down to
   its place and size. Moved with `transform` alone, so nothing around it is
   laid out again. */
.quest-overlay--intro .quest-overlay__bar {
    /* From the bottom edge to the middle: half the free height up, less half
       the strip's own. Scaled from its centre. */
    transform: translateY(calc(-50vh + 50% + 1.5rem)) scale(1.2);
    transform: translateY(calc(-50dvh + 50% + 1.5rem)) scale(1.2);
    /* Scaled up, a strip as wide as the phone would run off both sides: it is
       narrowed so that 1.2 times its width is still the screen's width. On a
       desktop the 40rem cap is the smaller value and nothing changes. */
    max-width: min(40rem, calc((100vw - 1.5rem) / 1.2));
}

@media (prefers-reduced-motion: reduce) {
    .quest-overlay__bar {
        transition: none;
    }

    .quest-overlay--intro .quest-overlay__bar {
        transform: none;
    }
}

/* The dashboard's tutorial card, opened in an overlay on every visit (#750).
   The overlay's own card is only the frame to centre it in: no surface, no
   border, no padding — what shows is the dark tutorial card itself. The card
   drops the edge-to-edge pull it has inside a page and gets the X in its
   corner. */
.quest-teaser-overlay {
    width: min(40rem, 100%);
    min-width: 0;
    background: none;
    border: 0;
    box-shadow: none;
    overflow: visible;
}

.quest-teaser-overlay .quest-strip {
    position: relative;
    /* Over the overlay body's padding — Bootstrap's spacer on a desktop, the
       overlay's own 1rem 1.5rem below 768px (overlay.css). */
    margin: calc(-1 * var(--bs-card-spacer-y)) calc(-1 * var(--bs-card-spacer-x));
    padding-right: 3rem;
    border-radius: var(--bs-card-border-radius);
}

@media screen and (max-width: 768px) {
    .quest-teaser-overlay .quest-strip {
        margin: -1rem -1.5rem;
    }
}

.quest-teaser__close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}
