/* Import Noto Sans Japanese from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: #eeebdd;
    color: #3f4691;
    line-height: 1.6;
}

header {
    padding: 30px 50px 20px 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eeebdd;
    background-color: #eeebdd;
    width: 100%;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
}

.logo-image {
    height: 50px;
    width: auto;
    transition: opacity 0.3s;
}

.logo-image:hover {
    opacity: 0.8;
}

nav {
    padding: 20px 50px;
    border-bottom: 1px solid #eeebdd;
}

nav ul {
    display: flex;
    list-style: none;
}

nav ul li {
    margin-right: 30px;
}

nav ul li a {
    text-decoration: none;
    color: #888;
    font-size: 16px;
    transition: color 0.3s;
}

nav ul li a:hover {
    color: #3f4691;
}

/* ページタイトル部分のスタイル */
.page-title {
    padding: 30px 0px 10px 50px;
}

.title-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.title-text {
    font-size: 20px;
    font-weight: normal;
    margin: 0;
}

/* タグフィルター部分のスタイル */
.tag-filter-section {
    padding: 10px 0px 20px 50px;
}

.controls-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1400px;
    gap: 20px;
}

.back-arrow {
    margin-right: 20px;
    color: #ffffff;
    font-size: 24px;
    text-decoration: none;
}

.tag-filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    flex: 1;
}

.tag-filter {
    padding: 8px 16px;
    background-color: #ffffff;
    border: 1px solid #ffffff;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: #666;
}

.tag-filter:hover {
    background-color: #ffffff;
    color: #333;
}

.tag-filter.active {
    background-color: #3f4691;
    color: white;
    border-color: #3f4691;
}

/* ソートボタンのスタイル */
.sort-button {
    padding: 6px 12px;
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
    white-space: nowrap;
}

.sort-button:hover {
    background-color: #e8e8e8;
    color: #333;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 最大4列に固定 */
    gap: 20px; /* 余白を調整 */
    padding: 20px 30px 30px; /* パディングも調整 */
    max-width: 1400px; /* 最大幅を調整して4列に制限 */
    margin: 0 auto;
    background-color: #eeebdd;
}

.project-card {
    text-decoration: none;
    color: inherit;
    display: block;
    position: relative; /* 子要素の絶対位置指定の基準点 */
    transition: opacity 0.3s ease;
}

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

.fixed-image-square {
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* 正方形を維持 */
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    z-index: 3;
}

.fixed-image-square  {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    transition: clip-path 0.3s ease;
    clip-path: inset(0% 0% 0% 0%);
}

.fixed-image-square:hover  {
    clip-path: inset(10% 10% 10% 10%);
}

/* タッチデバイス: ホバー効果を無効化し、.touched クラスで代替 */
@media (hover: none) {
    .fixed-image-square:hover {
        clip-path: inset(0% 0% 0% 0%);
    }

    .fixed-image-square.touched {
        clip-path: inset(10% 10% 10% 10%);
    }
}

    
/* タイトル用の透明正方形 */
.fixed-text-square {
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* 正方形を維持 */
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2; /* 色付き正方形より下に配置 */
}

/* 色付き正方形 - ホバー時に縮小するのみ */
.project-square {
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* 正方形を維持 */
    position: relative;
    background-color: #80a0c0; /* デフォルトの背景色 - 落ち着いた青 */ 
    z-index: 1; /* 固定テキスト正方形の上、固定画像正方形の下に表示 */
    transform-origin: center; /* 縮小の中心点を明示的に設定 */
}

/* タグ別カラー設定 */
.project-card[data-tags*="Design"] .project-square {
    background-color: #eeebdd; /* 赤系 */
}

.project-card[data-tags*="Research"] .project-square {
    background-color: #eeebdd; /* 青系 */
}

.project-card[data-tags*="Thesis"] .project-square {
    background-color: #eeebdd; /* 緑系 */
}

.project-card[data-tags*="Reading"] .project-square {
    background-color: #eeebdd; /* オレンジ系 */
}

.project-card[data-tags*="Publication"] .project-square {
    background-color: #eeebdd; /* 紫系 */
}

.project-card[data-tags*="Event"] .project-square {
    background-color: #eeebdd; /* 黄系 */
}


/* 画像コンテナを固定画像正方形内に配置 */
.project-image-container {
    position: absolute;
    top: 0%;
    left: 0%;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* 画像自体のスタイル */
.project-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* プロジェクト情報テキスト - 画像と同じ左端位置に配置 */
.project-info {
    font-size: 15px;
    position: absolute;
    bottom: 5px;
    left: 10%; /* 画像コンテナと同じ左オフセット */
    color: #3f4691; /* 文字色を白に */
}

/* プロジェクトタイトル - 太字 */
.project-title {
    font-weight: bold;
}

/* 区切り文字 - 細字 */
.project-separator {
    font-weight: normal;
}

/* 日付 - 細字 */
.project-date {
    font-weight: normal;
}

/* メディアクエリの改善 */
@media (max-width: 768px) {
    header {
        padding: 15px 30px;
    }
    
    .logo-image {
        height: 35px;
    }
    
    nav, .page-title, .tag-filter-section {
        padding-left: 30px;
        padding-right: 30px;
    }
    
    .title-text {
        font-size: 18px;
    }
    
    .title-container {
        justify-content: space-between;
        align-items: center;
        gap: 10px;
    }
    
    .tag-filters {
        gap: 10px;
    }
    
    .tag-filter {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .sort-button {
        font-size: 11px;
        padding: 5px 10px;
    }
}

@media (max-width: 600px) {
    header, nav, .page-title {
        padding: 12px 20px;
    }
    
    .logo-image {
        height: 30px;
    }
    
    nav ul {
        flex-wrap: wrap;
    }
    
    nav ul li {
        margin-right: 15px;
        margin-bottom: 5px;
    }
    
    .title-text {
        font-size: 16px;
    }
}

/* スマートフォン向けの調整 */
@media (max-width: 480px) {
    header {
        padding: 10px 15px;
    }
    
    .logo-image {
        height: 25px;
    }
    
    .page-title {
        padding: 10px 15px;
    }
    
    .title-text {
        font-size: 15px;
    }
}

/* レスポンシブなメディアクエリを調整 - 最大4列に制限 */
@media (min-width: 1101px) {
    .projects-grid {
        grid-template-columns: repeat(4, 1fr); /* 大きな画面でも最大4列 */
    }
}

@media (min-width: 851px) and (max-width: 1100px) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px; /* さらに余白を減らす */
    }
}

@media (min-width: 551px) and (max-width: 850px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px; /* さらに余白を減らす */
        padding: 15px 20px 20px;
    }
}

@media (max-width: 550px) {
    .projects-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 15px; /* 縦方向の余白も調整 */
        padding: 10px 15px 20px;
    }
}
