/* retoor <retoor@molodetz.nl> */

.feed-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr) 280px;
    gap: 1.5rem;
    align-items: start;
}

.feed-main {
    min-width: 0;
}

.feed-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 1rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 0.25rem;
    border: 1px solid var(--border);
}

.feed-nav-btn,
.projects-tab,
.profile-tab {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.feed-nav-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.feed-nav-btn.active {
    background: var(--accent);
    color: var(--on-accent);
}

.feed-nav-actions {
    margin-left: auto;
    display: flex;
    gap: 0.25rem;
}

.feed-nav-actions button {
    color: var(--text-muted);
    padding: 0.375rem 0.5rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.feed-nav-actions button:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.feed-posts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-xl);
}

.post-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow);
}

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

.post-author-wrap {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.post-author {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.post-author-level {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-weight: 400;
}

.post-time {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-left: auto;
    padding-left: 0.75rem;
    white-space: nowrap;
    line-height: 1.5;
}

.post-topic {
    margin-bottom: 0.75rem;
}

.post-title-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.post-title-link:hover .post-title {
    color: var(--accent);
}

.post-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.post-content {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 1rem;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer;
}

.post-content:hover {
    color: var(--accent);
}

.post-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.post-action-btn {
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
}

.post-action-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-secondary);
}

.post-action-btn.vote-up:hover {
    color: var(--accent);
}

.post-action-btn.vote-down:hover {
    color: var(--danger);
}

.post-action-btn.vote-up.voted {
    color: var(--accent);
    font-weight: 700;
}

.post-action-btn.vote-down.voted {
    color: var(--danger);
    font-weight: 700;
}

.post-votes {
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
}

.post-vote-count {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    min-width: 1.25rem;
    text-align: center;
}

.post-action-btn.share {
    margin-left: auto;
}

.feed-right {
    position: sticky;
    top: calc(var(--nav-height) + 1rem);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.daily-topic-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
}

.daily-topic-label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
}

.daily-topic-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
}

.daily-topic-card h4 {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.daily-topic-card p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.daily-topic-card .topic-links {
    display: flex;
    gap: 0.75rem;
}

.daily-topic-card .topic-links a {
    font-size: 0.75rem;
    font-weight: 600;
}

.online-count {
    display: inline-block;
    min-width: 1.25rem;
    padding: 0 0.375rem;
    border-radius: 999px;
    background: var(--success);
    color: var(--white);
    font-size: 0.6875rem;
    text-align: center;
    vertical-align: middle;
}

.online-users-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.online-user {
    display: inline-flex;
    flex-shrink: 0;
}

.online-empty {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.community-stats {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
}

.community-stats h3 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.375rem 0;
    font-size: 0.8125rem;
}

.stat-row:not(:last-child) {
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.25rem;
    padding-bottom: 0.5rem;
}

.stat-row .label {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
}

.top-author-name {
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-row .value {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.feed-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 2rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    z-index: var(--z-fab);
    border: none;
    cursor: pointer;
}

.feed-fab:hover {
    color: var(--white);
    transform: scale(1.06);
    box-shadow: 0 10px 32px rgba(255, 95, 70, 0.6);
}

@media (max-width: 1024px) {
    .feed-layout {
        grid-template-columns: minmax(0, 1fr);
    }
    .feed-right {
        display: none;
    }
    .leaderboard-page {
        grid-template-columns: 1fr;
    }
    .leaderboard-page > aside {
        display: none;
    }
}

@media (max-width: 768px) {
    .feed-nav {
        gap: 0.125rem;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .feed-nav-btn {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    .feed-nav-actions {
        display: none;
    }

    .feed-nav-btn .icon {
        width: auto;
        margin-right: 0.125rem;
    }

    .post-card {
        padding: var(--space-lg);
    }

    .post-header {
        gap: 0.5rem;
    }

    .post-time {
        font-size: 0.625rem;
    }

    .post-title {
        font-size: 1rem;
    }

    .post-actions {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .post-action-btn {
        padding: 0.375rem 0.5rem;
        font-size: 0.75rem;
    }

    .feed-fab {
        bottom: calc(1rem + env(safe-area-inset-bottom));
        right: calc(1rem + env(safe-area-inset-right));
    }
}

@media (max-width: 360px) {
    .post-header {
        flex-wrap: wrap;
    }

    .post-time {
        margin-left: 0;
        padding-left: 0;
        width: 100%;
    }

    .feed-nav {
        gap: 0.125rem;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .feed-nav-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
        flex-shrink: 0;
    }
}

.leaderboard-page {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 1.5rem;
    align-items: start;
}

.leaderboard-page > aside {
    position: sticky;
    top: calc(var(--nav-height) + 1rem);
}

.leaderboard-main {
    min-width: 0;
}

.featured-news {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
}

.featured-news h3 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.featured-news-item {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.5rem 0;
}

.featured-news-item:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.featured-news-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.featured-news-meta {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.leaderboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.leaderboard-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.leaderboard-you {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-light);
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
}

.leaderboard-intro {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.leaderboard-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.leaderboard-row-self {
    border-color: var(--accent);
    background: var(--accent-light);
}

.leaderboard-rank {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--text-muted);
    min-width: 2.5rem;
}

.leaderboard-name {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-level {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.leaderboard-stars {
    font-weight: 700;
    color: var(--text-primary);
}

.leaderboard-star-icon {
    color: var(--accent);
}

.leaderboard-empty {
    list-style: none;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.post-card-comments {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.post-card-comments .rendered-content pre code {
    max-height: 14rem;
    overflow: hidden;
}

.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.topic-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.topic-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-sm);
}

.topic-card-count {
    font-size: 0.875rem;
    color: var(--text-muted);
}
