/* collapsible.css - 折りたたみ機能のスタイル（修正版） */

/* 折りたたみ可能なセクションのスタイル */
.collapsible-section {
  border: 1px solid #ddd;
  border-radius: 5px;
  margin-bottom: 2rem;
  overflow: hidden;
}

.collapsible-header {
  background-color: #f5f5f5;
  padding: 1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0;
  border-bottom: none;
  position: relative;
  z-index: 2;
  font-weight: bold;
  font-size: 1.2rem;
}

.collapsible-header:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.toggle-icon {
  transition: transform 0.3s ease;
  font-size: 1rem;
  display: inline-block;
  margin-left: 0.5rem;
  color: #333;
}

.collapsible-section.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.collapsible-content {
  max-height: 1000px;
  overflow: auto;
  transition: max-height 0.5s ease-in-out;
  padding: 1rem;
}

.collapsible-section.collapsed .collapsible-content {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  border-top: none;
}

/* モバイル向け特別スタイル */
@media (max-width: 768px) {
  .collapsible-section {
    position: relative;
    z-index: 10;
    margin-bottom: 1rem;
    border: 2px solid #ddd;
  }
  
  .collapsible-header {
    padding: 12px 15px;
    font-weight: bold;
    font-size: 1.1rem;
    background-color: #e9f0f7;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .collapsible-header::after {
    content: "▼";
    display: inline-block;
    margin-left: 8px;
    font-size: 0.9rem;
    transition: transform 0.3s ease;
  }
  
  .collapsible-section.collapsed .collapsible-header::after {
    transform: rotate(-90deg);
  }
  
  .toggle-icon {
    display: none; /* モバイルでは ::after 疑似要素を使用するため非表示 */
  }
  
  .collapsible-content {
    max-height: 300px;
    padding: 0.75rem;
  }
  
  /* モバイルでは目次を最初から折りたたむ */
  #toc.collapsible-section {
    margin-bottom: 1rem;
  }
  
  #toc.collapsible-section.collapsed .collapsible-content {
    max-height: 0;
    padding: 0;
    visibility: hidden;
  }
}
