/* ===================================================
   事業承継コンサルティング — Blog Stylesheet
   =================================================== */

/* ============================================================
   BLOG PAGE BODY
   ============================================================ */
.blog-page #header {
  background: rgba(255,255,255,0.96);
  box-shadow: 0 2px 20px rgba(26,44,71,0.10);
}
.blog-page .logo-text { color: var(--primary) !important; }
.blog-page .nav-link { color: var(--text) !important; }
.nav-link-active {
  color: var(--accent) !important;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 2px;
}

/* ============================================================
   BLOG HERO
   ============================================================ */
.blog-hero {
  position: relative;
  padding: 160px 0 80px;
  overflow: hidden;
}
.blog-hero-bg {
  position: absolute; inset: 0; z-index: 0;
}
.blog-hero-bg img {
  width: 100%; height: 100%; object-fit: cover;
}
.blog-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(10,20,36,0.92) 0%, rgba(26,44,71,0.82) 100%);
}
.blog-hero-content {
  position: relative; z-index: 1;
  color: #fff;
}
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: rgba(255,255,255,0.6);
  margin-bottom: 24px;
}
.breadcrumb a { color: rgba(255,255,255,0.6); transition: color var(--transition); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .material-symbols-outlined { font-size: 16px; }
.blog-hero-content h1 {
  font-size: clamp(28px, 4vw, 52px);
  font-weight: 900;
  line-height: 1.25;
  color: #fff;
  margin: 16px 0 20px;
  font-family: var(--font-serif);
}
.blog-hero-content h1 span {
  display: block;
  font-size: 0.6em;
  color: var(--accent);
  font-family: var(--font);
  font-weight: 700;
  margin-top: 8px;
}
.blog-hero-content p {
  font-size: 15px;
  color: rgba(255,255,255,0.78);
  line-height: 1.8;
  max-width: 640px;
}

/* ============================================================
   SERIES FILTER BAR
   ============================================================ */
.blog-series-bar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 72px;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(26,44,71,0.06);
}
.blog-series-inner {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 24px;
  max-width: 1200px;
  margin: 0 auto;
  /* PCでは横並び・折り返しなし */
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.blog-series-inner::-webkit-scrollbar { display: none; }
.series-filter-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  font-size: 13px; font-weight: 700;
  color: var(--text-mid);
  border-radius: var(--radius-full);
  border: 1.5px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.series-filter-btn .material-symbols-outlined { font-size: 18px; }
.series-filter-btn:hover { color: var(--primary); background: var(--bg-light); }
.series-filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.blog-search-wrap {
  margin-left: auto;
  flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-light);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 8px 14px;
  transition: border-color var(--transition);
}
.blog-search-wrap:focus-within { border-color: var(--accent); }
.blog-search-wrap .material-symbols-outlined { font-size: 18px; color: var(--text-light); }
#blogSearch {
  border: none; background: none; outline: none;
  font-size: 13px; color: var(--text);
  width: 140px;
}
@media (max-width: 768px) {
  .blog-series-bar { top: 60px; }
  .blog-series-inner { padding: 8px 16px; gap: 6px; }
  .series-filter-btn { padding: 7px 11px; font-size: 12px; }
  .blog-search-wrap { width: auto; min-width: 0; }
  #blogSearch { width: 90px; }
  /* 長いラベルは省略 */
  .series-filter-btn[data-filter="series1"] span:last-child { content: "前編"; }
}

/* ============================================================
   BLOG LAYOUT
   ============================================================ */
.blog-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 48px;
  padding-top: 48px;
  padding-bottom: 80px;
  align-items: start;
}
.blog-main { min-width: 0; }
@media (max-width: 1024px) {
  .blog-layout {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-top: 32px;
    padding-bottom: 56px;
  }
  .blog-sidebar {
    order: -1;
    position: static !important; /* sticky解除 */
    top: auto !important;
  }
}

/* ============================================================
   SERIES HEADER
   ============================================================ */
.series-section { margin-bottom: 48px; }
.series-header {
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
}
.series-header-1 {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 100%);
  color: #fff;
}
.series-header-2 {
  background: linear-gradient(135deg, #2d4a2d 0%, #3d6b3d 100%);
  color: #fff;
}
.series-header-inner {
  display: flex; align-items: center; gap: 20px;
}
.series-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 64px; height: 64px;
  min-width: 64px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--primary);
  font-size: 15px; font-weight: 900;
}
.series-badge-2 {
  background: #5cb85c;
  color: #fff;
}
.series-header h2 {
  font-size: 20px; font-weight: 900;
  color: #fff;
  margin-bottom: 6px;
}
.series-header p { font-size: 13px; color: rgba(255,255,255,0.7); }
.series-count {
  margin-left: auto;
  font-size: 48px; font-weight: 900;
  color: rgba(255,255,255,0.2);
  line-height: 1;
  white-space: nowrap;
}
.series-count span {
  font-size: 16px; font-weight: 700;
  color: rgba(255,255,255,0.4);
}
@media (max-width: 600px) {
  .series-header { padding: 20px; }
  .series-header-inner { flex-wrap: wrap; }
  .series-count { display: none; }
}

/* ============================================================
   ARTICLES LIST
   ============================================================ */
.articles-list {
  display: flex; flex-direction: column; gap: 12px;
}

/* ============================================================
   ARTICLE CARD
   ============================================================ */
.article-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.article-card:hover {
  border-color: rgba(26,44,71,0.3);
  box-shadow: var(--shadow);
}
.article-card.open {
  border-color: var(--accent);
  box-shadow: 0 4px 24px rgba(200,151,62,0.15);
}
.article-card-final {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(200,151,62,0.03), #fff);
}

/* Article Header (toggle trigger) */
.article-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  cursor: pointer;
  gap: 16px;
  transition: background var(--transition);
  user-select: none;
}
.article-header:hover { background: rgba(26,44,71,0.02); }
.article-meta-left {
  display: flex; align-items: flex-start; gap: 16px; flex: 1; min-width: 0;
}
.article-no {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 60px; height: 32px;
  background: var(--primary);
  color: #fff;
  font-size: 12px; font-weight: 900;
  border-radius: 6px;
  flex-shrink: 0;
  margin-top: 2px;
}
.article-no-final { background: var(--accent); }
.article-title-wrap { flex: 1; min-width: 0; }
.article-title-wrap h3 {
  font-size: 16px; font-weight: 700;
  color: var(--primary);
  line-height: 1.4;
  margin-bottom: 8px;
}
.article-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  color: var(--primary-light);
  background: rgba(26,44,71,0.07);
  padding: 2px 10px;
  border-radius: var(--radius-full);
}
.tag-alert {
  color: #c0392b;
  background: rgba(192,57,43,0.08);
}
.toggle-icon {
  font-size: 24px;
  color: var(--text-light);
  flex-shrink: 0;
  transition: transform var(--transition);
}
.article-card.open .toggle-icon { transform: rotate(180deg); }

/* Article Body */
.article-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.article-card.open .article-body { max-height: 2400px; }
.article-body-inner {
  padding: 0 24px 28px;
  border-top: 1px solid var(--border);
}
.article-body-inner p {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-mid);
  line-height: 1.85;
  margin-bottom: 16px;
}
.article-body-inner p:last-child { margin-bottom: 0; }

/* Point box */
.article-point {
  display: flex; gap: 12px; align-items: flex-start;
  background: rgba(26,44,71,0.04);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
  margin-top: 16px;
}
.article-point .material-symbols-outlined { font-size: 20px; color: var(--primary); flex-shrink: 0; margin-top: 1px; }
.article-point-warning {
  background: rgba(192,57,43,0.05);
  border-left-color: #c0392b;
}
.article-point-warning .material-symbols-outlined { color: #c0392b; }

/* Compare table */
.article-compare {
  display: flex; align-items: center; gap: 16px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.compare-item {
  flex: 1; min-width: 140px;
  background: var(--bg-light);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: center;
}
.compare-item-accent {
  background: rgba(200,151,62,0.1);
  border: 2px solid var(--accent);
}
.compare-label {
  font-size: 12px; font-weight: 700;
  color: var(--text-light);
  margin-bottom: 8px;
}
.compare-item p { font-size: 14px; color: var(--text-mid); line-height: 1.6; margin: 0; }
.compare-item strong { color: var(--accent); font-size: 18px; }
.compare-item-accent p { color: var(--text); }
.compare-arrow .material-symbols-outlined { font-size: 28px; color: var(--text-light); }

/* Checklist */
.article-checklist {
  background: var(--bg-light);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
  font-size: 14px;
}
.article-checklist h4 { font-size: 14px; color: var(--primary); margin-bottom: 8px; }
.article-checklist ul { display: flex; flex-direction: column; gap: 6px; padding-left: 8px; }
.article-checklist li { color: var(--text-mid); }

/* Final message */
.article-final-message {
  display: flex; gap: 20px; align-items: flex-start;
  background: linear-gradient(135deg, rgba(200,151,62,0.1), rgba(200,151,62,0.05));
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 20px;
}
.article-final-message > .material-symbols-outlined {
  font-size: 40px; color: var(--accent); flex-shrink: 0;
  margin-top: 4px;
}
.article-final-message h4 {
  font-size: 16px; font-weight: 900;
  color: var(--primary); margin-bottom: 8px;
}
.article-final-message p { font-size: 14px; color: var(--text-mid); margin: 0; }
@media (max-width: 500px) {
  .article-final-message { flex-direction: column; }
}

/* ============================================================
   SERIES DIVIDER
   ============================================================ */
.series-divider {
  display: flex; align-items: center; gap: 16px;
  margin: 32px 0 48px;
  color: var(--text-light);
  font-size: 13px; font-weight: 700;
}
.series-divider-line { flex: 1; height: 1px; background: var(--border); }
.series-divider-text {
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.series-divider-text .material-symbols-outlined { font-size: 20px; color: var(--accent); }

/* ============================================================
   SIDEBAR
   ============================================================ */
.blog-sidebar {
  display: flex; flex-direction: column; gap: 24px;
  position: sticky; top: 140px;
}
.sidebar-widget {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 24px;
}
.widget-title {
  font-size: 14px; font-weight: 900;
  color: var(--primary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--bg-light);
}
.sidebar-series { display: flex; flex-direction: column; gap: 10px; }
.sidebar-series-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  transition: all var(--transition);
  cursor: pointer;
}
.sidebar-series-item:hover { border-color: var(--accent); background: rgba(200,151,62,0.04); }
.sidebar-series-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--accent);
  font-size: 12px; font-weight: 900;
  flex-shrink: 0;
}
.sidebar-series-item .series-badge-2 { background: #3d6b3d; color: #fff; }
.sidebar-series-item p { font-size: 13px; font-weight: 700; color: var(--primary); }
.sidebar-series-item small { font-size: 11px; color: var(--text-light); }

/* Tag cloud */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud-btn {
  padding: 6px 14px;
  font-size: 12px; font-weight: 700;
  color: var(--primary-light);
  background: rgba(26,44,71,0.06);
  border-radius: var(--radius-full);
  border: 1.5px solid transparent;
  transition: all var(--transition);
}
.tag-cloud-btn:hover, .tag-cloud-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Sidebar CTA */
.sidebar-cta {
  background: var(--primary);
  border-color: var(--primary);
  text-align: center;
}
.sidebar-cta-icon {
  font-size: 40px; color: var(--accent);
  display: block; margin-bottom: 12px;
}
.sidebar-cta h4 { font-size: 16px; color: #fff; margin-bottom: 8px; }
.sidebar-cta p { font-size: 13px; color: rgba(255,255,255,0.7); margin-bottom: 16px; line-height: 1.7; }

/* ============================================================
   SEARCH HIGHLIGHT
   ============================================================ */
.article-card.hidden-by-search { display: none; }
.highlight-match {
  background: rgba(200,151,62,0.3);
  border-radius: 2px;
  padding: 0 2px;
}

/* ============================================================
   HOMEPAGE BLOG PREVIEW
   ============================================================ */
.blog-preview-series {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 48px;
}
.blog-preview-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
  transition: all var(--transition);
}
.blog-preview-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.bp-header {
  padding: 28px 28px 20px;
}
.blog-preview-card-1 .bp-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 100%);
}
.blog-preview-card-2 .bp-header {
  background: linear-gradient(135deg, #2d4a2d 0%, #3d6b3d 100%);
}
.bp-badge {
  display: inline-block;
  font-size: 11px; font-weight: 900;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--primary);
  margin-bottom: 12px;
}
.bp-badge-2 { background: #5cb85c; color: #fff; }
.bp-header h3 {
  font-size: 18px; font-weight: 900;
  color: #fff; line-height: 1.4;
  margin-bottom: 6px;
}
.bp-header p { font-size: 12px; color: rgba(255,255,255,0.6); }
.bp-list {
  padding: 20px 28px 24px;
  background: #fff;
  display: flex; flex-direction: column; gap: 10px;
}
.bp-list li {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-mid);
}
.bp-list .material-symbols-outlined { font-size: 16px; color: var(--accent); flex-shrink: 0; }
.bp-more {
  font-size: 12px; color: var(--text-light); font-style: italic;
  padding-left: 26px;
}
.bp-list .btn { margin: 8px 0 0; }
.btn-outline-dark {
  background: transparent;
  color: var(--primary);
  border: 2px solid rgba(26,44,71,0.3);
}
.btn-outline-dark:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-2px);
}
.blog-preview-cta {
  text-align: center;
}
@media (max-width: 768px) {
  .blog-preview-series { grid-template-columns: 1fr; }
}

/* ============================================================
   MOBILE / iOS Safari 総合修正
   ============================================================ */

/* ---- ヒーロー ---- */
@media (max-width: 768px) {
  .blog-hero {
    padding: 110px 0 56px;
  }
  .blog-hero-content h1 {
    font-size: 26px;
    margin: 12px 0 16px;
  }
  .blog-hero-content p {
    font-size: 14px;
    line-height: 1.75;
  }
  .breadcrumb { margin-bottom: 16px; }
}

/* ---- サイドバー（モバイルでは横スクロールのカード列） ---- */
@media (max-width: 1024px) {
  .blog-sidebar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
  }
  /* 相談CTAは全幅 */
  .sidebar-cta { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .blog-sidebar { grid-template-columns: 1fr; }
}

/* ---- シリーズヘッダー ---- */
@media (max-width: 480px) {
  .series-header { padding: 16px; border-radius: var(--radius); }
  .series-header h2 { font-size: 16px; }
  .series-badge { width: 48px; height: 48px; min-width: 48px; font-size: 13px; }
}

/* ---- 記事カード ---- */
@media (max-width: 600px) {
  .article-header { padding: 14px 16px; gap: 10px; }
  .article-meta-left { gap: 10px; }
  .article-no { min-width: 50px; height: 28px; font-size: 11px; }
  .article-title-wrap h3 { font-size: 14px; margin-bottom: 6px; }
  .article-tags { gap: 4px; }
  .tag { font-size: 10px; padding: 2px 8px; }
  .toggle-icon { font-size: 20px; }

  .article-body-inner { padding: 0 16px 20px; }
  .article-body-inner p { font-size: 14px; line-height: 1.8; }

  .article-point { padding: 12px 12px; font-size: 12px; gap: 8px; }
  .article-point .material-symbols-outlined { font-size: 18px; }

  .article-compare { flex-direction: column; gap: 8px; }
  .compare-item { min-width: 0; width: 100%; }
  .compare-arrow { transform: rotate(90deg); }

  .article-checklist { padding: 14px; font-size: 13px; }
  .article-final-message { padding: 16px; gap: 12px; flex-direction: column; }
  .article-final-message > .material-symbols-outlined { font-size: 32px; }
  .article-final-message h4 { font-size: 14px; }
  .article-final-message p { font-size: 13px; }
}

/* ---- iOS Safari 向け全体調整 ---- */
@supports (-webkit-touch-callout: none) {
  /* iOSのスクロール慣性 */
  .blog-layout { -webkit-overflow-scrolling: touch; }

  /* iOS Safariで position:sticky が親の overflow:hidden に阻まれる問題を防ぐ */
  .blog-series-bar { -webkit-position: sticky; }

  /* iOS Safariでのフォームズーム防止（フォントサイズ16px未満だと自動ズーム） */
  #blogSearch { font-size: 16px; }

  /* タップ時のハイライト除去 */
  .article-header,
  .series-filter-btn,
  .tag-cloud-btn,
  .slider-btn {
    -webkit-tap-highlight-color: transparent;
  }
}

/* ---- 極小画面（iPhone SE等 375px以下）---- */
@media (max-width: 375px) {
  .blog-hero { padding: 96px 0 48px; }
  .blog-hero-content h1 { font-size: 22px; }
  .blog-series-bar { top: 56px; }
  .blog-series-inner { padding: 6px 12px; }
  .series-filter-btn { padding: 6px 9px; font-size: 11px; }
  #blogSearch { width: 70px; font-size: 14px; }
  .series-header h2 { font-size: 15px; }
  .article-title-wrap h3 { font-size: 13px; }
}

/* ============================================================
   X POST BLOCK
   ============================================================ */
.x-post-block {
  background: #f5e9d0;
  border: 1.5px solid #d4b896;
  border-radius: 16px;
  padding: 20px 20px 14px;
  margin-bottom: 28px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans JP', sans-serif;
  position: relative;
}

.x-post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.x-post-avatar {
  width: 44px;
  height: 44px;
  min-width: 44px;
  background: linear-gradient(135deg, #1a1a2e 0%, #2d4a7a 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: -1px;
}

.x-post-author-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
}

.x-post-name {
  font-weight: 700;
  font-size: 15px;
  color: #0f1419;
  line-height: 1.3;
}

.x-post-handle {
  font-size: 13px;
  color: #536471;
  line-height: 1.3;
}

.x-post-logo-wrap {
  margin-left: auto;
}

.x-logo-svg {
  width: 22px;
  height: 22px;
  fill: #0f1419;
  display: block;
}

.x-post-body {
  font-size: 15px;
  line-height: 1.75;
  color: #0f1419;
  margin-bottom: 14px;
}

.x-post-body p {
  margin: 0 0 6px;
  padding: 0;
}

.x-post-body p:last-child {
  margin-bottom: 0;
}

.x-post-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #536471;
  border-top: 1px solid #eff3f4;
  padding-top: 10px;
  margin-top: 4px;
}

.x-post-footer-icon {
  width: 14px;
  height: 14px;
  fill: #536471;
  flex-shrink: 0;
}

/* ダークモード対応（オプション） */
@media (prefers-color-scheme: dark) {
  .x-post-block {
    background: #16181c;
    border-color: #2f3336;
  }
  .x-post-name { color: #e7e9ea; }
  .x-post-body { color: #e7e9ea; }
  .x-logo-svg { fill: #e7e9ea; }
  .x-post-footer { border-top-color: #2f3336; }
}

@media (max-width: 600px) {
  .x-post-block { padding: 14px 14px 10px; border-radius: 12px; }
  .x-post-body { font-size: 14px; }
  .x-post-avatar { width: 36px; height: 36px; min-width: 36px; font-size: 15px; }
  .x-post-name { font-size: 14px; }
}
