/* Custom scrollbar for a more thematic feel */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #0a0a0a;
}
::-webkit-scrollbar-thumb {
    background: #00ff00;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #00e600;
}

/* Define fonts */
body {
    font-family: 'Fira Code', monospace;
    background-color: #010101;
    color: #E0E0E0;
}
h1, h2, h3 {
    font-family: 'Orbitron', sans-serif;
}

/* Glitchy background canvas */
#glitch-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* Scan line overlay for CRT effect */
.scan-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Make sure it's not interactable */
    z-index: 999;
    background: linear-gradient(
        to bottom,
        rgba(1, 1, 1, 0),
        rgba(1, 1, 1, 0.1) 50%,
        rgba(1, 1, 1, 0)
    );
    background-size: 100% 3px;
    animation: scan 7s linear infinite;
}

@keyframes scan {
    from { background-position-y: 0; }
    to { background-position-y: 200px; }
}

/* Pre-loader and page transition styles */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #010101;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 1rem;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}
.loader-text {
    color: #00ff00;
    font-size: 1rem;
}
.loader-bar {
    width: 200px;
    height: 2px;
    background-color: rgba(0, 255, 0, 0.2);
    position: relative;
    overflow: hidden;
}
.loader-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background-color: #00ff00;
    animation: loading 2s linear forwards;
}

@keyframes loading {
    from { width: 0; }
    to { width: 100%; }
}

/* Glitch effect for the main title */
.glitch {
    position: relative;
    font-size: 5rem;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 0.1em;
    animation: glitch-skew 1s infinite linear alternate-reverse;
}
.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #010101;
    overflow: hidden;
}
.glitch::before {
    left: 2px;
    text-shadow: -2px 0 #00ff00;
    animation: glitch-anim-1 2s infinite linear alternate-reverse;
}
.glitch::after {
    left: -2px;
    text-shadow: -2px 0 #00aaff, 2px 2px #ff00ff;
    animation: glitch-anim-2 2s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
    0% { clip-path: inset(15% 0 86% 0); } 25% { clip-path: inset(5% 0 45% 0); } 50% { clip-path: inset(25% 0 15% 0); } 75% { clip-path: inset(60% 0 30% 0); } 100% { clip-path: inset(90% 0 5% 0); }
}
@keyframes glitch-anim-2 {
    0% { clip-path: inset(80% 0 10% 0); } 25% { clip-path: inset(30% 0 65% 0); } 50% { clip-path: inset(55% 0 12% 0); } 75% { clip-path: inset(10% 0 70% 0); } 100% { clip-path: inset(75% 0 5% 0); }
}
@keyframes glitch-skew {
    0% { transform: skewX(0deg); } 10% { transform: skewX(0.5deg); } 20% { transform: skewX(0deg); } 80% { transform: skewX(0deg); } 90% { transform: skewX(-0.8deg); } 100% { transform: skewX(0deg); }
}

/* Typewriter effect for the subtitle */
#typewriter {
    overflow: hidden;
    border-right: .10em solid #00ff00;
    white-space: nowrap;
    margin: 0 auto;
    letter-spacing: .10em;
    animation: typing 3.5s steps(40, end), blink-caret .75s step-end infinite;
}

@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}
@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: #00ff00; }
}

/* Card styles for projects and writeups */
.card {
    position: relative; /* For pseudo-element positioning */
    background: rgba(16, 16, 16, 0.5);
    border: 1px solid rgba(0, 255, 0, 0.2);
    transition: transform 0.3s ease, border-color 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1;
}
.card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: rgba(0, 255, 0, 0.4);
}
/* New card glow on hover */
.card::before {
    content: '';
    position: absolute;
    top: -2px; left: -2px;
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    border-radius: inherit;
    background: linear-gradient(45deg, #00ff00, #00aaff);
    opacity: 0;
    transition: opacity 0.4s ease-out;
    z-index: -1;
    filter: blur(15px);
}
.card:hover::before {
    opacity: 0.4;
}

/* Smooth reveal on scroll */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Custom glow effect on navbar links */
.nav-link {
    position: relative;
    transition: color 0.3s ease;
}
.nav-link::after {
    content: '';
    position: absolute;
    width: 100%;
    transform: scaleX(0);
    height: 1px;
    bottom: -2px;
    left: 0;
    background-color: #00ff00;
    transform-origin: bottom right;
    transition: transform 0.3s ease-out;
}
.nav-link:hover {
    color: #00ff00;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}
.nav-link:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

/* Skill Tag styles */
.skill-tag {
    background: rgba(0, 255, 0, 0.1);
    color: #00ff00;
    padding: 8px 16px;
    border-radius: 9999px;
    border: 1px solid rgba(0, 255, 0, 0.3);
    font-size: 0.9rem;
    transition: background-color 0.3s, box-shadow 0.3s;
    cursor: default;
}
.skill-tag:hover {
    background: rgba(0, 255, 0, 0.2);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.4);
}
