/* 
   ANTI-SLOP AESTHETIC: "The Redacted Terminal"
   - No rounded corners
   - Monospace only
   - High contrast
   - Raw, brutalist layout
*/

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

:root {
    --bg-color: #050505;
    --panel-bg: #0a0a0a;
    --text-primary: #e0e0e0;
    --text-dim: #666;
    --accent-alert: #ff3300; /* Red/Orange for vulnerabilities */
    --accent-sys: #7CFF9D;   /* Pale Green for AppSec feel */
    --accent-info: #00ccff;  /* Cyan for links */
    --border-color: #333;
    --grid-gap: 8px;
}

/* Developer Mode Overrides */
body.dev-mode {
    --accent-sys: #00ccff;   /* Cyan for Dev Mode */
    --accent-alert: #ff00ff; /* Magenta for Dev Mode */
    --accent-info: #00ff41;  /* Green for Dev Mode */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Space Mono', monospace;
    line-height: 1.5;
    overflow-x: hidden;
    font-size: 14px;
}

/* CRT Scanline Effect */
body::before {
    content: " ";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

a {
    color: var(--accent-info);
    text-decoration: none;
    position: relative;
    transition: color 0.2s, background-color 0.2s;
}

a:hover {
    background-color: rgba(0, 204, 255, 0.2); /* Semi-transparent background */
    color: #fff; /* High contrast text */
    text-shadow: 0 0 5px var(--accent-info);
}

/* Dev mode link hover override */
body.dev-mode a:hover {
    background-color: rgba(0, 255, 65, 0.2);
    text-shadow: 0 0 5px var(--accent-info);
}

/* Layout Grid */
.grid-container {
    display: grid;
    grid-template-columns: 300px 1fr; /* Increased sidebar width */
    min-height: 100vh;
    border: 1px solid var(--border-color);
    margin: 40px auto; /* Increased margin and centered */
    max-width: 1500px; /* Max width constraint */
    gap: var(--grid-gap);
    position: relative;
    z-index: 1;
}

/* Sidebar / Terminal Status */
.sidebar {
    border-right: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.sidebar > div {
    margin-top: 25px; /* Vertical spacing between blocks */
    padding-top: 25px;
    border-top: 1px solid rgba(51, 51, 51, 0.5); /* Subtle separator */
}

.sidebar > div:first-of-type {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

/* Profile Picture */
.profile-pic {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border: 1px solid var(--accent-sys);
    filter: grayscale(100%) contrast(1.1); /* Reduced contrast */
    margin-bottom: 20px;
    display: block;
}

.profile-pic:hover {
    filter: none;
}

.profile-header h1 {
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    color: var(--accent-sys);
}

.profile-header h2 {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 20px;
}

.contact-info {
    font-size: 0.8rem;
}

.contact-item {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.contact-item i {
    width: 20px;
    color: var(--text-dim);
}

/* Main Content Area */
.main-content {
    padding: 0;
}

.section-panel {
    border-bottom: 1px solid var(--border-color);
    padding: 30px;
}

.section-panel:last-child {
    border-bottom: none;
}

.section-title {
    font-size: 1.2rem; /* Increased font size */
    text-transform: uppercase;
    border-left: 3px solid var(--accent-alert);
    padding-left: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.section-title::after {
    content: '';
    flex-grow: 1;
    height: 1px;
    background: var(--border-color);
    margin-left: 15px;
    opacity: 0.5; /* Reduced opacity */
}

/* Experience Items */
.exp-item {
    margin-bottom: 25px;
    position: relative;
    padding-left: 20px;
}

.exp-item::before {
    content: '>';
    position: absolute;
    left: 0;
    color: var(--accent-alert);
}

.exp-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    flex-wrap: wrap;
}

.exp-role {
    font-weight: 700;
    color: var(--text-primary);
}

.exp-company {
    color: var(--text-dim);
}

.exp-date {
    font-family: 'Space Mono', monospace;
    color: var(--accent-sys);
    font-size: 0.8rem;
}

.exp-details ul {
    list-style: none;
    margin-top: 10px;
}

.exp-details li {
    margin-bottom: 5px;
    color: #bbb;
    font-size: 0.9rem;
}

.exp-details li::before {
    content: '- ';
    color: var(--text-dim);
}

/* Skills Grid */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.skill-tag {
    border: 1px solid var(--border-color);
    padding: 8px;
    font-size: 0.85rem;
    text-align: center;
    transition: all 0.2s;
    cursor: crosshair;
}

.skill-tag:hover {
    border-color: var(--accent-sys);
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.2);
    color: var(--accent-sys);
}

/* Switch Portfolio Button */
.switch-portfolio {
    margin-top: auto;
    border: 1px solid var(--accent-info);
    padding: 15px;
    text-align: center;
    display: block;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
    transition: 0.3s;
}

.switch-portfolio:hover {
    background: var(--accent-info);
    color: #000;
    box-shadow: 0 0 15px var(--accent-info);
}

/* Glitch Animation for Name */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -1px 0 var(--accent-alert);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim-1 5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -1px 0 var(--accent-sys);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim-2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
    0% { clip: rect(20px, 9999px, 10px, 0); }
    20% { clip: rect(50px, 9999px, 60px, 0); }
    40% { clip: rect(10px, 9999px, 80px, 0); }
    60% { clip: rect(30px, 9999px, 10px, 0); }
    80% { clip: rect(70px, 9999px, 90px, 0); }
    100% { clip: rect(40px, 9999px, 20px, 0); }
}

@keyframes glitch-anim-2 {
    0% { clip: rect(60px, 9999px, 70px, 0); }
    20% { clip: rect(10px, 9999px, 50px, 0); }
    40% { clip: rect(90px, 9999px, 10px, 0); }
    60% { clip: rect(30px, 9999px, 40px, 0); }
    80% { clip: rect(80px, 9999px, 20px, 0); }
    100% { clip: rect(10px, 9999px, 90px, 0); }
}

/* Accessibility: Reduce motion */
@media (prefers-reduced-motion: reduce) {
    .glitch::before,
    .glitch::after {
        animation: none;
        display: none;
    }
}

/* Mobile & Tablet Optimization (Covers Portrait & Landscape) */
@media screen and (max-width: 992px), screen and (orientation: landscape) and (max-height: 600px) {
    /* 1. GRID LAYOUT FIXES & 11. REMOVE OVERFLOW ISSUES */
    html, body {
        overflow-x: hidden !important;
        width: 100%;
    }

    .grid-container {
        display: flex !important;
        flex-direction: column;
        margin: 0 !important;
        max-width: 100%;
        border: none;
        width: 100%;
        min-height: auto;
    }

    /* 2. SIDEBAR OPTIMIZATION */
    .sidebar {
        width: 100%;
        padding: 20px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .sidebar > div {
        width: 100%;
        max-width: 500px; /* Prevent content from stretching too wide on tablets */
    }

    .profile-pic {
        width: 150px; /* Fixed reasonable size */
        max-width: 50%;
        margin: 0 auto 20px auto;
    }

    .profile-header, 
    .contact-info, 
    .education-mini {
        text-align: center;
        width: 100%;
    }

    .status-indicator {
        white-space: normal; /* Allow wrapping */
        display: block;
        margin-top: 10px;
    }

    /* 3. TYPOGRAPHY SCALING */
    .section-title {
        font-size: 1.1rem;
    }

    .exp-role, 
    .exp-company {
        font-size: 1rem;
    }

    p {
        line-height: 1.6;
        font-size: 0.95rem;
    }

    /* 4. CONTENT WIDTH CONTROL */
    .main-content {
        width: 100%;
    }

    .section-panel {
        padding: 25px 20px !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* 5. EXPERIENCE SECTION FIXES */
    .exp-item {
        padding-left: 15px;
    }

    .exp-item::before {
        left: 0;
    }

    .exp-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .exp-date {
        white-space: normal;
        margin-bottom: 5px;
        display: inline-block;
    }

    /* 6. SKILLS GRID IMPROVEMENT */
    .skills-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 8px;
    }

    .skill-tag {
        font-size: 0.8rem;
        padding: 10px;
    }

    /* 7. SECTION TITLE LINE FIX */
    .section-title::after {
        display: none; /* Hide line on mobile for cleaner look */
    }

    /* 8. BUTTON RESPONSIVENESS */
    .sidebar a[href="developer.html"], 
    .sidebar a[href="index.html"] {
        display: block;
        width: 100%;
        max-width: 400px;
        padding: 15px !important;
        font-size: 0.9rem !important;
        text-align: center;
        margin: 20px auto 0 auto !important;
        box-sizing: border-box;
    }
    
    /* 9. PUBLICATIONS AND PROJECT CARDS */
    a i {
        width: auto;
        margin-right: 5px;
    }

    .exp-details {
        padding: 0;
    }

    /* 10. SCANLINE BACKGROUND RESPONSIVENESS */
    body::before {
        background-size: 100% 4px, 4px 100%; /* Coarser scanlines for mobile performance */
    }

    /* 12. IMPROVE TAP TARGETS */
    .contact-item, 
    .exp-date, 
    .switch-portfolio {
        padding: 10px 0;
        display: block;
    }

    /* 13. OPTIONAL AESTHETIC IMPROVEMENTS */
    .grid-container, 
    .sidebar, 
    .section-panel, 
    .skill-tag, 
    .exp-date {
        border-width: 1px; /* Ensure borders are visible */
    }

    /* 14. DISABLE GLITCH ON MOBILE TO PREVENT ARTIFACTS */
    .glitch::before,
    .glitch::after {
        display: none;
    }
}
