/* Responsive CSS for hengkunz.com */

/* Animation Classes */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Content Wrapper Margins - All Devices */
.content-wrapper {
    padding-left: 5%;
    padding-right: 5%;
}

/* Mobile Navigation Styles */
@media only screen and (max-width: 768px) {
    .hamburger {
        display: block;
        z-index: 1000;
    }
    
    .hamburger .bar {
        width: 25px;
        height: 3px;
        background-color: var(--yellow);
        margin: 5px 0;
        transition: all 0.3s ease;
    }
    
    .hamburger.active .bar:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }
    
    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }
    
    .hamburger.active .bar:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }
    
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        background-color: rgba(0, 0, 0, 0.95);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        z-index: 999;
        transition: right 0.4s ease;
        padding: 50px 20px;
        gap: 30px;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
    }
    
    .nav-links.active {
        right: 0;
    }
    
    .nav-links li {
        opacity: 0;
        transform: translateX(50px);
    }
    
    .nav-links.active li {
        opacity: 1;
        transform: translateX(0);
        transition: opacity 0.4s ease, transform 0.4s ease;
    }
    
    .nav-links.active li:nth-child(1) { transition-delay: 0.1s; }
    .nav-links.active li:nth-child(2) { transition-delay: 0.2s; }
    .nav-links.active li:nth-child(3) { transition-delay: 0.3s; }
    .nav-links.active li:nth-child(4) { transition-delay: 0.4s; }
    .nav-links.active li:nth-child(5) { transition-delay: 0.5s; }
    
    body.menu-open {
        overflow: hidden; /* Prevent scrolling when menu is open */
    }
    
    .nav-links li a {
        font-size: 1.2rem;
        padding: 10px;
        display: flex;
        align-items: center;
        width: 100%;
    }
    
    .nav-links li a i {
        margin-right: 10px;
        font-size: 1.3rem;
    }
    
    /* Override hamburger display on larger screens */
    @media only screen and (min-width: 769px) {
        .hamburger {
            display: none;
        }
        
        .nav-links {
            position: static;
            flex-direction: row;
            height: auto;
            background-color: transparent;
            padding: 0;
            width: auto;
            box-shadow: none;
        }
        
        .nav-links li {
            opacity: 1;
            transform: none;
        }
        
        .nav-links li a {
            font-size: 1rem;
            padding: 0;
        }
    }
}

/* Extra large devices (large laptops and desktops, 1200px and up) */
@media only screen and (min-width: 1200px) {
    .content-wrapper {
        max-width: 1400px;
        margin: 0 auto;
        padding-left: 8%;
        padding-right: 8%;
    }
    
    .hero-content {
        padding: 0 50px;
    }
    
    .code-container {
        max-width: 900px;
    }
}

/* Large devices (laptops/desktops, 992px to 1199px) */
@media only screen and (min-width: 992px) and (max-width: 1199px) {
    .skills-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
    
    .project-preview img {
        height: 220px;
    }
}

/* Medium devices (landscape tablets, 768px to 991px) */
@media only screen and (min-width: 768px) and (max-width: 991px) {
    .content-wrapper {
        padding-left: 6%;
        padding-right: 6%;
    }
    
    .hero-section {
        height: auto;
        min-height: 80vh;
        padding: 100px 0;
    }
    
    .code-container {
        max-width: 100%;
        padding: 0 20px;
    }
    
    .large-text {
        font-size: 2rem;
    }
    
    .skills-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .terminal-tabs {
        margin-top: 15px;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 5px;
    }
    
    .section-title {
        margin-bottom: 10px;
    }
}

/* Small devices (portrait tablets and large phones, 576px to 767px) */
@media only screen and (min-width: 576px) and (max-width: 767px) {
    .content-wrapper {
        padding-left: 5%;
        padding-right: 5%;
    }
    
    .hero-section {
        height: auto;
        min-height: 70vh;
        padding: 80px 0;
    }
    
    .code-container {
        max-width: 100%;
        padding: 0 15px;
    }
    
    .large-text {
        font-size: 1.8rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .project-card {
        padding: 15px;
    }
    
    .project-details h3 {
        font-size: 1.4rem;
    }
    
    .project-links {
        flex-wrap: wrap;
    }
    
    .terminal-tabs .tab {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .skills-category h3 {
        font-size: 1.2rem;
    }
    
    .contact-link i {
        font-size: 1.5rem;
    }
    
    .link-title {
        font-size: 1rem;
    }
}

/* Back to Top Button */
#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 40px;
    height: 40px;
    background-color: var(--yellow);
    color: var(--background);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
    z-index: 998;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

#back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}

#back-to-top:hover {
    background-color: #e0a930;
}

#back-to-top i {
    font-size: 1.2rem;
}

@media only screen and (max-width: 575px) {
    #back-to-top {
        bottom: 20px;
        right: 20px;
        width: 35px;
        height: 35px;
    }
}

/* Add responsive styles for project cards on mobile */
@media only screen and (max-width: 767px) {
    .projects-container {
        display: flex;
        flex-direction: column;
        gap: 60px;
    }
    
    /* Project 1: Details first, then image */
    .project-card:nth-child(1) {
        display: flex !important;
        flex-direction: column-reverse !important;
        margin-bottom: 40px;
        border-bottom: 1px dashed rgba(255, 197, 75, 0.3);
        padding-bottom: 40px;
    }
    
    /* Project 2: Already has details first, then image */
    .project-card:nth-child(2) {
        flex-direction: column !important;
        margin-bottom: 40px;
        border-bottom: 1px dashed rgba(255, 197, 75, 0.3);
        padding-bottom: 40px;
    }
    
    /* Project 3: Details first, then image */
    .project-card:nth-child(3) {
        display: flex !important;
        flex-direction: column-reverse !important;
        margin-bottom: 40px;
    }
    
    .project-card:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    
    .project-terminal, .project-details {
        width: 100%;
        max-width: 100%;
    }
    
    /* For projects with details first, add spacing after details */
    .project-card:nth-child(1) .project-details,
    .project-card:nth-child(3) .project-details {
        margin-bottom: 25px;
    }
    
    /* For projects with terminal first, add spacing after terminal */
    .project-card:nth-child(2) .project-terminal {
        margin-bottom: 25px;
    }
    
    /* Style all project images */
    .project-preview img {
        height: auto;
        max-height: 250px;
        width: 100%;
        object-fit: cover;
    }
    
    /* Stacked contact links */
    .contact-links {
        flex-direction: column;
    }
    
    .contact-link {
        width: 100%;
    }
}

/* For touch devices */
.no-hover .nav-links li a:hover::after {
    width: 0; /* Disable hover effects on touch devices */
}

.no-hover .nav-links li a.active::after {
    width: 100%; /* Keep active state */
}

/* Extra small devices (phones, 575px and down) */
@media only screen and (max-width: 575px) {
    body {
        font-size: 14px;
    }
    
    .content-wrapper {
        padding-left: 4%;
        padding-right: 4%;
    }
    
    .navbar {
        padding: 15px;
    }
    
    .hero-section {
        height: auto;
        min-height: 60vh;
        padding: 60px 0;
    }
    
    .code-container {
        width: 100%;
        padding: 0 10px;
    }
    
    .code-block {
        padding: 15px;
    }
    
    .line-number {
        display: none; /* Hide line numbers on very small screens */
    }
    
    .large-text {
        font-size: 1.5rem;
    }
    
    .changing-text {
        min-width: auto;
    }
    
    .section-title {
        font-size: 1.6rem;
    }
    
    .projects-container {
        gap: 50px;
    }
    
    .project-card {
        padding: 10px;
        margin-bottom: 30px;
    }
    
    /* Enhance spacing for alternating layout on mobile */
    .project-card:nth-child(1) .project-details,
    .project-card:nth-child(3) .project-details {
        margin-bottom: 20px;
    }
    
    .project-card:nth-child(2) .project-terminal {
        margin-bottom: 20px;
    }
    
    .project-details h3 {
        font-size: 1.3rem;
        margin-top: 15px;
    }
    
    .project-details p {
        font-size: 0.9rem;
    }
    
    .tech-stack {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .tech-stack .tech-item {
        font-size: 0.8rem;
        padding: 4px 8px;
    }
    
    .project-preview {
        border-radius: 6px;
        overflow: hidden;
    }
    
    .project-preview img {
        max-height: 200px;
    }
    
    .project-links {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .terminal-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .terminal-tabs {
        gap: 8px;
    }
    
    .terminal-tabs .tab {
        padding: 5px 10px;
        font-size: 0.75rem;
    }
    
    .skills-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .skills-category h3 {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }
    
    .contact-header h3 {
        font-size: 1.5rem;
    }
    
    .contact-header p {
        font-size: 0.9rem;
    }
    
    .contact-link {
        padding: 12px;
    }
    
    .contact-link i {
        font-size: 1.3rem;
        margin-right: 12px;
    }
    
    .link-title {
        font-size: 0.9rem;
    }
    
    .link-subtitle {
        font-size: 0.8rem;
    }
    
    .contact-footer p {
        font-size: 0.8rem;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .social-links {
        margin-top: 15px;
    }
}

/* Fix for extra small landscape phones */
@media only screen and (max-width: 575px) and (orientation: landscape) {
    .hero-section {
        min-height: 100vh; /* Ensure full height on landscape */
    }
    
    .code-container {
        padding: 0 20px;
    }
}

/* Additional tweaks for extremely small devices */
@media only screen and (max-width: 360px) {
    .content-wrapper {
        padding-left: 3%;
        padding-right: 3%;
    }
    
    .nav-logo {
        font-size: 1.1rem;
    }
    
    .large-text {
        font-size: 1.3rem;
    }
    
    .section-title {
        font-size: 1.4rem;
    }
    
    .project-details h3 {
        font-size: 1.2rem;
    }
    
    .skills-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    }
    
    .contact-link {
        padding: 10px;
    }
    
    .contact-link i {
        font-size: 1.2rem;
        margin-right: 10px;
    }
}
