/* 
 * TGM Wood Factory - パーティクル・スプラッシュエフェクト
 * 木くずが散るようなナビゲーションエフェクト
 * 全メニューアイテム対応版
 */

/* ナビゲーションリンクの基本設定 */
.nav-link {
    position: relative;
    transition: all 0.3s ease;
}

/* パーティクルコンテナ - 全てのnavリンクに適用 */
.nav-link::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, transparent 0%, transparent 30%, rgba(205, 166, 127, 0.4) 30%, rgba(155, 118, 83, 0.3) 70%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
    z-index: -1;
}

/* ホバー時のエフェクト - 全てのnavリンクに適用 */
.nav-link:hover::before {
    width: 100px;
    height: 100px;
    opacity: 0.4;
    animation: particleSplash 0.6s ease-out forwards;
}

/* ホバー時のテキスト効果 */
.nav-link:hover {
    animation: textGlow 0.3s ease-in-out;
    color: var(--color-primary);
}

/* パーティクルスプラッシュアニメーション */
@keyframes particleSplash {
    0% {
        width: 0;
        height: 0;
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
    30% {
        width: 60px;
        height: 60px;
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        width: 120px;
        height: 120px;
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.8);
    }
}

/* テキストグロー効果 */
@keyframes textGlow {
    0% {
        text-shadow: none;
    }
    50% {
        text-shadow: 0 0 8px rgba(155, 118, 83, 0.4), 0 0 12px rgba(205, 166, 127, 0.3);
    }
    100% {
        text-shadow: 0 0 4px rgba(155, 118, 83, 0.2);
    }
}

/* パーティクル生成のためのJavaScript用クラス */
.particle {
    position: fixed !important;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    animation: particleFly 0.8s ease-out forwards;
}

/* 木くずタイプのパーティクル */
.particle.wood-chip {
    border-radius: 30% 70% 40% 60%;
    background: linear-gradient(135deg, 
        rgba(155, 118, 83, 0.8) 0%, 
        rgba(205, 166, 127, 0.9) 50%, 
        rgba(60, 36, 21, 0.7) 100%);
    box-shadow: 0 1px 3px rgba(60, 36, 21, 0.3);
}

/* おがくずタイプのパーティクル */
.particle.sawdust {
    border-radius: 50%;
    background: radial-gradient(circle, 
        rgba(205, 166, 127, 0.8) 0%, 
        rgba(155, 118, 83, 0.6) 70%, 
        transparent 100%);
    opacity: 0.7;
}

/* パーティクルの飛散アニメーション */
@keyframes particleFly {
    0% {
        opacity: 1;
        transform: scale(1) translate(0, 0) rotate(0deg);
    }
    25% {
        opacity: 0.9;
        transform: scale(1.2) translate(calc(var(--random-x, 50px) * 0.3), calc(var(--random-y, -30px) * 0.3)) rotate(90deg);
    }
    75% {
        opacity: 0.4;
        transform: scale(0.8) translate(calc(var(--random-x, 50px) * 0.8), calc(var(--random-y, -30px) * 0.8)) rotate(270deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.3) translate(var(--random-x, 50px), var(--random-y, -30px)) rotate(360deg);
    }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .nav-link::before {
        max-width: 60px;
        max-height: 60px;
    }
    
    @keyframes particleSplash {
        0% {
            width: 0;
            height: 0;
            opacity: 0;
        }
        30% {
            width: 30px;
            height: 30px;
            opacity: 0.6;
        }
        100% {
            width: 60px;
            height: 60px;
            opacity: 0;
        }
    }
    
    /* モバイルではパーティクル数を減らす */
    .particle {
        animation-duration: 0.6s;
    }
}

/* パフォーマンス向上 */
.nav-link,
.nav-link::before,
.particle {
    will-change: transform, opacity;
}

/* アクセシビリティ：アニメーションを無効にする設定 */
@media (prefers-reduced-motion: reduce) {
    .nav-link::before,
    .nav-link:hover,
    .particle {
        animation: none !important;
        transition: opacity 0.2s ease !important;
    }
    
    .nav-link:hover::before {
        opacity: 0.2;
    }
}

/* サブメニューの矢印との共存設定 */
.nav-item.has-submenu > .nav-link {
    /* サブメニューがあってもパーティクルエフェクトは同じように適用 */
    overflow: visible;
}

/* contact-btnとexternal-btnは除外 */
.nav-link.contact-btn::before,
.nav-link.external-btn::before {
    display: none;
}

.nav-link.contact-btn:hover,
.nav-link.external-btn:hover {
    animation: none;
}
