/**
 * Smooth Scroll Styles
 * スムーススクロール関連スタイル
 */

/* HTML要素のスクロール動作設定 */
html {
    scroll-behavior: smooth;
}

/* スクロールバーのスタイル設定 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* スクロールターゲットのハイライト効果 */
.scroll-target-highlight {
    position: relative;
    overflow: hidden;
}

.scroll-target-highlight::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 193, 7, 0.3),
        transparent
    );
    animation: scrollShine 1s ease-in-out;
    pointer-events: none;
    z-index: 1;
}

@keyframes scrollShine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* アクティブナビゲーションスタイル */
.navbar-nav .nav-link.active {
    color: var(--accent-color) !important;
    font-weight: 600;
    position: relative;
}

.navbar-nav .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--accent-color);
    border-radius: 1px;
    animation: activeNavSlide 0.3s ease-in-out;
}

@keyframes activeNavSlide {
    from {
        width: 0;
        opacity: 0;
    }
    to {
        width: 20px;
        opacity: 1;
    }
}

/* スムーススクロールボタンのスタイル */
.smooth-scroll-btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.smooth-scroll-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.smooth-scroll-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.smooth-scroll-btn:active::after {
    width: 300px;
    height: 300px;
}

/* フォーカス時のスタイル */
.smooth-scroll-target:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 4px;
    border-radius: 4px;
}

/* セクション間のスムーズな遷移 */
section {
    transition: opacity 0.3s ease-in-out;
}

section.section-fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: sectionFadeIn 0.6s ease-in-out forwards;
}

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

/* レスポンシブ対応 */
@media (max-width: 768px) {
    /* モバイルでのスクロール速度調整 */
    html {
        scroll-behavior: smooth;
    }
    
    .navbar-nav .nav-link.active::after {
        bottom: 0;
        width: 100%;
        height: 1px;
        left: 0;
        transform: none;
    }
    
    /* モバイルでのスクロールハイライト調整 */
    .scroll-target-highlight {
        padding: 10px;
        margin: -10px;
        border-radius: 8px;
    }
}

@media (max-width: 480px) {
    /* より小さな画面での調整 */
    .smooth-scroll-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .scroll-target-highlight::before {
        background: linear-gradient(
            90deg,
            transparent,
            rgba(255, 193, 7, 0.2),
            transparent
        );
    }
}

/* プリフィックス対応（古いブラウザサポート） */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    
    .scroll-target-highlight,
    .smooth-scroll-btn,
    section {
        animation: none !important;
        transition: none !important;
    }
}

/* 高コントラストモード対応 */
@media (prefers-contrast: high) {
    .scroll-target-highlight {
        border: 2px solid currentColor;
        background: transparent;
    }
    
    .navbar-nav .nav-link.active::after {
        background: currentColor;
        height: 3px;
    }
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
    ::-webkit-scrollbar-track {
        background: #2c2c2c;
    }
    
    ::-webkit-scrollbar-thumb {
        background: #555;
    }
    
    ::-webkit-scrollbar-thumb:hover {
        background: #777;
    }
}
