/* css/style.css */

/* ============================= */
/* 🌍 GLOBAL RESET & CORE STYLES */
/* ============================= */
body {
    margin: 0;
    /* Prevents the whole page from bouncing/scrolling on mobile */
    overflow: hidden; 
    background: black;
    font-family: 'Arial', sans-serif;
    color: white;
    /* Prevents "pull-to-refresh" on mobile which ruins 3D apps */
    overscroll-behavior: none; 
}

/* Ensure canvas elements are displayed */
canvas {
    display: block;
    outline: none;
}

/* ============================= */
/* 🧭 UI MENU OVERLAY (NAV)      */
/* ============================= */
#ui-menu {
    position: absolute;
    top: 50px;
    left: 50px;
    z-index: 10;
}

#ui-menu button {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 10px 20px;
    margin-right: 15px;
    font-size: 16px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    /* Ensures buttons are easy to tap on touch screens */
    touch-action: manipulation; 
}

#ui-menu button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
}

/* ============================= */
/* 🧠 CSS2D CONTENT CARD         */
/* ============================= */
.content-card {
    /* Dimensions and visual style */
    width: 380px;
    max-height: 500px; /* Limits height to keep brain visible */
    
    padding: 20px;
    background: rgba(10, 10, 10, 0.85); 
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    text-align: left;
    
    /* Allow scrolling inside the card if text is long */
    overflow-y: auto; 
    
    /* Animation Preparation */
    will-change: transform, opacity; 
    opacity: 0;
    transition: opacity 1.5s ease-out, transform 1.5s cubic-bezier(0.25, 1, 0.5, 1);
    
    /* Start non-interactive so clicks pass through to 3D model */
    pointer-events: none; 
}

.content-card.active {
    opacity: 1;
    pointer-events: auto; /* Re-enable interaction when visible */
}

/* Typography */
.content-card h1 { 
    font-size: 2.2em;
    font-weight: 300;
    margin-bottom: 0.5em;
    letter-spacing: 1px;
    text-align: center;
}
.content-card h2 { 
    color: #99ccff;
    margin-top: 0;
    font-size: 1.8em;
    font-weight: 500;
}
.content-card p { 
    font-size: 1.0em;
    line-height: 1.5;
    margin: 0.8em 0;
    color: rgba(255, 255, 255, 0.9);
}
.content-card .contact-buttons button { 
    background: #99ccff; 
    color: black; 
    border: none; 
    padding: 8px 12px; 
    border-radius: 4px; 
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}
.content-card .contact-buttons button:hover {
    background: #66b3ff;
}

/* ============================= */
/* 📡 DATA PROBE PANEL           */
/* ============================= */
.data-probe {
    width: 280px;
    height: 180px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #66ccff;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(102, 204, 255, 0.5);
    
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    color: #33ff99;
    line-height: 1.4;
    overflow: hidden; 
    text-align: left;

    opacity: 0;
    transition: opacity 0.5s ease-in;
    pointer-events: none;
    z-index: 100;
}

.data-probe.ready {
    opacity: 1;
}

.data-probe .progress-bar {
    height: 6px;
    background: rgba(51, 255, 153, 0.2);
    margin-top: 10px;
    overflow: hidden;
}

.data-probe .progress-fill {
    height: 100%;
    width: 0%;
    background: #33ff99;
    transition: width 0.7s ease-out;
}

/* ============================= */
/* 📂 EXPANDED PROJECT MODAL     */
/* ============================= */
.expanded-card {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    width: 90vw;
    max-width: 900px;
    height: 90vh;
    max-height: 800px;
    
    padding: 30px;
    background: rgba(0, 0, 0, 0.95);
    border: 3px solid #66ccff;
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(102, 204, 255, 0.7);
    
    z-index: 999;
    overflow-y: auto; /* Scrollable content inside the fixed modal */
    
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.expanded-card.visible {
    opacity: 1;
    pointer-events: auto;
}

.expanded-card h2 {
    color: #33ff99;
    border-bottom: 1px solid rgba(153, 204, 255, 0.2);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.expanded-card .close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2em;
    cursor: pointer;
    color: #99ccff;
    transition: color 0.2s;
}

.expanded-card .close-button:hover {
    color: #ff3399;
}

/* ============================= */
/* 📸 SCREENSHOT SHOWCASE (FILMSTRIP) */
/* ============================= */

.screenshot-container {
    margin-top: 25px;
    
    /* Layout: Horizontal Flex Row */
    display: flex;
    flex-direction: row;
    gap: 20px;
    
    /* Enable Horizontal Scrolling */
    overflow-x: auto;
    overflow-y: hidden;
    
    /* Padding to allow hover effects not to get clipped */
    padding: 20px 10px; 
    
    /* Scroll Snapping for a premium "app-like" feel */
    scroll-snap-type: x mandatory;
    
    /* Firefox Scrollbar Styling */
    scrollbar-width: thin;
    scrollbar-color: #33ff99 rgba(0,0,0,0.3);
}

/* Custom Scrollbar for Chrome/Safari/Edge */
.screenshot-container::-webkit-scrollbar {
    height: 8px; /* Slim scrollbar */
}
.screenshot-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}
.screenshot-container::-webkit-scrollbar-thumb {
    background: #33ff99; /* Tech Green Handle */
    border-radius: 4px;
    border: 1px solid #000;
}

/* Individual Image Styling */
.screenshot-container img {
    /* Fixed height constraints the layout. 
       450px is good for mobile UI screenshots. */
    height: 450px; 
    width: auto; /* Width adjusts automatically */
    
    /* Prevent images from squishing */
    flex-shrink: 0;
    
    /* Styling */
    border-radius: 12px;
    border: 2px solid rgba(153, 204, 255, 0.3); /* Tech Blue border */
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    
    /* Snapping alignment */
    scroll-snap-align: center;
    
    /* Transitions */
    transition: all 0.3s ease;
    opacity: 0.85;
    cursor: grab;
}

/* Hover Effect - Pop out slightly */
.screenshot-container img:hover {
    opacity: 1;
    transform: scale(1.02);
    border-color: #33ff99; /* Green glow on hover */
    box-shadow: 0 8px 25px rgba(51, 255, 153, 0.2);
    z-index: 10;
}

/* Active State (while clicking) */
.screenshot-container img:active {
    cursor: grabbing;
    transform: scale(0.98);
}

/* --- Mobile Adjustments --- */
@media (max-width: 768px) {
    .screenshot-container img {
        height: 350px; /* Slightly smaller on phones */
    }
}
/* ============================= */
/* 📄 RESUME STYLING             */
/* ============================= */
.resume-container {
    padding: 30px;
    max-width: 850px;
    margin: 0 auto;
    color: #f0f0f0;
}

.resume-container header {
    border-bottom: 2px solid #33ff99;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.resume-container h1 { font-size: 2.5em; margin-bottom: 5px; color: #99ccff; }
.resume-container h2 { font-size: 1.2em; font-weight: 400; margin-top: 0; color: #ccc; }
.contact-info a { color: #99ccff; text-decoration: none; margin-right: 15px; }

.resume-container section { margin-bottom: 25px; }
.resume-container h3 {
    font-size: 1.4em;
    color: #33ff99;
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.resume-container .entry h4 { font-size: 1.1em; color: #f0f0f0; margin-bottom: 5px; }
.resume-container ul { list-style: square; margin-left: 20px; padding-left: 0; }
.resume-container ul li { margin-bottom: 5px; }

.skills-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
.skills-grid h4 { color: #99ccff; margin-bottom: 5px; }
.skills-grid p { font-size: 0.95em; }

/* ============================= */
/* ⏳ LOADING SCREEN             */
/* ============================= */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    font-family: 'Courier New', monospace;
    transition: opacity 1s ease-out;
}
.loader-content { width: 300px; text-align: center; }
#status-text { color: #33ff99; font-size: 14px; letter-spacing: 2px; margin-bottom: 10px; }
.progress-container { width: 100%; height: 2px; background: rgba(51, 255, 153, 0.1); border-radius: 2px; overflow: hidden; }
#progress-fill { width: 0%; height: 100%; background: #33ff99; box-shadow: 0 0 10px #33ff99; transition: width 0.3s ease; }
#loading-logs { margin-top: 20px; font-size: 10px; color: #66ccff; text-align: left; height: 50px; overflow: hidden; opacity: 0.7; }
.scanner-line {
    position: absolute;
    width: 100%;
    height: 4px;
    background: rgba(51, 255, 153, 0.05);
    top: 0;
    animation: scan 3s linear infinite;
}
@keyframes scan { 0% { top: 0; } 100% { top: 100%; } }

/* ==================================== */
/* 📱 MOBILE OPTIMIZATION (FINAL FIX)   */
/* ==================================== */

@media (max-width: 768px) {

    /* ---------------------------------- */
    /* GLOBAL MOBILE SAFETY               */
    /* ---------------------------------- */
    body {
        overflow: hidden; /* Prevent body scroll */
    }

    canvas {
        pointer-events: auto; /* Allow brain rotation */
        touch-action: none; 
    }

    /* ---------------------------------- */
    /* BOTTOM NAV MENU                    */
    /* ---------------------------------- */
    #ui-menu {
        position: fixed;
        bottom: 20px; 
        left: 50%;
        top: auto; 
        transform: translateX(-50%);
        width: 90vw;
        z-index: 50;
        display: flex;
        justify-content: center;
        background: rgba(0,0,0,0.5); 
        border-radius: 20px;
        padding: 5px;
        backdrop-filter: blur(4px);
    }

    #ui-menu button {
        margin: 0 5px;
        padding: 12px 10px;
        font-size: 13px;
        flex: 1;
        text-align: center;
        border: none;
        border-right: 1px solid rgba(255,255,255,0.2);
    }
    #ui-menu button:last-child { border-right: none; }

    /* ---------------------------------- */
    /* CONTENT CARD (MAIN HERO CARD)      */
    /* ---------------------------------- */
    .content-card,
    .content-card.active {
        width: 85vw; 
        max-width: none;
        max-height: 55vh; /* Reduce height slightly to see more brain */
        padding: 15px;
        font-size: 0.9em;
        pointer-events: auto; 
        box-sizing: border-box; /* Prevents width overflow */
    }

    .content-card h1 { font-size: 1.5em; }
    .content-card h2 { font-size: 1.3em; }

    /* ---------------------------------- */
    /* EXPANDED PROJECT VIEW (THE FIX)    */
    /* ---------------------------------- */
    .expanded-card {
        width: 100%;
        height: 100dvh; /* Dynamic viewport height */
        top: 0; 
        left: 0;
        transform: none;
        
        border-radius: 0;
        border: none;
        background: rgba(0, 0, 0, 0.98); /* Almost solid black for readability */
        
        /* Padding: Top, Right, Bottom (Large to allow scroll), Left */
        padding: 60px 15px 100px 15px; 
        box-sizing: border-box; /* CRITICAL: Keeps width at 100% */
        
        overflow-y: auto; /* Force scroll */
        -webkit-overflow-scrolling: touch; /* Smooth scroll on iOS */
    }
    
    /* Sticky Close Button with Background */
    .expanded-card .close-button {
        position: fixed; /* Keeps it stuck to top corner */
        top: 15px;
        right: 15px;
        font-size: 2em;
        width: 40px;
        height: 40px;
        background: rgba(0,0,0,0.8); /* Dark circle behind X */
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1002;
        border: 1px solid #33ff99;
    }

    /* ---------------------------------- */
    /* RESUME & TEXT WRAPPING FIXES       */
    /* ---------------------------------- */
    .resume-container {
        padding: 0; /* Remove internal padding on mobile */
        width: 100%;
    }

    /* Fix long URLs breaking the screen width */
    .contact-info span {
        display: block; /* Stack emails/links vertically */
        margin-bottom: 5px;
        font-size: 0.9em;
    }
    
    a {
        word-break: break-word; /* Force long links to wrap */
        overflow-wrap: break-word;
    }

    .skills-grid { 
        grid-template-columns: 1fr; 
    }

    /* Horizontal Filmstrip for Screenshots */
    .screenshot-container {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        gap: 15px;
        grid-template-columns: none;
        -webkit-overflow-scrolling: touch; 
        scroll-snap-type: x mandatory;
        padding-bottom: 10px;
    }

    .screenshot-container img {
        height: 220px;
        width: auto;
        scroll-snap-align: center;
        flex-shrink: 0;
    }
}