/* ============================================================
   MakCode Studio — Responsive Styles
   Breakpoints: 1200px, 992px, 768px, 576px
   ============================================================ */

/* ── Large Desktop (≤ 1200px) ────────────────────────────────── */
@media (max-width: 1200px) {
    .hero-container {
        gap: var(--space-2xl);
    }

    .floating-laptop {
        width: 360px;
        height: 240px;
    }

    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tech-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .footer-grid {
        grid-template-columns: 1.5fr 1fr 1fr 1.5fr;
        gap: var(--space-2xl);
    }

    .stats-grid {
        gap: var(--space-lg);
    }

    .portfolio-grid {
        gap: var(--space-lg);
    }
}

/* ── Tablet Landscape (≤ 992px) ──────────────────────────────── */
@media (max-width: 992px) {
    :root {
        --nav-height: 70px;
    }

    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-content {
        order: 1;
    }

    .hero-visual {
        order: 0;
        min-height: 350px;
    }

    .hero-description {
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-stats {
        justify-content: center;
    }

    .floating-laptop {
        width: 320px;
        height: 220px;
    }

    /* Navigation — Mobile */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 400px;
        height: 100vh;
        background: rgba(5, 8, 22, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        padding: calc(var(--nav-height) + var(--space-xl)) var(--space-2xl) var(--space-2xl);
        gap: var(--space-xs);
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        border-left: 1px solid rgba(255, 255, 255, 0.05);
        overflow-y: auto;
        z-index: 999;
    }

    .nav-links.active {
        right: 0;
    }

    .nav-link {
        width: 100%;
        padding: 12px 16px;
        font-size: 1rem;
        border-radius: var(--border-radius-sm);
    }

    .nav-link:hover {
        background: rgba(255, 255, 255, 0.03);
    }

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

    .nav-toggle {
        display: flex;
    }

    .nav-cta {
        margin-top: var(--space-md);
        width: 100%;
        text-align: center;
    }

    /* Mega Menu — Mobile */
    .mega-menu {
        position: static;
        transform: none;
        min-width: 100%;
        grid-template-columns: 1fr;
        border: none;
        border-radius: 0;
        background: rgba(255, 255, 255, 0.02);
        padding: var(--space-md);
        margin-top: var(--space-sm);
        box-shadow: none;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
    }

    .nav-item-dropdown.open .mega-menu {
        max-height: 1000px;
        opacity: 1;
        visibility: visible;
    }

    /* Mobile Overlay */
    .nav-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }

    .nav-overlay.active {
        display: block;
    }

    /* Grids */
    .about-story {
        grid-template-columns: 1fr;
        gap: var(--space-2xl);
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .pricing-grid {
        grid-template-columns: 1fr;
        max-width: 500px;
        margin-left: auto;
        margin-right: auto;
    }

    .pricing-card.featured {
        transform: none;
    }

    .pricing-card.featured:hover {
        transform: translateY(-8px);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .portfolio-grid {
        grid-template-columns: 1fr;
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }

    .tech-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .values-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .why-grid {
        grid-template-columns: 1fr;
    }

    .careers-grid {
        grid-template-columns: 1fr;
    }

    .case-study-grid {
        grid-template-columns: 1fr;
    }

    .benefits-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-2xl);
    }

    /* Timeline — Mobile */
    .timeline::before {
        left: 20px;
    }

    .timeline-item,
    .timeline-item:nth-child(even) {
        justify-content: flex-start;
        padding-right: 0;
        padding-left: 60px;
    }

    .timeline-marker {
        left: 20px;
    }

    .timeline-content {
        max-width: 100%;
    }

    /* Testimonials */
    .testimonial-card {
        min-width: calc(50% - var(--space-xl));
    }

    /* Custom cursor hidden on touch */
    .custom-cursor,
    .cursor-dot,
    .cursor-trail {
        display: none !important;
    }

    /* Section spacing */
    .section {
        padding: var(--space-4xl) 0;
    }

    .page-header {
        padding: calc(var(--nav-height) + var(--space-3xl)) 0 var(--space-3xl);
    }
}

/* ── Tablet Portrait (≤ 768px) ───────────────────────────────── */
@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-lg);
    }

    h1 { font-size: clamp(2rem, 6vw, 2.8rem); }
    h2 { font-size: clamp(1.6rem, 5vw, 2.2rem); }

    .section {
        padding: var(--space-3xl) 0;
    }

    .section-header {
        margin-bottom: var(--space-2xl);
    }

    .hero {
        min-height: auto;
        padding-top: calc(var(--nav-height) + var(--space-2xl));
        padding-bottom: var(--space-2xl);
    }

    .hero-visual {
        min-height: 280px;
    }

    .floating-laptop {
        width: 280px;
        height: 190px;
    }

    .floating-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .glass-ui-element {
        display: none;
    }

    .hero-stats {
        gap: var(--space-xl);
    }

    .hero-stat-number {
        font-size: 1.5rem;
    }

    .services-grid {
        grid-template-columns: 1fr;
    }

    .tech-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-md);
    }

    .blog-grid {
        grid-template-columns: 1fr;
    }

    .values-grid {
        grid-template-columns: 1fr;
    }

    .benefits-grid {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    .footer-bottom-links {
        justify-content: center;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* Testimonials */
    .testimonial-card {
        min-width: 100%;
    }

    .slider-controls {
        gap: var(--space-sm);
    }

    .stat-number {
        font-size: 2.2rem;
    }

    .pricing-amount {
        font-size: 2.5rem;
    }

    .btn {
        padding: 12px 24px;
        font-size: 0.9rem;
    }

    .btn-lg {
        padding: 14px 28px;
    }

    .floating-actions {
        bottom: 20px;
        right: 20px;
    }

    .floating-action-btn {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

    /* Background decorations smaller */
    .bg-glow {
        filter: blur(60px);
        opacity: 0.7;
    }

    .bg-glow-1 {
        width: 300px;
        height: 300px;
    }

    .bg-glow-2 {
        width: 250px;
        height: 250px;
    }

    .floating-shape {
        opacity: 0.08;
    }

    .culture-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Mobile (≤ 576px) ────────────────────────────────────────── */
@media (max-width: 576px) {
    :root {
        --nav-height: 64px;
    }

    .container {
        padding: 0 var(--space-md);
    }

    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.2rem; }

    .section {
        padding: var(--space-2xl) 0;
    }

    .section-label {
        font-size: 0.7rem;
    }

    .section-subtitle {
        font-size: 0.95rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-description {
        font-size: 1rem;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }

    .hero-buttons .btn {
        width: 100%;
    }

    .hero-stats {
        flex-wrap: wrap;
        gap: var(--space-lg);
    }

    .hero-stat-item {
        width: calc(50% - var(--space-lg));
    }

    .hero-visual {
        min-height: 240px;
    }

    .floating-laptop {
        width: 240px;
        height: 165px;
    }

    .floating-icon:nth-child(n+4) {
        display: none;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
    }

    .stat-card {
        padding: var(--space-lg);
    }

    .stat-number {
        font-size: 1.8rem;
    }

    .glass-card {
        padding: var(--space-lg);
    }

    .service-card {
        padding: var(--space-lg);
    }

    .tech-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .portfolio-filters {
        gap: 6px;
    }

    .filter-btn {
        padding: 8px 16px;
        font-size: 0.75rem;
    }

    .portfolio-image {
        height: 180px;
    }

    .pricing-card {
        padding: var(--space-lg);
    }

    .pricing-amount {
        font-size: 2rem;
    }

    .blog-image {
        height: 160px;
    }

    .faq-question {
        padding: var(--space-lg);
        font-size: 0.9rem;
    }

    .faq-answer p {
        padding: 0 var(--space-lg) var(--space-lg);
        font-size: 0.85rem;
    }

    .contact-info-card {
        flex-direction: column;
        text-align: center;
        padding: var(--space-lg);
    }

    .social-links {
        justify-content: center;
    }

    .nav-logo {
        gap: 8px;
        flex-shrink: 0;
        white-space: nowrap !important;
    }

    .nav-logo img {
        height: 32px;
        width: auto;
        flex-shrink: 0;
        display: block;
    }

    .nav-logo-text {
        font-size: 1rem !important;
        white-space: nowrap !important;
        flex-shrink: 0;
        word-break: keep-all;
    }

    .nav-links {
        width: 90%;
    }

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

    .newsletter-btn {
        width: 100%;
    }

    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }

    .cta-buttons .btn {
        width: 100%;
        max-width: 300px;
    }

    .breadcrumb {
        font-size: 0.75rem;
    }

    .page-header h1 {
        font-size: 1.8rem;
    }

    .page-header p {
        font-size: 0.95rem;
    }

    .timeline-item,
    .timeline-item:nth-child(even) {
        padding-left: 45px;
    }

    .timeline::before {
        left: 12px;
    }

    .timeline-marker {
        left: 12px;
        width: 16px;
        height: 16px;
    }

    .career-card {
        padding: var(--space-lg);
    }

    .case-study-image {
        height: 160px;
    }
}

/* ── Very Small Screens (≤ 380px) ────────────────────────────── */
@media (max-width: 380px) {
    .container {
        padding: 0 12px;
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.3rem; }

    .hero-title {
        font-size: 1.6rem;
    }

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

    .tech-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-stat-item {
        width: 100%;
    }

    .floating-laptop {
        width: 200px;
        height: 140px;
    }
}

/* ── Hover Capability Detection ──────────────────────────────── */
@media (hover: none) {
    .custom-cursor,
    .cursor-dot,
    .cursor-trail,
    .mouse-glow {
        display: none !important;
    }

    /* Simplify hover effects on touch */
    .glass-card:hover,
    .service-card:hover,
    .portfolio-card:hover,
    .blog-card:hover,
    .tech-card:hover,
    .stat-card:hover,
    .testimonial-card:hover,
    .career-card:hover,
    .case-study-card:hover {
        transform: none;
    }
}

/* ── Landscape Phone ─────────────────────────────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: calc(var(--nav-height) + var(--space-xl)) 0 var(--space-xl);
    }

    .hero-visual {
        min-height: 200px;
    }
}
