/* Mobile & Touch Optimizations */

/* Touch Device Rules */
@media (hover: none) and (pointer: coarse) {

    /* Disable custom cursor */
    /* .cursor {
        display: none !important;
    } */

    /* Force hide cursor even on touch devices to support hybrid laptops */
    * {
        cursor: none !important;
    }

    a,
    button,
    .hover-this,
    .lang-toggle,
    .lang-btn,
    .mobile-lang button,
    .project-card-v2 {
        cursor: none !important;
    }

    /* Speed up skills animation (User Request: "move faster") */
    .skills-marquee {
        animation-duration: 6s !important;
    }

    /* User Request: Delete scroll hint for touch devices */
    .scroll-hint {
        display: none !important;
    }

    /* Fix Project Title Overflow (Tokenizer) */
    .card-title-v2 {
        font-size: 1.3rem !important;
        overflow-wrap: break-word;
        word-wrap: break-word;
        hyphens: auto;
        line-height: 1.3;
    }

    /* Prevent Horizontal Scroll */
    html,
    body {
        overflow-x: hidden !important;
        width: 100%;
        max-width: 100%;
        position: relative;
        touch-action: pan-y;
    }

    .page-wrapper {
        width: 100%;
        overflow-x: hidden;
        position: relative;
    }

    /* Fix fixed-width container causing overflow */
    .container {
        width: 100% !important;
        max-width: 100vw !important;
        flex: 1 !important;
        margin-left: 0 !important;
        padding: 0 1rem;
    }

    /* Fix canvas width */
    #neural-canvas {
        width: 100% !important;
    }
}

/* Layout Adjustments for Mobile (<900px) */
@media (max-width: 900px) {

    /* Hide 'See projects' to prevent overlap */
    .metrics-link,
    .home-cta {
        display: none !important;
    }

    /* --- Hamburger Menu Logic --- */

    /* Hide Desktop Nav Elements ONLY on Touch Devices < 900px */
    @media (pointer: coarse) {

        .nav-wrapper>nav>a,
        .nav-wrapper>nav>.nav-contact,
        .nav-wrapper>nav>.lang-selector {
            display: none !important;
        }
    }

    /* Show Hamburger - Only on Touch Devices or very small screens if intended */
    /* User requested: "this should only show up in touch devices" */
    @media (pointer: coarse) {
        .hamburger-menu {
            display: flex !important;
            flex-direction: column;
            justify-content: space-between;
            width: 30px;
            height: 22px;
            cursor: pointer;
            z-index: 10002;
            position: fixed;
            top: 25px;
            right: 25px;
        }
    }

    .hamburger-menu .bar {
        width: 100%;
        height: 2px;
        background-color: #fff;
        border-radius: 2px;
        transition: 0.3s;
    }

    /* Adjust Nav Container */
    nav {
        justify-content: flex-end !important;
        padding-right: 1.5rem;
    }

    /* --- Contact Page Centering --- */
    .contact-v2-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-top: 5rem;
        /* Increased top margin for fixed header clearance */
        padding-top: 2rem;
    }

    .contact-left,
    .contact-right {
        width: 100%;
        max-width: 500px;
        text-align: center !important;
        margin-bottom: 3rem;
        padding: 0 1rem;
    }

    .contact-left h1 {
        text-align: center !important;
        font-size: 2.2rem !important;
        /* Adjust if too big */
        line-height: 1.2;
    }

    .contact-left p {
        text-align: center !important;
        margin-bottom: 1.5rem;
    }

    /* Ensure form inputs are centered/full width */
    .form-box-v2 {
        margin: 0 auto;
        text-align: left;
        /* Keep form Labels/Inputs readable */
    }

    .social-icons-v2 {
        justify-content: center;
    }
}

/* Mobile Menu Overlay Styles (Global but hidden) */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.98);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    text-align: center;
}

.mobile-nav a {
    font-family: "Monument Extended", sans-serif;
    font-size: 1.5rem;
    color: #fff;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    transition: color 0.3s;
}

.mobile-nav a:hover {
    color: #888;
}

.mobile-lang {
    margin-top: 2rem;
    font-family: "Monument Extended", sans-serif;
    color: #fff;
    font-size: 1rem;
}

.mobile-lang button {
    background: none;
    border: none;
    font-family: inherit;
    color: inherit;
    font-size: inherit;
    cursor: pointer;
    padding: 10px;
    /* Increased touch target */
    pointer-events: auto;
    /* Force clickable */
    text-transform: uppercase;
}

.close-menu {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 3rem;
    cursor: pointer;
    line-height: 1;
}

/* Default Hamburger State (Hidden on Desktop) */
.hamburger-menu {
    display: none;
}

/* Nav refinements for small screens */
/* Nav refinements & Project Card Fixes for small screens */
@media (max-width: 480px) {
    .nav-status {
        display: none !important;
    }

    /* Aggressive Text Resizing for Mobile */
    .projects-content h1 {
        font-size: 2.2rem !important;
        line-height: 1.1;
        margin-bottom: 2rem;
    }

    .projects-hero {
        padding: 1rem !important;
        width: 100% !important;
        overflow-x: hidden;
    }

    .hero-info h2 {
        font-size: 1.5rem !important;
        overflow-wrap: break-word;
        word-wrap: break-word;
        hyphens: auto;
        line-height: 1.2;
        width: 100%;
        max-width: 100%;
    }

    .projects-grid-v2 {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
        width: 100% !important;
    }

    .modern-project-card {
        width: 100% !important;
        margin: 0 !important;
        min-width: 0 !important;
    }

    .card-content-v2 {
        padding: 1.2rem !important;
    }

    /* User Request: Make images always revealed on phone */
    .card-img-wrapper img {
        filter: grayscale(0) contrast(1) !important;
        opacity: 0.9 !important;
        transform: scale(1.05);
        /* Slight zoom for impact */
    }
}

/* Ensure Contact Form doesn't overflow */
@media (max-width: 768px) {
    .contact-v2-wrapper {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}