@charset "UTF-8";

/*!
Theme Name: Cocoon Child
Description: Cocoon専用の子テーマ
Theme URI: https://wp-cocoon.com/
Author: わいひら
Author URI: https://nelog.jp/
Template:   cocoon-master
Version:    1.1.3
*/

/************************************
** 子テーマ用のスタイルを書く
************************************/
/*必要ならばここにコードを書く*/

/* ==========================================================
   CTAボタン(購入導線)視認性改善
   対象: 商品ページの .kc-buy ボタン(kc_render_buy_buttons出力)
        + 記事内に埋め込まれたインラインstyleの購入ボタン
   両方とも rel="nofollow sponsored noopener" を共通で持つため、
   属性セレクタで一括して既存の全購入ボタンに上乗せする。
   ========================================================== */

/* 1) 全アフィリエイトボタン共通: 立体感・ホバー・フォーカスリング */
a[rel~="sponsored"] {
  display: inline-block !important;
  box-shadow: 0 3px 0 rgba(0,0,0,0.18), 0 4px 10px rgba(0,0,0,0.12) !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease !important;
  min-height: 48px !important;
  line-height: 1.4 !important;
  box-sizing: border-box !important;
  letter-spacing: 0.02em !important;
  text-align: center !important;
}
a[rel~="sponsored"]:hover {
  transform: translateY(-2px) scale(1.03) !important;
  box-shadow: 0 5px 0 rgba(0,0,0,0.18), 0 8px 16px rgba(0,0,0,0.18) !important;
  filter: brightness(1.06) !important;
}
a[rel~="sponsored"]:active {
  transform: translateY(0) scale(0.98) !important;
  box-shadow: 0 1px 0 rgba(0,0,0,0.18), 0 2px 4px rgba(0,0,0,0.12) !important;
}
a[rel~="sponsored"]:focus-visible {
  outline: 3px solid #ffd166 !important;
  outline-offset: 2px !important;
}

/* 2) 商品ページの .kc-buy ボタン本体(現状ノースタイルだったため新規に定義) */
.kc-buy {
  color: #fff !important;
  font-weight: bold !important;
  font-size: 15px !important;
  padding: 13px 24px !important;
  margin: 6px 8px 6px 0 !important;
  border-radius: 8px !important;
  text-decoration: none !important;
  background: #6b7280;
}
.kc-buy:hover,
.kc-buy:active,
.kc-buy:visited {
  color: #fff !important;
  text-decoration: none !important;
}
/* ASP別の色分け(記事内埋め込みボタンの配色に合わせて統一) */
.kc-buy[href*="moshimo.com"],
.kc-buy[href*="amazon.co.jp"] { background: #f99a0c !important; } /* Amazon */
.kc-buy[href*="rakuten.co.jp"] { background: #e0423c !important; } /* 楽天 */
.kc-buy[href*="yahoo.co.jp"] { background: #438ee8 !important; } /* Yahoo! */
.kc-buy[href*="switchbot.jp"],
.kc-buy[href*="ankerjapan.com"],
.kc-buy[href*="eufylife.com"],
.kc-buy[href*="valuecommerce"],
.kc-buy[href*="a8.net"] { background: #22a06b !important; } /* 直販/直ASP */

/* 3) 商品ページでのボタン間隔・折り返し調整 */
.kc-buy + .kc-buy {
  margin-left: 4px;
}

/* ==========================================================
   トップページのヒーロー(2026-08-23 デザイン改善)
   Cocoon skin-grayishはフロントページ限定で.headerを100vh(画面いっぱい)にする
   演出用CSSを持つが、背景画像を設定していないため「ロゴだけの空白画面」になり、
   実際の価値提案(front-page.phpの.kc-hero)がスクロールしないと見えない状態だった。
   ヒーローの高さを実用的なサイズに圧縮し、下にある本来のコンテンツをすぐ見せる。
   ========================================================== */
.skin-grayish.front-top-page .container .header-container .header {
  height: auto !important;
  min-height: 0 !important;
  padding: 48px 0 !important;
}
.skin-grayish.front-top-page .header .header-in {
  height: auto !important;
}
/* 高さが十分あった時のための「Scroll」誘導は、圧縮後は不要かつ文脈が合わなくなるため非表示に */
.skin-grayish.front-top-page .skinadd-topmv-scroll {
  display: none !important;
}

/* ==========================================================
   記事アイキャッチ画像の見た目統一(2026-08-23 デザイン改善)
   ASP(Amazon/楽天/Yahoo!)から取得した商品画像をそのままアイキャッチに使っているため、
   テキストが焼き込まれた販促バナー系の画像が混ざり、商品ページ・比較ツールの
   白基調ミニマルなデザインと馴染んでいなかった。白背景の枠に統一し、
   object-fit: containで画像全体を収めることで「カードに収まった商品写真」に見せる。
   ========================================================== */
.eye-catch,
.eye-catch-wrap {
  background: #f5f5f7 !important;
}
.eye-catch-image {
  object-fit: contain !important;
  background: #f5f5f7 !important;
  padding: 12px;
  box-sizing: border-box;
}

/* ==========================================================
   比較ツールページのサイドバー非表示(2026-08-23 デザイン改善)
   /compare/ はブログ記事ではなく操作系の「ツール」ページのため、
   「最近の投稿」「アーカイブ」等のブログ用サイドバーは文脈上不要かつ画面を圧迫していた。
   本文エリアを全幅にしてコンテンツに集中させる。
   ========================================================== */
.page-template-page-compare .sidebar {
  display: none !important;
}
.page-template-page-compare #main {
  width: 100% !important;
  float: none !important;
}

/* ==========================================================
   サイドバーの総入れ替え(2026-08-25 デザイン改善)
   sidebar.php側で標準ウィジェット(検索/最近の投稿/最近のコメント/アーカイブ/カテゴリー)を
   廃止し、実用的なカード(検索・カテゴリー一覧・比較ツール導線)に総入れ替えした。
   ここではその見た目をサイト全体のミニマル基調(#1d1d1f文字 / #f5f5f7地 / #d2d2d7罫線)に合わせる。
   ========================================================== */
.kc-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.kc-side-card {
  background: #fff;
  border: 1px solid #d2d2d7;
  border-radius: 14px;
  padding: 20px;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", sans-serif;
}
.kc-side-search {
  display: flex;
  gap: 8px;
}
.kc-side-search-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #d2d2d7;
  border-radius: 980px;
  padding: 9px 16px;
  font-size: 14px;
  color: #1d1d1f;
  background: #f5f5f7;
}
.kc-side-search-input:focus {
  outline: 2px solid #1d1d1f;
  outline-offset: 1px;
}
.kc-side-search-btn {
  flex-shrink: 0;
  border: none;
  border-radius: 980px;
  width: 38px;
  height: 38px;
  background: #1d1d1f;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.kc-side-search-btn:hover {
  background: #000;
}
.kc-side-title {
  font-size: 14px;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}
.kc-side-cat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.kc-side-cat-list li {
  border-top: 1px solid #f0f0f0;
}
.kc-side-cat-list li:first-child {
  border-top: none;
}
.kc-side-cat-list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 9px 2px;
  font-size: 13.5px;
  color: #1d1d1f;
  text-decoration: none;
  transition: color 0.2s ease, padding-left 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.kc-side-cat-list a:hover {
  color: #6e6e73;
  padding-left: 6px;
}
.kc-side-cat-list a.is-current {
  font-weight: 700;
  color: #000;
}
.kc-side-cat-list a.is-current .kc-side-cat-name::before {
  content: "● ";
  font-size: 8px;
  vertical-align: middle;
}
.kc-side-cat-count {
  flex-shrink: 0;
  font-size: 12px;
  color: #a1a1a6;
}
.kc-side-cta {
  background: #f5f5f7;
  text-align: center;
}
.kc-side-cta-title {
  font-size: 15px;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 6px;
}
.kc-side-cta-sub {
  font-size: 12.5px;
  color: #6e6e73;
  line-height: 1.6;
  margin: 0 0 16px;
}
.kc-side-cta-btn {
  display: inline-block;
  background: #1d1d1f;
  color: #fff;
  border-radius: 980px;
  padding: 10px 24px;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}
.kc-side-cta-btn:hover {
  background: #000;
}

/* ==========================================================
   Apple風の「滑らかさ」の演出(2026-08-23)
   Apple公式サイトのデザインそのものは複製しない(フォントのライセンス・商標的な見た目の
   問題があるため、[[design-review]]の判断どおり)。その代わり、Appleらしい上質な質感の
   核である「滑らかなイージング」「スクロールで自然に現れる要素」「ホバー時の軽やかな反応」を、
   このサイト独自のミニマルなデザイン言語の上に実装する。
   スクロールで要素をふわっと出す仕組み(.kc-observe/.kc-revealed)はfunctions.php側の
   IntersectionObserverと対になっている。JSが動かない場合でもコンテンツは
   最初から見える状態を保つ(JSが.kc-observeクラス自体を付与するので、無効化時は
   非表示状態にすらならない=プログレッシブエンハンスメント)。
   ========================================================== */
html {
  scroll-behavior: smooth;
}
.kc-observe {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.kc-observe.kc-revealed {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .kc-observe {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ホバー時の質感向上: 既存の border-color だけの素っ気ない反応に、
   軽い浮き上がり(translateY)+影+滑らかなイージングを追加する。 */
.kc-cat-card-dual,
.kc-card,
.kc-detail-card {
  transition: border-color 0.3s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.3s cubic-bezier(0.22, 1, 0.36, 1) !important;
}
.kc-cat-card-dual:hover,
.kc-card:hover,
.kc-detail-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}
.kc-compare-item {
  transition: padding-left 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              background-color 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.kc-compare-item:hover {
  padding-left: 10px;
  background-color: #f9fafb;
}
/* 既存の.kc-buyホバー(transform/box-shadow)を、より滑らかな減速カーブに差し替え */
.kc-buy {
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.2s cubic-bezier(0.22, 1, 0.36, 1),
              filter 0.2s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

/* ==========================================================
   ヘッダー「カテゴリー」ドロップダウンのメガメニュー化(2026-08-26)
   17カテゴリーを1列で並べると縦に伸びすぎて画面下に見切れる不具合をユーザーが発見
   (今後カテゴリーが増えるほど悪化する)。Apple公式サイトのメガメニューのように、
   複数列のグリッドに変えて「縦に伸びる」問題そのものを構造的に解消する。
   #menu-item-3192 は「カテゴリー」ドロップダウンの親メニュー項目
   (2026-08-26新設、kc_add_category_to_header_menu_on_create()が今後の新カテゴリーを
   自動でこの下に追加する)。列数を増やす方向で吸収できるので、カテゴリーが
   今後何個増えてもこの構造なら破綻しない。

   【2026-08-26 追記】さらに1階層追加し、17カテゴリーを6つのジャンル
   (お掃除・空気家電/洗濯・衣類ケア家電/キッチン家電/美容家電/スマートホーム・防犯/映像家電)
   にグルーピング。WordPressの標準ナビ構造上は「グループ見出し→その孫要素としてカテゴリー」
   という2階層のドロップダウンになるが、素の挙動だと孫の.sub-menuは自分のliに
   再度ホバーしないと開かない(=クリックしないと中身が見えない)ため、Apple風に
   「開いた瞬間に全部の列が見えている」メガメニューにするには、孫.sub-menuを
   常時展開状態に強制する必要がある。以下はその上書き。
   ========================================================== */
#menu-item-3192 > .sub-menu {
  display: flex !important;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 28px 36px;
  width: max-content;
  max-width: min(920px, calc(100vw - 40px));
  padding: 22px 26px !important;
  box-sizing: border-box;
  /* 幅を広げた際、Cocoon側の中央寄せ計算(親linkの中心基準)がマイナスのleftを
     算出して画面外にはみ出す不具合があったため、親li(カテゴリー)の左端に固定する。 */
  left: 0 !important;
  right: auto !important;
  transform: none !important;
}
/* 列(=ジャンル)本体。孫.sub-menuを縦に積む入れ物にする */
#menu-item-3192 > .sub-menu > li {
  width: auto !important;
  min-width: 148px;
}
/* ジャンル見出し自体はリンクとして機能させない(装飾用の列タイトル扱い) */
#menu-item-3192 > .sub-menu > li > a {
  font-weight: 700;
  font-size: 13px;
  color: var(--kc-text, #6e6e73);
  pointer-events: none;
  cursor: default;
  padding-bottom: 4px !important;
  border-bottom: 1px solid #e5e5e5;
  margin-bottom: 8px;
  display: block;
}
/* 孫.sub-menu(実際のカテゴリーリンク)を常時展開状態に固定 */
#menu-item-3192 > .sub-menu > li > .sub-menu {
  display: block !important;
  position: static !important;
  width: auto !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
#menu-item-3192 > .sub-menu > li > .sub-menu > li > a {
  padding: 4px 0 !important;
  white-space: nowrap;
}
@media screen and (max-width: 900px) {
  #menu-item-3192 > .sub-menu {
    max-width: calc(100vw - 24px);
    gap: 20px 24px;
  }
}

/* ==========================================================
   比較表ヘッダー行の視認性修正(2026-09-16)
   kc_render_table()(bin/regenerate-compare-articles.php)が生成し
   1000件超の記事のpost_contentに焼き込み済みの比較表で、
   ヘッダー行<tr style="background:#1e3a5f;color:#fff;">の色がColorの
   子<th>に正しく伝わっていなかった問題:
   - 商品名2セルはbackgroundの指定がなく、Cocoon本体のtable th{background:xx-thin-color}
     (ほぼ白)が上書きし、白文字(継承)×白背景でほぼ見えなくなっていた。
   - 「項目」セルはbackground:#1e3a5fを自前で持つが、Cocoonの1列目固定用CSSが
     color:#333(継承ではなく直接指定)を上書きし、紺地にグレー文字で読みにくくなっていた。
   記事本文を1000件超書き換える代わりに、生成時と同じ配色をCSS側で
   インライン属性セレクタで狙い撃ちして強制することで、既存記事にも即時反映させる。
   ========================================================== */
table thead tr[style*="1e3a5f"] th,
.scrollable-table table thead tr[style*="1e3a5f"] th,
.scrollable-table.stfc-sticky table thead tr[style*="1e3a5f"] > *:first-child {
  background-color: #1e3a5f !important;
  color: #fff !important;
}

/************************************
** レスポンシブデザイン用のメディアクエリ
************************************/
/*1023px以下*/
@media screen and (max-width: 1023px){
  /*必要ならばここにコードを書く*/
}

/*834px以下*/
@media screen and (max-width: 834px){
  /*必要ならばここにコードを書く*/
}

/*480px以下*/
@media screen and (max-width: 480px){
  /*必要ならばここにコードを書く*/
  /* CTAボタン: スマホでは横幅いっぱいに広げてタップしやすくする */
  .kc-buy {
    display: block !important;
    width: 100% !important;
    margin: 8px 0 !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }
  a[rel~="sponsored"] {
    min-height: 52px !important;
  }
}
