:root {
    --primary-color: #4A55A2;
    --text-color: #333;
    --background-color: #F8F9FA;
    --card-background: #FFFFFF;
    --meta-color: #666;
    --border-color: #eee;
    --blockquote-background: #f8f9fa;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --shadow-color-strong: rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #7B83B6;
        --text-color: #E4E4E4;
        --background-color: #1A1A1A;
        --card-background: #242424;
        --meta-color: #999;
        --border-color: #333;
        --blockquote-background: #2A2A2A;
        --shadow-color: rgba(0, 0, 0, 0.2);
        --shadow-color-strong: rgba(0, 0, 0, 0.3);
    }

    .news-article {
        box-shadow: 0 4px 6px var(--shadow-color);
    }

    .article-thumbnail.placeholder {
        background: linear-gradient(135deg, #4A55A2, #363B66);
    }

    #article-content img {
        box-shadow: 0 8px 16px var(--shadow-color-strong);
    }

    .verified-badge img {
        filter: brightness(0.8);
    }

    .author-image.initial-avatar {
        filter: brightness(0.8);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Pretendard', sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    margin: 0;
    padding: 2rem;
    text-align: left;
    background: var(--background-color);
    z-index: 100;
    /* box-shadow 제거 */
}

.title {
    max-width: 1200px;
    margin: 0 auto;
}

header p {
    max-width: 230px;
    margin: 0;
    padding: 0;
    font-size: 2.5rem;
    line-height: 1.2;
    background: linear-gradient(to left, #db5aff, #b6b1ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

#news-container {
    margin-top: 160px;  /* 헤더와의 간격 증가 */
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 3rem;  /* 패딩 증가 */
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem;  /* 간격 증가 */
}

/* 첫 번째 기사 스타일 */
.news-article:first-child {
    grid-column: 1 / -1;  /* 전체 너비 차지 */
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 3rem;  /* 간격 증가 */
    padding: 3rem;  /* 패딩 증가 */
    margin-bottom: 2rem;  /* 하단 여백 추가 */
    background: var(--card-background);
}

.news-article:first-child .article-thumbnail {
    height: 400px;  /* 큰 썸네일 */
    border-radius: 8px;
}

.news-article:first-child .article-content {
    padding: 0;
}

.news-article:first-child h2 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.news-article:first-child .article-meta {
    font-size: 1rem;
}

.news-article {
    background: var(--card-background);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px var(--shadow-color);
    transition: transform 0.3s ease;
    cursor: pointer;
}

.news-article:hover {
    transform: translateY(-5px);
}

.article-thumbnail {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.article-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-thumbnail.placeholder {
    background: linear-gradient(135deg, #4A55A2, #7B83B6);
    display: flex;
    align-items: flex-start;  /* 중앙 정렬에서 상단 정렬로 변경 */
    justify-content: flex-start;  /* 중앙 정렬에서 왼쪽 정렬로 변경 */
}

.placeholder-text {
    color: white;
    font-size: 1.5rem;
    text-align: left;  /* 중앙 정렬에서 왼쪽 정렬로 변경 */
    line-height: 1.4;
    padding: 2rem;  /* 왼쪽 정렬을 위한 패딩 추가 */
}

.article-content {
    padding: 2rem;  /* 패딩 증가 */
}

.article-content h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;  /* 여백 증가 */
    line-height: 1.4;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.article-meta .right-side {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.author-image {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.author-image.initial-avatar {
    background-color: var(--primary-color);
    object-fit: contain;
    padding: 0;
}

.verified-badge {
    display: inline-block;
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-left: 4px;
}

.verified-badge img {
    width: 100%;
    height: 100%;
}

/* 기사 상세 보기 스타일 */
#article-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background-color);
    z-index: 1000;
    overflow-y: auto;
    opacity: 0;
    transform: translateX(100%);
    transition: transform 0.5s ease, opacity 0.5s ease;
    padding-top: 100px;
}

#article-view.slide-in {
    transform: translateX(0);
    opacity: 1;
}

#article-view.hidden {
    display: none;
}

.article-container {
    max-width: 1200px;  /* 메인 화면과 동일한 폭 */
    margin: 0 auto;
    padding: 0 3rem 8rem;  /* 패딩 증가 */
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;  /* 간격 증가 */
}

.article-header {
    margin-bottom: 5rem;  /* 여백 증가 */
    position: relative;
}

#back-button {
    position: absolute;
    top: -3rem;
    left: 0;
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--meta-color);
    cursor: pointer;
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.3s ease;
}

#back-button:hover {
    color: var(--primary-color);
}

#article-title {
    font-size: 3.5rem;
    margin-bottom: 2rem;
    line-height: 1.2;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.02em;
}

.article-meta {
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.article-main {
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--text-color);
    display: grid;
    grid-template-columns: minmax(0, 800px);
    justify-content: center;
    gap: 2rem;
}

/* 마크다운 컨텐츠 스타일 */
#article-content {
    max-width: 100%;
}

#article-content h1 {
    font-size: 2.5rem;
    margin: 4rem 0 2rem;  /* 여백 증가 */
    color: var(--text-color);
    letter-spacing: -0.02em;
}

#article-content h2 {
    font-size: 2rem;
    margin: 3rem 0 1.5rem;  /* 여백 증가 */
    color: var(--text-color);
    letter-spacing: -0.02em;
}

#article-content p {
    margin-bottom: 2rem;  /* 여백 증가 */
    line-height: 1.9;
}

#article-content img {
    width: 100%;
    height: auto;
    border-radius: 16px;
    margin: 4rem 0;  /* 여백 증가 */
    box-shadow: 0 8px 16px var(--shadow-color-strong);
}

#article-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem 2rem;
    margin: 3rem 0;  /* 여백 증가 */
    background: var(--blockquote-background);
    border-radius: 0 16px 16px 0;
    color: var(--text-color);
    font-size: 1.1em;
}

.loading {
    text-align: center;
    padding: 6rem;
    color: var(--meta-color);
    font-size: 1.2rem;
}

/* 푸터 스타일 */
footer {
    text-align: center;
    padding: 2rem;
    background: var(--card-background);
    position: fixed;
    bottom: -100px;
    left: 0;
    width: 100%;
    transition: transform 0.3s ease;
    box-shadow: 0 -2px 10px var(--shadow-color);
}

footer.show {
    transform: translateY(-100px);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    header {
        padding: 1.5rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    #news-container {
        margin-top: 120px;
        padding: 2rem;
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .news-article:first-child {
        grid-template-columns: 1fr;
        padding: 2rem;
        gap: 2rem;
    }

    .news-article:first-child .article-thumbnail {
        height: 250px;
    }

    .news-article:first-child h2 {
        font-size: 1.8rem;
        margin: 1rem 0;
    }

    .news-article:first-child .article-content {
        padding: 0;
    }

    #article-view {
        padding-top: 80px;
    }

    .article-container {
        padding: 0 2rem 4rem;
    }

    #article-title {
        font-size: 2.2rem;
        margin-bottom: 1.5rem;
    }

    .article-meta {
        flex-direction: column;
        gap: 1rem;
    }
    
    .article-meta .right-side {
        width: 100%;
        flex-direction: column;
        gap: 1rem;
    }

    .article-controls {
        width: 100%;
    }
    
    .share-button {
        width: 100%;
        justify-content: center;
    }

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

    .article-controls {
        justify-self: stretch;  /* 전체 너비로 확장 */
        order: 3;  /* 순서 변경 */
    }
    
    #article-date {
        order: 2;  /* 순서 변경 */
    }

    .article-main {
        font-size: 1.1rem;
    }

    #article-content h1 {
        font-size: 2rem;
    }

    #article-content h2 {
        font-size: 1.7rem;
    }

    .article-content {
        padding: 1.5rem;
    }

    .article-meta {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .article-controls {
        order: 3;
        width: 100%;
    }
    
    .share-button {
        width: 100%;
        justify-content: center;
    }
}

.article-content h2,
.article-content p,
#article-content p,
#article-content h1,
#article-content h2,
#article-content h3,
#article-content h4,
#article-content h5,
#article-content h6 {
    word-wrap: break-word;
    word-break: keep-all;
    overflow-wrap: break-word;
}

/* 공유 버튼 스타일 */
.share-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.share-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px var(--shadow-color);
}

.share-button svg {
    stroke: currentColor;
}

/* 공유 버튼 위치 조정 */
.article-header .article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.article-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-self: flex-end;  /* 우측 정렬 */
}
