/* ============================================
   MOBILE RESPONSIVE STYLES - FIXED VERSION
   ============================================ */

/* Global Mobile Fixes - Prevent Horizontal Scroll */
html {
    overflow-x: hidden;
    width: 100%;
}

body {
    overflow-x: hidden;
    overflow-x: clip;
    /* Modern browsers support clip for better performance */
    width: 100%;
    max-width: 100vw;
    position: relative;
}

img,
video,
iframe {
    max-width: 100%;
    height: auto;
}

section {
    overflow-x: hidden;
}

/* Tablet and Below (1024px) */
@media (max-width: 1024px) {
    .hero-content h1 {
        font-size: 3.5rem;
    }

    .services-container,
    .about-content {
        flex-direction: column;
    }

    .services-image,
    .about-visual {
        width: 100%;
        height: 400px;
    }

    .about-text h2 {
        font-size: 4rem;
    }

    .project-grid {
        flex-direction: column;
    }

    .project-column,
    .column-center,
    .column-right {
        margin-top: 0;
    }

    .testimonial-header-container {
        flex-direction: column;
        gap: 40px;
    }

    .testimonial-image-placeholder {
        width: 100%;
        height: 400px;
    }

    .contact-form {
        grid-template-columns: 1fr;
    }
}

/* Mobile Styles (768px and below) */
@media (max-width: 768px) {

    /* Navigation */
    .navbar {
        padding: 14px 20px;
        width: calc(100% - 24px);
        top: 12px;
        border-radius: 14px;
    }

    .nav-links,
    .nav-cta,
    .theme-toggle,
    .navbar-right {
        display: none;
    }

    /* Mobile Menu Button */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border: none;
        background: var(--accent-glass);
        border-radius: 12px;
        cursor: pointer;
        color: var(--text-main);
        font-size: 1.4rem;
    }

    /* Mobile Menu Overlay */
    .mobile-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: var(--bg-color);
        z-index: 2000;
        display: flex;
        flex-direction: column;
        padding: 20px;
        transform: translateX(100%);
        visibility: hidden;
        transition: transform 0.3s ease, visibility 0.3s ease;
    }

    .mobile-menu.active {
        transform: translateX(0);
        visibility: visible;
    }

    .mobile-menu-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 30px;
        border-bottom: 1px solid var(--border-color);
    }

    .mobile-menu-close {
        width: 42px;
        height: 42px;
        border: none;
        background: var(--accent-glass);
        border-radius: 12px;
        cursor: pointer;
        color: var(--text-main);
        font-size: 1.4rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-menu-links {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 30px 0;
    }

    .mobile-menu-links a {
        font-size: 1.5rem;
        font-weight: 500;
        color: var(--text-main);
        padding: 16px 0;
        border-bottom: 1px solid var(--border-color);
    }

    .mobile-menu-footer {
        padding-top: 20px;
        border-top: 1px solid var(--border-color);
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    .mobile-theme-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 0;
    }

    .mobile-theme-toggle span {
        font-size: 1rem;
        color: var(--text-muted);
    }

    .theme-toggle-mobile {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        border: 1px solid var(--border-color);
        background: var(--accent-glass);
        cursor: pointer;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .theme-toggle-mobile i {
        font-size: 1.3rem;
        color: var(--text-main);
        position: absolute;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Mobile theme toggle icon states */
    #theme-icon-sun-mobile {
        opacity: 0;
        transform: rotate(-90deg) scale(0);
    }

    #theme-icon-moon-mobile {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }

    [data-theme="light"] #theme-icon-sun-mobile {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }

    [data-theme="light"] #theme-icon-moon-mobile {
        opacity: 0;
        transform: rotate(90deg) scale(0);
    }

    .mobile-cta {
        width: 100%;
        text-align: center;
        padding: 16px;
    }

    /* Hero Section */
    .hero {
        padding-top: 100px;
        min-height: 100vh;
        width: 100%;
    }

    .hero-content h1 {
        font-size: 2.8rem;
        line-height: 1.2;
    }

    .hero-content p {
        font-size: 0.95rem;
        margin-bottom: 30px;
    }

    .hero-content p br {
        display: none;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
        gap: 15px;
        align-items: center;
    }

    .hero-buttons .btn-outline {
        width: auto;
        min-width: 220px;
        max-width: 280px;
        justify-content: center;
        padding: 12px 20px;
    }

    .scroll-indicator {
        display: none;
    }

    /* Logo Marquee - Fix overflow */
    .logo-marquee {
        width: 100%;
        overflow: hidden;
    }

    /* Projects Section - 2 Column Grid on Mobile */
    .projects {
        padding: 60px 20px;
        width: 100%;
    }

    .project-feature {
        display: none !important;
    }

    .project-feature img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .project-feature .about-tag {
        font-size: 0.9rem;
        padding: 10px 20px;
    }

    .project-grid {
        display: flex;
        flex-direction: column;
        gap: 30px;
        width: 100%;
    }

    .project-column {
        display: contents;
    }

    .project-card {
        min-height: 230px;
        border-radius: 24px;
        width: 100%;
        max-width: 550px;
        margin: 0 auto;
        overflow: hidden;
        transition: all 0.3s ease;
        order: 1;
    }

    .project-card img {
        width: 100%;
        height: auto;
        display: block;
        object-fit: contain;
        /* Ensures full image is visible */
    }

    .hidden-project {
        order: 2 !important;
        /* Always after visible ones */
    }

    .project-card.about-card {
        height: auto;
        aspect-ratio: auto;
        display: flex;
        order: 0;
    }

    /* Only target the main project image link */
    .project-card>a {
        display: block;
        width: 100%;
        height: 100%;
    }

    .project-card.about-card>a {
        height: 100%;
        width: 100%;
    }

    /* Prevent the link button from stretching and ensure visibility */
    .project-link-btn {
        width: 44px !important;
        height: 44px !important;
        border-radius: 50% !important;
        flex-shrink: 0;
        background: rgba(255, 255, 255, 0.2) !important;
        border: 1.5px solid rgba(255, 255, 255, 0.6) !important;
        color: #ffffff !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    [data-theme="light"] .project-link-btn {
        color: #ffffff !important;
        background: rgba(255, 255, 255, 0.2) !important;
        border-color: rgba(255, 255, 255, 0.6) !important;
    }

    .project-link-btn i {
        color: #ffffff !important;
        font-size: 1.1rem !important;
    }

    .about-tag {
        font-size: 0.8rem;
        padding: 8px 18px;
    }

    .project-details {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        padding: 20px 15px;
        opacity: 0;
        pointer-events: none;
        background: rgba(0, 0, 0, 0.92) !important;
        /* Force high-contrast dark background */
        backdrop-filter: blur(15px);
        transition: opacity 0.4s ease;
        z-index: 5;
        overflow: hidden;
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
    }

    .project-card.active .project-details {
        opacity: 1;
        pointer-events: auto;
    }

    .project-title-row {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 10px !important;
        width: 100% !important;
        margin-bottom: 10px !important;
    }

    .project-title {
        font-size: 1.3rem !important;
        margin: 0 !important;
        color: #ffffff !important;
        white-space: nowrap !important;
        text-shadow: none !important;
    }

    [data-theme="light"] .project-title {
        color: #ffffff !important;
    }

    .project-description {
        display: -webkit-box !important;
        font-size: 0.85rem !important;
        line-height: 1.5 !important;
        color: rgba(255, 255, 255, 0.95) !important;
        margin-bottom: 15px !important;
        -webkit-line-clamp: 4 !important;
        line-clamp: 4 !important;
        -webkit-box-orient: vertical !important;
        width: 100% !important;
        overflow: hidden !important;
        text-shadow: none !important;
    }

    [data-theme="light"] .project-description {
        color: rgba(255, 255, 255, 0.95) !important;
    }

    .project-tags {
        gap: 6px;
        justify-content: center;
        margin-top: 0;
        display: flex !important;
    }

    .project-tag {
        font-size: 0.65rem !important;
        padding: 3px 10px !important;
        background: rgba(255, 255, 255, 0.1) !important;
        color: #ffffff !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
    }

    /* Legacy Project Info Overlay - Removed */

    .projects-footer {
        flex-direction: column;
        gap: 20px;
        margin-top: 40px;
    }

    .projects-footer .btn-outline,
    .projects-footer .link-underline {
        width: 100%;
        text-align: center;
        display: block;
    }

    /* Services Section - Image First on Mobile */
    .services {
        padding: 60px 20px;
        width: 100%;
    }

    .services-container {
        gap: 30px;
        display: flex;
        flex-direction: column;
    }

    .services-image {
        order: -1;
        height: 250px;
        width: 100%;
    }

    .services-text h2 {
        font-size: 2.5rem;
    }

    .section-desc {
        font-size: 1rem;
    }

    .service-buttons {
        flex-direction: column;
        width: 100%;
    }

    .service-buttons .btn-outline {
        width: 100%;
        justify-content: center;
    }

    .service-cards {
        flex-direction: column;
        width: 100%;
    }

    .service-card {
        width: 100%;
    }

    /* About Section - Image First on Mobile */
    .about-section {
        padding: 60px 20px;
        width: 100%;
    }

    .about-content {
        gap: 30px;
        display: flex;
        flex-direction: column;
    }

    .about-visual {
        order: -1;
        height: 300px;
        width: 100%;
    }

    .about-text h2 {
        font-size: 2.5rem !important;
    }

    .about-text p {
        font-size: 0.95rem !important;
    }

    .about-tags {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 10px;
        width: 100%;
    }

    .about-tags .tag {
        font-size: 0.75rem;
        padding: 6px 12px;
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .exp-item {
        flex-direction: column;
        gap: 10px;
        padding: 18px 0 18px 18px;
        position: relative;
    }

    .experience-list {
        padding: 0;
        background: transparent;
        border: none;
        gap: 0;
    }

    .exp-item {
        width: 100%;
        background: transparent;
        border-radius: 0;
        margin-bottom: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    }

    .exp-item::before {
        content: '';
        position: absolute;
        left: 0;
        top: 14px;
        bottom: 14px;
        width: 2px;
        border-radius: 999px;
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent);
        opacity: 0.7;
    }

    .exp-item::after {
        content: '';
        position: absolute;
        left: -4px;
        top: 14px;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.85);
        box-shadow: 0 0 12px rgba(255, 255, 255, 0.35);
    }

    .exp-item:last-child {
        border-bottom: none;
    }

    .exp-item h4 {
        font-size: 1.1rem;
        letter-spacing: 0.02em;
    }

    .exp-item span {
        font-size: 0.9rem;
        color: rgba(255, 255, 255, 0.75);
    }

    .exp-company {
        text-align: left;
    }

    /* Testimonials - Image First on Mobile */
    .testimonials {
        padding: 60px 20px;
        gap: 50px;
        width: 100%;
    }

    .testimonial-header-container {
        gap: 30px;
        display: flex;
        flex-direction: column;
    }

    .testimonial-image-placeholder {
        order: -1;
        height: 250px;
        width: 100%;
    }

    .testimonial-header {
        padding-left: 0;
    }

    .testimonial-header h2 {
        font-size: 2.2rem;
    }

    .testimonial-header p {
        font-size: 0.95rem;
    }

    .testimonial-buttons {
        flex-direction: column;
        width: 100%;
    }

    .testimonial-buttons .btn-outline {
        width: 100%;
        text-align: center;
    }

    .testimonial-card {
        width: 280px;
        height: 320px;
        padding: 25px;
    }

    .client-info h3 {
        font-size: 1.2rem;
    }

    .client-info span {
        font-size: 0.95rem;
    }

    .testimonial-card p {
        font-size: 1rem;
    }

    .testimonial-grid {
        width: 100%;
    }

    .testimonial-grid::before,
    .testimonial-grid::after {
        width: 50px;
    }

    /* Contact Section */
    .contact-section {
        padding: 60px 20px;
        width: 100%;
    }

    .contact-card {
        padding: 30px 20px;
        gap: 30px;
        width: 100%;
    }

    .contact-intro h2 {
        font-size: 2rem;
    }

    .contact-intro p {
        font-size: 1rem;
    }

    .contact-link {
        font-size: 0.9rem;
        padding: 10px 14px;
    }

    /* Stats Section */
    .stats {
        padding: 40px 20px;
        width: 100%;
    }

    .stats-card {
        flex-direction: column;
        padding: 40px 30px;
        gap: 30px;
        width: 100%;
    }

    .stat-divider {
        width: 100%;
        height: 1px;
    }

    .stat-number {
        font-size: 2.5rem;
    }

    .stat-label {
        font-size: 0.9rem;
    }

    /* CTA Section */
    .cta-section {
        padding: 60px 20px;
        width: 100%;
    }

    .cta-content h2 {
        font-size: 2rem;
        margin: 20px 0 30px;
    }

    .cta-links {
        margin-top: 40px;
        font-size: 1.2rem;
    }

    /* FAQ Section */
    .faq {
        padding: 60px 20px;
        width: 100%;
    }

    .faq-container {
        flex-direction: column;
        gap: 40px;
    }

    .faq-text h2 {
        font-size: 2.5rem;
    }

    .faq-text p {
        font-size: 1rem;
    }

    .faq-image {
        height: 250px;
        margin-top: 20px;
        width: 100%;
    }

    .faq-question {
        font-size: 1rem;
        padding: 18px;
    }

    .faq-answer {
        padding: 0 18px;
    }

    .faq-answer p {
        font-size: 0.9rem;
    }

    .faq-item.active .faq-answer {
        padding-bottom: 18px;
    }

    /* Footer */
    .footer {
        padding: 30px 20px;
        width: 100%;
    }

    .footer-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        font-size: 0.85rem;
    }
}

/* Extra Small Devices (480px and below) */
@media (max-width: 480px) {
    .hero-content h1 {
        font-size: 2.2rem;
    }

    .project-card {
        height: 180px;
    }

    .about-tags {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 8px;
    }

    .about-tags .tag {
        font-size: 0.7rem;
        padding: 6px 10px;
    }

    .about-text h2 {
        font-size: 2rem !important;
    }

    .testimonial-header h2 {
        font-size: 1.8rem;
    }

    .services-text h2,
    .faq-text h2 {
        font-size: 2rem;
    }
}