/* ============================================
   Posts Page - Minimalist Feed Style
   ============================================ */

:root {
    --posts-max-width: 720px;
    --posts-card-bg: var(--card-bg);
    --posts-card-hover: var(--card-hover);
    --posts-spacing: 2rem;
    --posts-gap: 3rem;
    --header-height: 7rem;
    --filter-bar-height: 70px;
    --total-header-height: 140px;
}

/* Reset body padding for posts page */
body {
    padding-top: 80px;
    overflow-x: hidden;
    line-height: 1.7;
}

/* ============================================
   GitHub-Style Header
   ============================================ */

.posts-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    
    border-bottom: 2px solid var(--border-color);
    z-index: 1000;
    height: var(--header-height);
}

.posts-header-container {
    max-width: var(--posts-max-width);
    margin: 0 auto;
    padding: 0 2rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

/* Left section with logo and title */
.posts-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.posts-logo {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
}

.posts-divider {
    color: var(--text-muted);
    font-size: 1.5rem;
    font-weight: 300;
}

.posts-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* Center section - sticky post title */
.posts-header-center {
    flex: 1;
    max-width: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sticky-post-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    opacity: 0;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

header{
    margin-top: 0;
}

.sticky-post-title.visible {
    opacity: 1;
}

/* Academic fade/morph animation for title changes - subtle and professional */
.sticky-post-title.flip-out {
    animation: fadeOutMorph 0.15s ease-out forwards;
}

.sticky-post-title.flip-in {
    animation: fadeInMorph 0.15s ease-in forwards;
}

@keyframes fadeOutMorph {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0px);
    }
    100% {
        opacity: 0;
        transform: scale(0.98) translateY(-3px);
        filter: blur(2px);
    }
}

@keyframes fadeInMorph {
    0% {
        opacity: 0;
        transform: scale(0.98) translateY(3px);
        filter: blur(2px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0px);
    }
}

.posts-search-container {
    position: relative;
    width: 100%;
    display: none;
}

.posts-search-container i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
}

.posts-search-container input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.75rem;
    background: var(--background-alt);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.posts-search-container input:focus {
    outline: none;
    background: var(--card-bg);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 136, 255, 0.1);
}

.posts-search-container input::placeholder {
    color: var(--text-muted);
}

/* Right section with buttons */
.posts-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.posts-home-btn {
    padding: 0.5rem 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--accent-primary);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.posts-home-btn:hover {
    background: var(--background-alt);
    border-color: var(--accent-primary);
}

.posts-theme-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.posts-theme-btn:hover {
    background: var(--background-alt);
    border-color: var(--text-muted);
}

/* ============================================
   Filter Bar Below Header
   ============================================ */

.posts-filter-bar {
   
  
    left: 0;
    right: 0;
    background: var(--background);
    border-bottom: 1px solid var(--border-color);
    z-index: 1001;
    height: var(--filter-bar-height);
    overflow-x: auto;
    overflow-y: hidden;
    /* Hide scrollbar but keep scroll functionality */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.posts-filter-bar::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.posts-filter-container {
    max-width: var(--posts-max-width);
    margin: 0 auto;
    padding: 0 2rem;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.filter-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.filter-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}

.filter-btn {
    padding: 0.4rem 1rem;
    background: var(--background-alt);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-btn:hover {
    background: var(--card-bg);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.popular-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.tag-filter {
    padding: 0.4rem 0.85rem;
    background: var(--background-alt);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-decoration: none;
}

.tag-filter:hover {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
    color: white;
}

.tag-filter.active {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
    color: white;
}

/* ============================================
   Posts Grid Container - Fixed Position Aware
   ============================================ */

.posts-container {
    max-width: var(--posts-max-width);
    margin: 0 auto;
    padding: var(--posts-spacing);
    min-height: calc(100vh - var(--total-header-height));
    margin-top: var(--total-header-height);
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--posts-gap);
    margin-bottom: 3rem;
}

/* ============================================
   Post Card Component - Enhanced Design
   ============================================ */

.post-card {
    background: var(--posts-card-bg);
    border: 2px solid var(--text-primary);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.post-card-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background: linear-gradient(135deg, 
        var(--accent-primary) 0%, 
        var(--accent-secondary) 100%);
}

.post-card-content {
    padding: 1.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.post-card-date {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.post-card-category {
    padding: 0.35rem 0.85rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.post-card-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 1rem;
    color: var(--text-primary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-excerpt {
    font-size: 0.98rem;
    color: var(--text-muted);
    line-height: 1.65;
    margin: 0 0 1.25rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
    margin-bottom: 1rem;
}

.post-tag {
    padding: 0.35rem 0.85rem;
    background: var(--background-alt);
    color: var(--text-muted);
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}



.post-card-read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent-primary);
    font-weight: 700;
    font-size: 0.95rem;
    margin-top: auto;
    transition: gap 0.3s ease;
}



/* ============================================
   Loading & Empty States
   ============================================ */

.posts-loading,
.posts-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 5rem 2rem;
    color: var(--text-muted);
}

.posts-loading i,
.posts-empty i {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.3;
    color: var(--text-primary);
}

.posts-empty h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.posts-empty p {
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}

.posts-loading i {
    animation: spin 2s linear infinite;
    opacity: 0.5;
}

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

.hidden {
    display: none !important;
}

/* ============================================
   Disclaimer
   ============================================ */

.posts-disclaimer {
    max-width: var(--posts-max-width);
    margin: 0 auto;
    padding: 0 var(--posts-spacing);
    margin-top: 3rem;
    margin-bottom: 2rem;
}

.posts-disclaimer p {
    padding: 1.25rem;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.posts-disclaimer strong {
    color: var(--text-primary);
    font-weight: 600;
}

.posts-disclaimer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
}

.posts-disclaimer a:hover {
    text-decoration: underline;
}

/* ============================================
   Footer
   ============================================ */

.posts-footer {
    text-align: center;
    padding: 2.5rem 2rem;
    border-top: 2px solid var(--border-color);
    background: var(--background-alt);
    margin-top: 4rem;
}

.posts-footer p {
    margin: 0 0 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--accent-primary);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .posts-header-container {
        padding: 0 1.5rem;
        gap: 1rem;
        flex-wrap: wrap;
        height: auto;
        
    }

    .posts-header-left {
        order: 1;
    }

    .posts-header-right {
        order: 2;
        margin-left: auto;
    }

    .posts-header-center {
        order: 3;
        width: 100%;
        max-width: 100%;
        margin-top: 0.5rem;
        padding-bottom: 0.75rem;
    }

    .sticky-post-title {
        font-size: 0.9rem;
    }

    .posts-search-container input {
        font-size: 0.9rem;
        padding: 0.5rem 1rem 0.5rem 2.5rem;
    }

    .posts-home-btn {
        padding: 0.45rem 1rem;
        font-size: 0.9rem;
    }

    .posts-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .posts-container {
        padding: 1.5rem;
        margin-top: calc(var(--header-height) + 50px);
    }

    .post-card-content {
        padding: 1.5rem;
    }

    .post-card-title {
        font-size: 1.35rem;
    }
}

@media (max-width: 480px) {
    .posts-header-container {
        padding: 0 1rem;
        gap: 0.5rem;
    }

    .posts-header-center {
        margin-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .sticky-post-title {
        font-size: 0.85rem;
    }

    .posts-logo {
        width: 28px;
        height: 28px;
    }

    .posts-divider {
        font-size: 1.25rem;
    }

    .posts-title {
        font-size: 1.1rem;
    }



    .posts-home-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .posts-theme-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .post-card-content {
        padding: 1.25rem;
    }

    .post-card-title {
        font-size: 1.25rem;
    }

    .post-card-image {
        height: 180px;
    }
}

/* ============================================
   Timeline Ribbon Post Style
   ============================================ */

.timeline-post {
    grid-column: 1 / -1;
    background: var(--posts-card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin: 2rem 0;
    position: relative;
    transition: all 0.3s ease;
}

.timeline-post::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899);
    z-index: 1;
}

.timeline-post:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
    border-color: #6366f1;
}

.timeline-ribbon {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1.5rem 2rem;
    position: relative;
}

.timeline-year {
    flex-shrink: 0;
    font-size: 3rem;
    font-weight: 900;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    letter-spacing: -0.02em;
    opacity: 0.9;
}

.timeline-divider {
    width: 2px;
    height: 60px;
    background: linear-gradient(180deg, transparent, var(--border-color), transparent);
    flex-shrink: 0;
}

.timeline-image {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.timeline-post:hover .timeline-image {
    border-color: #6366f1;
    transform: scale(1.05);
}

.timeline-content {
    flex: 1;
    min-width: 0;
}

.timeline-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.timeline-title i {
    font-size: 1.25rem;
    color: #6366f1;
}

.timeline-description {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

.timeline-link {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.timeline-link:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.timeline-link i {
    font-size: 1.1rem;
}

@media (max-width: 968px) {
    .timeline-ribbon {
        flex-wrap: wrap;
        gap: 1.5rem;
    }

    .timeline-year {
        font-size: 2.5rem;
    }

    .timeline-divider {
        display: none;
    }
}

@media (max-width: 768px) {
    .timeline-ribbon {
        flex-direction: column;
        align-items: flex-start;
        padding: 1.5rem;
    }

    .timeline-year {
        font-size: 2rem;
    }

    .timeline-image {
        width: 100%;
        height: 140px;
    }

    .timeline-link {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   Minimalist Posts Feed - Center Aligned
   ============================================ */

.posts-container {
    min-height: calc(100vh - var(--header-height) - 100px);
    padding: 4rem 2rem;
    max-width: var(--posts-max-width);
    margin: 0 auto;
}

.posts-feed {
    display: flex;
    flex-direction: column;
    gap: var(--posts-gap);
    align-items: center;
}

/* Post Card */
.post-card {
    width: 100%;
    max-width: 680px;
    background: var(--card-bg);
    border: 2px solid var(--text-primary);
    border-radius: 8px;
    padding: 2.5rem;
}

/* Post Header */
.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.post-date {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
}

.post-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.post-tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    background: var(--background-alt);
    color: var(--text-secondary);
    border-radius: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Post Title */
.post-title {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 1.5rem 0;
    color: var(--text-primary);
}

/* Post Content */
.post-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.post-content p {
    margin: 0 0 1.25rem 0;
    text-align: justify;
}

.post-content p:last-child {
    margin-bottom: 0;
}

/* Post Images */
.post-image {
    margin: 2rem 0;
    border-radius: 6px;
    overflow: hidden;
}

.post-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
}

.post-images-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.post-images-grid img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    object-fit: cover;
}

/* Post Quote */
.post-quote {
    margin: 2rem 0;
    padding: 1.5rem;
    border-left: 4px solid var(--accent-primary);
    background: var(--background-alt);
    font-style: italic;
    color: var(--text-secondary);
    border-radius: 0 6px 6px 0;
}

/* Responsive */
@media (max-width: 768px) {
    .posts-container {
        padding: 2rem 1rem;
    }

    .post-card {
        padding: 1.5rem;
    }

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

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

    .post-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .post-images-grid {
        grid-template-columns: 1fr;
    }
}

/* Disclaimer */
.posts-disclaimer {
    width: 100%;
    max-width: 680px;
    margin: 3rem auto 2rem;
    padding: 1.5rem;
    background: var(--background-alt);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-align: center;
}

.posts-disclaimer p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.posts-disclaimer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
}

.posts-disclaimer a:hover {
    text-decoration: underline;
}



