/* Responsive Design and Mobile Optimizations */

/* General Mobile Responsiveness */
@media (max-width: 768px) {
    /* Hero Section */
    .glitch {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1.2rem;
    }

    /* Profile Section */
    .profile-container {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 1rem;
    }

    .profile-card {
        max-width: 100%;
        aspect-ratio: 1;
    }

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

    .profile-text {
        font-size: 1rem;
    }

    /* Projects Section */
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 1rem;
    }

    .project-card {
        max-width: 100%;
    }

    .projects-title, .section-title {
        font-size: 2rem;
        padding: 0 1rem;
    }

    .project-video {
        aspect-ratio: 16/9;
        height: auto;
    }

    .project-content {
        padding: 1.5rem;
    }

    .project-title {
        font-size: 1.3rem;
    }

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

    /* Experience Section */
    .experience-section {
        padding: 4rem 1rem;
    }

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

    .timeline-content {
        width: 100%;
        margin: 0 !important;
        padding: 1.5rem;
    }

    .timeline-role {
        font-size: 1.3rem;
    }

    .timeline-skills {
        flex-wrap: wrap;
    }

    .timeline-line {
        left: 20px;
    }

    .timeline-item {
        flex-direction: column;
        align-items: flex-start;
        margin-left: 40px;
    }

    .timeline-content {
        width: calc(100% - 40px);
        margin: 0 !important;
    }

    .timeline-dot {
        left: -25px; /* Position so left edge touches the timeline line at 20px */
        top: 50%; /* Center vertically relative to the timeline-content */
        transform: translateY(-50%); /* Perfect vertical centering */
    }

    .timeline-connector {
        display: none;
    }

    /* Skills Section */
    .skills-section {
        padding: 4rem 1rem;
    }

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

    .skills-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 1rem;
    }

    .skill-category {
        padding: 1.5rem;
    }

    /* Contact Section */
    .contact-section {
        padding: 4rem 1rem;
    }

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

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

    .contact-form {
        padding: 1.5rem;
    }

    .form-input {
        font-size: 1rem;
    }

    /* Social Links */
    .social-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .social-link {
        width: 45px;
        height: 45px;
    }

    /* Footer */
    .footer-content {
        flex-direction: column;
        gap: 2rem;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .glitch {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .project-links {
        flex-direction: column;
        gap: 0.5rem;
    }

    .project-link {
        width: 100%;
        text-align: center;
    }

    .tech-stack {
        gap: 0.5rem;
    }

    .tech-item {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}

/* Landscape Mode */
@media (max-height: 600px) and (orientation: landscape) {
    .hero {
        height: auto;
        min-height: 100vh;
        padding: 2rem 0;
    }

    .profile-card {
        aspect-ratio: 16/9;
    }
}

/* Tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

/* Medium devices (tablets) */
@media (min-width: 769px) and (max-width: 992px) {
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Touch Device Optimizations */
@media (hover: none) {
    .project-card:hover {
        transform: none;
    }

    .social-link:hover {
        transform: none;
    }

    .tech-item:hover {
        background: rgba(255,255,255,0.1);
        color: var(--neon-blue);
    }
}

/* Modal Responsive */
@media (max-height: 800px) {
    .project-modal {
        align-items: flex-start;
    }
    
    .modal-content {
        margin: 1rem auto;
    }
}

/* Safe Area Support for Notched Phones */
@supports (padding: env(safe-area-inset-top)) {
    .hero,
    .profile-section,
    .projects-section,
    .experience-section,
    .skills-section,
    .contact-section {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* Mobile Touch Interactions */
.touch-active {
    transform: scale(0.98);
    opacity: 0.8;
    transition: transform 0.1s ease, opacity 0.1s ease;
}

.project-card.swiping {
    transition: transform 0.1s ease;
    cursor: grabbing;
}

.project-card.project-highlight {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 243, 255, 0.3);
    border: 2px solid var(--neon-blue);
    transition: all 0.3s ease;
}

/* Improved touch targets for mobile */
@media (max-width: 768px) {
    button, a, .tech-item, .timeline-skill {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    .theme-toggle {
        width: 50px;
        height: 50px;
        top: 1rem;
        right: 1rem;
    }
    
    .audio-toggle {
        width: 50px;
        height: 50px;
        top: 1rem;
        right: 4rem; /* Positioned to the left of theme toggle */
    }
    
    /* Enhanced project card interactions */
    .project-card {
        touch-action: pan-y;
        user-select: none;
    }
    
    .project-video {
        pointer-events: none; /* Prevent accidental video controls on mobile */
    }
}

/* Swipe indicators */
@media (max-width: 768px) {
    .projects-section::after {
        display: block;
        text-align: center;
        padding: 1rem;
        color: var(--text-secondary);
        font-size: 0.9rem;
        opacity: 0.7;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .nav-dot .dot {
        border-width: 3px;
    }
    
    .theme-toggle {
        border-width: 3px;
    }
}