:root {
    --primary-color: #333;
    --border-color: #eee;
    --text-muted: #888;
}

.board-wrapper { max-width: 1100px; margin: 0 auto; padding: 20px; }

/* 컨트롤 바 */
.board-control { 
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid var(--border-color);
}
.view-switch button:not(.btn-search) {
    background: #fff; border: 1px solid var(--border-color); padding: 6px 12px;
    cursor: pointer; font-size: 14px; transition: 0.2s;
}
.view-switch button.active { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }

/* 공통 리스트 컨테이너 */
.list-container { display: grid; gap: 20px; }

/* [갤러리형 모드] - 이미지 중심의 카드 타입 */
.gallery-view { 
    grid-template-columns: repeat(5, 1fr); 
    gap: 12px; /* 아이템 사이 간격도 좁게 조정 */
}
.gallery-view .post-item { 
    display: flex;
    flex-direction: column; 
    border: 1px solid var(--border-color); 
    border-radius: 6px; /* 모서리 곡률도 살짝 줄여서 샤프하게 */
    overflow: hidden; 
    background: #fff;
    height: 100%;
    cursor: pointer;
}

.gallery-view .post-thumb { 
    width: 100%; 
    aspect-ratio: 16 / 9; 
    overflow: hidden;
    background-color: #f8f8f8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-view .post-thumb img {
    /* 핵심 수정 사항 */
    width: 100%;
    height: 100%;
    object-fit: contain; /* 이미지가 잘리지 않고 영역 안에 전체가 다 보임 */
    display: block;
}

.gallery-view .post-info { 
    padding: 10px; 
    flex-grow: 1; /* 제목이 짧아도 아래쪽 여백을 동일하게 채움 */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.gallery-view .post-title { 
    font-size: 14px; 
    margin-bottom: 4px;
	line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery-view .post-meta { 
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.gallery-view .post-meta span { 
    display: block;
    margin-bottom: 10px; /* 줄 간격 */
}

/* [NO DATA] */
.no-data {
	grid-column: 1 / -1; /* 1번 칸부터 끝까지 확장 */
    width: 100%;
    padding: 50px 0;
    text-align: center;
}

.no-data p {
    color: #999;
    font-size: 0.9rem;
    margin: 0;
}

/* 반응형 처리 및 모바일 최적화 */
@media (max-width: 768px) {
    /* 1. 컨트롤 바 조정 */
    .board-control {
        flex-direction: column; /* 세로 정렬 */
        align-items: flex-start;
        gap: 12px;
        padding-bottom: 10px;
    }

    .view-switch {
        width: 100%;
        display: flex;
        gap: 5px;
    }

    .view-switch button {
        flex: 1; /* 버튼들이 동일한 너비를 가짐 */
        padding: 10px 0;
        font-size: 13px;
    }

    /* 2. 갤러리 리스트: 2열 배치로 변경 */
    .gallery-view {
        grid-template-columns: repeat(2, 1fr); 
        gap: 10px;
        padding: 0;
    }

    /* 3. 개별 포스트 아이템: 카드 스타일 강화 */
    .gallery-view .post-item {
        border: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); /* 은은한 그림자 */
        border-radius: 12px; /* 좀 더 둥글게 */
        transition: transform 0.2s;
    }

    .gallery-view .post-item:active {
        transform: scale(0.98); /* 터치 시 눌리는 효과 */
    }

    /* 4. 섬네일: 비율 유지 및 꽉 채우기 */
    .gallery-view .post-thumb {
        aspect-ratio: 1 / 1; /* 모바일은 정사각형이 더 예쁩니다 */
        border-radius: 12px 12px 0 0;
    }

    .gallery-view .post-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover; /* 잘리더라도 영역을 꽉 채워 풍성해 보이게 함 */
    }

    /* 5. 텍스트 정보 최적화 */
    .gallery-view .post-info {
        padding: 12px 8px;
    }

    .gallery-view .post-title {
        font-size: 13px;
        font-weight: 600;
        margin-bottom: 6px;
        -webkit-line-clamp: 2; /* 제목이 길면 2줄까지 표시 */
    }

    .gallery-view .post-meta {
        flex-direction: row; /* 날짜와 작성자를 한 줄에 */
        justify-content: space-between;
        align-items: center;
        gap: 0;
    }

    .gallery-view .post-meta span {
        font-size: 11px;
        color: #aaa;
        margin-bottom: 0; /* 기존 여백 제거 */
    }
    
    .gallery-view .post-meta .author::before {
        content: "|";
        margin: 0 4px;
        color: #eee;
    }
}

/* 아주 작은 기기 (아이폰 SE 등) */
@media (max-width: 380px) {
    .gallery-view {
        grid-template-columns: 1fr; /* 1열로 변경하여 가독성 확보 */
    }
}