/* ═══════════════════════════════════════════════════════════════
   🎨 EDITORIAL MAGAZINE BLOG SKIN
   Trendy, Bold Typography + Refined Minimalism
   + 광고 최적화 버전
   ═══════════════════════════════════════════════════════════════ */

/* 1. IMPORTS & VARIABLES */
/* 폰트 최적화: font-display=swap 적용 */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.8/dist/web/static/pretendard.css");
@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700;800&display=swap");

:root {
  /* Color Palette - WCAG 2.1 AA 대비율 4.5:1 이상 준수 */
  --ink: #0d0d0d;
  --charcoal: #1a1a1a;
  --graphite: #2d2d2d;
  /* 접근성 개선: 대비율 4.5:1 이상으로 조정 */
  --slate: #545454; /* 기존 #6b6b6b → #545454 (대비율 7:1) */
  --silver: #767676; /* 기존 #a8a8a8 → #767676 (대비율 4.54:1) */
  --cloud: #f5f5f5;
  --paper: #fafafa;
  --white: #ffffff;

  /* Accent Colors */
  --accent: #c5303c; /* 기존 #e63946 → #c5303c (대비율 4.5:1 이상) */
  --accent-soft: #e04545;
  --accent-glow: rgba(197, 48, 60, 0.15);

  /* Typography - font-display 적용 */
  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Pretendard", -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing System */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;
  --space-2xl: 64px;
  --space-3xl: 100px;

  /* Layout */
  --content-width: 1200px;
  --content-narrow: 720px;

  /* Effects */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 40px var(--accent-glow);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 0.2s;
  --duration-normal: 0.4s;
  --duration-slow: 0.6s;
}

/* Dark Mode - 대비율 개선 */
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f5f5f5;
    --charcoal: #e8e8e8;
    --graphite: #d0d0d0;
    --slate: #b0b0b0; /* 어두운 배경에서 4.5:1 이상 */
    --silver: #8a8a8a; /* 어두운 배경에서 4.5:1 이상 */
    --cloud: #1a1a1a;
    --paper: #111111;
    --white: #0d0d0d;
    --accent: #ff6b6b; /* 어두운 배경에서 더 밝은 악센트 */
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
  }
}

/* 다크모드 댓글 스타일 */
@media (prefers-color-scheme: dark) {
  /* 댓글 영역 전체 배경 */
  .post-reply,
  .post-reply .rp_wrap,
  .post-reply #entry0Comment,
  .post-reply .tt_box_total,
  .post-reply .tt_cmt_input,
  .post-reply .tt-box-profile,
  .post-reply .tt_box_namecard {
    background: transparent !important;
    color: var(--charcoal) !important;
  }

  /* 댓글 작성자명 - 밝게 */
  .post-reply .tt_txt_g,
  .post-reply .tt-link-user,
  .post-reply .tt_txt_user,
  .post-reply a.tt_txt_user,
  .post-reply .tt-wrap-cmt .tt_txt_g {
    color: var(--ink) !important;
  }

  /* 댓글 내용 텍스트 */
  .post-reply .tt_txt_cnt,
  .post-reply p,
  .post-reply span:not(.tt_date) {
    color: var(--charcoal) !important;
  }

  /* 댓글 날짜/시간 */
  .post-reply .tt_cmt_info,
  .post-reply .tt_date,
  .post-reply time,
  .post-reply .tt_txt_g.tt_date {
    color: var(--slate) !important;
  }

  /* 댓글 링크 */
  .post-reply a {
    color: var(--charcoal) !important;
  }

  .post-reply a:hover {
    color: var(--accent) !important;
  }

  /* 댓글 입력창 */
  .post-reply input,
  .post-reply textarea {
    background: var(--graphite) !important;
    color: var(--ink) !important;
    border-color: var(--slate) !important;
  }

  .post-reply input::placeholder,
  .post-reply textarea::placeholder {
    color: var(--silver) !important;
  }

  /* 댓글 구분선 */
  .post-reply .tt-wrap-cmt,
  .post-reply .tt-item-reply {
    border-color: var(--graphite) !important;
  }

  /* 답글 영역 배경 */
  .post-reply .tt-list-reply,
  .post-reply .tt-wrap-reply {
    background: rgba(255, 255, 255, 0.03) !important;
  }

  /* 카테고리 다른 글 영역 */
  .another_category,
  .another_category table {
    background: transparent !important;
    color: var(--charcoal) !important;
  }

  .another_category a {
    color: var(--charcoal) !important;
  }

  .another_category a:hover {
    color: var(--accent) !important;
  }

  .another_category th {
    background: var(--graphite) !important;
    color: var(--ink) !important;
  }

  .another_category td {
    border-color: var(--graphite) !important;
  }

  /* 프로필 카드 */
  .post-reply .tt-box-profile *,
  .post-reply .tt_box_namecard * {
    color: var(--charcoal) !important;
  }
}

/* 2. RESET & BASE */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--charcoal);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.no-scroll {
  overflow: auto;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* 3. LAYOUT UTILITIES */
.content-width {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

#main {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--space-2xl);
  padding: var(--space-2xl) 0;
}

#main.sidebarPosition.none {
  grid-template-columns: 1fr;
}

#content {
  min-width: 0;
}

/* 4. HEADER - Editorial Style */
#header_wrap {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(250, 250, 250, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: all var(--duration-normal) var(--ease-out);
}

@media (prefers-color-scheme: dark) {
  #header_wrap {
    background: rgba(17, 17, 17, 0.85);
    border-bottom-color: rgba(255, 255, 255, 0.05);
  }
}

#header_wrap.shrink {
  box-shadow: var(--shadow-sm);
}

#header_gnb {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

/* Logo / Title */
#header-title h1,
#header-title .h1-style {
  margin: 0;
}

#header-title a {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  position: relative;
  display: inline-block;
}

#header-title a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--duration-normal) var(--ease-out);
}

#header-title a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Search Bar */
#search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--cloud);
  border-radius: 100px;
  padding: var(--space-sm) var(--space-md);
  transition: all var(--duration-normal) var(--ease-out);
  border: 1px solid transparent;
}

#search-bar:focus-within {
  background: var(--white);
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.search-icon {
  color: var(--slate);
  display: flex;
  transition: color var(--duration-fast);
}

#search-bar:focus-within .search-icon {
  color: var(--accent);
}

#search-input {
  border: none;
  background: transparent;
  font-size: 0.9rem;
  color: var(--charcoal);
  width: 180px;
  outline: none;
}

/* 접근성 개선: placeholder 대비율 */
#search-input::placeholder {
  color: var(--silver);
}

/* 5. PROGRESS BAR - Gradient Glow */
#progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    var(--accent-soft) 50%,
    var(--accent) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
  box-shadow: 0 0 20px var(--accent-glow);
  transition: width 0.1s linear;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* 6. POST LIST - Magazine Cards */
.list_content {
  animation: fadeInUp 0.6s var(--ease-out) backwards;
}

.list_content:nth-child(1) {
  animation-delay: 0.1s;
}
.list_content:nth-child(2) {
  animation-delay: 0.15s;
}
.list_content:nth-child(3) {
  animation-delay: 0.2s;
}
.list_content:nth-child(4) {
  animation-delay: 0.25s;
}
.list_content:nth-child(5) {
  animation-delay: 0.3s;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.index_wrap {
  display: flex;
  gap: var(--space-xl);
  padding: var(--space-xl) 0;
  border-bottom: 1px solid var(--cloud);
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
}

.index_wrap::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 50%;
  width: 4px;
  height: 0;
  background: var(--accent);
  border-radius: 2px;
  transition: height var(--duration-normal) var(--ease-out);
  transform: translateY(-50%);
}

.index_wrap:hover::before {
  height: 60%;
}

.index_wrap:hover {
  padding-left: var(--space-md);
}

.post_link {
  display: flex;
  gap: var(--space-xl);
  width: 100%;
  align-items: flex-start;
}

.list_detail_wrap {
  flex: 1;
  min-width: 0;
}

/* Post Title */
.post_title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  margin-bottom: var(--space-sm);
  letter-spacing: -0.02em;
  transition: color var(--duration-fast);
  word-break: keep-all;
}

.index_wrap:hover .post_title {
  color: var(--accent);
}

/* Post Excerpt - 접근성 개선 */
.post_text {
  font-size: 1rem;
  color: var(--slate);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--space-md);
}

/* Post Meta - 접근성 개선 */
.post_meta {
  font-size: 0.8rem;
  color: var(--silver);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Thumbnail */
s_article_rep_thumbnail {
  display: block;
  flex-shrink: 0;
}

.thumnail {
  flex-shrink: 0;
  width: 200px;
  aspect-ratio: 10 / 7;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background: var(--cloud);
}

.thumnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out);
}

.index_wrap:hover .thumnail img {
  transform: scale(1.08);
}

/* 썸네일 없는 경우 */
.index_wrap:not(:has(s_article_rep_thumbnail)) .list_detail_wrap {
  max-width: 100%;
}

/* 7. ARTICLE PAGE - Editorial Reading Experience */
.h-entry {
  animation: fadeIn 0.8s var(--ease-out);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Article Header */
.hd {
  text-align: center;
  padding: var(--space-2xl) 0 var(--space-xl);
  max-width: var(--content-narrow);
  margin: 0 auto;
}

/* 접근성 개선: 메타 정보 대비율 */
.meta-cate {
  font-size: 0.85rem;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: var(--space-lg);
}

.meta-cate a {
  color: var(--accent);
  font-weight: 600;
  transition: opacity var(--duration-fast);
}

.meta-cate a:hover {
  opacity: 0.7;
}

/* Article Title */
.hd-heading {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -0.03em;
  margin: 0;
  word-break: keep-all;
}

/* Admin Tools */
.admin-tools {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--cloud);
}

.dup-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  background: var(--ink);
  color: var(--white);
  padding: var(--space-sm) var(--space-md);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: all var(--duration-fast) var(--ease-out);
}

.dup-button:hover {
  background: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.textLenIncludeSpaces {
  color: var(--slate);
  font-size: 0.85rem;
  margin-left: var(--space-sm);
}

/* 8. POST CONTENT - Typography Perfection */
.post-content,
.e-content {
  max-width: var(--content-narrow);
  margin: 0 auto;
  font-size: 1.125rem;
  line-height: 1.85;
  color: var(--charcoal);
}

.post-content > * + * {
  margin-top: 1.5em;
}

.post-content p {
  word-break: keep-all;
  text-align: justify;
}

/* Headings */
.post-content h2 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--ink);
  margin: 2.5em 0 0.8em;
  letter-spacing: -0.02em;
  position: relative;
  padding-left: var(--space-lg);
}

.post-content h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.2em;
  width: 4px;
  height: 1em;
  background: var(--accent);
  border-radius: 2px;
}

.post-content h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink);
  margin: 2em 0 0.6em;
}

.post-content h4 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--graphite);
  margin: 1.8em 0 0.5em;
}

/* Links - 접근성 개선 */
.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--duration-fast);
}

.post-content a:hover {
  text-decoration-color: var(--accent);
}

/* Blockquote */
.post-content blockquote {
  position: relative;
  margin: 2em 0;
  padding: var(--space-lg) var(--space-xl);
  background: var(--cloud);
  border-radius: 8px;
  font-style: italic;
  color: var(--graphite);
}

.post-content blockquote::before {
  content: '"';
  position: absolute;
  top: -10px;
  left: var(--space-md);
  font-family: var(--font-display);
  font-size: 4rem;
  color: var(--accent);
  opacity: 0.3;
  line-height: 1;
}

/* Lists */
.post-content ul,
.post-content ol {
  padding-left: var(--space-lg);
}

.post-content li {
  margin: 0.5em 0;
}

.post-content li::marker {
  color: var(--accent);
}

/* Code */
.post-content code {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.9em;
  background: var(--cloud);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--graphite);
}

.post-content pre {
  background: var(--ink);
  color: var(--cloud);
  padding: var(--space-lg);
  border-radius: 12px;
  overflow-x: auto;
  margin: 1.5em 0;
}

.post-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 0.85rem;
  line-height: 1.6;
}

/* Images */
.post-content img {
  border-radius: 12px;
  margin: 1.5em auto;
  box-shadow: var(--shadow-md);
}

.post-content figure {
  margin: 2em 0;
}

/* 접근성 개선: figcaption 대비율 */
.post-content figcaption {
  text-align: center;
  font-size: 0.9rem;
  color: var(--slate);
  margin-top: var(--space-sm);
}

/* Tables */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.95rem;
}

.post-content th,
.post-content td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--cloud);
}

.post-content th {
  font-weight: 600;
  color: var(--ink);
  background: var(--cloud);
}

.post-content tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

/* Horizontal Rule */
.post-content hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--silver), transparent);
  margin: 3em 0;
}

/* 9. SIDEBAR - Clean & Minimal */
#sidebar {
  position: sticky;
  top: 100px;
  height: fit-content;
}

.module {
  margin-bottom: var(--space-xl);
}

/* 접근성 개선: 모듈 타이틀 대비율 */
.module-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--slate);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--ink);
  display: inline-block;
}

/* Category List */
.module-category .module-content {
  font-size: 0.95rem;
}

.module-category a {
  display: block;
  padding: var(--space-xs) 0;
  color: var(--charcoal);
  transition: all var(--duration-fast);
}

.module-category a:hover {
  color: var(--accent);
  padding-left: var(--space-sm);
}

/* 접근성 개선: 카운트 대비율 */
.module-category .c_cnt {
  color: var(--silver);
  font-size: 0.85em;
  margin-left: var(--space-xs);
}

/* 10. PAGINATION */
#paging {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-2xl) 0;
}

.pagination .numbox {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

/* 이전/다음 버튼 */
.pagination .prev,
.pagination .next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  color: var(--slate);
  transition: all var(--duration-fast) var(--ease-out);
}

.pagination .prev:hover,
.pagination .next:hover {
  background: var(--cloud);
  color: var(--ink);
}

/* 이전/다음 비활성화 */
.pagination .no-more-prev,
.pagination .no-more-next {
  opacity: 0.3;
  pointer-events: none;
  cursor: default;
}

/* 페이지 번호 링크 */
.pagination .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 var(--space-sm);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--slate);
  transition: all var(--duration-fast) var(--ease-out);
}

.pagination .num:hover {
  background: var(--cloud);
  color: var(--ink);
}

/* 현재 페이지 - span.selected가 있는 경우 */
.pagination .num:has(.selected) {
  background: var(--ink);
  color: var(--white);
  font-weight: 600;
  pointer-events: none;
}

/* :has() 미지원 브라우저 대응 - span.selected 직접 스타일링 */
.pagination .num span.selected {
  color: var(--white);
}

/* 11. FOOTER - Minimal */
#footer {
  border-top: 1px solid var(--cloud);
  padding: var(--space-2xl) 0;
  margin-top: var(--space-3xl);
}

#footer .content-width {
  text-align: center;
}

/* 접근성 개선: 푸터 텍스트 대비율 */
#footer p {
  font-size: 0.85rem;
  color: var(--slate);
  margin: var(--space-xs) 0;
}

#footer a {
  color: var(--charcoal);
  font-weight: 500;
  transition: color var(--duration-fast);
}

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

/* 12. COMMENTS & REACTIONS */
.post-reply {
  max-width: var(--content-narrow);
  margin: var(--space-lg) auto 0;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--cloud);
}

/* 카테고리 다른 글 영역 간격 조정 */
.another_category {
  margin: var(--space-lg) 0 var(--space-md) !important;
}

/* 티스토리 프로필 카드 간격 조정 */
.post-reply .tt-box-profile,
.post-reply .tt_box_namecard {
  margin: var(--space-md) 0 !important;
  padding: var(--space-md) !important;
}

/* 댓글 목록 상단 간격 */
.post-reply .tt-box-total {
  margin-top: var(--space-sm) !important;
}

/* 티스토리 댓글 스타일 오버라이드 */
.post-reply .rp_wrap,
.post-reply #entry0Comment,
.post-reply .tt_box_total,
.post-reply .tt_cmt_input {
  color: var(--charcoal) !important;
  background: var(--white) !important;
}

.post-reply input,
.post-reply textarea {
  color: var(--charcoal) !important;
  background: var(--white) !important;
  border: 1px solid var(--cloud) !important;
  border-radius: 8px !important;
  padding: var(--space-sm) var(--space-md) !important;
}

/* 접근성 개선: placeholder 대비율 */
.post-reply input::placeholder,
.post-reply textarea::placeholder {
  color: var(--silver) !important;
}

.post-reply button,
.post-reply .tt_btn_submit {
  background: var(--ink) !important;
  color: var(--white) !important;
  border-radius: 8px !important;
  padding: var(--space-sm) var(--space-md) !important;
  transition: background var(--duration-fast) !important;
}

.post-reply button:hover,
.post-reply .tt_btn_submit:hover {
  background: var(--accent) !important;
}

/* 접근성 개선: 댓글 정보 대비율 */
.post-reply .tt_txt_g,
.post-reply .tt_cmt_info,
.post-reply .tt_date {
  color: var(--slate) !important;
}

.post-reply a {
  color: var(--charcoal) !important;
}

.post-reply a:hover {
  color: var(--accent) !important;
}

.container_postbtn {
  max-width: var(--content-narrow);
  margin: var(--space-xl) auto;
  visibility: hidden;
}

/* ═══════════════════════════════════════════════════════════════
   18. 광고 영역 스타일 (AD AREA STYLES)
   ═══════════════════════════════════════════════════════════════ */

/* 광고 영역 기본 스타일 */
.ad-area {
  width: 100%;
  margin: var(--space-lg) 0;
  text-align: center;
  overflow: hidden;
}

/* 빈 광고 영역 숨김 */
.ad-area:empty {
  display: none;
  margin: 0;
}

/* 본문 상단 광고 */
.ad-top {
  margin-bottom: var(--space-xl);
}

/* 본문 하단 광고 */
.ad-bottom {
  margin-top: var(--space-xl);
}

/* 글 목록 사이 광고 (인피드) */
.ad-list {
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--cloud);
  background: var(--paper);
}

/* 글 본문 상단 광고 (제목 아래) */
.ad-post-top {
  max-width: var(--content-narrow);
  margin: 0 auto var(--space-xl);
}

/* 글 본문 하단 광고 (내용 아래) */
.ad-post-bottom {
  max-width: var(--content-narrow);
  margin: var(--space-xl) auto;
}

/* 관련 글/광고 영역 */
.ad-related {
  max-width: var(--content-narrow);
  margin: var(--space-xl) auto;
}

/* 사이드바 광고 모듈 */
.module-ad {
  margin-bottom: var(--space-xl);
}

.module-ad-sticky {
  margin-top: var(--space-lg);
}

/* 사이드바 고정 영역 */
.sidebar-sticky {
  position: sticky;
  top: 100px;
}

/* 광고 내부 iframe/ins 반응형 */
.ad-area iframe,
.ad-area ins {
  max-width: 100%;
}

/* 애드센스 자동 광고 컨테이너 */
.adsbygoogle {
  display: block;
  width: 100%;
}

/* 텐핑 광고 스타일 */
.tenping-widget {
  margin: var(--space-md) 0;
}

/* 쿠팡 파트너스 배너 */
.coupang-banner {
  margin: var(--space-md) 0;
  text-align: center;
}

.coupang-banner img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

/* 광고 라벨 (선택적) */
.ad-label {
  font-size: 0.7rem;
  color: var(--silver);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-xs);
}

/* 다크모드에서 광고 배경 */
@media (prefers-color-scheme: dark) {
  .ad-area {
    background: transparent;
  }

  .ad-list {
    background: var(--paper);
  }
}

/* 모바일 광고 최적화 */
@media screen and (max-width: 768px) {
  .ad-area {
    margin: var(--space-md) 0;
  }

  .ad-post-top,
  .ad-post-bottom {
    margin: var(--space-md) auto;
  }

  /* 모바일에서 사이드바 광고 */
  .module-ad,
  .module-ad-sticky {
    text-align: center;
  }

  .sidebar-sticky {
    position: static;
  }
}

/* 인쇄 시 광고 숨김 */
@media print {
  .ad-area,
  .module-ad,
  .module-ad-sticky,
  .sidebar-sticky {
    display: none !important;
  }
}

/* 13. RESPONSIVE DESIGN */
@media screen and (max-width: 1024px) {
  #main {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  #sidebar {
    position: static;
    padding-top: var(--space-xl);
    border-top: 1px solid var(--cloud);
  }
}

@media screen and (max-width: 768px) {
  :root {
    --space-lg: 20px;
    --space-xl: 32px;
    --space-2xl: 48px;
  }

  #header_gnb {
    height: 60px;
  }

  #header-title a {
    font-size: 1.4rem;
  }

  #search-input {
    width: 120px;
  }

  .index_wrap {
    flex-direction: column-reverse;
    gap: var(--space-md);
  }

  .post_link {
    flex-direction: column-reverse;
  }

  s_article_rep_thumbnail {
    width: 100%;
  }

  .thumnail {
    width: 100%;
    aspect-ratio: 16 / 9;
  }

  .post_title {
    font-size: 1.4rem;
  }

  .hd-heading {
    font-size: 1.8rem;
  }

  .post-content,
  .e-content {
    font-size: 1rem;
  }

  .post-content h2 {
    font-size: 1.5rem;
  }
}

@media screen and (max-width: 480px) {
  .content-width {
    padding: 0 var(--space-md);
  }

  .index_wrap::before {
    display: none;
  }

  .index_wrap:hover {
    padding-left: 0;
  }

  #search-bar {
    padding: var(--space-xs) var(--space-sm);
  }

  #search-input {
    width: 100px;
    font-size: 0.85rem;
  }
}

/* 14. ANIMATIONS & MICRO-INTERACTIONS */
/* Smooth entrance for content */
#content.show {
  animation: contentReveal 0.8s var(--ease-out);
}

@keyframes contentReveal {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Selection styling */
::selection {
  background: var(--accent);
  color: var(--white);
}

/* Focus states for accessibility - 접근성 강화 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Smooth scroll anchor offset */
:target {
  scroll-margin-top: 100px;
}

/* 15. UTILITY CLASSES */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Skip Link for Accessibility - 접근성 강화 */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--white);
  padding: var(--space-sm) var(--space-lg);
  border-radius: 0 0 8px 8px;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 9999;
  transition: top var(--duration-fast) var(--ease-out);
}

.skip-link:focus {
  top: 0;
  outline: none;
}

.text-accent {
  color: var(--accent);
}
.text-muted {
  color: var(--slate);
}
.font-display {
  font-family: var(--font-display);
}

/* 16. PRINT STYLES */
@media print {
  #header_wrap,
  #sidebar,
  #footer,
  .admin-tools,
  #progress,
  .container_postbtn {
    display: none;
  }

  #main {
    display: block;
  }

  .post-content {
    max-width: none;
    font-size: 12pt;
  }
}

/* 17. REDUCED MOTION - 접근성 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  #progress {
    animation: none;
  }
}
