/* ============================================================
   Homepage mobile polish — 2026-05-18
   Tightens every section on the index.html homepage for phones.
   Loaded AFTER styles.css so its overrides win on equal specificity.
   Scope is `.hero`, `.partners-strip`, `.about-section`, `.courses-section`,
   `.internship-section`, `.job-section`, `.consultation-section`,
   `.testimonials-section`, `.footer`. The `.platform-section` already has
   its own mobile block inline in index.html.
   ============================================================ */

/* -------- Tablet (≤900px) — tighten container side gutters -------- */
@media (max-width: 768px) {
    .container { padding-left: 1rem; padding-right: 1rem; }
}

/* =============================================================
   Phone (≤720px)
   ============================================================= */
@media (max-width: 768px) {

    /* ===== Section headers — uniform shrink ===== */
    .section-header { margin-bottom: 1.5rem; }
    .section-header h2 { font-size: 1.5rem !important; line-height: 1.25; }
    .section-header p { font-size: 0.9rem; line-height: 1.5; }

    /* ===== HERO ===== */
    .hero { padding-top: 5.5rem !important; padding-bottom: 2rem !important; }
    .hero-content { gap: 1.5rem !important; }
    .hero-eyebrow { font-size: 0.68rem !important; padding: 0.35rem 0.8rem !important; }
    .hero-text h1, .hero-content h1 { font-size: 1.55rem !important; line-height: 1.2 !important; }
    .hero-text p, .hero-content p { font-size: 0.92rem !important; line-height: 1.55 !important; }
    .hero-buttons { flex-direction: column !important; gap: 0.6rem !important; align-items: stretch !important; }
    .hero-buttons .btn, .hero-buttons a { width: 100%; justify-content: center; padding: 0.85rem 1rem !important; font-size: 0.92rem !important; }

    /* Hero stats bar — 2x2 grid, drop the dividers since they look weird wrapped */
    .hero-stats-bar { display: grid !important; grid-template-columns: repeat(2, 1fr) !important; padding: 0.85rem !important; gap: 0.6rem 0.4rem !important; }
    .hs-divider { display: none !important; }
    .hs-stat { flex-direction: column; align-items: flex-start; gap: 0.1rem; }
    .hs-num { font-size: 1.1rem !important; }
    .hs-lbl { font-size: 0.72rem !important; }

    /* Hero console — keep but compact, drop the "Source" column to fit cleanly */
    .hero-console { margin-top: 1rem !important; border-radius: 12px !important; }
    .hc-chrome { padding: 0.5rem 0.7rem !important; gap: 0.3rem; }
    .hc-status { font-size: 0.6rem; }
    .hc-tabs { padding: 0.35rem !important; gap: 0.25rem !important; }
    .hc-tab { font-size: 0.62rem !important; padding: 0.3rem 0.5rem !important; gap: 0.2rem !important; }
    .hc-tab img { width: 12px !important; height: 12px !important; }
    .hc-body { font-size: 0.6rem !important; padding: 0.45rem !important; }
    .hc-row { grid-template-columns: 18px 1fr 0.7fr 0.7fr 0.7fr !important; gap: 0.25rem !important; padding: 0.35rem 0.4rem !important; }
    .hc-row > :nth-child(3) { display: none !important; } /* hide "Source" column on phones */
    .hc-row.hc-head > :nth-child(3) { display: none !important; }
    .hc-cell-name { font-size: 0.6rem; }
    .hc-pill, .hc-action { font-size: 0.55rem !important; padding: 0.1rem 0.3rem !important; }
    .hc-footer { padding: 0.5rem 0.7rem !important; font-size: 0.62rem !important; }
    .hp-trust-line { font-size: 0.72rem; margin-top: 0.6rem; text-align: center; }

    /* ===== PARTNERS STRIP ===== */
    .partners-strip { padding: 1.5rem 0 !important; }
    .ps-label { font-size: 0.72rem !important; margin-bottom: 0.9rem; }
    .ps-row { gap: 0.9rem 1.2rem !important; justify-content: center; }
    .ps-mark { font-size: 0.85rem !important; }
    .ps-tcs, .ps-ibm, .ps-csco { font-size: 0.95rem !important; }

    /* ===== ABOUT SECTION ===== */
    .about-section { padding: 2rem 0 !important; }
    .about-grid { grid-template-columns: 1fr !important; gap: 1.5rem !important; }
    .about-content p { font-size: 0.93rem; line-height: 1.6; }
    .about-features { grid-template-columns: 1fr 1fr !important; gap: 0.7rem !important; }
    .about-feature { font-size: 0.78rem !important; padding: 0.7rem !important; gap: 0.5rem !important; }
    .about-feature .af-icon { width: 32px !important; height: 32px !important; }
    .about-feature .af-icon svg { width: 16px; height: 16px; }
    /* About stats — 2x2 grid (not 4-col, not 1-col) */
    .about-stats { grid-template-columns: repeat(2, 1fr) !important; gap: 0.7rem !important; }
    .stat-card { padding: 1rem 0.8rem !important; border-radius: 12px !important; text-align: center; }
    .stat-card h3 { font-size: 1.6rem !important; margin-bottom: 0.25rem !important; }
    .stat-card p { font-size: 0.78rem !important; }

    /* ===== COURSES SECTION ===== */
    .courses-section { padding: 2rem 0 !important; }
    .courses-grid { grid-template-columns: 1fr !important; gap: 1rem !important; }

    /* ===== INTERNSHIP + JOB SECTIONS (shared `.form-container`) ===== */
    .internship-section, .job-section { padding: 2rem 0 !important; }
    .form-container { grid-template-columns: 1fr !important; gap: 1.5rem !important; display: grid !important; }
    .form-info h3, .application-form h3 { font-size: 1.1rem !important; margin-bottom: 0.85rem !important; }
    .form-info ul { padding-left: 0; list-style: none; }
    .form-info li { font-size: 0.88rem; line-height: 1.6; }
    .application-form { padding: 1.25rem !important; border-radius: 12px !important; }
    .application-form .form-group { margin-bottom: 0.85rem !important; }
    .application-form label { font-size: 0.85rem !important; margin-bottom: 0.35rem !important; }
    .application-form input,
    .application-form select,
    .application-form textarea {
        padding: 0.7rem 0.85rem !important;
        font-size: 0.92rem !important;
        width: 100%;
        box-sizing: border-box;
    }
    .application-form .btn { width: 100%; padding: 0.85rem !important; font-size: 0.95rem !important; }

    /* ===== CONSULTATION SECTION ===== */
    .consultation-section { padding: 2rem 0 !important; }
    .consultation-section .consultation-content { padding: 1.5rem !important; border-radius: 14px !important; }
    .consultation-section h2 { font-size: 1.4rem !important; }
    .consultation-section p { font-size: 0.9rem; }

    /* ===== TESTIMONIALS ===== */
    .testimonials-section { padding: 2rem 0 !important; }
    .testimonials-grid { gap: 0.9rem !important; }
    .testi-card, .testimonial-card { padding: 1.1rem !important; border-radius: 12px !important; }
    .testi-text, .testimonial-text { font-size: 0.88rem !important; line-height: 1.6 !important; }
    .testi-author, .testimonial-author { gap: 0.6rem; }
    .testi-name, .testimonial-name { font-size: 0.92rem; }
    .testi-role, .testimonial-role { font-size: 0.75rem; }

    /* ===== FOOTER ===== */
    .footer { padding: 2rem 0 1rem !important; }
    .footer .footer-grid { gap: 1.5rem !important; }
    .footer-brand p { font-size: 0.85rem; }
    .footer-title { font-size: 0.72rem !important; margin-bottom: 0.6rem !important; }
    .footer .footer-links a { font-size: 0.85rem !important; padding: 0.15rem 0; }
    .footer-bottom { font-size: 0.75rem !important; margin-top: 1.25rem !important; }
}

/* =============================================================
   Phone refinement (≤640px) — 2026-05-21 paid-student feedback pass.
   The 720px block above tightens layout; this block adds tap-target
   sizing (WCAG 2.5.5 / Apple HIG 44px min), iOS momentum scrolling,
   and disables bg-attachment:fixed that breaks on iOS Safari.
   ============================================================= */
@media (max-width: 640px) {

    /* Tap targets: 44px+ on footer links & social icons */
    .footer .footer-links a { min-height: 44px; display: inline-flex; align-items: center; line-height: 1.2; padding: 0.55rem 0; }
    .footer-brand .social-icons a,
    .footer .social-icons a,
    .footer a[aria-label*="social" i],
    .footer a[href*="facebook"],
    .footer a[href*="linkedin"],
    .footer a[href*="twitter"],
    .footer a[href*="youtube"],
    .footer a[href*="instagram"],
    .footer a[href*="wa.me"] {
        min-width: 44px; min-height: 44px;
        display: inline-flex; align-items: center; justify-content: center;
    }

    /* iOS Safari background-attachment:fixed breaks compositing */
    .hero, .about-section, .consultation-section, .testimonials-section, body {
        background-attachment: scroll !important;
    }

    /* Smooth iOS momentum on horizontal scrollers */
    .courses-grid,
    .testimonials-grid,
    [class*="-carousel"],
    [data-scroll="x"] {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }

    /* Prevent iOS auto-zoom on input focus (font-size ≥16px) */
    .application-form input,
    .application-form select,
    .application-form textarea {
        font-size: 1rem !important;
    }

    /* Trust badges row: gracefully wrap, no horizontal overflow */
    .ps-row, .trust-badges, .partner-logos {
        flex-wrap: wrap !important;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Hero CTAs: ≥48px tap height even with custom paddings */
    .hero-buttons .btn,
    .hero-buttons a {
        min-height: 48px;
    }

    /* Smooth anchor scroll for in-page navigation */
    html { scroll-behavior: smooth; }

    /* Section-header h2: prevent text bleed at 360px */
    .section-header h2 { word-break: break-word; hyphens: auto; }
}

/* =============================================================
   Tiny phones (≤380px) — squeeze the last bits
   ============================================================= */
@media (max-width: 640px) {
    .container { padding-left: 0.75rem; padding-right: 0.75rem; }
    .section-header h2 { font-size: 1.35rem !important; }
    .hero-text h1, .hero-content h1 { font-size: 1.35rem !important; }
    .hs-num { font-size: 1rem !important; }
    .stat-card h3 { font-size: 1.4rem !important; }
    /* Hero console — drop one more column on the tiniest screens */
    .hc-row { grid-template-columns: 16px 1fr 0.7fr 0.7fr !important; }
    .hc-row > :nth-child(4) { display: none !important; } /* hide "Dest" too */
    .hc-row.hc-head > :nth-child(4) { display: none !important; }
}

/* =============================================================
   R5 Mobile Pass (2026-05-23)
   - Force 48px min touch targets
   - Single-column course cards on mobile
   - Footer columns collapse to accordion-style stack
   - Floating chat widget respects safe-area insets
   ============================================================= */
@media (max-width: 768px) {
    /* All anchors/buttons inside content areas — guarantee 48px minimum touch */
    .btn, button.btn, a.btn,
    .nav-link, .footer-col a,
    .tc-card-cta, .tc-syllabus-link {
        min-height: 48px;
    }
    .btn, button.btn, a.btn {
        padding-top: 12px !important; padding-bottom: 12px !important;
    }

    /* Course cards stack 1-col on phones (the auto-fit minmax(280, 1fr) already does this,
       but ensure if any nested grid is fighting) */
    .courses-grid { grid-template-columns: 1fr !important; gap: 16px !important; }

    /* New v2 card — mobile polish */
    .course-card.tc-card-v2 { min-height: 0 !important; padding: 20px 16px !important; }
    .tc-vendor-zone { width: 80px !important; height: 56px !important; margin: 12px auto 8px !important; }
    .tc-vendor-logo { max-height: 36px !important; max-width: 64px !important; }
    .tc-card-title { font-size: 1.05rem !important; min-height: 0 !important; }
    .tc-card-desc { -webkit-line-clamp: 3 !important; min-height: 0 !important; }
    .tc-price { font-size: 1.35rem !important; }

    /* Cat-filter chips — wrap-friendly + tap-friendly */
    .tc-cat-filter-bar { gap: 6px !important; padding: 0 4px !important; }
    .tc-cat-chip { min-height: 36px; }

    /* Floating chat widget — respect iOS safe area */
    #tcFloatChat #tcChatBtn,
    #chatbotFab,
    .chatbot-fab {
        bottom: max(24px, env(safe-area-inset-bottom, 24px)) !important;
        right: max(16px, env(safe-area-inset-right, 16px)) !important;
    }

    /* Footer columns — full-width stacks */
    .footer-grid, .footer-columns {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }
    .footer-col { padding-bottom: 8px; }
    .footer-col h4 { font-size: 0.85rem !important; letter-spacing: 0.08em; }

    /* Form inputs — readable size + tap-friendly */
    input, select, textarea {
        font-size: 16px !important; /* prevents iOS zoom-on-focus */
        min-height: 48px;
        padding: 12px 14px !important;
    }
    textarea { min-height: 100px; }
}

@media (max-width: 640px) {
    /* Tighter cat chips on small phones */
    .tc-card-badge { font-size: 10px !important; padding: 3px 8px !important; }
    .cat-chip { font-size: 10px !important; padding: 3px 8px !important; }
}

/* ── Visual-audit fixes (2026-06-10) ───────────────────────────────── */
@media (max-width: 640px) {
    /* 3 stats in a 2-col grid left an orphan — third stat spans full width */
    .hero-stats-bar .hs-stat:last-child { grid-column: 1 / -1; }

    /* Console pills were breaking mid-word ("Den y", "ms- off ice 365").
       Pills never wrap; long app names ellipsize instead. */
    .hc-pill, .hc-action {
        white-space: nowrap !important;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
        max-width: 100%;
    }
    .hc-row > span { min-width: 0; }
}

/* ── Mobile-first homepage tightening (2026-07-06) ─────────────────── */
@media (max-width: 640px) {
    .hero {
        padding-top: 4.25rem !important;
        padding-bottom: 1.35rem !important;
        min-height: auto !important;
    }

    .hero-content {
        gap: 1rem !important;
    }

    .hero-proof-pills {
        gap: 0.45rem !important;
        margin-top: 1.15rem !important;
    }

    .hero-proof-pills span {
        min-height: 38px !important;
        padding: 0.48rem 0.7rem !important;
        font-size: 0.78rem !important;
    }

    .hero-buttons {
        margin-top: 1.1rem !important;
    }

    .hero-buttons .btn,
    .hero-buttons a {
        min-height: 46px !important;
        padding: 0.68rem 0.95rem !important;
    }

    .hero-stats-bar {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 0 !important;
        padding: 0.55rem 0.45rem !important;
        margin-top: 1rem !important;
    }

    .hero-stats-bar .hs-stat,
    .hero-stats-bar .hs-stat:last-child {
        grid-column: auto !important;
        align-items: center !important;
        text-align: center !important;
        padding: 0.35rem 0.25rem !important;
    }

    .hero-stats-bar .hs-num {
        font-size: 0.98rem !important;
        line-height: 1.05 !important;
    }

    .hero-stats-bar .hs-lbl {
        font-size: 0.64rem !important;
        line-height: 1.2 !important;
    }

    .hero-visual {
        margin-top: 0.3rem !important;
    }

    .mentor-shot-copy {
        padding: 0.65rem 0.8rem !important;
    }

    .mentor-shot-copy strong {
        font-size: 0.82rem !important;
        line-height: 1.35 !important;
    }
}
