/* ベーススタイル */
body {
  font-family: 'Noto Sans JP', sans-serif;
  background-color: #fff;
  color: #222;
  line-height: 1.8;
  padding: 0;
  margin: 0;
}

/* ------------- header ------------- */
.site-logo { max-height: 48px; height: auto; width: auto; display: block;}

/* レスポンシブ記事ラッパー */
.post-wrapper {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 16px;
}

.post-thumbnail img {
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.post-title {
  font-size: 28px;
  font-weight: bold;
  margin: 24px 0 12px;
}

.post-meta {
  font-size: 14px;
  color: #666;
  margin-bottom: 24px;
}

.post-toc {
  background-color: #fff;
  border: 1px solid #ddd;
  padding: 20px;
  border-radius: 8px;
  margin: 32px 0;
  font-size: 15px;
  position: relative;
}

.post-toc h2 {
  font-size: 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  font-weight: bold;
}

.post-toc h2 i {
  margin-right: 8px;
  color: #666;
}

.post-toc ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
  max-height: 280px; /* 閉じた状態の高さ */
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.post-toc ul.expanded {
  max-height: 1000px; /* 開いた状態 */
}

.post-toc li {
  margin-bottom: 6px;
}

.post-toc li a {
  text-decoration: none;
  color: #222;
  display: block;
  padding-left: 4px;
}

.post-toc li[data-level="2"] a {
  font-weight: bold;
  font-size: 15px;
}

.post-toc li[data-level="3"] a {
  font-size: 14px;
  padding-left: 16px;
  color: #444;
}

.toc-toggle {
  display: block;
  margin: 12px auto 0;
  background-color: #f5f5f5;
  border: 1px solid #ccc;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}

.toc-divider {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 12px 0 16px;
}

.post-content {
  margin-top: 24px;
}

.post-content h2 {
  margin-top: 40px;
  border-left: 4px solid #e0b354;
  padding-left: 12px;
  scroll-margin-top: calc(var(--header-h) + 8px);
}

/* 👇 H3に下線を付ける装飾 */
.post-content h3 {
  margin-top: 32px;
  position: relative;
  padding-bottom: 8px;
  font-weight: bold;
  font-size: 18px;
  color: #333;
  scroll-margin-top: calc(var(--header-h) + 8px);
}

.post-content h3::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background-color: #e0b354; /* アクセントカラーの下線 */
}

.post-content pre {
  background: #111;
  color: #eee;
  padding: 16px;
  border-radius: 6px;
  overflow-x: auto;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 24px;
}

.post-content th, .post-content td {
  border: 1px solid #ccc;
  padding: 8px;
}

.post-share {
  margin-top: 48px;
  background: #f0f0f0;
  padding: 24px;
  border-radius: 8px;
  text-align: center;
}

.post-share p{
  margin-top: 0px;
}

.post-share a {
  margin: 0 12px;
  text-decoration: none;
  color: #fff;
  font-weight: bold;
}

@media (max-width: 768px) {
  .post-wrapper {
    padding: 24px 12px;
  }

  .post-title {
    font-size: 22px;
  }

  .post-toc h2 {
    font-size: 16px;
  }
}

/* ===== シェアボタン ===== */
.share-buttons{
  display:flex;
  justify-content:center;
  gap:16px;
  margin:20px 0 0;
  padding:0;
  list-style:none;
}
.share-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:44px; height:44px;
  border-radius:50%;
  font-size:20px;
  color:#fff;
  transition:opacity .3s ease;
  border:none;
}
.share-btn:hover{ opacity:.8; }

/* ブランドカラー */
.share-btn.facebook{ background:#1877F2; }
.share-btn.x       { background:#000;   }
.share-btn.line    { background:#06C755; }

/* アクセシビリティ用にアイコン以外を非表示 */
.sr-only{
  position:absolute;
  clip:rect(1px,1px,1px,1px);
  height:1px; width:1px; overflow:hidden;
}

/* 外部リンクモーダル */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0; top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: #fff;
  padding: 24px;
  border-radius: 8px;
  max-width: 90%;
  width: 320px;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  animation: slideUp 0.3s ease;
}

.modal-buttons {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.modal-buttons button {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 4px;
  font-size: 15px;
  cursor: pointer;
}

#modal-cancel {
  background: #eee;
  color: #333;
}

#modal-confirm {
  background: #007BFF;
  color: #fff;
}

/* アニメーション */
@keyframes fadeIn {
  from { background: rgba(0,0,0,0); }
  to   { background: rgba(0,0,0,0.5); }
}

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

/* ─── タクソノミー ───────────────────────── */
.post-taxonomy{
  margin:32px 0 24px;
  font-size:.875rem;
  display:flex; gap:12px; flex-wrap:wrap;
}
.post-taxonomy i{ margin-right:4px; color:#888; }
.post-cats a, .post-tags a{
  color:#007acc; text-decoration:none; margin-right:6px;
}
.post-cats a:hover, .post-tags a:hover{ text-decoration:underline; }

/* ─── カスタムページネーション ───────────────────── */
.post-pagination{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:24px;
  margin:60px 0;
}
.pagination-link{
  flex:1;
  display:flex;
  align-items:center;
  gap:16px;
  text-decoration:none;
  color:#222;
  font-size:.9rem;
  line-height:1.4;
  transition:opacity .25s ease;
}
.pagination-link:hover{ opacity:.8; }

.arrow-bar{
  width:28px; height:64px;
  background:#0A1238;           /* 濃紺バー */
  display:flex; align-items:center; justify-content:center;
}
.arrow-bar i{ color:#fff; font-size:18px; }

/* 右側リンクはバーを右端に */
.next-post{ justify-content:flex-end; }
.next-post .arrow-bar{ order:2; } /* タイトル→バー の順 */

/* モバイル：縦並び */
@media(max-width:768px){
  .post-pagination{
    flex-direction:column;
    gap:20px;
    align-items:stretch;
  }
  /* 前の記事：左寄せ */
  .prev-post{
    justify-content:flex-start;
    align-self:flex-start;        /* 左側に配置 */
    text-align:left;
  }
  /* 次の記事：右寄せ */
  .next-post{
    justify-content:flex-end;
    align-self:flex-end;          /* 右側に配置 */
    text-align:right;
  }
}

/* ─── 関連記事 ──────────────────── */
.related-posts{ margin:60px 0; }
.related-posts h2{ font-size:1.2rem; margin:0 0 16px; }
.related-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(280px,1fr));
  gap:24px;
}
.related-item{
  background:#fff; border:1px solid #e0e0e0; border-radius:4px;
  overflow:hidden; transition:transform .2s;
}
.related-item:hover{ transform:translateY(-4px); }
.related-item img{ width:100%; height:auto; display:block; }
.related-item time{
  display:block; font-size:.75rem; color:#777; margin:8px 12px 0;
}
.related-item h3{
  font-size:.9rem; font-weight:600;
  margin:4px 12px 12px; line-height:1.4;
  color:#222;
}

/* モバイル調整 */
@media(max-width:768px){
  .related-grid{ grid-template-columns:1fr 1fr; gap:16px; }
  .post-pagination{ flex-direction:column; gap:12px; }
}