/* ==========================================================================
   VEOSOFT — SUPER RESPONSIVE MEDIA QUERIES
   Breakpoints: 1400 / 1200 / 1024 / 992 / 768 / 576 / 480 / 375
   ========================================================================== */

/* ── 0. Fluid base ────────────────────────────────────────────────── */
html {
    /* Fluid font-size: 14px → 16px across 375–1400px */
    font-size: clamp(14px, calc(14px + (16 - 14) * ((100vw - 375px) / (1400 - 375))), 16px);
}

/* Make all images and media fluid */
img, video, canvas, svg {
    max-width: 100%;
    height: auto;
}

/* ── 1. Large Screens (≤ 1400px) ─────────────────────────────────── */
@media (max-width: 1400px) {
    .section {
        padding: 7rem 2.5rem 4.5rem;
    }

    .hero {
        padding: 8rem 2.5rem 5rem;
    }

    .footer-container {
        gap: 2.5rem;
    }
}

/* ── 2. Desktops (≤ 1200px) ──────────────────────────────────────── */
@media (max-width: 1200px) {
    .section-title {
        font-size: 2.25rem;
    }

    .hero-title {
        font-size: 3.5rem;
    }

    .bento-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.25rem;
    }

    .footer-container {
        grid-template-columns: 1.6fr 1fr 1fr 1.4fr;
        gap: 2rem;
    }

    .contact-grid {
        gap: 2rem;
    }
}

/* ── 3. Tablets Landscape (≤ 1024px) ─────────────────────────────── */
@media (max-width: 1024px) {
    .hero-title {
        font-size: 3rem;
    }

    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .span-2 {
        grid-column: span 2;
    }

    .span-3 {
        grid-column: span 2;
    }

    .pricing-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }

    .pricing-card {
        padding: 1.75rem;
    }

    .contact-grid {
        grid-template-columns: 1fr 1.2fr;
    }

    .about-story-grid {
        gap: 2.5rem;
    }

    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── 4. Tablets Portrait (≤ 992px) — Mobile nav triggers ─────────── */
@media (max-width: 992px) {
    /* --- Mobile Navigation Drawer --- */
    .navbar-menu {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        width: min(300px, 85vw);
        height: 100dvh;
        background: rgba(252, 252, 253, 0.98);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        border-left: 1px solid var(--border-color);
        padding: 5.5rem 2rem 2rem;
        z-index: 1001; /* Ensure it is on top of navbar bar */
        align-items: flex-start;
        gap: 0.25rem;
        box-shadow: -12px 0 40px rgba(0, 0, 0, 0.06);
        transform: translateX(100%);
        visibility: hidden;
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        pointer-events: none;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .navbar-menu.active {
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
    }

    .mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 8px;
        background: rgba(9, 9, 11, 0.04);
        border: 1px solid var(--border-color);
        position: relative;
        z-index: 1005; /* High z-index to click/close over drawer */
    }

    /* Mobile nav items & full width list reset */
    .navbar-menu li {
        width: 100%;
    }

    .navbar-menu .navbar-item {
        border-bottom: 1px solid var(--border-color);
    }

    .navbar-menu .navbar-item a {
        font-size: 1.05rem;
        font-weight: 500;
        display: block;
        padding: 0.85rem 0;
        color: var(--text);
    }

    .navbar-menu .navbar-item a:hover {
        color: var(--primary);
    }

    .navbar-menu .navbar-cta {
        margin-top: 1.25rem;
        width: 100%;
        text-align: center;
        padding: 0.75rem 1rem;
        display: block;
        border-radius: 8px;
    }

    /* Mobile full-screen overlay backdrop */
    .navbar:has(.navbar-menu.active)::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.2);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 997; /* Behind drawer but above normal content */
        pointer-events: auto;
        animation: fadeIn 0.3s ease forwards;
    }

    /* --- Bento Grid Tablet --- */
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    .span-2 {
        grid-column: span 2;
    }

    .span-3 {
        grid-column: span 2;
    }

    /* --- Content Grids --- */
    .portfolio-grid,
    .blog-grid,
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .pricing-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .pricing-card.popular {
        /* Highlight popular card */
        order: -1;
        grid-column: span 2;
        max-width: 480px;
        margin: 0 auto;
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    /* --- Footer --- */
    .footer-container {
        grid-template-columns: 1fr 1fr;
        gap: 2.5rem;
    }

    .footer-info {
        grid-column: span 2;
    }

    .footer-newsletter {
        grid-column: span 2;
    }

    /* --- About story grid --- */
    .about-story-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    /* --- Contact grid --- */
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .contact-form-card {
        padding: 2rem;
    }

    /* --- Section spacing --- */
    .section {
        padding: 6rem 2rem 4rem;
    }

    .section-header {
        margin-bottom: 3rem;
    }
}

/* ── 5. Small Tablets / Large Phones (≤ 768px) ────────────────────── */
@media (max-width: 768px) {
    /* --- Typography --- */
    .section-title {
        font-size: 1.9rem;
        letter-spacing: -0.03em;
    }

    .hero-title {
        font-size: 2.6rem;
        line-height: 1.12;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 2.5rem;
    }

    .section-desc {
        font-size: 0.95rem;
    }

    /* --- Sections --- */
    .section {
        padding: 5.5rem 1.5rem 3.5rem;
    }

    .hero {
        padding: 7rem 1.5rem 4rem;
        min-height: 90vh;
    }

    /* --- Bento: full-width stack --- */
    .bento-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .span-2,
    .span-3 {
        grid-column: span 1;
    }

    /* --- Other grids stack --- */
    .portfolio-grid,
    .blog-grid,
    .services-grid,
    .pricing-grid,
    .stats-grid,
    .about-story-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .pricing-card.popular {
        order: unset;
        grid-column: unset;
        max-width: unset;
    }

    /* --- Stats --- */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-number {
        font-size: 2.5rem;
    }

    /* --- Bento cards --- */
    .bento-card {
        padding: 1.75rem;
    }

    .testimonial-card {
        padding: 1.75rem;
    }

    /* --- Code panel --- */
    .code-panel {
        font-size: 0.75rem;
    }

    .code-body {
        padding: 1rem;
    }

    /* --- Timeline: all left-aligned --- */
    .process-timeline {
        margin-top: 2.5rem;
    }

    .timeline-progress-line {
        left: 20px !important;
    }

    .timeline-step {
        justify-content: flex-start !important;
        margin-bottom: 2.5rem;
    }

    .timeline-step:nth-child(even) {
        justify-content: flex-start !important;
    }

    .timeline-content-wrapper {
        width: calc(100% - 50px) !important;
        padding-left: 20px !important;
        margin-left: 50px;
    }

    .timeline-dot {
        left: 20px !important;
        transform: translateX(-50%) !important;
    }

    /* --- Footer --- */
    .footer {
        padding: 4rem 1.5rem 2rem;
    }

    .footer-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-info {
        grid-column: span 1;
    }

    .footer-newsletter {
        grid-column: span 1;
    }

    .footer-info-desc {
        max-width: 100%;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-top: 2.5rem;
    }

    .footer-bottom-links {
        gap: 1rem;
    }

    /* --- Form row: stack --- */
    .form-group.row {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    /* --- Budget Slider Touch Targets --- */
    .slider-control {
        height: 40px;
        background: transparent;
        margin: 5px 0;
    }
    .slider-control::-webkit-slider-runnable-track {
        height: 6px;
    }
    .slider-control::-moz-range-track {
        height: 6px;
    }
    .slider-control::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
        margin-top: -9px; /* Center 24px thumb on 6px track */
    }
    .slider-control::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
    .slider-control::-moz-range-progress {
        height: 6px;
    }

    /* --- Contact map --- */
    .contact-map-placeholder {
        height: 120px;
    }

    /* --- Chat widget --- */
    .chat-widget {
        bottom: 1.25rem;
        right: 1.25rem;
    }

    .chat-window {
        width: calc(100vw - 2.5rem);
        max-width: 400px;
        height: 420px;
    }

    /* --- Back to top --- */
    .back-to-top {
        bottom: 1.25rem;
        left: 1.25rem;
        width: 34px;
        height: 34px;
    }

    /* --- Hero buttons: responsive wrap --- */
    .hero-buttons {
        flex-direction: column;
        align-items: center;
        gap: 0.85rem;
    }

    .hero-buttons .btn {
        width: 100%;
        max-width: 320px;
        justify-content: center;
    }

    /* --- Portfolio img height --- */
    .portfolio-img-container {
        height: 180px;
    }

    /* --- Swiper pagination spacing --- */
    .testimonials-slider {
        padding-bottom: 3rem !important;
    }

    /* --- FAQ --- */
    .faq-header {
        padding: 1.25rem 1.5rem;
    }

    .faq-content p {
        padding: 0 1.5rem 1.25rem;
    }

    /* --- Preloader --- */
    .preloader-logo {
        font-size: 1.75rem;
    }
}

/* ── 6. Small Mobile Devices (≤ 576px) ───────────────────────────── */
@media (max-width: 576px) {
    /* --- Navbar --- */
    .navbar {
        padding: 1rem 1.25rem;
    }

    .navbar.scrolled {
        padding: 0.75rem 1.25rem;
    }

    .navbar-logo {
        font-size: 1.25rem;
    }

    /* --- Hero --- */
    .hero {
        padding: 5.5rem 1.25rem 3rem;
        min-height: 85vh;
    }

    .hero-title {
        font-size: 2.1rem !important;
        line-height: 1.15;
    }

    .hero-subtitle {
        font-size: 0.9rem !important;
        line-height: 1.6;
        margin-bottom: 2rem;
    }

    .hero-badge {
        margin-bottom: 1rem;
    }

    /* --- Sections --- */
    .section {
        padding: 5rem 1.25rem 3rem;
    }

    .section-title {
        font-size: 1.7rem;
    }

    .section-header {
        margin-bottom: 2.25rem;
    }

    /* --- Bento cards --- */
    .bento-card,
    .glass-card {
        padding: 1.5rem;
    }

    .testimonial-card {
        padding: 1.5rem;
    }

    /* --- Stats --- */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.85rem;
    }

    .stat-card {
        padding: 1.75rem 1rem;
    }

    .stat-number {
        font-size: 2.25rem;
    }

    /* --- Buttons --- */
    .btn {
        font-size: 0.9rem;
        padding: 0.7rem 1.4rem;
    }

    /* --- Newsletter: stack vertical --- */
    .newsletter-form {
        flex-direction: column;
        gap: 0.6rem;
    }

    .newsletter-btn {
        width: 100%;
        height: 40px;
        border-radius: 6px;
        justify-content: center;
    }

    .newsletter-input {
        padding: 0.7rem 1rem;
    }

    /* --- Contact form card --- */
    .contact-form-card {
        padding: 1.5rem;
    }

    /* --- Pricing headers --- */
    .pricing-price {
        font-size: 1.9rem;
    }

    /* --- Service icons --- */
    .service-icon {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }

    /* --- Code panel font --- */
    .code-panel,
    .code-body {
        font-size: 0.72rem;
    }

    /* --- Threads monitor height --- */
    .threads-monitor {
        height: 150px;
    }

    /* --- FAQ --- */
    .faq-header {
        padding: 1rem 1.25rem;
        gap: 0.75rem;
    }

    .faq-header h3 {
        font-size: 0.9rem;
    }

    .faq-content p {
        padding: 0 1.25rem 1rem;
        font-size: 0.85rem;
    }

    /* --- Portfolio info --- */
    .portfolio-info {
        padding: 1.25rem;
    }

    /* --- Footer bottom --- */
    .footer-bottom-links {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    /* --- Chat window --- */
    .chat-window {
        width: calc(100vw - 2rem);
        height: 400px;
    }

    /* --- Timeline content --- */
    .timeline-content {
        padding: 1.25rem;
    }

    /* --- Back to top position adjustment (no overlap with chat) --- */
    .back-to-top {
        bottom: 1rem;
        left: 1rem;
    }

    .chat-widget {
        bottom: 1rem;
        right: 1rem;
    }
}

/* ── 7. Extra Small Devices (≤ 480px) ────────────────────────────── */
@media (max-width: 480px) {
    .hero-title {
        font-size: 1.85rem !important;
    }

    .section-title {
        font-size: 1.55rem;
    }

    /* --- Stats: 2 columns, tighter --- */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-number {
        font-size: 2rem;
    }

    /* --- Bento grid gap --- */
    .bento-grid {
        gap: 0.85rem;
    }

    /* --- Portfolio img --- */
    .portfolio-img-container {
        height: 160px;
    }

    /* --- Testimonials: padding --- */
    .testimonial-quote {
        font-size: 0.9rem;
    }

    /* --- Pricing price shrink --- */
    .pricing-price {
        font-size: 1.7rem;
    }

    /* --- Navbar logo trim --- */
    .navbar-logo {
        font-size: 1.15rem;
    }

    /* --- Process timeline content --- */
    .timeline-content h3 {
        font-size: 1rem;
    }

    .timeline-content-wrapper {
        width: calc(100% - 40px) !important;
        margin-left: 40px;
    }

    /* --- Footer column gap --- */
    .footer {
        padding: 3.5rem 1rem 1.75rem;
    }

    /* --- Contact details icon --- */
    .contact-detail-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

/* ── 8. Micro Phones (≤ 375px) ───────────────────────────────────── */
@media (max-width: 375px) {
    .navbar-logo {
        font-size: 1rem;
        letter-spacing: -0.03em;
    }

    .hero-title {
        font-size: 1.65rem !important;
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 0.85rem !important;
    }

    .section-title {
        font-size: 1.45rem;
    }

    .bento-card,
    .glass-card {
        padding: 1.25rem;
    }

    .testimonial-card {
        padding: 1.25rem;
    }

    .btn {
        font-size: 0.85rem;
        padding: 0.65rem 1.2rem;
    }

    .badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
    }

    .stat-number {
        font-size: 1.75rem;
    }

    .stat-card {
        padding: 1.5rem 0.75rem;
    }

    .stats-grid {
        gap: 0.65rem;
    }

    .pricing-price {
        font-size: 1.55rem;
    }

    .chat-window {
        width: calc(100vw - 1.5rem);
        height: 380px;
    }

    /* Footer compact */
    .footer-bottom {
        gap: 0.5rem;
    }

    .footer-bottom-links {
        gap: 0.5rem;
    }
}

/* ── 9. Touch & Motion Overrides ─────────────────────────────────── */

/* Disable hover transforms on touch devices (avoids sticky hover states) */
@media (hover: none) and (pointer: coarse) {
    .bento-card:hover {
        transform: none;
        border-color: var(--border-color);
        box-shadow: none;
    }

    .btn:hover {
        transform: none;
    }

    .navbar-cta:hover {
        transform: none;
    }

    .chat-toggle:hover {
        transform: none;
    }

    .service-link:hover i {
        transform: none;
    }
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── 10. Landscape Phone Overrides ───────────────────────────────── */
@media (max-width: 768px) and (orientation: landscape) and (max-height: 450px) {
    .hero {
        min-height: auto;
        padding: 5rem 1.5rem 3rem;
    }

    .hero-title {
        font-size: 2rem !important;
    }

    .hero-subtitle {
        display: none; /* Too cramped in landscape on small phones */
    }

    .navbar-menu {
        padding-top: 4rem;
        overflow-y: auto;
    }
}

/* ── 11. Utility: Prevent horizontal scroll leak ─────────────────── */
body {
    overflow-x: hidden;
}

#content-container {
    position: relative;
    width: 100%;
    overflow-x: hidden;
}

/* Safe area insets for notched phones */
@supports (padding: max(0px)) {
    .navbar {
        padding-left: max(2rem, env(safe-area-inset-left));
        padding-right: max(2rem, env(safe-area-inset-right));
    }

    @media (max-width: 576px) {
        .navbar {
            padding-left: max(1.25rem, env(safe-area-inset-left));
            padding-right: max(1.25rem, env(safe-area-inset-right));
        }
    }

    .footer {
        padding-bottom: max(2.5rem, env(safe-area-inset-bottom));
    }

    .chat-widget {
        bottom: max(2rem, env(safe-area-inset-bottom));
        right: max(2rem, env(safe-area-inset-right));
    }

    .back-to-top {
        bottom: max(2rem, env(safe-area-inset-bottom));
        left: max(2rem, env(safe-area-inset-left));
    }
}
/* ── 12. Mobile Form Interaction Fixes ───────────────────────────── */

/* iOS Safari: prevent zoom on input focus (must be >= 16px) */
@media (max-width: 992px) {
    input,
    textarea,
    select,
    .form-control,
    .newsletter-input,
    .chat-input {
        font-size: 16px !important;
        /* Ensure tap targets are large enough */
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(234, 88, 12, 0.08);
    }

    textarea.form-control {
        min-height: 120px;
    }

    /* Fix: bento-card overflow:hidden clips the custom select dropdown */
    .contact-form-card {
        overflow: visible !important;
    }

    /* Fix: ensure custom select dropdown is above everything on mobile */
    .custom-select-wrapper {
        position: relative;
        z-index: 50;
    }

    .custom-options-container {
        z-index: 200;
        /* Ensure dropdown renders above card boundary */
        position: absolute;
    }

    /* Fix: newsletter form inputs on mobile */
    .newsletter-input {
        font-size: 16px !important;
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(234, 88, 12, 0.08);
    }

    .newsletter-btn {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
    }

    /* Fix: make all form buttons tappable */
    .btn,
    button[type="submit"],
    .filter-btn {
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(234, 88, 12, 0.08);
        cursor: pointer;
    }

    /* Fix: remove transform on bento-card hover that can interfere with touch */
    .bento-card {
        -webkit-overflow-scrolling: touch;
    }

    /* Fix: form group labels fully tappable */
    .form-label {
        display: block;
        padding: 0.25rem 0;
    }

    /* Fix: custom select trigger tap area */
    .custom-select-trigger {
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(234, 88, 12, 0.08);
        cursor: pointer;
        user-select: none;
        -webkit-user-select: none;
    }

    /* Fix: slider control on mobile */
    .slider-control {
        min-height: 44px;
        touch-action: pan-x;
        cursor: pointer;
    }

    /* Safety overlays prevention and input enablement */
    input, textarea, select, .form-control, .newsletter-input, .chat-input {
        pointer-events: auto !important;
        -webkit-user-select: text !important;
        user-select: text !important;
    }
}

/* Fix specifically for phones: ensure footer newsletter form is fully interactive */
@media (max-width: 768px) {
    .footer-newsletter {
        position: relative;
        z-index: 1;
    }

    .newsletter-form {
        position: relative;
        z-index: 2;
        touch-action: manipulation;
    }

    .newsletter-input,
    .newsletter-btn {
        position: relative;
        z-index: 3;
    }
}

