/* ==========================================================================
   Components - 記事内見出しスタイル適用
   カスタマイザーで選択されたパターンを .post-content 内のh2〜h4に反映
   body に付与される .heading-style-{N} で切り替え
   ========================================================================== */

/* ---------- 共通リセット ---------- */
.post-content h2,
.post-content h3,
.post-content h4 {
  margin: var(--pb-space-10) 0 var(--pb-space-5);
  line-height: var(--pb-line-height-tight);
  font-weight: var(--pb-font-weight-bold);
  color: var(--pb-text-primary);
}

.post-content h2 { font-size: var(--pb-font-size-2xl); }
.post-content h3 { font-size: var(--pb-font-size-xl); }
.post-content h4 { font-size: var(--pb-font-size-lg); }

/* ==========================================================================
   Type 1: 左ボーダー + 背景色
   ========================================================================== */
.heading-style-1 .post-content h2 {
  padding: var(--pb-space-4) var(--pb-space-5);
  border-left: 5px solid var(--pb-primary);
  background: var(--pb-bg-secondary);
  border-radius: 0 var(--pb-radius-sm) var(--pb-radius-sm) 0;
}

.heading-style-1 .post-content h3 {
  padding: var(--pb-space-3) var(--pb-space-5);
  border-left: 4px solid var(--pb-primary-light);
  background: var(--pb-bg-secondary);
}

.heading-style-1 .post-content h4 {
  padding-left: var(--pb-space-4);
  border-left: 3px solid var(--pb-border-dark);
}

/* ==========================================================================
   Type 2: 下線のみ
   ========================================================================== */
.heading-style-2 .post-content h2 {
  padding-bottom: var(--pb-space-3);
  border-bottom: 3px solid var(--pb-primary);
}

.heading-style-2 .post-content h3 {
  padding-bottom: var(--pb-space-2);
  border-bottom: 2px solid var(--pb-border-dark);
}

.heading-style-2 .post-content h4 {
  padding-bottom: var(--pb-space-2);
  border-bottom: 1px dashed var(--pb-border-dark);
}

/* ==========================================================================
   Type 3: 全幅背景色
   ========================================================================== */
.heading-style-3 .post-content h2 {
  padding: var(--pb-space-4) var(--pb-space-5);
  background: var(--pb-primary);
  color: #ffffff;
  border-radius: var(--pb-radius-md);
}

.heading-style-3 .post-content h3 {
  padding: var(--pb-space-3) var(--pb-space-5);
  background: var(--pb-bg-tertiary);
  border-radius: var(--pb-radius-sm);
}

.heading-style-3 .post-content h4 {
  padding: var(--pb-space-2) var(--pb-space-4);
  background: var(--pb-bg-secondary);
  border-radius: var(--pb-radius-sm);
}

/* ==========================================================================
   Type 4: ストライプ背景 + 左ボーダー
   ========================================================================== */
.heading-style-4 .post-content h2 {
  padding: var(--pb-space-4) var(--pb-space-5);
  border-left: 5px solid var(--pb-primary);
  background: repeating-linear-gradient(
    -45deg,
    var(--pb-bg-secondary),
    var(--pb-bg-secondary) 4px,
    var(--pb-bg-primary) 4px,
    var(--pb-bg-primary) 8px
  );
}

.heading-style-4 .post-content h3 {
  padding: var(--pb-space-3) var(--pb-space-5);
  border-left: 4px solid var(--pb-primary);
  background: var(--pb-bg-secondary);
}

.heading-style-4 .post-content h4 {
  padding-left: var(--pb-space-4);
  border-left: 3px solid var(--pb-primary-light);
}

/* ==========================================================================
   Type 5: 吹き出し風
   ========================================================================== */
.heading-style-5 .post-content h2 {
  padding: var(--pb-space-4) var(--pb-space-5);
  background: var(--pb-primary);
  color: #ffffff;
  border-radius: var(--pb-radius-md);
  position: relative;
}

.heading-style-5 .post-content h2::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 24px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid var(--pb-primary);
}

.heading-style-5 .post-content h3 {
  padding: var(--pb-space-3) var(--pb-space-5);
  background: var(--pb-bg-tertiary);
  border-radius: var(--pb-radius-sm);
  position: relative;
}

.heading-style-5 .post-content h3::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 24px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--pb-bg-tertiary);
}

.heading-style-5 .post-content h4 {
  padding: var(--pb-space-2) var(--pb-space-4);
  background: var(--pb-bg-secondary);
  border-radius: var(--pb-radius-sm);
}

/* ==========================================================================
   Type 6: ステップ番号付き
   ========================================================================== */
.heading-style-6 .post-content {
  counter-reset: heading-counter;
}

.heading-style-6 .post-content h2 {
  counter-increment: heading-counter;
  padding: var(--pb-space-4) var(--pb-space-5) var(--pb-space-4) var(--pb-space-16);
  background: var(--pb-bg-secondary);
  border-radius: var(--pb-radius-md);
  border-left: 5px solid var(--pb-primary);
  position: relative;
}

.heading-style-6 .post-content h2::before {
  content: counter(heading-counter);
  position: absolute;
  left: var(--pb-space-4);
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--pb-primary);
  color: #ffffff;
  border-radius: var(--pb-radius-full);
  font-size: var(--pb-font-size-base);
  font-weight: var(--pb-font-weight-bold);
}

.heading-style-6 .post-content h3 {
  padding: var(--pb-space-3) var(--pb-space-5);
  border-left: 4px solid var(--pb-primary-light);
  background: var(--pb-bg-secondary);
}

.heading-style-6 .post-content h4 {
  padding-left: var(--pb-space-4);
  border-left: 3px solid var(--pb-border-dark);
}

/* ==========================================================================
   Type 7: リボン風
   ========================================================================== */
.heading-style-7 .post-content h2 {
  padding: var(--pb-space-4) var(--pb-space-6) var(--pb-space-4) var(--pb-space-5);
  background: var(--pb-primary);
  color: #ffffff;
  position: relative;
  margin-left: -8px;
  margin-right: -8px;
  border-radius: 0;
}

.heading-style-7 .post-content h2::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  border-width: 8px 0 0 8px;
  border-style: solid;
  border-color: var(--pb-primary-dark) transparent transparent;
}

.heading-style-7 .post-content h2::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 0;
  border-width: 8px 8px 0 0;
  border-style: solid;
  border-color: var(--pb-primary-dark) transparent transparent;
}

.heading-style-7 .post-content h3 {
  padding: var(--pb-space-3) var(--pb-space-5);
  border-bottom: 3px solid var(--pb-primary);
}

.heading-style-7 .post-content h4 {
  padding-left: var(--pb-space-4);
  border-left: 3px solid var(--pb-primary);
}

/* ==========================================================================
   Type 8: グラデーション下線
   ========================================================================== */
.heading-style-8 .post-content h2 {
  padding-bottom: var(--pb-space-3);
  position: relative;
}

.heading-style-8 .post-content h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--pb-primary), var(--pb-accent), var(--pb-primary-light));
  border-radius: var(--pb-radius-full);
}

.heading-style-8 .post-content h3 {
  padding-bottom: var(--pb-space-2);
  position: relative;
}

.heading-style-8 .post-content h3::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60%;
  height: 3px;
  background: linear-gradient(90deg, var(--pb-primary), transparent);
  border-radius: var(--pb-radius-full);
}

.heading-style-8 .post-content h4 {
  padding-bottom: var(--pb-space-2);
  position: relative;
}

.heading-style-8 .post-content h4::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 40%;
  height: 2px;
  background: var(--pb-primary-light);
  border-radius: var(--pb-radius-full);
}

/* ==========================================================================
   記事内コンテンツ - 一般要素の微調整
   ========================================================================== */
.post-content p {
  margin-bottom: var(--pb-space-5);
}

.post-content a {
  color: var(--pb-link-color);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--pb-transition-fast);
}

.post-content a:hover {
  color: var(--pb-link-hover);
}

.post-content ul,
.post-content ol {
  margin: var(--pb-space-5) 0;
  padding-left: var(--pb-space-8);
}

.post-content ul li {
  list-style: disc;
  margin-bottom: var(--pb-space-2);
}

.post-content ol li {
  list-style: decimal;
  margin-bottom: var(--pb-space-2);
}

.post-content blockquote {
  margin: var(--pb-space-6) 0;
  padding: var(--pb-space-5) var(--pb-space-6);
  border-left: 4px solid var(--pb-primary);
  background: var(--pb-bg-secondary);
  border-radius: 0 var(--pb-radius-md) var(--pb-radius-md) 0;
  font-style: italic;
  color: var(--pb-text-secondary);
}

.post-content blockquote p:last-child {
  margin-bottom: 0;
}

.post-content pre {
  margin: var(--pb-space-6) 0;
  padding: var(--pb-space-5) var(--pb-space-6);
  background: var(--pb-bg-dark);
  color: #e2e8f0;
  border-radius: var(--pb-radius-md);
  overflow-x: auto;
  font-family: var(--pb-font-mono);
  font-size: var(--pb-font-size-sm);
  line-height: 1.6;
}

.post-content code {
  font-family: var(--pb-font-mono);
  font-size: 0.9em;
  padding: 2px var(--pb-space-2);
  background: var(--pb-bg-tertiary);
  border-radius: var(--pb-radius-sm);
  color: var(--pb-primary-dark);
}

.post-content pre code {
  padding: 0;
  background: none;
  color: inherit;
}

.post-content table {
  width: 100%;
  margin: var(--pb-space-6) 0;
  border-collapse: collapse;
}

.post-content table th,
.post-content table td {
  padding: var(--pb-space-3) var(--pb-space-4);
  border: 1px solid var(--pb-border-color);
  font-size: var(--pb-font-size-sm);
}

.post-content table th {
  background: var(--pb-bg-secondary);
  font-weight: var(--pb-font-weight-semibold);
  text-align: left;
}

.post-content table tr:nth-child(even) {
  background: var(--pb-bg-secondary);
}

.post-content .wp-block-image,
.post-content figure {
  margin: var(--pb-space-6) 0;
}

.post-content .wp-block-image figcaption,
.post-content figcaption {
  font-size: var(--pb-font-size-xs);
  color: var(--pb-text-muted);
  text-align: center;
  margin-top: var(--pb-space-2);
}

.post-content hr {
  margin: var(--pb-space-8) 0;
  border: none;
  height: 1px;
  background: var(--pb-border-color);
}

.post-content iframe {
  max-width: 100%;
}

.post-content .wp-block-embed {
  margin: var(--pb-space-6) 0;
}
