/* ===================================
   Works Section - 制作実績セクション
   =================================== */

/* Works Section メイン */
.works-section {
    position: relative;
    background: #0f0f0f;
    min-height: 100vh;
    overflow: hidden;
    padding: 80px 0;
    color: #fff;

}

/* オーバーフロー制御用の内部コンテナ */
.works-section::after {
    content: '';
    position: absolute;
    top: 0;
    left: -10%;
    right: -10%;
    bottom: 0;
    background: linear-gradient(to right, 
        #0f0f0f 0%, 
        transparent 10%, 
        transparent 90%, 
        #0f0f0f 100%);
    pointer-events: none;
    z-index: 10;
}

/* 背景パーティクル */
.works-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
    opacity: 0.1;
}

.tech-particle {
    position: absolute;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    color: #4ecdc4;
    animation: floatUpRotate 20s infinite linear;
    opacity: 0;
}

@keyframes floatUpRotate {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.5;
    }
    90% {
        opacity: 0.5;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* セクションインナー */
.works-section-inner {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    z-index: 2;
}

/* ヘッダー */
.works-section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.works-title-en {
    font-size: 1rem;
    letter-spacing: 0.3em;
    color: #4ecdc4;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.works-title-ja {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 900;
    color: #fff;
    margin-bottom: 0;
}

    /* カードコンテナ */
    .works-cards-container {
        position: relative;
        width: 100%;
        height: 500px;
        display: flex;
        align-items: center;
        justify-content: center;
        perspective: 1200px;
        margin-bottom: 3rem;
        overflow: visible; /* overflowをvisibleに変更 */
    }
    
    /* モバイルでのカードコンテナ調整 */
    @media (max-width: 768px) {
        .works-cards-container {
            height: 450px; /* モバイルでは少し小さく */
            margin-bottom: 100px; /* スワイプヒント用の余白を増加 */
        }
    }

/* ワークカード */
.work-card {
    position: absolute;
    width: 400px;
    max-width: 90vw;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    transform-style: preserve-3d;
}

.work-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* カード画像 */
.card-image-wrapper {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    background: #1a1a1a;
}

/* プレースホルダー画像のスタイル */
.card-image[src^="data:image/png"] {
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.work-card:hover .card-image {
    transform: scale(1.1);
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.8) 100%);
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.work-card:hover .card-overlay {
    opacity: 0.8;
}

/* カード番号 */
.card-number {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.2);
    z-index: 2;
}

/* カードコンテンツ */
.card-content {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.8rem;
    line-height: 1.4;
}

.card-description {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1rem;
    line-height: 1.5;
    max-height: 4.5em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* タグ */
.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: rgba(78, 205, 196, 0.1);
    border: 1px solid var(--tag-color, #4ecdc4);
    color: var(--tag-color, #4ecdc4);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tag:hover {
    background: var(--tag-color, #4ecdc4);
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(78, 205, 196, 0.3);
}

/* ナビゲーション */
.works-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.works-nav-prev,
.works-nav-next {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #fff;
    font-size: 1.5rem;
}

.works-nav-prev:hover,
.works-nav-next:hover {
    background: rgba(78, 205, 196, 0.2);
    border-color: #4ecdc4;
    transform: scale(1.1);
}

/* インジケーター */
.works-indicators {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.indicator-dot {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.indicator-dot.active {
    width: 24px;
    background: #4ecdc4;
    border-radius: 4px;
}

.indicator-dot:hover {
    background: rgba(78, 205, 196, 0.5);
}

/* モバイル対応 */
@media (max-width: 768px) {
    .works-section {
        padding: 60px 0;
        min-height: auto;
    }
    
    .works-section-inner {
        padding: 0 1rem;
    }
    
    .works-section-header {
        margin-bottom: 2rem;
    }
    
    .works-title-en {
        font-size: 0.9rem;
    }
    
    .works-title-ja {
        font-size: 1.8rem;
    }
    
    .works-cards-container {
        height: 400px;
        margin-bottom: 2rem;
    }
    
    .work-card {
        width: 85%;
        max-width: 320px;
    }
    
    .card-image-wrapper {
        height: 200px;
    }
    
    .card-content {
        padding: 1.2rem;
    }
    
    .card-title {
        font-size: 1rem;
    }
    
    .card-number {
        font-size: 1.5rem;
        top: 15px;
        right: 15px;
    }
    
    .tag {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
    }
    
    /* モバイルではナビゲーションボタンを非表示 */
    .works-navigation {
        display: none;
    }
    
    /* モバイル用のナビゲーションボタンを追加 */
    .works-navigation-mobile {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 1rem;
        margin-top: 1rem;
    }
    
    .works-nav-mobile-btn {
        background: rgba(78, 205, 196, 0.1);
        border: 2px solid rgba(78, 205, 196, 0.3);
        color: #4ecdc4;
        padding: 0.8rem 1.5rem;
        border-radius: 25px;
        cursor: pointer;
        transition: all 0.3s ease;
        font-size: 0.9rem;
        font-weight: 500;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    .works-nav-mobile-btn:hover {
        background: rgba(78, 205, 196, 0.2);
        border-color: #4ecdc4;
        transform: scale(1.05);
    }
    
    .works-nav-mobile-btn:active {
        transform: scale(0.95);
    }
    
    .works-nav-mobile-btn:disabled {
        opacity: 0.3;
        cursor: not-allowed;
        transform: none;
        pointer-events: none;
    }
    
    /* スワイプヒント */
    .works-cards-container::after {
        content: '← スワイプ →';
        position: absolute;
        bottom: -30px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 0.8rem;
        color: rgba(255, 255, 255, 0.5);
        animation: fadeInOut 3s infinite;
    }
    
    @keyframes fadeInOut {
        0%, 100% { opacity: 0.3; }
        50% { opacity: 0.8; }
    }
}

/* タブレット対応 */
@media (min-width: 769px) and (max-width: 1024px) {
    .work-card {
        width: 350px;
    }
    
    .card-image-wrapper {
        height: 220px;
    }
}

/* 既存のworks-section.cssの最後に以下を追加 */

/* デスクトップではモバイルナビゲーションを非表示 */
@media (min-width: 769px) {
    .works-navigation-mobile {
        display: none !important;
    }
    
    /* デスクトップでは通常のナビゲーションを表示 */
    .works-navigation {
        display: flex !important;
    }
}

/* モバイル専用の追加スタイル */
@media (max-width: 768px) {
    /* セクション全体の調整 */
    .works-section {
        padding: 40px 0 60px; /* 上下パディングを削減 */
    }
    
    /* ヘッダーの余白調整 */
    .works-section-header {
        margin-bottom: 1.5rem; /* 3remから削減 */
    }
    
    /* カードコンテナの初期表示を改善 */
    .works-cards-container {
        min-height: 400px; /* 最小高さを確保 */
        position: relative;
        overflow: visible; /* オーバーフローを表示に変更 */
        margin-bottom: 80px; /* スワイプヒント用の余白 */
    }
    
    /* モバイルでの初期表示を安定化 */
    .work-card {
        position: absolute;
        width: 85vw; /* ビューポート幅の85%に拡大 */
        max-width: 350px; /* 最大幅を拡大 */
        visibility: visible !important; /* 確実に表示 */
        transform-origin: center center;
        left: 50%;
        transform: translateX(-50%); /* 中央配置の基準 */
    }
    
    /* 最初のカードを確実に表示 */
    .work-card[data-index="0"] {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateX(-50%) scale(1) !important;
        z-index: 3;
    }
    
    /* 2番目のカードを少し見えるように */
    .work-card[data-index="1"] {
        opacity: 0.3 !important;
        visibility: visible !important;
        transform: translateX(calc(-50% + 60px)) scale(0.9) !important;
        z-index: 2;
    }
    
    /* 3番目のカードも少し見えるように */
    .work-card[data-index="2"] {
        opacity: 0.1 !important;
        visibility: visible !important;
        transform: translateX(calc(-50% + 120px)) scale(0.8) !important;
        z-index: 1;
    }
    
    /* カード画像のアスペクト比を調整 */
    .card-image-wrapper {
        height: 0;
        padding-bottom: 62.5%; /* 16:10のアスペクト比 */
        position: relative;
    }
    
    .card-image {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    /* タグのサイズ調整 */
    .card-tags {
        gap: 0.3rem;
    }
    
    .tag {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
    
    /* スワイプヒントの位置調整 */
    .works-cards-container::after {
        content: '👆 スワイプして他の作品を見る →';
        position: absolute;
        bottom: -60px; /* 位置を調整 */
        left: 50%;
        transform: translateX(-50%);
        font-size: 0.9rem; /* フォントサイズを拡大 */
        color: rgba(255, 255, 255, 0.7); /* 色を濃く */
        white-space: nowrap;
        pointer-events: none;
        animation: swipeHint 3s ease-in-out infinite;
        z-index: 10;
        font-weight: 500; /* フォントウェイトを追加 */
    }
    
    @keyframes swipeHint {
        0%, 100% { 
            opacity: 0.6;
            transform: translateX(-50%) translateX(0);
        }
        50% { 
            opacity: 1;
            transform: translateX(-50%) translateX(15px);
        }
    }
    
    /* works-sectionの::afterを無効化 */
    .works-section::after {
        display: none;
    }
    
    /* パフォーマンス最適化 */
    .tech-particle {
        display: none; /* モバイルではパーティクルを非表示 */
    }
}

/* タブレット専用の調整 */
@media (min-width: 769px) and (max-width: 1024px) {
    .work-card {
        width: 340px;
    }
    
    .card-image-wrapper {
        height: 210px;
    }
    
    /* タブレットでも画像切り替えに対応 */
    .card-image {
        object-position: center center;
    }
}