/* --- Global Variables & Theme Setup --- */
:root {
    --bg-dark: #000000;
    --card-bg: rgba(0, 255, 0, 0.03);
    --glass-border: rgba(0, 255, 0, 0.2);
    --matrix-green: #00ff41;
    --neon-purple: #f0f; /* Used for highlights and hover states */
    --text-dim: #999;
    --font-main: 'JetBrains Mono', monospace;
}

/* --- Schematic Mode (Light Theme Variables) --- */
body.light-mode {
    /* Reduced background opacity to 0.85 for a softer feel */
    --bg-dark: rgba(224, 229, 236, 0.85); 
    --matrix-green: #1a4d80;   /* Deep blueprint blue */
    --neon-purple: #d11a2a;    /* Technical red for highlights */
    --card-bg: rgba(26, 77, 128, 0.05);
    --glass-border: rgba(26, 77, 128, 0.3);
    --text-dim: #555;
}

/* --- Layout Reset --- */
body {
    background-color: var(--bg-dark);
    color: var(--matrix-green);
    font-family: var(--font-main);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Light Mode Specific Body Styling */
body.light-mode {
    background-color: var(--bg-dark);
    background-image: 
        linear-gradient(rgba(26, 77, 128, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(26, 77, 128, 0.04) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* --- Navigation --- */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--bg-dark);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    z-index: 1000;
    padding: 15px 0;
}

/* Update navigation for light mode transparency and readability */
body.light-mode nav {
    background: rgba(255, 255, 255, 0.7); 
    backdrop-filter: blur(12px); 
    border-bottom: 1px solid var(--glass-border);
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 0;
    gap: 15px;
}

.nav-link {
    color: var(--matrix-green);
    text-decoration: none;
    font-size: 1rem;
    padding: 5px 10px;
    transition: all 0.3s ease;
}

.nav-link:hover, .nav-link.active {
    color: var(--neon-purple);
    text-shadow: 0 0 10px var(--neon-purple);
}

.nav-toggle-btn {
    background: transparent;
    border: 1px solid var(--matrix-green);
    color: var(--matrix-green);
    font-family: var(--font-main);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 4px;
    transition: all 0.3s ease;
    margin-left: 10px;
    text-transform: uppercase;
}

.nav-toggle-btn:hover {
    background: var(--matrix-green);
    color: var(--bg-dark);
    box-shadow: 0 0 8px var(--matrix-green);
}

/* --- Containers & Typography --- */
.container {
    max-width: 1000px;
    margin: 80px auto 40px auto; 
    padding: 0 20px;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

h2 {
    color: var(--neon-purple);
    font-size: 1.5rem;
    margin-top: 2rem;
    border-bottom: 1px solid var(--glass-border);
    display: inline-block;
    padding-bottom: 5px;
}

.highlight { color: var(--neon-purple); }
.comment { color: var(--text-dim); font-style: italic; }

/* --- Project Tags & Grid Layout --- */
.all-projects-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.project-tag {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: var(--matrix-green);
    padding: 8px 15px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: 0.3s;
}

.project-tag:hover {
    border-color: var(--neon-purple);
    color: var(--neon-purple);
    transform: translateY(-2px);
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    padding: 20px;
    border-radius: 8px;
    transition: 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

body.light-mode .card, 
body.light-mode .project-tag {
    background: #fff;
    box-shadow: 2px 2px 0px var(--matrix-green);
}

.card:hover {
    border-color: var(--neon-purple);
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.1);
    transform: scale(1.02);
}

.tag {
    font-size: 0.7rem;
    color: var(--neon-purple);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    display: block;
}

.card h3 {
    margin: 5px 0 10px 0;
    color: var(--matrix-green); 
    font-size: 1.2rem;
}

body:not(.light-mode) .card h3 {
    color: #fff;
}

.card p {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* --- Contact Form & Actions --- */
.contact-wrapper {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    margin-top: 30px;
}

.contact-form .form-group {
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
}

.contact-form .form-group label {
    display: block;
    margin-bottom: 10px;
}

.contact-form input, .contact-form textarea {
    background: rgba(0,0,0,0.1);
    border: 1px solid var(--glass-border);
    padding: 12px;
    color: var(--matrix-green);
    font-family: var(--font-main);
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
}

body.light-mode .contact-form input,
body.light-mode .contact-form textarea {
    background: #fff;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 15px;
}

.direct-email-link {
    color: var(--matrix-green);
    text-decoration: none;
    font-size: 0.8rem;
    font-family: var(--font-main);
    transition: all 0.3s ease;
    opacity: 0.8;
}

.direct-email-link:hover {
    opacity: 1;
    color: var(--neon-purple);
    text-shadow: 0 0 8px var(--neon-purple);
}

body.light-mode .direct-email-link {
    font-weight: bold;
}

/* --- Buttons --- */
.submit-btn, .contact-form button {
    background: transparent;
    border: 1px solid var(--matrix-green);
    color: var(--matrix-green);
    padding: 12px 25px;
    font-family: var(--font-main);
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0; 
    width: fit-content;
}

.submit-btn:hover, .contact-form button:hover {
    background: var(--matrix-green);
    color: var(--bg-dark);
    box-shadow: 0 0 15px var(--matrix-green);
}

body.light-mode .submit-btn, 
body.light-mode .contact-form button {
    background: #fff;
    border: 2px solid var(--matrix-green);
    box-shadow: 3px 3px 0px var(--matrix-green);
}

body.light-mode .submit-btn:hover, 
body.light-mode .contact-form button:hover {
    background: var(--matrix-green);
    color: #fff;
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0px var(--matrix-green);
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 40px 0;
    margin-top: auto;
    border-top: 1px solid var(--glass-border);
}

.footer-link {
    color: var(--matrix-green);
    text-decoration: none;
    margin: 0 10px;
}

.footer-link:hover { color: var(--neon-purple); }

/* --- Search & Filter Controls --- */
.controls-container {
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-box input {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--glass-border);
    color: var(--matrix-green);
    font-family: var(--font-main);
    font-size: 1rem;
    padding: 5px;
    width: 300px;
    outline: none;
}

.search-box input:focus {
    border-color: var(--neon-purple);
}

.filter-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--matrix-green);
    font-family: var(--font-main);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 4px 10px;
    transition: all 0.3s ease;
}

.filter-btn:hover, .filter-btn.active {
    background: var(--matrix-green);
    color: var(--bg-dark);
    box-shadow: 0 0 10px var(--matrix-green);
}

/* This hides the headings and the grids associated with them */
.hidden {
    display: none !important;
}

/* Optional: Smooth transition for filtering */
section {
    transition: opacity 0.3s ease;
}

/* Animation for cards appearing */
.card {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* --- Responsive Design --- */
/* @media (max-width: 768px) {
    .container { margin-top: 120px; }
    nav ul { flex-wrap: wrap; }
    .contact-wrapper { grid-template-columns: 1fr; }
    
    .form-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
} */

* {
    box-sizing: border-box; /* Ensures padding doesn't add to width */
}
/* --- IDE-Style Mobile Alignment Fix --- */
@media (max-width: 768px) {
    /* 1. Prevent overlapping: Increase margin to push content below nav */
    .container {
        margin-top: 140px; 
        padding: 0 15px;
        text-align: left; /* Keep it left-aligned like code */
    }

    .hero h1, .container h1 {
        font-size: 6.5vw !important; /* Dynamically scales with screen width */
        white-space: nowrap;        /* Prevents wrapping */
        letter-spacing: -1px;       /* Tighter spacing to fit more characters */
        overflow: hidden;
        text-overflow: ellipsis;    /* Adds ... if it still somehow overflows */
        width: 100%;
        text-align: left;
    }


    /* 2. Fix the Navigation Bar wrapping */
   nav ul {
        flex-direction: row; 
        flex-wrap: wrap;
        justify-content: center; /* Centers items horizontally */
        align-items: center;
        padding: 10px 0;
        gap: 10px;
    }

    .nav-toggle-btn {
        margin: 5px auto; 
        display: block; 
        width: fit-content;
    }

    /* 3. Scale down large headers so they don't overflow */
   h1, h2 {
        max-width: 100%;
        word-wrap: break-word;
        text-align: left; /* Keep left alignment from 3rd image */
    }

    /* 4. Search & Controls: Align to left, not center */
    .controls-container {
        align-items: flex-start; /* Keep left aligned */
        width: 100%;
    }

    .search-box {
        width: 100%;
    }

    /* Ensure search box doesn't overflow */
    .search-box input {
        width: 100%;
        max-width: calc(100vw - 40px); /* Account for container padding */
    }

    .filter-buttons {
        justify-content: flex-start; /* Align buttons to left */
        gap: 5px;
    }

    /* 5. Section Headers: Keep left aligned */
    section h2 {
        text-align: left;
        margin-left: 0;
        width: 100%;
    }

    /* 6. Fix Project Grid: Ensure cards stack properly */
   .project-grid {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 20px;
    }

    .card {
        width: 100% !important; /* Force card to fit screen width */
        margin-left: 0;
        margin-right: 0;
        padding: 15px; /* Adjust internal card padding for mobile */
    }
    .container {
        margin-top: 140px; /* Space for sticky nav */
        padding: 0 15px; /* Consistent side spacing */
        width: 100%;
        overflow-x: hidden; /* Prevent horizontal scroll */
    }

    section h2 {
        font-size: 1.2rem !important;
        white-space: nowrap;
    }

    /* 3. Fix the layout alignment to match your "IDE" style */
    .container {
        padding: 0 10px; /* Tighter padding to give more room for text */
    }

    .contact-wrapper {
        display: flex !important;
        flex-direction: column !important;
        gap: 40px; /* Space between form and connection protocols */
        width: 100%;
        padding: 0;
    }

    /* Force the protocol list to align left and take full width */
    .contact-info {
        width: 100%;
        text-align: left;
    }

    .protocol-list {
        padding-left: 20px; /* Standard indentation for the bullet points */
        margin: 10px 0;
    }
    /* Ensure the "Execute Send" button and Direct link stay left-aligned */
    .form-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}