/* ============================================
   Mobile-first refinements (loaded last)
   ============================================ */

html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

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

body { overflow-wrap: anywhere; }

body.nav-locked { overflow: hidden; }

.nav-toggle {
    position: relative;
    z-index: 1002;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    margin-right: -8px;
}

/* Tablet and below */
@media (max-width: 900px) {
    .main-content { text-align: left; }
    .sidebar-card { min-width: 0; }
}

/* Phones */
@media (max-width: 768px) {
    .header { padding: max(10px, env(safe-area-inset-top)) 0 10px; }
    .header.scrolled { padding: 8px 0; background: rgba(10, 10, 15, 0.92); }
    .header .container { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
    .logo-img { height: 48px; }

    /* Full-width slide-in menu with big tap targets */
    .nav {
        z-index: 1001;
        width: 100%;
        max-width: none;
        height: 100vh;
        height: 100dvh;
        border-left: none;
        padding: 96px 20px calc(24px + env(safe-area-inset-bottom));
        overflow-y: auto;
        visibility: hidden;
        opacity: 0;
        transform: translateY(-12px);
        transition: opacity 0.3s, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.3s;
    }
    .nav.open { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
    .nav ul { gap: 6px; }
    .nav a {
        padding: 18px 20px;
        font-size: 1.125rem;
        min-height: 56px;
        display: flex;
        align-items: center;
        border: 1px solid var(--color-border);
        border-radius: 12px;
    }
    .nav a.nav-cta { justify-content: center; margin-top: 12px; border: none; }

    /* Hero: banner fills the section instead of a tiny letterboxed strip */
    .hero {
        margin-top: 68px;
        min-height: calc(100svh - 68px);
        padding: 24px 0 40px;
        background-size: cover;
        background-position: center;
    }
    .hero-content {
        padding: 28px 20px;
        border-radius: 16px;
    }
    .hero-badge { padding: 8px 14px; font-size: 0.75rem; margin-bottom: 20px; }
    .hero h2 { font-size: clamp(1.75rem, 8vw, 2.25rem); margin-bottom: 16px; }
    .hero-subtitle { font-size: 1rem; margin-bottom: 24px; }
    .hero-cta { gap: 12px; margin-bottom: 28px; align-items: stretch; }
    .hero-stats {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    .stat { text-align: center; }
    .stat-value { font-size: 1.5rem; }
    .stat-label { font-size: 0.6875rem; letter-spacing: 0.5px; }

    /* Sections */
    .services, .features, .cta, .cta-section { padding: 64px 0; }
    .section-header { margin-bottom: 36px; }
    .section-header p { font-size: 1rem; }
    .section-tag { font-size: 0.75rem; padding: 6px 12px; }
    .service-card { padding: 28px 20px; }
    .features-content { gap: 36px; }
    .feature-list { gap: 24px; }
    .dashboard-content { padding: 20px; }
    .chart-bar { width: 16px; }

    /* Buttons: comfortable touch size, full width */
    .btn, .btn-large {
        width: 100%;
        justify-content: center;
        min-height: 52px;
        padding: 14px 20px;
        font-size: 1rem;
    }
    .cta-buttons { flex-direction: column; gap: 12px; }

    /* Inner pages */
    .page-hero { padding: 104px 0 40px; }
    .page-hero p { font-size: 1.0625rem; }
    .breadcrumb { flex-wrap: wrap; margin-bottom: 16px; }
    .page-banner img { height: 180px; }
    .page-content { padding: 44px 0; }
    .content-grid, .contact-grid { gap: 36px; }
    .main-content h2 { font-size: 1.5rem; margin: 36px 0 16px; }
    .main-content h3 { font-size: 1.125rem; margin: 24px 0 12px; }
    .main-content p { line-height: 1.7; }
    .service-detail-card { padding: 22px 20px; }
    .services-detail-grid { gap: 16px; margin: 24px 0; }
    .contact-item { gap: 16px; }
    .contact-icon { width: 48px; height: 48px; flex-shrink: 0; }
    .sidebar { gap: 16px; flex-wrap: nowrap; }
    .sidebar-card { flex: 0 0 auto; }

    /* Forms: 16px font prevents iOS zoom on focus */
    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px;
        min-height: 50px;
    }
    .form-group textarea { min-height: 140px; }

    /* Footer */
    .footer { padding-top: 48px; }
    .footer-content { gap: 32px; }
    .footer-links { flex-direction: row; flex-wrap: wrap; gap: 32px 40px; }
    .footer-links a, .footer-column a { display: inline-block; padding: 6px 0; }
    .footer-bottom { padding-top: 24px; padding-bottom: env(safe-area-inset-bottom); }
}

@media (max-width: 480px) {
    .container { padding: 0 16px; }
    .hero-content { padding: 24px 16px; }
    .industries-grid { grid-template-columns: 1fr; }
    .footer-links { flex-direction: column; gap: 28px; }
}

@media (max-width: 360px) {
    .stat-value { font-size: 1.25rem; }
    .stat-label { font-size: 0.625rem; }
    .logo-img { height: 42px; }
}

/* Touch devices: no sticky hover lifts */
@media (hover: none) {
    .service-detail-card:hover, .btn-primary:hover, .nav-cta:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
