/* PerseedAction / PerseedUI - tap feedback, skeletons, toasts (pairs with js/v1/perseed-actions.js) */

/* ---------- Tap feedback ----------
   Only .is-pressed carries the transition so existing component transitions are untouched. */
.is-pressed {
    transform: scale(.94);
    transition: transform 120ms ease;
}
[aria-busy="true"].is-pressed,
button[aria-busy="true"] {
    cursor: progress;
}
[data-post-react]:focus-visible, [data-post-save]:focus-visible, [data-comment-react]:focus-visible,
#video-like-btn:focus-visible, #video-dislike-btn:focus-visible, #public-profile-follow-btn:focus-visible,
.g-btn:focus-visible, .challenge-join-btn:focus-visible {
    outline: 3px solid #176b45;
    outline-offset: 2px;
    border-radius: 8px;
}

/* ---------- Screen-reader only ---------- */
.ps-sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

/* ---------- Skeletons (same look as garden-groups .g-skel / gShimmer) ---------- */
.ps-skel {
    box-sizing: border-box;
    border-radius: 16px;
    border: 1px solid #eef2f7;
    background: #fff;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}
.ps-skel--block,
.ps-skel__bone {
    background: linear-gradient(90deg, #eef2f7 25%, #f6f8fb 37%, #eef2f7 63%);
    background-size: 400% 100%;
    animation: psShimmer 1.25s ease infinite;
}
.ps-skel--block { min-height: 160px; padding: 0; }
.ps-skel__bone { border-radius: 8px; }
.ps-skel__media { width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; }
.ps-skel__media--tall { aspect-ratio: 4 / 5; }
.ps-skel__line { height: 12px; width: 100%; }
.ps-skel__line--short { width: 55%; }
.ps-skel__avatar { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 999px; }
.ps-skel__head { display: flex; align-items: center; gap: 10px; }
.ps-skel__head .ps-skel__line { flex: 1; }
.ps-skel--row {
    flex-direction: row;
    align-items: center;
    border-radius: 0;
    border-width: 0 0 1px 0;
    padding: 12px 14px;
}
.ps-skel__lines { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ps-skel--post { min-height: 320px; }
@keyframes psShimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------- Toasts ---------- */
.ps-toast-region {
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 84px);
    transform: translateX(-50%);
    z-index: 2147483647;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: min(92vw, 420px);
    pointer-events: none;
}
.ps-toast {
    pointer-events: auto;
    max-width: 100%;
    padding: 10px 14px;
    border-radius: 12px;
    background: #0f172a;
    color: #fff;
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .18);
    opacity: 1;
    transform: translateY(0);
    transition: opacity .25s ease, transform .25s ease;
    animation: psToastIn .2s ease;
}
.ps-toast--success { background: #176b45; }
.ps-toast--error { background: #b91c1c; }
.ps-toast--offline { background: #334155; }
.ps-toast.is-leaving { opacity: 0; transform: translateY(6px); }
@keyframes psToastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .is-pressed { transform: none; transition: none; }
    .ps-skel--block, .ps-skel__bone { animation: none; background: #eef2f7; }
    .ps-toast { animation: none; transition: none; }
    .ps-toast.is-leaving { transform: none; }
}
