/* forum-image-enhance.css
 * Visual layer for forum-image-enhance.js — skeleton shimmer while loading,
 * smooth fade-in when ready, friendly fallback when broken. Touches only
 * post images (not avatars / stickers / emojis).
 */

/* Skeleton state — image hasn't decoded yet. We keep at least 80px of
 * vertical room to anchor surrounding content + show motion to the user. */
.post-content img.fie-skeleton,
.classic-post-content img.fie-skeleton {
    opacity: 0;
    min-height: 80px;
    background: linear-gradient(
        90deg,
        var(--surface-3, rgba(120, 120, 120, 0.10)) 0%,
        var(--surface-2, rgba(160, 160, 160, 0.18)) 50%,
        var(--surface-3, rgba(120, 120, 120, 0.10)) 100%
    );
    background-size: 200% 100%;
    animation: fie-shimmer 1.4s ease-in-out infinite;
    border-radius: 6px;
}

/* Loaded state — fade in smoothly so we never get a jarring pop. */
.post-content img.fie-loaded,
.classic-post-content img.fie-loaded {
    opacity: 1;
    animation: none;
    background: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

/* When the skeleton hands off to loaded, the first paint of the real image
 * benefits from a slight scale-up so it feels deliberate rather than abrupt. */
@media (prefers-reduced-motion: no-preference) {
    .post-content img.fie-skeleton,
    .classic-post-content img.fie-skeleton {
        transform: scale(0.98);
    }
    .post-content img.fie-loaded,
    .classic-post-content img.fie-loaded {
        transform: scale(1);
    }
}

@keyframes fie-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .post-content img.fie-skeleton,
    .classic-post-content img.fie-skeleton {
        animation: none;
        background-position: 0 0;
    }
    .post-content img.fie-loaded,
    .classic-post-content img.fie-loaded {
        transition: none;
    }
}

/* Broken-image fallback — replaces a failed <img> with a tiny inline chip
 * that stays out of the way but lets the user click through to the source.
 */
.post-content .fie-broken-fallback,
.classic-post-content .fie-broken-fallback {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.35em 0.75em;
    border-radius: 6px;
    background: var(--surface-2, rgba(160, 160, 160, 0.12));
    border: 1px dashed var(--hairline, rgba(160, 160, 160, 0.35));
    font-size: 0.85em;
    color: var(--text-muted, #888);
    line-height: 1.2;
    margin: 4px 2px;
    max-width: 100%;
}

.post-content .fie-broken-icon,
.classic-post-content .fie-broken-icon {
    font-size: 1.05em;
    line-height: 1;
}

.post-content .fie-broken-link,
.classic-post-content .fie-broken-link {
    color: inherit;
    text-decoration: underline;
    text-decoration-style: dotted;
}

.post-content .fie-broken-link:hover,
.classic-post-content .fie-broken-link:hover {
    color: var(--accent, #6366F1);
    text-decoration-style: solid;
}
