/* --- VARIABLES: Easy to tweak colors --- */
:root {
    /* Default DARK Theme (Cyberpunk) */
    --bg-color: #0a0a0a;
    --surface-color: #161b22;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --accent-color: #00ff9d;
    --accent-glow: rgba(0, 255, 157, 0.2);
    /* Dark Mode Nav (Translucent Black) */
    --nav-bg: rgba(10, 10, 10, 0.85); 
    --nav-border: rgba(255, 255, 255, 0.1);
    --nav-text: #e6edf3;
    
    --font-code: 'Fira Code', monospace;
    --font-body: 'Inter', sans-serif;
}

/* --- LIGHT THEME (Creme/Beach Vibes) --- */
[data-theme="light"] {
    --bg-color: #fdfcf0;       /* Warm Cream/Sand */
    --surface-color: #f4f1ea;  /* Slightly darker sand for cards */
    --text-primary: #4a4036;   /* Dark Coffee Brown */
    --text-secondary: #8b7e74; /* Warm Grey */
    
    --accent-color: #009688;   /* Ocean Teal / Sea Glass */
    --accent-glow: rgba(0, 150, 136, 0.2);
    /* Light Mode Nav (Translucent Sand/Creme) */
    --nav-bg: rgba(253, 252, 240, 0.85); 
    --nav-border: rgba(74, 64, 54, 0.1); /* Low opacity coffee color */
    --nav-text: #4a4036;
}

/* --- GLOBAL RESET & BASE --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s; /* Smooth transition */
}

/* --- TYPOGRAPHY --- */
h1, h2, h3, h4 {
    font-family: var(--font-code);
    color: var(--text-primary);
    margin-bottom: 1rem;
}

h1 {
    font-size: 3rem;
    text-shadow: 0 0 10px var(--accent-glow);
}

/* Global 'a' tags (used for footer links/contact, etc., but not nav) */
a {
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--accent-color);
    transition: all 0.3s ease;
}

a:hover {
    background-color: var(--accent-color);
    color: var(--bg-color);
    box-shadow: 0 0 15px var(--accent-color);
}

/* --- LAYOUT UTILITIES --- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

section {
    padding: 80px 0;
    /* Use variable for subtle guide line */
    border-left: 1px solid var(--nav-border); 
    margin-left: 20px;
    padding-left: 40px;
}

/* --- COMPONENTS: The "Card" Look --- */
.card, .project-item, .skill-box {
    background: var(--surface-color);
    /* Use variable for border color */
    border: 1px solid var(--nav-border); 
    padding: 2rem;
    border-radius: 4px;
    transition: transform 0.3s ease, border-color 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Futuristic Hover Effect */
.card:hover, .project-item:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
    box-shadow: 0 10px 30px -10px var(--accent-glow);
}

/* Add a fake "terminal header" to cards */
.card::before, .project-item::before {
    content: '';
    display: block;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-color), transparent);
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.3s;
}

.card:hover::before, .project-item:hover::before {
    opacity: 1;
}

/* --- BUTTONS: Neon Style --- */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-family: var(--font-code);
    font-weight: bold;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:hover {
    background: var(--accent-color);
    color: var(--bg-color);
    box-shadow: 0 0 20px var(--accent-glow);
}

/* --- SUPER SAIYAN BUTTON & MODE --- */
.btn-saiyan {
    display: inline-block;
    padding: 12px 24px;
    font-family: var(--font-code);
    font-weight: bold;
    border: 1px solid #ffdd00; /* Electric Yellow */
    color: #ffdd00;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-saiyan:hover {
    background: #ffdd00;
    color: #000;
    box-shadow: 0 0 25px rgba(255, 221, 0, 0.8);
}

/* This class replaces the blue/green border with yellow gold */
.saiyan-mode {
    background: linear-gradient(135deg, #ffdd00, #ffaa00) !important;
    box-shadow: 0 0 50px rgba(255, 221, 0, 0.6) !important;
    transition: all 0.5s ease;
}

/* --- NAVIGATION --- */
nav {
    padding: 15px 0; /* Slightly slimmer for a modern look */
    position: sticky;
    top: 0;
    
    /* CRITICAL: Use variables for theme switching */
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    
    /* Glassmorphism Blur */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px); /* Safari support */
    
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    
    transition: background 0.3s ease, border-color 0.3s ease, padding 0.3s ease, transform 0.3s ease;
}

/* --- NAVIGATION LINKS --- */
.nav-links a {
    color: var(--nav-text); /* Ensures links turn brown in light mode */
    font-weight: 500;
    margin-right: 20px;
    position: relative;
    border-bottom: none; /* Remove the default underline */
    transition: color 0.3s ease;
}

/* Hover Effect: A small glowing dot or line instead of full underline */
.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

/* Active Page Style */
.nav-links a.active {
    color: var(--accent-color);
    font-weight: bold;
}

/* --- THEME TOGGLE BUTTON --- */
#theme-toggle {
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 8px 12px;
    cursor: pointer;
    font-family: var(--font-code);
    font-size: 1.2rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

#theme-toggle:hover {
    background: var(--accent-color);
    color: var(--bg-color);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* --- GRID SYSTEM --- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* Tag styling for the repo cards */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-color);
    font-size: 0.8rem;
    margin-right: 5px;
    margin-bottom: 5px;
    border: 1px solid rgba(0, 255, 157, 0.2);
}

.card-header a {
    color: var(--text-primary);
    border-bottom: none;
}

.card-header a:hover {
    color: var(--accent-color);
    background: none;
    box-shadow: none;
}
/* --- TIMELINE (Experience) --- */
.timeline {
    position: relative;
    padding-left: 20px;
    border-left: 2px solid var(--nav-border); /* The faint main line */
    margin-top: 2rem;
}

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
    padding-left: 30px;
}

/* The "Node" or "Commit Dot" */
.timeline-item::before {
    content: '';
    position: absolute;
    left: -27px; 
    top: 8px; 
    width: 12px;
    height: 12px;
    background-color: var(--bg-color);
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    z-index: 1;
    transition: all 0.3s ease;
}

/* Glow effect on hover */
.timeline-item:hover::before {
    background-color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-glow);
}

.job-date {
    font-family: var(--font-code);
    color: var(--accent-color);
    font-size: 0.9rem;
    display: inline-block;
    margin-bottom: 5px;
}

/* Styling the bullet points in the achievements list */
.timeline-item ul li {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.timeline-item ul li::marker {
    color: var(--accent-color); /* Green bullet points */
    content: "> "; /* Replaces standard bullet with terminal arrow */
}

/* --- HERO SECTION LAYOUT --- */
.hero-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4rem; /* Space between text and video */
}

/* Container for the video */
.hero-visual {
    flex-shrink: 0; /* Prevents video from shrinking too much */
}

/* The Glowing Cyber Frame */
.video-frame {
    width: 300px;
    height: 300px;
    border-radius: 50%; /* Makes it circular */
    padding: 5px; /* Gap for the border effect */
    background: linear-gradient(135deg, var(--accent-color), #79c0ff); /* Green/Blue gradient border */
    box-shadow: 0 0 40px var(--accent-glow);
    position: relative;
    overflow: hidden;
}

/* The Video Itself */
.video-frame video {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures video fills the circle without stretching */
    border-radius: 50%;
    background-color: var(--bg-color); /* Fallback color */
}

/* Define the base look for terminal/log windows using theme variables */
.terminal-window {
    /* Use surface color for the background (it's slightly lighter than bg-color) */
    background: var(--surface-color) !important; 
    /* Use the nav border color, which changes based on theme, for a soft border */
    border: 1px solid var(--nav-border) !important; 
    border-radius: 5px;
    box-shadow: 0 0 5px var(--accent-glow);
    transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

/* You may also want to ensure the log list colors adapt */
.terminal-window #blog-list a {
    color: var(--text-primary); /* Ensures blog titles adapt */
}

/* Also ensure the color of system messages in the log adapts */
.terminal-window #blog-list p, .terminal-window #blog-list div > span {
    color: var(--text-secondary); 
}

/* --- GAME STYLES (GRID LAYOUT FIX) --- */
.game-layout {
    display: grid;
    /* Desktop: Sidebar (1 part) | Game Window (2 parts) */
    grid-template-columns: 1fr 2fr;
    grid-template-areas: 
        "status window"
        "leaderboard window";
    gap: 2rem;
    align-items: start;
    margin-top: 2rem;
}

/* Assign grid areas */
.game-status {
    grid-area: status;
    min-width: 250px;
}

.game-leaderboard {
    grid-area: leaderboard;
    min-width: 250px;
}

.game-window {
    grid-area: window;
    background: var(--surface-color);
    border: 1px solid var(--accent-color);
    padding: 1rem;
    
    /* FIXED HEIGHT to prevent expansion */
    height: 400px;
    max-height: 400px;
    overflow-y: auto; /* Scroll if content overflows */
    
    font-family: var(--font-code);
    font-size: 0.9rem;
    white-space: pre-wrap;
    line-height: 1.2;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: border-color 0.3s, box-shadow 0.3s;
}

/* Game Status Boxes */
.status-box {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 10px 15px;
    border: 1px solid var(--text-secondary);
    border-radius: 4px;
    font-family: var(--font-code);
}

/* Styling for the Anomaly text (subtle, pre-detection) */
.anomaly {
    color: var(--text-secondary); 
    font-weight: bold;
    font-size: 1.1em;
    opacity: 0.8;
    animation: flash 0.2s 3; 
}

/* NEW: Styling for a successfully detected anomaly */
.detected-anomaly {
    color: var(--accent-color) !important; /* Green/Teal accent color */
    opacity: 1;
    background-color: rgba(0, 150, 136, 0.1); /* Subtle background highlight */
    transition: color 0.3s, background-color 0.3s;
}

/* NEW: Styling for the Detect Button (Mobile Friendly) */
#detect-button {
    width: 100%;
    margin-top: 10px;
    padding: 15px;
    font-size: 1.1rem;
    border-color: var(--accent-color);
    background: rgba(0, 255, 157, 0.05); /* Faint background */
}
#detect-button:active {
    background: var(--accent-color);
    color: var(--bg-color);
}
#detect-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}


/* Animation when an anomaly appears */
@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

/* Leaderboard styling */
.leaderboard-list {
    list-style: none;
    padding: 0;
}

.leaderboard-list li {
    padding: 10px;
    margin-bottom: 5px;
    background: var(--surface-color);
    border-left: 3px solid var(--accent-color);
    font-family: var(--font-code);
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.leaderboard-list li:first-child {
    font-weight: bold;
    border-left-width: 5px;
}

/* Input field styling */
.game-input {
    width: 100%;
    padding: 8px 10px;
    margin-top: 5px;
    margin-bottom: 20px;
    background: var(--bg-color);
    border: 1px solid var(--text-secondary);
    color: var(--text-primary);
    font-family: var(--font-code);
    border-radius: 2px;
    box-shadow: 0 0 5px rgba(0,0,0,0.1);
}

/* --- RESPONSIVE DESIGN (MOBILE & TABLET) --- */
@media (max-width: 900px) {
    
    .container {
        padding: 0 20px;
        width: 100%;
    }

    section {
        margin-left: 0 !important;
        padding-left: 0 !important;
        border-left: none !important;
        text-align: center;
        padding-top: 40px;
        padding-bottom: 40px;
    }

    .hero-layout {
        flex-direction: column; 
        align-items: center;
        justify-content: center;
        gap: 2rem;
    }

    #hero h1, 
    #hero p, 
    #hero div {
        margin-left: 0 !important;
        width: 100%;
        text-align: center;
    }

    #hero .video-frame {
        width: 200px !important;
        height: 200px !important;
        border-radius: 50% !important;
        margin: 0 auto 30px auto !important; /* 'auto' centers it, !important protects it */
    }
    
    nav {
        flex-direction: column;
        align-items: center;
        padding: 15px 0;
    } 
    .nav-links {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 15px;
        width: 100%;
        margin-top: 10px;
    }
    #theme-toggle {
        position: absolute;
        top: 15px;
        right: 0;
    }
    
    .game-layout {
        grid-template-columns: 1fr;
        grid-template-areas: "status" "window" "leaderboard";
    }
}