/* ========================================
   リセット・ベーススタイル
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f9fa;
    color: #2c3e50;
    line-height: 1.6;
}

/* ========================================
   ヘッダー
   ======================================== */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 900;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.header .subtitle {
    font-size: 1rem;
    font-weight: 300;
    opacity: 0.95;
}

/* ========================================
   コンテナ・レイアウト
   ======================================== */
.container {
    width: 100%;
}

.main-content {
    display: flex;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* ========================================
   サイドバー：カテゴリ一覧
   ======================================== */
.sidebar {
    width: 250px;
    flex-shrink: 0;
}

.sidebar h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #2c3e50;
    padding-bottom: 1rem;
    border-bottom: 2px solid #667eea;
}

.category-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-item {
    transition: all 0.3s ease;
}

.category-button {
    width: 100%;
    padding: 0.875rem 1rem;
    background-color: white;
    color: #2c3e50;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
}

.category-button:hover {
    background-color: #f0f4ff;
    border-color: #667eea;
    color: #667eea;
    transform: translateX(4px);
}

.category-item.active .category-button {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* ========================================
   プロジェクトセクション
   ======================================== */
.projects-section {
    flex: 1;
    min-width: 0;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   プロジェクトカード
   ======================================== */
.project-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.project-card.hidden {
    display: none;
}

.project-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: transform 0.3s ease;
}

.project-card:hover .project-image {
    transform: scale(1.05);
}

.project-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.project-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.project-category {
    margin-bottom: 1rem;
    flex-grow: 1;
}

.category-badge {
    display: inline-block;
    background-color: #e8eaf6;
    color: #667eea;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-footer {
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.view-btn {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.view-btn:active {
    transform: scale(0.98);
}

/* ========================================
   モーダル
   ======================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    z-index: 1000;
    animation: modalAppear 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes modalAppear {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    animation: overlayFadeIn 0.3s ease;
}

@keyframes overlayFadeIn {
    from {
        background-color: rgba(0, 0, 0, 0);
    }
    to {
        background-color: rgba(0, 0, 0, 0.6);
    }
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: contentSlideIn 0.3s ease;
    z-index: 1001;
}

@keyframes contentSlideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2rem;
    height: 2rem;
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1002;
}

.modal-close:hover {
    background-color: white;
    transform: rotate(90deg);
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
}

.modal-image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 300px;
    margin: 0 auto;
    object-fit: contain;
    border-radius: 8px;
}

.modal-info {
    display: flex;
    flex-direction: column;
}

.modal-info h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.modal-category {
    margin-bottom: 1.5rem;
}

.modal-description {
    flex: 1;
}

.modal-description h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.75rem;
}

.modal-description p {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.7;
    text-align: justify;
}

/* ========================================
   レスポンシブ対応
   ======================================== */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
        gap: 2rem;
    }

    .sidebar {
        width: 100%;
    }

    .sidebar h2 {
        display: inline-block;
        margin-right: 2rem;
        border-bottom: none;
        border-right: 2px solid #667eea;
        padding-right: 2rem;
    }

    .category-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1rem;
    }

    .category-item {
        flex: 0 1 auto;
    }

    .category-button {
        white-space: nowrap;
    }

    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }

    .modal-body {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .header .subtitle {
        font-size: 0.9rem;
    }

    .main-content {
        padding: 1rem;
    }

    .sidebar h2 {
        display: block;
        border-right: none;
        border-bottom: 2px solid #667eea;
        padding-right: 0;
        padding-bottom: 1rem;
        margin-right: 0;
    }

    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }

    .project-image {
        height: 150px;
    }

    .project-info {
        padding: 1rem;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-body {
        padding: 1.5rem;
        gap: 1.5rem;
    }

    .modal-image {
        max-height: 200px;
    }

    .modal-info h2 {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1.5rem 1rem;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .main-content {
        padding: 1rem 0.5rem;
        gap: 1rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-close {
        width: 1.8rem;
        height: 1.8rem;
        font-size: 1.2rem;
    }
}

/* ========================================
   スクロールバーのスタイリング（Webkit系）
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}
