@charset "utf-8";
/*
 * Document single page styles
 * custom css: single-documents.php
 */

/* ========================================
   Layout
   ======================================== */

/* ページ背景 */
.single-documents #main_contents {
  background-color: #e8f0f0;
}

/* パンくず */
.single-documents #bread_crumb {
  background-color: #f5f5f5;
}

/* テーマデフォルトの #main_col を無効化 */
.single-documents #main_col {
  display: none;
}

/* 2カラムレイアウト */
#document_wrap {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px;
  gap: 30px;
  position: relative;
}

/* ========================================
   Sidebar
   ======================================== */

#document_sidebar {
  width: 250px;
  min-width: 250px;
  flex-shrink: 0;
}

.doc-chapter-nav {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  background: #fff;
  border-radius: 8px;
  padding: 20px 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.doc-sidebar-title {
  font-size: 14px;
  font-weight: 700;
  color: #249396;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid #249396;
  line-height: 1.5;
}

.doc-chapter-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.doc-chapter-nav li {
  margin-bottom: 2px;
}

.doc-chapter-nav a {
  display: block;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.5;
  color: #555;
  text-decoration: none;
  border-radius: 4px;
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
}

.doc-chapter-nav a:hover {
  color: #249396;
  background: #f0f8f8;
}

.doc-chapter-nav a.is-active {
  font-weight: 700;
  color: #222;
  background: #eef7f7;
  border-left-color: #249396;
}

/* ========================================
   Main content
   ======================================== */

#document_main {
  flex: 1;
  min-width: 0;
  background: #fff;
  border-radius: 8px;
  padding: 40px 48px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* ページタイトル */
.doc-page-title {
  font-size: 26px;
  font-weight: 700;
  color: #222;
  margin: 0 0 30px;
  padding-bottom: 16px;
  border-bottom: 3px solid #249396;
  line-height: 1.4;
}

/* 本文 */
#document_main .post_content {
  font-size: 16px;
  line-height: 1.9;
  letter-spacing: 0.96px;
  color: #333;
}

#document_main .post_content p {
  margin-bottom: 1.5em;
}

/* 章セクション: デフォルト非表示、.is-visible で表示 */
.doc-chapter-section {
  display: none;
  margin-bottom: 48px;
}

.doc-chapter-section.is-visible {
  display: block;
}

/* 章タイトル (h2) */
#document_main .post_content h2 {
  font-size: 28px;
  font-weight: 700;
  color: #249396;
  margin: 0 0 20px;
  padding: 12px 0 12px 20px;
  border-left: 7px solid #249396;
  line-height: 1.4;
  scroll-margin-top: 80px;
}

/* セクション見出し (h3) */
#document_main .post_content h3 {
  font-size: 24px;
  font-weight: 700;
  color: #333;
  margin: 40px 0 20px;
  padding-bottom: 8px;
  border-bottom: 2px solid #249396;
  line-height: 1.4;
  scroll-margin-top: 80px;
}

/* サブセクション (h4) */
#document_main .post_content h4 {
  font-size: 18px;
  font-weight: 700;
  color: #444;
  margin: 32px 0 16px;
  padding: 14px;
  border-left: 4px solid #cdcdcd;
  line-height: 1.4;
  scroll-margin-top: 80px;
}

/* h5, strong */
#document_main .post_content h5,
#document_main .post_content strong {
  font-weight: 700;
}

/* ========================================
   Chapter bottom nav (前後の章リンク)
   ======================================== */

.doc-chapter-nav-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid #e0e0e0;
  gap: 16px;
}

.doc-chapter-nav-bottom a {
  display: inline-block;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 700;
  color: #fff !important;
  background: #249396;
  border-radius: 6px;
  text-decoration: none !important;
  transition: background 0.2s;
  max-width: 45%;
  line-height: 1.5;
}

.doc-chapter-nav-bottom a:hover {
  background: #1e7d80;
}

.doc-chapter-nav-bottom .doc-nav-prev {
  text-align: left;
}

.doc-chapter-nav-bottom .doc-nav-next {
  text-align: right;
  margin-left: auto;
}

/* ========================================
   TOC Card (章内目次)
   ======================================== */

.doc-toc-card {
  border: 7px solid #eaeaea;
  border-radius: 8px;
  margin-bottom: 24px;
  overflow: hidden;
}

.doc-toc-toggle {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: #f9f9f9;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: #333;
  text-align: left;
  transition: background 0.2s;
}

.doc-toc-toggle:hover {
  background: #f0f0f0;
}

.doc-toc-toggle-icon {
  display: inline-block;
  font-size: 11px;
  transition: transform 0.2s;
  margin-right: 4px;
}

.doc-toc-toggle[aria-expanded="false"] .doc-toc-toggle-icon {
  transform: rotate(-90deg);
}

.doc-toc-list {
  list-style: none;
  margin: 0;
  padding: 12px 16px 12px 24px;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  overflow: hidden;
}

.doc-toc-card.is-collapsed {
  margin-bottom: 0;
}

.doc-toc-toggle[aria-expanded="false"] + .doc-toc-list {
  margin: 0 !important;
}

.doc-toc-card.is-collapsed .doc-toc-list {
  max-height: 0 !important;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.doc-toc-list li {
  margin-bottom: 6px;
  line-height: 1.5;
}

.doc-toc-list li a {
  font-size: 14px;
  color: #249396;
  text-decoration: none;
}

.doc-toc-list li a:hover {
  text-decoration: underline;
}

.doc-toc-list li.doc-toc-sub {
  padding-left: 16px;
}

.doc-toc-list li.doc-toc-sub a {
  font-size: 13px;
  color: #666;
}

/* ========================================
   Tables
   ======================================== */

#document_main .post_content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 14px;
  line-height: 1.6;
}

#document_main .post_content table th,
#document_main .post_content table td {
  padding: 10px 14px;
  border: 1px solid #ddd;
  text-align: left;
  vertical-align: top;
}

#document_main .post_content table thead th,
#document_main .post_content table tr:first-child th {
  background-color: #eaeaea;
  font-weight: 700;
}

#document_main .post_content table tbody tr:nth-child(even) {
  background-color: #f9fcfc;
}

/* ========================================
   Images
   ======================================== */

#document_main .post_content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* ========================================
   Lists
   ======================================== */

#document_main .post_content ul,
#document_main .post_content ol {
  margin: 12px 0 20px 24px;
  padding: 0;
}

#document_main .post_content li {
  margin-bottom: 6px;
  line-height: 1.7;
}

/* ========================================
   Code & Pre
   ======================================== */

#document_main .post_content code {
  background: #f4f4f4;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 14px;
}

#document_main .post_content pre {
  background: #f8f8f8;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 16px;
  overflow-x: auto;
  margin: 16px 0 24px;
}

#document_main .post_content pre code {
  background: none;
  padding: 0;
}

/* ========================================
   Mermaid diagrams
   ======================================== */

#document_main .post_content .mermaid {
  margin: 16px 0 24px;
  overflow-x: auto;
}

/* ========================================
   Mobile hamburger button
   ======================================== */

#doc_nav_toggle {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  padding: 12px 20px;
  background: #249396;
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  transition: background 0.2s;
}

#doc_nav_toggle:hover {
  background: #1e7d80;
}

.doc-nav-toggle-icon {
  margin-right: 4px;
}

/* Overlay */
#doc_overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s;
}

#doc_overlay.is-visible {
  display: block;
  opacity: 1;
}

/* ========================================
   Responsive (≤768px)
   ======================================== */

@media screen and (max-width: 768px) {
  #document_wrap {
    flex-direction: column;
    padding: 16px 12px;
    gap: 0;
  }

  /* サイドバー: モバイルではスライドイン */
  #document_sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 270px;
    min-width: 270px;
    height: 100vh;
    z-index: 999;
    background: #fff;
    overflow-y: auto;
    transition: left 0.3s ease;
    padding: 20px 0;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
  }

  #document_sidebar.is-open {
    left: 0;
  }

  .doc-chapter-nav {
    position: static;
    max-height: none;
    box-shadow: none;
    border-radius: 0;
  }

  #doc_nav_toggle {
    display: block;
  }

  /* メイン */
  #document_main {
    padding: 24px 16px;
    border-radius: 6px;
  }

  .doc-page-title {
    font-size: 20px;
  }

  #document_main .post_content h2 {
    font-size: 22px;
    padding: 10px 0 10px 14px;
    border-left-width: 5px;
  }

  #document_main .post_content h3 {
    font-size: 18px;
  }

  #document_main .post_content h4 {
    font-size: 16px;
  }

  #document_main .post_content {
    font-size: 15px;
    line-height: 26px;
  }

  #document_main .post_content table {
    font-size: 12px;
    display: block;
    overflow-x: auto;
  }
}
