/* ================================================
   모두통신 티스토리 테마 CSS
   ================================================ */

/* 기본 초기화 */
*, *::before, *::after { box-sizing: border-box; }

body, h1, h2, h3, h4, p, ul, li {
  margin: 0;
  padding: 0;
  list-style: none;
}

body {
  background-color: #f4f4f0;
  color: #1a1a1a;
  font-family: 'Pretendard', 'Apple SD Gothic Neo', -apple-system, sans-serif;
  line-height: 1.6;
}

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

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

/* ------------------------------------------------
   CSS 변수
------------------------------------------------ */
:root {
  --orange:      #ff8c00;
  --dark:        #1a1a1a;
  --bg:          #f4f4f0;
  --white:       #ffffff;
  --border:      #eeeeee;
  --text:        #1a1a1a;
  --text-gray:   #666666;
  --text-muted:  #aaaaaa;
  --radius-md:   12px;
  --radius-lg:   16px;
  --shadow-sm:   0 4px 12px rgba(0,0,0,0.05);
  --shadow-md:   0 10px 28px rgba(0,0,0,0.07);
  --shadow-hover:0 16px 40px rgba(0,0,0,0.11);
  --max-width:   1100px;
  --transition:  0.25s ease;
}

/* ------------------------------------------------
   전체 래퍼
------------------------------------------------ */
#modu-tistory-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ------------------------------------------------
   헤더
------------------------------------------------ */
#header {
  background-color: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo a {
  font-size: 20px;
  font-weight: 900;
  color: var(--orange);
  letter-spacing: -0.5px;
}

.gnb ul {
  display: flex;
  gap: 24px;
}

.gnb a {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  transition: color var(--transition);
}

.gnb a:hover { color: var(--orange); }

/* ------------------------------------------------
   히어로 배너
------------------------------------------------ */
.hero-banner {
  background: var(--dark);
  padding: 56px 24px;
  text-align: center;
}

.hero-tag {
  display: inline-block;
  background: var(--orange);
  color: var(--white);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: 100px;
  margin-bottom: 16px;
  letter-spacing: 0.5px;
}

.hero-title {
  font-size: 30px;
  font-weight: 900;
  color: var(--white);
  line-height: 1.35;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
  word-break: keep-all;
}

.hero-sub {
  font-size: 14px;
  color: rgba(255,255,255,0.5);
}

/* ------------------------------------------------
   메인 레이아웃
------------------------------------------------ */
#main {
  flex: 1;
  padding: 48px 24px;
}

/* 전체 2단 레이아웃 */
.layout-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 32px;
  align-items: start;
}

/* 왼쪽 포스트 컬럼 */
.posts-col {
  min-width: 0; /* 그리드 자식 overflow 방지 */
  width: 100%;
}

/* 섹션 타이틀 */
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.section-title-bar {
  width: 4px;
  height: 22px;
  background: var(--orange);
  border-radius: 2px;
  flex-shrink: 0;
}

.section-title h2 {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
}

.section-title .post-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ------------------------------------------------
   포스트 그리드 (글 수 자동 열 조절)
------------------------------------------------ */
.post-grid {
  display: grid;
  gap: 22px;
  margin-bottom: 40px;

  /* 기본: 3열 */
  grid-template-columns: repeat(3, 1fr);
}

/* 글 1개: 가로형 레이아웃 */
.post-grid:has(article:only-child) {
  grid-template-columns: 1fr;
}

.post-grid:has(article:only-child) .post-card {
  display: grid;
  grid-template-columns: 300px 1fr;
}

.post-grid:has(article:only-child) .card-thumb {
  height: 100%;
  min-height: 220px;
}

/* 글 2개: 2열 */
.post-grid:has(article:nth-child(2):last-child) {
  grid-template-columns: repeat(2, 1fr);
}

/* ------------------------------------------------
   포스트 카드
------------------------------------------------ */
.post-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.post-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}

.card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

/* 썸네일 */
.card-thumb {
  width: 100%;
  padding-top: 56.25%;
  background-size: cover;
  background-position: center;
  background-color: #ffe8cc;
  position: relative;
  flex-shrink: 0;
}

/* 썸네일 없을 때 */
.card-thumb.no-thumb {
  background: linear-gradient(135deg, #ffe8cc, #ffd0a0);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 0;
  height: 180px;
}

.card-thumb.no-thumb .no-thumb-text {
  font-size: 18px;
  font-weight: 900;
  color: var(--orange);
  opacity: 0.5;
  letter-spacing: -0.5px;
}

/* 카드 본문 */
.card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-category {
  font-size: 12px;
  font-weight: 700;
  color: var(--orange);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

.card-title {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.45;
  color: var(--text);
  margin-bottom: 10px;
  word-break: keep-all;
}

.card-summary {
  font-size: 13px;
  color: var(--text-gray);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  margin-bottom: 16px;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-date {
  font-size: 12px;
  color: var(--text-muted);
}

.card-more {
  font-size: 12px;
  font-weight: 700;
  color: var(--orange);
}

/* ------------------------------------------------
   개별 포스트 본문
------------------------------------------------ */
.post-detail {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 50px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.post-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 28px;
  margin-bottom: 36px;
  text-align: center;
}

.post-header .post-category {
  color: var(--orange);
  font-weight: 700;
  font-size: 14px;
  display: block;
  margin-bottom: 14px;
}

.post-header .post-title {
  font-size: 32px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 18px;
  word-break: keep-all;
  letter-spacing: -0.5px;
  line-height: 1.35;
}

.post-header .post-meta {
  color: #999;
  font-size: 13px;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.post-header .post-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.post-header .post-meta span:not(:last-child)::after {
  content: '|';
  color: #ddd;
}

.entry-content {
  font-size: 17px;
  line-height: 1.85;
  color: #333;
}

.entry-content p { margin-bottom: 22px; }

.entry-content img {
  border-radius: var(--radius-md);
  margin: 28px 0;
}

.entry-content h2 {
  font-size: 22px;
  font-weight: 800;
  margin: 40px 0 16px;
  color: var(--text);
  letter-spacing: -0.3px;
}

.entry-content h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 32px 0 12px;
  color: var(--text);
  padding: 10px 14px;
  background: rgba(255,140,0,0.07);
  border-radius: var(--radius-md);
}

/* ------------------------------------------------
   사이드바
------------------------------------------------ */
.sidebar { position: sticky; top: 90px; }

.sidebar-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.sidebar-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* 사이드바 포스트 */
.side-post {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f7f7f7;
  cursor: pointer;
}

.side-post:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.side-thumb {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  background: #ffe8cc;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}

.side-post-title {
  font-size: 13px;
  font-weight: 700;
  color: #222;
  line-height: 1.45;
  margin-bottom: 4px;
  word-break: keep-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.side-date {
  font-size: 11px;
  color: var(--text-muted);
}

/* 태그 클라우드 */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  background: #f7f7f5;
  border-radius: 100px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}

.tag:hover {
  background: var(--orange);
  color: var(--white);
  border-color: var(--orange);
}

/* ------------------------------------------------
   페이징
------------------------------------------------ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.pagination a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  transition: all var(--transition);
}

.pagination a:hover,
.pagination .selected {
  background: var(--orange);
  color: var(--white);
  border-color: var(--orange);
}

/* ------------------------------------------------
   푸터
------------------------------------------------ */
#footer {
  background: var(--dark);
  padding: 40px 24px;
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.footer-logo {
  font-size: 18px;
  font-weight: 900;
  color: var(--orange);
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  font-size: 13px;
  color: #777;
  transition: color var(--transition);
}

.footer-links a:hover { color: var(--orange); }

.copyright {
  text-align: center;
  font-size: 12px;
  color: #555;
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ================================================
   반응형
================================================ */
@media (max-width: 900px) {
  .layout-wrap {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
  }
  .post-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .post-grid:has(article:only-child) {
    grid-template-columns: 1fr !important;
  }
  .post-grid:has(article:only-child) .post-card {
    display: flex;
    flex-direction: column;
  }
  .post-grid:has(article:only-child) .card-thumb {
    height: auto;
    padding-top: 56.25%;
    min-height: unset;
  }
  .post-detail {
    padding: 30px 20px;
  }
  .post-header .post-title {
    font-size: 24px;
  }
}

@media (max-width: 600px) {
  .hero-title { font-size: 24px; }
  .post-grid { grid-template-columns: 1fr !important; }
  .header-inner { padding: 14px 16px; }
  #main { padding: 32px 16px; }
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-links { justify-content: center; }
}

/* ================================================
   티스토리 광고(애드센스) 격리
   - post-grid 안에 끼어드는 광고 블록을
     카드처럼 보이지 않게 처리
================================================ */
.post-grid > ins,
.post-grid > div:not(.post-card):not(article) {
  grid-column: 1 / -1;  /* 전체 열 차지 */
  margin: 8px 0;
}

/* 티스토리가 자동 삽입하는 광고 래퍼 무력화 */
.post-grid .revenue_unit_wrap,
.post-grid .adsbygoogle {
  grid-column: 1 / -1;
  width: 100%;
}