/* Mobile Enhancements CSS */

/* General mobile improvements */
@media screen and (max-width: 736px) {
    /* Increase touch target sizes - minimum 44x44 for accessibility */
    a, button, .button, .actions li a {
        padding: 0.6rem 1.2rem !important;
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Nav link touch targets */
    #nav ul.links li a {
        padding: 0 2rem !important;
        min-height: 44px;
        line-height: 44px;
    }

    /* Icon touch targets */
    #nav ul.icons li a {
        min-width: 44px;
        min-height: 44px;
        padding: 0.5rem !important;
    }

    /* Improve readability */
    p, li {
        font-size: 0.95rem;
        line-height: 1.7;
    }

    /* Adjust header sizes for mobile */
    h1 {
        font-size: 2rem !important;
    }

    h2 {
        font-size: 1.5rem !important;
    }

    /* Improve nav panel for touch */
    #navPanel .links li a {
        padding: 0.8rem 1rem !important;
        min-height: 44px;
    }

    /* Improve footer readability */
    #footer {
        padding: 2rem 1.5rem !important;
    }

    #footer .split.contact > section {
        padding: 1.5rem 0 !important;
    }

    /* Improve spacing in main content */
    #main > * {
        padding: 2rem 1.5rem 0.5rem 1.5rem !important;
    }

    /* Fix intro section on mobile */
    #intro {
        padding: 4rem 1rem 2rem 1rem !important;
    }

    /* Improve project card spacing */
    .project-card-content {
        padding: 1rem !important;
    }
}

/* Extra small device improvements */
@media screen and (max-width: 480px) {
    /* Further reduce font sizes */
    html {
        font-size: 14pt !important;
    }

    /* Adjust project cards */
    .project-card {
        min-height: 450px !important;
    }

    .project-card-description {
        min-height: 60px !important;
    }

    .tag-container {
        min-height: 50px !important;
        max-height: 50px !important;
        overflow: hidden !important;
        gap: 0.3rem !important;
    }

    /* Make tags more compact */
    .language-tag, .tech-tag {
        padding: 0.2rem 0.4rem !important;
        font-size: 0.65rem !important;
        margin: 0.15rem !important;
    }

    /* Improve button layout in cards */
    .project-card-footer .actions.special {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .project-card-footer .actions.special li {
        width: 100% !important;
    }

    .project-card-footer .actions.special li a {
        width: 100% !important;
    }

    /* Fix pagination on small screens */
    .pagination {
        flex-wrap: wrap !important;
        justify-content: center !important;
    }

    .pagination .page-info {
        width: 100% !important;
        text-align: center !important;
        margin: 0.5rem 0 !important;
        order: -1 !important;
    }
}

/* Fix for very small devices */
@media screen and (max-width: 360px) {
    html {
        font-size: 13pt !important;
    }

    /* Simplify project cards further */
    .project-card {
        min-height: 400px !important;
    }

    /* Reduce padding */
    #main > * {
        padding: 1.5rem 1rem 0.5rem 1rem !important;
    }

    /* Adjust header sizes */
    h1 {
        font-size: 1.8rem !important;
    }

    h2 {
        font-size: 1.3rem !important;
    }

    /* Featured project title on mobile */
    .post.featured header.major h2 a {
        font-size: 1.5rem !important;
    }

    .post.featured header.major h2 a[data-length="long"],
    .post.featured header.major h2 a[data-length="very-long"] {
        font-size: 1.3rem !important;
    }

    /* Improve project title display */
    .project-title {
        min-height: auto !important;
        padding: 0.3rem 0 !important;
    }

    .project-title h2 a {
        font-size: 1.2rem !important;
        line-height: 1.2 !important;
    }

    .project-title h2 a[data-length="long"],
    .project-title h2 a[data-length="very-long"] {
        font-size: 1rem !important;
        line-height: 1.1 !important;
    }

    /* Adjust footer for very small screens */
    #footer .split.contact > section {
        width: 100%;
    }

    /* Make nav panel toggle more visible */
    #navPanelToggle {
        padding: 0.25rem 0.75rem !important;
        font-size: 0.7rem !important;
    }

    /* Simplify intro */
    #intro h1 {
        font-size: 1.6rem !important;
    }

    /* Adjust logo size */
    .logo {
        font-size: 0.9rem !important;
        padding: 0 1rem !important;
    }
}

/* Fix for iOS Safari issues */
@supports (-webkit-touch-callout: none) {
    /* iOS specific fixes */
    .project-card {
        /* Fix for iOS Safari rendering issues */
        transform: translateZ(0);
    }

    /* Fix for iOS Safari scrolling */
    #wrapper {
        -webkit-overflow-scrolling: touch;
    }
}

/* Improve touch feedback */
@media (hover: none) {
    /* Provide visual feedback for touch devices */
    a:active, button:active, .button:active, .touch-active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }

    /* Disable hover effects that don't work well on touch */
    .project-card:hover {
        transform: none !important;
    }

    .language-tag:hover, .tech-tag:hover {
        transform: none !important;
    }
}

/* Touch active state */
.touch-active {
    background-color: rgba(0, 0, 0, 0.05) !important;
    transform: scale(0.98);
}

/* Fix for mobile nav panel */
@media screen and (max-width: 736px) {
    #navPanelToggle {
        top: 1rem !important;
        right: 1rem !important;
        z-index: 10000 !important;
    }

    #navPanel {
        width: 80% !important;
        max-width: 300px !important;
    }

    #navPanel .close {
        height: 4rem !important;
        line-height: 4rem !important;
    }
}

/* Fix for project cards on mobile */
@media screen and (max-width: 736px) {
    #main > .posts > article, #projects-container > article {
        padding: 1.5rem !important;
    }

    .project-card-description p {
        -webkit-line-clamp: 4 !important; /* Show more text on mobile */
    }

    /* Improve scrolling on mobile */
    html, body {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    /* Fix for intro section on mobile */
    #intro {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    /* Improve form elements on mobile */
    input, textarea, select {
        font-size: 16px !important; /* Prevent iOS zoom on focus */
        padding: 0.8rem !important;
    }

    /* Fix for footer on mobile */
    #footer .split.contact {
        display: flex;
        flex-wrap: wrap;
    }

    #footer .split.contact > section {
        width: 50%;
        box-sizing: border-box;
    }

    /* Improve spacing for contact form on mobile */
    .contact-form .field.half {
        width: 100% !important;
        margin-left: 0 !important;
    }
}
