/* =============================================
   blog.css - ブログページ固有スタイル
   page.css → howto.css → これ の順で読み込む
   ============================================= */

/* ===== Blog TOC — 折りたたみ + 階層番号 ===== */
.blog-toc details {
  margin: 0;
}

.blog-toc summary.toc-title {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--howto-space-sm);
  user-select: none;
}

.blog-toc summary.toc-title::-webkit-details-marker {
  display: none;
}

.blog-toc summary.toc-title::after {
  content: '';
  margin-left: auto;
  width: 20px;
  height: 20px;
  background: var(--howto-accent-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--howto-accent);
  transition: transform var(--howto-transition-base);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2 3.5L5 7L8 3.5' fill='none' stroke='%23454c84' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.blog-toc details:not([open]) summary.toc-title::after {
  transform: rotate(-90deg);
}

/* ===== Blog TOC — 階層番号 (howto.css の counter を上書き) ===== */
.blog-toc .toc-list {
  counter-reset: none;
}

.blog-toc .toc-list li {
  counter-increment: none;
}

.blog-toc .toc-list a::before {
  content: none;
}

.blog-toc .toc-num {
  display: inline-block;
  min-width: 2em;
  color: var(--howto-accent);
  font-weight: 600;
  font-size: 0.8125rem;
}

.blog-toc .toc-sublist {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.blog-toc .toc-sublist li {
  padding-left: 0;
}

.blog-toc .toc-sublist a {
  padding-left: 1em;
  font-size: 0.8125rem;
}

.blog-toc .toc-sublist .toc-num {
  min-width: 2.5em;
  font-size: 0.75rem;
}

/* ===== Eye-Catch (Single) ===== */
.blog-eyecatch {
  margin-bottom: var(--howto-space-xl);
  text-align: center;
}

.blog-eyecatch img {
  max-width: 100%;
  height: auto;
  border-radius: var(--howto-radius-md);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* ===== Post Body (記事本文) ===== */
.blog-post-body {
  font-size: 16px;
  line-height: 1.9;
  color: var(--howto-text);
  word-break: break-word;
}

.blog-post-body p {
  margin: 0 0 20px;
}

/* --- Headings --- */
.blog-post-body h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 48px 0 24px;
  padding: 12px 0 12px 16px;
  border-left: 4px solid var(--howto-accent);
  line-height: 1.4;
  color: var(--howto-text);
}

.blog-post-body h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 36px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--howto-border);
  line-height: 1.4;
  color: var(--howto-text);
}

.blog-post-body h4 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 28px 0 12px;
  color: var(--howto-text);
}

/* --- Images (figure/figcaption) --- */
.blog-post-body figure {
  margin: 32px 0;
  padding: 0;
  text-align: center;
}

.blog-post-body figure img {
  max-width: 100%;
  height: auto;
  border-radius: var(--howto-radius-sm);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.blog-post-body figcaption {
  margin-top: 8px;
  font-size: 0.8125rem;
  color: var(--howto-text-dim);
  font-style: normal;
}

/* --- Tables --- */
.blog-post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.875rem;
}

.blog-post-body thead th {
  background: var(--howto-accent);
  color: #fff;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

.blog-post-body tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--howto-border);
  vertical-align: top;
}

.blog-post-body tbody tr:nth-child(even) {
  background: var(--howto-surface);
}

/* --- Lists --- */
.blog-post-body ul,
.blog-post-body ol {
  margin: 16px 0 24px 24px;
  padding: 0;
}

.blog-post-body li {
  margin-bottom: 8px;
  line-height: 1.7;
}

.blog-post-body ul li {
  list-style-type: disc;
}

.blog-post-body ol li {
  list-style-type: decimal;
}

/* --- Links --- */
.blog-post-body a {
  color: var(--howto-accent);
  text-decoration: underline;
}

.blog-post-body a:hover {
  color: var(--howto-accent-light);
}

/* --- Emphasis --- */
.blog-post-body strong {
  color: var(--howto-text);
}

/* --- Blockquote --- */
.blog-post-body blockquote {
  margin: 24px 0;
  padding: 16px 20px;
  border-left: 4px solid var(--howto-accent);
  background: var(--howto-surface);
  color: var(--howto-text-muted);
  font-style: italic;
  border-radius: 0 var(--howto-radius-sm) var(--howto-radius-sm) 0;
}

/* ===== Post Footer (tags, meta) ===== */
.blog-post-footer {
  margin-top: var(--howto-space-xl);
  padding-top: var(--howto-space-md);
  border-top: 1px solid var(--howto-border);
}

.blog-post-meta {
  display: flex;
  gap: var(--howto-space-md);
  font-size: 0.8125rem;
  color: var(--howto-text-muted);
  flex-wrap: wrap;
  align-items: center;
}

.blog-post-meta .viewdate,
.blog-post-meta .viewcategory {
  display: flex;
  align-items: center;
  gap: 0.25em;
}

/* ===== Post Navigation (prev/next) ===== */
.blog-post-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--howto-space-lg);
  margin: var(--howto-space-xl) 0;
  font-size: 0.875rem;
}

.blog-post-nav a {
  color: var(--howto-accent);
  text-decoration: none;
  padding: var(--howto-space-xs) var(--howto-space-sm);
  border-radius: 6px;
  transition: background var(--howto-transition-fast);
}

.blog-post-nav a:hover {
  background: var(--howto-accent-bg);
}

/* ===== Blog Section Heading ===== */
.blog-section-heading {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--howto-text);
  margin: 0 0 var(--howto-space-lg);
  display: flex;
  align-items: center;
  gap: var(--howto-space-sm);
}

.blog-section-heading i {
  color: var(--howto-accent);
}

/* ===== Featured Article Card ===== */
.blog-featured-card {
  margin-bottom: var(--howto-space-xl);
}

.blog-featured-link {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--howto-border);
  border-radius: var(--howto-radius-md);
  overflow: hidden;
  transition: box-shadow var(--howto-transition-base);
}

.blog-featured-link:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  text-decoration: none;
}

.blog-featured-thumb {
  width: 100%;
  height: 300px;
  overflow: hidden;
  background: linear-gradient(135deg, #454c84 0%, #6c7ae0 50%, #454c84 100%);
  position: relative;
}

.blog-featured-thumb::before {
  content: '\f001';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 4rem;
  color: rgba(255,255,255,0.15);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.blog-featured-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 1;
}

.blog-featured-link:hover .blog-featured-thumb img {
  transform: scale(1.03);
}

.blog-featured-body {
  padding: var(--howto-space-lg);
}

.blog-featured-meta {
  display: flex;
  gap: var(--howto-space-md);
  font-size: 0.8125rem;
  color: var(--howto-text-dim);
  margin-bottom: var(--howto-space-sm);
}

.blog-featured-meta span {
  display: flex;
  align-items: center;
  gap: 0.25em;
}

.blog-featured-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 var(--howto-space-sm);
  line-height: 1.5;
  color: var(--howto-text);
}

.blog-featured-link:hover .blog-featured-title {
  color: var(--howto-accent);
}

.blog-featured-desc {
  font-size: 0.9375rem;
  color: var(--howto-text-muted);
  line-height: 1.7;
  margin: 0 0 var(--howto-space-md);
}

.blog-featured-readmore {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--howto-accent);
}

.blog-featured-readmore i {
  transition: transform 0.2s ease;
}

.blog-featured-link:hover .blog-featured-readmore i {
  transform: translateX(4px);
}

/* ===== No Posts ===== */
.blog-no-posts {
  text-align: center;
  color: var(--howto-text-muted);
  padding: var(--howto-space-xl) 0;
  font-size: 1rem;
}

/* ===== Blog Index - Post Cards ===== */
.blog-post-list {
  display: flex;
  flex-direction: column;
  gap: var(--howto-space-lg);
}

.blog-post-card {
  display: flex;
  gap: var(--howto-space-md);
  padding: var(--howto-space-lg);
  background: #fff;
  border: 1px solid var(--howto-border);
  border-radius: var(--howto-radius-md);
  transition: box-shadow var(--howto-transition-base);
}

.blog-post-card:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.blog-post-card .blog-card-thumb {
  flex-shrink: 0;
  width: 160px;
  height: 120px;
  overflow: hidden;
  border-radius: var(--howto-radius-sm);
  background: linear-gradient(135deg, #454c84 0%, #6c7ae0 50%, #454c84 100%);
  position: relative;
}

.blog-post-card .blog-card-thumb::before {
  content: '\f001';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 2rem;
  color: rgba(255,255,255,0.15);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.blog-post-card .blog-card-thumb a {
  display: block;
  width: 100%;
  height: 100%;
}

.blog-post-card .blog-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: relative;
  z-index: 1;
}

.blog-post-card .blog-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.blog-post-card .blog-card-body a {
  text-decoration: none;
  color: var(--howto-text);
}

.blog-post-card .blog-card-body a:hover {
  text-decoration: none;
}

.blog-post-card .blog-card-body h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 var(--howto-space-xs);
  line-height: 1.5;
  color: var(--howto-text);
}

.blog-post-card .blog-card-body h3:hover {
  color: var(--howto-accent);
}

.blog-post-card .blog-card-desc {
  font-size: 0.8125rem;
  color: var(--howto-text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.blog-post-card .blog-card-meta {
  display: flex;
  gap: var(--howto-space-md);
  font-size: 0.75rem;
  color: var(--howto-text-dim);
  margin-top: var(--howto-space-sm);
  flex-wrap: wrap;
}

/* ===== SNS Links ===== */
.blog-sns-links {
  margin: var(--howto-space-lg) 0;
}

/* ===== Pagination ===== */
.blog-pagination {
  margin-top: var(--howto-space-xl);
  text-align: center;
}

/* ===== Responsive: Mobile ===== */
@media (max-width: 600px) {
  .blog-post-body {
    font-size: 15px;
    line-height: 1.8;
  }

  .blog-post-body h2 {
    font-size: 1.2rem;
    margin: 32px 0 16px;
    padding: 10px 0 10px 12px;
  }

  .blog-post-body h3 {
    font-size: 1.05rem;
    margin: 24px 0 12px;
  }

  /* テーブルの横スクロール対応（responsive.css display:list-item 対策） */
  .blog-post-body table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .blog-post-body thead,
  .blog-post-body tbody,
  .blog-post-body tr,
  .blog-post-body th,
  .blog-post-body td {
    display: revert;
  }

  .blog-post-body thead th {
    font-size: 0.8125rem;
    padding: 8px 10px;
  }

  .blog-post-body tbody td {
    font-size: 0.8125rem;
    padding: 8px 10px;
  }

  .blog-post-body figure {
    margin: 24px 0;
  }

  .blog-post-body figure img {
    border-radius: 4px;
  }

  .blog-post-body figcaption {
    font-size: 0.75rem;
  }

  /* Featured Card - Mobile */
  .blog-featured-thumb {
    height: 200px;
  }

  .blog-featured-title {
    font-size: 1.1rem;
  }

  .blog-featured-desc {
    font-size: 0.875rem;
  }

  .blog-featured-body {
    padding: var(--howto-space-md);
  }

  /* Post Cards - Stack */
  .blog-post-card {
    flex-direction: column;
  }

  .blog-post-card .blog-card-thumb {
    width: 100%;
    height: 180px;
  }

  .blog-post-nav {
    flex-direction: column;
    gap: var(--howto-space-sm);
  }
}
