/* ===== MOBILE PERFORMANCE OPTIMIZATIONS ===== */

/* Improve scrolling performance on mobile */
* {
    -webkit-overflow-scrolling: touch;
}

/* Prevent zoom on input focus (iOS) */
input, select, textarea {
    font-size: 16px;
}

/* Improve tap targets for accessibility */
a, button, [role="button"] {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Prevent text selection on UI elements */
.header, .cta-button, .hamburger, .mobile-nav-close {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Base styles for dark mode */
body {
    font-family: 'Space Grotesk', sans-serif;
    background-color: #000000;
    color: #e2e8f0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.text-primary { color: #e2e8f0; }
.text-secondary { color: #a1a1aa; }

.project-card {
    background-color: #111111;
    border: 1px solid #27272a;
    border-radius: 1rem;
    transition: all 0.3s ease;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.card-button {
    background-color: #18181b;
    border: 1px solid #3f3f46;
    color: #e2e8f0;
    transition: background-color 0.3s ease;
}

.card-button:hover {
    background-color: #27272a;
}

.header-link { color: #a1a1aa; }
.header-link:hover { color: #ffffff; }

/* Light mode styles */
body.light-mode {
    background-color: #f1f5f9;
    color: #0f172a;
}

.light-mode .text-primary { color: #0f172a; }
.light-mode .text-secondary { color: #475569; }

.light-mode .project-card {
    background-color: #ffffff;
    border-color: #e2e8f0;
}

.light-mode .project-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.07), 0 4px 6px -2px rgba(0,0,0,0.04);
}

.light-mode .card-button {
    background-color: #f1f5f9;
    border-color: #e2e8f0;
    color: #1e293b;
}

.light-mode .card-button:hover {
    background-color: #e2e8f0;
}

.light-mode .header-link { color: #475569; }
.light-mode .header-link:hover { color: #0f172a; }
.light-mode .footer { border-top-color: #e2e8f0; }

/* Base grid styles for projects page */
.grid {
    display: grid;
    width: 100%;
}

/* Ensure project cards have consistent structure */
.project-item-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.bg-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.bg-card img {
    flex-shrink: 0;
}

.bg-card .p-4 {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.bg-card .p-4 .flex {
    margin-top: auto;
}/* =====
 RESPONSIVE DESIGN OPTIMIZATIONS FOR PROJECTS PAGE ===== */

/* Mobile First Approach - Base styles for mobile */
@media (max-width: 480px) {
    /* Container adjustments */
    .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
    
    /* Header responsive */
    header {
        padding: 1.5rem 0;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    header .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
    
    /* Projects grid mobile */
    .grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }
    
    /* Project cards mobile */
    .project-card {
        margin: 0 1rem;
        border-radius: 0.75rem;
    }
    
    .project-card img {
        height: 200px;
    }
    
    .project-card h2 {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    .project-card p {
        font-size: 0.875rem;
        line-height: 1.5;
    }
    
    /* Card buttons mobile */
    .card-button {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        min-height: 44px;
    }
    
    /* Page title mobile */
    h1 {
        font-size: 2.5rem !important;
        text-align: center;
        margin-bottom: 1rem;
    }
    
    /* Back button mobile */
    .header-link {
        font-size: 0.875rem;
        padding: 0.5rem;
    }

    /* Add divider lines after each project on mobile - same as main page */
    .project-item-wrapper:not(:last-child) {
        position: relative;
        margin-bottom: 2rem;
        padding-bottom: 1rem;
    }

    .project-item-wrapper:not(:last-child)::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: rgba(226, 232, 240, 0.8);
        border-radius: 2px;
    }

    .light-mode .project-item-wrapper:not(:last-child)::after {
        background: rgba(0, 0, 0, 0.6);
    }
}

/* Tablet styles */
@media (min-width: 481px) and (max-width: 768px) {
    /* Projects grid tablet */
    .grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 2rem;
    }
    
    /* Project cards tablet */
    .project-card h2 {
        font-size: 1.75rem;
    }
    
    .project-card img {
        height: 220px;
    }
    
    /* Page title tablet */
    h1 {
        font-size: 3rem !important;
    }
}

/* Large tablet/small desktop */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Projects grid */
    .grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 2.5rem;
    }
    
    /* Project cards */
    .project-card img {
        height: 240px;
    }
    
    .project-card h2 {
        font-size: 2rem;
    }
}

/* Standard web view - Force 3 columns, 2 rows */
@media (min-width: 1025px) and (max-width: 1439px) {
    .grid {
        grid-template-columns: repeat(3, 1fr) !important;
        grid-template-rows: repeat(2, 1fr) !important;
        gap: 2rem;
        max-height: fit-content;
    }
    
    /* Ensure consistent card heights in 2x3 grid */
    .project-item-wrapper {
        height: fit-content;
    }
    
    .project-card {
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .project-card .p-4 {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
}

/* Desktop optimizations */
@media (min-width: 1025px) {
    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
    }
    
    /* Enhanced hover effects for desktop */
    .project-card:hover {
        transform: translateY(-8px);
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    }
    
    /* Better spacing for large screens */
    .container {
        max-width: 1200px;
    }
    
    /* Projects grid desktop - Force 2 rows with 3 columns */
    .grid {
        grid-template-columns: repeat(3, 1fr) !important;
        grid-template-rows: repeat(2, 1fr) !important;
        max-height: fit-content;
    }
}

/* Ultra-wide screens */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }
    
    /* Projects grid ultra-wide - Keep 2 rows with 3 columns */
    .grid {
        grid-template-columns: repeat(3, 1fr) !important;
        grid-template-rows: repeat(2, 1fr) !important;
        gap: 3rem;
        max-height: fit-content;
    }
    
    h1 {
        font-size: 4rem !important;
    }
}

/* Landscape mobile orientation */
@media (max-width: 768px) and (orientation: landscape) {
    /* Projects grid landscape mobile */
    .grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
    }
    
    .project-card img {
        height: 150px;
    }
    
    main {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    h1 {
        font-size: 2rem !important;
        margin-bottom: 1.5rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .card-button {
        min-height: 48px;
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
    
    .header-link {
        min-height: 44px;
        padding: 0.75rem 1rem;
    }
    
    /* Remove hover effects on touch devices */
    .project-card:hover {
        transform: none;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .project-card:hover {
        transform: none;
    }
}

/* Print styles */
@media print {
    header,
    .card-button,
    footer {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .project-card {
        background: white;
        border: 1px solid #ccc;
        break-inside: avoid;
        margin-bottom: 1rem;
    }
    
    .grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
    }
}