/* Responsive: yes */

/* =========================================================
   全体調整
   - パンくずリストは表示したまま、最後の記事タイトルだけ非表示
   - PCでは「読む前にチェック！」パーツと記事タイトルの間に少し余白を作る
   ========================================================= */

/* PC・スマホ共通：パンくず内の最後の記事タイトルだけ非表示 */
body.page-entry .breadcrumb .breadcrumb-child:last-child {
  display: none !important;
}

/* PC・スマホ共通：最後の記事タイトルの直前にある区切り記号「>」も非表示 */
body.page-entry .breadcrumb .breadcrumb-gt:nth-last-child(2),
body.page-entry .breadcrumb .breadcrumb-gt:has(+ .breadcrumb-child:last-child) {
  display: none !important;
}

/* パンくず全体の下余白を控えめにする */
body.page-entry .breadcrumb {
  margin-bottom: 10px !important;
  padding-bottom: 0 !important;
}

/* カテゴリ下・広告上に出る余白を控えめにする */
body.page-entry .entry-categories,
body.page-entry .entry-category,
body.page-entry .categories,
body.page-entry .entry-tags,
body.page-entry .entry-tag {
  margin-bottom: 8px !important;
}

/* 記事本文上の広告枠まわりの余白を控えめにする */
body.page-entry .g-ads,
body.page-entry .g-h-ads {
  margin-top: 8px !important;
  margin-bottom: 10px !important;
}

/* PC表示：上部マーケット情報パネルと記事タイトルの間を少し空ける */
@media screen and (min-width: 768px) {
  body.page-entry .p-entry-chart {
    margin-bottom: 24px !important;
  }

  body.page-entry .entry-header,
  body.page-entry .entry-title {
    margin-top: 0 !important;
  }
}

/* =========================================================
   スマホ記事ページ・カテゴリページ調整
   - 記事本文フォントサイズは変更しない
   - 記事本文行間を26pxに調整
   - カテゴリ説明文は行間を少し詰める
   - カテゴリ説明内カードの行間だけ詰める
   - メインカテゴリ説明画像はスマホ時のみ説明文より上に表示
   - 記事上の為替情報パネルを非表示
   - カテゴリタグを小さく・上下を詰める
   - スマホ上部のMarket NEXTアプリ誘導を非表示
   ========================================================= */

@media screen and (max-width: 767px) {
  /* スマホ記事本文：フォントサイズは維持し、行間だけ調整 */
  body.page-entry,
  body.page-entry * {
    line-height: 26px !important;
  }

  body.page-entry p {
    margin-top: 0 !important;
    margin-bottom: 0.9em !important;
  }

  /* スマホカテゴリページ：カテゴリ説明文の行間を統一 */
  body.page-archive .archive-description-container p,
  body.page-archive .archive-description p,
  body.page-archive .category-description p {
    line-height: 1.45 !important;
    margin-top: 0 !important;
    margin-bottom: 0.7em !important;
  }

  body.page-archive .archive-description-container p:last-child,
  body.page-archive .archive-description p:last-child,
  body.page-archive .category-description p:last-child {
    margin-bottom: 0 !important;
  }

  /* カテゴリ説明内カード：カード幅・画像サイズは触らず、テキスト行間だけ詰める */
  body.page-archive .archive-description-container a p {
    line-height: 1.3 !important;
    margin-top: 0 !important;
  }

  body.page-archive .archive-description-container a p:first-child {
    margin-bottom: 2px !important;
  }

  body.page-archive .archive-description-container a p:last-child {
    margin-bottom: 0 !important;
  }

  body.page-archive .archive-description-container a > div {
    padding-top: 12px !important;
    padding-bottom: 14px !important;
  }

  /* スマホカテゴリページ：メインカテゴリ画像を説明文より上に表示 */
  body.page-archive .archive-description-container .main-category-hero-image {
    order: -1 !important;
  }

  body.page-archive .archive-description-container .main-category-hero-text {
    order: 0 !important;
  }

  body.page-archive .archive-description-container .main-category-hero {
    row-gap: 18px !important;
  }

  body.page-archive .archive-description-container .main-category-hero-image img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
  }

  /* スマホカテゴリページ：メイン説明ブロックとカード一覧を少し分離 */
  body.page-archive .archive-description-container .main-category-card-grid {
    margin-top: 32px !important;
    padding-top: 18px !important;
    border-top: 1px solid #d9e2ec !important;
  }

  /* 記事上「読む前にチェック！最新FX為替情報」を非表示 */
  .p-entry-chart {
    display: none !important;
  }

  /* スマホ上部のMarket NEXTアプリ誘導を非表示 */
  .c-marketnext,
  .c-marketnext-layout,
  .c-marketnext-pic,
  .c-marketnext-body,
  .c-marketnext-badges {
    display: none !important;
  }

  .c-section:has(.c-marketnext),
  .c-section:has(img[src*="logo-marketnext"]),
  .c-section:has(img[src*="top-app"]) {
    display: none !important;
  }

  /* パンくず下の余白をさらに圧縮 */
  body.page-entry .breadcrumb {
    margin-top: 12px !important;
    margin-bottom: 4px !important;
    padding-bottom: 0 !important;
  }

  /* パンくずの直後に余白だけ残る場合の対策 */
  body.page-entry .breadcrumb + * {
    margin-top: 0 !important;
  }

  /* 記事タイトルまわりの余白を圧縮 */
  body.page-entry .entry-header {
    margin-top: 0 !important;
    margin-bottom: 10px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  body.page-entry .entry-title {
    margin-top: 0 !important;
    margin-bottom: 12px !important;
    padding-top: 0 !important;
  }

  /* 日付まわりの余白を控えめに */
  body.page-entry .entry-date,
  body.page-entry .date,
  body.page-entry time {
    margin-top: 0 !important;
    margin-bottom: 8px !important;
  }

  /* スマホ記事ページ：カテゴリタグを小さく・上下を詰める */
  body.page-entry .entry-categories,
  body.page-entry .entry-category,
  body.page-entry .categories,
  body.page-entry .entry-tags,
  body.page-entry .entry-tag {
    gap: 4px !important;
    margin-top: 4px !important;
    margin-bottom: 4px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    line-height: 1.1 !important;
  }

  body.page-entry .entry-categories a,
  body.page-entry .entry-category a,
  body.page-entry .categories a,
  body.page-entry .entry-tags a,
  body.page-entry .entry-tag a,
  body.page-entry a[rel="tag"] {
    display: inline-block !important;
    font-size: 12px !important;
    line-height: 1.05 !important;
    padding: 5px 12px !important;
    margin: 0 4px 5px 0 !important;
    border-radius: 999px !important;
    white-space: nowrap !important;
  }

  /* カテゴリ下から広告までの余白を圧縮 */
  body.page-entry .entry-categories + *,
  body.page-entry .entry-category + *,
  body.page-entry .categories + *,
  body.page-entry .entry-tags + *,
  body.page-entry .entry-tag + * {
    margin-top: 6px !important;
  }

  /* 記事本文上の広告枠まわりの余白を圧縮 */
  body.page-entry .g-ads,
  body.page-entry .g-h-ads {
    margin-top: 6px !important;
    margin-bottom: 8px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  /* 空の広告枠が余白だけ残す場合は高さを詰める */
  body.page-entry .g-ads:empty,
  body.page-entry .g-h-ads:empty {
    display: none !important;
  }
}
