.postview-container {
  margin-top: 100px;
  margin-left: 15px;
  margin-right: 15px;
}

/* 떠다니는 목차 (데스크탑) */
.floating-toc {
    position: fixed;
    top: 80px;
    left: calc(50% - 640px / 2 - 280px);
    background: #f7f9fa;
    border: 1px solid #ccc;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    max-width: 250px;
    max-height: 50vh; /* 화면 높이의 80%까지만 */
    overflow-y: auto;  /* 세로 스크롤 허용 */
    z-index: 999;
    display: none;
  }
  
  .floating-toc .toc-title {
    display: block;
    font-weight: bold;
    margin-bottom: 1rem;
  }

  html.dark .floating-toc {
    background: #1f1f2b;
    border-color: #444;
    color: #ddd;
  }
  
  @media (max-width: 768px) {
    .floating-toc {
      display: none !important; /* 모바일에서는 아예 숨김 */
    }
  }

  /* 모바일 전용 목차 버튼 */
  .mobile-toc-button {
    position: fixed;
    bottom: 80px;
    right: 20px;
    padding: 7px 16px;

    font-size: 16px;
    font-weight: bold;
    background-color: #0077cc;
    color: white;
    border-radius: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 99999;
    transition: opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
  }
  
  
  @media (max-width: 768px) {
    .mobile-toc-button {
      display: flex;
    }
  }
  
  /* 모바일 토글 목차 */
  .mobile-toc-modal {
    position: fixed;
    top: 0;
    left: 10px;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    box-sizing: border-box;
    overflow: hidden;
    padding: 2rem;   
  }
  
  .mobile-toc-content {
    background: white;
    border-radius: 8px;
    max-width: 100%;
    max-height: 100%;
    overflow-y: auto;
    padding: 1rem;         /* 내부 여백 */
    margin: 0 1rem;  
  }
  
  html.dark .mobile-toc-content {
    background: #1f1f2b;
    color: white;
  }

  .mobile-toc-button {
    transition: opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
  }
  
  .mobile-toc-button.show {
    opacity: 1;
    pointer-events: auto;
  }

  html.modal-open,
body.modal-open {
    overflow: hidden;
    touch-action: none; /* 터치 스크롤도 차단 */
    height: 100%; /* 모바일 크롬 대응 */
  }

 
  /* 📘 전체 구조 */

.post-content {
  line-height: 1.7;
  font-size: 1rem;
  color: #333;
  max-width: 640px;
  margin: 0 auto;
  padding-left: 0.5rem;
  position: relative;
}

html.dark body .post-content {
  color: #ddd;
}

/* 📝 제목, 본문 요소 간격 */

.post-content h1,
.post-content h2 {
  margin-top: 2rem;
  margin-bottom: 2rem;
  line-height: 1.3;
}

.post-content p {
  margin-bottom: 2rem;
}

.post-content ul,
.post-content ol {
  padding-left: 1em;
  margin: 0.3rem 0;
}

.post-content li {
  margin: 0;
  padding: 0;
}

.post-content footer {
  display: block;
  font-size: 0.85rem;
  color: #666;
  margin: 0.3em 0;
  line-height: 1.5;
}

html.dark .post-content footer {
  color: #aaa;
}

/* 🧭 목차 (.auto-toc 포함) */



.post-content .auto-toc {
  background: #f7f9fa;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  padding: 1rem;
  font-size: 0.95rem;
  line-height: 1.4;
  width: 100%;
  max-width: 280px;
  margin-bottom: 1rem;
  margin-left: 0;
  margin-right: auto;
}

@media (max-width: 768px) {
  .post-content .auto-toc {
    max-width: 100%;      /* 뷰포트에 맞게 줄어듦 */
    box-sizing: border-box;
    padding: 1rem;
    margin-left: auto;
    margin-right: auto;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  .toc-list a {
    word-break: break-word;  /* 긴 링크 줄바꿈 */
    white-space: normal;     /* 텍스트 줄바꿈 허용 */
  }
}

.post-content .auto-toc .toc-title {
  font-weight: bold;
  margin-bottom: 0;
  display: block;
}

.post-content .auto-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-content .auto-toc li {
  margin: 0.1em 0;
  line-height: 1.2;
  padding-right: 0;
}

.post-content .auto-toc li.toc-h1 {
  margin-top: 0.8rem;
}

.post-content .auto-toc + h1,
.post-content .auto-toc + h2 {
  margin-top: 0.5rem !important;
}

html.dark .post-content .auto-toc {
  background: #1f1f2b;
  border: 1px solid #444;
  color: #ddd;
}

/* 🧾 TOC 링크 리스트 */

.toc-list {
  font-size: 0; /* 줄바꿈 공백 제거 */
}

.toc-list a {
  display: block;
  font-size: 14px;
  line-height: 1.4;
  padding: 2px 6px;
  border-radius: 4px;
  color: #0366d6;
  text-decoration: none;
  transition: all 0.2s ease;
}

.toc-list a:hover {
  color: #999ff9 !important;
  text-decoration: underline !important;
}

html.dark .toc-list a {
  color: #6fb7ff !important;
}

html.dark .toc-list a:hover {
  color: #a2d4ff !important;
}

.toc-item.toc-h2 {
  padding-left: 1.2rem;
}

/* ✍️ 타이틀/메타/로고 */

.postview-container .post-title {
  font-size: 1.5rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 1rem;
}

.postview-container .post-meta {
  text-align: center;
  font-size: 0.9rem;
  color: #777;
  margin-bottom: 2rem;
}

/* ✏️ 수정/삭제 버튼 */

.postview-container .post-actions {
  text-align: center;
  margin-top: 2rem;
}

.postview-container .post-actions a.edit-btn,
.postview-container .post-actions form button {
  display: inline-block;
  padding: 4px 10px;
  margin: 0 4px;
  border: none;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.postview-container .post-actions a.edit-btn {
  background-color: #f0f8ff;
  color: #0077cc;
  text-decoration: none;
}

.postview-container .post-actions a.edit-btn:hover {
  background-color: #d8edff;
  color: #005fa3;
}

.postview-container .post-actions form button {
  background-color: #fff0f0;
  color: #cc0000;
  border: 1px solid #cc0000;
}

.postview-container .post-actions form button:hover {
  background-color: #ffe5e5;
  color: #a30000;
}


.mobile-toc-content strong {
  display: block;         /* 인라인 → 블록으로 바꿔야 margin이 적용됨 */
  margin-bottom: 0.8em;    /* "목차"랑 1번 목차 사이 간격 */
}
