/*
 * PWA Install Prompt — component styles
 * Two variants: "inline" (compact hint) and "card" (detailed card)
 *
 * Usage:
 *   {% include "core/includes/_pwa_install.html" with variant="inline" %}
 *   {% include "core/includes/_pwa_install.html" with variant="card" %}
 */


/* ─────────────────────────────────────
   Shared
   ───────────────────────────────────── */
.pwa-install-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.9rem;
    border: none;
    border-radius: 999px;
    background: var(--primary);
    color: var(--text-inverse);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-fast);
    white-space: nowrap;
}

.pwa-install-btn:hover {
    background: var(--primary-dark);
}

.pwa-install-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.pwa-install-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}


/* ─────────────────────────────────────
   Inline variant — compact one-liner
   ───────────────────────────────────── */
.pwa-install-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    margin-top: 1rem;
    background: var(--primary-light);
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.pwa-install-inline svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.pwa-install-inline-text {
    flex: 1;
    min-width: 0;
}

.pwa-install-inline .pwa-install-btn {
    font-size: 0.75rem;
    padding: 0.3rem 0.7rem;
}

.pwa-install-dismiss {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
    transition: background var(--transition-fast), color var(--transition-fast);
    padding: 0;
}

.pwa-install-dismiss:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-color);
}

.pwa-install-dismiss:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Ensure the hidden attribute works despite display: flex on the component.
 *
 * ⛔ **AND THE BUTTON NEEDS IT TOO — IT WAS MISSED RIGHT NEXT TO THIS LINE.**
 * `.pwa-install-btn` carries `display: inline-flex` twenty lines above, so the
 * `hidden` it ships with in the template and the `btn.hidden = true`
 * `pwa-install.js` sets when no `beforeinstallprompt` ever arrives both did
 * nothing. On every browser that does not fire that event — all iOS Safari,
 * desktop Safari, Firefox — `/help/everything-else/` drew a filled *Install
 * Pensio* button that returns on the first line of `triggerInstall()`, sitting
 * directly above the card's own *"Tap the Share button (⎙) → Add to Home
 * Screen"* steps. A live-looking primary action above the instructions for
 * doing it by hand.
 *
 * ⚠️ The wrappers were guarded and the button was not, which is why the
 * component reads as correct: dismissing works, the manual steps appear, and
 * the only broken part is the one piece nobody could click.
 * 📐 Same trap, same fix as `.btn[hidden]` (components/buttons.css) and
 * `.jump__row[hidden]` (components/jump.css), which is what found this.
 * 🧪 tests/browser/test_the_install_button_is_not_a_decoration.py
 */
.pwa-install-inline[hidden],
.pwa-install-card[hidden],
.pwa-install-btn[hidden] {
    display: none;
}

/* Manual instructions (inline) — small muted text below */
.pwa-install-inline .pwa-install-manual {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}


/* ─────────────────────────────────────
   Card variant — richer detail block

   ⭐ **IT IS ONE ITEM, SO IT IS A CARD** (Design 2.0 grammar, 2026-09-05 —
   *the card goes on the item*). The template composes `.card-surface`; the box
   — white, hairline, 20px radius, 20px padding, no resting shadow — comes from
   `components/cards.css` and is NOT restated here.
   ⛔ It used to be a `--primary-light` slab with a 10px radius and a 3px left
   accent, which is a fourth surface, and the one page it renders on sits it
   beside 704px list surfaces. `.card-stack` is what bounds it now; only the
   inside of the card is this component's own.
   ───────────────────────────────────── */

.pwa-install-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-2xs);
    font-family: var(--font-heading);
    font-size: var(--text-base);
    font-weight: 600;
    line-height: 1.35;
    color: var(--text-color);
}

.pwa-install-card-header svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.pwa-install-card-body {
    font-size: var(--text-base-sm);
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-md);
}

.pwa-install-card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.pwa-install-card .pwa-install-manual {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.pwa-install-card .pwa-install-manual strong {
    color: var(--text-secondary);
    font-weight: 600;
}

/* Platform instruction blocks */
.pwa-install-manual-steps {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.pwa-install-manual-steps li {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.pwa-install-manual-steps .step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--text-inverse);
    font-size: 0.65rem;
    font-weight: 600;
    flex-shrink: 0;
}


/* ─────────────────────────────────────
   Responsive
   ───────────────────────────────────── */
@media (max-width: 480px) {
    .pwa-install-inline {
        gap: 0.35rem;
        padding: 0.5rem 0.65rem;
    }

    .pwa-install-inline-text {
        font-size: 0.75rem;
    }

    .pwa-install-inline .pwa-install-btn {
        font-size: 0.7rem;
        padding: 0.25rem 0.55rem;
        white-space: nowrap;
    }
}