/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-dark: #0a0a0a;
    --bg-card: #1a1a1a;
    --bg-card-hover: #222;
    --text-primary: #f0f0f0;
    --text-secondary: #999;
    --accent: #e63946;
    --accent-glow: rgba(230, 57, 70, 0.3);
    --truth-blue: #6a5acd;
    --border: #333;
    --max-width: 720px;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Header === */
header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-bottom: 3px solid var(--accent);
    padding: 2rem 1rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.header-content h1 .question-mark {
    color: var(--accent);
    font-size: 3rem;
}

.tagline {
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* === Main Feed === */
main {
    flex: 1;
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* === Loading State === */
.loading {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === Post Card === */
.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover {
    border-color: var(--truth-blue);
    box-shadow: 0 4px 24px rgba(106, 90, 205, 0.15);
}

.post-card a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.post-card .post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.post-meta .post-date {
    color: var(--text-secondary);
}

.post-meta .post-badge {
    background: var(--truth-blue);
    color: #fff;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* === Truth Social Post Body (mimics post screenshot) === */
.truth-post-body {
    padding: 1.25rem 1rem;
    background: #15202b;
    border-left: 3px solid var(--truth-blue);
}

.truth-post-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.truth-avatar-img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-right: 0.75rem;
    background: var(--border);
}

.truth-author {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.truth-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.truth-verified {
    flex-shrink: 0;
}

.truth-handle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.truth-content {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--text-primary);
    word-wrap: break-word;
    margin-bottom: 0.75rem;
}

.truth-content p {
    margin-bottom: 0.5rem;
}

.truth-content a {
    color: var(--truth-blue);
    text-decoration: underline;
}

/* === Media in posts === */
.truth-media {
    margin-bottom: 0.75rem;
    border-radius: 8px;
    overflow: hidden;
}

.truth-media-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.truth-media-video {
    position: relative;
}

.truth-play-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* === Engagement stats === */
.truth-stats {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.truth-stat {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.truth-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* === Last updated bar === */
.last-updated {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.post-card .post-footer {
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
}

.post-footer .view-on-truth {
    color: var(--truth-blue);
    font-weight: 600;
    transition: color 0.2s;
}

.post-card:hover .view-on-truth {
    color: #8b7ff0;
}

/* === New Post Indicator === */
.post-card.is-new .post-meta::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    margin-right: 0.5rem;
    box-shadow: 0 0 8px var(--accent-glow);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* === No Posts === */
.no-posts {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* === Footer === */
footer {
    text-align: center;
    padding: 2rem 1rem;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.8rem;
}

footer .disclaimer {
    margin-top: 0.5rem;
    font-style: italic;
    font-size: 0.75rem;
    color: #666;
}

footer .attribution {
    margin-top: 0.5rem;
    font-size: 0.8rem;
}

footer .attribution a {
    color: var(--truth-blue);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

footer .attribution a:hover {
    color: #8b7ff0;
}

/* === Responsive === */
@media (max-width: 600px) {
    .header-content h1 {
        font-size: 1.75rem;
    }

    .header-content h1 .question-mark {
        font-size: 2.1rem;
    }

    .tagline {
        font-size: 0.8rem;
    }

    main {
        padding: 1rem 0.5rem;
    }

    .post-card .post-meta,
    .post-card .post-footer {
        padding: 0.6rem 0.75rem;
    }
}
