:root {
    --primary: #3b5998;
    --accent: #ff4500;
    --background: #f0f2f5;
    --card-bg: #ffffff;
    --text-main: #1c1e21;
    --text-muted: #65676b;
    --glass: rgba(255, 255, 255, 0.85);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --container-width: 1000px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Noto Sans Malayalam', sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Manjari', sans-serif;
}

header {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 0.75rem 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    /* For absolute centering of nav */
}

/* Navigation */
.main-nav {
    display: flex;
    gap: 8px;
    align-items: center;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Absolute Center on Desktop */
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
}

.main-nav::-webkit-scrollbar {
    display: none;
}

.nav-link {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--primary);
    background: rgba(59, 89, 152, 0.08);
}

.nav-link.active {
    color: var(--primary);
    background: rgba(59, 89, 152, 0.12);
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 12px;
        align-items: center;
        /* Center align on mobile */
    }

    .main-nav {
        /* Reset absolute positioning for mobile */
        position: static;
        transform: none;
        left: auto;

        width: 100%;
        justify-content: center;
        /* Center content in nav */
        margin-left: 0;
        padding-bottom: 4px;
        /* Scroll mask */
        mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
        -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    }
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 16px;
}

.logo-link {
    text-decoration: none;
    display: flex;
    flex-direction: column;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
    line-height: 1.1;
}


.site-tagline {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

@media (min-width: 768px) {

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

    .site-tagline {
        font-size: 0.75rem;
    }
}

/* Ad Containers */
.ad-container {
    margin: 32px 0;
    text-align: center;
    background: #fdfdfd;
    border: 1px solid #f0f0f1;
    border-radius: 8px;
    position: relative;
    min-height: 100px;
    display: block;
    width: 100%;
    padding: 20px 0 10px;
}

@media (max-width: 600px) {

    /* Homepage ads - breaking out of .container (16px) */
    .ad-container {
        margin: 24px -16px !important;
        width: calc(100% + 32px) !important;
        border-left: none;
        border-right: none;
        border-radius: 0;
        overflow: hidden;
    }

    /* Article ads - breaking out of .single-article (20px) AND .container (16px) */
    .single-article .ad-container {
        margin: 24px -36px !important;
        width: calc(100% + 72px) !important;
    }
}

.ad-container::before {
    content: "- ADVERTISEMENT -";
    position: absolute;
    top: 6px;
    left: 0;
    right: 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #bbb;
    z-index: 1;
}

ins.adsbygoogle {
    margin: 0 auto !important;
    display: block !important;
    max-width: 100% !important;
    /* Ensure ad doesn't exceed container width */
}

/* Grid System - Mobile First */
.main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 24px;
    align-items: start;
}

@media (min-width: 600px) {
    .main-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (min-width: 900px) {
    .main-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }
}

/* Article Cards */
.article-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.article-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

.article-content {
    padding: 16px;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.category {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    margin-bottom: 6px;
    display: block;
}

.article-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.4;
    font-family: 'Manjari', sans-serif;
    /* Text Clamping for uniform card height */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 auto;
}

.article-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid #f0f0f1;
    padding-top: 12px;
    flex-shrink: 0;
}

/* Single Article Styling */
.single-article {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
    box-shadow: var(--shadow);
}

@media (min-width: 768px) {
    .single-article {
        padding: 40px;
        margin-top: 40px;
    }
}

.single-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 16px;
    font-family: 'Manjari', sans-serif;
    line-height: 1.25;
}

@media (min-width: 768px) {
    .single-title {
        font-size: 2.75rem;
        margin-bottom: 24px;
    }
}

.single-img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    margin-bottom: 20px;
}

.article-text {
    font-size: 1.125rem;
    color: #222;
    line-height: 1.8;
}

.article-text p {
    margin-bottom: 1.5rem;
}

.share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 24px 0;
}

.share-btn {
    flex: 1;
    min-width: 140px;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 8px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: filter 0.2s;
    font-size: 14px;
}

.share-btn:hover {
    filter: brightness(1.1);
}

.share-fb {
    background-color: #1877f2;
}

.share-wa {
    background-color: #25d366;
}

/* Buttons */
.button {
    background: var(--primary);
    color: #fff;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
    display: inline-block;
    transition: background 0.2s;
    border: none;
    cursor: pointer;
}

.button:hover {
    background: #2d4373;
}

/* Sticky Mobile Share Bar */
.mobile-share-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--glass);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 10px 16px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

@media (max-width: 767px) {
    .mobile-share-bar {
        display: flex;
        gap: 12px;
    }
}

/* Back to Top */
.back-to-top {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: var(--primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: var(--shadow);
    opacity: 0.8;
    transition: opacity 0.3s;
    z-index: 999;
}

@media (min-width: 768px) {
    .back-to-top {
        bottom: 30px;
    }
}

.back-to-top:hover {
    opacity: 1;
}

/* Responsive Embeds */
.embed-container {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    margin: 24px 0;
    background: #000;
    border-radius: 8px;
}

.embed-container iframe,
.embed-container object,
.embed-container embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Social Media Embed Adjustments */
.social-embed {
    margin: 24px 0;
    display: flex;
    justify-content: center;
    width: 100%;
}

.social-embed blockquote {
    margin: 0 !important;
}

/* Internal Read Now Link */
.read-now-link {
    background: #f8f9fa;
    border-left: 4px solid var(--primary-color);
    padding: 15px 20px;
    margin: 25px 0;
    font-size: 1.1rem;
    line-height: 1.4;
    border-radius: 0 4px 4px 0;
}

.read-now-link strong {
    color: var(--primary-color);
    letter-spacing: 0.5px;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 5px;
}

.read-now-link a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 700;
    transition: color 0.2s;
}

.read-now-link a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Hide redundant share buttons on ultra-mobile */
@media (max-width: 480px) {
    .single-article .share-buttons:first-of-type {
        display: none;
    }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin: 50px 0 30px;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: background 0.2s, transform 0.2s;
    font-size: 14px;
}

.pagination-btn:hover {
    background: #2d4373;
    transform: translateY(-2px);
}

.pagination-btn.disabled {
    background: #ccc;
    color: #888;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination-numbers {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pagination-number {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    color: var(--text-main);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: var(--shadow);
    font-size: 14px;
}

.pagination-number:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.pagination-number.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 89, 152, 0.3);
}

.pagination-dots {
    color: var(--text-muted);
    font-weight: 600;
    padding: 0 4px;
}

@media (max-width: 600px) {
    .pagination {
        gap: 8px;
        margin: 30px 0 20px;
    }

    .pagination-btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .pagination-number {
        width: 36px;
        height: 36px;
        font-size: 13px;
    }
}

/* Generic Responsive Fixes for Content */
.article-text iframe,
.article-text video,
.article-text embed,
.article-text object {
    max-width: 100%;
}

/* Fix for AdSense Auto Ads creating overflow */
.google-auto-placed {
    max-width: 100%;
    overflow: hidden;
}

/* Prevent horizontal scroll from negative margin elements */
body {
    overflow-x: hidden;
    width: 100%;
}