/*
 * Yi Cheng Perspective - Animations Stylesheet
 * 頁面轉場動畫與互動效果 (FR-31)
 */

/* ========================================
   Page Load Fade-In Animation
   ======================================== */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Slide-In Animation (for cards, elements)
   ======================================== */
.slide-in-up {
    animation: slideInUp 0.4s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-left {
    animation: slideInLeft 0.4s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   Button Hover Effects
   ======================================== */
.btn {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--shadow-color);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: all 0.1s ease;
}

/* Ripple effect on click */
.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.5s ease;
}

.btn:active::after {
    transform: translate(-50%, -50%) scale(40);
    opacity: 0;
    transition: transform 0.5s ease, opacity 0.3s ease;
}

/* ========================================
   Card Hover Effects
   ======================================== */
.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow-color);
}

/* ========================================
   Link Hover Effects
   ======================================== */
a {
    transition: color 0.2s ease;
}

.nav-link {
    position: relative;
    transition: color 0.2s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.3s ease, left 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
    left: 0;
}

/* ========================================
   Social Icon Hover Effects
   ======================================== */
.social-icon {
    transition: transform 0.2s ease, color 0.2s ease;
}

.social-icon:hover {
    transform: scale(1.2);
    color: var(--accent-color) !important;
}

/* ========================================
   Search Input Focus Animation
   ======================================== */
#search-input {
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

#search-input:focus {
    box-shadow: 0 0 0 3px rgba(var(--accent-color), 0.25);
    border-color: var(--accent-color);
}

/* ========================================
   Search Results Dropdown Animation
   ======================================== */
.search-results-dropdown {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease;
    opacity: 0;
}

.search-results-dropdown.show {
    max-height: 400px;
    opacity: 1;
}

/* ========================================
   Image Hover Effects (Gallery)
   ======================================== */
.gallery-item {
    transition: transform 0.3s ease;
    overflow: hidden;
}

.gallery-item:hover {
    transform: scale(1.02);
}

.gallery-item img {
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* ========================================
   Staggered Animation for Lists
   ======================================== */
.stagger-item {
    opacity: 0;
    animation: fadeIn 0.4s ease forwards;
}

.stagger-item:nth-child(1) {
    animation-delay: 0.1s;
}

.stagger-item:nth-child(2) {
    animation-delay: 0.2s;
}

.stagger-item:nth-child(3) {
    animation-delay: 0.3s;
}

.stagger-item:nth-child(4) {
    animation-delay: 0.4s;
}

.stagger-item:nth-child(5) {
    animation-delay: 0.5s;
}

.stagger-item:nth-child(6) {
    animation-delay: 0.6s;
}

/* ========================================
   Loading Spinner
   ======================================== */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}