#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;
  }
}

/* ================================================
   Screen Reader Only - Accessibility
   ================================================ */

/* 視覚的には非表示だがスクリーンリーダーで読み上げ可能 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ================================================
   Figure with Description (AI-generated images)
   ================================================ */

.figure-desc {
  margin: 1.5em 0;
}

.figure-desc img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

.figure-desc figcaption {
  margin-top: 0.5em;
  font-size: 0.9em;
  color: #666;
  text-align: center;
  font-style: italic;
}

/* Article title (h1) styles */
article h1,
article h1 a {
  color: #000000 !important;
  text-decoration: none !important;
  font-weight: bold !important;
}

article h1 a:hover {
  color: #000000 !important;
  text-decoration: none !important;
}

/* ================================================
   Pagefind Search UI Customization
   ================================================ */

/* Form wrapper - match original nav form positioning */
body > nav form.pagefind-form {
  -webkit-background-clip: padding;
  -moz-background-clip: padding;
  background-clip: padding-box;
  margin: 0;
  padding: 0;
  padding-top: 0.15em;
}

body > nav form.pagefind-form fieldset[role=search] {
  position: relative;
  border: 0;
  padding: 0;
  margin: 0;
}

/* Override Pagefind UI default styles - minimal scale */
.pagefind-ui {
  --pagefind-ui-scale: 0.65;
  --pagefind-ui-primary: #80b1df;
  --pagefind-ui-text: #444;
  --pagefind-ui-background: #fff;
  --pagefind-ui-border: #ddd;
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 0.5em;
  --pagefind-ui-font: "PT Sans", "Helvetica Neue", Arial, sans-serif;
}

/* Hide default Pagefind form wrapper styles */
.pagefind-ui .pagefind-ui__form {
  position: relative;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Hide the search icon */
.pagefind-ui .pagefind-ui__form::before {
  display: none !important;
}

/* Search input - match original .search class exactly */
.pagefind-ui .pagefind-ui__search-input {
  padding: 0.3em 0.5em !important;
  font-size: 0.85em !important;
  font-family: "PT Sans", "Helvetica Neue", Arial, sans-serif !important;
  line-height: 1.1em !important;
  width: 100% !important;
  height: auto !important;
  border-radius: 0.5em !important;
  background-color: #f2f2f2 !important;
  border: 1px solid #b3b3b3 !important;
  color: #888 !important;
  box-shadow: #d1d1d1 0 1px !important;
}

.pagefind-ui .pagefind-ui__search-input:focus {
  color: #444 !important;
  border-color: #80b1df !important;
  box-shadow: #80b1df 0 0 4px, #80b1df 0 0 3px inset !important;
  background-color: #fff !important;
  outline: none !important;
}

/* Search clear button - hide or minimal */
.pagefind-ui .pagefind-ui__search-clear {
  display: none !important;
}

/* Results dropdown container */
.pagefind-ui .pagefind-ui__drawer {
  position: absolute !important;
  top: 100% !important;
  right: 0 !important;
  left: auto !important;
  z-index: 1000 !important;
  background: #fff !important;
  border: 1px solid #ddd !important;
  border-radius: 0 0 0.5em 0.5em !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  max-height: 400px !important;
  overflow-y: auto !important;
  width: 350px !important;
  flex-direction: column !important;
  gap: 0 !important;
  margin-top: 2px !important;
}

/* Results area */
.pagefind-ui .pagefind-ui__results-area {
  padding: 0 !important;
  margin: 0 !important;
  min-width: auto !important;
  flex: none !important;
}

/* Results list */
.pagefind-ui .pagefind-ui__results {
  padding: 0.5em !important;
  margin: 0 !important;
}

/* Individual result styling */
.pagefind-ui .pagefind-ui__result {
  padding: 0.8em !important;
  margin: 0 0 0.5em 0 !important;
  border: none !important;
  border-left: 3px solid #80b1df !important;
  border-top: none !important;
  border-bottom: none !important;
  background: #f9f9f9 !important;
  border-radius: 0 4px 4px 0 !important;
  display: block !important;
  gap: 0 !important;
}

.pagefind-ui .pagefind-ui__result:last-of-type {
  border-bottom: none !important;
  margin-bottom: 0 !important;
}

.pagefind-ui .pagefind-ui__result:hover {
  background: #f0f0f0 !important;
}

/* Result inner container */
.pagefind-ui .pagefind-ui__result-inner {
  margin: 0 !important;
  flex: none !important;
}

/* Result title */
.pagefind-ui .pagefind-ui__result-title {
  font-size: 0.9em !important;
  margin: 0 0 0.3em 0 !important;
  display: block !important;
}

.pagefind-ui .pagefind-ui__result-link {
  color: #2c3e50 !important;
  font-weight: 600 !important;
  text-decoration: none !important;
}

.pagefind-ui .pagefind-ui__result-link:hover {
  color: #80b1df !important;
  text-decoration: underline !important;
}

/* Result excerpt */
.pagefind-ui .pagefind-ui__result-excerpt {
  font-size: 0.8em !important;
  color: #666 !important;
  line-height: 1.4 !important;
  margin: 0 !important;
  min-width: auto !important;
  display: block !important;
}

/* Highlighted search terms */
.pagefind-ui mark {
  background: #fff3cd !important;
  color: inherit !important;
  padding: 0 2px;
  border-radius: 2px;
}

/* Load more button */
.pagefind-ui .pagefind-ui__button {
  background: #80b1df !important;
  color: #fff !important;
  border: none !important;
  padding: 0.5em 1em !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  font-size: 0.85em !important;
  font-weight: normal !important;
  width: calc(100% - 1em) !important;
  margin: 0.5em !important;
  height: auto !important;
  text-align: center !important;
}

.pagefind-ui .pagefind-ui__button:hover {
  background: #5a9bd4 !important;
  border: none !important;
}

/* Message (no results, etc.) */
.pagefind-ui .pagefind-ui__message {
  color: #888 !important;
  font-size: 0.85em !important;
  padding: 1em !important;
  text-align: center !important;
  height: auto !important;
  font-weight: normal !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

/* Hide thumbnails and nested results */
.pagefind-ui .pagefind-ui__result-thumb,
.pagefind-ui .pagefind-ui__result-nested {
  display: none !important;
}

/* Hide filter panel */
.pagefind-ui .pagefind-ui__filter-panel {
  display: none !important;
}

/* Mobile: full width search */
@media only screen and (max-width: 549px) {
  body > nav form.pagefind-form fieldset[role=search] {
    float: right;
    width: 48%;
  }
  
  /* iOS: Prevent auto-zoom on focus (font-size must be >= 16px) */
  .pagefind-ui .pagefind-ui__search-input {
    font-size: 16px !important;
  }
  
  .pagefind-ui .pagefind-ui__drawer {
    position: fixed !important;
    top: 60px !important;  /* Below nav bar */
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: 60vh !important;
    border-radius: 0 !important;
    /* iOS: Ensure touch events work */
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    background: #fff !important;
    z-index: 9999 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
  }
  
  /* iOS: Ensure results are tappable */
  .pagefind-ui .pagefind-ui__result {
    cursor: pointer !important;
    -webkit-tap-highlight-color: rgba(128, 177, 223, 0.3) !important;
  }
  
  .pagefind-ui .pagefind-ui__result-link {
    display: block !important;
    padding: 0.5em 0 !important;
    /* Larger tap target for mobile */
    min-height: 44px !important;
  }
  
  /* iOS: Fix "Load more" button text visibility */
  .pagefind-ui .pagefind-ui__button {
    color: #fff !important;
    font-size: 16px !important;
    line-height: 1.4 !important;
    padding: 0.8em 1em !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    -webkit-appearance: none !important;
    appearance: none !important;
  }
}

/* Tablet (iPad) - 550px to 991px */
@media only screen and (min-width: 550px) and (max-width: 991px) {
  body > nav form.pagefind-form {
    width: 175px;
    float: right;
    text-align: left;
    padding-left: 0.8em;
    padding-top: 0.15em;
  }
  
  .pagefind-ui .pagefind-ui__search-input {
    font-size: 16px !important;  /* Prevent iOS auto-zoom */
    line-height: 1.2em !important;
  }
  
  /* iPad: Fixed position drawer like mobile */
  .pagefind-ui .pagefind-ui__drawer {
    position: fixed !important;
    top: 55px !important;
    right: 10px !important;
    left: auto !important;
    width: 400px !important;
    max-height: 70vh !important;
    z-index: 9999 !important;
    background: #fff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  /* iPad: Larger tap targets */
  .pagefind-ui .pagefind-ui__result {
    cursor: pointer !important;
    -webkit-tap-highlight-color: rgba(128, 177, 223, 0.3) !important;
  }
  
  .pagefind-ui .pagefind-ui__result-link {
    display: block !important;
    min-height: 44px !important;
  }
}

/* Tablet and up (general) */
@media only screen and (min-width: 550px) {
  body > nav form.pagefind-form {
    width: 175px;
    float: right;
    text-align: left;
    padding-left: 0.8em;
    padding-top: 0.15em;
  }
}

/* Desktop */
@media only screen and (min-width: 992px) {
  body > nav form.pagefind-form {
    width: 215px;
  }
}
