/* ==========================================================================
   BunShai TECHNOHUB — Full Responsive System (320px phones -> 2560px displays)
   No dark-mode variable inversion; preserves unified light/dark contrast.
   ========================================================================== */

/* Global overflow & media safety */
html,
body {
    max-width: 100%;
    overflow-x: clip;
}

img,
video,
iframe,
svg {
    max-width: 100%;
}

/* Large & Ultra-Wide Displays */
@media (min-width: 1280px) {
    .container {
        max-width: 1240px;
    }
}

@media (min-width: 1536px) {
    .container {
        max-width: 1380px;
    }
    .video-content h1 {
        font-size: 4rem;
    }
}

@media (min-width: 1920px) {
    .container {
        max-width: 1520px;
    }
}

/* Laptops (<= 1199px) */
@media (max-width: 1199px) {
    .container {
        max-width: 96%;
    }
    .services-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablets & Mobile Navigation Drawer (<= 992px) */
@media (max-width: 992px) {
    .header-content {
        gap: 12px;
        justify-content: flex-start;
    }

    .brand {
        flex: 1 1 auto;
        min-width: 0;
    }

    .brand .logo-link {
        gap: 8px;
        min-width: 0;
    }

    .brand h1 {
        white-space: normal;
        line-height: 1.15;
        font-size: clamp(0.95rem, 4.4vw, 1.2rem);
        overflow-wrap: anywhere;
    }

    .logo-img {
        flex-shrink: 0;
    }

    .footer-brand-lockup {
        flex-wrap: wrap;
    }

    .footer-brand-lockup span {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    nav#main-nav {
        position: fixed;
        top: 0;
        left: -100%;
        width: min(380px, 100%);
        height: 100vh;
        height: 100dvh;
        background: var(--dark);
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        padding: 74px 20px 40px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        transition: var(--transition);
        z-index: 1002;
        box-shadow: var(--shadow-xl);
    }

    nav#main-nav.show {
        left: 0;
    }

    .nav-close {
        display: block;
        position: absolute;
        top: 18px;
        right: 20px;
        font-size: 1.5rem;
        color: #ffffff;
        cursor: pointer;
    }

    .nav-content {
        flex-direction: column;
        gap: 6px;
        text-align: left;
        width: 100%;
        min-width: 0;
    }

    .nav-dropdown,
    .nav-dropdown-mega {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .nav-link {
        width: 100%;
        justify-content: flex-start;
        gap: 10px;
        padding: 12px 14px;
        border-radius: 8px;
        font-size: 1rem;
    }

    .nav-link .fa-chevron-down {
        margin-left: auto;
        transition: transform 0.25s ease;
    }

    .nav-dropdown.open > .nav-link {
        background: rgba(255, 255, 255, 0.08);
    }

    .nav-dropdown.open > .nav-link .fa-chevron-down {
        transform: rotate(180deg);
    }

    .nav-link::after {
        display: none;
    }

    /* Stack multi-column layouts cleanly */
    .about-content,
    .contact-grid,
    .course-detail-grid,
    .service-hero,
    .hero-section {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .service-hero {
        flex-direction: column;
        text-align: center;
    }

    .popup-container,
    .bs-modal-split {
        flex-direction: column;
        width: min(94vw, 680px);
        max-height: 92dvh;
    }

    .popup-left,
    .bs-modal-hero,
    .popup-right,
    .bs-modal-body {
        width: 100%;
    }

    .popup-left,
    .bs-modal-hero {
        padding: 22px 20px;
    }

    .popup-right,
    .bs-modal-body {
        padding: 22px 20px;
    }

    .featured-spotlight,
    .article-layout-grid,
    .exp-layout-grid,
    .feedback-layout-grid {
        grid-template-columns: 1fr;
    }

    .video-content h1 {
        font-size: clamp(2rem, 5vw, 3rem);
    }

    .page-header h1 {
        font-size: clamp(1.9rem, 4.5vw, 2.6rem);
    }
}

/* Mobile & Landscape Phones (<= 768px) */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .brand h1 {
        font-size: clamp(0.95rem, 4.4vw, 1.15rem);
    }

    .logo-img {
        height: 38px;
    }

    .page-header {
        padding: 96px 0 42px;
        margin-top: 64px;
    }

    .video-content h1 {
        font-size: clamp(1.75rem, 6vw, 2.3rem);
    }

    .video-content p,
    .page-header p {
        font-size: 1rem;
    }

    .hero-buttons,
    .cta-buttons,
    .course-hero-cta-row {
        flex-direction: column;
        align-items: stretch;
    }

    .weekly-digest-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .weekly-rss-link {
        width: 100%;
        justify-content: center;
    }

    .hero-buttons .cta-btn,
    .hero-buttons .cta-btn-secondary,
    .cta-buttons .btn-primary,
    .cta-buttons .btn-secondary,
    .course-hero-cta-row .btn-primary,
    .course-hero-cta-row .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .hero-stats {
        height: auto;
        gap: 20px;
    }

    .form-row,
    .services-grid,
    .features-grid,
    .courses-grid,
    .testimonials-grid,
    .blog-grid,
    .team-grid,
    .values-grid,
    .support-options,
    .subscribe-grid,
    .pillars-grid,
    .related-courses-grid,
    .exp-published-grid,
    .services-content,
    .content-grid,
    .cloud-platforms,
    .offering-grid,
    .benefits-grid,
    .tech-grid,
    .project-types {
        grid-template-columns: 1fr;
    }

    .stats-grid,
    .courses-hero-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .courses-toolbar {
        padding: 14px;
    }

    .course-search-box {
        flex: 1 1 100%;
        min-width: 0;
    }

    .contact-form,
    .contact-form-container,
    .enroll-card,
    .support-form-container,
    .application-form-container {
        padding: 24px 18px;
    }

    .captcha-container {
        flex-direction: column;
        align-items: stretch;
    }

    .captcha-display {
        min-width: 0;
        width: 100%;
    }

    .map-container {
        height: 280px;
    }

    .slide {
        width: min(330px, 82vw);
    }

    .usage-table,
    .retention-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .newsletter-content {
        padding: 36px 20px;
        text-align: center;
    }

    .newsletter-form form {
        flex-direction: column;
    }

    /* Compact floating action tab on mobile */
    .header-actions {
        top: auto;
        bottom: 158px;
        transform: none;
    }

    .lets-connect-btn {
        padding: 9px 13px;
        font-size: 0.85rem;
    }
}

/* Small Phones (<= 576px) */
@media (max-width: 576px) {
    nav#main-nav {
        width: 100%;
        padding: 68px 16px 36px;
    }

    .brand h1 {
        font-size: clamp(0.9rem, 4.5vw, 1rem);
    }

    .logo-img {
        height: 34px;
    }

    .section-header h2,
    .section-heading h2 {
        font-size: 1.65rem;
    }

    .stats-grid,
    .courses-hero-stats {
        grid-template-columns: 1fr;
    }

    .course-card-actions-row {
        flex-direction: column;
    }

    .testimonials-cta .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .proposal-popup,
    .bs-timed-modal,
    .modal {
        padding: 10px;
    }

    #captchaText {
        font-size: 1.45rem;
        letter-spacing: 4px;
    }

    .whatsapp-float {
        width: 48px;
        height: 48px;
        bottom: 16px;
        right: 16px;
        font-size: 1.5rem;
    }

    .chatbot-container {
        bottom: 76px;
        right: 16px;
    }

    .chatbot-window {
        width: calc(100vw - 24px);
        right: -8px;
        height: 62vh;
    }

    .back-to-top {
        width: 44px;
        height: 44px;
        bottom: 16px;
        left: 16px;
        right: auto;
    }

    .header-actions {
        display: none;
    }
}

/* Ultra-Small Screens (<= 380px) */
@media (max-width: 380px) {
    .brand h1 {
        font-size: clamp(0.82rem, 4.6vw, 0.95rem);
    }
    .video-content h1,
    .page-header h1,
    .courses-hero h1 {
        font-size: 1.55rem;
    }
    input,
    textarea,
    select {
        font-size: 16px; /* Prevents iOS auto-zoom */
    }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .video-hero {
        height: auto;
        min-height: 115vh;
        padding: 90px 0 40px;
    }
    .popup-container {
        max-height: 95vh;
    }
}

/* Touch Device Ergonomics */
@media (hover: none) and (pointer: coarse) {
    .lets-connect-btn,
    .cta-btn,
    .submit-btn,
    .bs-submit-btn,
    .btn-solid-course,
    .btn-outline-course,
    .btn-syllabus-course,
    .enroll-submit-btn {
        min-height: 44px;
    }
    button,
    a {
        -webkit-tap-highlight-color: transparent;
    }
}

/* High DPI */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo-img,
    .footer-logo {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    html {
        scroll-behavior: auto !important;
    }
}

/* Print */
@media print {
    .header,
    .header-actions,
    .whatsapp-float,
    .chatbot-container,
    .back-to-top,
    footer,
    .modal {
        display: none !important;
    }
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
}
