/*
* HARUN RAHAHLA PORTFOLIO WEBSITE
* Custom Animations Stylesheet
*/

/* 
* ========================================
* KEYFRAME ANIMATIONS
* ========================================
*/

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Fade In Up Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Down Animation */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Left Animation */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade In Right Animation */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Zoom In Animation */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Reveal Text Character by Character */
@keyframes revealText {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

/* Glitch Effect Animation */
@keyframes glitch {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0);
    }
}

/* Floating Animation */
@keyframes float {
    0% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
    100% {
        transform: translateY(0);
    }
}

/* Pulse Animation */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Shimmer Animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Rotation Animation */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 
* ========================================
* ANIMATION UTILITY CLASSES
* ========================================
*/

/* Fade In Animations */
.animate-fade-in {
    animation: fadeIn 1s ease forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 1s ease forwards;
}

.animate-fade-in-down {
    animation: fadeInDown 1s ease forwards;
}

.animate-fade-in-left {
    animation: fadeInLeft 1s ease forwards;
}

.animate-fade-in-right {
    animation: fadeInRight 1s ease forwards;
}

/* Zoom Animation */
.animate-zoom-in {
    animation: zoomIn 1s ease forwards;
}

/* Floating Animation */
.animate-float {
    animation: float 6s ease-in-out infinite;
}

/* Pulse Animation */
.animate-pulse {
    animation: pulse 3s ease-in-out infinite;
}

/* Shimmer Animation */
.animate-shimmer {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* Rotation Animation */
.animate-rotate {
    animation: rotate 10s linear infinite;
}

/* 
* ========================================
* ANIMATION DELAYS
* ========================================
*/
.delay-100 {
    animation-delay: 100ms;
}

.delay-200 {
    animation-delay: 200ms;
}

.delay-300 {
    animation-delay: 300ms;
}

.delay-400 {
    animation-delay: 400ms;
}

.delay-500 {
    animation-delay: 500ms;
}

.delay-600 {
    animation-delay: 600ms;
}

.delay-700 {
    animation-delay: 700ms;
}

.delay-800 {
    animation-delay: 800ms;
}

.delay-900 {
    animation-delay: 900ms;
}

.delay-1000 {
    animation-delay: 1000ms;
}

/* 
* ========================================
* SPECIFIC ELEMENT ANIMATIONS
* ========================================
*/

/* Glitch Text Effect - Applied to elements with class .glitch-text */
.glitch-text {
    position: relative;
    display: inline-block;
}

.glitch-text:hover {
    animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
    color: var(--primary-color);
}

/* Gradient Border Animation */
.gradient-border {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.gradient-border::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    z-index: -1;
    background: linear-gradient(
        45deg,
        var(--primary-color),
        var(--secondary-color),
        var(--accent-color),
        var(--primary-color)
    );
    background-size: 400% 400%;
    animation: borderGradient 5s ease infinite;
    border-radius: calc(var(--border-radius) + 2px);
}

@keyframes borderGradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Button Hover Animation */
.btn-hover-effect {
    overflow: hidden;
    position: relative;
}

.btn-hover-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.2);
    transition: width 0.5s ease;
    z-index: -1;
}

.btn-hover-effect:hover::before {
    width: 100%;
}

/* Typing Text Animation - Applied through JavaScript */
.typing-text {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid var(--primary-color);
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink-caret {
    from,
    to {
        border-color: transparent;
    }
    50% {
        border-color: var(--primary-color);
    }
}

/* Reveal on Scroll Animation - Applied through JavaScript with IntersectionObserver */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Image Hover Zoom Effect */
.img-zoom-container {
    overflow: hidden;
}

.img-zoom {
    transition: transform 0.5s ease;
}

.img-zoom:hover {
    transform: scale(1.1);
}

/* Ripple Button Effect - Applied through JavaScript */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: scale(0);
    animation: ripple 0.6s linear;
}

@keyframes ripple {
    to {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* Skewed Section Divider */
.skewed-divider {
    position: relative;
    height: 100px;
    overflow: hidden;
}

.skewed-divider::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--dark-bg);
    transform: skewY(-3deg);
    transform-origin: top left;
}

/* Parallax Effect - Applied through JavaScript */
.parallax {
    position: relative;
    overflow: hidden;
}

.parallax-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: transform 0.1s ease-out;
}

/* Tech Icons Hover Animation */
.tech-item:hover .tech-icon {
    animation: techPulse 1.5s ease infinite;
}

@keyframes techPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
        color: var(--primary-light);
    }
    100% {
        transform: scale(1);
    }
}

/* Highlight Animation for Text */
.text-highlight {
    position: relative;
    display: inline-block;
}

.text-highlight::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.5s ease;
}

.text-highlight:hover::after {
    width: 100%;
}

/* Background Particles Animation - Applied through JavaScript */
.particles-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* Loading Spinner Animation */
.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Content Fade In on Page Load */
body.loaded .page-content {
    animation: contentFadeIn 1s ease forwards;
}

@keyframes contentFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card Flip Animation */
.flip-card {
    perspective: 1000px;
    width: 100%;
    height: 400px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.flip-card-front {
    background-color: var(--dark-card-bg);
}

.flip-card-back {
    background-color: var(--dark-surface);
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

/* Project Card Hover Animation */
.project-card .project-info {
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.5s ease, opacity 0.5s ease;
    transition-delay: 0.1s;
}

.project-card:hover .project-info {
    transform: translateY(0);
    opacity: 1;
}

/* Skills Progress Bar Animation */
.skill-progress {
    width: 100%;
    height: 8px;
    background-color: var(--dark-surface);
    border-radius: var(--border-radius-full);
    margin-bottom: 1.5rem;
    overflow: hidden;
    position: relative;
}

.skill-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--primary-gradient);
    border-radius: var(--border-radius-full);
    width: 0;
    transition: width 1.5s ease;
}

.skill-progress.animate .skill-progress-bar {
    animation: progressBar 1.5s ease forwards;
}

@keyframes progressBar {
    from {
        width: 0;
    }
    to {
        width: var(--progress-width);
    }
}

/* Navigation Menu Item Animation */
.nav-item {
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease, left 0.3s ease;
}

.nav-link:hover::before,
.nav-link.active::before {
    width: 100%;
    left: 0;
}

/* Social Media Icons Hover Animation */
.social-icon {
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.social-icon:hover {
    transform: translateY(-5px) scale(1.1);
}

/* Animated Background Gradient */
.gradient-bg {
    background: linear-gradient(
        135deg,
        var(--dark-bg) 0%,
        var(--dark-bg-secondary) 25%,
        var(--dark-bg) 50%,
        var(--dark-bg-secondary) 75%,
        var(--dark-bg) 100%
    );
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Contact Form Input Focus Animation */
.form-control {
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.25);
}

/* Timeline Animation */
.timeline-item {
    position: relative;
    padding-left: 3rem;
    margin-bottom: 3rem;
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.timeline-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--primary-color);
    z-index: 2;
}

.timeline-item::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    width: 2px;
    height: calc(100% + 3rem);
    background-color: var(--dark-border);
    transform: translateX(-50%);
    z-index: 1;
}

.timeline-item:last-child::after {
    height: calc(100% - 8px);
}

.timeline-item.show {
    opacity: 1;
    transform: translateX(0);
}

/* Staggered Fade In Animation for Lists */
.stagger-fade-in > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.stagger-fade-in.show > *:nth-child(1) {
    transition-delay: 0.1s;
}

.stagger-fade-in.show > *:nth-child(2) {
    transition-delay: 0.2s;
}

.stagger-fade-in.show > *:nth-child(3) {
    transition-delay: 0.3s;
}

.stagger-fade-in.show > *:nth-child(4) {
    transition-delay: 0.4s;
}

.stagger-fade-in.show > *:nth-child(5) {
    transition-delay: 0.5s;
}

.stagger-fade-in.show > * {
    opacity: 1;
    transform: translateY(0);
}

/* Counter Animation */
.counter-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    display: inline-block;
}

/* Scroll Reveal Animations */
[data-scroll] {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-scroll="fade-up"] {
    transform: translateY(50px);
}

[data-scroll="fade-down"] {
    transform: translateY(-50px);
}

[data-scroll="fade-left"] {
    transform: translateX(-50px);
}

[data-scroll="fade-right"] {
    transform: translateX(50px);
}

[data-scroll="zoom-in"] {
    transform: scale(0.9);
}

[data-scroll].in-view {
    opacity: 1;
    transform: translate(0) scale(1);
}

/* Media Queries for Animations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}