/* Prevent horizontal overflow */
body {
    overflow-x: hidden;
}

.navbar {
    width: 100%;
    overflow: visible;
}

.navbar .container {
    width: 100%;
    max-width: 1200px;
}

/* Tablet Styles */
@media (max-width: 968px) {
    .container {
        padding: 0 1.5rem;
    }

    /* Fix navbar layout for tablets */
    .navbar .container {
        display: flex;
        align-items: center;
        gap: 1.5rem;
        padding: 1rem 1.5rem;
    }

    .nav-brand {
        margin-right: auto;
    }

    .nav-menu {
        gap: 1.5rem;
    }

    .theme-toggle {
        flex-shrink: 0;
    }

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

    .hero-subtitle {
        font-size: 1.25rem;
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .projects-grid {
        grid-template-columns: repeat(4, 1fr);
        grid-auto-rows: 180px;
        gap: 1rem;
    }

    .project-card:nth-child(1) {
        grid-column: span 4;
        grid-row: span 2;
    }

    .project-card:nth-child(2) {
        grid-column: span 4;
        grid-row: span 2;
    }

    .project-card:nth-child(3) {
        grid-column: span 2;
        grid-row: span 2;
    }

    .project-card:nth-child(4) {
        grid-column: span 2;
        grid-row: span 2;
    }
}

/* iPad Pro specific fixes */
@media (max-width: 1024px) and (min-width: 769px) {
    .navbar {
        padding: 0;
    }
    
    .navbar .container {
        padding: 1rem 2rem;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .nav-menu {
        gap: 1rem;
        font-size: 0.9rem;
    }
    
    .theme-toggle {
        margin-left: 0.5rem;
        flex-shrink: 0;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    .navbar .container {
        padding: 1rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        position: relative;
    }

    /* Push theme toggle and hamburger to the right */
    .nav-brand {
        order: 1;
    }

    .theme-toggle {
        order: 2;
        margin-left: auto;
    }

    .mobile-menu-toggle {
        order: 3;
        margin-left: 1rem;
        display: flex;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 60px;
        flex-direction: column;
        background: var(--bg-primary);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: var(--shadow);
        padding: 2rem 0;
        gap: 0;
        order: 4;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-menu li {
        margin: 1rem 0;
    }

    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }

    .hero {
        padding: 6rem 0 4rem;
    }

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

    .hero-subtitle {
        font-size: 1.125rem;
    }

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

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

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

    section {
        padding: 3rem 0;
    }

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

    .projects-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
        gap: 1.5rem;
    }

    .project-card:nth-child(1),
    .project-card:nth-child(2),
    .project-card:nth-child(3),
    .project-card:nth-child(4) {
        grid-column: span 1;
        grid-row: span 1;
    }

    .project-card {
        min-height: 300px;
    }

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

    .timeline-item {
        padding-left: 2.5rem;
    }

    .timeline-marker {
        left: 4px;
    }

    .skill-tags {
        justify-content: center;
    }

    .contact-links {
        gap: 1rem;
    }
    
    .contact-link {
        min-width: 100px;
        padding: 1.25rem;
    }
}

/* Small Mobile Styles */
@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

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

    .section-title {
        font-size: 1.75rem;
    }

    .project-card, .timeline-content {
        padding: 1.5rem;
    }
}