/**
 * post_card.css
 * BEM namespace: .post-card
 *
 * Renders a single idea card. Supports:
 *   - featured variant (animated conic-gradient hairline border)
 *   - alert variant (red-tinted gradient border + soft inner overlay)
 *   - inline GIF (preview)
 *   - inline structured media: chart / candles / poll / sparkline tiles /
 *     quote-repost / reply-thread / placeholder
 *   - sentiment chip in the header
 *   - engagement bar with like + bookmark toggle states
 */

.post-card {
    padding: 18px 20px 14px;
    border-radius: 20px;
    background: var(--surface);
    border: 1px solid var(--hairline);
    box-shadow: var(--shadow-soft);
    transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    position: relative;
}
.post-card:hover {
    transform: translateY(-2px);
    border-color: var(--hairline-2);
    box-shadow: var(--shadow-pop);
}

.post-card--featured {
    --ang: 0deg;
    border-color: transparent;
    background:
        linear-gradient(var(--surface), var(--surface)) padding-box,
        conic-gradient(from var(--ang),
            #6366f1 0%, #22d3ee 25%, #a855f7 50%, #22d3ee 75%, #6366f1 100%) border-box;
    animation: postCardSpin 12s linear infinite;
}
@keyframes postCardSpin { to { --ang: 360deg; } }

.post-card--alert {
    background:
        linear-gradient(var(--surface), var(--surface)) padding-box,
        linear-gradient(135deg, color-mix(in srgb, var(--red) 28%, transparent), transparent 60%) border-box;
    border: 1px solid transparent;
}
.post-card--alert::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, color-mix(in srgb, var(--red) 6%, transparent), transparent 50%);
    pointer-events: none;
}

/* ---------- Header ---------- */
.post-card__header {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
}

.post-card__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-family: 'Inter Tight', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: white;
    letter-spacing: -0.02em;
    user-select: none;
}

.post-card__meta { min-width: 0; }

.post-card__row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.post-card__name {
    font-family: 'Inter Tight', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    letter-spacing: -0.01em;
}

.post-card__verified {
    color: var(--iris);
    display: inline-flex;
}

.post-card__role {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--iris-tint);
    color: var(--iris);
}
.post-card__role--green { background: var(--green-tint); color: var(--green-2); }
.post-card__role--violet { background: color-mix(in srgb, var(--violet) 14%, transparent); color: var(--violet); }
.post-card__role--amber { background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber); }
.post-card__role--alert { background: var(--red-tint); color: var(--red); }

.post-card__handle { font-size: 13px; color: var(--text-2); }
.post-card__dot-sep { color: var(--text-3); }
.post-card__time { font-size: 13px; color: var(--text-3); }

.post-card__shimmer-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: linear-gradient(120deg,
        color-mix(in srgb, var(--iris) 14%, transparent) 0%,
        color-mix(in srgb, var(--cyan) 14%, transparent) 50%,
        color-mix(in srgb, var(--violet) 14%, transparent) 100%);
    background-size: 220% 100%;
    background-position: var(--shimmer-x, 0%) 0;
    color: var(--iris);
    font-family: 'Inter Tight', sans-serif;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    border: 1px solid color-mix(in srgb, var(--iris) 18%, transparent);
    animation: postCardShimmer 6s ease-in-out infinite;
    margin-top: 4px;
}
@keyframes postCardShimmer {
    0%, 100% { --shimmer-x: 0%; }
    50%      { --shimmer-x: 100%; }
}

.post-card__more {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
}
.post-card__more:hover {
    background: var(--surface-2);
    color: var(--text);
}

/* ---------- Body ---------- */
.post-card__body {
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    margin: 6px 0 12px;
    letter-spacing: -0.005em;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.post-card__ticker {
    display: inline-flex;
    align-items: center;
    font-family: 'Inter Tight', sans-serif;
    font-weight: 600;
    color: var(--iris);
    padding: 1px 7px;
    margin: 0 1px;
    background: var(--iris-tint);
    border-radius: 6px;
    font-size: 14px;
    letter-spacing: -0.01em;
    text-decoration: none;
    cursor: pointer;
}
.post-card__ticker--green { color: var(--green-2); background: var(--green-tint); }
.post-card__ticker--red { color: var(--red); background: var(--red-tint); }
.post-card__ticker--violet { color: var(--violet); background: color-mix(in srgb, var(--violet) 14%, transparent); }

.post-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 12px;
}

.post-card__ticker-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: 'Inter Tight', sans-serif;
    font-weight: 600;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--iris-tint);
    color: var(--iris);
    letter-spacing: -0.01em;
    text-decoration: none;
}
.post-card__ticker-chip--green { background: var(--green-tint); color: var(--green-2); }
.post-card__ticker-chip--violet { background: color-mix(in srgb, var(--violet) 14%, transparent); color: var(--violet); }
.post-card__ticker-chip--red { background: var(--red-tint); color: var(--red); }

/* ---------- GIF inline ---------- */
.post-card__gif {
    display: block;
    width: 100%;
    max-height: 320px;
    object-fit: cover;
    border-radius: 14px;
    margin: 10px 0 6px;
    background: var(--surface-2);
}

/* ---------- Media cards ---------- */
.post-card__media {
    margin: 10px 0 6px;
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--surface-2);
    border: 1px solid var(--hairline);
    position: relative;
    overflow: hidden;
}

.post-card__media-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.post-card__media-title {
    font-family: 'Inter Tight', sans-serif;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: -0.01em;
}
.post-card__media-change {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-feature-settings: "tnum";
}
.post-card__media-change--up { color: var(--green-2); }
.post-card__media-change--down { color: var(--red); }
.post-card__media-change--muted { color: var(--text-3); }

.post-card__media-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
}

.post-card__callout-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: linear-gradient(120deg, var(--iris-tint), color-mix(in srgb, var(--cyan) 12%, transparent));
    color: var(--iris);
    font-family: 'Inter Tight', sans-serif;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: -0.01em;
    border: 1px solid color-mix(in srgb, var(--iris) 18%, transparent);
    white-space: nowrap;
}

/* Poll */
.post-card__poll {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 6px 0 4px;
}
.post-card__poll-row {
    display: grid;
    grid-template-columns: 60px 1fr 50px;
    gap: 12px;
    align-items: center;
    font-size: 13px;
}
.post-card__poll-label { font-weight: 500; }
.post-card__poll-pct {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-2);
    text-align: right;
    font-feature-settings: "tnum";
}
.post-card__poll-bar {
    height: 8px;
    border-radius: 999px;
    background: var(--surface);
    overflow: hidden;
    border: 1px solid var(--hairline);
}
.post-card__poll-fill {
    height: 100%;
    border-radius: inherit;
    transition: width 1.2s cubic-bezier(.25,.8,.25,1);
}
.post-card__poll-row--bull .post-card__poll-fill {
    background: linear-gradient(90deg, var(--green), #4ade80);
}
.post-card__poll-row--bear .post-card__poll-fill {
    background: linear-gradient(90deg, var(--red), #fb7185);
}
.post-card__poll-row--hold .post-card__poll-fill {
    background: linear-gradient(90deg, var(--iris), var(--violet));
}
.post-card__poll-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-3);
    margin-top: 4px;
}

/* Quote-repost */
.post-card__quote {
    margin-top: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--hairline);
}
.post-card__quote-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}
.post-card__quote-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-family: 'Inter Tight', sans-serif;
    font-weight: 600;
    font-size: 11px;
    color: white;
}
.post-card__quote-name {
    font-family: 'Inter Tight', sans-serif;
    font-weight: 600;
}
.post-card__quote-body {
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
}

/* Sparkline tiles row */
.post-card__spark-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 10px;
}
.post-card__spark-tile {
    padding: 12px;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid var(--hairline);
}
.post-card__spark-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.post-card__spark-sym {
    font-family: 'Inter Tight', sans-serif;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: -0.01em;
}
.post-card__spark-ch {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-feature-settings: "tnum";
}
.post-card__spark-ch--up { color: var(--green-2); }
.post-card__spark-ch--down { color: var(--red); }
.post-card__spark-svg {
    display: block;
    width: 100%;
    height: 36px;
    margin-top: 4px;
}

/* Reply thread */
.post-card__reply-thread {
    margin-top: 12px;
    padding-left: 16px;
    border-left: 2px solid var(--hairline);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.post-card__reply {
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--surface-2);
    border: 1px solid var(--hairline);
}
.post-card__reply-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}
.post-card__reply-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-family: 'Inter Tight', sans-serif;
    font-weight: 600;
    font-size: 10px;
    color: white;
}
.post-card__reply-body {
    font-size: 14px;
    line-height: 1.5;
}
.post-card__typing {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 14px;
    background: var(--surface-2);
    border: 1px solid var(--hairline);
    font-size: 13px;
    color: var(--text-2);
    width: fit-content;
}
.post-card__typing-dots {
    display: inline-flex;
    gap: 3px;
}
.post-card__typing-dots i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--iris);
    animation: postCardTypingDot 1.2s ease-in-out infinite;
}
.post-card__typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.post-card__typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes postCardTypingDot {
    0%, 60%, 100% { transform: scale(0.6); opacity: 0.4; }
    30%           { transform: scale(1); opacity: 1; }
}

/* Media placeholder (video screenshot) */
.post-card__placeholder {
    margin-top: 12px;
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    height: 200px;
    background: linear-gradient(135deg, #6366f1 0%, #22d3ee 50%, #a855f7 100%);
    display: grid;
    place-items: center;
}
.post-card__placeholder::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 40%, rgba(255,255,255,0.18), transparent 50%),
                radial-gradient(circle at 70% 70%, rgba(0,0,0,0.18), transparent 50%);
}
.post-card__play-glyph {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    display: grid;
    place-items: center;
    position: relative;
    z-index: 1;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    cursor: pointer;
    border: none;
    transition: transform 0.2s;
}
.post-card__play-glyph:hover { transform: scale(1.06); }
.post-card__play-glyph svg { color: #6366f1; margin-left: 3px; }

/* ---------- Engagement bar ---------- */
.post-card__engage {
    display: grid;
    grid-template-columns: repeat(5, 1fr) auto;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--hairline);
    color: var(--text-2);
    font-size: 13px;
}
.post-card__engage-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    padding: 6px 4px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-feature-settings: "tnum";
    transition: color 0.15s, background 0.15s;
}
.post-card__engage-btn:hover {
    color: var(--iris);
    background: var(--iris-tint);
}
.post-card__engage-btn--like:hover {
    color: var(--red);
    background: var(--red-tint);
}
.post-card__engage-btn--like.is-on { color: var(--iris); }
.post-card__engage-btn--like.is-on svg { fill: var(--iris); }
.post-card__engage-btn--like.is-bouncing svg { animation: postCardHeartBounce 0.45s ease; }
@keyframes postCardHeartBounce {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.4); }
    70%  { transform: scale(0.9); }
    100% { transform: scale(1); }
}
.post-card__engage-btn--bookmark.is-on svg {
    fill: var(--iris);
    color: var(--iris);
    animation: postCardFoldDown 0.3s ease;
}
@keyframes postCardFoldDown {
    0%   { transform: translateY(-3px); }
    60%  { transform: translateY(2px); }
    100% { transform: translateY(0); }
}

@media (max-width: 768px) {
    .post-card { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .post-card,
    .post-card--featured,
    .post-card__shimmer-pill,
    .post-card__typing-dots i {
        animation: none !important;
    }
}
