/* 기본 스타일 리셋 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Noto Sans KR', sans-serif;
}

body {
    background-color: #f0f0f0;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

/* 메인 배너 스타일 */
.main-banner {
    background-color: #0078ff;
    color: white;
    padding: 30px;
    text-align: center;
    border-radius: 8px;
    margin-bottom: 30px;
}

.main-banner h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.main-banner p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 애드센스 광고 스타일 */
.adsense-banner {
    margin-bottom: 30px;
    text-align: center;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* 블로그 포스트 그리드 - CSS Grid 사용 */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 데스크탑에서 3개 열 */
    gap: 20px;
    margin-bottom: 30px;
}

/* 이전 구조 숨김 */
.post-row {
    display: none;
}

/* 포스트 카드 스타일 */
.post-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.post-img {
    background-color: #f2f2f2;
    height: 200px;
    padding: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 65px;
    /* 기본 배경색 처리 */
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.7));
}

.tag {
    position: absolute;
    top: 10px;
    left: 0;
    background-color: #0078ff;
    color: white;
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 0 4px 4px 0;
}

/* 이미지 내 제목 스타일 - 확실하게 3줄로 고정 */
.post-img h2 {
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.4;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    z-index: 2;
    text-align: left;
    white-space: normal;
    word-break: keep-all;
    height: auto;
    min-height: 4.2em;
    display: block;
    overflow: visible;
    padding: 0 10px;
}

/* 포스트 정보 내 제목 스타일 */
.post-info {
    padding: 20px;
}

.post-date {
    color: #888;
    font-size: 0.85rem;
    display: block;
    margin-bottom: 8px;
}

.post-info h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    line-height: 1.3;
    font-weight: 700;
    color: #333;
    text-align: left;
    /* 3줄 제한은 유지 */
    height: 4.2em;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-info p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 15px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 4rem;
}

.read-more {
    display: inline-block;
    padding: 8px 20px;
    background-color: #0078ff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.3s;
}

.read-more:hover {
    background-color: #0060cc;
}

/* 태블릿/모바일 반응형 디자인 */
@media screen and (max-width: 900px) {
    .blog-grid {
        grid-template-columns: repeat(2, 1fr); /* 모바일에서 2개 열 */
        gap: 20px;
    }
    
    .post-img {
        height: 180px;
    }
    
    .post-img h2 {
        font-size: 1.2rem;
        line-height: 1.4;
        min-height: 4.2em; /* 최소 3줄 높이 유지 */
    }
}

/* 작은 모바일 화면 */
@media screen and (max-width: 600px) {
    .blog-grid {
        gap: 15px;
    }
    
    .post-img {
        height: 150px;
        padding: 15px;
        padding-top: 55px;
    }
    
    .post-img h2 {
        font-size: 1.1rem;
        line-height: 1.4;
        min-height: 3.9em;
        padding: 0 8px;
        word-break: keep-all;
        white-space: normal;
        margin-top: 5px;
    }
    
    .post-info {
        padding: 15px;
    }
    
    .post-info h3 {
        font-size: 0.95rem;
    }
    
    .post-info p {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
        height: 2.5rem;
        margin-bottom: 10px;
    }
    
    .read-more {
        padding: 6px 15px;
        font-size: 0.8rem;
    }
    
    .main-banner {
        padding: 20px;
    }
    
    .main-banner h1 {
        font-size: 1.6rem;
    }
    
    .main-banner p {
        font-size: 1rem;
    }
}

/* 매우 작은 화면 */
@media screen and (max-width: 400px) {
    .blog-grid {
        grid-template-columns: 1fr;
    }
    
    .post-img {
        height: 180px;
        padding-top: 50px;
    }
    
    .post-img h2 {
        font-size: 1rem;
        line-height: 1.4;
        min-height: 3.6em;
        padding: 0 5px;
        margin-top: 8px;
    }
}