:root {
    --bg-color: #0d1117;
    --card-bg: rgba(22, 27, 34, 0.7);
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --accent-primary: #58a6ff;
    /* Blue */
    --accent-secondary: #ffa657;
    /* Orange */
    --accent-tertiary: #7ee787;
    /* Green */
    --accent-glow: rgba(88, 166, 255, 0.3);
    --glass-border: rgba(48, 54, 61, 0.8);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Space Grotesk', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow-x: hidden;
    line-height: 1.6;
}

html {
    scroll-behavior: auto;
    /* Disable native smooth scroll for our custom engine */
}

/* --- Smooth Scroll Engine --- */
html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    /* Hide native scrollbar */
}

/* Mobile Scroll Reset */
@media (max-width: 768px) {

    html,
    body {
        overflow-y: auto !important;
        height: auto !important;
    }

    #smooth-wrapper {
        position: relative !important;
        height: auto !important;
    }
}

#smooth-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
    /* Behind navbar but contains content */
}

#smooth-content {
    position: relative;
    width: 100%;
    will-change: transform;
    /* Hardware acceleration */
}

/* Adjust navbar to be fixed properly outside the scroll flow context */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

/* --- Particle Canvas Background --- */
#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    opacity: 0.6;
}

/* --- Typography --- */
h1,
h2,
h3 {
    font-family: var(--font-heading);
    font-weight: 700;
}

h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}


.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 3rem;
}


/* --- Layout Utilities --- */
section {
    padding: 5rem 10%;
    min-height: 80vh;
    /* Default min-height for sections */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* --- Background Glow --- */
.cursor-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    transform: translate(-50%, -50%);
    transition: left 0.1s ease, top 0.1s ease;
}

/* --- Navbar --- */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 0.8rem 10%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(13, 17, 23, 0.9);
    backdrop-filter: blur(12px);
    z-index: 1000;
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: 1px;
}

.logo .highlight {
    color: var(--accent-primary);
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--text-primary);
}

.cta-btn {
    background: var(--text-primary);
    color: var(--bg-color) !important;
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    font-weight: 700 !important;
    transition: transform 0.3s !important;
}

.cta-btn:hover {
    transform: scale(1.05);
}

/* --- Hero Section --- */
.hero-section {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: 100vh;
    padding-top: 80px;
}

.hero-content {
    flex: 1;
    max-width: 800px;
    background: rgba(22, 27, 34, 0.6);
    padding: 2.5rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(15px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    margin: 0 auto;
}

.code-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.red {
    background: #ff5f56;
}

.dot.yellow {
    background: #ffbd2e;
}

.dot.green {
    background: #27c93f;
}

.file-name {
    margin-left: 10px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.code-container {
    min-height: 140px;
    margin-bottom: 0.5rem;
    /* Reduced specific spacing */
    display: flex;
    align-items: flex-start;
}

.typewriter-target {
    font-family: var(--font-mono) !important;
    font-size: 2.2rem;
    color: var(--text-primary);
    line-height: 1.3;
    word-break: break-word;
    margin: 0;
    margin-bottom: 2rem;
    /* Added space before description */
}

/* Syntax Highlighting Classes (Added via JS) */
.syntax-keyword {
    color: var(--accent-primary);
}

.syntax-string {
    color: var(--accent-secondary);
}

.syntax-function {
    color: var(--accent-tertiary);
}

.syntax-comment {
    color: var(--text-secondary);
    font-style: italic;
}

.hero-visual {
    flex: 1;
    position: relative;
    height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.glowing-orb {
    position: absolute;
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: pulse 4s infinite alternate;
}

/* --- Minimalist Buttons --- */
.minimal-btn {
    position: relative;
    padding: 1rem 2.5rem;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    border: 1px solid var(--accent-primary);
    background: transparent;
    transition: color 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    overflow: hidden;
    z-index: 1;
}

.minimal-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: var(--accent-primary);
    transition: width 0.4s cubic-bezier(0.19, 1, 0.22, 1), height 0.4s cubic-bezier(0.19, 1, 0.22, 1), top 0.4s cubic-bezier(0.19, 1, 0.22, 1), left 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: -1;
}

.minimal-btn:hover {
    color: var(--bg-color);
    border-color: transparent;
    /* "Delete the line" */
}

.minimal-btn:hover::before {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.minimal-btn.secondary {
    border-color: var(--glass-border);
}

.minimal-btn.secondary::before {
    background: var(--text-primary);
}

.minimal-btn.secondary:hover {
    color: var(--bg-color);
}

/* --- Typewriter --- */
.typewriter-target::after {
    content: '|';
    animation: blink 0.8s infinite;
    color: var(--accent-primary);
    margin-left: 5px;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* --- Interactive Elements --- */
.glass-card {
    position: absolute;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    width: 200px;
    color: white;
}

.glass-card:nth-child(2) {
    top: 20%;
    right: 10%;
    transform: rotate(5deg);
}

.glass-card:nth-child(3) {
    bottom: 20%;
    left: 10%;
    transform: rotate(-5deg);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.glass-card h3 {
    font-size: 1.1rem;
}

.glass-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* --- Services --- */
/* --- Services Redesign --- */
.services-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.service-code-block {
    background: rgba(13, 17, 23, 0.4);
    border-left: 2px solid var(--glass-border);
    padding: 1.5rem;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    line-height: 1.6;
    transition: all 0.3s ease;
    cursor: default;
}

.service-code-block:hover {
    border-left-color: var(--accent-primary);
    background: rgba(13, 17, 23, 0.8);
    transform: translateX(10px);
}

.line-number {
    display: block;
    color: var(--glass-border);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    user-select: none;
}

.code-line {
    display: block;
    color: var(--text-secondary);
}

.code-content {
    display: block;
    margin-left: 1.5rem;
    color: var(--text-primary);
}

.keyword {
    color: #ff7b72;
}

.function {
    color: #d2a8ff;
}

.string {
    color: #a5d6ff;
}

.comment {
    color: #8b949e;
    font-style: italic;
}

.variable {
    color: #79c0ff;
}

.boolean {
    color: #79c0ff;
}

.this {
    color: #ff7b72;
}

.class-name {
    color: #ffa657;
}

/* --- Portfolio --- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2.5rem;
    perspective: 1000px;
}

.project-card {
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    transition: transform 0.1s ease-out;
    /* Fast/No transition for mouse follow */
    transform-style: preserve-3d;
    will-change: transform;
}

.project-card:hover {
    /* Transform handled by JS */
    z-index: 10;
    /* Bring to front */
}

.project-image {
    height: 250px;
    width: 100%;
}

/* Dynamic Gradients for Placeholders */
.placeholder-gradient-1 {
    background: linear-gradient(45deg, #2D3436, #000000);
}

.placeholder-gradient-2 {
    background: linear-gradient(45deg, #1A1A2E, #16213E);
}

.placeholder-gradient-3 {
    background: linear-gradient(45deg, #141E30, #243B55);
}

.project-info {
    padding: 1.5rem;
}

.project-info h3 {
    margin-bottom: 0.5rem;
}

.project-info p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.view-project {
    color: var(--accent-secondary);
    text-decoration: none;
    font-weight: 600;
    transition: gap 0.2s;
}

/* --- Contact --- */
.contact-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.glass-panel {
    background: var(--card-bg);
    padding: 3rem;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.input-group input:focus,
.input-group textarea:focus {
    border-color: var(--accent-primary);
}

.submit-btn {
    background: white;
    color: black;
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: background 0.3s;
}

.submit-btn:hover {
    background: var(--text-secondary);
}

/* --- Footer --- */
footer {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid var(--glass-border);
    font-size: 0.9rem;
}

/* --- Animations --- */
.fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s forwards;
}

.delay-1 {
    animation-delay: 0.2s;
}

.delay-2 {
    animation-delay: 0.4s;
}

.delay-3 {
    animation-delay: 0.6s;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Split Text Reveal Animation --- */
.split-line {
    overflow: hidden;
    display: block;
}

.reveal-char {
    display: inline-block;
    opacity: 0;
    transform: translateY(100%) rotateX(-90deg);
    /* Start below and rotated */
    transform-origin: bottom center;
    transition: transform 0.8s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.8s ease;
}

.visible .reveal-char {
    opacity: 1;
    transform: translateY(0) rotateX(0deg);
}

.reveal-text.visible {
    /* Container itself just needs to be visible */
    opacity: 1 !important;
    transform: none !important;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.4;
    }

    100% {
        transform: scale(1.1);
        opacity: 0.6;
    }
}

.float {
    animation: float 6s ease-in-out infinite;
}

.delay-float {
    animation-delay: 3s;
}

@keyframes float {
    0% {
        transform: translateY(0) rotate(5deg);
    }

    50% {
        transform: translateY(-20px) rotate(5deg);
    }

    100% {
        transform: translateY(0) rotate(5deg);
    }
}

/* --- Responsive --- */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    z-index: 1001;
}

.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background: white;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Navigation */
.nav-links.mobile-active {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    width: 70%;
    height: 100vh;
    background: rgba(5, 5, 8, 0.98);
    backdrop-filter: blur(20px);
    padding: 6rem 2rem 2rem;
    gap: 2rem;
    border-left: 1px solid var(--glass-border);
    animation: slideIn 0.3s ease;
    z-index: 1000;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    section {
        padding: 3rem 5%;
    }

    h1 {
        font-size: 2.2rem;
    }

    h2 {
        font-size: 1.8rem;
    }

    .navbar {
        padding: 1rem 5%;
    }

    .hamburger {
        display: flex;
    }

    .nav-links {
        display: none;
    }

    .hero-section {
        flex-direction: column;
        text-align: center;
        padding-top: 120px;
        min-height: auto;
    }

    .hero-content {
        max-width: 100%;
    }

    .hero-buttons {
        justify-content: center;
        flex-direction: column;
        align-items: stretch;
    }

    .hero-buttons a {
        text-align: center;
    }

    .hero-visual {
        width: 100%;
        margin-top: 3rem;
        height: 350px;
    }

    .glass-card {
        width: 150px;
        padding: 1rem;
        font-size: 0.85rem;
    }

    .services-grid {
        grid-template-columns: 1fr;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .contact-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .glass-panel {
        padding: 2rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .hero-visual {
        height: 250px;
    }

    .glass-card {
        display: none;
    }

    .primary-btn,
    .secondary-btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
}