/* RESET & BASE */
:root {
    --bg-black: #000000;
    --deep-purple: #2D0036;
    --grad-start: #CDB4DB;
    --grad-end: #9BF6FF;
    --pale-gold: #F6E0B5;
    --accent: #CDB4DB;
    
    --text-main: #f4f4f5;
    --text-muted: #8a8a93;
    --border: rgba(255, 255, 255, 0.1);
    --panel-bg: #0c0c0e;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-black);
    color: var(--text-main);
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.6;
    overflow-x: hidden;
    font-size: 14px;
}

/* SECTION FADE IN ANIMATION */
section {
    padding: 8rem 0;
    border-bottom: 1px solid var(--border);
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1.2s cubic-bezier(0.2, 0.8, 0.2, 1), transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
section.visible {
    opacity: 1;
    transform: translateY(0);
}

section:last-child {
    border-bottom: none;
}

a { color: inherit; text-decoration: none; transition: all 0.3s ease; }
a:hover { color: var(--grad-end); text-shadow: 0 0 8px rgba(155, 246, 255, 0.6); }

.hover-link { display: inline-block; padding: 2px 4px; border-radius: 4px; transition: all 0.3s; }
.hover-link:hover { color: var(--text-main); text-shadow: 0 0 8px rgba(255, 255, 255, 0.8); }

.glow-white-link:hover {
    color: #fff !important;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    -webkit-text-fill-color: #fff !important;
}

.glow-text-hover { transition: all 0.3s ease; }
.glow-text-hover:hover { text-shadow: 0 0 15px var(--grad-end); }

.muted { color: var(--text-muted); }
.italic { font-style: italic; }
.mt-4 { margin-top: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.text-teal { color: var(--grad-end); }

/* TEXT GRADIENT */
.text-gradient {
    background: linear-gradient(to right, var(--grad-start), var(--grad-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* CUSTOM FONT FOR HEADINGS */
.serif-font {
    font-family: 'Instrument Serif', Georgia, serif;
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* CUSTOM CURSOR */
.cursor-dot, .cursor-outline {
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
}

.cursor-dot {
    width: 6px;
    height: 6px;
    background-color: var(--grad-end);
    box-shadow: 0 0 10px var(--grad-end);
}

.cursor-outline {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(155, 246, 255, 0.6);
    transition: width 0.2s, height 0.2s, background-color 0.2s, border-color 0.2s;
}

/* DEEP PURPLE MESH GLOW */
.mesh-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle at center, var(--deep-purple) 0%, transparent 60%);
    transform: translate(-50%, -50%);
    opacity: 0.5;
    z-index: -2;
    pointer-events: none;
    filter: blur(80px);
}

/* PARTICLE MESH BACKGROUND */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    opacity: 1; /* Increased opacity */
}

/* NAVBAR */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 3rem;
    z-index: 100;
}

.nav-brand { 
    font-size: 1.5rem; 
    font-weight: bold; 
    letter-spacing: 2px;
    background: linear-gradient(to right, #ff9800, #4caf50);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.nav-links { 
    display: flex; 
    gap: 2.5rem; 
    background: rgba(255, 255, 255, 0.03); 
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    padding: 0.8rem 2.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
.nav-links a { font-size: 0.8rem; letter-spacing: 1px; text-transform: uppercase; color: var(--text-muted); font-weight: bold; }
.nav-links a:hover { color: var(--text-main); text-shadow: 0 0 8px rgba(255, 255, 255, 0.8); }
.contact-btn {
    display: flex; align-items: center; gap: 0.5rem; border: 1px solid var(--border);
    padding: 0.5rem 1rem; border-radius: 4px; font-size: 0.8rem; background: rgba(0,0,0,0.5); backdrop-filter: blur(10px);
}
.pulse-dot { width: 6px; height: 6px; background-color: var(--grad-end); border-radius: 50%; box-shadow: 0 0 8px var(--grad-end); }

/* CONTAINER */
.container { max-width: 1400px; margin: 0 auto; padding: 0 3rem; }
.section-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 4rem; }
.section-num { color: var(--text-muted); font-size: 0.9rem; }
.section-header h2 { font-size: 3.5rem; }

/* HERO */
.hero { height: 100vh; display: flex; flex-direction: column; justify-content: center; padding-top: 4rem; opacity: 1; transform: none; }
.hero-top-info { color: var(--text-muted); font-size: 0.8rem; letter-spacing: 2px; margin-bottom: 2rem; }
.massive-title {
    font-size: clamp(6rem, 14vw, 12rem); line-height: 0.85; margin-bottom: 1.5rem;
    background: linear-gradient(to bottom right, #ffffff, var(--grad-start));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    transition: all 0.3s ease;
}

@keyframes nameFlash {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.flash-animation {
    background: linear-gradient(120deg, #ffffff 40%, #40e0d0 50%, #ffffff 60%);
    background-size: 300% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: nameFlash 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.hero-subtitle { font-size: 1.2rem; color: var(--pale-gold); font-style: italic; margin-bottom: 5rem; }
.hero-bottom { display: flex; justify-content: space-between; align-items: flex-end; }
.profile-wrapper { display: flex; flex-direction: column; gap: 1rem; }
.profile-img { width: 250px; height: 300px; object-fit: cover; object-position: center; border-radius: 4px; filter: grayscale(100%) contrast(1.1); transition: filter 0.5s ease; }
.profile-img:hover { filter: grayscale(0%); }
.profile-caption { font-size: 0.75rem; line-height: 1.8; }
.hero-stats { display: flex; gap: 4rem; }
.stat-block h2 { font-size: 2.5rem; margin-bottom: 0.25rem; color: var(--text-main); }
.stat-block span, .stat-block a { font-size: 0.75rem; }

/* PROJECTS LIST */
.projects-list { display: flex; flex-direction: column; }
.project-item { 
    display: flex; 
    padding: 3rem 0; 
    border-top: 1px solid var(--border); 
    gap: 2rem; 
    justify-content: space-between;
}
.proj-num { font-size: 0.85rem; color: var(--grad-end); width: 40px; }
.proj-content { flex: 1; max-width: 800px; }
.proj-title-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.proj-title-row h3 { font-size: 2.5rem; }
.proj-tag { display: inline-block; white-space: nowrap; text-align: center; font-size: 0.65rem; letter-spacing: 1px; padding: 0.2rem 0.6rem; border: 1px solid rgba(205, 180, 219, 0.4); border-radius: 4px; color: var(--grad-start); }
.proj-desc { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.95rem; }
.tech-stack { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tech-stack span { font-size: 0.7rem; border: 1px solid var(--border); padding: 0.25rem 0.75rem; border-radius: 2px; color: var(--text-muted); }
.proj-link { display: flex; align-items: center; font-size: 0.85rem; font-weight: bold; }
.proj-link a { 
    padding: 0.4rem 0.8rem; 
    border-radius: 4px; 
    border: 1px solid transparent; 
    transition: all 0.3s ease;
}
.proj-link a.text-gradient:hover { 
    border-color: rgba(50, 205, 50, 0.6); /* lime green edge */
    box-shadow: 0 0 12px rgba(50, 205, 50, 0.4), inset 0 0 8px rgba(50, 205, 50, 0.2); 
    text-shadow: none;
    color: #fff;
    -webkit-text-fill-color: #fff;
}

/* PROJECT VISUAL PANELS (Charts/Flows) */
.visual-panel {
    width: 350px;
    height: 200px;
    background: rgba(20, 20, 24, 0.4);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow: hidden;
}
.chart-lbl { font-size: 0.65rem; color: var(--text-muted); margin-bottom: 0.3rem; display: block; }

/* Flowchart */
.flowchart { display: flex; align-items: center; gap: 0.5rem; width: 100%; justify-content: center; }
.flow-box { border: 1px solid var(--border); padding: 0.5rem; font-size: 0.7rem; border-radius: 4px; color: var(--text-muted); }
.flow-box.active { border-color: var(--grad-start); color: var(--grad-start); box-shadow: 0 0 10px rgba(205, 180, 219, 0.2); }
.flow-arrow { color: var(--border); font-size: 0.8rem; }

/* Bar Chart */
.bar-chart { width: 100%; display: flex; flex-direction: column; gap: 0.5rem; }
.chart-row { display: flex; align-items: center; gap: 1rem; }
.chart-lbl { width: 60px; margin: 0; }
.chart-bar { height: 8px; border-radius: 2px; }
.chart-val { font-size: 0.7rem; }

/* Network Diagram */
.network-diagram { position: relative; }
.node { 
    position: absolute; background: var(--panel-bg); border: 1px solid var(--grad-end); 
    padding: 0.3rem 0.5rem; font-size: 0.65rem; border-radius: 4px; z-index: 2; color: var(--grad-end);
}
.node.top { top: 0; left: 50%; transform: translate(-50%, -50%); }
.node.bottom { bottom: 0; left: 50%; transform: translate(-50%, 50%); }
.node.left { left: 0; top: 50%; transform: translate(-50%, -50%); }
.node.right { right: 0; top: 50%; transform: translate(50%, -50%); }

/* Policy Chart */
.policy-chart { display: flex; flex-direction: column; align-items: center; width: 100%; }
.policy-box { border: 1px solid var(--border); padding: 0.5rem 1rem; font-size: 0.7rem; border-radius: 4px; text-align: center; width: 120px; }
.policy-box.active { border-color: #ff5f56; color: #ff5f56; box-shadow: 0 0 10px rgba(255, 95, 86, 0.2); }
.policy-line { width: 1px; height: 20px; background: var(--border); }

/* Loss Chart / Series Chart */
.loss-chart, .series-chart { width: 100%; height: 100%; position: relative; }


/* SKILLS */
.skills-wrapper { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4rem; }
.skill-category h4 { margin-bottom: 2rem; font-size: 1.2rem; letter-spacing: 1px; }
.skill-list { list-style: none; }
.skill-list li { margin-bottom: 1.5rem; font-size: 0.85rem; }
.skill-list span { display: block; margin-bottom: 0.5rem; color: var(--text-main); }
.bar-bg { width: 100%; height: 2px; background-color: var(--border); border-radius: 2px;}
.bar-fill {
    height: 100%;
    background: linear-gradient(to right, var(--grad-start), var(--grad-end));
    width: 0; /* animated via JS */
    transition: width 1.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    border-radius: 2px;
}

/* ABOUT / TERMINAL */
.about-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 4rem; }
.about-text p { margin-bottom: 1.5rem; color: var(--text-muted); }
.about-terminal { background-color: var(--panel-bg); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.term-header { display: flex; align-items: center; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); gap: 1rem; }
.term-dots span { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background-color: #3f3f46; margin-right: 4px; }
.term-title { font-size: 0.7rem; color: var(--text-muted); }
.term-body { padding: 1.5rem; font-size: 0.8rem; }
.term-body .prompt { color: #32cd32; margin-right: 0.5rem; text-shadow: 0 0 6px rgba(50, 205, 50, 0.5); }
.term-body pre { font-family: inherit; color: var(--text-muted); margin: 1rem 0; }
.blink { color: #32cd32; animation: blink 1s step-end infinite; text-shadow: 0 0 6px rgba(50, 205, 50, 0.5); }
@keyframes blink { 50% { opacity: 0; } }

/* CONTACT */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; margin-bottom: 6rem; }
.contact-left h2 { font-size: 4rem; line-height: 1.1; }
.contact-right { display: flex; flex-direction: column; justify-content: center; gap: 2rem; }
.contact-row { display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); padding-bottom: 1rem; }
.footer { display: flex; gap: 2rem; font-size: 0.7rem; color: var(--text-muted); letter-spacing: 1px; border-top: 1px solid var(--border); padding-top: 2rem; }

/* ==========================================================================
   RESPONSIVE & FORM-FACTOR OPTIMIZATIONS
   (Tablets, Foldables 4:3, Mobile 19.5:9, and Touch Devices)
   ========================================================================== */

/* 1. Touch Devices & Small Screens: Hide custom mouse cursor for native touch feel */
@media (hover: none) and (pointer: coarse), (max-width: 768px) {
    .cursor-dot, .cursor-outline { display: none !important; }
    body { cursor: auto !important; }
}

/* 2. Tablets & Foldable Displays (4:3 Aspect Ratio ~ iPad Pro 2752x2064, Galaxy Z Fold Inner 2184x1968) */
@media (max-width: 1380px) and (min-width: 769px) and (max-aspect-ratio: 14/10), (max-width: 1100px) and (min-width: 769px) {
    .container { padding: 0 2rem; }
    .navbar { padding: 1.2rem 2rem; }
    .nav-links { gap: 1.5rem; padding: 0.7rem 1.8rem; }
    
    .massive-title { font-size: clamp(4.5rem, 11vw, 8rem); }
    .hero-bottom { flex-direction: column; align-items: flex-start; gap: 3rem; }
    
    /* 2-Column layout for 4:3 tablet and foldable displays */
    .skills-wrapper { grid-template-columns: repeat(2, 1fr); gap: 3rem; }
    .about-grid { grid-template-columns: 1fr; gap: 3rem; }
    .contact-grid { grid-template-columns: 1fr; gap: 3rem; }
    
    .project-item { flex-direction: column; gap: 2rem; }
    .proj-visual { width: 100%; max-width: 650px; height: 220px; margin: 0 auto; }
}

/* 3. Mobile Phones (19.5:9 Aspect Ratio ~ 1080x2340 Displays & Narrow Screens up to 768px) */
@media (max-width: 768px) {
    .container { padding: 0 1.5rem; }
    
    /* Floating Capsule Dock Navbar */
    .navbar { 
        padding: 1rem 1.2rem; 
        flex-direction: column; 
        gap: 0.8rem; 
    }
    .nav-links { 
        position: static; 
        transform: none; 
        width: 100%; 
        max-width: 420px; 
        justify-content: space-around; 
        gap: 0.5rem; 
        padding: 0.6rem 1.2rem; 
    }
    .nav-links a { font-size: 0.75rem; }

    /* Hero Section adjusted for 19.5:9 tall viewport */
    .hero { 
        height: auto; 
        min-height: 100vh; 
        padding-top: 7rem; 
        padding-bottom: 4rem; 
        justify-content: flex-start;
    }
    .massive-title { font-size: clamp(3.5rem, 13vw, 5.5rem); margin-bottom: 1rem; }
    .hero-subtitle { font-size: 1.05rem; margin-bottom: 3rem; }
    .hero-bottom { flex-direction: column; align-items: flex-start; gap: 2.5rem; width: 100%; }
    
    .profile-img { width: 100%; max-width: 300px; height: 340px; }
    .hero-stats { gap: 2.5rem; flex-wrap: wrap; width: 100%; }
    .stat-block h2 { font-size: 2.2rem; }

    /* Section Headers */
    .section-header { margin-bottom: 2.5rem; }
    .section-header h2 { font-size: 2.2rem; }

    /* Projects & Workflows */
    .project-item { flex-direction: column; padding: 2.5rem 0; gap: 1.5rem; }
    .proj-title-row { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .proj-title-row h3 { font-size: 1.8rem; }
    .proj-desc { font-size: 0.9rem; }
    
    /* Responsive Visual Panels */
    .proj-visual { 
        width: 100%; 
        max-width: 100%; 
        height: auto; 
        min-height: 180px; 
        aspect-ratio: 16 / 9; 
        padding: 1rem; 
    }

    /* Skills */
    .skills-wrapper { grid-template-columns: 1fr; gap: 2.5rem; }

    /* About Terminal Mockup: Wrap JSON to prevent horizontal breaking */
    .about-grid { grid-template-columns: 1fr; gap: 2rem; }
    .about-terminal { width: 100%; overflow-x: auto; }
    .term-body { padding: 1rem; font-size: 0.75rem; }
    .term-body pre { 
        white-space: pre-wrap; 
        word-break: break-word; 
        font-size: 0.7rem; 
        margin: 0.5rem 0; 
    }

    /* Contact Section */
    .contact-grid { grid-template-columns: 1fr; gap: 2.5rem; margin-bottom: 4rem; }
    .contact-left h2 { font-size: 2.2rem; }
    .contact-right { gap: 1.5rem; }

    /* Footer */
    .footer { 
        flex-direction: column; 
        align-items: center; 
        text-align: center; 
        gap: 1rem; 
        padding: 2rem 1rem; 
    }
}

/* 4. Ultra-Narrow Foldable Cover Screens (~ up to 480px) */
@media (max-width: 480px) {
    .nav-links { gap: 0.2rem; padding: 0.5rem 0.8rem; }
    .nav-links a { font-size: 0.65rem; }
    .massive-title { font-size: 3rem; }
    .proj-visual { aspect-ratio: 4 / 3; min-height: 160px; }
    .term-body pre { font-size: 0.65rem; }
}

