/*
 * walkernash.ai mobile retrofit — DO NOT EDIT FOR DESKTOP.
 * Every rule below lives inside @media (max-width: 768px),
 * so desktop layout (>=769px) is completely unaffected.
 *
 * Linked from every page header. Touch points are consistent across
 * index.html, cases.html, industries.html, pilot-program.html,
 * media.html, briefing.html, blog.html, ai-governance.html,
 * curated.html, survey.html.
 */

@media (max-width: 768px) {

    /* ===== Global: no horizontal scroll, no iOS zoom ===== */
    html, body { max-width: 100%; overflow-x: hidden; }
    body { -webkit-text-size-adjust: 100%; }
    img, svg, video, canvas { max-width: 100%; height: auto; }
    input, select, textarea { font-size: 16px !important; }

    /* ===== NAV ===== */
    nav {
        padding: 0.75rem 1rem !important;
        flex-wrap: wrap;
    }
    nav.scrolled { padding: 0.5rem 1rem !important; }
    .nav-brand { flex: 1; min-width: 0; }
    .nav-name { font-size: 1rem !important; }
    .nav-logo { width: 32px !important; height: 32px !important; }

    /* Hide desktop inline nav, show hamburger */
    .nav-links {
        display: none !important;
        order: 3;
        width: 100%;
        flex-direction: column;
        gap: 0.25rem;
        margin-top: 0.75rem;
        padding: 0.5rem 0 0.25rem;
        border-top: 1px solid rgba(245,158,11,0.08);
    }
    .nav-links.open { display: flex !important; }
    .nav-links a {
        padding: 0.75rem 0.5rem;
        font-size: 0.95rem !important;
        width: 100%;
    }
    .nav-cta {
        width: 100%;
        text-align: center;
        padding: 0.75rem 1rem !important;
        margin-top: 0.5rem;
    }

    /* Injected hamburger (see mobile.js) */
    .nav-toggle {
        display: inline-flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        background: none;
        border: 1px solid rgba(245,158,11,0.25);
        border-radius: 8px;
        padding: 0.5rem;
        width: 40px;
        height: 40px;
        cursor: pointer;
        flex-shrink: 0;
    }
    .nav-toggle span {
        display: block;
        width: 20px;
        height: 2px;
        background: #e8e8e8;
        margin: 2px 0;
        border-radius: 2px;
        transition: transform 0.2s, opacity 0.2s;
    }
    .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
    .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
    .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

    /* ===== SECTIONS & HERO ===== */
    section {
        padding: 3.5rem 1.25rem !important;
    }
    .hero, .page-hero {
        padding: 6rem 1.25rem 3rem !important;
        min-height: auto !important;
    }
    .hero h1, .page-hero h1, .page-title {
        font-size: clamp(1.9rem, 7vw, 2.5rem) !important;
        line-height: 1.15 !important;
    }
    .hero p, .page-subtitle, .section-subtitle {
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
    }
    .section-title { font-size: clamp(1.6rem, 6vw, 2.1rem) !important; }
    .crucible-brand {
        font-size: clamp(2rem, 9vw, 2.8rem) !important;
        letter-spacing: 0.06em !important;
        margin-bottom: 1rem !important;
    }

    /* Hero buttons stack */
    .hero-buttons, .cta-btns, .btn-row {
        flex-direction: column;
        width: 100%;
    }
    .hero-buttons .btn-primary,
    .hero-buttons .btn-secondary,
    .cta-btns .btn-primary,
    .cta-btns .btn-secondary,
    .btn, .cta-btn {
        width: 100%;
        justify-content: center;
    }

    /* ===== INDEX: prompt bar + conversation (the showstoppers) ===== */
    .crucible-prompt-area {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        margin: 1.5rem 0 0 !important;
        padding: 0 !important;
    }
    .crucible-prompt-bar {
        padding: 0.5rem 0.5rem 0.5rem 1rem !important;
        border-radius: 12px !important;
    }
    .crucible-prompt-input {
        font-size: 16px !important;
        padding: 0.6rem 0.25rem !important;
    }
    .crucible-prompt-send {
        width: 36px !important;
        height: 36px !important;
    }
    .crucible-conversation {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        max-height: 60vh !important;
        padding: 1rem 0 !important;
    }
    .crucible-suggestions { gap: 0.35rem !important; }
    .crucible-chip { font-size: 0.72rem !important; padding: 0.35rem 0.65rem !important; }
    .ai-msg.user { font-size: 15px !important; padding: 0.7rem 1.25rem !important; max-width: 100% !important; }
    .ai-msg.assistant { font-size: 16px !important; line-height: 1.65 !important; }

    /* ===== GRIDS: force single column where pages use fixed column counts ===== */
    .stats-grid,
    .stat-bar,
    .pain-grid,
    .solution-grid,
    .industry-grid,
    .steps,
    .case-hook-grid,
    .deploy-grid,
    .grid,
    .form-row,
    .footer-main {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    .stats-grid, .stat-bar { grid-template-columns: repeat(2, 1fr) !important; }
    .stat-item h3, .stat .num { font-size: 1.75rem !important; }

    /* ===== CASES PAGE: filters + modal ===== */
    .controls-wrap, .controls {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
        padding: 0.75rem !important;
    }
    .ctrl-select, .ctrl-toggle {
        width: 100% !important;
        font-size: 14px !important;
    }
    .ctrl-divider { display: none !important; }
    .ctrl-count, .ctrl-label { text-align: center; }

    .modal {
        width: calc(100vw - 1.5rem) !important;
        max-width: calc(100vw - 1.5rem) !important;
        max-height: 90vh !important;
        padding: 1.25rem !important;
        border-radius: 12px !important;
    }
    .modal-section { font-size: 0.9rem !important; }
    .modal-entity { font-size: 1.1rem !important; }
    .modal-penalty { font-size: 1.5rem !important; }
    .modal-meta { flex-wrap: wrap; gap: 0.5rem !important; }

    /* ===== INDUSTRIES PAGE ===== */
    .stat-bar { padding: 1.25rem !important; gap: 1rem !important; }
    .card { padding: 1.25rem !important; }
    .count { font-size: 1.5rem !important; }

    /* ===== PILOT-PROGRAM / DEPLOY CARDS ===== */
    .deploy-card, .highlight-box { padding: 1.25rem !important; }
    .contact-bar {
        flex-direction: column !important;
        text-align: center;
        gap: 0.75rem !important;
        padding: 1.25rem !important;
    }

    /* ===== MEDIA PAGE ===== */
    .episode { padding: 1.25rem 1rem !important; }
    .episode h3 { font-size: 1.05rem !important; }
    .episode-meta {
        flex-wrap: wrap;
        gap: 0.5rem !important;
        font-size: 0.8rem !important;
    }
    .download { width: 100%; justify-content: center; }

    /* ===== BRIEFING PAGE ===== */
    .briefing-wrap { padding: 1rem !important; }
    .case-panel, .analysis-panel { padding: 1.25rem !important; }
    .case-panel-header, .analysis-header { flex-wrap: wrap; gap: 0.5rem; }
    .case-meta-row { flex-direction: column; gap: 0.25rem !important; align-items: flex-start; }
    .case-penalty-value { font-size: 1.5rem !important; }
    .dash-alert-bar { flex-wrap: wrap; gap: 0.5rem !important; }

    /* ===== SURVEY PAGE ===== */
    .checkbox-grid { grid-template-columns: 1fr !important; }
    .container { padding: 1rem !important; }

    /* ===== BLOG / CURATED / AI-GOVERNANCE ===== */
    .blog-footer { padding: 2rem 1rem !important; }
    .page-title { font-size: clamp(1.8rem, 6vw, 2.2rem) !important; }
    .intake-grid { grid-template-columns: 1fr !important; }

    /* curated.html sticky selection bar — stack contents */
    .selection-bar {
        flex-direction: column !important;
        gap: 0.75rem !important;
        padding: 1rem !important;
        left: 0.5rem !important;
        right: 0.5rem !important;
        width: auto !important;
        max-width: calc(100vw - 1rem) !important;
    }
    .selection-bar-info { align-items: center; text-align: center; }
    .selection-bar-btn {
        width: 100% !important;
        justify-content: center !important;
        padding: 0.75rem 1rem !important;
        font-size: 0.9rem !important;
    }
    .field-group select,
    .field-group textarea,
    .field-group input {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    .principle-grid { grid-template-columns: 1fr !important; }

    /* Wide tables become horizontally scrollable instead of pushing the page.
       mobile.js wraps each <table> in div.mobile-table-wrap on page load. */
    .mobile-table-wrap {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        margin: 1rem 0;
        border-radius: 8px;
    }
    .mobile-table-wrap table { min-width: 100%; }
    .nist-table th,
    .nist-table td { padding: 0.5rem 0.65rem !important; font-size: 0.72rem !important; }

    /* ===== FOOTER ===== */
    .footer-main {
        padding: 2.5rem 1.25rem 1.5rem !important;
        text-align: center;
        gap: 1.75rem !important;
    }
    .footer-social { justify-content: center !important; display: flex !important; gap: 0.5rem; }
    .footer-col ul { align-items: center !important; }
    .footer-bottom {
        flex-direction: column !important;
        text-align: center;
        gap: 0.5rem !important;
        padding: 1rem 1.25rem !important;
    }

    /* ===== FORMS ===== */
    .contact-form .form-row { grid-template-columns: 1fr !important; }
    .form-group input,
    .form-group select,
    .form-group textarea { font-size: 16px !important; }

    /* ===== NEWSLETTER MODAL ===== */
    .nl-modal {
        width: calc(100vw - 1.5rem) !important;
        max-width: calc(100vw - 1.5rem) !important;
        padding: 1.5rem !important;
    }
    .nl-input { font-size: 16px !important; }

    /* ===== ORBS: scale down to avoid layout cost ===== */
    .orb-1 { width: 300px !important; height: 300px !important; }
    .orb-2 { width: 240px !important; height: 240px !important; }
    .orb-3 { width: 220px !important; height: 220px !important; }
}

/* Phones narrower than iPhone SE */
@media (max-width: 380px) {
    nav { padding: 0.5rem 0.75rem !important; }
    section, .hero, .page-hero { padding-left: 1rem !important; padding-right: 1rem !important; }
    .hero h1, .page-title { font-size: 1.7rem !important; }
    .crucible-brand { font-size: 1.9rem !important; }
}
