/*
 * NetworkUstad mobile and tablet polish.
 * Loaded after the site, homepage, landing-page and certification stylesheets
 * so these rules form one consistent responsive layer without editing the
 * original desktop design system.
 */

/* Alternate hero copy is hidden on desktop and exposed only at phone widths. */
.nu-hp-hero-copy-mobile { display: none !important; }

@media (max-width: 1023px) {
    .nu-header-inner { gap: 12px; }
    .nu-mobile-toggle { display: inline-flex !important; }
    .nu-nav { display: none !important; }
}

@media (max-width: 767px) {
    html { scroll-padding-top: 76px; }
    body.nu-standalone-theme,
    body.nu-theme { width: 100%; max-width: 100%; overflow-x: clip; }

    /* Header: preserve the actual brand name on small screens. */
    .nu-header {
        top: 0 !important;
        z-index: 9999 !important;
        padding: 0 !important;
        background: rgba(255,255,255,.96) !important;
        border-bottom: 1px solid rgba(15,23,42,.08) !important;
        box-shadow: 0 3px 14px rgba(15,23,42,.045);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }
    .nu-header > .nu-container { padding-left: 14px !important; padding-right: 14px !important; }
    .nu-header-inner { height: 64px !important; min-height: 64px; gap: 7px !important; }
    .nu-header-inner > div:first-child { min-width: 0; gap: 6px !important; }
    .nu-header .nu-logo { min-width: 0; gap: 7px; }
    .nu-header .nu-logo-icon { width: 33px; height: 33px; border-radius: 9px; }
    .nu-header .nu-logo-text {
        display: block !important;
        color: #102033 !important;
        font-size: 14px !important;
        font-weight: 800 !important;
        line-height: 1.05 !important;
        letter-spacing: -.035em !important;
        white-space: nowrap;
    }
    .nu-header .nu-logo > span:last-child > span:last-child { display: none !important; }
    .nu-header .nu-logo-text .nu-highlight { color: #0d827d !important; }
    .nu-header-actions { flex: 0 0 auto; gap: 1px !important; }
    .nu-header-actions > #nu-search-actions,
    .nu-header-actions > #nu-theme-toggle { flex: 0 0 auto; }
    .nu-header-actions .nu-icon-btn,
    .nu-header-actions > .nu-icon-btn { width: 33px; height: 36px; border-radius: 9px; }
    .nu-header-actions .nu-icon-btn svg { width: 17px; height: 17px; }
    .nu-mobile-toggle {
        width: 35px !important;
        height: 35px !important;
        flex: 0 0 35px;
        border-radius: 10px !important;
        background: #f1f5f9 !important;
        color: #1e293b !important;
    }
    .nu-mobile-toggle svg { width: 19px !important; height: 19px !important; }

    /* Cleaner, wider drawer with a proper backdrop and touch-friendly rows. */
    .nu-mobile-overlay {
        z-index: 10000 !important;
        background: rgba(5,13,27,.62) !important;
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
    }
    .nu-mobile-menu {
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: min(92vw, 360px) !important;
        max-width: calc(100vw - 18px) !important;
        z-index: 10001 !important;
        overflow: hidden;
        background: #fff !important;
        color: #152238 !important;
        border-radius: 0 22px 22px 0;
        box-shadow: 18px 0 54px rgba(0,0,0,.2);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .nu-mobile-menu-header {
        min-height: 72px;
        padding: 16px 18px !important;
        background: #f8fafc;
        border-bottom: 1px solid #e7edf3 !important;
    }
    .nu-mobile-menu-header .nu-logo-text { display: block !important; font-size: 16px !important; color: #102033 !important; }
    .nu-mobile-menu-header .nu-logo-icon { width: 34px; height: 34px; border-radius: 10px; }
    .nu-mobile-menu-header .nu-icon-btn {
        width: 38px; height: 38px; border-radius: 11px;
        background: #eaf0f5; color: #233247;
    }
    .nu-mobile-nav {
        display: flex;
        flex-direction: column;
        gap: 5px;
        padding: 14px 14px 22px !important;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    .nu-mobile-nav::before {
        content: 'EXPLORE NETWORKUSTAD';
        display: block;
        padding: 7px 12px 10px;
        color: #8a98a9;
        font-size: 10px;
        font-weight: 800;
        letter-spacing: .12em;
    }
    .nu-mobile-nav a {
        min-height: 46px;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 11px 13px !important;
        border: 1px solid transparent;
        border-radius: 12px !important;
        color: #34445a !important;
        font-size: 14px !important;
        font-weight: 650 !important;
        line-height: 1.35;
    }
    .nu-mobile-nav a .nu-svg-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 20px;
        height: 20px;
        color: #0d827d;
        flex: 0 0 20px;
    }
    .nu-mobile-nav a .nu-svg-icon svg { width: 18px; height: 18px; }
    .nu-mobile-nav a.current {
        background: #eaf7f5 !important;
        border-color: #d5eeeb !important;
        color: #086d68 !important;
        box-shadow: inset 3px 0 0 #0d827d;
    }
    .nu-mobile-nav a:active { background: #eef4f8; }

    /* Announcement bar: keep its message visible instead of showing only icons. */
    .nu-sticky-bar { padding: 8px 0 !important; }
    .nu-sticky-bar-inner { padding: 0 13px !important; gap: 8px !important; }
    .nu-sticky-bar-dot { width: 7px; height: 7px; flex: 0 0 7px; }
    .nu-sticky-bar-text {
        display: block !important;
        min-width: 0;
        flex: 1 1 auto;
        font-size: 11px !important;
        line-height: 1.3;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .nu-sticky-bar-btn { padding: 6px 10px !important; font-size: 10px !important; }
    .nu-sticky-bar-close { font-size: 14px; padding: 2px; }

    /* Shared page gutters and section rhythm. */
    .nu-container {
        max-width: 100% !important;
        padding-left: 18px !important;
        padding-right: 18px !important;
    }
    .nu-hp-wrap { width: 100%; max-width: 100%; overflow: clip; }
    .nu-hp-section-head { margin-bottom: 24px !important; }
    .nu-hp-section-head h2 { font-size: 25px !important; line-height: 1.16 !important; }
    .nu-hp-section-head p { font-size: 14px !important; line-height: 1.6 !important; }

    /* Homepage hero: concise copy on phones; keep the full editorial copy on desktop. */
    .nu-hp-hero-copy-mobile { display: none !important; }
    .nu-hp-hero-copy-desktop { display: inline !important; }
    .nu-hp-hero { padding: 30px 0 28px !important; }
    .nu-hp-hero-copy-desktop { display: none !important; }
    .nu-hp-hero-copy-mobile { display: inline !important; }
    .nu-hp-hero .nu-container { padding-left: 19px !important; padding-right: 19px !important; }
    .nu-hp-hero-inner { width: 100%; max-width: 100%; }
    .nu-hp-hero-badge {
        display: inline-flex;
        max-width: 100%;
        white-space: normal;
        align-items: flex-start;
        font-size: 10px !important;
        line-height: 1.3;
        padding: 6px 10px !important;
        margin-bottom: 14px !important;
        white-space: nowrap;
        border-radius: 10px !important;
    }
    .nu-hp-hero-badge-dot { margin-top: 4px; flex: 0 0 6px; }
    .nu-hp-hero-h1 {
        font-size: clamp(29px, 8.2vw, 35px) !important;
        line-height: 1.06 !important;
        letter-spacing: -.045em !important;
        margin: 0 0 12px !important;
        overflow-wrap: normal;
    }
    .nu-hp-hero-p {
        max-width: 100% !important;
        font-size: 14px !important;
        line-height: 1.48 !important;
        margin: 0 0 18px !important;
        max-width: 31rem !important;
    }
    .nu-hp-hero-btns { display: flex; flex-direction: column; gap: 9px; margin: 0 0 21px !important; }
    .nu-hp-hero-btn-primary,
    .nu-hp-hero-btn-ghost {
        display: flex !important;
        width: 100% !important;
        min-height: 46px;
        align-items: center;
        justify-content: center;
        text-align: center;
        font-size: 13.5px !important;
        line-height: 1.3;
        padding: 10px 14px !important;
        border-radius: 12px !important;
        white-space: normal;
    }
    .nu-hp-hero-btn-primary svg { flex: 0 0 16px; }
    .nu-hp-hero-proof {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
        gap: 12px 12px !important;
        padding-top: 16px;
        border-top: 1px solid rgba(255,255,255,.12);
    }
    .nu-hp-hero-stat { min-width: 0; gap: 5px; }
    .nu-hp-hero-stat strong { font-size: 21px !important; line-height: 1.05; }
    .nu-hp-hero-stat span { font-size: 9px !important; letter-spacing: .45px; line-height: 1.35; }
    .nu-hp-hero-stat-div { display: none !important; }

    /* Homepage cards and content sections. */
    .nu-hp-courses,
    .nu-vs-section,
    .nu-hp-exam-cta,
    .nu-hp-roadmap,
    .nu-hp-latest,
    .nu-hp-community,
    .nu-hp-faq,
    .nu-hp-newsletter { padding-top: 44px !important; padding-bottom: 44px !important; }
    .nu-courses-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 13px !important; }
    .nu-course-card { padding: 17px !important; gap: 12px !important; border-radius: 15px !important; }
    .nu-course-card-top { gap: 10px !important; align-items: flex-start; }
    .nu-course-icon { font-size: 27px !important; }
    .nu-course-name { font-size: 16px !important; line-height: 1.25 !important; }
    .nu-course-vendor { font-size: 10px !important; }
    .nu-course-badge { font-size: 10px !important; padding: 4px 8px !important; }
    .nu-course-desc { font-size: 13px !important; line-height: 1.58 !important; }
    .nu-course-meta-row { gap: 7px 10px !important; font-size: 10.5px !important; }
    .nu-course-cta { font-size: 13px !important; }
    .nu-vs-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 14px !important; }
    .nu-hp-exam-cta-inner { grid-template-columns: minmax(0, 1fr) !important; gap: 24px !important; }
    .nu-hp-exam-cta-left h2 { font-size: 26px !important; line-height: 1.16 !important; }
    .nu-hp-exam-btns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px !important; }
    .nu-hp-exam-btn { min-height: 46px; justify-content: center; }
    .nu-hp-three-grid,
    .nu-hp-community-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 14px !important; }
    .nu-hp-nl-form { flex-direction: column; gap: 9px; border: 0 !important; overflow: visible !important; }
    .nu-hp-nl-form input,
    .nu-hp-nl-form button { width: 100% !important; min-height: 48px; border-radius: 10px !important; }
    .nu-hp-roadmap-grid { grid-template-columns: minmax(0, 1fr) !important; }

    /* Category and certification landing pages. */
    .nu-lp-hero { padding: 46px 18px 38px !important; }
    .nu-lp-hero-inner { width: 100%; max-width: 100%; }
    .nu-lp-hero h1,
    .nu-ccna-h1 { font-size: clamp(28px, 8vw, 36px) !important; line-height: 1.1 !important; letter-spacing: -.04em !important; }
    .nu-lp-hero-desc { font-size: 14.5px !important; line-height: 1.65 !important; }
    .nu-lp-hero-stats,
    .nu-lp-promo-stats {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 !important;
        margin-top: 25px !important;
        padding-top: 18px !important;
    }
    .nu-lp-hero-stat { min-width: 0; padding: 13px 8px !important; flex: initial !important; border: 0 !important; border-bottom: 1px solid rgba(255,255,255,.1) !important; }
    .nu-lp-hero-stat:nth-child(odd) { border-right: 1px solid rgba(255,255,255,.1) !important; }
    .nu-lp-hero-stat-num { font-size: 25px !important; }
    .nu-lp-hero-stat-lbl { font-size: 10px !important; }
    .nu-lp-promo-stat { min-width: 0; text-align: center; padding: 12px 8px; }
    .nu-lp-promo-stat span { font-size: 24px !important; }
    .nu-lp-promo-stat small { font-size: 10px !important; }
    .nu-lp-topics-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 12px !important; }
    .nu-lp-articles-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 14px !important; }
    .nu-lp-articles-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .nu-ccna-modules-grid,
    .nu-ccna-why-grid,
    .nu-cas-related-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 13px !important; }
    .nu-domain-toolbar { padding: 14px !important; border-radius: 14px !important; }
    .nu-domain-toolbar-main,
    .nu-domain-toolbar-filters { width: 100%; flex-wrap: wrap; gap: 9px !important; }
    .nu-domain-toolbar-search-wrap,
    .nu-domain-toolbar-search { width: 100% !important; min-width: 0 !important; }
    .nu-domain-toolbar-meta { flex-wrap: wrap; gap: 8px; }

    /* Keep long-form and practice screens inside the viewport. */
    .nu-content-frame,
    .nu-article-layout,
    .nu-article-content,
    .nu-ccna-single,
    .nu-exam-wrap { width: 100%; max-width: 100%; min-width: 0; }
    .nu-article-content,
    .nu-lp-article-body { overflow-wrap: anywhere; }
    .nu-article-content img,
    .nu-lp-article-body img,
    .nu-exam-wrap img { max-width: 100%; height: auto; }

    /* Footer: comfortable spacing without forcing tiny columns. */
    .nu-footer-grid,
    .nu-footer-grid-6 { grid-template-columns: minmax(0, 1fr) !important; gap: 24px !important; }
    .nu-footer { padding: 36px 0 24px !important; }
    .nu-footer-bottom-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
    .nu-footer-legal-links { display: flex; flex-wrap: wrap; gap: 8px 12px; }
}

@media (max-width: 380px) {
    .nu-header > .nu-container { padding-left: 11px !important; padding-right: 11px !important; }
    .nu-header-inner { gap: 5px !important; }
    .nu-header .nu-logo-text { font-size: 13px !important; }
    .nu-header .nu-logo-icon { width: 31px; height: 31px; }
    .nu-header-actions .nu-icon-btn,
    .nu-header-actions > .nu-icon-btn { width: 30px; }
    .nu-header-actions { gap: 0 !important; }
    .nu-mobile-toggle { width: 32px !important; height: 32px !important; flex-basis: 32px; }
    .nu-container { padding-left: 15px !important; padding-right: 15px !important; }
    .nu-hp-hero .nu-container { padding-left: 16px !important; padding-right: 16px !important; }
    .nu-hp-hero-h1 { font-size: 29px !important; }
    .nu-hp-hero-p { font-size: 14px !important; }
    .nu-hp-hero-stat strong { font-size: 19px !important; }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .nu-header > .nu-container { padding-left: 22px !important; padding-right: 22px !important; }
    .nu-header .nu-logo-text { display: block !important; }
    .nu-mobile-menu { width: min(420px, 76vw) !important; }
    .nu-hp-hero { padding: 62px 0 58px !important; }
    .nu-hp-hero-h1 { font-size: clamp(42px, 5.5vw, 54px) !important; }
    .nu-hp-hero-inner { max-width: 740px; }
    .nu-courses-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .nu-lp-topics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

@media (prefers-reduced-motion: reduce) {
    .nu-mobile-menu,
    .nu-mobile-overlay { transition: none !important; }
}
