/*
Theme Name: 신흥뉴스 (Sinheung News)
Theme URI: https://example.com/
Author: Sinheung News
Description: 깔끔한 인터넷 뉴스 스타일의 워드프레스 테마. 메인 헤드라인 그리드, 카테고리 섹션, 인기기사 위젯, 반응형 레이아웃을 지원합니다.
Version: 1.0.0
Requires at least: 5.8
Tested up to: 6.6
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: sinheung-news
*/

/* ==========================================================================
   1. 디자인 토큰
   ========================================================================== */
:root {
  --c-bg: #ffffff;
  --c-bg-soft: #f5f6f8;
  --c-text: #1a1d23;
  --c-text-sub: #5b616b;
  --c-text-mute: #8a909a;
  --c-line: #e3e6ea;
  --c-line-strong: #1a1d23;
  --c-brand: #0b3d91;
  --c-brand-dark: #082c69;
  --c-accent: #d92d20;
  --font-sans: "Pretendard", "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", sans-serif;
  --font-serif: "Noto Serif KR", "Nanum Myeongjo", "Batang", serif;
  --wrap: 1200px;
  --radius: 4px;
}

/* ==========================================================================
   2. 리셋 / 기본
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
  word-break: keep-all;
  overflow-wrap: break-word;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--c-brand); }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; letter-spacing: -0.02em; }
p { margin: 0 0 1em; }
button { font-family: inherit; cursor: pointer; }
.screen-reader-text {
  position: absolute !important; clip: rect(1px, 1px, 1px, 1px);
  width: 1px; height: 1px; overflow: hidden; white-space: nowrap;
}
.skip-link:focus {
  clip: auto; width: auto; height: auto; background: #fff; padding: 8px 14px;
  z-index: 1000; left: 8px; top: 8px;
}
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* ==========================================================================
   3. 헤더
   ========================================================================== */
.top-bar { background: var(--c-bg-soft); border-bottom: 1px solid var(--c-line); font-size: 13px; color: var(--c-text-sub); }
.top-bar .wrap { display: flex; justify-content: space-between; align-items: center; height: 36px; }
.top-bar a:hover { color: var(--c-brand); }
.top-links { display: flex; gap: 16px; }
.top-links li + li { position: relative; }
.top-links li + li::before { content: ""; position: absolute; left: -9px; top: 4px; bottom: 4px; width: 1px; background: var(--c-line); }

.site-header { background: #fff; }
.header-main .wrap { display: flex; align-items: center; justify-content: space-between; padding-top: 22px; padding-bottom: 22px; }
.site-branding .site-title { font-size: 34px; font-weight: 900; letter-spacing: -0.05em; color: var(--c-brand); line-height: 1; }
.site-branding .site-title a:hover { color: var(--c-brand-dark); }
.site-branding .site-desc { font-size: 12px; color: var(--c-text-mute); margin-top: 6px; }
.custom-logo { max-height: 64px; width: auto; }
.footer-info .sep { margin: 0 6px; color: #5a616c; }

.header-search { display: flex; border-bottom: 2px solid var(--c-brand); }
.header-search input[type="search"] { border: 0; outline: 0; padding: 8px 4px; width: 220px; font-size: 15px; font-family: inherit; background: transparent; }
.header-search button { border: 0; background: transparent; padding: 0 6px; color: var(--c-brand); font-weight: 700; }

/* 메인 내비 */
.main-nav { border-top: 2px solid var(--c-line-strong); border-bottom: 1px solid var(--c-line); background: #fff; position: sticky; top: 0; z-index: 50; }
.main-nav .wrap { display: flex; align-items: center; justify-content: space-between; }
.main-nav ul.menu { display: flex; flex-wrap: wrap; }
.main-nav ul.menu > li { position: relative; }
.main-nav ul.menu > li > a { display: block; padding: 14px 13px; font-size: 17px; font-weight: 700; }
.main-nav ul.menu > li > a:hover,
.main-nav ul.menu > li.current-menu-item > a,
.main-nav ul.menu > li.current-menu-ancestor > a,
.main-nav ul.menu > li.current-cat > a { color: var(--c-brand); box-shadow: inset 0 -3px 0 var(--c-brand); }
.main-nav .sub-menu { display: none; position: absolute; left: 0; top: 100%; min-width: 160px; background: #fff; border: 1px solid var(--c-line); box-shadow: 0 6px 16px rgba(0,0,0,.08); padding: 6px 0; z-index: 60; }
.main-nav li:hover > .sub-menu, .main-nav li:focus-within > .sub-menu { display: block; }
.main-nav .sub-menu a { display: block; padding: 9px 16px; font-size: 14px; }
.main-nav .sub-menu a:hover { background: var(--c-bg-soft); }
.menu-toggle { display: none; border: 0; background: none; padding: 12px 0; font-size: 15px; font-weight: 700; }
.menu-toggle .bars { display: inline-block; width: 20px; height: 14px; border-top: 2px solid currentColor; border-bottom: 2px solid currentColor; position: relative; vertical-align: -2px; margin-right: 8px; }
.menu-toggle .bars::after { content: ""; position: absolute; left: 0; right: 0; top: 4px; border-top: 2px solid currentColor; }

/* 속보 티커 */
.breaking { border-bottom: 1px solid var(--c-line); font-size: 14px; }
.breaking .wrap { display: flex; align-items: center; gap: 12px; height: 42px; overflow: hidden; }
.breaking .label { flex: none; background: var(--c-accent); color: #fff; font-weight: 700; font-size: 12px; padding: 3px 9px; border-radius: 2px; }
.breaking a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* ==========================================================================
   4. 메인 페이지
   ========================================================================== */
.site-main { padding: 28px 0 60px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 2px solid var(--c-line-strong); padding-bottom: 10px; margin-bottom: 18px; }
.section-title h2 { font-size: 22px; font-weight: 800; }
.section-title a.more { font-size: 13px; color: var(--c-text-mute); }
.section-title a.more:hover { color: var(--c-brand); }

.cat-label { display: inline-block; font-size: 13px; font-weight: 700; color: var(--c-brand); margin-bottom: 6px; }
.meta { font-size: 13px; color: var(--c-text-mute); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.thumb { display: block; background: var(--c-bg-soft); overflow: hidden; position: relative; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.thumb:hover img { transform: scale(1.04); }
.thumb.ratio-16x9 { aspect-ratio: 16 / 9; }
.thumb.ratio-4x3 { aspect-ratio: 4 / 3; }
.thumb .noimg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--c-text-mute); font-weight: 900; font-size: 22px; letter-spacing: -0.05em; background: linear-gradient(135deg, #eef1f6, #dde3ee); }

/* 헤드라인 그리드 */
.headline { display: grid; grid-template-columns: 2fr 1fr; gap: 28px; padding-bottom: 28px; border-bottom: 1px solid var(--c-line); margin-bottom: 32px; }
.headline-lead .thumb { margin-bottom: 14px; }
.headline-lead h2 { font-size: 32px; font-weight: 800; margin-bottom: 10px; }
.headline-lead .excerpt { color: var(--c-text-sub); font-size: 16px; margin-bottom: 10px; }
.headline-side { display: flex; flex-direction: column; gap: 18px; }
.headline-side .item { display: grid; grid-template-columns: 1fr 120px; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--c-line); }
.headline-side .item:last-child { border-bottom: 0; padding-bottom: 0; }
.headline-side h3 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.headline-side .thumb { align-self: start; }

/* 메인 + 사이드바 레이아웃 */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; }

/* 카테고리 섹션 */
.cat-section { margin-bottom: 40px; }
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card h3 { font-size: 17px; font-weight: 700; margin: 10px 0 6px; }
.card .excerpt { font-size: 14px; color: var(--c-text-sub); margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 기사 리스트 (아카이브/검색) */
.post-list .row { display: grid; grid-template-columns: 240px 1fr; gap: 22px; padding: 22px 0; border-bottom: 1px solid var(--c-line); }
.post-list .row:first-child { padding-top: 0; }
.post-list .row h2, .post-list .row h3 { font-size: 21px; font-weight: 700; margin-bottom: 8px; }
.post-list .row .excerpt { color: var(--c-text-sub); font-size: 15px; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-list .row.no-thumb { grid-template-columns: 1fr; }

.archive-head { margin-bottom: 24px; padding-bottom: 14px; border-bottom: 2px solid var(--c-line-strong); }
.archive-head h1 { font-size: 28px; font-weight: 800; }
.archive-head .desc { color: var(--c-text-sub); font-size: 14px; margin-top: 6px; }

/* 페이지네이션 */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 34px; flex-wrap: wrap; }
.pagination .page-numbers { min-width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--c-line); border-radius: var(--radius); font-size: 14px; padding: 0 10px; }
.pagination .page-numbers.current { background: var(--c-brand); border-color: var(--c-brand); color: #fff; font-weight: 700; }
.pagination a.page-numbers:hover { border-color: var(--c-brand); color: var(--c-brand); }

/* ==========================================================================
   5. 사이드바 / 위젯
   ========================================================================== */
.sidebar .widget { margin-bottom: 32px; }
.widget-title { font-size: 18px; font-weight: 800; border-bottom: 2px solid var(--c-line-strong); padding-bottom: 8px; margin-bottom: 14px; }
.sidebar .widget ul li { padding: 9px 0; border-bottom: 1px solid var(--c-line); font-size: 15px; }
.sidebar .widget ul li:last-child { border-bottom: 0; }
.rank-list { counter-reset: rank; }
.rank-list li { counter-increment: rank; display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--c-line); align-items: flex-start; }
.rank-list li::before { content: counter(rank); flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--c-line); color: var(--c-text-sub); font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.rank-list li:nth-child(-n+3)::before { background: var(--c-brand); color: #fff; }
.rank-list a { font-weight: 600; font-size: 15px; line-height: 1.45; }
.rank-list li:last-child { border-bottom: 0; }

/* ==========================================================================
   6. 기사 본문
   ========================================================================== */
.article { max-width: 780px; }
.article-head { margin-bottom: 22px; padding-bottom: 20px; border-bottom: 1px solid var(--c-line); }
.article-head .cat-label { font-size: 14px; }
.article-head h1 { font-size: 36px; font-weight: 800; line-height: 1.32; margin-bottom: 14px; }
.article-head .meta { font-size: 14px; }
.article-head .meta .author { color: var(--c-text-sub); font-weight: 600; }
.article-figure { margin: 0 0 24px; }
.article-figure figcaption { font-size: 13px; color: var(--c-text-mute); margin-top: 8px; }
.entry-content { font-size: 18px; line-height: 1.85; color: #23272e; }
.entry-content p { margin-bottom: 1.35em; }
.entry-content h2 { font-size: 26px; font-weight: 800; margin: 1.8em 0 .7em; }
.entry-content h3 { font-size: 21px; font-weight: 700; margin: 1.6em 0 .6em; }
.entry-content a { color: var(--c-brand); text-decoration: underline; text-underline-offset: 3px; }
.entry-content img { margin: 1.2em auto; }
.entry-content blockquote { margin: 1.6em 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--c-brand); color: var(--c-text-sub); font-size: 19px; }
.entry-content ul { list-style: disc; padding-left: 1.4em; margin-bottom: 1.3em; }
.entry-content ol { list-style: decimal; padding-left: 1.4em; margin-bottom: 1.3em; }
.entry-content table { width: 100%; border-collapse: collapse; margin-bottom: 1.4em; font-size: 16px; }
.entry-content th, .entry-content td { border: 1px solid var(--c-line); padding: 10px 12px; }
.entry-content th { background: var(--c-bg-soft); }
.wp-caption, .wp-caption-text, .wp-block-image figcaption { font-size: 13px; color: var(--c-text-mute); text-align: left; }
.alignleft { float: left; margin: 0 1.2em 1em 0; }
.alignright { float: right; margin: 0 0 1em 1.2em; }
.aligncenter { margin-left: auto; margin-right: auto; }

.article-tags { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 8px; }
.article-tags a { font-size: 13px; background: var(--c-bg-soft); border: 1px solid var(--c-line); border-radius: 20px; padding: 4px 12px; color: var(--c-text-sub); }
.article-tags a:hover { border-color: var(--c-brand); color: var(--c-brand); }
.share { display: flex; gap: 8px; margin-top: 24px; }
.share a, .share button { font-size: 13px; border: 1px solid var(--c-line); background: #fff; border-radius: var(--radius); padding: 7px 14px; }
.share a:hover, .share button:hover { border-color: var(--c-brand); color: var(--c-brand); }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--c-line); }
.post-nav a { display: block; font-size: 14px; color: var(--c-text-sub); }
.post-nav .dir { display: block; font-size: 12px; color: var(--c-text-mute); margin-bottom: 4px; }
.post-nav .next { text-align: right; }
.related { margin-top: 44px; }

/* 댓글 */
.comments-area { margin-top: 44px; }
.comments-area h2 { font-size: 20px; margin-bottom: 18px; }
.comment-list li { padding: 16px 0; border-bottom: 1px solid var(--c-line); }
.comment-list .children { margin-left: 28px; }
.comment-author .avatar { float: left; margin-right: 12px; border-radius: 50%; }
.comment-metadata { font-size: 12px; color: var(--c-text-mute); }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea { width: 100%; border: 1px solid var(--c-line); padding: 10px 12px; font-family: inherit; font-size: 15px; border-radius: var(--radius); }
.comment-form .submit, .search-submit { background: var(--c-brand); color: #fff; border: 0; padding: 11px 22px; border-radius: var(--radius); font-weight: 700; }
.comment-form .submit:hover, .search-submit:hover { background: var(--c-brand-dark); }

/* 검색폼 / 404 */
.search-form { display: flex; gap: 8px; }
.search-form .search-field { flex: 1; border: 1px solid var(--c-line); padding: 10px 12px; font-size: 15px; border-radius: var(--radius); font-family: inherit; }
.not-found { text-align: center; padding: 70px 0; }
.not-found h1 { font-size: 64px; color: var(--c-brand); font-weight: 900; margin-bottom: 10px; }
.not-found .search-form { max-width: 420px; margin: 24px auto 0; }

/* ==========================================================================
   7. 푸터
   ========================================================================== */
.site-footer { background: #20242b; color: #b6bcc7; font-size: 13px; }
.footer-nav { border-bottom: 1px solid #343a44; }
.footer-nav .wrap { display: flex; flex-wrap: wrap; gap: 4px 22px; padding-top: 16px; padding-bottom: 16px; }
.footer-nav a { color: #dfe3ea; font-weight: 600; }
.footer-nav a:hover { color: #fff; }
.footer-info .wrap { padding-top: 26px; padding-bottom: 40px; }
.footer-info .brand { font-size: 22px; font-weight: 900; color: #fff; letter-spacing: -0.04em; margin-bottom: 12px; }
.footer-info p { margin-bottom: 4px; line-height: 1.7; }
.footer-info .copy { margin-top: 14px; color: #7f8794; }
.to-top { position: fixed; right: 20px; bottom: 24px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--c-brand); color: #fff; font-size: 18px; box-shadow: 0 4px 12px rgba(0,0,0,.2); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 70; }
.to-top.show { opacity: 1; pointer-events: auto; }

/* ==========================================================================
   8. 반응형
   ========================================================================== */
@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { margin-top: 20px; }
}
@media (max-width: 860px) {
  .headline { grid-template-columns: 1fr; }
  .headline-lead h2 { font-size: 26px; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .header-search { display: none; }
  .menu-toggle { display: block; }
  .main-nav .wrap { flex-wrap: wrap; }
  .main-nav ul.menu { display: none; width: 100%; flex-direction: column; border-top: 1px solid var(--c-line); }
  .main-nav.open ul.menu { display: flex; }
  .main-nav ul.menu > li > a { padding: 12px 4px; font-size: 16px; }
  .main-nav .sub-menu { position: static; display: block; border: 0; box-shadow: none; padding: 0 0 6px 14px; }
  .site-branding .site-title { font-size: 28px; }
}
@media (max-width: 600px) {
  body { font-size: 15px; }
  .cat-grid { grid-template-columns: 1fr; }
  .post-list .row { grid-template-columns: 110px 1fr; gap: 14px; }
  .post-list .row h2, .post-list .row h3 { font-size: 17px; }
  .post-list .row .excerpt { display: none; }
  .article-head h1 { font-size: 26px; }
  .entry-content { font-size: 17px; }
  .headline-side .item { grid-template-columns: 1fr 96px; }
  .top-bar .date { display: none; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { text-align: left; }
}
