:root {
    --bg-dark: #0a0a0c;
    --matrix-green: #00FF41;
    --system-cyan: #00F7FF;
    --system-purple: #7000ff;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-highlight: rgba(255, 255, 255, 0.1);
    --pill-blue: #007bff;
    --pill-red: #ff4136;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: none;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    line-height: 1.6;
    scroll-behavior: smooth;
    background-image: radial-gradient(circle at 50% 50%, rgba(20, 20, 25, 1) 0%, rgba(10, 10, 12, 1) 100%);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--system-cyan);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--matrix-green);
}

canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* Custom Cursor */
#cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    border: 2px solid var(--system-cyan);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    will-change: transform;
    transition: width 0.3s, height 0.3s, border-color 0.3s, background-color 0.3s;
    mix-blend-mode: difference;
}

.cursor-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background: var(--system-cyan);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.cursor-ring {
    position: absolute;
    inset: -5px;
    border: 1px solid rgba(0, 247, 255, 0.3);
    border-radius: 50%;
    animation: cursorPulse 2s infinite;
}

@keyframes cursorPulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* CRT & Scanline Effects */
.crt-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
    background-size: 100% 4px, 3px 100%;
    z-index: 9998;
    pointer-events: none;
    opacity: 0.2;
}

.scanlines {
    position: fixed;
    inset: 0;
    background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.15) 50%);
    background-size: 100% 8px;
    z-index: 9997;
    pointer-events: none;
    opacity: 0.1;
    animation: scanlineMove 20s linear infinite;
}

@keyframes scanlineMove {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 0 100%;
    }
}

body.red-mode .crt-overlay {
    animation: flicker 0.15s infinite;
    opacity: 0.4;
}

@keyframes flicker {
    0% {
        opacity: 0.35;
    }

    5% {
        opacity: 0.4;
    }

    10% {
        opacity: 0.32;
    }

    15% {
        opacity: 0.4;
    }

    20% {
        opacity: 0.38;
    }

    25% {
        opacity: 0.34;
    }

    30% {
        opacity: 0.4;
    }

    100% {
        opacity: 0.37;
    }
}

/* Loader Styles */
.loader {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.loader-content {
    position: relative;
    z-index: 10;
    text-align: center;
}

.terminal-text {
    font-family: 'Fira Code', monospace;
    color: var(--matrix-green);
    font-size: 1.5rem;
    margin-bottom: 2rem;
    text-shadow: 0 0 10px var(--matrix-green);
}

.progress-bar-container {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: var(--matrix-green);
    box-shadow: 0 0 15px var(--matrix-green);
}

/* Navigation */
#main-nav {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1.5rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(20px);
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid var(--glass-border);
}

.nav-logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: 2px;
    color: var(--system-cyan);
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    margin-left: 2rem;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    transition: 0.3s;
    position: relative;
    opacity: 0.7;
}

.nav-links a:hover {
    color: var(--system-cyan);
    text-shadow: 0 0 8px var(--system-cyan);
    opacity: 1;
}

/* Sections */
.section {
    padding: 10rem 5%;
    min-height: 80vh;
    display: flex;
    align-items: center;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 4rem;
    color: var(--system-cyan);
    text-transform: uppercase;
    letter-spacing: 6px;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--system-cyan);
}

/* Holographic Glass Panel & Light Cycle Borders */
.glass-panel {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
    backdrop-filter: blur(40px) brightness(1.1);
    -webkit-backdrop-filter: blur(40px) brightness(1.1);
    border: 1px solid rgba(0, 247, 255, 0.15);
    /* Keep subtle border */
    padding: 3rem;
    border-radius: 4px;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

/* Subtle Background Light Gradient */
.glass-panel::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(0, 247, 255, 0.03), transparent 70%);
    opacity: 0;
    transform: translate(-50%, -50%);
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: 0;
}

.glass-panel:hover::after {
    opacity: 1;
    animation: lightDrift 10s infinite linear;
}

@keyframes lightDrift {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    100% {
        transform: translate(-20px, -20px) rotate(360deg);
    }
}

/* Noise Texture Overlay */
.glass-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    opacity: 0.15;
    pointer-events: none;
    mix-blend-mode: overlay;
    z-index: 0;
}

.glass-panel:hover {
    box-shadow:
        0 10px 50px 0 rgba(0, 247, 255, 0.2),
        inset 0 0 20px rgba(0, 247, 255, 0.05);
    transform: translateY(-2px);
    border-color: var(--system-cyan);
}

/* --- TRON LIGHT CYCLE BORDERS --- */
.tron-line {
    position: absolute;
    display: block;
    background: var(--system-cyan);
    box-shadow: 0 0 10px var(--system-cyan), 0 0 20px var(--system-cyan);
    z-index: 10;
}

/* Top Line */
.line-top {
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--system-cyan));
    animation: btn-anim1 2s linear infinite;
}

@keyframes btn-anim1 {
    0% {
        left: -100%;
    }

    50%,
    100% {
        left: 100%;
    }
}

/* Right Line */
.line-right {
    top: -100%;
    right: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, transparent, var(--system-cyan));
    animation: btn-anim2 2s linear infinite;
    animation-delay: 0.5s;
}

@keyframes btn-anim2 {
    0% {
        top: -100%;
    }

    50%,
    100% {
        top: 100%;
    }
}

/* Bottom Line */
.line-bottom {
    bottom: 0;
    right: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(270deg, transparent, var(--system-cyan));
    animation: btn-anim3 2s linear infinite;
    animation-delay: 1s;
}

@keyframes btn-anim3 {
    0% {
        right: -100%;
    }

    50%,
    100% {
        right: 100%;
    }
}

/* Left Line */
.line-left {
    bottom: -100%;
    left: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(360deg, transparent, var(--system-cyan));
    animation: btn-anim4 2s linear infinite;
    animation-delay: 1.5s;
}

@keyframes btn-anim4 {
    0% {
        bottom: -100%;
    }

    50%,
    100% {
        bottom: 100%;
    }
}

/* Red Mode Override for Lines */
body.red-mode .tron-line {
    background: var(--matrix-green);
    box-shadow: 0 0 10px var(--matrix-green);
}

body.red-mode .line-top {
    background: linear-gradient(90deg, transparent, var(--matrix-green));
}

body.red-mode .line-right {
    background: linear-gradient(180deg, transparent, var(--matrix-green));
}

body.red-mode .line-bottom {
    background: linear-gradient(270deg, transparent, var(--matrix-green));
}

body.red-mode .line-left {
    background: linear-gradient(360deg, transparent, var(--matrix-green));
}

/* Hero Section */
#hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.glitch-text {
    font-family: 'Outfit', sans-serif;
    font-size: 7rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    letter-spacing: -2px;
}

.tagline {
    font-family: 'Fira Code', monospace;
    font-size: 1.4rem;
    color: var(--system-cyan);
    margin-bottom: 2rem;
    min-height: 1.5em;
    opacity: 0.9;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 650px;
    margin: 0 auto 4rem;
    min-height: 3em;
}

.hero-actions .btn {
    opacity: 0;
    transform: translateY(20px);
    padding: 1rem 3rem;
    font-family: 'Fira Code', monospace;
    font-weight: 700;
    border: none;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0 1.5rem;
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    border-radius: 50px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.btn-blue {
    background: linear-gradient(135deg, #007bff 0%, #003060 100%);
    border-bottom: 4px solid #004080;
}

.btn-red {
    background: linear-gradient(135deg, #ff4136 0%, #801010 100%);
    border-bottom: 4px solid #801010;
}

.btn-blue:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 0 30px rgba(0, 123, 255, 0.6);
}

.btn-red:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 0 30px rgba(255, 65, 54, 0.6);
}

/* Grid Layouts */
.stack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
}

.stack-category h3 {
    font-family: 'Fira Code', monospace;
    color: var(--system-cyan);
    margin-bottom: 2rem;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.stack-list li {
    margin-bottom: 1rem;
    font-size: 1.05rem;
    opacity: 0.8;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 3rem;
}

.project-card h3 {
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
    color: var(--system-cyan);
}

/* CLI */
/* CLI */
#cli-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 450px;
    height: 350px;
    background: rgba(0, 5, 5, 0.95);
    border: 1px solid var(--system-cyan);
    z-index: 500;
    display: flex;
    flex-direction: column;
    font-family: 'Fira Code', monospace;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: 0 0 30px rgba(0, 247, 255, 0.2);
    box-shadow: 0 0 30px rgba(0, 247, 255, 0.2);
    overflow: hidden;
    /* Ensure rounded corners */
}

/* Terminal Code Blocks for Red Mode */
.terminal-code {
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    color: inherit;
    /* Inherit green/cyan */
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 4px;
    white-space: pre-wrap;
    /* Allow wrapping */
    border-left: 2px solid var(--system-cyan);
    margin-top: 0.5rem;
    overflow-x: auto;
}

body.red-mode .terminal-code {
    border-left-color: var(--matrix-green);
    background: rgba(0, 20, 0, 0.3);
    color: var(--matrix-green);
    text-shadow: 0 0 2px rgba(0, 255, 0, 0.4);
}

.stack-list li pre {
    margin: 0;
    padding: 0;
    background: none !important;
    border: none !important;
}

/* Contact Form Terminal Aesthetic */
.matrix-form .form-group {
    margin-bottom: 2rem;
}

.matrix-form label {
    display: block;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--system-cyan);
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

.matrix-form input,
.matrix-form textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 1rem;
    font-family: 'Fira Code', monospace;
    font-size: 1rem;
    transition: 0.3s;
    border-radius: 4px 4px 0 0;
}

.matrix-form textarea {
    min-height: 120px;
    resize: vertical;
}

.matrix-form input:focus,
.matrix-form textarea:focus {
    outline: none;
    border-bottom-color: var(--system-cyan);
    background: rgba(0, 247, 255, 0.05);
    box-shadow: 0 5px 15px -10px var(--system-cyan);
}

#cli-container.cli-minimized {
    height: 42px;
    width: 280px;
    /* Increased width to prevent text clipping */
}

.cli-header {
    background: var(--system-cyan);
    color: #000;
    padding: 0.7rem 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    font-size: 0.75rem;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
    /* Prevent wrapping */
}

/* Fix Flex Body to allow scrolling */
.cli-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Container for scrollable area */
    padding: 1rem;
}

#cli-output {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-bottom: 1rem;
    max-height: 100%;
}

.cli-input-line {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    border-top: 1px solid rgba(0, 247, 255, 0.2);
    padding-top: 0.5rem;
}

#cli-input {
    background: none;
    border: none;
    color: #fff;
    outline: none;
    flex: 1;
    font-family: 'Fira Code', monospace;
}

/* Author Widget (Bottom Left) */
#author-widget {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    width: 280px;
    padding: 1.5rem;
    z-index: 400;
    transform: translateY(0);
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    background: rgba(0, 5, 5, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
}

#author-widget:hover {
    border-color: var(--system-cyan);
    transform: translateY(-5px);
    box-shadow: 0 0 20px rgba(0, 247, 255, 0.15);
}

.widget-header {
    font-family: 'Fira Code', monospace;
    color: var(--system-cyan);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
}

#author-widget p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.glitch-link {
    display: inline-block;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 247, 255, 0.1);
    border: 1px solid var(--system-cyan);
    transition: 0.3s;
}

.glitch-link:hover {
    background: var(--system-cyan);
    color: #000;
    box-shadow: 0 0 15px var(--system-cyan);
}

/* TRON Border Effect */

/* Tron Disk Shockwave */
.disk-shockwave {
    position: fixed;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    background: radial-gradient(circle, rgba(0, 247, 255, 0.8) 0%, transparent 60%);
    border: 2px solid var(--system-cyan);
    box-shadow: 0 0 20px var(--system-cyan), inset 0 0 20px var(--system-cyan);
    z-index: 99999;
    animation: diskImpact 0.6s ease-out forwards;
}

@keyframes diskImpact {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
        border-width: 5px;
    }

    100% {
        width: 400px;
        height: 400px;
        opacity: 0;
        border-width: 0;
    }
}

#cli-container.cli-minimized {
    height: 42px;
    width: 240px;
}

.cli-header {
    background: var(--system-cyan);
    color: #000;
    padding: 0.7rem 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    font-size: 0.75rem;
}

#cli-input {
    background: none;
    border: none;
    color: #fff;
    outline: none;
}

/* Animations */
.reveal-text {
    visibility: hidden;
    opacity: 0;
}

/* Red Mode overrides */
body.red-mode {
    --system-cyan: var(--matrix-green);
    --system-purple: #008000;
}

/* Responsiveness */
@media (max-width: 1024px) {
    .glitch-text {
        font-size: 5rem;
    }
}

@media (max-width: 768px) {
    #cursor {
        display: none !important;
    }

    * {
        cursor: auto !important;
    }

    #main-nav .nav-links {
        display: none;
    }

    .glitch-text {
        font-size: 3rem;
    }

    .hero-actions {
        flex-direction: column;
        gap: 1rem;
    }

    .hero-actions .btn {
        width: 100%;
        max-width: 300px;
        margin: 0;
    }

    .section {
        padding: 6rem 5%;
    }

    .section-title {
        font-size: 2.22rem;
    }

    .stack-grid,
    .projects-grid {
        grid-template-columns: 1fr;
    }

    /* Stack fixed widgets on mobile */
    #cli-container {
        width: calc(100% - 2rem);
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        z-index: 500;
    }

    #author-widget {
        width: calc(100% - 2rem);
        left: 1rem;
        right: 1rem;
        bottom: 4rem;
        /* Stack above minimized CLI (42px + gap) */
        padding: 1rem;
        z-index: 490;
    }

    /* Adjust Author Widget layout for mobile */
    #author-widget p {
        display: none;
        /* Hide description to save space */
    }

    .widget-header {
        display: inline-block;
        margin-right: 1rem;
        margin-bottom: 0;
        border: none;
    }

    #author-console-link {
        font-size: 0.7rem;
        padding: 0.3rem 0.8rem;
    }
}