/* 
 * Animations CSS for Abhijeet's Portfolio Website
 * Custom CSS Animations (No Bootstrap)
 */

/* ---------- Preloader Animation ---------- */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.light-theme .preloader {
    background-color: var(--light-bg);
}

.dark-theme .preloader {
    background-color: var(--dark-bg);
}

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

.preloader-content h1 {
    font-family: var(--heading-font);
    font-size: 2.5rem;
    margin-bottom: 1rem;
    animation: pulse 1.5s infinite;
}

.light-theme .preloader-content h1 {
    color: var(--light-title);
}

.dark-theme .preloader-content h1 {
    color: var(--dark-title);
}

.typing-container {
    display: inline-block;
    position: relative;
    font-size: 1.5rem;
    font-family: var(--primary-font);
}

.light-theme .typing-container {
    color: var(--light-text);
}

.dark-theme .typing-container {
    color: var(--dark-text);
}

.cursor {
    display: inline-block;
    width: 3px;
    height: 1.5rem;
    background-color: currentColor;
    margin-left: 2px;
    animation: blink 1s infinite;
    vertical-align: middle;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ---------- Typing Animation in Home Section ---------- */
#animated-text {
    position: relative;
    display: inline-block;
}

#text-content {
    display: inline-block;
}

#cursor {
    display: inline-block;
    width: 3px;
    height: 1.2em;
    background-color: currentColor;
    margin-left: 2px;
    animation: blink 1s infinite;
    vertical-align: middle;
}

/* ---------- Fade-in Animation ---------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---------- Slide-in Animation ---------- */
@keyframes slideInFromLeft {
    from { transform: translateX(-50px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInFromRight {
    from { transform: translateX(50px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInFromTop {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideInFromBottom {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ---------- Pop Animation ---------- */
@keyframes pop {
    0% { transform: scale(0.8); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* ---------- Apply Animations to Elements ---------- */
/* Applied when section becomes active and NOT in single-page-mode */
body:not(.single-page-mode) .section.active .section-title {
    animation: slideInFromLeft 0.5s forwards;
}

body:not(.single-page-mode) .section.active .profile-section {
    animation: fadeIn 1s forwards;
}

body:not(.single-page-mode) .section.active .about-content {
    animation: slideInFromBottom 0.7s forwards;
}

body:not(.single-page-mode) .section.active .filter-buttons {
    animation: slideInFromTop 0.6s forwards;
}

body:not(.single-page-mode) .section.active .project-card {
    animation: pop 0.5s forwards;
    animation-delay: calc(var(--animation-order) * 0.1s);
    opacity: 0; /* Start hidden, animation will make it visible */
}

body:not(.single-page-mode) .section.active .game-card {
    animation: pop 0.5s forwards;
    animation-delay: calc(var(--animation-order) * 0.1s);
    opacity: 0;
}

body:not(.single-page-mode) .section.active .timeline-item { /* Assuming .timeline-item exists, or .timeline-block */
    animation: fadeIn 0.8s forwards;
    animation-delay: calc(var(--animation-order) * 0.2s);
    opacity: 0;
}

body:not(.single-page-mode) .section.active .stat-card {
    animation: slideInFromBottom 0.5s forwards;
    animation-delay: calc(var(--animation-order) * 0.1s);
    opacity: 0;
}

body:not(.single-page-mode) .section.active .contact-info {
    animation: slideInFromLeft 0.7s forwards;
    opacity: 0;
}
body:not(.single-page-mode) .section.active .contact-form {
    animation: slideInFromRight 0.7s forwards;
    opacity: 0;
}


/* Preloader Fade Out */
.preloader.fade-out {
    animation: fadeOut 0.5s forwards;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; visibility: hidden; }
}