:root {
    --bg-dark: #0a0a0a;
    /* Deep Black */
    --bg-card: #161616;
    /* Card Background */
    --primary: #6d28d9;
    /* Vivid Purple */
    --primary-glow: #8b5cf6;
    --secondary: #06b6d4;
    /* Cyan */
    --text-main: #ffffff;
    --text-muted: #a3a3a3;
    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    margin: 0;
    line-height: 1.6;
}

/* Navbar */
.navbar {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-brand {
    font-weight: 700;
    font-size: 1.5rem;
    background: linear-gradient(to right, var(--primary-glow), var(--secondary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s;
    font-weight: 500;
}

.nav-link:hover {
    color: var(--text-main);
}

/* Hero Section */
.hero {
    padding: 6rem 2rem;
    text-align: center;
    max-width: 1200px;
    margin: 0 auto;
    background: radial-gradient(circle at 50% 10%, rgba(109, 40, 217, 0.15) 0%, transparent 60%);
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 3rem;
}

.btn-primary {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-glow));
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(109, 40, 217, 0.4);
}

/* Common Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Cards Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1.25rem;
    transition: transform 0.3s, border-color 0.3s;
    height: 280px;
    /* Fixed height */
    max-height: 280px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.card:hover {
    transform: translateY(-5px);
    border-color: rgba(139, 92, 246, 0.3);
}

.card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    overflow: hidden;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    overflow: hidden;
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    flex-grow: 1;
}

/* Section Headers */
.section-header {
    margin: 4rem 0 2rem;
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.section-header i {
    color: var(--secondary);
}

/* Skills/Specs Bar */
.skill-bar {
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 1rem;
}

.skill-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
    border-radius: 4px;
}

/* AI Widget */
.ai-widget-trigger {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--primary-glow));
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(109, 40, 217, 0.5);
    transition: transform 0.3s, box-shadow 0.3s;
    z-index: 9999;
}

.ai-widget-trigger:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 0 30px rgba(109, 40, 217, 0.8);
}

.ai-widget-container {
    position: fixed;
    bottom: 7rem;
    right: 2rem;
    width: 380px;
    height: 600px;
    max-height: 80vh;
    /* Prevent overflow on small screens */
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    backdrop-filter: blur(20px);

    /* Transitions */
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Timeline Implementation */
.timeline-section {
    position: relative;
    padding: 2rem 0;
}

/* The vertical line */
.timeline-section::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 20px;
    /* Adjust for responsiveness or center it */
    width: 4px;
    background: linear-gradient(to bottom, var(--primary), var(--secondary));
    border-radius: 2px;
}

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
    padding-left: 60px;
    /* Space for the line */
    opacity: 0;
    transform: translateX(-20px);
    animation: slideInRight 0.5s ease-out forwards;
}

.timeline-item:nth-child(even) {
    animation-delay: 0.2s;
}

.timeline-dot {
    position: absolute;
    left: 11px;
    /* Center on the line (20px left + 4px width / 2) - dot width/2 */
    top: 5px;
    width: 22px;
    height: 22px;
    background: var(--bg-dark);
    border: 4px solid var(--secondary);
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
    transition: transform 0.3s;
}

.timeline-item:hover .timeline-dot {
    transform: scale(1.3);
    background: var(--secondary);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.8);
}

.timeline-content {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s, border-color 0.3s;
}

.timeline-content:hover {
    transform: translateX(5px);
    border-color: rgba(139, 92, 246, 0.3);
}

.timeline-date {
    color: var(--secondary);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.timeline-title {
    font-size: 1.3rem;
    color: var(--text-main);
    margin: 0 0 0.3rem 0;
}

.timeline-company {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.timeline-desc {
    color: #ccc;
    font-size: 0.95rem;
    line-height: 1.6;
}

@keyframes slideInRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ai-widget-container.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

.ai-header {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-avatar {
    width: 36px;
    height: 36px;
    background: rgba(109, 40, 217, 0.2);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--primary-glow);
}

.ai-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    max-width: 80%;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.ai-message {
    background: rgba(255, 255, 255, 0.05);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.user-message {
    background: var(--primary);
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.ai-input-area {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 0.5rem;
}

#ai-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 0.8rem 1.2rem;
    color: white;
    font-family: inherit;
    outline: none;
}

#ai-input:focus {
    border-color: var(--primary);
}

#ai-send-btn {
    background: var(--primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.2s;
}

#ai-send-btn:hover {
    transform: scale(1.1);
}

/* =========================================================
   CYBERPUNK & DYNAMIC UI UPGRADES (NEW)
   ========================================================= */

/* Hero Glitch Effect */
.glitch {
    position: relative;
    color: white;
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    z-index: 10;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

.glitch::before {
    left: 4px;
    text-shadow: -2px 0 var(--primary);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -4px;
    text-shadow: -2px 0 var(--secondary);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% { clip: rect(10px, 9999px, 83px, 0); }
    5% { clip: rect(31px, 9999px, 20px, 0); }
    10% { clip: rect(12px, 9999px, 60px, 0); }
    15% { clip: rect(74px, 9999px, 81px, 0); }
    20% { clip: rect(11px, 9999px, 65px, 0); }
    25% { clip: rect(3px, 9999px, 34px, 0); transform: translate(3px, 0); }
    30% { clip: rect(25px, 9999px, 50px, 0); }
    35% { clip: rect(40px, 9999px, 40px, 0); transform: translate(-3px, 0); }
    40% { clip: rect(15px, 9999px, 2px, 0); }
    45% { clip: rect(50px, 9999px, 23px, 0); }
    50% { clip: rect(5px, 9999px, 60px, 0); }
    55% { clip: rect(98px, 9999px, 45px, 0); }
    60% { clip: rect(23px, 9999px, 12px, 0); }
    65% { clip: rect(34px, 9999px, 89px, 0); }
    70% { clip: rect(1px, 9999px, 28px, 0); transform: translate(3px, 0); }
    75% { clip: rect(42px, 9999px, 11px, 0); }
    80% { clip: rect(89px, 9999px, 98px, 0); transform: translate(-3px, 0); }
    85% { clip: rect(5px, 9999px, 34px, 0); }
    90% { clip: rect(67px, 9999px, 11px, 0); }
    95% { clip: rect(23px, 9999px, 34px, 0); }
    100% { clip: rect(2px, 9999px, 50px, 0); }
}

@keyframes glitch-anim2 {
    0% { clip: rect(50px, 9999px, 12px, 0); }
    5% { clip: rect(11px, 9999px, 45px, 0); }
    10% { clip: rect(23px, 9999px, 23px, 0); }
    15% { clip: rect(83px, 9999px, 98px, 0); transform: translate(-4px, 0); }
    20% { clip: rect(4px, 9999px, 12px, 0); }
    25% { clip: rect(15px, 9999px, 50px, 0); transform: translate(4px, 0); }
    30% { clip: rect(89px, 9999px, 34px, 0); }
    35% { clip: rect(12px, 9999px, 2px, 0); }
    40% { clip: rect(34px, 9999px, 89px, 0); transform: translate(-4px, 0); }
    45% { clip: rect(5px, 9999px, 45px, 0); transform: translate(4px, 0); }
    50% { clip: rect(60px, 9999px, 1px, 0); }
    55% { clip: rect(2px, 9999px, 15px, 0); }
    60% { clip: rect(45px, 9999px, 50px, 0); }
    65% { clip: rect(12px, 9999px, 23px, 0); }
    70% { clip: rect(34px, 9999px, 83px, 0); }
    75% { clip: rect(11px, 9999px, 12px, 0); transform: translate(-4px, 0); }
    80% { clip: rect(98px, 9999px, 45px, 0); transform: translate(4px, 0); }
    85% { clip: rect(23px, 9999px, 34px, 0); }
    90% { clip: rect(50px, 9999px, 89px, 0); }
    95% { clip: rect(1px, 9999px, 12px, 0); }
    100% { clip: rect(89px, 9999px, 45px, 0); }
}

/* Enhancing Buttons for Cyber Feel */
.btn-primary.cyber-btn {
    border-radius: 0;
    border: 1px solid var(--secondary);
    background: transparent;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2), inset 0 0 10px rgba(6, 182, 212, 0.2);
}

.btn-primary.cyber-btn:hover {
    background: var(--secondary);
    color: var(--bg-dark);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.6), inset 0 0 20px rgba(6, 182, 212, 0.6);
    transform: translateY(-2px);
}

.btn-primary.cyber-btn:active {
    transform: scale(0.95);
}

/* Card 3D Enhancements */
.card {
    background: rgba(22, 22, 22, 0.8) !important;
    backdrop-filter: blur(5px) !important;
    border: 1px solid rgba(109, 40, 217, 0.3) !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1) !important;
    /* Setup for vanilla-tilt */
    transform-style: preserve-3d;
}

.card:hover {
    border-color: rgba(6, 182, 212, 0.8) !important;
    box-shadow: 0 0 25px rgba(6, 182, 212, 0.2) !important;
}

/* Content inside card pops out in 3D */
.card > * {
    transform: translateZ(30px);
}

/* Particles Background Canvas */
#particles-js {
    position: fixed;
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    z-index: -1;
    background: var(--bg-dark);
}

/* Make body transparent so particles show (only when particles layer exists) */
body:has(#particles-js) {
    background-color: transparent !important;
}



/* =========================================================
   EXTRA MOVEMENT & ANIMATIONS (NEW)
   ========================================================= */

/* Custom Cyber Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.8);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-glow);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.8);
}

/* Floating Animation for Avatar */
@keyframes floatY {
    0% { transform: translateY(0px) rotate(0deg); box-shadow: 0 0 20px rgba(109, 40, 217, 0.3); }
    50% { transform: translateY(-15px) rotate(3deg); box-shadow: 0 0 40px rgba(6, 182, 212, 0.7); }
    100% { transform: translateY(0px) rotate(0deg); box-shadow: 0 0 20px rgba(109, 40, 217, 0.3); }
}

.floating-avatar {
    animation: floatY 4s ease-in-out infinite;
    display: inline-block;
}

/* Typing Effect */
@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: var(--secondary); }
}

.typing-effect {
    overflow: hidden; 
    border-right: .15em solid var(--secondary); 
    white-space: nowrap; 
    margin: 0 auto; 
    letter-spacing: .05em; 
    animation: typing 3.5s steps(40, end), blink-caret .75s step-end infinite;
    display: inline-block;
    max-width: fit-content;
}

@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

/* Social icons pulsate */
@keyframes pulsate {
    0% { transform: scale(1); filter: drop-shadow(0 0 5px rgba(6, 182, 212, 0.3)); }
    50% { transform: scale(1.1); filter: drop-shadow(0 0 15px rgba(6, 182, 212, 0.9)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 5px rgba(6, 182, 212, 0.3)); }
}

.social-link:hover {
    animation: pulsate 1s infinite alternate;
}

/* =========================================================
   RESPONSIVE — Tablet (≤ 992px)
   Goal: keep the desktop look but loosen heights and spacing
   so 1024×768 / iPad-portrait stops clipping content.
   ========================================================= */
@media (max-width: 992px) {
    .hero { padding: 4rem 1.5rem; }
    .hero h1, .glitch { font-size: 2.6rem; }
    .container, .section-header { margin-left: 1rem; margin-right: 1rem; }

    /* Cards: drop fixed height; otherwise text gets clipped at 280px */
    .card { height: auto; max-height: none; }

    .ai-widget-container { width: 340px; }
}

/* =========================================================
   RESPONSIVE — Phone (≤ 768px)
   Most of the bleed-over the user sees comes from inline style
   attributes set in Index.cshtml — those win over class CSS, so
   the few rules below need !important to actually take effect.
   ========================================================= */
@media (max-width: 768px) {

    /* ── Layout & typography ─────────────────────────────── */
    .navbar      { padding: 0.85rem 1rem; }
    .nav-brand   { font-size: 1.2rem; }
    .nav-links   { display: none; }                /* Hide horizontal nav on phones; sections are reachable by scroll */
    .container   { padding: 0 1rem; }
    .hero        { padding: 3rem 1rem !important; }
    .hero h1     { font-size: 2rem !important; }
    .hero p, .typing-effect { font-size: 1rem !important; max-width: 100% !important; white-space: normal !important; border-right: 0 !important; animation: none !important; }
    .glitch      { font-size: 2rem !important; }
    .glitch::before, .glitch::after { display: none; } /* Glitch overlay is desktop-only — looks broken on small text */

    .section-header {
        font-size: 1.4rem;
        margin: 2.5rem 0 1rem;
        gap: 0.6rem;
    }

    /* ── Floating avatar ─────────────────────────────────── */
    .floating-avatar {
        width: 110px !important;
        height: 110px !important;
        margin-bottom: 1.5rem !important;
    }

    /* ── Social row ──────────────────────────────────────── */
    .hero > div[style*="display: flex"] { gap: 1rem !important; font-size: 1.25rem !important; }

    /* ── CTA buttons (Hire Me / Resume / About) ──────────── */
    .btn-primary.cyber-btn {
        padding: 0.7rem 1.2rem !important;
        font-size: 0.9rem !important;
        letter-spacing: 1px !important;
    }
    /* Contact section "Send an Email" button overrides its own inline padding/font */
    #contact + .card .btn-primary.cyber-btn {
        padding: 0.85rem 1.5rem !important;
        font-size: 1rem !important;
        width: 100%;
        max-width: 280px;
        text-align: center;
    }

    /* ── Cards grid ──────────────────────────────────────── */
    .grid {
        grid-template-columns: 1fr !important;     /* single column */
        gap: 1.25rem;
    }
    .card {
        height: auto !important;
        max-height: none !important;
        padding: 1rem !important;
    }
    .card > * { transform: none !important; }      /* Disable 3D pop-out — looks janky on touch */
    .card:hover { transform: none !important; }    /* Touch devices: no hover */

    /* The contact "Let's work together" card has its own inline padding 3rem */
    #contact + .card { padding: 1.5rem 1rem !important; }

    /* ── Timeline ─────────────────────────────────────────── */
    .timeline-section::before { left: 12px; width: 3px; }
    .timeline-item { padding-left: 38px; margin-bottom: 2rem; }
    .timeline-dot { left: 4px; width: 18px; height: 18px; border-width: 3px; }
    .timeline-content { padding: 1rem; }
    .timeline-title { font-size: 1.05rem; }

    /* ── AI widget ────────────────────────────────────────── */
    .ai-widget-trigger {
        right: 1rem;
        bottom: 1rem;
        width: 52px;
        height: 52px;
        font-size: 1.25rem;
    }
    .ai-widget-container {
        right: 0.5rem !important;
        left: 0.5rem !important;
        bottom: 4.5rem !important;
        width: auto !important;
        max-width: none !important;
        height: 70vh !important;
        max-height: 70vh !important;
    }

    /* ── Footer ───────────────────────────────────────────── */
    footer { font-size: 0.8rem; padding: 1.5rem 1rem !important; }
}

/* =========================================================
   RESPONSIVE — Small phones (≤ 420px)
   Tighten spacing one more notch so iPhone SE / Galaxy A
   don't get horizontal scroll on long words.
   ========================================================= */
@media (max-width: 420px) {
    .hero h1  { font-size: 1.6rem !important; }
    .glitch   { font-size: 1.6rem !important; }
    .hero p   { font-size: 0.92rem !important; }
    .section-header { font-size: 1.2rem; }
    .btn-primary.cyber-btn {
        padding: 0.6rem 1rem !important;
        font-size: 0.82rem !important;
    }
    .floating-avatar {
        width: 90px !important;
        height: 90px !important;
    }
}

/* =========================================================
   Touch-only tweaks — kill hover-only effects that get stuck
   in the "hover" state on tap-and-release.
   ========================================================= */
@media (hover: none) {
    .card:hover, .timeline-content:hover { transform: none !important; }
    .social-link:hover { animation: none !important; }
}
