:root {
    --primary-color: #1a202c;
    --accent-color: #2b6cb0;
    --text-color: #333;
    --text-light: #666;
    --bg-light: #f7fafc;
    --border-color: #e2e8f0;
    --max-width: 1200px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    background-color: #fff;
}

a {
    text-decoration: none;
    color: inherit;
}

a:hover {
    color: var(--accent-color);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Common Layout Classes */
.site-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.inner-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

.page-section {
    flex: 1;
    padding: 40px 0;
}

/* Layout Grid for Main/View/List with Sidebar */
.content-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.main-content {
    flex: 1;
    min-width: 0;
}

/* Header */
.site-header {
    border-bottom: 1px solid var(--border-color);
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    column-gap: 20px;
}

.site-logo {
    font-size: 32px;
    font-weight: 900;
    color: var(--primary-color);
    letter-spacing: -1px;
    cursor: pointer;
}

.site-logo img { max-height: 72px; }

.site-logo span {
    color: var(--accent-color);
}

.header-search {
    display: flex;
}

.header-search input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px 0 0 4px;
    outline: none;
}

.header-search button {
    padding: 8px 16px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}

.site-nav {
    background: var(--primary-color);
    color: #fff;
}

.nav-list {
    display: flex;
    flex-wrap: wrap;
}

.nav-item {
    padding: 15px 20px;
    font-weight: bold;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.nav-item:hover, .nav-item.active {
    background: var(--accent-color);
}

/* Sidebar */
.aside.view-sidebar {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0px;
}

.sidebar-widget {
    border: 1px solid var(--border-color);
    background: #fff;
}

.widget-title {
    background: var(--bg-light);
    padding: 15px;
    font-size: 16px;
    font-weight: bold;
    border-bottom: 1px solid var(--border-color);
}

.widget-content {
    padding: 15px;
}

.popular-list li {
    margin-bottom: 12px;
    font-size: 14px;
    display: flex;
    gap: 10px;
}

.popular-list li span {
    font-weight: bold;
    color: var(--accent-color);
}

.ad-text-section {
    background: #fff8f8;
    border: 1px solid #fecaca;
    padding: 15px;
    text-align: center;
}
.ad-text-section h4 { color: #dc2626; margin-bottom: 10px; font-size: 14px;}
.ad-text-section p { font-size: 13px; color: var(--text-light); }

/* Article Cards */
.article-card {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.article-thumb {
    width: 240px;
    height: 160px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: var(--bg-light);
}

.article-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-category {
    font-size: 12px;
    color: var(--accent-color);
    font-weight: bold;
    margin-bottom: 8px;
}

.article-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 10px;
    line-height: 1.4;
}

.article-excerpt {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-meta {
    font-size: 12px;
    color: #999;
}

/* Main Page Specific */
.section-header {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.hero-article {
    margin-bottom: 40px;
    cursor: pointer;
}

.hero-article img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 20px;
}

.hero-article .article-title {
    font-size: 28px;
}

.youtube-section {
    background: var(--bg-light);
    padding: 40px;
    margin: 40px -20px;
    border-radius: 12px;
}

.youtube-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.youtube-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.youtube-card img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}

.youtube-card-title {
    padding: 15px;
    font-weight: bold;
    font-size: 14px;
}

.issue-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
.issue-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}
.issue-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}
.issue-card-content {
    padding: 15px;
}

/* View Page */
.view-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.view-category {
    color: var(--accent-color);
    font-weight: bold;
    margin-bottom: 10px;
}

.view-title {
    font-size: 32px;
    font-weight: bold;
    line-height: 1.4;
    margin-bottom: 15px;
}

.view-meta {
    color: var(--text-light);
    font-size: 14px;
    display: flex;
    gap: 20px;
}

.view-body {
    font-size: 17px;
    line-height: 1.8;
    color: #222;
}

.view-body img {
    margin: 30px 0;
    border-radius: 8px;
    width: 100%;
}

.view-body p {
    margin-bottom: 20px;
}

/* About Page */
.about-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 30px;
    overflow-x: auto;
}

.about-tab-btn {
    padding: 15px 30px;
    font-size: 16px;
    font-weight: bold;
    color: var(--text-light);
    background: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.about-tab-btn.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.about-content-panel {
    display: none;
    background: #fff;
    padding: 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    flex-direction: column;
}

.about-content-panel.active {
    display: flex;
}

.about-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.about-text {
    line-height: 1.8;
    color: var(--text-color);
    white-space: pre-line;
}


/* --- 추가된 CSS : 한줄픽 소개(tab-0) 가로 배치 --- */
#tab-0 {
    flex-wrap: wrap;
    gap: 30px;
    align-items: flex-start;
    flex-direction: row;
}

#tab-0 .about-title {
    width: 100%; /* 제목을 전체 너비로 설정하여 아래 항목들을 줄바꿈시킴 */
    margin-bottom: 0;
}

#tab-0 .about-intro-img {
    flex: 0 0 45%; /* 이미지 영역이 45%의 너비를 차지하도록 설정 */
    max-width: 500px;
}

#tab-0 .about-intro-img img {
    width: 100%;
    border-radius: 8px;
    display: block;
}

#tab-0 .about-text {
    flex: 1; /* 남은 공간을 텍스트가 모두 차지하도록 설정 */
    min-width: 250px;
}

/* Footer */
.site-footer {
    background: var(--primary-color);
    color: #a0aec0;
    padding: 40px 0;
    margin-top: auto;
    font-size: 13px;
}

.footer-links {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 20px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #fff;
    font-weight: bold;
}

.footer-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    line-height: 1.8;
}

.footer-info span {
    display: inline-block;
    margin-right: 15px;
}

.footer-copyright {
    margin-top: 20px;
    color: #718096;
}

/* Rolling Slider */
.rolling-slider {
    overflow: hidden;
    position: relative;
    margin-bottom: 40px;
}
.rolling-wrapper {
    display: flex;
    transition: transform 0.5s ease-in-out;
}
.rolling-slide {
    width: 100%;
    flex-shrink: 0;
}
.rolling-controls {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}
.rolling-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--border-color);
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}
.rolling-dot.active {
    background-color: var(--primary-color);
}

/* Extra Article Grid */
.extra-news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}
.extra-news-card {
    cursor: pointer;
}
.extra-news-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}
.extra-news-title {
    font-size: 15px;
    font-weight: bold;
    line-height: 1.4;
}

/* Toast Message */
.toast-message {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(26, 32, 44, 0.9);
    color: #fff;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.toast-message.show {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 992px) {
    .content-layout {
        flex-direction: column;
    }
    .aside.view-sidebar {
        width: 100%;
    }
    .youtube-grid {
        grid-template-columns: 1fr;
    }
    .issue-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .article-card {
        flex-direction: column;
    }
    .article-thumb {
        width: 100%;
        height: 200px;
    }
    .extra-news-grid {
        grid-template-columns: 1fr;
    }
    .nav-item {
        padding: 10px 15px;
        font-size: 14px;
    }
    .footer-info {
        grid-template-columns: 1fr;
    }
}

/* 1. 모든 요소의 패딩/테두리를 넓이에 포함 (필수 기본 셋팅) */
* {
    box-sizing: border-box;
}

/* 2. 전체 페이지 가로 스크롤 방지 */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* 3. 미디어 요소(이미지, 동영상 등) 반응형 처리 */
/* 본문 내 인라인 스타일(style="width:720px")을 무시하기 위해 !important 사용 */
img, video, iframe, figure {
    max-width: 100% !important;
    height: auto !important;
}


/* 4. 긴 영문 텍스트나 URL이 화면을 뚫고 나가는 것 방지 */
.view-body, .view-body p, .view-body span, .view-body a {
    word-break: break-all;
    overflow-wrap: break-word;
}

/* 5. 표(Table)가 있을 경우 가로 스크롤 허용 (테이블이 화면을 밀어내는 것 방지) */
.view-body table {
    max-width: 100%;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* --- 모바일(768px 이하) 전용 레이아웃 조정 --- */
@media screen and (max-width: 768px) {
    
    .site-logo img { max-height: 48px; }
    
    /* 컨테이너 및 사이드바 넓이를 100%로 강제 조정 */
    .inner-container, 
    .main-content, 
    .view-sidebar {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* 모바일에서는 메인 콘텐츠와 사이드바(광고/추천기사)가 세로로 떨어지도록 처리 */
    .content-layout {
        display: block !important; /* flex나 grid로 되어있을 경우 세로 배치로 변경 */
    }
    
    /* 기사 본문 양옆 여백 확보 */
    .view-body {
        padding: 0;
    }
}

    /* 기본 광고 배너 */
    .ad-banner { width: 100%; background-color: #161B2E; /*border: 1px solid #1e293b;*/  display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; cursor: pointer; margin: 2rem 0;  }
    @media (min-width: 768px) { .ad-banner {  } }
    .ad-bg { position: absolute; inset: 0; background: linear-gradient(to right, rgba(30,58,138,0.1), transparent, rgba(30,58,138,0.1)); opacity: 0.5; }
    .ad-content { position: relative; z-index: 10; text-align: center; }
    .ad-label { font-size: 10px; color: #64748b; text-transform: uppercase; letter-spacing: 0.1em; font-weight: bold; display: block; margin-bottom: 0.25rem; }
    .ad-text { color: #94a3b8; font-weight: 500; }
    @media (min-width: 768px) { .ad-text { font-size: 1.125rem; } }
    .ad-badge {position: absolute;top: 3px;right: 3px;font-weight: bold;margin: auto;display: flex;align-items: center;font-size: 10px;background: rgba(0, 0, 0, 0.1);color: #cecdcd;padding: 2px 6px;border-radius: 3px;}

    /* 우측 광고배너 */
    .banner_ad{position:absolute;top:2px; right:2px; width: auto !important; height: 16px; z-index:1;cursor:pointer}