/*
 Theme Name:   houkago Child
 Template:     houkago
 Version:      1.3.0

 説明:
  - ヘッダー(ロゴ/検索/三本線)が小画面対応
  - コメント親子レイアウト(通常/返信)
  - インスタ風グリッド: PC5列/スマホ3列
*/

/*----------------------------------------------
  ヘッダー関連
----------------------------------------------*/
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 80px;
  z-index: 999;
  background: #fff;
  border-bottom: 1px solid #ccc;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1em;
  flex-wrap: nowrap;
  box-sizing: border-box;
  padding: 0 0.5em;
}

.header-logo img {
  max-height: 60px !important;
  height: auto !important;
  width: auto !important;
  display: block;
}

/* 検索フォーム */
.header-search .search-form {
  display: flex;
  align-items: center;
  background: #f2f2f2;
  border-radius: 4px;
  padding: 0.3em 0.5em;
  flex-shrink: 1;
  flex-grow: 1;
  min-width: 60px;
  max-width: 300px;
}

.header-search .search-form input[type="search"] {
  border: none;
  background: transparent;
  outline: none;
  color: #333;
  padding: 0;
  margin-right: 0.4em;
  flex: 1 1 auto;
  min-width: 30px;
}

.header-search .search-form button {
  border: none;
  background: none;
  font-size: 1em;
  color: #333;
  cursor: pointer;
  padding: 0;
  margin: 0;
}

/* 三本線(ハンバーガー) */
.header-hamburger {
  display: flex;
  align-items: center;
}

.hamburger-icon {
  width: 30px;
  height: 24px;
  position: relative;
  cursor: pointer;
  display: inline-block;
}

.hamburger-icon span {
  display: block;
  width: 100%;
  height: 3px;
  background: #000;
  margin: 4px 0;
  transition: all 0.3s ease;
}

.hamburger-icon.is-active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.hamburger-icon.is-active span:nth-child(2) {
  opacity: 0;
}

.hamburger-icon.is-active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ドロワーメニュー */
.global-nav {
  position: absolute;
  top: 80px; /* ヘッダーの高さ */
  left: 0; right: 0;
  background: #f9f9f9;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  box-sizing: border-box;
  padding: 0 1em;
}

.global-nav.nav-open {
  max-height: 300px;
}

.nav-menu {
  list-style: none;
  margin: 1em 0;
  padding: 0;
}

.nav-menu li {
  margin-bottom: 0.5em;
}

.nav-menu li a {
  color: #333;
  text-decoration: none;
}

/* ヘッダーspacer */
.header-spacer {
  height: 80px;
}

/* 上に戻るボタン */
.scroll-to-top {
  position: fixed;
  bottom: 20px; right: 20px;
  background: #ccc;
  color: #333;
  font-size: 0.9em;
  padding: 0.5em 0.8em;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  z-index: 9999;
  display: none;
}

/* ~360px 小画面 */
@media screen and (max-width: 360px) {
  .header-inner {
    gap: 0.5em;
    padding: 0 0.25em;
  }

  .header-logo img {
    max-height: 35px;
  }

  .header-search .search-form {
    max-width: 200px;
  }
}

/*----------------------------------------------
  コメントの親子区別 & インデント
----------------------------------------------*/
.normal-comment {
  background: #FFF;
  margin-bottom: 1em;
}

.reply-comment {
  background: #FFF;
  margin-bottom: 1em;
}

.comment-list .children .reply-comment {
  margin-left: 2em;
}


.comment-list .comment {
    margin-bottom: 4.5em; /* コメント間の間隔を調整 */
}


/*----------------------------------------------
  インスタ風グリッド:
  - PC(769px～): 5列固定
  - スマホ(～768px): 3列固定
----------------------------------------------*/
.grid-container {
  display: grid;
  grid-gap: 10px;
  padding: 1em;
  box-sizing: border-box;
}

@media screen and (min-width: 769px) {
  .grid-container {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media screen and (max-width: 768px) {
  .grid-container {
    grid-gap: 5px;
    grid-template-columns: repeat(3, 1fr);
  }
}

.grid-item {
  position: relative;
  overflow: hidden;
}

.grid-item img.thumb-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.no-thumb {
  width: 100%;
  height: 200px;
  background: #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
}

/*----------------------------------------------
  キャプション文字サイズ変更
----------------------------------------------*/
.wp-caption .wp-caption-text,
.wp-caption-text,
figcaption {
  text-align: left;
  font-size: 0.9em !important;
  line-height: 1.3;
  color: #999;
}

/* カテゴリページのレイアウト調整 */
.category-page {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 3列レイアウト */
  gap: 20px;
  justify-items: stretch;
  margin: 2em 0;
}

.category-item {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 15px;
  box-sizing: border-box;
  transition: all 0.3s ease;
}

.category-item:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-5px);
}

.category-item .entry-title {
  font-size: 1.1em;
  font-weight: bold;
  margin-bottom: 10px;
}

/* レスポンシブ調整 */
@media screen and (max-width: 1024px) {
  .category-page {
    grid-template-columns: repeat(2, 1fr); /* タブレットでは2列 */
  }
}

@media screen and (max-width: 768px) {
  .category-page {
    grid-template-columns: 1fr; /* スマホでは1列 */
  }
}

/* カテゴリナビゲーション */
.category-nav {
  display: flex;
  gap: 1em;
  list-style: none;
  padding: 0;
  margin-bottom: 2em;
}

.category-nav li a {
  text-decoration: none;
  color: #333;
  padding: 0.5em 1em;
  border-radius: 4px;
  transition: background 0.3s ease;
}

.category-nav li a:hover {
  background: #2e7d32;
  color: white;
}

/* カテゴリボタン */
.category-button {
  display: inline-block;
  background: #eee;
  border: 1px solid #ccc;
  color: #333;
  font-size: 0.8em;
  text-decoration: none;
  padding: 0.4em 0.5em;
  margin: 0.3em 0.3em;
  border-radius: 4px;
}

.category-button:hover {
  background: #2e7d32;
  color: white;
}

/* カテゴリリスト */
.category-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.category-list li {
  margin-bottom: 10px;
}


.comment-list .comment .reply a {
    display: inline-block;
    padding: 0.3em 0.8em;
    background-color: #0073aa;
    color: #ffffff;
    border-radius: 3px;
    text-decoration: none;
    font-size: 0.9em;
}

.comment-list .comment .reply {
    text-align: right; /* 右寄せ */
    margin-top: 1em; /* 上部の間隔調整 */
}




/* カテゴリなどのグリッド内サムネイルを「同じ高さ」に揃える */
.grid-container .thumb-link {
  display: block;
}

.grid-container .thumb-frame {
  position: relative;
  width: 100%;
  /* ★ここでアスペクト比を固定 → 高さが揃う */
  aspect-ratio: 16 / 9;   /* 好みに応じて 4 / 3 や 3 / 4 に変更可 */
  overflow: hidden;
  background: #f5f5f5;
}

.grid-container .thumb-frame img.thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;       /* 余白なしで中央トリミング */
  display: block;
}

/* アイキャッチ無し（No Image）のときも枠の高さを合わせる */
.grid-container .thumb-frame .no-thumb {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9em;
  color: #666;
  text-align: center;
}
