/* =========================================================================
   衛星ブログ（WP 移植）スタイル — Cocoon風の再現
   Vite/Tailwind に依存しない素のCSS。記事本文は WP Gutenberg 由来HTMLのため
   preflight を避けて基本ブロック（見出し/段落/リスト/画像/引用/テーブル）を整える。
   ========================================================================= */

/* ---- リセット（最低限） ------------------------------------------------ */
* { box-sizing: border-box; }
/* scroll-behavior: 目次リンク等のページ内アンカーをスムーススクロールに */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
/* アンカー着地時に見出しが上端に張り付かないよう余白を確保 */
.entry-content h2[id], .entry-content h3[id] { scroll-margin-top: 16px; }
body {
  margin: 0;
  background: #f7f7f7;
  color: #333;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
    "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.8;
}
img { max-width: 100%; height: auto; }
a { color: #2681c8; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- レイアウト -------------------------------------------------------- */
.blog-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}
.blog-body {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  padding: 24px 0 48px;
}
.blog-main { flex: 1 1 auto; min-width: 0; }
.blog-sidebar { flex: 0 0 300px; width: 300px; }

/* ---- ヘッダー ---------------------------------------------------------- */
.blog-header {
  background: #fff;
  border-bottom: 1px solid #e6e6e6;
}
.blog-header-in {
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 16px;
  text-align: center;
}
.blog-logo {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
}
.blog-logo a { color: #333; }
.blog-catchphrase {
  margin: 6px 0 0;
  font-size: 13px;
  color: #777;
}
.blog-globalnav {
  background: #fff;
  border-bottom: 1px solid #e6e6e6;
}
.blog-globalnav-in {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  flex-wrap: wrap;
}
.blog-globalnav-in a {
  display: block;
  padding: 12px 16px;
  color: #444;
  font-size: 14px;
}
.blog-globalnav-in a:hover { background: #f0f0f0; text-decoration: none; }

/* ---- パンくず ---------------------------------------------------------- */
.blog-breadcrumb {
  font-size: 12px;
  color: #888;
  padding: 12px 0 0;
}
.blog-breadcrumb a { color: #888; }
.blog-breadcrumb span { margin: 0 6px; }

/* ---- 記事カード（一覧） ------------------------------------------------ */
.entry-card {
  display: flex;
  gap: 16px;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 16px;
  transition: box-shadow .15s ease;
}
.entry-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.entry-card-thumb {
  flex: 0 0 160px;
  width: 160px;
  height: 90px;
  overflow: hidden;
  border-radius: 4px;
  background: #eee;
}
.entry-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.entry-card-content { flex: 1 1 auto; min-width: 0; }
.entry-card-title {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.5;
  font-weight: 700;
}
.entry-card-title a { color: #333; }
.entry-card-title a:hover { color: #2681c8; }
.entry-card-snippet {
  margin: 0 0 10px;
  font-size: 13px;
  color: #666;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.entry-card-meta { font-size: 12px; color: #999; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.cat-label {
  display: inline-block;
  background: #2681c8;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 3px;
}
.cat-label:hover { background: #1c6aa8; text-decoration: none; color: #fff; }

/* ---- ページタイトル ---------------------------------------------------- */
.page-title {
  font-size: 22px;
  font-weight: 700;
  margin: 4px 0 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #2681c8;
}

/* ---- 記事本体 ---------------------------------------------------------- */
.article {
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 6px;
  padding: 28px;
}
.article-title {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.45;
  margin: 0 0 14px;
}
.article-meta {
  font-size: 12px;
  color: #999;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.article-meta .date-icon::before { content: "🕒 "; }
.article-meta .mod-icon::before { content: "🔄 "; }
.article-eyecatch { margin: 0 0 22px; }
.article-eyecatch img { width: 100%; border-radius: 4px; }

/* 本文（Gutenberg 基本ブロック） */
.entry-content { font-size: 16px; }
.entry-content > * { margin-top: 0; }
.entry-content p { margin: 0 0 1.4em; }
.entry-content h2 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.5;
  margin: 2em 0 .8em;
  padding: 12px 16px;
  background: #f2f7fb;
  border-left: 5px solid #2681c8;
  scroll-margin-top: 20px;
}
.entry-content h3 {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.5;
  margin: 1.8em 0 .7em;
  padding-bottom: 6px;
  border-bottom: 2px solid #dbe7f0;
  scroll-margin-top: 20px;
}
.entry-content h4 { font-size: 17px; font-weight: 700; margin: 1.6em 0 .6em; }
.entry-content ul,
.entry-content ol { margin: 0 0 1.4em; padding-left: 1.6em; }
.entry-content li { margin-bottom: .4em; }
.entry-content a { text-decoration: underline; }
.entry-content img { border-radius: 4px; }
.entry-content figure { margin: 0 0 1.4em; }
.entry-content figure img { display: block; margin: 0 auto; }
.entry-content figcaption { font-size: 12px; color: #888; text-align: center; margin-top: 6px; }
.entry-content blockquote {
  margin: 0 0 1.4em;
  padding: 12px 18px;
  background: #f7f7f7;
  border-left: 4px solid #ccc;
  color: #555;
}
.entry-content blockquote p:last-child { margin-bottom: 0; }
.entry-content pre {
  background: #2d2d2d;
  color: #f5f5f5;
  padding: 16px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 13px;
  margin: 0 0 1.4em;
}
.entry-content code {
  background: #eef2f5;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 90%;
}
.entry-content pre code { background: none; padding: 0; }
.entry-content .wp-block-table,
.entry-content figure.wp-block-table { overflow-x: auto; }
.entry-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 1.4em;
  font-size: 14px;
}
.entry-content th,
.entry-content td {
  border: 1px solid #d6d6d6;
  padding: 8px 10px;
  text-align: left;
}
.entry-content th { background: #f2f7fb; }
.entry-content hr { border: none; border-top: 1px solid #e0e0e0; margin: 2em 0; }

/* ---- インライン強調（Cocoon / VK Blocks マーカー） -------------------- */
.entry-content .marker,
.entry-content .marker-red,
.entry-content .marker-blue {
  background: linear-gradient(transparent 60%, #fff384 60%);
  padding: 0 .1em;
  font-weight: 700;
}
.entry-content .marker-red { background: linear-gradient(transparent 60%, #ffd0d0 60%); }
.entry-content .marker-blue { background: linear-gradient(transparent 60%, #cfe6ff 60%); }
.entry-content .marker-under {
  background: none;
  border-bottom: 2px solid #2681c8;
  font-weight: 700;
}

/* ---- 見出しスタイル（VK Blocks 上下二重線） --------------------------- */
.entry-content .is-style-vk-heading-double_black {
  background: none;
  border: none;
  border-top: 3px double #333;
  border-bottom: 3px double #333;
  padding: 10px 0;
  text-align: center;
}

/* ---- 目次ボックス（Cocoon風） ----------------------------------------- */
.toc {
  background: #fbfbf9;
  border: 1px solid #e0e0d8;
  border-radius: 4px;
  padding: 16px 20px;
  margin: 0 0 28px;
  font-size: 14px;
}
.toc-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 8px;
  text-align: center;
}
.toc ol { margin: 0; padding-left: 1.4em; }
.toc > ol { counter-reset: toc-h2; list-style: none; padding-left: 0; }
.toc > ol > li { counter-increment: toc-h2; }
.toc > ol > li > a::before { content: counter(toc-h2) ". "; color: #2681c8; font-weight: 700; }
.toc ol ol { list-style: none; padding-left: 1.4em; margin: 4px 0; counter-reset: toc-h3; }
.toc ol ol > li { counter-increment: toc-h3; }
.toc ol ol > li > a::before { content: counter(toc-h2) "-" counter(toc-h3) ". "; color: #6aa0c8; }
.toc li { margin: 4px 0; line-height: 1.6; }
.toc a { color: #444; }
.toc a:hover { color: #2681c8; }

/* ---- サイドバー -------------------------------------------------------- */
.widget {
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 6px;
  margin-bottom: 24px;
  overflow: hidden;
}
.widget-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: #2681c8;
  padding: 10px 14px;
  margin: 0;
}
.widget-body { padding: 12px 14px; }
.widget-recent { list-style: none; margin: 0; padding: 0; }
.widget-recent li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed #eee; }
.widget-recent li:last-child { border-bottom: none; }
.widget-recent-thumb { flex: 0 0 70px; width: 70px; height: 46px; overflow: hidden; border-radius: 3px; background: #eee; }
.widget-recent-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.widget-recent-title { font-size: 13px; line-height: 1.5; color: #444; }
.widget-recent-title a { color: #444; }
.widget-cats { list-style: none; margin: 0; padding: 0; }
.widget-cats li { border-bottom: 1px solid #f0f0f0; }
.widget-cats li:last-child { border-bottom: none; }
.widget-cats a {
  display: flex;
  justify-content: space-between;
  padding: 8px 4px;
  color: #444;
  font-size: 14px;
}
.widget-cats a:hover { color: #2681c8; text-decoration: none; }
.widget-cats .count { color: #999; font-size: 12px; }

/* ---- ページネーション -------------------------------------------------- */
.pagination {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}
.pagination a,
.pagination span {
  display: inline-block;
  min-width: 38px;
  text-align: center;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  color: #2681c8;
  font-size: 14px;
}
.pagination a:hover { background: #f0f7fc; text-decoration: none; }
.pagination .current { background: #2681c8; color: #fff; border-color: #2681c8; }
.pagination .disabled { color: #bbb; }

/* ---- フッター ---------------------------------------------------------- */
.blog-footer {
  background: #333;
  color: #ccc;
  text-align: center;
  padding: 24px 16px;
  font-size: 13px;
}
.blog-footer a { color: #ccc; }

/* ---- 埋め込み（YouTube等）16:9 レスポンシブ -------------------------- */
.entry-content .wp-block-embed { margin: 24px 0; }
.wp-block-embed figcaption { font-size: 13px; color: #666; text-align: center; margin-top: 6px; }
.wp-block-embed__wrapper { position: relative; width: 100%; }
.wp-block-embed__wrapper iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 0;
  border-radius: 8px;
}

/* ---- レスポンシブ（スマホは1カラム） ---------------------------------- */
@media (max-width: 860px) {
  .blog-body { flex-direction: column; }
  .blog-sidebar { flex-basis: auto; width: 100%; }
  .entry-card { flex-direction: column; }
  .entry-card-thumb { flex-basis: auto; width: 100%; height: auto; aspect-ratio: 16 / 9; }
  .article { padding: 18px; }
  .article-title { font-size: 22px; }
  .blog-logo { font-size: 22px; }
}

/* ==== Cocoon 商品リンク（[rakuten] 展開ボックス） ========================
   本家テーマ style.css の該当セレクタから、外観に必要なものだけを抽出。
   クラス名は product-item-* / rakuten-item-* / shoplink* で blog.css の
   既存セレクタと重複しないため競合しない。 */
.product-item-box {
  padding: 22px 25px;
  width: 96%;
  border: 3px solid #dfdfdf;
  box-sizing: border-box;
  position: relative;
  margin: 1.5em auto;
}
.product-item-error.cf {
  display: block;
  line-height: 1.2;
}
.product-item-thumb {
  width: 160px;
  min-width: 160px;
  margin: 0 auto 1em !important;
  float: none !important;
  text-align: center;
}
.product-item-thumb * { display: block; }
.product-item-thumb > a > img { margin: 0 auto; }
.product-item-thumb-image { border: none; box-shadow: none; max-width: 100%; height: auto; }
.product-item-content { line-height: 125%; width: 100%; }
/* 商品タイトルリンクは本家同様に下線なし。既存の
   .entry-content a { text-decoration: underline } を明示的に打ち消す
   （ボタンは .product-item-buttons a 側で別途 none 指定済み）。 */
.product-item-title-link { font-weight: bold; text-decoration: none; }
.rakuten-item-thumb-link { text-decoration: none; }
.product-item-snippet { font-size: 0.8em; margin-top: 6px; }
.product-item-maker { color: #555; }
.product-item-price { margin-top: 4px; }
.item-price { color: #c9171e; font-weight: bold; }
.acquired-date { font-size: 0.9em; color: #777; }

.product-item-buttons { margin-top: 1em; }
.product-item-buttons > * {
  background: none !important;
  padding: 0 !important;
  display: block !important;
}
.product-item-buttons a {
  width: 90%;
  display: block;
  margin: 0 auto 8px;
  padding: 6px 12px;
  text-decoration: none;
  font-size: 13px;
  font-weight: bold;
  text-align: center;
  color: #fff;
  border-radius: 3px;
}
.product-item-buttons a:hover { opacity: 0.6; }

/* 各ショップのブランドカラー */
.shoplinkamazon a  { background: #f79901; }
.shoplinkrakuten a { background: #bf0000; }
.shoplinkyahoo a   { background: #e60033; position: relative; }
.shoplinkmercari a { background: #4dc9ff; }

@media screen and (min-width: 769px) {
  .product-item-box {
    text-align: left;
    display: flex;
    font-size: inherit !important;
  }
  .product-item-thumb {
    vertical-align: top;
    box-sizing: border-box;
    min-width: auto !important;
  }
  .product-item-content {
    line-height: 125%;
    vertical-align: top;
    box-sizing: border-box;
    padding-left: 25px;
    width: 100%;
  }
  .product-item-buttons { display: flex; flex-wrap: wrap; }
  .product-item-buttons a { width: auto; text-align: center; }
  .product-item-buttons > * { margin: 0.5%; box-sizing: border-box; }
}

/* ---- ① カテゴリー帯（キャッチコピー下・パンくず上） --------------------
   全カテゴリをチップ表示。1行固定・はみ出しは横スクロール。 */
.blog-catbar {
  background: #fff;
  border-bottom: 1px solid #e6e6e6;
}
.blog-catbar-list {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 16px;
  list-style: none;
  display: flex;
  flex-wrap: nowrap;      /* 1行固定 */
  gap: 8px;
  overflow-x: auto;       /* はみ出しは横スクロール */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;  /* Firefox: 控えめ */
  scrollbar-color: #ccc transparent;
}
.blog-catbar-list::-webkit-scrollbar { height: 6px; }
.blog-catbar-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }
.blog-catbar-list::-webkit-scrollbar-track { background: transparent; }
.blog-catbar-list li { flex: 0 0 auto; }
.blog-catchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  padding: 6px 12px;
  font-size: 13px;
  color: #444;
  background: #f5f7f9;
  border: 1px solid #e2e6ea;
  border-radius: 999px;
  line-height: 1.2;
}
.blog-catchip:hover {
  color: #fff;
  background: #2681c8;
  border-color: #2681c8;
  text-decoration: none;
}
.blog-catchip-count {
  font-size: 11px;
  color: #999;
  background: #fff;
  border-radius: 999px;
  padding: 1px 7px;
  min-width: 16px;
  text-align: center;
}
.blog-catchip:hover .blog-catchip-count { color: #2681c8; }

/* ---- ② サイドバー共通バナー ------------------------------------------- */
.widget-banner { border: none; background: transparent; }
.widget-banner .widget-body { padding: 0; }
.sidebar-banner a { display: block; }
.sidebar-banner img { width: 100%; height: auto; display: block; border-radius: 4px; }

/* ---- ③ サイドバー内検索ボックス --------------------------------------- */
.widget-search .widget-body { padding: 0; }
.blog-search { display: flex; }
.blog-search-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #d8dde1;
  border-right: none;
  border-radius: 6px 0 0 6px;
  background: #fff;
  color: #333;
}
.blog-search-input:focus { outline: none; border-color: #2681c8; }
.blog-search-btn {
  flex: 0 0 auto;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: #2681c8;
  border: 1px solid #2681c8;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
}
.blog-search-btn:hover { opacity: 0.85; }
.search-summary { font-size: 13px; color: #777; margin: 0 0 16px; }
