/* ==========================================================================
   CSS Variables & Base Reset
   ========================================================================== */
:root {
    /* Color Palette - Dark Theme Default */
    --bg-color: #020617;
    --bg-secondary: #0f172a;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    
    --primary-color: #1e3a8a;
    --secondary-color: #0f172a;
    --highlight-color: #f97316;
    --accent-color: #38bdf8;
    
    /* Glassmorphism */
    --glass-bg: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    /* Typography */
    --font-body: 'Inter', sans-serif;
    --font-heading: 'Space Grotesk', sans-serif;
    
    /* Transition */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-color: #f8fafc;
    --bg-secondary: #f1f5f9;
    --text-color: #0f172a;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(30, 58, 138, 0.1);
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
}

/* Override Bootstrap Text Colors for better contrast */
.text-muted { color: var(--text-muted) !important; }
.text-accent { color: var(--accent-color) !important; }
.text-highlight { color: var(--highlight-color) !important; }
.text-primary-color { color: var(--primary-color) !important; }

/* ==========================================================================
   Matrix Background
   ========================================================================== */
#matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    opacity: 0.12;
    pointer-events: none;
}
[data-theme="light"] #matrix-canvas {
    opacity: 0.05;
}

/* Custom Utilities */
.section-padding { padding: 100px 0; }
.bg-secondary-dark { background-color: var(--bg-secondary); }

/* ==========================================================================
   Loading Screen
   ========================================================================== */
#loading-screen {
    position: fixed;
    inset: 0;
    background-color: #020617;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.loader-content { text-align: center; }

.logo-glitch {
    font-family: var(--font-heading);
    font-size: 4rem;
    font-weight: bold;
    color: var(--text-color);
    position: relative;
    margin-bottom: 2rem;
    letter-spacing: 2px;
}

.logo-glitch::before, .logo-glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.logo-glitch::before {
    left: 2px;
    text-shadow: -1px 0 red;
    animation: glitch-anim-1 2s infinite linear alternate-reverse;
}

.logo-glitch::after {
    left: -2px;
    text-shadow: -1px 0 blue;
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
    0% { clip-path: inset(20% 0 80% 0); }
    20% { clip-path: inset(60% 0 10% 0); }
    40% { clip-path: inset(40% 0 50% 0); }
    60% { clip-path: inset(80% 0 5% 0); }
    80% { clip-path: inset(10% 0 70% 0); }
    100% { clip-path: inset(30% 0 50% 0); }
}

@keyframes glitch-anim-2 {
    0% { clip-path: inset(10% 0 60% 0); }
    20% { clip-path: inset(30% 0 20% 0); }
    40% { clip-path: inset(70% 0 10% 0); }
    60% { clip-path: inset(20% 0 50% 0); }
    80% { clip-path: inset(50% 0 30% 0); }
    100% { clip-path: inset(5% 0 80% 0); }
}

.loading-bar-container {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 auto 10px;
    border-radius: 4px;
    overflow: hidden;
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color);
}

.loading-text {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--accent-color);
    letter-spacing: 2px;
    animation: blink 1s infinite;
}

@keyframes blink { 50% { opacity: 0.5; } }

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

.cursor-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-color);
}

.cursor-outline {
    width: 40px;
    height: 40px;
    border: 2px solid rgba(56, 189, 248, 0.5);
    transition: width 0.2s, height 0.2s, border-color 0.2s;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
#header {
    background: transparent;
    transition: all var(--transition-normal);
    padding: 15px 0;
}

#header.scrolled {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    padding: 10px 0;
}

.logo-font {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text-color);
    text-decoration: none;
}

.nav-link {
    color: var(--text-color) !important;
    font-weight: 500;
    position: relative;
    padding: 0.5rem 1rem !important;
    transition: color var(--transition-fast);
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    background-color: var(--accent-color);
    transition: all var(--transition-normal);
    transform: translateX(-50%);
}

.nav-link:hover::after, .nav-link.active::after { width: 80%; }
.nav-link:hover, .nav-link.active { color: var(--accent-color) !important; }

/* Buttons */
.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 15px rgba(30, 58, 138, 0.4);
}

.btn-primary-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(56, 189, 248, 0.6);
    color: #fff;
}

.btn-outline-custom {
    background: transparent;
    color: var(--text-color);
    border: 2px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    backdrop-filter: blur(5px);
    transition: all var(--transition-normal);
}

.btn-outline-custom:hover {
    background: var(--glass-bg);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-2px);
}

.btn-icon {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: var(--primary-color);
    color: white;
    transform: rotate(15deg);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero-section {
    position: relative;
    height: 100vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    overflow: hidden;
}

#particles-js {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
}

.hero-content {
    padding-top: 80px; /* offset for header */
}

.greeting {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--accent-color);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.hero-name {
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="light"] .hero-name {
    background: linear-gradient(to right, #0f172a, #334155);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-roles {
    min-height: 40px;
    font-weight: 600;
}

/* Profile Image Transition Effect */
.profile-card {
    position: relative;
    width: 350px;
    height: 450px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.image-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(20%);
    transition: filter 0.5s;
}

.image-wrapper:hover img { filter: grayscale(0%); }

.img-label {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 5px 15px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9rem;
    backdrop-filter: blur(4px);
    border-left: 3px solid var(--accent-color);
}

.scan-line {
    position: absolute;
    width: 100%;
    height: 4px;
    background: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color), 0 0 20px var(--accent-color);
    top: 0;
    left: 0;
    z-index: 10;
    opacity: 0;
}

.after-img {
    opacity: 0; /* Hidden initially, will be controlled by GSAP glitch */
}

/* TV Glitch effect applied via JS */
.glitch-active {
    animation: tv-glitch 0.2s linear infinite;
    filter: invert(1) hue-rotate(180deg) brightness(1.5) contrast(1.5);
}

@keyframes tv-glitch {
    0% { transform: translate(0) scale(1); clip-path: inset(0 0 0 0); }
    20% { transform: translate(-5px, 5px) scale(1.05); clip-path: inset(20% 0 80% 0); }
    40% { transform: translate(-5px, -5px) scale(1.05); clip-path: inset(80% 0 10% 0); }
    60% { transform: translate(5px, 5px) scale(1.05); clip-path: inset(40% 0 40% 0); }
    80% { transform: translate(5px, -5px) scale(1.05); clip-path: inset(10% 0 60% 0); }
    100% { transform: translate(0) scale(1); clip-path: inset(0 0 0 0); }
}

.profile-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.2) 0%, rgba(0,0,0,0) 70%);
    z-index: -1;
    animation: pulse-glow 4s infinite;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
}

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 10;
}

/* ==========================================================================
   Shared Components
   ========================================================================== */
.section-header .title {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.section-header .underline {
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 2px;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.tilt-element {
    transform-style: preserve-3d;
}

/* ==========================================================================
   About Section
   ========================================================================== */
.stat-card {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-10px);
    border-color: rgba(56, 189, 248, 0.3);
    box-shadow: 0 10px 30px rgba(56, 189, 248, 0.1);
}

.stat-icon {
    transform: translateZ(20px);
}

.stat-number {
    transform: translateZ(30px);
}

/* ==========================================================================
   Skills Section
   ========================================================================== */
.skill-category-title {
    font-family: var(--font-heading);
    color: var(--text-color);
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}

.skill-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 12px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: default;
}

.skill-card i {
    font-size: 1.5rem;
}

.skill-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-5px);
    border-color: var(--accent-color);
    box-shadow: 0 5px 15px rgba(56, 189, 248, 0.2);
}

/* Specific icon colors if needed */
.text-orange { color: #f97316 !important; }
.text-purple { color: #a855f7 !important; }

/* ==========================================================================
   Projects Section
   ========================================================================== */
.project-card {
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.project-img {
    position: relative;
    overflow: hidden;
    height: 220px;
}

.project-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.project-overlay {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-card:hover .project-img img {
    transform: scale(1.1);
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.project-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.project-title {
    font-size: 1.25rem;
    margin-bottom: 10px;
}

.project-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 15px;
    flex-grow: 1;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.project-tech span {
    font-size: 0.8rem;
    padding: 4px 10px;
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent-color);
    border-radius: 20px;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

/* ==========================================================================
   Contact Section
   ========================================================================== */
.glow-bg {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
}

.contact-icon {
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
}

.bg-primary-custom { background-color: var(--primary-color); }
.bg-highlight { background-color: var(--highlight-color); }
.bg-accent { background-color: var(--accent-color); }

.social-icon {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-color);
    font-size: 1.2rem;
    text-decoration: none;
    transition: all 0.3s;
}

.social-icon:hover {
    background: var(--accent-color);
    color: #fff;
    transform: translateY(-3px);
}

.form-control {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
}

.form-control:focus {
    background: rgba(0, 0, 0, 0.3);
    border-color: var(--accent-color);
    color: var(--text-color);
    box-shadow: 0 0 0 0.25rem rgba(56, 189, 248, 0.25);
}

.form-floating label {
    color: var(--text-muted);
}

[data-theme="light"] .form-control {
    background: rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   Project Modal
   ========================================================================== */
.custom-modal {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
}

.custom-modal.active {
    visibility: visible;
    opacity: 1;
}

.custom-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.custom-modal-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 20px;
    z-index: 1051;
    transform: translateY(50px);
    opacity: 0;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s;
}

.close-modal:hover {
    background: var(--highlight-color);
    color: #fff;
}

.modal-body-content {
    /* Padding internally to elements */
}

.modal-banner {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.modal-info-wrap {
    padding: 30px;
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 991px) {
    .navbar-collapse {
        background: var(--bg-secondary);
        padding: 20px;
        border-radius: 10px;
        margin-top: 10px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    }
    
    .profile-card {
        width: 300px;
        height: 380px;
    }
    
    .logo-glitch { font-size: 3rem; }
}

@media (max-width: 768px) {
    .hero-name { font-size: 2.5rem; }
    .hero-section { text-align: center; }
    .hero-buttons { justify-content: center; display: flex; flex-wrap: wrap; }
    .profile-card { margin-top: 2rem; width: 280px; height: 350px; }
    .cursor-dot, .cursor-outline { display: none; } /* Hide custom cursor on mobile */
}
