:root {
    --bg-color: #0a0a0a;
    --text-color: #e0e0e0;
    --accent-green: #00ff41;
    --accent-blue: #00f3ff;
    --font-main: 'Inter', 'Roboto', sans-serif;
    --font-mono: 'Fira Code', 'Courier New', monospace;
    --card-bg: #111;
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-green) var(--bg-color);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 2px;
}

a {
    color: var(--accent-green);
    text-decoration: none;
    transition: color var(--transition-speed);
}

a:hover {
    color: var(--accent-blue);
    text-shadow: 0 0 8px var(--accent-blue);
}

/* --- Utilities --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.mono {
    font-family: var(--font-mono);
}

.text-green {
    color: var(--accent-green);
}

.text-blue {
    color: var(--accent-blue);
}

.hero-logo {
    display: block;
    margin: 0 auto 1.5rem auto;
    max-width: 300px;
    height: auto;
    filter: drop-shadow(0 0 10px rgba(0, 255, 65, 0.5));
    animation: float-glow 6s ease-in-out infinite;
}

@keyframes float-glow {

    0%,
    100% {
        transform: translateY(0);
        filter: drop-shadow(0 0 10px rgba(0, 255, 65, 0.5));
    }

    50% {
        transform: translateY(-15px);
        filter: drop-shadow(0 0 20px rgba(0, 243, 255, 0.6));
    }
}

footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
    border-top: 1px solid #333;
    color: #666;
    font-size: 0.8rem;
    font-family: var(--font-mono);
}

.footer-logo {
    height: 40px;
    width: auto;
    margin-bottom: 0.5rem;
    opacity: 0.7;
    transition: opacity var(--transition-speed);
}

.footer-logo:hover {
    opacity: 1;
}

/* --- Navigation --- */
nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(5px);
    border-bottom: 1px solid var(--accent-green);
    z-index: 1000;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-green);
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-green);
    transition: width var(--transition-speed);
}

.nav-links a:hover::after {
    width: 100%;
}

/* --- Boot Screen --- */
#boot-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9999;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    font-family: var(--font-mono);
    color: var(--accent-green);
    font-size: 0.9rem;
    pointer-events: none;
    /* Allow clicks to pass through if JS fails to hide it, though opacity will be 0 */
    transition: opacity 0.5s ease-out;
}

.boot-log {
    overflow: hidden;
    white-space: pre-wrap;
    line-height: 1.4;
}

/* --- Glitch Effect --- */
.glitch {
    position: relative;
    display: inline-block;
}

.glitch:hover {
    animation: glitch-anim 0.3s cubic-bezier(.25, .46, .45, .94) both infinite;
    color: var(--accent-green);
}

@keyframes glitch-anim {
    0% {
        transform: translate(0)
    }

    20% {
        transform: translate(-2px, 2px)
    }

    40% {
        transform: translate(-2px, -2px)
    }

    60% {
        transform: translate(2px, 2px)
    }

    80% {
        transform: translate(2px, -2px)
    }

    100% {
        transform: translate(0)
    }
}

/* --- Hero Section (Index) --- */
#hero {
    height: 100vh;
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

canvas#network-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    background: rgba(10, 10, 10, 0.7);
    padding: 2rem;
    border: none;
    backdrop-filter: blur(3px);
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    text-shadow: 0 0 10px var(--accent-green);
}

.hero-content h2 {
    font-size: 1.5rem;
    color: var(--accent-blue);
    min-height: 1.6em;
    /* Prevent layout shift */
    margin-bottom: 2rem;
}

.cta-button {
    display: inline-block;
    padding: 1rem 2rem;
    font-family: var(--font-mono);
    font-size: 1.2rem;
    color: var(--bg-color);
    background: var(--accent-green);
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: bold;
    box-shadow: 0 0 15px var(--accent-green);
    transition: all var(--transition-speed);
}

.cta-button:hover {
    background: var(--bg-color);
    color: var(--accent-green);
    box-shadow: 0 0 25px var(--accent-green), inset 0 0 0 2px var(--accent-green);
}

/* --- Projects (Tech Stack Layout) --- */
.project-stack {
    display: flex;
    flex-direction: column;
    gap: 4rem;
    position: relative;
    padding: 2rem 0;
}

/* Central Timeline Line */
.project-stack::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: linear-gradient(180deg,
            transparent 0%,
            var(--accent-green) 15%,
            var(--accent-blue) 85%,
            transparent 100%);
    opacity: 0.3;
    z-index: -1;
}

.project-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4rem;
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.project-item:nth-child(even) {
    flex-direction: row-reverse;
}

/* Connectors to Central Line */
.project-item::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: var(--bg-color);
    border: 2px solid var(--accent-green);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-green);
    z-index: 1;
}

.project-visual {
    flex: 1;
    background: rgba(10, 20, 15, 0.6);
    border: 1px solid var(--accent-green);
    padding: 2rem;
    position: relative;
    overflow: hidden;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    transition: transform var(--transition-speed), border-color var(--transition-speed);
}

.project-visual:hover {
    transform: scale(1.02);
    border-color: var(--accent-blue);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.2);
}

.project-icon {
    font-size: 5rem;
    opacity: 0.8;
    filter: drop-shadow(0 0 15px var(--accent-green));
}

.project-content {
    flex: 1;
    padding: 1.5rem;
    background: rgba(10, 10, 10, 0.8);
    border-left: 3px solid var(--accent-blue);
    /* Default side */
}

.project-item:nth-child(even) .project-content {
    border-left: none;
    border-right: 3px solid var(--accent-blue);
    text-align: right;
}

.project-title {
    font-family: var(--font-mono);
    font-size: 1.8rem;
    color: var(--accent-blue);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 5px rgba(0, 243, 255, 0.5);
}

.project-tagline {
    font-size: 1rem;
    color: #aaa;
    margin-bottom: 1rem;
    font-style: italic;
    border-bottom: 1px dashed #333;
    padding-bottom: 0.5rem;
    display: inline-block;
}

.project-desc {
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

/* Stagger Animations */
.project-item:nth-child(1) {
    animation-delay: 0.2s;
}

.project-item:nth-child(2) {
    animation-delay: 0.4s;
}

.project-item:nth-child(3) {
    animation-delay: 0.6s;
}

.project-item:nth-child(4) {
    animation-delay: 0.8s;
}

.project-item:nth-child(5) {
    animation-delay: 1.0s;
}

.project-item:nth-child(6) {
    animation-delay: 1.2s;
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
    background: rgba(0, 243, 255, 0.05);
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- About (The Kernel) --- */
.about-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    padding-top: 6rem;
}

.bio-terminal {
    background: #000;
    border: 1px solid #333;
    padding: 1.5rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    color: var(--accent-green);
    margin-bottom: 2rem;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
}

.timeline {
    position: relative;
    border-left: 2px solid #333;
    padding-left: 2rem;
}

.timeline-node {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-node::before {
    content: '';
    position: absolute;
    left: -2.6rem;
    top: 0.25rem;
    width: 1rem;
    height: 1rem;
    background: var(--bg-color);
    border: 2px solid var(--accent-green);
    border-radius: 50%;
}

.timeline-node:hover::before {
    background: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
}

.skill-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    align-content: flex-start;
}

.hex-skill {
    position: relative;
    width: 100px;
    height: 57.74px;
    background-color: #1a1a1a;
    margin: 28.87px 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-blue);
    transition: all var(--transition-speed);
    cursor: default;
}

.hex-skill:before,
.hex-skill:after {
    content: "";
    position: absolute;
    width: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
}

.hex-skill:before {
    bottom: 100%;
    border-bottom: 28.87px solid #1a1a1a;
}

.hex-skill:after {
    top: 100%;
    width: 0;
    border-top: 28.87px solid #1a1a1a;
}

.hex-skill:hover {
    background-color: var(--accent-blue);
    color: var(--bg-color);
    transform: scale(1.1);
    z-index: 10;
}

.hex-skill:hover:before {
    border-bottom-color: var(--accent-blue);
}

.hex-skill:hover:after {
    border-top-color: var(--accent-blue);
}

/* --- Contact (Secure Comms) --- */
.contact-container {
    padding-top: 6rem;
    max-width: 800px;
    margin: 0 auto;
}

.cli-form {
    background: #000;
    padding: 2rem;
    border: 1px solid #333;
    font-family: var(--font-mono);
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    color: var(--accent-green);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 2px solid #333;
    color: var(--text-color);
    font-family: var(--font-mono);
    padding: 0.5rem 0;
    font-size: 1rem;
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
    border-bottom-color: var(--accent-green);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.submit-btn {
    background: transparent;
    border: 2px solid var(--accent-green);
    color: var(--accent-green);
    padding: 1rem 2rem;
    font-family: var(--font-mono);
    font-size: 1rem;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition-speed);
    width: 100%;
}

.submit-btn:hover {
    background: var(--accent-green);
    color: var(--bg-color);
    box-shadow: 0 0 15px var(--accent-green);
}

/* --- Mobile Navigation --- */
.hamburger {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    z-index: 1001;
}

.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--accent-green);
    transition: all 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {

    /* Navigation */
    .hamburger {
        display: flex;
    }

    .nav-links {
        position: fixed;
        right: 0;
        top: 0;
        height: 100vh;
        width: 70%;
        background: rgba(10, 10, 10, 0.95);
        backdrop-filter: blur(10px);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        transform: translateX(100%);
        transition: transform 0.4s ease-in-out;
        z-index: 1000;
        border-left: 1px solid var(--accent-green);
    }

    .nav-links.nav-active {
        transform: translateX(0%);
    }

    .nav-links li {
        opacity: 0;
        transition: opacity 0.5s ease 0.2s;
    }

    .nav-active li {
        opacity: 1;
    }

    /* Hamburger Animation */
    .toggle .line1 {
        transform: rotate(-45deg) translate(-5px, 6px);
    }

    .toggle .line2 {
        opacity: 0;
    }

    .toggle .line3 {
        transform: rotate(45deg) translate(-5px, -6px);
    }

    /* Layout Adjustments */
    .container {
        padding: 1.5rem;
    }

    .about-layout {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .timeline {
        margin-left: 1rem;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-content h2 {
        font-size: 1.2rem;
    }

    .project-stack::before {
        left: 20px;
    }

    .project-item {
        flex-direction: column !important;
        /* Always stack vertical */
        align-items: flex-start;
        gap: 1.5rem;
        padding-left: 3rem;
        /* Make room for line */
        margin-bottom: 3rem;
    }

    .project-item::after {
        left: 20px;
        /* Align dot to line */
        top: 2rem;
        /* Align to top visual or title */
    }

    .project-visual {
        width: 100%;
        min-height: 200px;
    }

    .project-content {
        width: 100%;
        text-align: left !important;
        border-right: none !important;
        border-left: 3px solid var(--accent-blue) !important;
    }

    .contact-container {
        padding-top: 5rem;
    }

    .skill-cluster {
        margin-top: 2rem;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.2rem;
    }

    .hero-content h1 {
        font-size: 1.8rem;
    }

    .cta-button {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
}

/* --- Accessibility Features --- */
.a11y-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--accent-green);
    border-radius: 50%;
    color: var(--accent-green);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.5);
    transition: all 0.3s ease;
}

.a11y-btn:hover,
.a11y-btn:focus {
    background: var(--accent-green);
    color: #000;
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.8);
    outline: none;
}

.a11y-menu {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid var(--accent-green);
    padding: 1rem;
    border-radius: 8px;
    display: none;
    /* Toggled via JS */
    flex-direction: column;
    gap: 0.8rem;
    z-index: 9998;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    min-width: 150px;
}

.a11y-menu.active {
    display: flex;
    animation: fadeInUp 0.3s ease-out;
}

.a11y-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-color);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    gap: 1rem;
}

.a11y-toggle-btn {
    background: #222;
    border: 1px solid #444;
    color: #fff;
    padding: 0.2rem 0.6rem;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.a11y-toggle-btn:hover {
    background: var(--accent-green);
    color: #000;
}

/* Accessibility Modes */
body.font-large {
    font-size: 18px;
    /* Base increase */
}

body.font-large h1 {
    font-size: 3.5rem;
}

body.font-large h2 {
    font-size: 2rem;
}

body.font-large p {
    font-size: 1.2rem;
    line-height: 1.8;
}

body.font-xl {
    font-size: 20px;
    /* Large increase */
    line-height: 1.9;
}

body.font-xl h1 {
    font-size: 4rem;
}

body.font-xl h2 {
    font-size: 2.5rem;
}


/* High Contrast Mode */
body.high-contrast {
    --bg-color: #000 !important;
    --text-color: #fff !important;
    --accent-green: #ffeb3b !important;
    /* Yellow */
    --accent-blue: #00ffff !important;
    /* Cyan */
    background-color: #000 !important;
    color: #fff !important;
}

body.high-contrast a {
    color: #ffeb3b !important;
    text-decoration: underline;
}

body.high-contrast .a11y-btn {
    border-color: #fff !important;
    background: #000 !important;
    color: #fff !important;
}

body.high-contrast .a11y-btn:hover,
body.high-contrast .a11y-btn:focus {
    background: #fff !important;
    color: #000 !important;
}

body.high-contrast .a11y-menu {
    background: #000 !important;
    border: 2px solid #fff !important;
}

body.high-contrast .a11y-toggle-btn {
    border: 2px solid #fff !important;
    background: #000 !important;
    color: #fff !important;
}

body.high-contrast .a11y-toggle-btn:hover,
body.high-contrast .a11y-toggle-btn:focus {
    background: #fff !important;
    color: #000 !important;
}

/* Specific override for the anchor tag CTA button */
body.high-contrast a.cta-button {
    background-color: #ffeb3b !important;
    color: #000000 !important;
    border: 2px solid #ffffff !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

body.high-contrast a.cta-button:hover,
body.high-contrast a.cta-button:focus {
    background-color: #000000 !important;
    color: #ffeb3b !important;
    border-color: #ffeb3b !important;
}