.content {
    counter-reset: h2 -0;
}

/* H2 */

.content h2 {
    counter-increment: h2;
    counter-reset: h3;
    
    font-size: 1.8rem;
    text-align: left;
    vertical-align: middle;
    font-weight: bold;
}

.content h2::before {
    content: counter(h2) ". ";
}


/* H3 */

.content h3 {
    counter-increment: h3;
    counter-reset: h4;
    
    font-size: 1.2rem;
    font-weight: bold;
    position: relative;
    
    border-left: 8px solid #4ecdc4;
    
    padding-left: 17px;
    margin-top: 30px;
    line-height: 1.5;
    clear:both;
}


.content h3::before {
    content: counter(h2) "." counter(h3) " ";
    
    position: static;
    left: auto;
    top: auto;
    bottom: auto;
    width: auto;
    height: auto;
    background-color: transparent;
    
    display: inline;
}

/* H4 */

.content h4 {
    counter-increment: h4;
    
    border-left: 6px solid #2eada4;
    padding-left: 8px;
    margin-top: 30px;
    font-size: 1.1rem;
    font-weight: bold;
    clear:both;
}

.content h4::before {
    content:
    counter(h2) "."
    counter(h3) "."
    counter(h4)
    " ";
}

th, td {
    font-weight: 200;
}


/**
 * aside.css
 * 本文中の注記を右端に配置
 * 
 * HTMLは <span class="aside">注記</span> を使用
 */

/* asideの基本スタイル（デスクトップ） */
span.aside {
  display: inline-block;
  width: 202px; /* 250px → 202px（3em分狭く） */
  padding-left: 1em;
  border-left: 1px solid #e0e0e0;
  font-size: 0.85em;
  color: #666;
  line-height: 1.6;
  vertical-align: top;
}

/* PC版: 注番号を表示 */
span.aside[data-desktop-note-number]::before {
  content: attr(data-desktop-note-number) ": ";
  font-weight: 600;
  color: #14b8a6;
  display: inline; /* block → inline に変更 */
  margin-right: 0.3em; /* margin-bottom → margin-right に変更 */
}

/* 本文中のアンカー */
sup.aside-anchor {
  color: #14b8a6;
  font-size: 0.75em;
  margin-left: 0.1em;
  cursor: default;
  font-weight: normal;
}

/* 注記内のリンク */
span.aside a {
  /*color: #14b8a6;*/
  text-decoration: none;
}

span.aside a:hover {
  text-decoration: underline;
}

/* レスポンシブ対応（狭い画面） */
@media screen and (max-width: 1200px) {
  /* 章末の注記コンテナ */
  div.chapter-notes {
    margin: 1em 0 1.5em 0 !important;
    padding: 0.6em !important;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    box-sizing: border-box !important;
    width: auto !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }
  
  div.chapter-notes .notes-header {
    font-size: 0.95em !important;
    font-weight: 600 !important;
    color: #333 !important;
    margin: 0 0 0.5em 0 !important;
    padding: 0 0 0.3em 0 !important;
    border-bottom: 2px solid #14b8a6 !important;
    box-sizing: border-box !important;
  }
  
  /* 注記カード（ポストイット風） - 詳細度を上げる */
  div.chapter-notes > span.aside[data-note-number] {
    display: block !important;
    background: white !important;
    margin: 0.3em 0 !important;
    padding: 0.4em 0.6em !important;
    border-radius: 3px !important;
    border-left: 3px solid #14b8a6 !important;
    width: auto !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
    position: static !important;
    float: none !important;
    font-size: 0.85em !important;
  }
  
  /* 注番号を表示 */
  div.chapter-notes > span.aside[data-note-number]::before {
    content: attr(data-note-number) ": " !important;
    font-weight: 600 !important;
    color: #14b8a6 !important;
  }

  /* PC版の注番号を非表示 */
  div.chapter-notes > span.aside[data-desktop-note-number]::before {
    display: none !important;
  }
  
  /* 注記内のテキストもはみ出さないように */
  div.chapter-notes > span.aside * {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* 印刷時 */
@media print {
  span.aside {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 1em 0;
    padding: 0.5em;
    border: 1px solid #ccc;
    background: #f5f5f5;
    page-break-inside: avoid;
  }
}

p:has(span.aside) { display: flow-root; }

/* 目次 */
.content .toc {
    margin: 2.5rem 0 4rem;
    padding: 1.5rem 2rem;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.content .toc-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

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

.content .toc-list li {
    margin: 0.35em 0;
}

.content .toc-list a {
    color: inherit;
    text-decoration: none;
}

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

.content .toc-number {
    display: inline-block;
    min-width: 3.5em;
    color: #4ecdc4;
}

.content .toc-level-3 {
    padding-left: 1.5rem;
}

.content .toc-level-4 {
    padding-left: 3rem;
    font-size: 0.95em;
}

/* summary の既定マーカーを消して自前の三角に差し替える */
.toc-title {
    cursor: pointer;
    list-style: none;
}
.toc-title::-webkit-details-marker {
    display: none;
}
.toc-title::before {
    content: "▶";
    display: inline-block;
    margin-right: 0.4em;
    font-size: 0.8em;
    color: #14b8a6;
    transition: transform 0.15s;
}
.toc-body[open] > .toc-title::before {
    transform: rotate(90deg);
}
