/*
 * ============================================================
 *  KenStack AI News — Responsive Stylesheet
 *  Covers breakpoints from 1440px → 360px
 *  DO NOT change the base (desktop) styles — extend only.
 * ============================================================
 *
 *  Table of Contents
 *  -----------------
 *  1.  Global Helpers & Base overrides for fluid typography
 *  2.  Hamburger button (hidden on desktop)
 *  3.  Mobile Overlay / Backdrop
 *  4.  @media (max-width: 1440px)  — Large Desktop
 *  5.  @media (max-width: 1200px)  — Desktop / Laptop
 *  6.  @media (max-width: 1024px)  — Laptop
 *  7.  @media (max-width: 992px)   — Tablet Landscape  (hamburger ON)
 *  8.  @media (max-width: 768px)   — Tablet Portrait
 *  9.  @media (max-width: 576px)   — Large Mobile
 *  10. @media (max-width: 480px)   — Small Mobile
 *  11. @media (max-width: 360px)   — Extra-small Devices
 *  12. Accessibility & Performance helpers
 * ============================================================
 */


/* ============================================================
   1. Global — fluid typography & image safety
   ============================================================ */

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Fluid headings using clamp() */
.hero-content h2 {
    font-size: clamp(1.8rem, 4vw, 2.875rem); /* 29px → 46px */
}

.header-content h1 {
    font-size: clamp(1.6rem, 3.5vw, 2.625rem); /* 26px → 42px */
}

.newsletter-section h2 {
    font-size: clamp(1.4rem, 3vw, 2rem);
}

.contact-left h3,
.event-details h4 {
    font-size: clamp(1.1rem, 2.5vw, 1.75rem);
}

.header-left h3,
.widget-title {
    font-size: clamp(1rem, 2vw, 1.375rem);
}

/* Prevent horizontal overflow site-wide */
html, body {
    overflow-x: hidden;
}

/* Hide mobile drawer footer on desktop */
.mobile-drawer-footer {
    display: none;
}

/* ============================================================
   2. Hamburger Button — always in the DOM, visible on mobile
   ============================================================ */

.hamburger-btn {
    display: none;               /* hidden on desktop */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    transition: background 0.3s ease;
    position: relative;          /* ensures z-index works */
    z-index: 5;                  /* sits above siblings in nav-right */
    flex-shrink: 0;
}

.hamburger-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.hamburger-btn .bar {
    display: block;
    width: 24px;
    height: 2px;
    background-color: #ffffff;
    border-radius: 2px;
    transition: transform 0.35s ease, opacity 0.35s ease, width 0.35s ease;
    transform-origin: center;
}

/* Animated X state */
.hamburger-btn.open .bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.hamburger-btn.open .bar:nth-child(2) {
    opacity: 0;
    width: 0;
}
.hamburger-btn.open .bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ============================================================
   3. Mobile menu overlay / backdrop
   ============================================================ */

.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 95;  /* BELOW navbar z-index (100) — so hamburger stays always clickable */
    opacity: 0;
    transition: opacity 0.35s ease;
}

.mobile-overlay.visible {
    display: block;
    opacity: 1;
}

/* ============================================================
   Mobile Nav Drawer — base styles (slide-in from right)
   Activated below 992 px via JS class .mobile-open on .navbar
   ============================================================ */

@media (max-width: 992px) {

    /* --- Navbar Layout ------------------------------------ */
    .nav-container {
        position: relative;
    }

    .hamburger-btn {
        display: flex;
        /* no order needed — naturally last inside nav-right */
    }

    /* Hide extra nav-right items on tablet — shown in mobile drawer instead */
    .nav-right .icon-btn.profile-btn,
    .nav-right .btn-subscribe,
    .nav-right a.icon-btn[aria-label="Website"],
    .nav-right a.icon-btn[aria-label="LinkedIn"],
    .nav-right a.icon-btn[aria-label="Instagram"] {
        display: none;
    }

    /* Hide desktop nav links — become fixed drawer */
    .nav-center,
    .nav-center--pill {
        position: fixed !important;
        top: 0 !important;
        right: -330px !important;         /* start off-screen */
        width: min(320px, 86vw) !important;
        height: 100vh !important;
        height: 100dvh !important;
        background: linear-gradient(180deg, #0e1e6e 0%, #09134a 100%) !important;
        border-radius: 24px 0 0 24px !important;
        z-index: 200 !important;
        overflow-y: auto !important;
        padding: 72px 18px 30px !important;
        transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: -12px 0 40px rgba(0, 0, 0, 0.45) !important;
        box-sizing: border-box !important;
    }

    /* Open state — triggered by JS adding class to .navbar */
    .navbar.mobile-open .nav-center,
    .navbar.mobile-open .nav-center--pill {
        right: 0 !important;
    }

    /* Hamburger morphs into clean close button when drawer is open */
    .navbar.mobile-open .hamburger-btn {
        position: fixed !important;
        top: 16px !important;
        right: 18px !important;
        z-index: 250 !important;
        background: rgba(255, 255, 255, 0.14) !important;
        border-radius: 50% !important;
        width: 42px !important;
        height: 42px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .navbar.mobile-open .hamburger-btn .bar {
        background-color: #ffffff !important;
    }

    /* Mobile nav list — vertical stack */
    .nav-center ul,
    .nav-center--pill ul {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 6px !important;
        padding: 0 !important;
        margin: 0 !important;
        list-style: none !important;
    }

    .nav-center ul li,
    .nav-center--pill ul li {
        width: 100% !important;
        margin: 0 !important;
    }

    .nav-center a,
    .nav-center--pill a,
    .nav-center ul li a,
    .nav-center--pill ul li a {
        padding: 13px 20px !important;
        border-radius: 50px !important;
        font-size: 15px !important;
        font-weight: 500 !important;
        width: 100% !important;
        justify-content: center !important;
        color: #ffffff !important;
        background: transparent !important;
        box-shadow: none !important;
        text-decoration: none !important;
        display: flex !important;
        align-items: center !important;
        transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease !important;
        box-sizing: border-box !important;
        text-align: center !important;
    }

    .nav-center a:hover,
    .nav-center--pill a:hover,
    .nav-center ul li a:hover,
    .nav-center--pill ul li a:hover {
        background: rgba(255, 255, 255, 0.12) !important;
        color: #ffffff !important;
    }

    .nav-center a.active,
    .nav-center--pill a.active,
    .nav-center ul li a.active,
    .nav-center--pill ul li a.active {
        background: #ffffff !important;
        color: #0b1a56 !important;
        font-weight: 700 !important;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2) !important;
    }

    /* Dropdown toggle chevron */
    .nav-center .dropdown-toggle {
        width: 100% !important;
        justify-content: center !important;
        gap: 8px !important;
    }

    .nav-center .dropdown-toggle i {
        color: rgba(255, 255, 255, 0.8) !important;
        font-size: 11px !important;
        transition: transform 0.25s ease !important;
    }

    .dropdown-item.show .dropdown-toggle i {
        transform: rotate(180deg) !important;
    }


    /* Mega menu — accordion inside mobile drawer */
    .mega-menu {
        position: static !important;
        transform: none !important;
        width: 100% !important;
        opacity: 1 !important;
        visibility: visible !important;
        display: none;
        box-shadow: none;
        background: rgba(255, 255, 255, 0.06);
        border-radius: 10px;
        margin: 4px 0 8px;
        padding: 12px;
    }

    .dropdown-item.show .mega-menu {
        display: block !important;
    }

    .mega-menu-grid {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .mega-menu-heading {
        color: rgba(255, 255, 255, 0.9);
        border-bottom-color: rgba(255, 255, 255, 0.15);
        font-size: 13px;
    }

    .mega-menu-heading i {
        color: #ffd633;
    }

    .nav-center .mega-menu .mega-menu-list a {
        color: rgba(255, 255, 255, 0.75) !important;
        font-size: 13px;
        padding: 7px 10px;
    }

    .nav-center .mega-menu .mega-menu-list a:hover {
        background: rgba(255, 255, 255, 0.1) !important;
        color: #ffffff !important;
        text-decoration: none;
    }

    .events-dropdown-grid {
        grid-template-columns: 1fr;
    }

    .nav-center .mega-menu .events-list a {
        color: rgba(255, 255, 255, 0.8) !important;
    }

    .nav-center .mega-menu .events-list a .event-title {
        color: rgba(255, 255, 255, 0.95);
    }

    .nav-center .mega-menu .events-list a:hover {
        background: rgba(255, 255, 255, 0.1) !important;
    }

    .event-desc {
        color: rgba(255, 255, 255, 0.55);
    }

    /* --- Nav Right — compact ----------------------------- */
    .nav-right {
        gap: 8px;
    }

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

    /* Mobile close button inside drawer */
    .mobile-drawer-header {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        padding: 16px 20px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .mobile-drawer-header .drawer-brand {
        font-size: 16px;
        font-weight: 700;
        color: #ffffff;
    }

    .mobile-drawer-close {
        background: transparent;
        border: none;
        color: #ffffff;
        font-size: 22px;
        cursor: pointer;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: background 0.2s;
    }

    .mobile-drawer-close:hover {
        background: rgba(255, 255, 255, 0.15);
    }

    /* Mobile drawer footer — hidden icons revealed in drawer */
    .mobile-drawer-footer {
        display: block !important;
        padding: 10px 0 0 !important;
        margin-top: 14px !important;
    }

    .mobile-drawer-divider {
        height: 1px !important;
        background: rgba(255, 255, 255, 0.15) !important;
        margin-bottom: 18px !important;
    }

    .mobile-drawer-actions {
        display: grid !important;
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 10px !important;
        margin-bottom: 18px !important;
    }

    .mobile-drawer-actions > :nth-child(1),
    .mobile-drawer-actions > :nth-child(2),
    .mobile-drawer-actions > :nth-child(3) {
        grid-column: span 2 !important;
    }

    .mobile-drawer-actions > :nth-child(4) {
        grid-column: 2 / span 2 !important;
    }

    .mobile-drawer-actions > :nth-child(5) {
        grid-column: 4 / span 2 !important;
    }

    .nav-center a.mobile-action-btn,
    .nav-center--pill a.mobile-action-btn,
    .mobile-action-btn {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        background: rgba(255, 255, 255, 0.08) !important;
        border: 1px solid rgba(255, 255, 255, 0.14) !important;
        border-radius: 14px !important;
        padding: 12px 6px !important;
        color: #ffffff !important;
        font-family: inherit !important;
        cursor: pointer !important;
        text-decoration: none !important;
        transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease !important;
        text-align: center !important;
        min-height: 66px !important;
        box-sizing: border-box !important;
        box-shadow: none !important;
    }

    .mobile-action-btn i {
        font-size: 18px !important;
        color: #fbbf24 !important;
    }

    .mobile-action-btn span {
        font-size: 11.5px !important;
        font-weight: 500 !important;
        color: rgba(255, 255, 255, 0.9) !important;
        line-height: 1.2 !important;
    }

    .mobile-action-btn:hover,
    .mobile-action-btn:active {
        background: rgba(255, 255, 255, 0.18) !important;
        border-color: rgba(251, 191, 36, 0.5) !important;
        transform: translateY(-2px) !important;
        color: #ffffff !important;
    }

    .nav-center a.mobile-subscribe-btn,
    .nav-center--pill a.mobile-subscribe-btn,
    .mobile-subscribe-btn {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 10px !important;
        background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
        color: #0b1a56 !important;
        font-weight: 700 !important;
        font-size: 14px !important;
        padding: 14px 20px !important;
        border-radius: 50px !important;
        text-decoration: none !important;
        box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35) !important;
        transition: transform 0.2s ease, box-shadow 0.2s ease !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .mobile-subscribe-btn:hover,
    .mobile-subscribe-btn:active {
        transform: translateY(-2px) !important;
        box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5) !important;
        color: #0b1a56 !important;
    }

    .mobile-subscribe-btn i {
        font-size: 15px !important;
        color: #0b1a56 !important;
    }
}



/* ============================================================
   4. @media (max-width: 1440px)  — Large Desktop
   ============================================================ */

@media (max-width: 1440px) {

    /* --- Container widths --------------------------------- */
    .main-content,
    .nav-container,
    .footer-container,
    .ai-news-container,
    .search-filters-section,
    .breadcrumb-container,
    .page-header {
        max-width: 1280px;
    }

    /* --- Mega menu width ---------------------------------- */
    .categories-mega-menu {
        width: min(1100px, 90vw);
    }
}


/* ============================================================
   5. @media (max-width: 1200px)  — Desktop / mid-laptop
   ============================================================ */

@media (max-width: 1200px) {

    /* --- Hero -------------------------------------------- */
    .hero-card {
        padding: 0 36px;
    }

    .hero-content h2 {
        font-size: clamp(1.75rem, 3.5vw, 2.4rem);
    }

    /* --- Home layout ------------------------------------- */
    .top-row {
        grid-template-columns: 62% calc(38% - 20px);
    }

    .bottom-row {
        grid-template-columns: 62% calc(38% - 20px);
    }

    /* --- Mega menu --------------------------------------- */
    .categories-mega-menu {
        width: min(960px, 92vw);
    }

    /* --- AI News page ------------------------------------ */
    .ai-news-container {
        grid-template-columns: 1fr;
    }

    .ai-news-sidebar {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    .news-list-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* --- Page header ------------------------------------- */
    .header-content h1 {
        font-size: clamp(1.6rem, 3vw, 2.2rem);
    }

    /* --- Footer ------------------------------------------ */
    .footer-container {
        grid-template-columns: 2fr 1fr 1fr 1.5fr;
        gap: 28px;
    }
}


/* ============================================================
   6. @media (max-width: 1024px)  — Laptop
   ============================================================ */

@media (max-width: 1024px) {

    /* --- Navbar ------------------------------------------ */
    .nav-center a {
        padding: 8px 12px;
        font-size: 12px;
    }

    .nav-right {
        gap: 10px;
    }

    .btn-subscribe {
        padding: 8px 18px;
        font-size: 13px;
    }

    /* --- Home layout ------------------------------------- */
    .top-row {
        grid-template-columns: 58% calc(42% - 20px);
    }

    .bottom-row {
        grid-template-columns: 60% calc(40% - 20px);
    }

    /* --- Hero -------------------------------------------- */
    .hero-card {
        padding: 0 28px;
    }

    .hero-content h2 {
        font-size: clamp(1.6rem, 3vw, 2.1rem);
    }

    /* --- News grid --------------------------------------- */
    .news-list-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 22px;
    }

    /* --- Events section ---------------------------------- */
    .events-section {
        padding: 30px;
    }

    /* --- Contact ----------------------------------------- */
    .contact-container {
        gap: 28px;
    }

    /* --- Footer ------------------------------------------ */
    .footer-container {
        grid-template-columns: 1.5fr 1fr 1fr 1.2fr;
        gap: 24px;
    }
}


/* ============================================================
   7. @media (max-width: 992px)  — Tablet Landscape
       Hamburger menu is now active (styles above in mobile nav)
   ============================================================ */

@media (max-width: 992px) {

    /* --- Navbar ------------------------------------------ */
    .navbar {
        height: 64px;
    }

    /* --- Home layout — stack panels vertically ----------- */
    .top-row {
        grid-template-columns: 1fr;
    }

    .bottom-row {
        grid-template-columns: 1fr;
    }

    /* Trending panel — horizontal scroll on tablet */
    .trending-panel {
        height: auto;
        padding: 20px;
    }

    .trending-wrapper {
        height: 280px;
    }

    /* --- Hero -------------------------------------------- */
    .hero-card {
        height: auto;
        min-height: 260px;
        padding: 36px 28px;
    }

    .hero-content {
        max-width: 100%;
    }

    /* --- Bottom row right sidebar ----------------------- */
    .right-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 16px;
    }

    .right-sidebar > * {
        flex: 1 1 280px;
    }

    /* --- News grid --------------------------------------- */
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .news-list-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    /* --- Categories grid --------------------------------- */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* --- AI News sidebar — horizontal grid -------------- */
    .ai-news-sidebar {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    /* --- Newsletter -------------------------------------- */
    .newsletter-section {
        padding: 50px 28px;
        margin-top: 30px;
    }

    .newsletter-form {
        flex-direction: column;
        align-items: stretch;
    }

    .newsletter-form input,
    .btn-subscribe-large {
        width: 100%;
    }

    /* --- Events ----------------------------------------- */
    .events-section {
        padding: 28px 20px;
        margin-top: 30px;
    }

    .timeline-content {
        gap: 15px;
    }

    /* --- FAQ -------------------------------------------- */
    .faq-section {
        padding: 28px 20px;
        margin-top: 30px;
    }

    /* --- Contact ----------------------------------------- */
    .contact-section {
        padding: 28px 20px;
        margin-top: 30px;
    }

    .contact-container {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    /* --- Footer ------------------------------------------ */
    .footer-container {
        grid-template-columns: 1fr 1fr;
        gap: 36px;
    }

    /* --- Section padding reduction ----------------------- */
    .main-content {
        padding: 16px;
    }

    /* --- Page header (AI News page) --------------------- */
    .page-header {
        padding: 50px 30px;
        margin: 0 20px 32px;
    }

    .header-stats {
        flex-wrap: wrap;
        gap: 20px;
    }

    /* --- Search filters ---------------------------------- */
    .secondary-filters {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .filter-dropdown select {
        min-width: 160px;
    }
}


/* ============================================================
   8. @media (max-width: 768px)  — Tablet Portrait
   ============================================================ */

@media (max-width: 768px) {

    /* --- Navbar ------------------------------------------ */
    .navbar {
        height: 60px;
        border-radius: 0 0 10px 10px;
    }

    .nav-container {
        padding: 0 16px;
    }

    .brand h1 {
        font-size: 17px;
    }

    .brand p {
        display: none; /* hide tagline on small screens */
    }

    .logo-icon {
        width: 38px;
        height: 34px;
    }

    /* Reduce right icon buttons */
    .nav-right .icon-btn:not(.profile-btn) {
        width: 36px;
        height: 36px;
        font-size: 15px;
    }

    /* --- Hero -------------------------------------------- */
    .hero-card {
        padding: 28px 20px;
        min-height: 220px;
        text-align: center;
        flex-direction: column;
        align-items: center;
    }

    .hero-content {
        max-width: 100%;
        text-align: center;
    }

    .hero-content h2 {
        font-size: clamp(1.5rem, 5vw, 2rem);
    }

    .hero-content p {
        font-size: 14px;
    }

    .btn-yellow {
        margin: 0 auto;
        width: fit-content;
        min-height: 44px;
    }

    /* --- Home: news grid --------------------------------- */
    .news-grid {
        grid-template-columns: 1fr;
    }

    .news-img {
        height: 160px;
    }

    /* --- Home: right sidebar — stack -------------------- */
    .right-sidebar {
        flex-direction: column;
    }

    /* --- Categories grid --------------------------------- */
    .categories-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .category-pill {
        padding: 10px 14px;
        font-size: 13px;
    }

    /* --- Latest news section ----------------------------- */
    .latest-news-card,
    .categories-card,
    .ad-card {
        padding: 20px;
    }

    /* --- News cards (AI News page) ----------------------- */
    .news-list-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* --- Timeline ---------------------------------------- */
    .timeline-content {
        flex-direction: column;
    }

    .event-img {
        width: 100%;
        height: 200px;
        border-radius: 10px;
    }

    .timeline::before {
        left: 18px;
    }

    .timeline-dot {
        left: -7px;
    }

    /* --- Newsletter -------------------------------------- */
    .newsletter-section {
        padding: 40px 20px;
        border-radius: 14px;
    }

    /* --- FAQ -------------------------------------------- */
    .faq-question {
        font-size: 15px;
        padding: 16px;
    }

    /* --- Contact ----------------------------------------- */
    .contact-form {
        padding: 20px;
    }

    /* --- AI news sidebar — single column ---------------- */
    .ai-news-sidebar {
        grid-template-columns: 1fr;
    }

    /* --- AI news page header ----------------------------- */
    .page-header {
        padding: 36px 20px;
        margin: 0 16px 24px;
    }

    .header-stats {
        gap: 16px;
    }

    .stat-value {
        font-size: 18px;
    }

    /* --- Filters ----------------------------------------- */
    .filter-pill {
        padding: 7px 14px;
        font-size: 12px;
        min-height: 36px;
    }

    .type-btn {
        font-size: 13px;
        min-height: 36px;
    }

    /* --- Load more button -------------------------------- */
    .load-more-btn {
        width: 100%;
        justify-content: center;
        min-height: 50px;
    }

    /* --- Footer ------------------------------------------ */
    .footer {
        padding: 48px 16px 16px;
        margin-top: 40px;
    }

    .footer-container {
        grid-template-columns: 1fr 1fr;
        gap: 28px;
    }

    /* --- Section spacing --------------------------------- */
    .main-content {
        padding: 12px;
    }

    .newsletter-section,
    .events-section,
    .faq-section,
    .contact-section {
        margin-top: 20px;
    }
}


/* ============================================================
   9. @media (max-width: 576px)  — Large Mobile
   ============================================================ */

@media (max-width: 576px) {

    /* --- Navbar ------------------------------------------ */
    .brand p {
        display: none;
    }

    /* Hide some social icon buttons to avoid overflow */
    .nav-right .icon-btn:not(.profile-btn):not([aria-label="Search"]) {
        display: none;
    }

    .nav-right {
        gap: 6px;
    }

    /* --- Mega Menu & Dropdowns --- */
    .mega-menu-grid,
    .events-dropdown-grid {
        grid-template-columns: 1fr;
    }

    /* --- Hero -------------------------------------------- */
    .hero-card {
        padding: 24px 16px;
        border-radius: 14px;
    }

    .hero-content h2 {
        font-size: clamp(1.4rem, 6vw, 1.8rem);
    }

    .btn-yellow {
        padding: 11px 22px;
        font-size: 14px;
        width: 100%;
        justify-content: center;
    }

    /* --- Trending panel ---------------------------------- */
    .trending-panel {
        padding: 16px;
    }

    .trending-thumb {
        width: 50px;
        height: 50px;
    }

    .trending-info h4 {
        font-size: 13px;
    }

    /* --- News grid --------------------------------------- */
    .news-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .news-list-grid {
        gap: 16px;
    }

    /* --- Categories -------------------------------------- */
    .categories-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .category-pill {
        min-height: 44px;
        padding: 10px 16px;
    }

    /* --- Section headers --------------------------------- */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .header-left h3 {
        font-size: clamp(1rem, 4.5vw, 1.2rem);
    }

    /* --- News cards -------------------------------------- */
    .news-list-item .item-content {
        padding: 18px;
    }

    .news-list-item h3 {
        font-size: 16px;
    }

    .news-list-item .img-wrapper {
        height: 180px;
    }

    /* --- Events ------------------------------------------ */
    .event-details h4 {
        font-size: 17px;
    }

    .event-meta {
        flex-direction: column;
        gap: 6px;
    }

    .btn-primary-outline {
        min-height: 44px;
        width: 100%;
        text-align: center;
    }

    /* --- Newsletter -------------------------------------- */
    .newsletter-form {
        gap: 12px;
    }

    .newsletter-form input {
        padding: 12px 18px;
        font-size: 14px;
    }

    .btn-subscribe-large {
        min-height: 48px;
        font-size: 14px;
    }

    /* --- Contact ----------------------------------------- */
    .contact-left h3 {
        font-size: 1.3rem;
    }

    .info-item span {
        font-size: 13px;
    }

    .btn-primary {
        min-height: 48px;
        font-size: 14px;
    }

    /* --- Footer ------------------------------------------ */
    .footer-container {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .footer-col {
        text-align: center;
    }

    .footer-brand {
        justify-content: center;
    }

    .footer-socials {
        justify-content: center;
    }

    .footer-col ul {
        align-items: center;
    }

    .mini-newsletter {
        max-width: 340px;
        margin: 0 auto;
    }

    /* --- FAQ -------------------------------------------- */
    .faq-question {
        font-size: 14px;
        padding: 14px;
    }

    /* --- Form buttons ------------------------------------ */
    .btn-subscribe {
        padding: 9px 16px;
        font-size: 13px;
    }

    /* --- AI News page header ----------------------------- */
    .page-header {
        padding: 30px 16px;
        margin: 0 12px 20px;
    }

    .header-stats {
        flex-direction: column;
        gap: 12px;
    }

    /* --- Search ------------------------------------------ */
    .search-bar {
        padding: 4px 16px;
    }

    .search-bar input {
        font-size: 15px;
        padding: 12px 0;
    }

    /* --- Filters ----------------------------------------- */
    .topic-filters {
        gap: 8px;
    }

    .filter-pill {
        font-size: 12px;
        padding: 7px 12px;
    }

    .content-type-filters {
        gap: 6px;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .type-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* --- Scroll to top ----------------------------------- */
    .scroll-to-top {
        bottom: 20px;
        right: 16px;
        width: 44px;
        height: 44px;
        font-size: 17px;
    }

    /* --- Sidebar widgets --------------------------------- */
    .sidebar-widget {
        padding: 18px;
    }

    .widget-title {
        font-size: 15px;
    }
}


/* ============================================================
   10. @media (max-width: 480px)  — Small Mobile
   ============================================================ */

@media (max-width: 480px) {

    /* --- Hero -------------------------------------------- */
    .hero-card {
        padding: 20px 14px;
    }

    .hero-content h2 {
        font-size: clamp(1.25rem, 6.5vw, 1.6rem);
        line-height: 1.2;
    }

    .hero-content p {
        font-size: 13px;
    }

    /* --- News items -------------------------------------- */
    .news-list-item .img-wrapper {
        height: 160px;
    }

    .news-content h4 {
        font-size: 15px;
    }

    /* --- Trending ---------------------------------------- */
    .trending-wrapper {
        height: 240px;
    }

    .trending-card {
        gap: 10px;
        padding: 8px;
    }

    .trending-thumb {
        width: 44px;
        height: 44px;
    }

    /* --- FAQ -------------------------------------------- */
    .faq-section {
        padding: 20px 14px;
    }

    /* --- Contact ----------------------------------------- */
    .contact-section {
        padding: 20px 14px;
    }

    /* --- Events ------------------------------------------ */
    .events-section {
        padding: 20px 14px;
    }

    /* --- Newsletter -------------------------------------- */
    .newsletter-section {
        padding: 32px 14px;
    }

    /* --- Footer ------------------------------------------ */
    .footer {
        padding: 36px 12px 12px;
    }

    /* --- Nav brand --------------------------------------- */
    .brand h1 {
        font-size: 15px;
    }

    /* --- AI News page header ----------------------------- */
    .page-header {
        margin: 0 8px 16px;
        padding: 24px 14px;
    }

    /* --- Load more --------------------------------------- */
    .load-more-btn {
        font-size: 14px;
        padding: 13px 24px;
    }

    /* --- Section card padding ---------------------------- */
    .latest-news-card,
    .categories-card {
        padding: 16px;
    }
}


/* ============================================================
   11. @media (max-width: 360px)  — Extra-small Devices
   ============================================================ */

@media (max-width: 360px) {

    /* --- Global ------------------------------------------ */
    .main-content {
        padding: 8px;
    }

    /* --- Navbar ------------------------------------------ */
    .navbar {
        height: 56px;
    }

    .nav-container {
        padding: 0 10px;
    }

    .brand h1 {
        font-size: 14px;
    }

    .logo-icon {
        width: 32px;
        height: 30px;
    }

    .btn-subscribe {
        padding: 7px 12px;
        font-size: 12px;
    }

    /* --- Hero -------------------------------------------- */
    .hero-card {
        padding: 18px 12px;
        border-radius: 12px;
    }

    .hero-content h2 {
        font-size: 1.2rem;
    }

    .btn-yellow {
        font-size: 13px;
        padding: 10px 18px;
        gap: 8px;
    }

    /* --- Cards ------------------------------------------- */
    .news-list-item .item-content {
        padding: 14px;
    }

    .news-list-item h3 {
        font-size: 14px;
    }

    .news-list-item p {
        font-size: 13px;
    }

    /* --- Categories -------------------------------------- */
    .category-pill {
        font-size: 12px;
        padding: 9px 12px;
    }

    /* --- Footer ------------------------------------------ */
    .footer-container {
        gap: 20px;
    }

    .footer-brand h2 {
        font-size: 18px;
    }

    /* --- Contact ----------------------------------------- */
    .contact-socials a {
        width: 36px;
        height: 36px;
    }

    /* --- AI News ----------------------------------------- */
    .page-header {
        margin: 0 4px 12px;
        padding: 20px 12px;
    }

    .header-content h1 {
        font-size: 1.4rem;
    }

    .stat-value {
        font-size: 16px;
    }

    /* --- Filter pills ------------------------------------ */
    .filter-pill {
        font-size: 11px;
        padding: 6px 10px;
    }

    /* --- Sidebar ----------------------------------------- */
    .sidebar-widget {
        padding: 14px;
    }

    /* --- Scroll to top ----------------------------------- */
    .scroll-to-top {
        width: 40px;
        height: 40px;
        font-size: 16px;
        bottom: 16px;
        right: 12px;
    }

    /* --- Timeline ---------------------------------------- */
    .timeline {
        padding-left: 14px;
    }

    .timeline::before {
        left: 14px;
    }

    .timeline-dot {
        left: -8px;
        width: 10px;
        height: 10px;
    }

    .event-img {
        height: 160px;
    }
}


/* ============================================================
   12. Accessibility & Performance helpers
   ============================================================ */

/* Visible focus indicator */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline-offset: 2px;
}

/* Lazy-load images — prevent layout shift */
img[loading="lazy"] {
    background-color: #e2e8f0;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }

    .trending-list {
        animation: none !important;
    }
}

/* Ensure touch targets are at least 44×44 px */
@media (max-width: 992px) {
    a, button, [role="button"] {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Exception: inline text links */
    p a, li a, .breadcrumb a, .footer-col ul a,
    .compact-info a, .tag, .view-all {
        min-height: unset;
        display: inline;
    }
}

/* Scrollbar — thin on mobile browsers */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }

    ::-webkit-scrollbar-track {
        background: transparent;
    }

    ::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 4px;
    }
}

/* ============================================================
   13. MAGAZINE HERO — Responsive (all breakpoints)
   ============================================================
   The base desktop style in style.css sets:
     .magazine-hero { grid-template-columns: 210px 1fr 220px; }
   We progressively collapse this below.
   ============================================================ */

/* --- Light navbar responsive overrides -------------------- */
@media (max-width: 992px) {
    .navbar--light {
        height: 64px;
    }
    .hamburger-btn--light .bar {
        background: #0f172a;
    }
    .btn-join-newsletter {
        padding: 9px 18px;
        font-size: 13px;
    }
}

@media (max-width: 576px) {
    .navbar--light {
        height: 60px;
    }
    .btn-join-newsletter {
        padding: 8px 14px;
        font-size: 12px;
        white-space: nowrap;
    }
}

@media (max-width: 360px) {
    .btn-join-newsletter {
        padding: 7px 10px;
        font-size: 11px;
    }
}

/* ============================================================
   13a. max-width: 1200px — Shrink hero proportionally
   ============================================================ */

@media (max-width: 1200px) {
    .magazine-hero {
        grid-template-columns: 190px 1fr 200px;
        gap: 12px;
        min-height: 480px;
    }

    .mh-hero-img {
        height: 300px;
    }

    .mh-hero-caption h2 {
        font-size: clamp(1.1rem, 2.2vw, 1.5rem);
    }

    .mh-side-card {
        min-height: 190px;
    }

    .mh-side-body {
        padding: 8px 12px 36px;
    }

    .mh-side-body h3 {
        font-size: 13px;
    }

    .mh-right-desc {
        font-size: 13px;
    }
}

/* ============================================================
   13b. max-width: 1024px — Compact 3-col
   ============================================================ */

@media (max-width: 1024px) {
    .magazine-hero {
        grid-template-columns: 170px 1fr 185px;
        gap: 10px;
        min-height: 440px;
    }

    .mh-hero-img {
        height: 270px;
    }

    .mh-hero-caption {
        padding: 16px 18px 18px;
    }

    .mh-hero-caption h2 {
        font-size: clamp(1rem, 2vw, 1.35rem);
        margin-bottom: 10px;
    }

    .mh-side-card {
        min-height: 175px;
    }

    .mh-right {
        gap: 12px;
    }

    .mh-right-desc {
        font-size: 12.5px;
    }

    .mh-btn-read {
        padding: 8px 18px;
        font-size: 12px;
    }

    .mh-social-icon {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .mh-trending-bar {
        padding: 8px 16px;
    }

    .mh-trending-track {
        animation-duration: 22s;
    }

    .mh-trending-label {
        font-size: 12px;
        padding-right: 14px;
        margin-right: 14px;
    }
}

/* ============================================================
   13c. max-width: 992px — Tablet landscape: 2-col grid
   Left sidebar cards move below center+right
   ============================================================ */

@media (max-width: 992px) {
    .magazine-hero {
        grid-template-columns: 1fr 200px;
        grid-template-rows: auto auto;
        grid-template-areas:
            "center right"
            "left   left";
        gap: 12px;
        min-height: auto;
        align-items: start;
    }

    .mh-left   { grid-area: left;   flex-direction: row; gap: 12px; }
    .mh-center { grid-area: center; }
    .mh-right  { grid-area: right;  }

    .mh-left .mh-side-card {
        flex: 1 1 0;
        min-width: 0;
        min-height: 200px;
    }

    .mh-hero-img {
        height: 280px;
    }

    .mh-hero-caption h2 {
        font-size: clamp(1rem, 2.5vw, 1.4rem);
    }

    .mh-right {
        gap: 10px;
    }

    .mh-right-desc {
        font-size: 12.5px;
    }

    .mh-right-card {
        min-height: 160px;
    }

    .mh-trending-track {
        animation-duration: 18s;
    }

    /* Homepage rows: stack vertically at 992px to prevent tablet landscape overflow */
    .hp-row,
    .hp-row--cat-news,
    .hp-row--events-faq {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
        width: 100% !important;
    }

    .hp-categories-panel,
    .hp-newsletter-panel,
    .hp-events-panel,
    .hp-faq-panel {
        flex: 1 1 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    /* About section: 1-column layout on tablet */
    .hp-about-inner {
        grid-template-columns: 1fr !important;
        gap: 28px !important;
    }

    .hp-about-card {
        max-width: 100% !important;
        width: 100% !important;
    }

    .hp-about-pillars {
        grid-template-columns: 1fr 1fr !important;
    }
}


/* ============================================================
   13d. max-width: 768px — Tablet portrait: full single column
   ============================================================ */

@media (max-width: 768px) {
    .magazine-hero {
        display: flex;
        flex-direction: column;
        gap: 14px;
        min-height: auto;
    }

    .mh-center { order: 1; }
    .mh-right  { order: 2; }
    .mh-left   { order: 3; flex-direction: row; gap: 12px; }

    .mh-left .mh-side-card {
        flex: 1 1 0;
        min-width: 0;
        min-height: 200px;
    }

    /* Image: padding-bottom trick for responsive aspect ratio */
    .mh-hero-img-wrap {
        min-height: auto;
    }

    /* dn-slide: let height be driven by the mh-hero-img padding-bottom */
    .dn-slide {
        height: auto !important;
        display: block;
    }

    .mh-hero-img {
        height: 0;
        padding-bottom: 56.25%;
        background-size: cover;
        background-position: center;
        border-radius: 20px 20px 0 0;
    }

    /* The overlay is already position:absolute inset:0 — still works */

    .mh-hero-caption {
        padding: 18px 20px 20px;
        border-radius: 0 0 20px 20px;
    }

    .mh-hero-caption h2 {
        font-size: clamp(1.05rem, 4vw, 1.45rem);
        margin-bottom: 10px;
    }

    .mh-hero-meta p {
        font-size: 12px;
    }

    /* Right panel — horizontal wrap */
    .mh-right {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 14px;
    }

    .mh-right-desc {
        flex: 1 1 55%;
        font-size: 13px;
    }

    .mh-right-actions {
        flex: 1 1 auto;
        flex-wrap: wrap;
        gap: 10px;
    }

    .mh-right-card {
        flex: 1 1 100%;
        min-height: 180px;
    }

    /* Touch-friendly social icons */
    .mh-social-icon {
        width: 44px;
        height: 44px;
        font-size: 15px;
    }

    .mh-btn-read {
        min-height: 44px;
        padding: 10px 22px;
        font-size: 13px;
    }

    /* Trending bar */
    .mh-trending-bar {
        border-radius: 14px;
        padding: 8px 14px;
        overflow: hidden;
    }

    .mh-trending-track-wrap {
        overflow: hidden;
    }

    /* Faster trending ticker speed on tablet / mobile */
    .mh-trending-track {
        animation-duration: 14s;
    }

    .mh-trending-label {
        font-size: 12px;
        padding-right: 12px;
        margin-right: 12px;
    }

    /* Homepage rows: stack vertically */
    .hp-row,
    .hp-row--cat-news,
    .hp-row--events-faq {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
        width: 100% !important;
    }

    .hp-categories-panel,
    .hp-newsletter-panel,
    .hp-events-panel,
    .hp-faq-panel {
        flex: 1 1 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .hp-panel-header {
        flex-direction: column !important;
        gap: 10px !important;
        align-items: flex-start !important;
    }

    .hp-newsletter-panel {
        min-height: auto;
    }

    .hp-event-arrow {
        display: none !important;
    }

    .hp-contact-banner {
        padding: 30px 18px !important;
    }

    .hp-contact-content {
        flex-direction: column !important;
        gap: 20px !important;
        text-align: center;
    }

    .hp-contact-text {
        max-width: 100% !important;
    }

    .hp-contact-items {
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100%;
        text-align: left;
    }

    .hp-contact-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================
   13e. max-width: 576px — Large mobile
   ============================================================ */

@media (max-width: 576px) {
    .magazine-hero {
        gap: 12px;
    }

    .mh-left {
        gap: 10px;
    }

    .mh-left .mh-side-card {
        min-height: 180px;
    }

    .mh-side-body h3 {
        font-size: clamp(12px, 3.5vw, 14px);
    }

    .mh-hero-img {
        padding-bottom: 60%;
    }

    .mh-hero-caption {
        padding: 14px 16px 16px;
    }

    .mh-hero-caption h2 {
        font-size: clamp(1rem, 4.5vw, 1.3rem);
        margin-bottom: 8px;
    }

    .mh-avatar {
        width: 26px;
        height: 26px;
    }

    .mh-hero-meta {
        gap: 10px;
    }

    .mh-hero-meta p {
        font-size: 11.5px;
    }

    .mh-right {
        flex-direction: column;
        gap: 12px;
    }

    .mh-right-desc {
        font-size: 13px;
        flex: 1 1 auto;
    }

    .mh-right-actions {
        align-items: flex-start;
    }

    .mh-right-card {
        min-height: 170px;
    }

    .mh-slider-dots {
        bottom: 90px;
    }

    /* Trending — brisk ticker motion */
    .mh-trending-bar {
        padding: 7px 12px;
        border-radius: 12px;
    }

    .mh-trending-track {
        animation-duration: 12s;
    }

    .mh-trend-chip {
        font-size: 11px;
        padding: 5px 10px 5px 5px;
        gap: 6px;
    }

    .mh-trend-chip-img {
        width: 22px;
        height: 22px;
    }

    .mh-trending-label {
        font-size: 11px;
        gap: 4px;
        padding-right: 10px;
        margin-right: 10px;
    }

    /* Home panels */
    .hp-panel-title {
        font-size: clamp(1.2rem, 5vw, 1.5rem);
    }

    .hp-cat-grid {
        gap: 10px;
        padding-bottom: 12px;
    }

    .hp-cat-grid::-webkit-scrollbar {
        height: 4px;
    }

    .hp-cat-card {
        flex: 0 0 210px;
        height: 190px;
    }

    .hp-nl-title {
        font-size: clamp(1.4rem, 6vw, 1.8rem);
    }

    .hp-nl-body {
        padding: 22px 18px 18px;
    }

    /* About section mobile styling */
    .hp-about-section {
        padding: 28px 16px !important;
        border-radius: 16px !important;
    }

    .hp-about-pillars {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .hp-about-pillar {
        padding: 12px 14px !important;
    }
}


/* ============================================================
   13f. max-width: 480px — Small mobile
   ============================================================ */

@media (max-width: 480px) {
    /* Stack left cards vertically when side-by-side gets too cramped */
    .mh-left {
        flex-direction: column;
        gap: 10px;
    }

    .mh-left .mh-side-card {
        min-height: 190px;
        flex: none;
        width: 100%;
    }

    .mh-hero-img {
        padding-bottom: 62%;
    }

    .mh-hero-caption h2 {
        font-size: clamp(0.95rem, 5vw, 1.2rem);
    }

    .mh-right-card {
        width: 100%;
    }

    .mh-trending-bar {
        padding: 6px 10px;
    }

    .mh-trending-track {
        animation-duration: 10s;
    }

    .mh-trending-label {
        display: none;
    }

    .hp-categories-panel,
    .hp-events-panel,
    .hp-faq-panel {
        padding: 20px 16px;
    }

    .hp-nl-body {
        padding: 18px 14px 14px;
    }
}

/* ============================================================
   13g. max-width: 360px — Minimum-width mobile
   ============================================================ */

@media (max-width: 360px) {
    .magazine-hero {
        gap: 10px;
    }

    .mh-left .mh-side-card {
        min-height: 170px;
    }

    .mh-hero-img {
        padding-bottom: 65%;
    }

    .mh-hero-caption {
        padding: 12px 14px 14px;
    }

    .mh-hero-caption h2 {
        font-size: 1rem;
        margin-bottom: 6px;
    }

    .mh-hero-meta p {
        font-size: 11px;
    }

    .mh-btn-read {
        font-size: 12px;
        padding: 9px 16px;
    }

    .mh-social-icon {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    .mh-right-desc {
        font-size: 12px;
    }

    .mh-right-card {
        min-height: 155px;
    }

    .mh-side-body h3 {
        font-size: 12px;
    }

    .mh-badge {
        font-size: 9px;
        padding: 3px 8px;
    }

    .mh-trending-track {
        animation-duration: 9s;
    }

    .mh-trend-chip {
        font-size: 10px;
        padding: 4px 8px 4px 4px;
    }

    .hp-panel-title {
        font-size: 1.1rem;
    }
}

/* ============================================================
   14. Overflow / layout safety guards & Motion enhancements
   ============================================================ */

/* Critical: prevent grid/flex children and main containers from overflowing */
.magazine-hero,
.mh-left,
.mh-center,
.mh-right,
.mh-hero-img-wrap,
.mh-side-card,
.mh-right-card,
.mh-trending-bar,
.hp-row,
.hp-row--cat-news,
.hp-row--events-faq,
.hp-categories-panel,
.hp-newsletter-panel,
.hp-events-panel,
.hp-faq-panel,
.hp-contact-banner,
.hp-about-section,
.hp-about-inner,
.hp-about-card,
.footer-container {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}


/* Images never cause horizontal scroll */
.mh-hero-img-wrap img,
.mh-side-bg {
    max-width: 100%;
}

/* Trending bar scroll container never causes page-level overflow */
.mh-trending-bar {
    max-width: 100%;
}

/* Trending track motion enhancements */
.mh-trending-track {
    will-change: transform;
}

.mh-trending-track:hover,
.mh-trending-track:active {
    animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
    .mh-trending-track {
        animation: none !important;
    }
}

/* ============================================================
   14. AI NEWS PAGE — Complete Cross-Device Responsiveness
   ============================================================ */

/* Universal guard: prevent horizontal layout breakage */
.ai-news-portal-container,
.ai-discovery-panel,
.ai-categories-container,
.ai-filter-chips,
.ai-editors-section,
.ai-latest-strip-wrap,
.ai-all-news-grid-section,
.news-list-grid,
.news-list-item,
.ai-newsletter-section {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

/* Category horizontal scrolling optimization */
.ai-categories-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.ai-filter-chips {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
    scroll-behavior: smooth;
}

/* --- 1024px Breakpoint (Tablet Landscape / Small Laptops) --- */
@media (max-width: 1024px) {
    .ai-news-portal-container {
        padding: 30px 20px 50px;
    }

    .ai-portal-hero h1 {
        font-size: 2.3rem;
    }

    .ai-editors-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }

    .ai-latest-items-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }

    .news-list-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
}

/* --- 768px Breakpoint (Tablet Portrait / Large Mobile) --- */
@media (max-width: 768px) {
    .ai-news-portal-container {
        padding: 24px 16px 44px;
    }

    .ai-portal-hero {
        margin-bottom: 24px;
    }

    .ai-portal-hero h1 {
        font-size: 1.95rem;
    }

    .ai-portal-hero p {
        font-size: 1rem;
    }

    /* Discovery panel */
    .ai-discovery-panel {
        padding: 18px 16px;
        border-radius: 16px;
        margin-bottom: 32px;
    }

    .ai-search-row {
        margin-bottom: 16px;
    }

    .ai-search-input {
        height: 46px;
        font-size: 14px;
        padding: 0 40px 0 44px;
    }

    .ai-search-icon {
        font-size: 15px;
        left: 16px;
    }

    /* Category Filter Chips */
    .ai-categories-container {
        margin-bottom: 14px;
    }

    .ai-filter-chips {
        gap: 7px;
        padding: 2px 2px 8px;
    }

    .ai-filter-chips::-webkit-scrollbar {
        height: 4px;
    }

    .ai-category-chip {
        padding: 7px 15px;
        font-size: 13px;
        flex-shrink: 0;
    }

    /* Controls Bar: Results Count & Sort */
    .ai-controls-bar {
        padding-top: 12px;
        gap: 10px;
    }

    .ai-results-count {
        font-size: 13px;
    }

    .ai-sort-wrap {
        gap: 8px;
    }

    .ai-sort-label {
        font-size: 12.5px;
    }

    .ai-sort-select {
        font-size: 13px;
        padding: 6px 12px;
    }

    /* Section Headings */
    .ai-section-heading {
        margin-bottom: 18px;
    }

    .ai-section-heading-text h2 {
        font-size: 1.45rem;
    }

    .ai-section-heading-text p {
        font-size: 13px;
    }

    /* Editor's Picks */
    .ai-editors-section {
        margin-bottom: 36px;
    }

    .ai-editors-grid {
        grid-template-columns: 1fr !important;
        gap: 18px !important;
    }

    .ai-editor-card {
        border-radius: 16px;
    }

    .ai-editor-img-wrap {
        height: 200px;
    }

    .ai-editor-body {
        padding: 20px 18px;
    }

    .ai-editor-title {
        font-size: 1.1rem;
    }

    /* Latest Updates Strip */
    .ai-latest-strip-wrap {
        padding: 18px 16px;
        border-radius: 16px;
        margin-bottom: 36px;
    }

    .ai-latest-items-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .ai-latest-item {
        padding: 6px 4px;
    }

    .ai-latest-thumb {
        width: 56px;
        height: 56px;
    }

    /* All AI News Articles Grid & Cards */
    .ai-all-news-grid-section {
        margin-bottom: 20px;
    }

    .news-list-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        margin-bottom: 32px;
    }

    .news-list-item {
        border-radius: 16px;
    }

    .news-list-item .img-wrapper {
        height: 190px;
    }

    .news-list-item .item-content {
        padding: 18px 16px;
    }

    .card-title {
        font-size: 1.05rem;
    }

    .card-desc {
        font-size: 13.5px;
        margin-bottom: 14px;
    }

    .ai-load-more-wrap {
        margin: 24px 0 44px;
    }

    .ai-load-more-btn {
        padding: 11px 26px;
        font-size: 14px;
    }

    /* Newsletter section */
    .ai-newsletter-section {
        padding: 38px 22px;
        border-radius: 18px;
        margin-bottom: 44px;
    }

    .ai-newsletter-content h2 {
        font-size: 1.8rem;
    }

    .ai-newsletter-content p {
        font-size: 0.95rem;
        margin-bottom: 22px;
    }

    .ai-newsletter-form {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .ai-newsletter-input,
    .ai-newsletter-btn {
        height: 48px;
        font-size: 14px;
        width: 100%;
    }

    .ai-newsletter-btn {
        justify-content: center;
    }
}

/* --- 576px Breakpoint (Mobile standard) --- */
@media (max-width: 576px) {
    .ai-news-portal-container {
        padding: 18px 12px 36px;
    }

    .ai-portal-hero h1 {
        font-size: clamp(1.5rem, 6vw, 1.75rem);
        margin-bottom: 8px;
    }

    .ai-portal-hero p {
        font-size: 13.5px;
        line-height: 1.5;
    }

    .ai-portal-badge {
        font-size: 11px;
        padding: 4px 12px;
        margin-bottom: 10px;
    }

    /* Discovery panel on mobile */
    .ai-discovery-panel {
        padding: 14px 12px;
        border-radius: 14px;
        margin-bottom: 24px;
    }

    .ai-search-row {
        margin-bottom: 12px;
    }

    .ai-search-input {
        height: 44px;
        font-size: 13.5px;
        padding: 0 36px 0 38px;
    }

    .ai-search-icon {
        left: 14px;
        font-size: 13.5px;
    }

    .ai-search-clear {
        right: 10px;
        width: 22px;
        height: 22px;
        font-size: 11px;
    }

    /* Category filter chips mobile display */
    .ai-categories-container {
        margin-bottom: 12px;
    }

    .ai-filter-chips {
        gap: 6px;
        padding: 2px 1px 8px;
    }

    .ai-category-chip {
        padding: 6px 13px;
        font-size: 12px;
        border-radius: 50px;
    }

    /* Controls bar flex adjustments */
    .ai-controls-bar {
        padding-top: 10px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
    }

    .ai-results-count {
        font-size: 12px;
    }

    .ai-sort-wrap {
        gap: 6px;
    }

    .ai-sort-label {
        font-size: 11.5px;
        display: none;
    }

    .ai-sort-select {
        font-size: 12.5px;
        padding: 5px 10px;
        border-radius: 8px;
    }

    /* Section Headings */
    .ai-section-heading-text h2 {
        font-size: 1.25rem;
    }

    .ai-section-heading-text p {
        font-size: 12.5px;
    }

    /* Editor's Picks */
    .ai-editors-section {
        margin-bottom: 28px;
    }

    .ai-editor-card {
        border-radius: 14px;
    }

    .ai-editor-img-wrap {
        height: 180px;
    }

    .ai-editor-badge {
        font-size: 10px;
        padding: 3px 9px;
        top: 10px;
        left: 10px;
    }

    .ai-editor-pick-tag {
        font-size: 9.5px;
        padding: 2px 8px;
        top: 10px;
        right: 10px;
    }

    .ai-editor-body {
        padding: 16px 14px;
    }

    .ai-editor-meta {
        font-size: 11.5px;
        gap: 8px;
        margin-bottom: 8px;
    }

    .ai-editor-title {
        font-size: 1.02rem;
        margin-bottom: 8px;
        line-height: 1.35;
    }

    .ai-editor-desc {
        font-size: 13px;
        line-height: 1.5;
        margin-bottom: 14px;
        -webkit-line-clamp: 2;
    }

    .ai-editor-footer {
        padding-top: 12px;
    }

    .btn-read-more {
        padding: 6px 12px;
        font-size: 11.5px;
    }

    .btn-card-share {
        padding: 6px 10px;
        font-size: 11.5px;
    }

    /* Latest strip */
    .ai-latest-strip-wrap {
        padding: 14px 12px;
        border-radius: 14px;
        margin-bottom: 28px;
    }

    .ai-latest-strip-header h3 {
        font-size: 0.95rem;
    }

    .ai-latest-thumb {
        width: 50px;
        height: 50px;
        border-radius: 8px;
    }

    .ai-latest-cat {
        font-size: 10px;
    }

    .ai-latest-headline {
        font-size: 12px;
    }

    .ai-latest-time {
        font-size: 11px;
    }

    /* All AI News Grid */
    .news-list-grid {
        gap: 16px !important;
        margin-bottom: 24px;
    }

    .news-list-item {
        border-radius: 14px;
    }

    .news-list-item .img-wrapper {
        height: 175px;
    }

    .news-list-item .item-content {
        padding: 15px 13px;
    }

    .news-list-item h3,
    .card-title {
        font-size: 1rem;
        margin-bottom: 6px;
        line-height: 1.35;
    }

    .news-list-item p,
    .card-desc {
        font-size: 13px;
        line-height: 1.5;
        margin-bottom: 12px;
        -webkit-line-clamp: 2;
    }

    .item-meta-top {
        font-size: 11px;
        gap: 8px;
        margin-bottom: 6px;
    }

    .news-list-item .item-footer {
        padding-top: 10px;
    }

    .card-views-badge {
        font-size: 11px;
        padding: 3px 8px;
    }

    .reading-time-pill {
        font-size: 10px;
        padding: 2px 7px;
        top: 10px;
        right: 10px;
    }

    .news-list-item .category-badge.small {
        font-size: 10px;
        padding: 3px 8px;
        top: 10px;
        left: 10px;
    }

    .ai-load-more-btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
        padding: 10px 20px;
        font-size: 13.5px;
    }

    /* Newsletter */
    .ai-newsletter-section {
        padding: 28px 16px;
        border-radius: 16px;
        margin-bottom: 32px;
    }

    .ai-newsletter-content h2 {
        font-size: 1.5rem;
    }

    .ai-newsletter-content p {
        font-size: 13px;
        margin-bottom: 18px;
    }

    .ai-newsletter-badge {
        font-size: 10px;
        padding: 4px 10px;
        margin-bottom: 10px;
    }

    .ai-newsletter-input,
    .ai-newsletter-btn {
        height: 44px;
        font-size: 13.5px;
    }

    /* Share toast */
    .ai-share-toast {
        width: calc(100% - 32px);
        max-width: 320px;
        font-size: 12.5px;
        padding: 9px 16px;
        bottom: 18px;
    }
}

/* --- 380px Breakpoint (Extra small mobile devices) --- */
@media (max-width: 380px) {
    .ai-controls-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .ai-sort-wrap {
        justify-content: space-between;
        width: 100%;
    }

    .ai-sort-label {
        display: inline-block;
    }

    .ai-sort-select {
        flex: 1;
        max-width: 180px;
    }
}


