/* =============================================
   AI導入補助金ナビ - articles.css
   記事一覧・記事ページ専用スタイル
   ============================================= */

/* =============================================
   記事一覧
   ============================================= */
.articles-page { padding: 40px 0 80px; }

/* カテゴリタブ */
.category-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.category-tab {
  padding: 8px 16px;
  border-radius: var(--radius-xl);
  font-size: .85rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.category-tab:hover,
.category-tab.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

/* 記事グリッド */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
@media (max-width: 1024px) {
  .articles-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .articles-grid { grid-template-columns: 1fr; gap: 16px; }
}

/* 記事カード */
.article-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
}
.article-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.article-card-thumb {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  overflow: hidden;
}
[data-theme="dark"] .article-card-thumb {
  background: linear-gradient(135deg, rgba(29,78,216,.15), rgba(29,78,216,.05));
}
.article-card-thumb i { width: 40px; height: 40px; }
.article-card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.article-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.article-card-cat {
  font-size: .75rem;
  font-weight: 700;
  color: var(--accent-primary);
  background: rgba(29,78,216,.08);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}
.article-card-date {
  font-size: .75rem;
  color: var(--text-muted);
}
.article-card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-card:hover .article-card-title {
  color: var(--accent-primary);
}
.article-card-desc {
  font-size: .85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.article-card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.article-card-readmore {
  font-size: .8rem;
  font-weight: 600;
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* =============================================
   個別記事ページ
   ============================================= */
.article-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 40px;
  padding: 40px 0 80px;
  align-items: start;
}
@media (max-width: 1024px) {
  .article-layout { grid-template-columns: 1fr; }
  .article-toc { display: none; }
}

/* 記事ヘッダー */
.article-header { margin-bottom: 32px; }
.article-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-xl);
  font-size: .8rem;
  font-weight: 700;
  background: rgba(29,78,216,.08);
  color: var(--accent-primary);
  margin-bottom: 16px;
}
.article-title {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-primary);
  margin-bottom: 16px;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: .85rem;
  color: var(--text-muted);
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}
.article-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.article-updated {
  background: rgba(5,150,105,.08);
  color: var(--accent-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

/* 記事本文 */
.article-body {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text-primary);
}
.article-body h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 48px 0 16px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  scroll-margin-top: calc(var(--header-h) + 20px);
}
[data-theme="dark"] .article-body h2 {
  background: var(--bg-surface);
}
.article-body h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 32px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent-primary);
  scroll-margin-top: calc(var(--header-h) + 20px);
}
.article-body p { margin-bottom: 16px; }
.article-body ul, .article-body ol {
  margin: 16px 0;
  padding-left: 28px;
}
.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }
.article-body li { margin-bottom: 8px; line-height: 1.7; }
.article-body strong { font-weight: 700; color: var(--text-primary); }
.article-body em { font-style: italic; }
.article-body a { color: var(--accent-primary); text-decoration: underline; }
.article-body a:hover { color: var(--accent-hover); }
.article-body blockquote {
  margin: 24px 0;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  font-size: .95rem;
  color: var(--text-secondary);
}
.article-body .table-wrap {
  overflow-x: auto;
  margin: 24px 0;
  -webkit-overflow-scrolling: touch;
}
.article-body table {
  width: 100%;
  min-width: 500px;
  border-collapse: collapse;
  font-size: .9rem;
  display: block;
}
.article-body th {
  background: var(--accent-primary);
  color: #fff;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
}
.article-body td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
}
.article-body tr:nth-child(even) td {
  background: var(--bg-secondary);
}

/* ハイライトボックス */
.highlight-box {
  padding: 20px 24px;
  border-radius: var(--radius-md);
  margin: 24px 0;
}
.highlight-box.info {
  background: #eff6ff;
  color: #1e40af;
}
[data-theme="dark"] .highlight-box.info {
  background: rgba(29,78,216,.1);
  color: #93c5fd;
}
.highlight-box.success {
  background: #f0fdf4;
  color: #166534;
}
.highlight-box.warning {
  background: #fffbeb;
  color: #92400e;
}
.highlight-box-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 補助金スペックカード */
.subsidy-card {
  background: var(--bg-primary);
  border: 2px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 24px;
  margin: 24px 0;
}
.subsidy-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.subsidy-specs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}
.subsidy-spec-item { text-align: center; }
.subsidy-spec-label {
  font-size: .75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.subsidy-spec-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}
.subsidy-spec-unit {
  font-size: .8rem;
  color: var(--text-secondary);
}

/* =============================================
   FAQ
   ============================================= */
.faq-section { margin: 48px 0; }
.faq-section-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.faq-item {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  margin-bottom: 8px;
  overflow: hidden;
}
.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 20px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: .95rem;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: background var(--transition);
  gap: 12px;
  text-align: left;
  font-family: inherit;
  line-height: 1.5;
}
.faq-question:hover { background: var(--bg-secondary); }
.faq-question.open { background: rgba(29,78,216,.04); color: var(--accent-primary); }
.faq-q-text { display: flex; align-items: center; gap: 10px; }
.faq-q-badge {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: var(--accent-primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  font-weight: 700;
}
.faq-chevron { transition: transform .2s ease; flex-shrink: 0; }
.faq-question.open .faq-chevron { transform: rotate(180deg); }
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
}
.faq-answer-inner {
  padding: 16px 20px 20px;
  font-size: .9rem;
  line-height: 1.7;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
}

/* =============================================
   目次（TOC）
   ============================================= */
.article-toc {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  max-height: calc(100vh - var(--header-h) - 60px);
  overflow-y: auto;
}
.toc-title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.toc-list { list-style: none; }
.toc-item a {
  display: block;
  padding: 5px 8px;
  font-size: .85rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.toc-item a:hover,
.toc-item a.active {
  color: var(--accent-primary);
  background: rgba(29,78,216,.05);
}
.toc-item-h3 a {
  padding-left: 20px;
  font-size: .8rem;
}

/* SP用TOC FABボタン */
.toc-fab {
  display: none;
  position: fixed;
  bottom: 80px;
  right: 24px;
  z-index: 49;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  box-shadow: var(--shadow-md);
  cursor: pointer;
}
@media (max-width: 1024px) {
  .toc-fab { display: flex; }
}

/* SP TOCドロワー */
.toc-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: var(--bg-primary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px 20px;
  max-height: 70vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform .3s ease;
  box-shadow: var(--shadow-xl);
}
.toc-drawer.open { transform: translateY(0); }

/* =============================================
   関連記事
   ============================================= */
.related-articles { margin: 48px 0; }
.related-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 640px) {
  .related-grid { grid-template-columns: 1fr; }
}
.related-card {
  display: flex;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  transition: all var(--transition);
}
.related-card:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.related-card-thumb {
  flex-shrink: 0;
  width: 80px;
  height: 60px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
}
.related-card-body { flex: 1; }
.related-card-title {
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.related-card:hover .related-card-title { color: var(--accent-primary); }
.related-card-cat {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 4px;
}
