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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #ffffff;
    color: #333;
    line-height: 1.6;
}

/* Header */
.header {
    background-color: #F8FAFC; /* Figma Fill */
    padding: 1rem 2rem;
    border-bottom: 1px solid #CBD5E1; /* Figma Stroke */
    box-shadow: none; /* Remove shadow to match design */
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: none; /* remove colored background for blog logo */
    color: inherit;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.favourite-info {
    flex: 1;
    padding-left: 0.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.nav-link {
    color: #666;
    text-decoration: none;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.3s;
}

.nav-link:hover {
    color: #4a90e2;
}

.nav-link i {
    font-size: 0.9rem;
}

/* Hero Section */
.hero {
    background-color: #ffffff; /* fallback */
    background: radial-gradient(circle at center, #E0EEFF 0%, #FFFFFF 100%);
    padding: 4rem 2rem;
    text-align: center;
}

.hero-container {
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 700;
    color: #4a90e2; /* fallback for browsers without background-clip support */
    background: linear-gradient(0deg, #99B6FF -17.91%, #195BFF 56.72%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 2rem;
}

.search-bar {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
}

.search-bar > i {
    position: absolute;
    left: 1.5rem;
    color: #999;
    font-size: 1.1rem;
}

.search-input {
    width: 100%;
    padding: 1rem 5rem 1rem 3.5rem; /* right padding for cancel + submit buttons */
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.search-input:focus {
    border-color: #4a90e2;
}

/* Search submit button inside hero search bar */
.search-bar .search-submit {
    position: absolute;
    right: 1.5rem;
    background: transparent;
    border: none;
    color: #999;
    font-size: 1.1rem;
    cursor: pointer;
}
.search-bar .search-submit:hover {
    color: #4a90e2;
}

/* Cancel button inside hero search bar */
.search-bar .search-cancel {
    position: absolute;
    right: 3.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
}
.search-bar .search-cancel:hover {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.08);
}

/* Prevent generic icon positioning from affecting cancel/submit icons */
.search-bar .search-cancel i,
.search-bar .search-submit i {
    position: static;
    left: auto;
}

/* Main Wrapper */
/* Visibility utilities */
.mobile-only { display: none !important; }
.desktop-only { display: block; }

.main-wrapper {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
}

/* Sidebar */
.sidebar {
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.sidebar-section {
    margin-bottom: 2.5rem;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-title {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
}

.sidebar-title i {
    color: #4a90e2;
}

.sidebar-title .fa-heart {
    color: #e74c3c;
}

/* Category List */
.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-list a, .category-list a:visited, .category-list a:active, .category-list a span {
    text-decoration: none !important;
    color: inherit;
}

.category-item {
    margin-bottom: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    display: block;
}

.category-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    height: auto;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    color: inherit;
    text-decoration: none !important;
    background: none;
    font-size: 1rem;
}

.category-item .category-link:hover,
.category-item .category-link:focus {
    background-color: #f0f7ff;
}

.category-item.active .category-link {
    background-color: #e8f4f8;
    color: #4a90e2;
}


.favourite-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.favourite-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-bottom: 0.5rem;
}
.favourite-item:hover,
.favourite-item:focus {
    background-color: #f0f7ff;
}
.favourite-thumb {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}
.favourite-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
}
.favourite-item:last-child {
    border-bottom: none;
}

.favourite-date {
    font-size: 0.85rem;
    color: #999;
    object-fit: cover;
    flex-shrink: 0;
}

.favourite-info {
    flex: 1;
}

.favourite-title {
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.favourite-date {
    font-size: 0.85rem;
    color: #999;
}

/* Main Content */
.main-content {
    min-height: 500px;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-bottom: 3rem;
}

.post-card {
    background-color: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    position: relative; /* for full-card clickable overlay */
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 420px;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 0 var(--36, 36px) 0 rgba(25, 91, 255, 0.18),
                0 var(--20, 20px) var(--32, 32px) -24px rgba(25, 91, 255, 0.06);
}

.post-image {
    width: 100%;
    height: 250px;
    object-fit: contain;
    object-position: center;
    background-color: #ffffff;
    display: block;
}

/* If no image, keep space reserved */
.no-image {
    width: 100%;
    height: 250px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Full-card clickable overlay without UI changes */
.post-card-link {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    text-decoration: none;
}

.post-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.post-title {
    font-size: 1.4rem;
    color: #333;
    margin-bottom: 1rem;
    font-weight: 600;
}

.post-description {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
    margin-top: auto; /* stick meta to bottom of card */
    min-height: 56px;
}

.post-author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.post-author-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.post-author {
    font-size: 0.9rem;
    color: #333;
    font-weight: 500;
}

.post-date {
    font-size: 0.85rem;
    color: #999;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

.pagination-btn,
.pagination-number {
    width: 40px;
    height: 40px;
    border: 1px solid #e0e0e0;
    background-color: #ffffff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
    color: #666;
    text-decoration: none; /* remove underline for anchor-based buttons */
}

.pagination-btn:hover,
.pagination-number:hover {
    border-color: #4a90e2;
    color: #4a90e2;
}

.pagination-number.active {
    background-color: #4a90e2;
    color: #ffffff;
    border-color: #4a90e2;
}

/* Footer */
.footer {
    background-color: #ffffff;
    padding: 2rem;
    text-align: center;
    margin-top: 4rem;
    border-top: 1px solid #f0f0f0;
}

.footer p {
    max-width: 1400px;
    margin: 0 auto;
    color: #999;
    font-size: 0.9rem;
    text-align: center;
}

/* Post Detail Styles */
.post-detail { background: transparent; }
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.back-link:hover { color: #1f2937; }

.post-header { margin-bottom: 1rem; }
.post-detail .post-title {
    font-size: 2rem; /* ~32px */
    font-weight: 800;
    color: #111827;
    margin: 0.25rem 0 0.75rem 0;
}
.post-meta-line {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #64748b;
}
.meta-avatar { width: 32px; height: 32px; border-radius: 9999px; object-fit: cover; }
.meta-text { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.meta-author { color: #0f172a; font-weight: 600; }
.meta-sep { color: #94a3b8; }
.meta-date { color: #64748b; }
.meta-category { color: #0ea5e9; }
.post-divider { height: 1px; background: #e5e7eb; margin-top: 1rem; }

/* Facebook-like Gallery */
.fb-gallery { display: grid; grid-gap: 8px; }
.fb-gallery.single { grid-template-columns: 1fr; }
.fb-gallery.two { grid-template-columns: 1fr 1fr; }
.fb-gallery.three { grid-template-columns: 2fr 1fr; }
.fb-gallery.four, .fb-gallery.five-plus { grid-template-columns: 1fr 1fr; }

.fb-item { position: relative; overflow: hidden; border-radius: 12px; background: #ffffff; }
.fb-img { width: 100%; height: 100%; display: block; object-fit: contain; background: #ffffff; }

/* Heights per layout to achieve balanced composition */
.fb-gallery.single .fb-item { height: 560px; }
.fb-gallery.two .fb-item { height: 420px; }
.fb-gallery.three .fb-large { height: 480px; }
.fb-gallery.three .fb-col { display: grid; grid-template-rows: 1fr 1fr; gap: 8px; }
.fb-gallery.three .fb-small { height: 236px; }
.fb-gallery.four .fb-item, .fb-gallery.five-plus .fb-item { height: 320px; }

.fb-more { cursor: pointer; }
.fb-more-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.45); color: #fff; font-weight: 700; font-size: 2rem; display: flex; align-items: center; justify-content: center; }

.post-body { font-size: 1.05rem; line-height: 1.8; color: #111827; }
.post-body img { max-width: 100%; border-radius: 12px; background: #fff; }

/* Responsive Design */
@media (max-width: 1024px) {
    .main-wrapper {
        grid-template-columns: 250px 1fr;
        gap: 1.5rem;
    }

    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    /* Utility visibility */
    .mobile-only { display: block !important; }
    .desktop-only { display: none !important; }

    .header-container {
        padding: 0 1rem;
    }

    .header {
        padding: 1rem;
    }

    .logo-text {
        font-size: 1.2rem;
    }

    .nav {
        gap: 1rem;
    }

    .nav-link {
        font-size: 0.9rem;
    }

    .hero {
        padding: 3rem 1rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .main-wrapper {
        grid-template-columns: 1fr;
        padding: 0 1rem;
        gap: 2rem;
        overflow-x: hidden; /* prevent page-level horizontal scroll */
    }
    /* Grid items should be allowed to shrink below content's min size */
    .main-wrapper > * { min-width: 0; }

    /* Hide desktop sidebar on mobile, we render mobile sections separately */
    .sidebar { display: none !important; }

    .main-content {
        order: 2;
    }

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

    .post-image {
        height: 200px;
    }

    .footer {
        padding: 1.5rem 1rem;
    }

    /* Mobile Category Dropdown (tablet & phones) */
    .mobile-category details { background:#fff; border:1px solid #e5e7eb; border-radius:12px; padding:0.5rem 0.75rem; margin-bottom:1rem; }
    .mobile-category summary { list-style:none; cursor:pointer; display:flex; align-items:center; gap:0.5rem; font-weight:600; color:#0f172a; }
    .mobile-category summary::-webkit-details-marker { display:none; }
    .mobile-category .category-list { margin-top:0.75rem; }

    /* Mobile Featured Slider (tablet & phones) */
    .mobile-featured { margin-top: 1.5rem; width: 100%; max-width: 100%; min-width: 0; overflow-x: hidden; }
    .mobile-featured-inner { display:flex; gap:12px; width:100%; max-width:100%; overflow-x:auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling:touch; padding: 0 4px 4px 4px; }
    .mobile-featured-inner::-webkit-scrollbar { height: 6px; }
    .mobile-featured-inner::-webkit-scrollbar-thumb { background:#e5e7eb; border-radius: 9999px; }
    .feat-card { flex:0 0 auto; min-width: 200px; max-width: 65%; background:#fff; border:1px solid #f0f0f0; border-radius:12px; padding:12px; text-decoration:none; color:inherit; box-shadow:0 2px 8px rgba(0,0,0,0.05); }
    .feat-card:hover { box-shadow:0 4px 16px rgba(0,0,0,0.1); }
    .feat-avatar { width:40px; height:40px; border-radius:8px; object-fit:cover; float:left; margin-right:10px; }
    .feat-info { display:block; }
    .feat-title { font-weight:600; font-size:0.95rem; line-height:1.3; max-height:2.6em; overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
    .feat-date { font-size:0.85rem; color:#999; margin-top:4px; }
}

@media (max-width: 480px) {
    .logo-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .logo-text {
        font-size: 1.1rem;
    }

    .nav-link span {
        display: none;
    }

    .hero-title {
        font-size: 1.75rem;
    }

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

    .sidebar {
        padding: 1.5rem;
    }

    .posts-grid {
        gap: 1rem;
    }

    .post-content {
        padding: 1rem;
    }

    /* Mobile Category Dropdown */
    .mobile-category details { background:#fff; border:1px solid #e5e7eb; border-radius:12px; padding:0.5rem 0.75rem; margin-bottom:1rem; }
    .mobile-category summary { list-style:none; cursor:pointer; display:flex; align-items:center; gap:0.5rem; font-weight:600; color:#0f172a; }
    .mobile-category summary::-webkit-details-marker { display:none; }
    .mobile-category .category-list { margin-top:0.75rem; }

    /* Mobile Featured Slider */
    .mobile-featured { margin-top: 1.5rem; width:100%; max-width:100%; overflow-x:hidden; }
    .mobile-featured-inner { display:flex; gap:12px; width:100%; max-width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; padding: 0 4px 4px 4px; }
    .feat-card { flex:0 0 auto; min-width: 200px; max-width: 65%; background:#fff; border:1px solid #f0f0f0; border-radius:12px; padding:12px; text-decoration:none; color:inherit; box-shadow:0 2px 8px rgba(0,0,0,0.05); }
    .feat-card:hover { box-shadow:0 4px 16px rgba(0,0,0,0.1); }
    .feat-avatar { width:40px; height:40px; border-radius:8px; object-fit:cover; float:left; margin-right:10px; }
    .feat-info { display:block; }
    .feat-title { font-weight:600; font-size:0.95rem; line-height:1.3; max-height:2.6em; overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
    .feat-date { font-size:0.85rem; color:#999; margin-top:4px; }
}


