/* グローバルアニメーション変数 */
:root {
    --animation-timing: cubic-bezier(0.4, 0, 0.2, 1);
    --animation-duration: 0.8s;
}

/* 3Dテキストエフェクト */
.hero-title {
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* ローリングテキストアニメーション */
.rolling-text {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    perspective: 1000px;
}

.letter {
    display: inline-block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    opacity: 0;
    transform-origin: bottom;
    transform: rotateX(-90deg);
    transition: all 0.5s var(--animation-timing);
}

.letter.visible {
    opacity: 1;
    transform: rotateX(0);
}

.letter:hover {
    color: var(--accent-color);
    transform: scale(1.2);
    transition: all 0.3s ease;
}

/* グロー効果 */
@keyframes glow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(255,255,255,0.8),
                     0 0 20px rgba(255,255,255,0.8),
                     0 0 30px rgba(255,255,255,0.8),
                     0 0 40px var(--primary-color),
                     0 0 70px var(--primary-color),
                     0 0 80px var(--primary-color),
                     0 0 100px var(--primary-color),
                     0 0 150px var(--primary-color);
    }
    50% {
        text-shadow: 0 0 5px rgba(255,255,255,0.8),
                     0 0 10px rgba(255,255,255,0.8),
                     0 0 15px rgba(255,255,255,0.8),
                     0 0 20px var(--primary-color),
                     0 0 35px var(--primary-color),
                     0 0 40px var(--primary-color),
                     0 0 50px var(--primary-color),
                     0 0 75px var(--primary-color);
    }
}

/* スクロールアニメーション */
.fade-up {
    opacity: 0;
    transform: translateY(50px) scale(0.95);
    transition: all var(--animation-duration) var(--animation-timing);
}

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

/* サービスカードアニメーション */
.service-card {
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.5s var(--animation-timing);
}

.service-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.service-card:hover {
    transform: translateY(-10px);
}

.services .service-grid .service-card h3 {
    color: var(--primary-color) !important;
    transition: color 0.3s ease;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: 0.5s;
}

.service-card:hover::before {
    left: 100%;
}

.service-card i {
    transition: all 0.3s ease;
}

.service-card:hover i {
    transform: scale(1.2) rotate(360deg);
    color: var(--primary-color);
}

/* ワークカードアニメーション */
.work-card {
    position: relative;
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.5s var(--animation-timing);
    overflow: hidden;
}

.work-card.visible {
    opacity: 1;
    transform: scale(1);
}

.work-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        45deg,
        rgba(var(--primary-color-rgb), 0.1),
        rgba(var(--accent-color-rgb), 0.1)
    );
    opacity: 0;
    transition: 0.5s ease;
}

.work-card:hover::after {
    opacity: 1;
}

.work-card:hover .work-image img {
    transform: scale(1.1) rotate(2deg);
}

.work-card .work-content {
    transform: translateY(20px);
    opacity: 0;
    transition: 0.5s ease;
}

.work-card.visible .work-content {
    transform: translateY(0);
    opacity: 1;
}

/* パーティクル効果 */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.particle {
    position: absolute;
    background: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.8) 0%,
        rgba(255, 255, 255, 0) 70%
    );
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    animation: particleFade 3s infinite ease-out;
}

@keyframes particleFade {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    20% {
        opacity: 0.5;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(2);
    }
}

/* CTAボタンアニメーション */
.cta-button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    z-index: 1;
}

.cta-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300%;
    height: 300%;
    background: radial-gradient(
        circle,
        rgba(var(--primary-color-rgb), 0.8) 0%,
        rgba(var(--accent-color-rgb), 0.8) 100%
    );
    transition: 0.8s ease;
    z-index: -1;
    transform: translate(-50%, -50%) scale(0);
}

.cta-button:hover::before {
    transform: translate(-50%, -50%) scale(1);
}

.cta-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* ナビゲーションアニメーション */
.nav-menu a {
    position: relative;
    overflow: hidden;
}

.nav-menu a::before,
.nav-menu a::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.nav-menu a::before {
    top: 0;
    left: 0;
    transform-origin: left;
}

.nav-menu a::after {
    bottom: 0;
    right: 0;
    transform-origin: right;
}

.nav-menu a:hover::before {
    transform: scaleX(1);
}

.nav-menu a:hover::after {
    transform: scaleX(1);
}

/* スクロールインジケーター */
.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    animation: fadeInUp 1s ease forwards 1s;
}

.scroll-indicator::before {
    content: '';
    display: block;
    width: 2px;
    height: 30px;
    background: var(--primary-color);
    margin: 0 auto;
    animation: scrollDown 2s ease infinite;
}

@keyframes scrollDown {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    50% {
        transform: translateY(10px);
        opacity: 0.5;
    }
    100% {
        transform: translateY(20px);
        opacity: 0;
    }
}

/* セクションヘッダーアニメーション */
.section-header {
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s var(--animation-timing);
}

.section-header.visible {
    opacity: 1;
    transform: translateY(0);
}

.section-header::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    width: 50px;
    height: 3px;
    background: linear-gradient(
        90deg,
        var(--primary-color),
        var(--accent-color)
    );
    transform: translateX(-50%) scaleX(0);
    transition: transform 0.5s ease 0.3s;
}

.section-header.visible::after {
    transform: translateX(-50%) scaleX(1);
}
