/* --- Variables & Configuration --- */
:root {
    --bg-color: #0d1117; /* Dark GitHub-like background */
    --card-bg: rgba(22, 27, 34, 0.85);
    --text-color: #c9d1d9;
    --primary-color: #58a6ff; /* Blue accent */
    --secondary-color: #238636; /* Green accent */
    --accent-color: #bc8cff; /* Purple accent */
    --font-main: 'Fira Code', monospace;
    --nav-height: 70px;
    --code-bg-opacity: 0.1;
}

[data-theme="light"] {
    --bg-color: #f0f2f5;
    --card-bg: rgba(255, 255, 255, 0.9);
    --text-color: #24292f;
    --primary-color: #0969da;
    --secondary-color: #1a7f37;
    --accent-color: #8250df;
    --code-bg-opacity: 0.05;
}

/* --- Global Reset & Basics --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

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

/* --- Scanline Overlay (CRT Effect) --- */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.15) 0px,
            rgba(0, 0, 0, 0.15) 1px,
            transparent 1px,
            transparent 2px
    );
    pointer-events: none;
    z-index: 9999;
    opacity: 0.4;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 10px;
    background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
    border: 2px solid var(--bg-color);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* --- Background C++ Code Effect --- */
.cpp-background {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
    display: flex;
    padding: 20px;
}

#bg-code {
    color: var(--primary-color);
    opacity: var(--code-bg-opacity);
    font-size: 1.2rem;
    white-space: pre-wrap;
}

/* --- Navigation --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(13, 17, 23, 0.95);
    backdrop-filter: blur(10px);
    padding: 0 5%;
    height: var(--nav-height);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--primary-color);
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.nav-links {
    display: flex;
    list-style: none;
}
.nav-links li { margin: 0 15px; }
.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s;
}
.nav-links a:hover {
    color: var(--primary-color);
    text-shadow: 0 0 5px var(--primary-color);
}

.controls button {
    background: none;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    padding: 5px 10px;
    cursor: pointer;
    margin-left: 10px;
    font-family: var(--font-main);
    transition: all 0.3s;
}
.controls button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* --- Hero Section (Terminal) --- */
#hero {
    height: calc(100vh - var(--nav-height));
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}

.terminal-window {
    background: rgba(13, 17, 23, 0.95);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(88, 166, 255, 0.15);
    max-width: 800px;
    width: 95%;
    overflow: hidden;
    position: relative;
    z-index: 10;
}

.terminal-header {
    background: rgba(88, 166, 255, 0.1);
    padding: 10px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--primary-color);
}

.terminal-btn {
    width: 12px; height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}
.terminal-btn.red { background: #ff5f56; }
.terminal-btn.yellow { background: #ffbd2e; }
.terminal-btn.green { background: #27c93f; }

.terminal-title {
    margin-left: auto; margin-right: auto;
    font-size: 0.8rem; opacity: 0.7;
}

.terminal-body { padding: 40px; text-align: left; }
.comment { color: #6a737d; font-style: italic; margin-bottom: 20px; }

.typing-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.prompt {
    color: var(--secondary-color);
    margin-right: 15px;
    font-size: 2rem;
    font-weight: bold;
}
#typing-text {
    color: var(--primary-color);
    font-size: 2.2rem;
    margin: 0;
}
.cursor {
    font-size: 2.2rem;
    color: var(--primary-color);
    animation: blink 1s step-end infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.syntax-highlight { color: var(--accent-color); font-family: var(--font-main); }

/* --- Buttons --- */
.cta-group { margin-top: 30px; }
.btn {
    display: inline-block;
    padding: 10px 25px;
    text-decoration: none;
    border: 2px solid transparent;
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: bold;
    transition: all 0.3s;
    margin: 5px 5px 5px 0;
}

.btn.no-border {
    border: none;
    background: rgba(88, 166, 255, 0.1);
    color: var(--primary-color);
    position: relative;
    overflow: hidden;
}
.btn.no-border::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}
.btn.no-border:hover::before { left: 100%; }
.btn.no-border:hover {
    color: var(--bg-color);
    background: var(--primary-color);
    box-shadow: 0 0 15px var(--primary-color);
}

/* --- Sections General --- */
.section {
    padding: 80px 10%;
    min-height: 80vh;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.section-title {
    text-align: center;
    margin-bottom: 50px;
    font-size: 2rem;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    display: table;
    margin-left: auto;
    margin-right: auto;
    padding: 10px 30px;
    background: rgba(88, 166, 255, 0.1);
    clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
}
.section-title::before { content: '< '; margin-right: 10px; color: var(--secondary-color); }
.section-title::after { content: ' />'; margin-left: 10px; color: var(--secondary-color); }

/* --- HUD / Tech Cards --- */
.tech-card {
    position: relative;
    background: var(--card-bg);
    padding: 30px;
    border: 1px solid rgba(88, 166, 255, 0.3);
    transition: all 0.3s;
}

/* Corners */
.tech-card::before, .tech-card::after,
.carousel-slide::before, .carousel-slide::after {
    content: "";
    position: absolute;
    width: 20px; height: 20px;
    border-color: var(--primary-color);
    border-style: solid;
    pointer-events: none;
    transition: all 0.3s ease;
}
.tech-card::before, .carousel-slide::before {
    top: -2px; left: -2px;
    border-width: 3px 0 0 3px;
}
.tech-card::after, .carousel-slide::after {
    bottom: -2px; right: -2px;
    border-width: 0 3px 3px 0;
}
.tech-card:hover::before, .tech-card:hover::after,
.carousel-slide:hover::before, .carousel-slide:hover::after {
    width: 30px; height: 30px;
    border-color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color);
}

/* --- Skills Section (Tech Tree) --- */
.skills-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}
.skill-category {
    background: rgba(13, 17, 23, 0.6);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(88, 166, 255, 0.2);
}
.category-title {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.skill-card {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 6px;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}
.skill-card:hover {
    transform: translateX(5px);
    border-left: 3px solid var(--secondary-color);
    background: rgba(22, 27, 34, 1);
}
.skill-icon {
    width: 40px; height: 40px;
    display: flex; justify-content: center; align-items: center;
    font-size: 1.8rem;
    margin-right: 15px;
    color: var(--text-color);
}
.skill-icon i, .skill-icon img { transition: 0.3s; }
.skill-card:hover .skill-icon i { color: var(--accent-color); }

.skill-info { flex-grow: 1; }
.skill-info h4 { margin: 0 0 5px 0; font-size: 0.9rem; font-weight: 600; }

.progress-bar {
    width: 100%; height: 6px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}
.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0; /* Animated via JS */
    transition: width 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- Projects Carousel --- */
.filter-container {
    display: flex; justify-content: center; gap: 15px; margin-bottom: 30px;
}
.filter-btn {
    background: transparent;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    padding: 8px 16px;
    cursor: pointer;
    font-family: var(--font-main);
    transition: 0.3s;
}
.filter-btn.active, .filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 0 10px rgba(88, 166, 255, 0.2);
}

.carousel-container {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    height: 600px;
}
.carousel-track-container {
    height: 100%;
    overflow: hidden;
    position: relative;
}
.carousel-track {
    padding: 0; margin: 0;
    list-style: none;
    position: relative;
    height: 100%;
    transition: transform 300ms ease-out;
}
.carousel-slide {
    position: absolute;
    top: 10px; bottom: 10px;
    width: calc(100% - 20px); /* Leave space for borders */
    padding: 40px;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid rgba(88, 166, 255, 0.2);
    margin: 0 10px;
}
.carousel-slide h3 { color: var(--secondary-color); margin-bottom: 15px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 10px; }
.carousel-slide ul { padding-left: 20px; margin-top: 10px; }
.carousel-slide li { margin-bottom: 5px; }

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-color);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    width: 40px; height: 40px;
    cursor: pointer;
    z-index: 20;
    border-radius: 50%;
    transition: 0.3s;
}
.carousel-btn:hover { background: var(--primary-color); color: var(--bg-color); }
.prev-btn { left: -60px; }
.next-btn { right: -60px; }

/* --- Contact & Footer --- */
.contact-wrapper {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 40px;
}
.social-links { display: flex; flex-direction: column; gap: 20px; }
.social-btn {
    text-decoration: none;
    color: var(--text-color);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 15px;
}
.social-btn:hover { color: var(--primary-color); }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 5px; color: var(--accent-color); font-size: 0.9rem;}
.form-group input, .form-group textarea {
    width: 100%;
    padding: 12px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--text-color);
    color: var(--text-color);
    font-family: var(--font-main);
    transition: 0.3s;
}
.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 10px rgba(35, 134, 54, 0.2);
}
.error-msg { color: #ff7b72; font-size: 0.8rem; display: block; margin-top: 5px; height: 15px; }

footer {
    text-align: center;
    padding: 30px;
    border-top: 1px solid var(--primary-color);
    font-size: 0.9rem;
    background: rgba(13, 17, 23, 0.95);
}

/* --- Animations --- */
.fade-in { animation: fadeIn 1s ease-in; }
.fade-in-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.fade-in-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- Responsive --- */
@media (max-width: 768px) {
    .nav-links { display: none; } /* Simplified for this example */
    .contact-wrapper { grid-template-columns: 1fr; }
    .carousel-container { height: 700px; }
    .prev-btn { left: -15px; background: rgba(0,0,0,0.8); }
    .next-btn { right: -15px; background: rgba(0,0,0,0.8); }
    .section { padding: 60px 5%; }
    #typing-text { font-size: 1.5rem; }
    .terminal-body { padding: 20px; }
}