/* Scroll and Mobile Fixes */

/* Fix double scrollbar issue */
html {
    overflow-x: hidden;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(23, 162, 184, 0.5) rgba(0, 0, 0, 0.1);
}

body {
    overflow-x: hidden !important;
    position: relative;
    width: 100%;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #0066CC 0%, #17A2B8 100%);
    border-radius: 10px;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #17A2B8 0%, #0066CC 100%);
}

/* Smooth scroll for all sections */
section {
    scroll-margin-top: 80px;
}

/* Prevent horizontal overflow on all sections */
.container {
    max-width: 100%;
    overflow-x: hidden;
    padding: 0 20px;
}

/* Mobile-specific fixes */
@media (max-width: 768px) {
    /* Prevent horizontal scroll */
    html, body {
        max-width: 100%;
        overflow-x: hidden !important;
    }

    /* Fix container padding */
    .container {
        padding: 0 15px;
        width: 100%;
        box-sizing: border-box;
    }

    /* Center all text on mobile */
    .hero-title,
    .hero-subtitle,
    .hero-description,
    .section-title,
    .about-intro,
    .about-description,
    .timeline-title,
    .timeline-company,
    .timeline-location,
    .project-title,
    .project-description,
    .contact-subtitle,
    .contact-description {
        text-align: center !important;
    }

    /* Fix hero section on mobile */
    .hero-content {
        padding: 20px;
        width: 100%;
        box-sizing: border-box;
    }

    .hero-text {
        width: 100%;
        max-width: 100%;
        padding: 0;
    }

    .hero-title {
        font-size: clamp(2rem, 8vw, 3rem);
        line-height: 1.2;
        margin-bottom: 1rem;
    }

    .hero-word {
        display: inline-block;
        margin: 0 0.25rem;
    }

    .hero-subtitle {
        font-size: clamp(0.9rem, 3vw, 1.2rem);
        margin-bottom: 1rem;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 0.5rem;
    }

    .hero-description {
        font-size: clamp(0.9rem, 2.5vw, 1.1rem);
        line-height: 1.6;
        padding: 0 10px;
        margin: 0 auto 2rem;
        max-width: 100%;
    }

    /* Fix buttons on mobile */
    .hero-cta {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        width: 100%;
        align-items: center;
    }

    .btn {
        width: 90%;
        max-width: 280px;
        padding: 12px 24px;
        font-size: 0.95rem;
    }

    /* Fix about section on mobile */
    .about-content {
        flex-direction: column;
        gap: 2rem;
    }

    .about-text {
        width: 100%;
        padding: 0;
    }

    .about-stats {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1.5rem;
        margin-top: 2rem;
    }

    .stat-item {
        min-width: 100px;
        text-align: center;
    }

    /* Fix orbit visualization on mobile */
    .about-visual {
        width: 100%;
        display: flex;
        justify-content: center;
        transform: scale(0.8);
        margin: 0;
    }

    .orbit-container {
        margin: 0 auto;
    }

    /* Fix timeline on mobile */
    .timeline {
        padding: 0;
        margin: 0;
    }

    .timeline-item {
        padding-left: 40px;
        margin: 0;
    }

    .timeline-item::before {
        left: 15px;
    }

    .timeline-item::after {
        left: 8px;
    }

    .timeline-content {
        padding: 20px;
        width: calc(100% - 20px);
        margin-left: 0;
    }

    .timeline-achievements {
        padding-left: 20px;
        font-size: 0.9rem;
        text-align: left;
    }

    /* Fix skills section on mobile */
    .skills-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0;
    }

    .skill-category {
        width: 100%;
        padding: 1.5rem;
    }

    .skill-item {
        margin-bottom: 1.5rem;
    }

    /* Fix projects grid on mobile */
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0;
    }

    .project-card {
        width: 100%;
        margin: 0;
    }

    .project-content {
        padding: 1.5rem;
    }

    /* Fix contact section on mobile */
    .contact-content {
        flex-direction: column;
        gap: 2rem;
        padding: 0;
    }

    .contact-info,
    .contact-form {
        width: 100%;
        padding: 0;
    }

    .contact-item {
        justify-content: center;
        flex-wrap: wrap;
    }

    /* Fix form on mobile */
    .form {
        width: 100%;
        padding: 0;
    }

    .form-group {
        width: 100%;
        margin-bottom: 1.5rem;
    }

    .form-input {
        width: 100%;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Fix navigation menu on mobile */
    .nav-menu {
        width: 100%;
        max-width: 100%;
        right: 0;
        left: 0;
        padding: 2rem 0;
    }

    .nav-link {
        padding: 1rem;
        font-size: 1.1rem;
    }

    /* Fix section headers */
    .section-header {
        margin-bottom: 2rem;
        padding: 0;
    }

    .section-title {
        font-size: clamp(1.8rem, 6vw, 2.5rem);
    }

    /* Fix footer on mobile */
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
        padding: 2rem 1rem;
    }

    /* Hide code window on small mobile */
    .hero-visual {
        display: none;
    }

    /* Fix scroll indicator */
    .scroll-indicator {
        bottom: 20px;
    }

    /* Prevent any element from causing overflow */
    * {
        max-width: 100%;
    }

    /* Fix tech tags */
    .timeline-tech {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .tech-tag {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    /* Fix social links */
    .social-links {
        justify-content: center;
        margin-top: 1.5rem;
    }
}

/* Tablet specific adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 0 30px;
    }

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

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

/* Smooth scrolling enhancement */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }

    /* Add smooth transitions to all interactive elements */
    a, button, .btn, .nav-link, .project-card, .skill-item {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

/* Fix for landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        min-height: 100vh;
        padding: 60px 0 40px;
    }

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

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

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

/* Ensure smooth scroll snap (optional - remove if not desired) */
.smooth-scroll-container {
    scroll-snap-type: y proximity;
    scroll-padding-top: 80px;
}

section {
    scroll-snap-align: start;
    scroll-snap-stop: normal;
}