:root {
    --bg-primary: #000000;
    --bg-secondary: #16181c;
    --bg-tertiary: #202327;
    --accent: #1d9bf0;
    --accent-hover: #1a8cd8;
    --text-primary: #e7e9ea;
    --text-secondary: #71767b;
    --border: #2f3336;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font);
    line-height: 1.5;
}

/* --- Three-column layout --- */

.layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 600px) 350px;
    justify-content: center;
    min-height: 100vh;
}

/* --- Left sidebar --- */

.left-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 16px 12px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 12px;
}

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 18px;
}

.brand-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    border-radius: 9999px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 18px;
    font-weight: 400;
    transition: background-color 0.2s;
}

.nav-link:hover {
    background-color: var(--bg-tertiary);
}

.nav-link.active {
    font-weight: 700;
}

.nav-link svg {
    flex-shrink: 0;
}

.nav-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section-title {
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Centre feed column --- */

.feed-column {
    border-right: 1px solid var(--border);
    min-height: 100vh;
}

.feed-header {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 16px;
    background-color: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.feed-title {
    font-size: 20px;
    font-weight: 700;
}

/* --- Pill tabs --- */

.pill-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.pill {
    padding: 6px 16px;
    border: none;
    border-radius: 9999px;
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s, color 0.2s;
}

.pill:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.pill.active {
    background-color: var(--accent);
    color: #fff;
}

/* --- Post / article items --- */

.post {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

.post:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.post-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    min-width: 0;
}

.post-feed-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.post-dot {
    color: var(--text-secondary);
    font-size: 13px;
}

.post-time {
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
}

.post-title {
    margin-bottom: 6px;
}

.post-title a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}

.post-title a:hover {
    text-decoration: underline;
}

.post-content {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.post-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.classification-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
    color: #fff;
}

.classification-badge[data-classification="technical"] {
    background-color: #1d4ed8;
}

.classification-badge[data-classification="opinion"] {
    background-color: #7c3aed;
}

.classification-badge[data-classification="news"] {
    background-color: #dc2626;
}

.classification-badge[data-classification="tutorial"] {
    background-color: #059669;
}

.classification-badge[data-classification="unclassified"] {
    background-color: #4b5563;
}

.post-tag {
    color: var(--accent);
    font-size: 13px;
    cursor: pointer;
}

.post-tag:hover {
    text-decoration: underline;
}

/* --- Right sidebar --- */

.right-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.search-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid var(--border);
    border-radius: 9999px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

/* --- Trending panel --- */

.trending-panel {
    background-color: var(--bg-secondary);
    border-radius: 16px;
    padding: 16px;
}

.trending-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
}

.trending-tag {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 4px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background-color 0.15s;
    border-radius: 4px;
}

.trending-tag:last-child {
    border-bottom: none;
}

.trending-tag:hover {
    background-color: var(--bg-tertiary);
}

.trending-tag.active {
    background-color: var(--bg-tertiary);
}

.trending-tag-name {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}

.trending-tag-count {
    color: var(--text-secondary);
    font-size: 13px;
}

/* --- Loading spinner --- */

.scroll-sentinel {
    padding: 20px;
    display: flex;
    justify-content: center;
}

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

.spinner.hidden {
    display: none;
}

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

/* --- Fade in animation --- */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Responsive --- */

@media (max-width: 1024px) {
    .layout {
        grid-template-columns: 220px minmax(0, 1fr);
    }

    .right-sidebar {
        display: none;
    }

    .feed-column {
        border-right: none;
    }
}

@media (max-width: 768px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .left-sidebar {
        position: fixed;
        bottom: 0;
        top: auto;
        left: 0;
        right: 0;
        height: auto;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        padding: 8px;
        border-right: none;
        border-top: 1px solid var(--border);
        background-color: var(--bg-primary);
        z-index: 100;
        gap: 8px;
    }

    .brand {
        display: none;
    }

    .nav-links {
        flex-direction: row;
        gap: 8px;
    }

    .nav-link {
        padding: 10px;
        font-size: 14px;
        gap: 8px;
    }

    .nav-link span {
        display: none;
    }

    .feed-column {
        padding-bottom: 60px;
    }
}
