@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;500;700&display=swap');

/* ==================== CSS VARIABLES ==================== */
:root {
    --bg: #000000;
    --text: #ffffff;
    --accent: #00ff41; /* Terminal Green */
    --shadow: #333333;
    --border-width: 3px;
    --card-bg: #111111;
}

.light-mode {
    --bg: #ffffff;
    --text: #000000;
    --accent: #ff0055; /* Neon Pink */
    --shadow: #000000;
    --card-bg: #f0f0f0;
}

/* ==================== RESET & BASE ==================== */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Fira Code', monospace; 
}

body {
    background-color: var(--bg);
    color: var(--text);
    transition: all 0.2s ease;
    overflow-x: hidden;
    position: relative;
}

/* ==================== BINARY BACKGROUND CANVAS ==================== */
#binary-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.25;
    pointer-events: none;
}

.light-mode #binary-canvas {
    opacity: 0.18;
}

/* ==================== CONTENT LAYER ==================== */
nav,
section,
#loader {
    position: relative;
    z-index: 1;
}

nav {
    z-index: 1000;
    background: var(--bg);
}

section {
    background: transparent;
}

.timeline-card,
.work-card,
.skill-category,
.contact-area,
.glitch-box {
    position: relative;
    z-index: 2;
}

/* ==================== CUSTOM TERMINAL LOADER ==================== */
#loader {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 40px;
    color: #00ff41;
    opacity: 1;
    transition: opacity 1s ease-out;
}

#loader.fade-out {
    opacity: 0;
}

#loader-content {
    position: absolute;
    top: 40px;
    left: 40px;
}

#loader-content p {
    margin-bottom: 10px;
    font-size: 0.9rem;
    font-family: 'Fira Code', monospace;
}

/* ==================== OFFLINE/DISCONNECT PAGE ==================== */
#offline-page {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.offline-content {
    text-align: center;
    max-width: 600px;
    border: var(--border-width) solid var(--text);
    padding: 60px 40px;
    background: var(--card-bg);
    box-shadow: 15px 15px 0px var(--shadow);
    position: relative;
    z-index: 2;
}

.offline-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.offline-title {
    font-size: clamp(2rem, 6vw, 4rem);
    font-weight: 900;
    letter-spacing: 2px;
    margin-bottom: 20px;
    color: var(--accent);
}

.offline-message {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--text);
}

.offline-status {
    font-size: 1rem;
    margin-bottom: 20px;
    font-weight: 700;
}

.offline-details {
    border-top: 2px dashed var(--text);
    border-bottom: 2px dashed var(--text);
    padding: 20px;
    margin: 20px 0;
    font-family: 'Fira Code', monospace;
}

#retry-btn {
    transition: all 0.2s ease;
}

#retry-btn:hover {
    transform: translate(-3px, -3px);
    box-shadow: 11px 11px 0px var(--shadow);
}

#retry-btn:active {
    transform: translate(0, 0);
    box-shadow: 8px 8px 0px var(--shadow);
}

/* ==================== NAVIGATION ==================== */
nav {
    position: fixed;
    top: 0; 
    width: 100%;
    padding: 20px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    background: var(--bg);
    border-bottom: var(--border-width) solid var(--text);
}

.nav-links a {
    text-decoration: none;
    color: var(--text);
    margin-left: 20px;
    font-weight: 700;
    padding: 5px 10px;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.nav-links a:hover {
    border: 2px solid var(--accent);
    background: var(--accent);
    color: #000;
}

#theme-toggle {
    background: var(--accent);
    color: #000;
    border: var(--border-width) solid var(--text);
    padding: 8px 15px;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 4px 4px 0px var(--shadow);
    transition: all 0.2s ease;
    font-size: 20px;
    line-height: 1;
    min-width: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#theme-toggle:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px var(--shadow);
}

/* ==================== HERO SECTION ==================== */
section { 
    padding: 120px 10% 60px; 
    min-height: 100vh;
    position: relative;
    z-index: 1;
    background: transparent;
}

.hero h1 {
    font-size: clamp(3rem, 10vw, 7rem);
    line-height: 0.8;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.glitch-box {
    display: inline-block;
    background: var(--accent);
    color: #000;
    padding: 10px 20px;
    font-weight: 700;
    border: var(--border-width) solid var(--text);
    box-shadow: 8px 8px 0px var(--shadow);
    margin-bottom: 30px;
    transition: all 0.2s ease;
}

.glitch-box:hover {
    transform: translate(-3px, -3px);
    box-shadow: 11px 11px 0px var(--shadow);
}

/* ==================== TIMELINE (BRUTALIST) ==================== */
.timeline {
    position: relative;
    max-width: 900px;
    margin-top: 50px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 0;
    width: var(--border-width);
    background: var(--text);
}

.timeline-item {
    position: relative;
    margin-bottom: 50px;
    padding-left: 60px;
    opacity: 0;
    transform: translateY(40px);
    transition: 0.6s cubic-bezier(0.17, 0.67, 0.83, 0.67);
}

.timeline-item.active { 
    opacity: 1; 
    transform: translateY(0); 
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 10px;
    width: 25px;
    height: 25px;
    background: var(--accent);
    border: var(--border-width) solid var(--text);
    z-index: 2;
}

.timeline-card {
    background: var(--card-bg);
    border: var(--border-width) solid var(--text);
    padding: 25px;
    box-shadow: 10px 10px 0px var(--shadow);
    transition: all 0.3s ease;
}

.timeline-card:hover {
    transform: translate(-5px, -5px);
    box-shadow: 15px 15px 0px var(--shadow);
}

.timeline-category {
    font-size: 0.8rem;
    background: var(--text);
    color: var(--bg);
    padding: 2px 8px;
    margin-bottom: 10px;
    display: inline-block;
}

/* ==================== WORKS SECTION ==================== */
.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.work-card {
    border: var(--border-width) solid var(--text);
    padding: 20px;
    transition: 0.2s;
    cursor: pointer;
    background: var(--bg);
}

.work-card:hover {
    background: var(--accent);
    color: #000;
    transform: translate(-5px, -5px);
    box-shadow: 10px 10px 0px var(--text);
}

/* ==================== CONTACT SECTION ==================== */
.contact-area {
    border: var(--border-width) dashed var(--text);
    padding: 40px;
    text-align: center;
}

/* ==================== FOOTER / COPYRIGHT ==================== */
footer {
    padding: 40px 10%;
    text-align: center;
    position: relative;
    z-index: 1;
}

footer p {
    font-family: 'Fira Code', monospace;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 1px;
    color: var(--text);
}

/* ==================== SKILLS SECTION ==================== */
.skills-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 1200px;
}

.skill-category {
    border: var(--border-width) solid var(--text);
    padding: 0;
    background: var(--card-bg);
    transition: all 0.3s ease;
}

.skill-category:hover {
    transform: translate(-5px, -5px);
    box-shadow: 10px 10px 0px var(--shadow);
}

.skill-header {
    background: var(--accent);
    color: #000;
    padding: 15px 20px;
    font-weight: 700;
    font-size: 1.2rem;
    border-bottom: var(--border-width) solid var(--text);
}

.skill-tags {
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.skill-tag {
    display: inline-block;
    padding: 8px 15px;
    border: 2px solid var(--text);
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.skill-tag:hover {
    background: var(--accent);
    color: #000;
    transform: translateY(-3px);
    box-shadow: 4px 4px 0px var(--shadow);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .hero h1 { 
        font-size: 3rem; 
    }
    
    nav { 
        padding: 15px 5%; 
    }
    
    .nav-links { 
        display: none; 
    }
    
    section {
        padding: 100px 5% 40px;
    }
    
    .timeline {
        margin-left: 0;
    }
    
    .timeline-item {
        padding-left: 50px;
    }
}