:root {
    --bg-color: #020617;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --accent-cyan: #38bdf8;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --glass-bg: rgba(255, 255, 255, 0.02);
    --glass-border: rgba(255, 255, 255, 0.08);
    --gradient-primary: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
    --gradient-glow: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
}

/* AI Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #020617;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 1s ease, visibility 1s;
}

.loader-container {
    width: 300px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

#cv-hud {
    position: fixed;
    top: 100px;
    left: 2rem;
    z-index: 1000;
    font-family: 'Courier New', Courier, monospace;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.hud-item {
    background: rgba(34, 211, 238, 0.05);
    border-left: 2px solid var(--accent-cyan);
    padding: 0.4rem 1rem;
    backdrop-filter: blur(4px);
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.hud-label {
    color: var(--text-secondary);
}

.hud-val {
    color: var(--accent-cyan);
    font-weight: bold;
}


.loader-bar {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    animation: loaderLoading 2s infinite ease-in-out;
}

@keyframes loaderLoading {
    0% {
        left: -100%;
    }

    50% {
        left: 0%;
    }

    100% {
        left: 100%;
    }
}

.loader-text {
    font-family: monospace;
    color: var(--accent-cyan);
    font-size: 0.9rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

#preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    background-color: var(--bg-color);
    scroll-padding-top: 100px;
    /* Precise landing for sticky nav */
}

body {
    font-family: var(--font-main);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* 3D Background Canvas */
#background-3d {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.6;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

/* Computer Vision Scanline Effect */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.15) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.01), rgba(0, 255, 0, 0.005), rgba(0, 0, 255, 0.01));
    background-size: 100% 4px, 3px 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.2;
}

/* Technical Grid Background */
.tech-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 2px 2px, rgba(255, 255, 255, 0.05) 1px, transparent 0);
    background-size: 40px 40px;
    z-index: -2;
    pointer-events: none;
}

/* Targeting Reticle - Advanced CV Version */
#reticle {
    position: fixed;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(34, 211, 238, 0.4);
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%);
    transition: width 0.3s cubic-bezier(0.19, 1, 0.22, 1), height 0.3s cubic-bezier(0.19, 1, 0.22, 1), border-color 0.3s;
    mix-blend-mode: screen;
    display: none;
    background: rgba(34, 211, 238, 0.02);
}

#reticle::before,
#reticle::after,
#reticle-top-right,
#reticle-bottom-left {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-color: var(--accent-cyan);
    border-style: solid;
    transition: all 0.3s ease;
}

/* Corner Markers */
#reticle::before {
    top: -2px;
    left: -2px;
    border-width: 2px 0 0 2px;
}

/* Top Left */
#reticle-top-right {
    top: -2px;
    right: -2px;
    border-width: 2px 2px 0 0;
    border-style: solid;
    border-color: var(--accent-cyan);
    position: absolute;
    width: 10px;
    height: 10px;
}

/* Top Right */
#reticle-bottom-left {
    bottom: -2px;
    left: -2px;
    border-width: 0 0 2px 2px;
    border-style: solid;
    border-color: var(--accent-cyan);
    position: absolute;
    width: 10px;
    height: 10px;
}

/* Bottom Left */
#reticle::after {
    bottom: -2px;
    right: -2px;
    border-width: 0 2px 2px 0;
}

/* Bottom Right */

/* Bottom Right */

/* Dynamic Scanning Line */
#reticle .scan-line {
    position: absolute;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
    top: 0;
    left: 0;
    animation: reticleScan 2s linear infinite;
    opacity: 0;
}

@keyframes reticleScan {
    0% {
        top: 0%;
        opacity: 0;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        top: 100%;
        opacity: 0;
    }
}

#reticle.active {
    border-color: var(--accent-cyan);
    background: rgba(34, 211, 238, 0.08);
    box-shadow: 0 0 20px rgba(34, 211, 238, 0.1);
}

#reticle.active .scan-line {
    opacity: 1;
}

/* Detection ID Label */
.reticle-id-label {
    position: absolute;
    top: -24px;
    left: -1px;
    background: var(--accent-cyan);
    color: #000;
    font-family: monospace;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 8px;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(5px);
    transition: all 0.3s ease;
    pointer-events: none;
    display: none;
}

#reticle.active .reticle-id-label {
    opacity: 1;
    transform: translateY(0);
    display: block;
}

/* Detection Boxes */
.detection-box {
    position: fixed;
    border: 1px solid var(--accent-cyan);
    background: rgba(34, 211, 238, 0.05);
    pointer-events: none;
    z-index: -1;
    opacity: 0;
}

.detection-label {
    position: absolute;
    top: -20px;
    left: -1px;
    background: var(--accent-cyan);
    color: #000;
    font-family: monospace;
    font-size: 10px;
    padding: 2px 5px;
    white-space: nowrap;
}

/* Background Glows */
.bg-glow {
    position: fixed;
    width: 1000px;
    height: 1000px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, rgba(5, 7, 10, 0) 70%);
    top: -400px;
    right: -300px;
    z-index: -1;
    pointer-events: none;
    animation: pulseGlow 15s infinite alternate;
}

.bg-glow-bottom {
    position: fixed;
    width: 1200px;
    height: 1200px;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.04) 0%, rgba(5, 7, 10, 0) 70%);
    bottom: -500px;
    left: -400px;
    z-index: -1;
    pointer-events: none;
    animation: pulseGlow 20s infinite alternate-reverse;
}

@keyframes pulseGlow {
    from {
        transform: scale(1);
        opacity: 0.5;
    }

    to {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 8s infinite linear;
    background-size: 200% auto;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

section {
    padding: 100px 0;
    min-height: 100vh;
    /* Total Isolation: One section per viewport */
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: var(--gradient-glow);
    transition: left 0.5s ease;
}

.glass-card:hover {
    border-color: rgba(34, 211, 238, 0.5);
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(34, 211, 238, 0.1);
}

.glass-card:hover::before {
    left: 100%;
}

.hero {
    padding: 0;
    min-height: 100vh;
    height: 100vh;
    display: flex;
    align-items: center;
    scroll-snap-align: start;
    /* Snap point */
    overflow: hidden;
}

.hero-title {
    font-size: 5.5rem;
    line-height: 1.1;
    margin-bottom: 2.5rem;
    position: relative;
    display: inline-block;
}

.hero-title .gradient-text {
    position: relative;
    z-index: 2;
}

/* AI Glitch Scan Effect */
.hero-title::after {
    content: "Engineering Intelligent Vision for the Real World";
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    color: rgba(34, 211, 238, 0.4);
    overflow: hidden;
    white-space: nowrap;
    border-right: 4px solid var(--accent-cyan);
    animation: glitchScan 4s infinite cubic-bezier(.74, .06, .4, .92);
    z-index: 1;
    filter: blur(5px);
}

@keyframes glitchScan {
    0% {
        width: 0;
        left: 0;
    }

    40% {
        width: 100%;
        left: 0;
    }

    60% {
        width: 100%;
        left: 0;
    }

    100% {
        width: 0;
        left: 100%;
    }
}

/* Floating Animation */
.hero-content {
    animation: digitalFloat 6s ease-in-out infinite;
}

@keyframes digitalFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    max-width: 900px;
    margin-bottom: 4rem;
}

.timeline {
    position: relative;
    padding-left: 3rem;
    border-left: 2px solid var(--glass-border);
}

.experience-item {
    position: relative;
    margin-bottom: 5rem;
}

.experience-item::before {
    content: '';
    position: absolute;
    left: -3.45rem;
    top: 0.5rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-cyan);
    box-shadow: 0 0 15px var(--accent-cyan);
    border: 3px solid var(--bg-color);
}

.experience-item h3 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.experience-item .company {
    color: var(--accent-cyan);
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: block;
    font-size: 1.1rem;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 2.5rem;
}

.project-card {
    padding: 3rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.project-tag {
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 100px;
    margin-right: 0.6rem;
    color: var(--accent-cyan);
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.blog-card {
    padding: 2rem;
    text-decoration: none;
    color: inherit;
}

.blog-date {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: block;
}

nav {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 2rem 0;
    z-index: 1000;
    transition: all 0.4s ease;
}

nav.scrolled {
    background: rgba(3, 5, 8, 0.85);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1.2rem 0;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: -1px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-block;
}

.logo:hover {
    transform: scale(1.05);
    text-shadow: 0 0 15px rgba(34, 211, 238, 0.4);
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-left: 2.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.nav-links a:hover {
    color: var(--text-primary);
    text-shadow: 0 0 10px var(--accent-cyan);
}

/* Section Activation Pulse */
section {
    transition: background-color 0.8s ease;
}

.section-active-pulse {
    animation: sectionPulse 1s ease-out;
}

@keyframes sectionPulse {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }

    50% {
        transform: scale(1.005);
        filter: brightness(1.2);
    }

    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal.active .skill-progress {
    width: var(--percent);
}

.btn-primary {
    background: var(--gradient-primary);
    color: #ffffff !important;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 800;
    font-size: 0.95rem;
    display: inline-block;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 20px rgba(34, 211, 238, 0.2);
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 30px rgba(34, 211, 238, 0.4), 0 0 20px rgba(34, 211, 238, 0.2);
    opacity: 1;
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 3.5rem;
    }

    .nav-links {
        display: none;
    }

    .grid-2 {
        grid-template-columns: 1fr !important;
    }
}

/* Refined Footer (Work Together) */
.footer-wrap {
    padding: 100px 0 50px;
    min-height: 100vh;
    /* Isolated Footer */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.footer-top {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 4rem;
    align-items: center;
    margin-bottom: 80px;
    text-align: left;
}

.footer-heading {
    font-size: 3.5rem;
    margin-bottom: 2rem;
}

.footer-sub {
    color: var(--text-secondary);
    max-width: 500px;
    margin-bottom: 2.5rem;
    font-size: 1.1rem;
}

.profile-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Centered in its column to shift "left" from the far edge */
    text-align: center;
}

.profile-img-circle {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    border: 5px solid var(--accent-cyan);
    box-shadow: 0 0 40px rgba(34, 211, 238, 0.35);
    margin-bottom: 3rem;
    /* Pushes email further down */
    object-fit: cover;
}

.footer-email-label {
    color: var(--accent-cyan);
    font-size: 1rem;
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
    font-weight: 600;
}

.footer-email {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s ease;
    display: block;
    margin-bottom: 1rem;
}

.footer-email:hover {
    color: var(--accent-cyan);
}

.footer-bottom {
    padding-top: 40px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.social-icons-row {
    display: flex;
    gap: 1.5rem;
}

.social-icons-row a {
    color: var(--text-secondary);
    font-size: 1.2rem;
    transition: all 0.3s ease;
    text-decoration: none;
}

.social-icons-row a:hover {
    color: #fff;
    transform: translateY(-2px);
}

.btn-say-hello {
    background: var(--gradient-primary);
    color: #ffffff !important;
    padding: 1.2rem 2.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 25px rgba(34, 211, 238, 0.2);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-say-hello:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 20px 40px rgba(34, 211, 238, 0.4), 0 0 30px rgba(34, 211, 238, 0.2);
}

/* Revamped Skill Stack V2 */
.skills-grid-new {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3rem;
    margin-top: 2rem;
}

.skill-card-v2 {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.3s ease;
}

.skill-card-v2:hover {
    transform: translateY(-5px);
}

.skill-icon-v2 {
    font-size: 2.5rem;
    color: var(--accent-cyan);
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.3));
}

.skill-name-v2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.skill-percent-v2 {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.9rem;
}

.skill-bar-v2 {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

.skill-progress-v2 {
    height: 100%;
    background: var(--gradient-primary);
    width: 0;
    transition: width 1.5s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 0 15px rgba(34, 211, 238, 0.5);
}

.social-icons-row a i {
    font-size: 1.5rem;
}

@media (max-width: 992px) {
    .skills-grid-new {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid-3-cv {
        grid-template-columns: 1fr 1fr !important;
    }
}

@media (max-width: 768px) {
    .skills-grid-new {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-3-cv {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }
}

@media (max-width: 480px) {
    .skills-grid-new {
        grid-template-columns: 1fr;
    }
}