@charset "UTF-8";
/*
    Template: swell
    Theme Name: SWELL CHILD
    Theme URI: https://swell-theme.com/
    Description: SWELLの子テーマ
    Version: 1.0.0
    Author: LOOS WEB STUDIO
    Author URI: https://loos-web-studio.com/

    License: GNU General Public License
    License URI: http://www.gnu.org/licenses/gpl.html
*/

/* 投稿本文内の画像を最大幅に揃える */
.entry-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.post_content h4 {
  border-left: 8px solid#99cc99;
  padding-left: 12px;
  font-weight: bold;
}



/* アイキャッチ画像直後の文章との間隔を狭くする */
.post_content > p:first-of-type {
  margin-top: 0em;
}

.single-post .post-thumbnail {
  margin-bottom: 0em;
}

/*　横並び＆装飾を調整　*/
.custom-category-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin-bottom: 1em;
}

.custom-category-labels .category-label {
  background-color: #f0f0f0;
  color: #333;
  padding: 0.3em 0.6em;
  border-radius: 4px;
  font-size: 0.85em;
  text-decoration: none;
}

<div class="eyecatch-wrapper">
  /*　<?php the_post_thumbnail(); ?>
  <div class="category-labels">
    <?php
      $categories = get_the_category();
      if ($categories) {
        foreach ($categories as $category) {
          echo '<span class="cat-label">' . esc_html($category->name) . '</span>';
        }
      }
    ?>　*/
　　<?php
　　　$categories = get_the_category();
　　　$parent_cat = null;

　　　foreach ($categories as $cat) {
 　 　if ($cat->category_parent == 0) {
 　   $parent_cat = $cat;
 　   break;
　　  　}
　　　}

　　　if ($parent_cat) {
  　　echo '<div class="parent-category-label">' . esc_html($parent_cat->name) . 
　　　}
　　　?>
  </div>
</div>

.p-postList__cat {
  position: absolute;
  top: 8px;
  right: 8px;
  background-color: rgba(0,0,0,0.6);
  color: #fff;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 4px;
  margin-left: 4px;
  z-index: 10;
}


