:root {
    --bg-page: #f5f6f8;
    --bg-card: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;

    --brand: #dc2626;
    --brand-soft: rgba(220, 38, 38, .1);
    --secondary-color: var(--brand);
    /* Restore for mobile */
    --gradient-primary: linear-gradient(135deg, var(--brand) 0%, #ff6b6b 100%);
    /* Restore for marquee */

    --radius-lg: 18px;
    --radius-md: 14px;

    --shadow-sm: 0 4px 16px rgba(0, 0, 0, .06);
    --shadow-md: 0 14px 40px rgba(0, 0, 0, .12);
    /* Apple News Vivid Red/Orange */
    /* Red for accents/breaking */
    --accent-color: #ffc107;
    /* Yellow */
    --bg-light: #f8f9fa;
    --text-dark: #212529;
    --text-muted: #6c757d;
    --font-primary: 'Inter', system-ui, sans-serif;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    /* Premium Soft Shadow */
    --header-height: 60px;
}

/* 1️⃣ LOCK THE VIEWPORT (CRITICAL) */
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-page);
    color: var(--text-primary);
    padding-top: 130px;
    /* Offset for fixed header */
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    letter-spacing: -0.5px;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

a:hover {
    color: var(--secondary-color);
}

/* --- header --- */
.main-header {
    background: #fff;
    z-index: 1030;
}

.top-bar {
    height: 70px;
}

.bottom-nav {
    background: #fff;
    height: 48px;
    overflow-x: auto;
    white-space: nowrap;
    border-bottom: 1px solid #eee;
}

.nav-link {
    color: var(--text-dark) !important;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.7rem 1rem;
    text-transform: uppercase;
}

.nav-link:hover,
.nav-link.active {
    color: var(--secondary-color) !important;
    background: rgba(0, 0, 0, 0.03);
}

/* Marquee */
.news-marquee {
    background: var(--gradient-primary);
    color: #fff;
    font-size: 0.85rem;
    padding: 4px 0;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
}

.marquee-content {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 20s linear infinite;
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* --- DESKTOP STYLES (Cards) --- */
@media (min-width: 769px) {
    .news-card {
        border: none;
        box-shadow: var(--shadow-sm);
        transition: transform .35s ease, box-shadow .35s ease;
        overflow: hidden;
        height: 100%;
        background: var(--bg-card);
        border-radius: var(--radius-lg);
    }

    .news-card:hover {
        transform: translateY(-8px);
        box-shadow: var(--shadow-md);
    }

    .news-card img {
        height: 200px;
        width: 100%;
        object-fit: cover;
        border-radius: 12px 12px 0 0;
    }

    .news-card .card-body {
        padding: 1.25rem;
    }

    .news-card .card-title {
        font-size: 1.1rem;
        font-weight: 800;
        line-height: 1.4;
        margin-bottom: 0.5rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        letter-spacing: -0.5px;
    }

    .news-card {
        transition: all .25s ease;
        cursor: pointer;
    }

    .news-card:hover {
        transform: translateY(-6px);
        box-shadow: 0 14px 35px rgba(0, 0, 0, .12);
    }

    .news-card:hover h5 {
        text-decoration: underline;
    }

    .news-card {
        animation: fadeUp .5s ease both;
    }

    @keyframes fadeUp {
        from {
            opacity: 0;
            transform: translateY(12px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Desktop Hero */
    .hero-card {
        position: relative;
        overflow: hidden;
        min-height: 420px;
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-md);
    }

    .hero-card img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.5s ease;
    }

    .hero-card:hover img {
        transform: scale(1.05);
    }

    .hero-overlay {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: linear-gradient(180deg,
                rgba(0, 0, 0, .25),
                rgba(0, 0, 0, .9));
        padding: 3.5rem;
        color: #fff;
    }

    .hero-overlay .badge {
        background: var(--brand);
        padding: 6px 14px;
        font-size: .7rem;
        letter-spacing: .08em;
    }

    .hero-title {
        font-size: 2.6rem;
        font-weight: 900;
        line-height: 1.15;
        letter-spacing: -1px;
        max-width: 80%;
        margin-bottom: 0.5rem;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    }
}

/* Sidebar Groups */
.group {
    padding: 6px;
    border-radius: 10px;
}

.group:hover {
    background: #f9fafb;
}

.group h6 {
    font-weight: 600;
}

.group img {
    transition: transform .3s ease;
}

.group:hover img {
    transform: scale(1.05);
}

/* List Items */
.list-group-item {
    background: rgba(255, 255, 255, .9);
    backdrop-filter: blur(4px);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    transition: background .2s ease, transform .2s ease;
}

.list-group-item:hover {
    transform: translateY(-2px);
    background: #ffffff;
}

/* Editorial */
.editorial .news-card {
    box-shadow: none;
    border-bottom: 1px solid #e5e7eb;
}

.editorial h4 {
    font-size: 1.6rem;
    font-weight: 900;
}

.editorial span {
    letter-spacing: .15em;
}

.editorial img {
    filter: contrast(1.05);
}

/* Events */
.events-panel {
    background: linear-gradient(160deg, #111827, #1f2937);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.events-item:hover {
    background: rgba(255, 255, 255, .05);
    border-radius: 10px;
}

/* Festivals */
.card-hover {
    overflow: hidden;
}

.card-hover .badge {
    font-size: .65rem;
    letter-spacing: .1em;
}

.card-hover img {
    transition: transform .5s ease;
}

.card-hover:hover img {
    transform: scale(1.12);
}

/* Section Titles */
.section-title {
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: -0.8px;
    position: relative;
}

.section-title::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 40px;
    height: 4px;
    background: var(--brand);
    border-radius: 10px;
}

/* --- MOBILE STYLES (App-like & Dailyhunt Strict) --- */
@media (max-width: 768px) {
    body {
        padding-top: 60px;
        /* Smaller header */
        padding-bottom: 72px;
        /* Bottom Nav Safe Area */
        background-color: #f5f5f5;
        /* Light grey for app feel */
    }

    /* Fixed Minimal Header */
    .top-bar {
        height: 55px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
        /* Softer shadow */
        position: fixed;
        width: 100%;
        top: 0;
        z-index: 1040;
        background: rgba(255, 255, 255, 0.95);
        /* Semi-transparent */
        /* Glassmorphism */
        -webkit-backdrop-filter: blur(10px);
    }

    /* Mobile Search & Socials */
    .search-icon-mobile {
        display: block !important;
        margin-right: 8px;
    }

    /* Mobile Marquee */
    .news-marquee {
        display: block !important;
        background: var(--gradient-primary);
        color: #fff;
        font-size: 0.75rem;
        padding: 6px 0;
        margin-top: 55px;
        /* Push down below fixed header */
        position: relative;
        z-index: 1030;
        font-weight: 600;
        /* Bolder text for impact */
    }

    .bottom-nav,
    .subscribe-btn {
        display: none !important;
    }

    .logo-img {
        height: 32px !important;
    }

    /* Single Column Layout */
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* 2️⃣ REMOVE BOOTSTRAP CONTAINER FROM MOBILE APP */
    .mobile-app {
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0;
        overflow-x: hidden;
    }

    /* 3️⃣ UNIFIED FEED CARD SYSTEM (Dailyhunt Style) */
    .feed-card {
        background: #fff;
        border-radius: 12px;
        /* Modern rounded corners */
        border: 1px solid rgba(0, 0, 0, 0.04);
        /* Subtle border */
        border-bottom: none;
        margin-bottom: 12px;
        /* Spacing between cards */
        box-shadow: var(--shadow-soft) !important;
        /* Soft shadow popping */
        overflow: hidden;
    }

    .feed-img {
        height: 200px;
        object-fit: cover;
        width: 100%;
    }

    .feed-title {
        font-size: 1.1rem;
        font-weight: 600;
        line-height: 1.4;
        margin-bottom: 0.5rem;
        color: #000;
    }

    .mobile-app small {
        font-size: 0.75rem;
        color: #777;
    }

    /* Hide Footer */
    footer {
        display: none;
    }

    /* Sticky Bottom Nav */
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: #fff;
        /* White Background */
        height: 60px;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
        z-index: 1050;
        justify-content: space-around;
        align-items: center;
        border-top: 1px solid #f0f0f0;
    }

    .nav-item-mobile {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: var(--text-primary);
        /* Inactive light grey */
        font-size: 0.7rem;
        text-decoration: none;
        flex: 1;
        padding: 8px 0;
        transition: color 0.3s ease;
    }

    .nav-item-mobile.active {
        color: var(--secondary-color);
        /* Active Brand Color */
        font-weight: 700;
        background: none;
    }

    .nav-item-mobile i {
        font-size: 1.2rem;
        margin-bottom: 4px;
    }

    /* Horizontal Scroll Sections */
    .horizontal-scroll {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        overflow-y: hidden;
        padding-left: 12px;
        padding-right: 12px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
    }

    .horizontal-scroll>* {
        scroll-snap-align: start;
        flex-shrink: 0;
    }

    /* App-like Chips */
    .story-chip {
        display: inline-block;
        padding: 8px 16px;
        border-radius: 20px;
        background-color: #fff;
        border: 1px solid #eee;
        color: #333;
        font-size: 0.85rem;
        font-weight: 600;
        white-space: nowrap;
    }

    .story-chip.active {
        background: var(--gradient-primary);
        /* Gradient chip */
        color: #fff;
        border: none;
        box-shadow: 0 4px 10px rgba(255, 52, 39, 0.3);
        /* Glow effect */
    }

    /* 5️⃣ HERO SHOULD TOUCH SCREEN EDGES */
    .mobile-hero {
        width: 100%;
        margin-bottom: 12px;
    }

    .mobile-hero-img {
        height: 220px;
        object-fit: cover;
        filter: brightness(0.7);
        width: 100%;
    }

    .mobile-hero-title {
        font-size: 1.25rem;
        font-weight: 800;
        line-height: 1.3;
        color: #fff;
    }

    /* PWA Install Banner */
    .pwa-install-banner {
        display: none;
        position: fixed;
        bottom: 70px;
        left: 12px;
        right: 12px;
        background: #fff;
        border-radius: 12px;
        padding: 12px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        z-index: 9999;
        align-items: center;
        justify-content: space-between;
        animation: slideUp 0.4s ease-out;
    }

    .pwa-install-banner.show {
        display: flex;
    }

    .pwa-content {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .pwa-icon {
        width: 50px;
        height: 50px;
        border-radius: 12px;
        object-fit: cover;
        flex-shrink: 0;
    }

    .pwa-text h6 {
        margin: 0;
        font-weight: 700;
        font-size: 0.95rem;
    }

    .pwa-text p {
        margin: 0;
        font-size: 0.75rem;
        color: var(--text-muted);
    }

    .pwa-btn {
        background: var(--text-dark);
        color: #fff;
        border: none;
        padding: 8px 16px;
        border-radius: 20px;
        font-size: 0.85rem;
        font-weight: 600;
        white-space: nowrap;
    }

    .pwa-close {
        position: absolute;
        top: -8px;
        right: -8px;
        background: #eee;
        border-radius: 50%;
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        color: #666;
        cursor: pointer;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.mobile-bottom-nav {
    display: none;
}

/* Utility: Hide Scrollbar */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Video Embeds (Responsive) */
.video-container {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 */
    height: 0;
    overflow: hidden;
    background: #000;
    border-radius: 12px;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* --- Desktop Fixes --- */
@media (min-width: 769px) {

    .pwa-install-banner,
    .mobile-bottom-nav {
        display: none !important;
    }

    /* Ensure Footer Logo/Title is clean */
    footer img {
        max-width: 150px;
        height: auto;
    }
}

/* Mobile Offcanvas Menu */
.offcanvas {
    border-right: none;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
}

.offcanvas-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

.offcanvas .list-group-item {
    font-size: 0.95rem;
    color: var(--text-dark);
    transition: all 0.2s ease;
}

.offcanvas .list-group-item:hover,
.offcanvas .list-group-item:active {
    background-color: #f8f9fa;
    color: var(--secondary-color);
    padding-left: 1.5rem !important;
    /* Slight slide effect */
}

.offcanvas .list-group-item i {
    width: 20px;
    text-align: center;
}