/* ========================================
   アニメーション専用CSS
   自然で上品な動きを追加
======================================== */

/* ========================================
   1. ヘッダー固定とスクロール時の影
======================================== */

.fv-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

/* スクロール時に影を追加 */
.fv-header.scrolled {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    background-color: rgba(255, 255, 255, 0.98);
}

/* ヘッダー固定に伴うFirst Viewの調整 */
.first-view {
    padding-top: 0;
}

/* ========================================
   2. フェードイン系アニメーション
   スクロール時にふわっと表示
======================================== */

/* 基本のフェードイン（下から） */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in-up.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* フェードイン（左から） */
.fade-in-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in-left.is-visible {
    opacity: 1;
    transform: translateX(0);
}

/* フェードイン（右から） */
.fade-in-right {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in-right.is-visible {
    opacity: 1;
    transform: translateX(0);
}

/* フェードイン + スケール（First View用） */
.fade-in-scale {
    opacity: 0;
    transform: scale(0.95);
    animation: fadeInScale 1.2s ease forwards;
    animation-delay: 0.3s;
}

@keyframes fadeInScale {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================
   3. First Viewのテキストラベルアニメーション
======================================== */

.slide-in-left {
    opacity: 0;
    transform: translateX(-60px);
    animation: slideInLeft 0.8s ease forwards;
    animation-delay: 0.6s;
}

@keyframes slideInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-right {
    opacity: 0;
    transform: translateX(60px);
    animation: slideInRight 0.8s ease forwards;
    animation-delay: 0.8s;
}

@keyframes slideInRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   4. ホバーアニメーション（控えめ）
======================================== */

/* 画像のホバー */
.works-image,
.about-image {
    transition: transform 0.4s ease;
}

.works-image:hover,
.about-image:hover {
    transform: translateY(-4px);
}

.works-image img,
.about-image img {
    transition: transform 0.6s ease, filter 0.4s ease;
}

.works-image:hover img {
    transform: scale(1.05);
}

.about-image:hover img {
    transform: scale(1.03);
    filter: brightness(1.05);
}

/* タグのホバー */
.tag {
    transition: all 0.3s ease;
}

.tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(119, 176, 255, 0.2);
}

/* ボタンのホバー */
.about-link,
.all-view-btn,
.contact-email {
    transition: all 0.3s ease;
}

.about-link:hover,
.all-view-btn:hover,
.contact-email:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 詳しく見るボタン */
.detail-btn {
    transition: all 0.3s ease;
}

.detail-btn:hover {
    transform: translateX(6px);
}

/* ========================================
   5. 画像の読み込みアニメーション
======================================== */

.image-placeholder img {
    opacity: 0;
    transition: opacity 0.6s ease;
}

.image-placeholder img.loaded {
    opacity: 1;
}

/* ========================================
   6. ナビゲーションメニューのアニメーション強化
======================================== */

.nav-item {
    transition: opacity 0.5s ease, transform 0.5s ease;
}

/* メニューリンクのホバー */
.nav-link {
    position: relative;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #77B0FF;
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* ========================================
   7. セクション間の滑らかな遷移
======================================== */

section {
    transition: opacity 0.3s ease;
}

/* ========================================
   8. スクロールバーのカスタマイズ（オプション）
======================================== */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 4px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* ========================================
   9. パフォーマンス最適化
======================================== */

/* アニメーション完了後の最適化 */
.animation-complete {
    transition: none !important;
}

/* GPU アクセラレーション */
.fade-in-up,
.fade-in-left,
.fade-in-right,
.fade-in-scale,
.slide-in-left,
.slide-in-right {
    will-change: transform, opacity;
}

/* アニメーション完了後にwill-changeを解除 */
.is-visible {
    will-change: auto;
}

/* ========================================
   10. レスポンシブ対応
======================================== */

@media (max-width: 768px) {
    /* モバイルではアニメーション距離を短く */
    .fade-in-up {
        transform: translateY(20px);
    }
    
    .fade-in-left {
        transform: translateX(-20px);
    }
    
    .fade-in-right {
        transform: translateX(20px);
    }
    
    /* ホバーアニメーションを控えめに */
    .works-image:hover,
    .about-image:hover {
        transform: translateY(-2px);
    }
}

@media (max-width: 480px) {
    /* スマホでは一部のホバーアニメーションを無効化 */
    .works-image:hover img,
    .about-image:hover img {
        transform: scale(1);
    }
}

/* ========================================
   11. アクセシビリティ対応
======================================== */

/* アニメーションを無効化する設定の場合 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .fade-in-up,
    .fade-in-left,
    .fade-in-right,
    .fade-in-scale,
    .slide-in-left,
    .slide-in-right {
        opacity: 1;
        transform: none;
    }
}