/* アニメーション専用スタイルシート */

/* ローディングアニメーション */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--dark-base);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-logo {
    width: 100px;
    height: 100px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-svg {
    width: 100%;
    height: 100%;
}

.logo-svg path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    fill-opacity: 0;
    animation: draw 2s ease forwards;
}

.loading-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 20px;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-pink));
    animation: loading 2s ease-in-out forwards;
}

@keyframes draw {
    to {
        stroke-dashoffset: 0;
        fill-opacity: 1;
    }
}

@keyframes loading {
    0% {
        width: 0;
    }
    100% {
        width: 100%;
    }
}

/* スクロールアニメーション */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

.fade-in-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

.fade-in-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

.scale-in {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

/* スクロールトリガー遅延 */
.delay-100 {
    transition-delay: 0.1s;
}

.delay-200 {
    transition-delay: 0.2s;
}

.delay-300 {
    transition-delay: 0.3s;
}

.delay-400 {
    transition-delay: 0.4s;
}

.delay-500 {
    transition-delay: 0.5s;
}

/* メッセージボードデモアニメーション */
.line-message {
    background: #FFF;
    color: #000;
    padding: 10px 15px;
    border-radius: 20px;
    max-width: 80%;
    margin-bottom: 10px;
    position: relative;
    align-self: flex-end;
    opacity: 0;
    transform: translateY(20px);
    animation: messageAppear 0.5s forwards;
}

.line-message.left {
    align-self: flex-start;
    background: #8DE055;
}

.line-message.delay-1 {
    animation-delay: 1s;
}

.line-message.delay-2 {
    animation-delay: 2s;
}

.line-message.delay-3 {
    animation-delay: 3s;
}

.line-message.delay-4 {
    animation-delay: 4s;
}

@keyframes messageAppear {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.led-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--accent-blue);
    font-size: 3rem;
    font-weight: 300;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    width: 0;
    opacity: 0;
}

.led-message.active {
    animation: ledTypewriter 4s steps(50, end) 5s forwards, 
               ledBlink 1s step-end infinite;
}

@keyframes ledTypewriter {
    from {
        width: 0;
        opacity: 1;
    }
    to {
        width: 100%;
        opacity: 1;
    }
}

@keyframes ledBlink {
    from, to {
        border-right: 3px solid transparent;
    }
    50% {
        border-right: 3px solid var(--accent-blue);
    }
}

/* 3Dアニメーション効果 */
.rotate-3d {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.rotate-y {
    animation: rotateY 20s linear infinite;
}

.rotate-x {
    animation: rotateX 15s linear infinite;
}

@keyframes rotateY {
    0% {
        transform: rotateY(0deg);
    }
    100% {
        transform: rotateY(360deg);
    }
}

@keyframes rotateX {
    0% {
        transform: rotateX(0deg);
    }
    100% {
        transform: rotateX(360deg);
    }
}

/* フローティング要素アニメーション */
.float {
    animation: float 6s ease-in-out infinite;
}

.float-reverse {
    animation: float 7s ease-in-out infinite reverse;
}

.float-delay {
    animation: float 5s ease-in-out 1s infinite;
}

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

/* グロー効果 */
.glow {
    animation: glow 3s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 0 0 5px var(--accent-blue), 0 0 10px var(--accent-blue);
    }
    to {
        text-shadow: 0 0 10px var(--accent-blue), 0 0 20px var(--accent-blue), 0 0 30px var(--accent-blue);
    }
}

/* パーティクルアニメーション */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.particle {
    position: absolute;
    width: 5px;
    height: 5px;
    background: var(--accent-blue);
    border-radius: 50%;
    opacity: 0.3;
    animation: particleFloat 15s infinite linear;
}

.particle:nth-child(even) {
    background: var(--accent-pink);
}

@keyframes particleFloat {
    0% {
        transform: translateY(0) rotate(0deg);
    }
    100% {
        transform: translateY(-100vh) rotate(720deg);
    }
}

/* マウストラッカー効果 */
.mouse-tracker {
    position: fixed;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
    mix-blend-mode: lighten;
    opacity: 0.5;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.mouse-tracker.hover {
    width: 80px;
    height: 80px;
    opacity: 0.7;
}

/* カウンターアニメーション */
.counter {
    animation: none; /* JSで制御 */
}

/* スクロールプログレスバー */
.scroll-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-pink));
    z-index: 9999;
    width: 0;
    transition: width 0.1s;
}

/* グリッチエフェクト */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--dark-base);
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 var(--accent-pink);
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim-1 5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 var(--accent-blue);
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
    0% {
        clip: rect(35px, 9999px, 56px, 0);
    }
    20% {
        clip: rect(87px, 9999px, 18px, 0);
    }
    40% {
        clip: rect(12px, 9999px, 64px, 0);
    }
    60% {
        clip: rect(98px, 9999px, 78px, 0);
    }
    80% {
        clip: rect(45px, 9999px, 25px, 0);
    }
    100% {
        clip: rect(67px, 9999px, 34px, 0);
    }
}

@keyframes glitch-anim-2 {
    0% {
        clip: rect(78px, 9999px, 89px, 0);
    }
    20% {
        clip: rect(45px, 9999px, 36px, 0);
    }
    40% {
        clip: rect(86px, 9999px, 12px, 0);
    }
    60% {
        clip: rect(35px, 9999px, 69px, 0);
    }
    80% {
        clip: rect(92px, 9999px, 15px, 0);
    }
    100% {
        clip: rect(23px, 9999px, 56px, 0);
    }
}

/* グラデーションテキスト */
.gradient-text {
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-pink));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* メディアクエリ　- アニメーション最適化 */
@media (max-width: 768px) {
    /* モバイルでは一部アニメーションを軽量化 */
    .rotate-3d,
    .rotate-y,
    .rotate-x {
        animation: none;
    }
    
    .particles {
        display: none;
    }
    
    .glitch::before,
    .glitch::after {
        display: none;
    }
}

/* プリファレンス対応 - 動きを減らす設定のユーザー向け */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .particles,
    .mouse-tracker {
        display: none;
    }
}