#TableOfContents {
  border: 1px solid black;
  padding: 1em;
  margin: 1em;
}

@media screen and (min-width:600px){
  #TableOfContents {
    width: 200px;
    float: right;
  }
}

.sidebar-label {
  font-size: small;
  font-family:"MS Pゴシック",sans-serif;
  text-decoration: none;
}

.tag-cloud a{
  text-decoration: none;
}

pre {
  border-radius: 10px;
}

pre > code {
  padding: 20px;
}

/* タグページのカバー画像 */
.tag-cover-image {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 2em;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tag-cover-image img {
  width: 100%;
  height: auto;
  display: block;
}

/* タグページの説明文 */
.tag-description {
  font-size: 1.1em;
  color: #666;
  margin: 1em 0 1.5em 0;
  line-height: 1.6;
}

.tag-content {
  margin: 0 0 2em 0;
  padding: 1.5em;
  background: #f9f9f9;
  border-radius: 4px;
  line-height: 1.7;
}

.tag-content p {
  margin: 0.5em 0;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .tag-cover-image {
    margin: 0 0 1.5em;
    border-radius: 4px;
  }
  
  .tag-description {
    font-size: 1em;
    padding: 0 0.5em;
  }
  
  .tag-content {
    padding: 1em;
    margin-left: 0;
    margin-right: 0;
  }
}

/* 更新日付表示 */
.meta .lastmod {
  color: #e67e22;
  font-weight: 500;
  margin-left: 0.5em;
}

/* ============================================
   Related Posts & Popular Tag Posts Styling
   ============================================ */

/* Related Posts Section */
.related-posts {
  margin-top: 3em;
  padding-top: 2em;
  border-top: 2px solid #e0e0e0;
}

.related-posts-title {
  font-size: 1.5em;
  color: #333;
  margin-bottom: 1.5em;
  font-weight: bold;
}

.related-posts-list {
  display: grid;
  gap: 1.5em;
}

.related-post-item {
  padding: 1.2em;
  background: #f9f9f9;
  border-radius: 6px;
  border-left: 4px solid #3498db;
  transition: transform 0.2s, box-shadow 0.2s;
}

.related-post-item:hover {
  transform: translateX(5px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.related-post-title {
  font-size: 1.1em;
  margin: 0 0 0.5em 0;
}

.related-post-title a {
  color: #2c3e50;
  text-decoration: none;
  font-weight: 600;
}

.related-post-title a:hover {
  color: #3498db;
}

.related-post-date {
  display: block;
  font-size: 0.85em;
  color: #888;
  margin-bottom: 0.5em;
}

.related-post-summary {
  font-size: 0.9em;
  color: #666;
  line-height: 1.6;
  margin: 0.5em 0;
}

.related-post-tags {
  margin-top: 0.8em;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
}

.related-post-tag {
  display: inline-block;
  padding: 0.2em 0.6em;
  background: #ecf0f1;
  color: #555;
  font-size: 0.75em;
  border-radius: 3px;
  font-weight: 500;
}

/* Popular Tag Posts Section */
.popular-tag-posts {
  margin: 2em 0;
  padding: 1.5em;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
}

.popular-posts-title {
  font-size: 1.3em;
  color: #333;
  margin-bottom: 1.2em;
  font-weight: bold;
  border-bottom: 2px solid #3498db;
  padding-bottom: 0.5em;
}

.popular-posts-list {
  display: grid;
  gap: 1.2em;
}

.popular-post-item {
  padding: 1em;
  background: #f9f9f9;
  border-radius: 4px;
  border-left: 3px solid #e67e22;
}

.popular-post-title {
  font-size: 1em;
  margin: 0 0 0.5em 0;
}

.popular-post-title a {
  color: #2c3e50;
  text-decoration: none;
  font-weight: 600;
}

.popular-post-title a:hover {
  color: #e67e22;
}

.popular-post-date {
  display: block;
  font-size: 0.8em;
  color: #888;
  margin-bottom: 0.5em;
}

.popular-post-summary {
  font-size: 0.85em;
  color: #666;
  line-height: 1.5;
  margin: 0;
}

/* Related Tags Section */
.related-tags-section {
  margin: 2em 0;
  padding: 1.5em;
  background: #f0f8ff;
  border-radius: 6px;
}

.related-tags-title {
  font-size: 1.2em;
  color: #333;
  margin-bottom: 1em;
  font-weight: bold;
}

.related-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8em;
}

.related-tag-link {
  display: inline-block;
  padding: 0.5em 1em;
  background: #3498db;
  color: #fff;
  text-decoration: none;
  border-radius: 20px;
  font-size: 0.9em;
  font-weight: 500;
  transition: background 0.2s, transform 0.2s;
}

.related-tag-link:hover {
  background: #2980b9;
  transform: translateY(-2px);
  box-shadow: 0 2px 6px rgba(52, 152, 219, 0.3);
}

/* Responsive Design */
@media (min-width: 768px) {
  .related-posts-list {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .popular-posts-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 767px) {
  .related-posts {
    margin-top: 2em;
    padding-top: 1.5em;
  }
  
  .related-posts-title,
  .popular-posts-title,
  .related-tags-title {
    font-size: 1.2em;
  }
  
  .popular-tag-posts,
  .related-tags-section {
    padding: 1em;
    margin: 1.5em 0;
  }
  
  .related-post-item,
  .popular-post-item {
    padding: 0.8em;
  }
}

/* 記事のカバー画像 */
.cover-image {
  width: 100%;
  max-width: 1200px;
  margin: 1.5em auto;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.cover-image img {
  width: 100%;
  height: auto;
  display: block;
}

/* レスポンシブ対応 */
@media screen and (max-width: 768px) {
  .cover-image {
    margin: 1em 0;
    border-radius: 4px;
  }
}

/* ============================================
   Sidebar Responsive Behavior with Toggle
   ============================================ */

/* サイドバートグルボタン */
.sidebar-toggle-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  display: none;
  transition: all 0.3s ease;
  padding: 0;
}

.sidebar-toggle-btn span {
  display: block;
  line-height: 56px;
  text-align: center;
}

.sidebar-toggle-btn:hover {
  background: #2980b9;
  transform: scale(1.1);
}

.sidebar-toggle-btn:active {
  transform: scale(0.95);
}

/* 1199px以下でトグルボタンを表示 */
@media screen and (max-width: 1199px) {
  .sidebar-toggle-btn {
    display: block;
  }
}

/* サイドバーオーバーレイ（背景の暗転） */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* タブレット以下でのサイドバー */
@media screen and (max-width: 1199px) {
  aside.sidebar {
    position: fixed !important;
    top: 0 !important;
    right: -400px !important;  /* 完全に隠す（パディング含む実際の幅より大きく） */
    width: 320px !important;
    height: 100% !important;
    overflow-y: auto !important;
    background: #fff !important;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15) !important;
    z-index: 1001 !important;
    transition: right 0.3s ease !important;
    padding: 20px !important;
    box-sizing: border-box !important;  /* パディングを幅に含める */
    float: none !important;
    margin: 0 !important;
  }
  
  /* サイドバーが開いている状態 */
  aside.sidebar.active {
    right: 0 !important;
    display: block !important;
    visibility: visible !important;
  }
  
  /* サイドバーが開いている状態 */
  aside.sidebar.active {
    right: 0 !important;
  }
  
  /* サイドバー非表示時はコンテンツ幅を最大化 */
  #content {
    margin-right: 0 !important;
  }
  
  /* サイドバー内のセクション調整 */
  aside.sidebar section {
    width: 100% !important;
    float: none !important;
    margin-left: 0 !important;
  }
  
  /* 閉じるボタン */
  aside.sidebar::before {
    content: '×';
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 36px;
    color: #666;
    cursor: pointer;
    z-index: 1002;
  }
}

/* デスクトップ（1200px以上）では通常表示 */
@media screen and (min-width: 1200px) {
  aside.sidebar {
    display: block;
    position: static !important;
    right: auto !important;
  }
  
  .sidebar-toggle-btn,
  .sidebar-overlay {
    display: none !important;
  }
}

/* ================================================
   Social Share Buttons - Compact & Modern Design
   ================================================ */

.social-share {
  margin: 2rem 0 1.5rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.social-share-title {
  margin: 0 0 0.875rem 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #555;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.social-share-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.social-share-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  border-radius: 20px;
  text-decoration: none;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.social-share-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.social-share-button:hover::before {
  left: 100%;
}

.social-share-button:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  text-decoration: none;
}

.social-share-button:active {
  transform: translateY(0) scale(0.98);
}

.social-share-button svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
}

.social-share-button span {
  position: relative;
  z-index: 1;
}

/* X (Twitter) */
.social-share-button.twitter {
  background: linear-gradient(135deg, #000000 0%, #2c2c2c 100%);
}

.social-share-button.twitter:hover {
  background: linear-gradient(135deg, #1a1a1a 0%, #404040 100%);
}

/* Facebook */
.social-share-button.facebook {
  background: linear-gradient(135deg, #1877f2 0%, #0c5bd6 100%);
}

.social-share-button.facebook:hover {
  background: linear-gradient(135deg, #2d88ff 0%, #1a6de8 100%);
}

/* LINE */
.social-share-button.line {
  background: linear-gradient(135deg, #06c755 0%, #05a847 100%);
}

.social-share-button.line:hover {
  background: linear-gradient(135deg, #07d85f 0%, #06b850 100%);
}

/* Hatena Bookmark */
.social-share-button.hatena {
  background: linear-gradient(135deg, #00a4de 0%, #0088b8 100%);
}

.social-share-button.hatena:hover {
  background: linear-gradient(135deg, #1ab3ed 0%, #0097ca 100%);
}

/* LinkedIn */
.social-share-button.linkedin {
  background: linear-gradient(135deg, #0077b5 0%, #005885 100%);
}

.social-share-button.linkedin:hover {
  background: linear-gradient(135deg, #0088cc 0%, #006699 100%);
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
  .social-share {
    padding: 1rem;
    margin: 1.5rem 0 1rem;
  }
  
  .social-share-title {
    font-size: 0.75rem;
    margin-bottom: 0.75rem;
  }
  
  .social-share-buttons {
    gap: 0.4rem;
  }
  
  .social-share-button {
    padding: 0.4rem 0.75rem;
    font-size: 0.7rem;
    border-radius: 18px;
  }
  
  .social-share-button svg {
    width: 14px;
    height: 14px;
  }
}

@media screen and (max-width: 480px) {
  .social-share {
    padding: 0.875rem;
  }
  
  .social-share-buttons {
    justify-content: center;
  }
  
  .social-share-button {
    flex: 0 1 auto;
  }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  .social-share {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-color: rgba(255, 255, 255, 0.1);
  }
  
  .social-share-title {
    color: #b8b8b8;
  }
}
