/**
 * Mobile app chrome: fixed header, fixed dock, sticky checkout, app footer,
 * home article row, blog archive cards.
 * Aggressive layout rules stay inside max-width 782px.
 */

@media (min-width: 783px) {
    .nof-app-footer,
    .nof-co-step-bar,
    .nof-ty-pdf-bar {
        display: none !important;
    }

    .nof-blog-modern-root {
        overflow-x: clip;
    }

    .nof-blog-filter-pills {
        max-width: 100%;
    }

    .nof-archive-pagination .page-numbers {
        min-width: 40px;
        min-height: 40px;
    }

    .nof-bcm-fallback,
    .nof-bc-fallback {
        display: block;
        width: 100%;
        height: 100%;
        min-height: 180px;
        background: linear-gradient(135deg, #0f172a, #7b2fbe 80%, #ff6b00);
    }
}

@media (max-width: 782px) {
    :root {
        --nof-app-top: 64px;
        --nof-dock-h: 72px;
        --nof-sticky-h: 0px;
    }

    body.home {
        --nof-app-top: 176px;
    }

    body.woocommerce-cart,
    body.woocommerce-checkout:not(.woocommerce-order-received),
    body.single-product {
        --nof-sticky-h: 78px;
    }

    body.woocommerce-order-received {
        --nof-sticky-h: 68px !important;
    }

    html,
    body {
        overflow-x: clip;
        max-width: 100%;
    }

    body {
        padding-top: var(--nof-app-top) !important;
        padding-bottom: calc(var(--nof-dock-h) + var(--nof-sticky-h) + 16px + env(safe-area-inset-bottom)) !important;
        box-sizing: border-box;
    }

    #nof-header,
    #nofTopBar {
        display: none !important;
    }

    body.home .nof-mobile-app-bar {
        display: block !important;
    }

    body.single-product .nof-app-sp-topbar,
    body.woocommerce-cart .nof-app-sp-topbar,
    body.woocommerce-checkout:not(.woocommerce-order-received) .nof-app-sp-topbar {
        display: flex !important;
    }

    body.woocommerce-order-received .nof-app-innerbar {
        display: flex !important;
    }

    body.woocommerce-order-received .nof-mobile-app-bar,
    body.woocommerce-order-received .nof-app-sp-topbar {
        display: none !important;
    }

    .nof-mobile-app-bar,
    .nof-app-innerbar,
    .nof-app-sp-topbar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        box-sizing: border-box;
        z-index: 10080 !important;
        background: #fff;
    }

    body .mobile-app-bottom-bar,
    nav#mobileAppBottomBar {
        display: flex !important;
        position: fixed !important;
        top: auto !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        transform: none !important;
        z-index: 10050 !important;
    }

    .nof-cart-wrapper .nof-app-sticky-buy-bar,
    .nof-co-v2 .nof-app-sticky-buy-bar,
    body.single-product .nof-app-sticky-buy-bar,
    .nof-co-step-bar {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: var(--nof-dock-h) !important;
        width: 100% !important;
        max-width: none !important;
        z-index: 10040 !important;
        box-sizing: border-box;
        border-radius: 16px 16px 0 0 !important;
        display: flex !important;
        gap: 8px;
        align-items: center;
        background: #fff;
        padding: 10px 12px !important;
        box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
    }

    .nof-co-step-bar [hidden] {
        display: none !important;
    }

    .nof-co-step-bar .nof-co-prev,
    .nof-co-step-bar .nof-co-next,
    .nof-co-step-bar .nof-co-pay {
        min-height: 48px;
        border-radius: 14px;
        font-weight: 800;
        font-family: inherit;
        cursor: pointer;
    }

    .nof-co-step-bar .nof-co-prev {
        flex: 0 0 auto;
        background: #fff;
        color: #0f172a;
        border: 1px solid #e2e8f0;
        padding: 0 14px;
    }

    .nof-co-step-bar .nof-co-next,
    .nof-co-step-bar .nof-co-pay {
        flex: 1 1 auto;
        border: 0;
        color: #fff;
        background: linear-gradient(135deg, #ff6b00, #f59e0b);
    }

    .nof-wizard-nav-btns,
    .nof-desktop-checkout-btn {
        display: none !important;
    }

    body.woocommerce-checkout:not(.woocommerce-order-received) #place_order {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        padding: 0 !important;
        margin: -1px !important;
        overflow: hidden !important;
        clip: rect(0, 0, 0, 0) !important;
        clip-path: inset(50%) !important;
        white-space: nowrap !important;
        border: 0 !important;
    }

    #havinWidget,
    .havin-widget.bb-ai-widget {
        bottom: calc(var(--nof-dock-h) + var(--nof-sticky-h) + 12px) !important;
        z-index: 10060 !important;
    }

    /* ── App footer (desktop footer stays .footer-inner) ── */
    #nof-footer .footer-inner {
        display: none !important;
    }

    #nof-footer {
        background: #0f172a;
        color: #e2e8f0;
        margin: 0;
        padding: 0;
    }

    .nof-app-footer {
        display: block;
        padding: 20px 16px 8px;
        direction: rtl;
    }

    .nof-app-footer-brand {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 14px;
    }

    .nof-app-footer-brand strong {
        display: block;
        color: #fff;
        font-size: 1.05rem;
    }

    .nof-app-footer-brand p {
        margin: 4px 0 0;
        color: #cbd5e1;
        font-size: 0.82rem;
        line-height: 1.6;
    }

    .nof-app-footer-icons {
        display: flex;
        gap: 10px;
        margin-bottom: 14px;
    }

    .nof-app-footer-icons a {
        width: 44px;
        height: 44px;
        border-radius: 14px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: #1e293b;
        color: #ffd600;
        border: 1px solid rgba(255, 214, 0, 0.25);
    }

    .nof-app-acc {
        background: #1e293b;
        border-radius: 16px;
        margin-bottom: 8px;
        overflow: hidden;
    }

    .nof-app-acc summary {
        list-style: none;
        cursor: pointer;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 14px;
        font-weight: 800;
        color: #fff;
    }

    .nof-app-acc summary::-webkit-details-marker {
        display: none;
    }

    .nof-app-acc summary::after {
        content: "";
        width: 8px;
        height: 8px;
        border-left: 2px solid #ff6b00;
        border-bottom: 2px solid #ff6b00;
        transform: rotate(-45deg);
        margin-inline-start: 8px;
    }

    .nof-app-acc[open] summary::after {
        transform: rotate(135deg);
    }

    .nof-app-acc-body {
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 0 8px 10px;
    }

    .nof-app-acc-body a,
    .nof-app-acc-body p {
        color: #e2e8f0;
        text-decoration: none;
        padding: 8px 8px;
        margin: 0;
        border-radius: 10px;
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .nof-app-footer-trust {
        display: flex;
        justify-content: flex-start;
        margin-top: 12px;
    }

    .nof-app-footer-trust img {
        background: #fff;
        border-radius: 12px;
        padding: 4px;
        width: 56px;
        height: auto;
    }

    .nof-app-footer-copy {
        margin: 12px 0 0;
        color: #94a3b8;
        font-size: 0.75rem;
    }

    /* ── Home articles: swipe row, desktop grid stays in style.css ── */
    .nof-blog-sec .nof-home-articles,
    .nof-blog-sec .nof-blog-grid {
        display: flex !important;
        grid-template-columns: none !important;
        gap: 12px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding: 4px 16px 8px;
        margin-top: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .nof-blog-sec .nof-home-articles::-webkit-scrollbar,
    .nof-blog-sec .nof-blog-grid::-webkit-scrollbar {
        display: none;
    }

    .nof-blog-sec .nof-home-articles .nof-blog-card,
    .nof-blog-sec .nof-blog-grid .nof-blog-card {
        flex: 0 0 78%;
        scroll-snap-align: start;
        min-width: 0;
        background: #fff;
        border-radius: 20px;
        border: 1px solid #e8eef5;
        box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
    }

    .nof-bc-img {
        position: relative;
        aspect-ratio: 16 / 10;
        background: #0f172a;
        overflow: hidden;
    }

    .nof-bc-img img,
    .nof-bc-fallback {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    .nof-bc-fallback {
        background: linear-gradient(135deg, #0f172a, #7b2fbe 70%, #ff6b00);
    }

    .nof-bc-excerpt {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .nof-home-articles-empty {
        flex: 1 0 100%;
        background: #fff;
        border-radius: 18px;
        padding: 20px;
        border: 1px solid #e8eef5;
    }

    /* ── Blog index and category/tag/author archives ── */
    .nof-blog-modern-root {
        max-width: 100%;
        overflow-x: clip;
        padding-bottom: 8px;
        background: #fafbff;
    }

    .nof-blog-modern-root .nof-blog-hero-section,
    .nof-blog-modern-root .nof-blog-hero-section::before,
    .nof-blog-modern-root::before {
        background: transparent !important;
        box-shadow: none !important;
    }

    .nof-blog-modern-root .nof-blog-hero-section::before,
    .nof-blog-modern-root::before {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }

    .nof-blog-modern-root .nof-blog-hero-section {
        padding: 8px 0 0 !important;
        margin: 0 !important;
    }

    .nof-blog-modern-root .nof-blog-hero-content {
        max-width: 100%;
        padding: 0 16px;
        box-sizing: border-box;
    }

    .nof-blog-modern-root .nof-blog-hero-title,
    .nof-blog-modern-root .nof-blog-hero-title span {
        color: #0f172a !important;
        font-size: 1.28rem !important;
        line-height: 1.45 !important;
    }

    .nof-blog-modern-root .nof-blog-hero-desc,
    .nof-blog-modern-root .nof-sp-breadcrumb,
    .nof-blog-modern-root .nof-sp-breadcrumb a {
        color: #64748b !important;
        font-size: 0.86rem;
    }

    .nof-blog-modern-root .nof-blog-kicker-badge {
        background: #fff7ed;
        color: #c2410c;
    }

    .nof-blog-modern-root .nof-blog-search-form,
    .nof-blog-modern-root .nof-bs-input-wrap {
        max-width: 100%;
    }

    .nof-blog-modern-root .nof-blog-filter-pills {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        gap: 8px;
        margin: 12px -16px 4px;
        padding: 2px 16px 10px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        max-width: none;
    }

    .nof-blog-modern-root .nof-blog-filter-pills::-webkit-scrollbar {
        display: none;
    }

    .nof-blog-modern-root .nof-blog-filter-pill {
        flex: 0 0 auto;
        min-height: 40px;
        border-radius: 999px;
        background: #fff !important;
        color: #0f172a !important;
        border: 1px solid #e2e8f0 !important;
        white-space: nowrap;
        padding: 0 14px;
    }

    .nof-blog-modern-root .nof-blog-filter-pill.active {
        background: #ff6b00 !important;
        color: #fff !important;
        border-color: #ff6b00 !important;
    }

    .nof-blog-modern-root .nof-featured-spotlight {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none !important;
        margin: 8px 16px 14px !important;
        border-radius: 22px;
        overflow: hidden;
        background: #fff;
        border: 1px solid #e8eef5;
        box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
        max-width: calc(100% - 32px);
    }

    .nof-blog-modern-root .nof-spotlight-img-link {
        display: block;
        height: 200px;
        position: relative;
        background: #0f172a;
    }

    .nof-blog-modern-root .nof-spotlight-img-link img,
    .nof-blog-modern-root .nof-bcm-fallback {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    .nof-bcm-fallback {
        min-height: 180px;
        background: linear-gradient(135deg, #0f172a, #7b2fbe 72%, #ff6b00);
    }

    .nof-blog-modern-root .nof-spotlight-body {
        padding: 14px 14px 16px;
    }

    .nof-blog-modern-root .nof-spotlight-title,
    .nof-blog-modern-root .nof-spotlight-title a {
        color: #0f172a;
        font-size: 1.12rem;
        line-height: 1.5;
    }

    .nof-blog-modern-root .nof-spotlight-excerpt,
    .nof-blog-modern-root .nof-bcm-excerpt {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        color: #475569;
    }

    .nof-blog-modern-root .nof-blog-modern-grid {
        display: flex !important;
        flex-direction: column;
        gap: 14px;
        padding: 0 16px;
        margin: 0;
        max-width: 100%;
        box-sizing: border-box;
    }

    .nof-blog-modern-root .nof-blog-card-modern {
        display: flex;
        flex-direction: column;
        width: 100%;
        min-width: 0;
        background: #fff;
        border-radius: 20px;
        overflow: hidden;
        border: 1px solid #e8eef5;
        box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
    }

    .nof-blog-modern-root .nof-bcm-media {
        display: block;
        position: relative;
        height: 180px;
        background: #0f172a;
    }

    .nof-blog-modern-root .nof-bcm-media img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .nof-blog-modern-root .nof-bcm-cat {
        position: absolute;
        top: 12px;
        right: 12px;
        background: #ff6b00;
        color: #fff;
        border-radius: 999px;
        padding: 4px 10px;
        font-size: 0.75rem;
        font-weight: 800;
    }

    .nof-blog-modern-root .nof-bcm-body {
        padding: 12px 14px 14px;
    }

    .nof-blog-modern-root .nof-bcm-title,
    .nof-blog-modern-root .nof-bcm-title a {
        color: #0f172a;
        font-size: 1.02rem;
        line-height: 1.5;
        margin: 6px 0;
    }

    .nof-blog-modern-root .nof-bcm-meta {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
        color: #64748b;
        font-size: 0.78rem;
    }

    .nof-blog-modern-root .nof-archive-pagination {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
        padding: 18px 16px 8px;
    }

    .nof-blog-modern-root .nof-archive-pagination .page-numbers {
        min-width: 44px;
        min-height: 44px;
        padding: 0 12px;
        box-sizing: border-box;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 14px;
        background: #fff;
        border: 1px solid #e8eef5;
        color: #0f172a;
        font-weight: 800;
        text-decoration: none;
    }

    .nof-blog-modern-root .nof-archive-pagination .page-numbers.current {
        background: #ff6b00;
        border-color: #ff6b00;
        color: #fff;
    }

    .nof-archive-empty {
        margin: 16px;
        text-align: center;
        padding: 28px 16px;
        background: #fff;
        border-radius: 20px;
        border: 1px solid #e8eef5;
    }
}
