:root {
    --bg-color: #ffffff;
    --text-color: #1a1a1a;
    --card-bg: #f4f4f4;
    --accent: #0066cc;
    --grid-line: rgba(0, 0, 0, 0.05);
    --red-accent: #ff0000;
    --contrast-banner: #ffcc00;
    --contrast-text: #000000;
}

[data-theme="dark"] {
    --bg-color: #0d1117; 
    --text-color: #c9d1d9;
    --card-bg: #161b22;
    --accent: #58a6ff;
    --grid-line: rgba(255, 255, 255, 0.05);
    --contrast-banner: #f1c40f; 
    --contrast-text: #000000;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background 0.3s, color 0.3s;
    background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
                      linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 40px 40px;
}

.insight-banner {
    background-color: var(--contrast-banner);
    color: var(--contrast-text);
    text-align: center;
    padding: 12px 10px;
    font-size: 1rem;
    font-weight: 800;
    border-bottom: 2px solid #000;
    font-family: 'Segoe UI', sans-serif;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Navbar */
.navbar {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    padding: 1rem 5%; 
    max-width: 1400px; 
    margin: 0 auto;
    flex-wrap: wrap; /* Allows wrapping on mobile */
}

.logo { 
    font-weight: bold; 
    font-size: 1.8rem; 
    color: var(--accent); 
    font-family: 'Courier New', monospace; 
}
.logo .red-accent {
    color: var(--red-accent);
}

.nav-links { 
    display: flex; 
    align-items: center; 
    gap: 20px;
}
.nav-links a { 
    text-decoration: none; 
    color: var(--text-color); 
    font-size: 0.95rem; 
    font-weight: 500; 
}
.nav-links a:hover { color: var(--accent); }

.resume-link { 
    border: 1px solid var(--accent); 
    padding: 5px 12px; 
    border-radius: 4px; 
    color: var(--accent) !important; 
    font-weight: 600;
    transition: 0.3s; 
}
.resume-link:hover { background: var(--accent); color: #fff !important; }

.theme-switch-wrapper {
    display: flex;
    align-items: center;
}
.theme-switch {
    position: relative;
    display: inline-block;
    width: 64px;
    height: 32px;
}
.theme-switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #2c3e50; 
    transition: .4s;
    border-radius: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.3);
}
.slider .icon-light { color: #f1c40f; font-size: 14px; z-index: 1; }
.slider .icon-dark { color: #f1c40f; font-size: 14px; z-index: 1; opacity: 0.5; }
.slider .ball {
    position: absolute;
    height: 24px;
    width: 24px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
input:checked + .slider .ball { transform: translateX(32px); }
input:checked + .slider .icon-light { opacity: 0.5; }
input:checked + .slider .icon-dark { opacity: 1; }

.hero { 
    padding: 3rem 1rem; 
    max-width: 1100px; 
    margin: 0 auto; 
}
.hero-container {
    display: flex;
    flex-direction: row; 
    align-items: center;
    justify-content: center;
    gap: 2rem; 
}

.hero-image-container { flex-shrink: 0; }
.profile-pic { 
    width: 220px; height: 220px; 
    border-radius: 50%; object-fit: cover; 
    border: 4px solid var(--accent); 
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.hero-text-container { text-align: left; }
.hero-text-container h1 { font-size: 2.5rem; margin-bottom: 0; }
.hero-text-container h2 { color: var(--accent); font-family: 'Courier New', monospace; margin-bottom: 1rem; font-size: 1.3rem; }
.bio { max-width: 600px; line-height: 1.5; opacity: 0.9; margin-top: 1rem; font-size: 1rem; }
.social-links { margin-bottom: 0.5rem; }
.social-links a { margin-right: 20px; color: var(--text-color); text-decoration: none; font-size: 1.2rem; }
.social-links a:hover { color: var(--accent); }

.section { max-width: 1200px; margin: 2.5rem auto; padding: 0 20px; }
.section-title { font-size: 1.8rem; margin-bottom: 1.5rem; border-left: 5px solid var(--accent); padding-left: 15px; }

.subtitle-inline {
    display: block;
    font-size: 0.9rem;
    font-weight: normal;
    color: var(--text-color);
    opacity: 0.7;
    margin-top: 5px;
}

.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; }
.skill-category { background: var(--card-bg); padding: 1.2rem; border-radius: 8px; border: 1px solid var(--grid-line); }
.skill-category h4 { margin-bottom: 8px; color: var(--accent); }
.skill-category p { font-size: 0.95rem; line-height: 1.4; }

.timeline { border-left: 2px solid var(--grid-line); margin-left: 10px; padding-left: 20px; }
.timeline-item { margin-bottom: 1.5rem; position: relative; }
.timeline-item::before { content: ''; position: absolute; left: -26px; top: 5px; width: 10px; height: 10px; background: var(--accent); border-radius: 50%; }
.timeline-date { font-size: 0.85rem; color: var(--accent); font-weight: bold; margin-bottom: 2px; }
.timeline-content h4 { font-size: 1.1rem; margin-bottom: 2px; }
.company { display: block; font-weight: 600; margin-bottom: 5px; opacity: 0.8; }
.timeline-content ul { padding-left: 20px; margin-top: 5px; opacity: 0.9; font-size: 0.95rem; line-height: 1.4; }
.timeline-content ul li { margin-bottom: 4px; }

.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.project-card { background: var(--card-bg); border-radius: 10px; overflow: hidden; border: 1px solid var(--grid-line); transition: transform 0.2s; cursor: pointer; }
.project-card:hover { transform: translateY(-5px); }
.video-container { width: 100%; height: 180px; background: #000; overflow: hidden; position: relative; pointer-events: none; }
.video-container video { width: 100%; height: 100%; object-fit: cover; }
.project-info { padding: 1.2rem; }
.project-info h4 { margin-bottom: 5px; }
.project-info p { margin-bottom: 8px; font-size: 0.9rem; line-height: 1.4; }
.tags span { display: inline-block; background: var(--grid-line); padding: 3px 8px; font-size: 0.8rem; border-radius: 4px; margin-right: 5px; margin-top: 5px; font-family: 'Courier New', monospace; }
.btn-link { display: inline-block; margin-top: 10px; color: var(--accent); text-decoration: none; font-weight: bold; font-size: 0.9rem; }

.cert-slider-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cert-slider-container {
    width: 100%;
    overflow: hidden;
    padding: 10px 0;
}
.cert-track {
    display: flex;
    transition: transform 0.4s ease-in-out;
    gap: 20px;
}
.cert-card-slide {
    min-width: calc(20% - 16px);
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--grid-line);
    cursor: pointer;
    transition: transform 0.2s;
}
.cert-card-slide:hover {
    transform: translateY(-5px);
}
.cert-card-slide img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}
.cert-details {
    padding: 10px;
    text-align: center;
}
.cert-details h4 {
    font-size: 0.8rem;
    margin-bottom: 5px;
    line-height: 1.2;
    height: 2.4em;
    overflow: hidden;
}
.cert-details a {
    font-size: 0.75rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: bold;
}
.cert-nav {
    background: var(--card-bg);
    border: 1px solid var(--grid-line);
    color: var(--text-color);
    font-size: 1.2rem;
    padding: 10px;
    cursor: pointer;
    border-radius: 50%;
    z-index: 10;
    transition: 0.2s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cert-nav:hover {
    background: var(--accent);
    color: #fff;
}
.left-arrow { margin-right: 15px; }
.right-arrow { margin-left: 15px; }

footer { text-align: center; padding: 2rem; font-size: 0.9rem; opacity: 0.7; }

.lightbox {
    display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%;
    overflow: auto; background-color: rgba(0, 0, 0, 0.95); backdrop-filter: blur(5px);
    align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s ease;
}
.lightbox.active { display: flex; opacity: 1; }
.lightbox-content {
    position: relative; width: 90%; max-width: 900px; background: var(--card-bg);
    border-radius: 12px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid var(--grid-line); display: flex; flex-direction: column;
}
.lightbox-media-container { width: 100%; background: #000; line-height: 0; display: flex; justify-content: center; align-items: center; min-height: 200px;}
.lightbox-media-container video { width: 100%; max-height: 60vh; object-fit: contain; }
.lightbox-media-container img { width: 100%; max-height: 60vh; object-fit: contain; }

.lightbox-details { padding: 1.5rem; text-align: left; color: var(--text-color); }
.lightbox-details h3 { font-size: 1.8rem; margin-bottom: 0.5rem; color: var(--accent); }
.lightbox-details p { font-size: 1rem; margin-bottom: 1rem; line-height: 1.5; opacity: 0.9; }

.lightbox-nav {
    position: absolute; top: 50%; transform: translateY(-50%); font-size: 3rem; color: #fff;
    cursor: pointer; padding: 20px; z-index: 1001; transition: 0.2s; user-select: none;
}
.lightbox-nav:hover { color: var(--accent); }
.prev-project { left: 20px; }
.next-project { right: 20px; }
.close-lightbox {
    position: absolute; top: 20px; right: 30px; color: #fff; font-size: 40px; font-weight: bold;
    cursor: pointer; z-index: 1002; transition: 0.2s;
}
.close-lightbox:hover { color: var(--accent); }


/* --- MOBILE LAYOUT FIXES --- */
@media (max-width: 768px) {
    .insight-banner {
        font-size: 0.8rem;
        padding: 8px 5px;
    }

    .navbar {
        padding: 0.8rem 5%;
    }

    /* ROW 1: Logo (Left) & Toggle (Right) */
    .logo {
        font-size: 1.5rem;
        order: 1;
        flex-grow: 1; /* Push Toggle to right */
    }

    .theme-switch-wrapper {
        order: 2;
    }
    
    /* Smaller Toggle for mobile */
    .theme-switch { width: 50px; height: 26px; }
    .slider .ball { width: 18px; height: 18px; }
    input:checked + .slider .ball { transform: translateX(24px); }

    /* ROW 2: Nav Links (Resume + Texts) */
    .nav-links {
        order: 3;
        width: 100%; /* Force new line */
        justify-content: center;
        flex-wrap: wrap; 
        gap: 12px;
        margin-top: 15px;
        border-top: 1px solid var(--grid-line);
        padding-top: 15px;
    }
    
    .nav-links a {
        font-size: 0.9rem;
        margin: 0;
    }
    
    .resume-link {
        padding: 4px 10px;
        font-size: 0.85rem;
    }

    /* Mobile Text Adjustments */
    .hero-container { flex-direction: column; text-align: center; gap: 1.5rem; }
    .hero-text-container { text-align: center; }
    .hero-text-container h1 { font-size: 2rem; }
    .hero-text-container h2 { font-size: 1.1rem; }
    .profile-pic { width: 180px; height: 180px; }
    .cert-card-slide { min-width: calc(50% - 10px); }
}

@media (max-width: 480px) {
    .nav-links { gap: 8px; }
    .nav-links a { font-size: 0.85rem; }
    .cert-card-slide { min-width: 100%; }
}