/* ============================================================
   肌研究ノート — Design System
   ============================================================ */

:root {
  /* Palette */
  --c-base: #FEFEFE;        /* background (near-white) */
  --c-paper: #FFFFFF;       /* cards / surfaces */
  --c-ink: #1A1A1A;         /* near-black text */
  --c-ink-soft: #545450;    /* muted text */
  --c-ink-faint: #8A8782;   /* captions / meta */
  --c-pink: #F2A99A;        /* coral pink accent */
  --c-pink-deep: #C56450;   /* darker pink for text-on-light */
  --c-pink-tint: #FBE5DF;   /* soft pink wash */
  --c-pink-tint2: #FEF5F2;  /* faintest pink wash */
  --c-sage: #7BAF8E;        /* sage green sub */
  --c-sage-deep: #4C8366;   /* deep sage for links/labels */
  --c-sage-tint: #E4EFE8;   /* soft sage wash */
  --c-line: #EAE9E5;        /* hairline borders */
  --c-line-soft: #F2F1ED;

  /* Type */
  --f-display: "Shippori Mincho B1", "Noto Serif JP", serif;
  --f-body: "Noto Serif JP", serif;
  --f-ui: "Noto Sans JP", sans-serif;

  /* Rhythm */
  --maxw: 1180px;
  --gutter: clamp(20px, 4vw, 48px);
  --radius: 4px;
  --radius-lg: 8px;

  --shadow-sm: 0 1px 2px rgba(26, 26, 26, 0.04), 0 1px 8px rgba(26, 26, 26, 0.03);
  --shadow-md: 0 4px 16px rgba(26, 26, 26, 0.07), 0 2px 6px rgba(26, 26, 26, 0.05);
  --shadow-lg: 0 12px 40px rgba(26, 26, 26, 0.12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--c-base);
  color: var(--c-ink);
  font-family: var(--f-body);
  font-weight: 400;
  line-height: 1.85;
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

img { display: block; max-width: 100%; }

::selection { background: var(--c-pink); color: #fff; }

/* scrollbar */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--c-base); }
::-webkit-scrollbar-thumb { background: #D9D9D5; border-radius: 99px; border: 3px solid var(--c-base); }
::-webkit-scrollbar-thumb:hover { background: var(--c-sage); }

/* ---------- Utilities ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--gutter); }
.ui { font-family: var(--f-ui); }
.eyebrow {
  font-family: var(--f-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--c-sage-deep);
}
.section-gap { padding-block: clamp(56px, 8vw, 104px); }

/* fade-in on mount */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.rise { animation: riseIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both; }
/* safety: if entrance animation can't run (e.g. tab hidden), never leave content invisible */
.rise.shown { opacity: 1 !important; transform: none !important; }
@media (prefers-reduced-motion: reduce) {
  .rise { animation: none !important; opacity: 1 !important; transform: none !important; }
}

/* ---------- Placeholder image ---------- */
.ph {
  position: relative;
  overflow: hidden;
  background-color: var(--c-pink-tint);
  background-image: repeating-linear-gradient(
    -45deg,
    transparent 0 11px,
    rgba(197, 100, 80, 0.12) 11px 22px
  );
  display: flex;
  align-items: center;
  justify-content: center;
}
.ph::after {
  content: attr(data-label);
  font-family: var(--f-ui);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--c-pink-deep);
  background: rgba(255, 255, 255, 0.72);
  padding: 5px 12px;
  border-radius: 99px;
  backdrop-filter: blur(2px);
}
.ph.sage {
  background-color: var(--c-sage-tint);
  background-image: repeating-linear-gradient(
    -45deg,
    transparent 0 11px,
    rgba(76, 131, 102, 0.12) 11px 22px
  );
}
.ph.sage::after { color: var(--c-sage-deep); }

/* ---------- Fillable image slots (<image-slot>) ---------- */
image-slot { display: block; }
image-slot::part(frame) {
  background-color: var(--c-pink-tint);
  background-image: repeating-linear-gradient(-45deg, transparent 0 11px, rgba(197,100,80,0.14) 11px 22px);
}
image-slot.sage::part(frame) {
  background-color: var(--c-sage-tint);
  background-image: repeating-linear-gradient(-45deg, transparent 0 11px, rgba(76,131,102,0.14) 11px 22px);
}
image-slot::part(empty) {
  color: var(--c-pink-deep);
  font-family: var(--f-ui);
}
image-slot.sage::part(empty) { color: var(--c-sage-deep); }
/* affiliate thumb: fill the flex row, go full-width when stacked */
.ad-aff .aff-img { height: auto; align-self: stretch; }
@media (max-width: 560px) {
  .ad-aff .aff-img { width: 100% !important; height: 150px !important; align-self: auto; }
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--f-ui);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px 28px;
  border-radius: 99px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s, background 0.25s, color 0.25s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary {
  background: var(--c-pink-deep);
  color: #fff;
  box-shadow: 0 6px 18px rgba(197, 100, 80, 0.32);
}
.btn-primary:hover { background: #B0533E; box-shadow: 0 10px 26px rgba(197, 100, 80, 0.42); transform: translateY(-2px); }
/* アフィリエイト（楽天等）ボタン — 全記事・ショートコード共通 */
.hn-rkt-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--c-pink-deep);
  color: #fff;
  border-radius: 8px;
  padding: 10px 24px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  line-height: 1.4;
  transition: background 0.2s ease;
}
.hn-rkt-btn:hover, .hn-rkt-btn:focus { background: #B0533E; color: #fff; }
.hn-rkt-btn svg { stroke: currentColor; }
/* レスポンシブ商品カード（楽天アフィリ）— 画像左・商品名・価格・★レビュー・ボタン */
.product-card {
  display: flex; gap: 16px; align-items: center; max-width: 100%;
  background: #fff; border: 1px solid #EFE7E2; border-radius: 14px;
  padding: 14px 16px; margin: 16px 0;
}
.product-card__img {
  width: 120px; height: 120px; flex-shrink: 0;
  object-fit: contain; background: #FAF8F6; border-radius: 10px;
}
.product-card__body { flex: 1; min-width: 0; }
.product-card__name { font-family: var(--f-ui); font-weight: 700; font-size: 15px; line-height: 1.45; margin: 0 0 4px; color: var(--c-ink); }
.product-card__meta { font-size: 13px; color: var(--c-ink-faint); margin: 0 0 4px; }
.product-card__review { color: #E0A030; font-weight: 600; }
.product-card__price { font-weight: 700; font-size: 16px; color: var(--c-pink-deep); margin: 0 0 10px; }
.product-card__price .note { font-size: 12px; font-weight: 400; color: #999; }
@media (max-width: 560px) {
  .product-card { flex-direction: column; align-items: stretch; }
  .product-card__img { width: 100%; height: auto; aspect-ratio: 1 / 1; max-height: 240px; }
  .product-card__cta .hn-rkt-btn { display: flex; justify-content: center; }
}
/* 比較表 商品名セルのインラインサムネ（比較・選び方系記事の標準） */
.cmp-name { display: flex; align-items: center; gap: 10px; }
.cmp-thumb {
  width: 48px; height: 48px; flex-shrink: 0;
  object-fit: contain; background: #FAF8F6; border: 1px solid #EFE7E2;
  border-radius: 8px;
}
@media (max-width: 560px) { .cmp-thumb { width: 40px; height: 40px; } }
/* 比較表直後の hero カード群の見出し */
.pick-heading {
  font-family: var(--f-ui); font-weight: 700; font-size: 14px;
  letter-spacing: .04em; color: var(--c-pink-deep); margin: 26px 0 6px;
}

/* ============================================================
   Claude Design 改善パターン（1 フローティングCTA / 2 結論ファースト / 3 行内購入ボタン）
   トンマナ：#F2A99A（サーモン）/ #FEFEFE（オフ白）/ #1A1A1A（インク）・明るい基調
   ============================================================ */

/* --- ボタンのゴースト/小サイズ・バリエーション（.hn-rkt-btn 派生） --- */
.hn-rkt-btn--ghost { background: transparent; color: #1A1A1A; border: 1px solid #E4D8D2; box-shadow: none; font-weight: 600; }
.hn-rkt-btn--ghost:hover, .hn-rkt-btn--ghost:focus { background: #FCEEEA; border-color: #F2A99A; color: #C5644F; }
.hn-rkt-btn--sm { padding: 7px 14px; font-size: 12px; gap: 5px; border-radius: 8px; }

/* --- 横幅オーバー対策（SPで記事が横にはみ出す問題・最優先） --- */
html, body { overflow-x: hidden; max-width: 100%; }
img, table, iframe, video, figure { max-width: 100%; }

/* --- 【1/2】スマホ固定フローティングCTAバー（記事ページ・モバイル／スクロールでフェードイン） --- */
.hn-floatbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  max-width: 100%; box-sizing: border-box;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(254,254,254,.97); border-top: 1px solid #EFE7E2;
  box-shadow: 0 -6px 20px rgba(26,26,26,.10);
  transform: translateY(120%); opacity: 0; pointer-events: none;
  transition: transform .32s ease, opacity .32s ease;   /* スムーズなフェード/スライドイン */
}
.hn-floatbar.is-visible { transform: none; opacity: 1; pointer-events: auto; }
.hn-floatbar__btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  background: var(--c-pink-deep); color: #fff; font-family: var(--f-ui); font-weight: 700; font-size: 15px;
  border-radius: 12px; padding: 14px 20px; text-decoration: none;
  box-shadow: 0 6px 16px rgba(242,169,154,.45); transition: background .2s;
}
.hn-floatbar__btn:hover, .hn-floatbar__btn:focus { background: #B0533E; color: #fff; }
@media (min-width: 768px) { .hn-floatbar { display: none !important; } }   /* PCでは出さない */
@media (max-width: 767px) { body.has-floatbar { padding-bottom: 86px; } }  /* バー分の余白 */

/* --- 【2】結論ファーストボックス（[hadanote_verdict]） --- */
.hn-verdict {
  margin: 22px 0; background: #FFFDFC; border: 1px solid #F6D9D1; border-radius: 14px;
  padding: 22px 22px 20px; position: relative; overflow: hidden;
}
.hn-verdict::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c-pink-deep); }
.hn-verdict__label { display: inline-flex; align-items: center; gap: 7px; font-family: var(--f-ui); font-weight: 700; font-size: 12px; letter-spacing: .08em; color: #C5644F; }
.hn-verdict__text { font-family: var(--f-display); font-size: 16px; line-height: 1.7; color: #1A1A1A; margin: 10px 0 0; }
.hn-verdict__text b { background: linear-gradient(transparent 60%, #F8E3DD 60%); font-weight: 700; }
.hn-verdict__reasons { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0 0; }
.hn-verdict__reason { display: inline-flex; align-items: center; gap: 5px; font-family: var(--f-ui); font-size: 12px; font-weight: 600; color: #4C8366; background: #E8F1EC; padding: 5px 11px; border-radius: 99px; }
.hn-verdict__reason::before { content: "✓"; font-weight: 700; }
.hn-verdict__cta { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 0; }
.hn-verdict__note { font-family: var(--f-ui); font-size: 11px; color: #9A8E88; margin: 12px 0 0; }

/* --- 【3】比較表 行内購入ボタン（JSで各行に付与） --- */
.hn-rowbuy { margin-top: 8px; }
.wp-block-table td .hn-rowbuy .hn-rkt-btn { white-space: nowrap; }

/* --- SP（767px以下）調整 --- */
@media (max-width: 767px) {
  /* 【1】比較表：横スクロール（汎用 wp-block-table / 直下table） */
  figure.wp-block-table, .wp-block-table {
    display: block; max-width: 100%;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  figure.wp-block-table > table, .wp-block-table > table { min-width: 540px; }
  /* 自作の比較表（div.wrapで既にスクロール）も保険 */
  figure.wp-block-table > div { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* 【3】結論ボックス：padding/font-size を詰めて崩れ解消 */
  .hn-verdict { padding: 18px 16px 16px; margin: 18px 0; }
  .hn-verdict__text { font-size: 14.5px; line-height: 1.65; }
  .hn-verdict__label { font-size: 11px; }
  .hn-verdict__reason { font-size: 11.5px; padding: 4px 9px; }
  .hn-verdict__cta { gap: 8px; }
  .hn-verdict__cta .hn-rkt-btn { flex: 1 1 100%; justify-content: center; }  /* ボタンは縦積み全幅 */
}

/* --- 本文テキストの右はみ出し防止（長い文字列の折り返し） --- */
.body, .body p, .body li, .body h2, .body h3, .body h4,
.body td, .body th, .body a, .body span {
  overflow-wrap: anywhere; word-break: break-word;
}
@media (max-width: 767px) {
  .wrap { padding-inline: 18px; box-sizing: border-box; }     /* 左右の最小余白を確保 */
  .art-layout, .body { max-width: 100%; min-width: 0; }        /* グリッド項目が幅を超えない */
  .body figure, .body table, .body img,
  .body .product-card, .body .hn-verdict, .body .affiliate-box {
    max-width: 100%; box-sizing: border-box;
  }
  .affiliate-box ul { padding-left: 18px; }                    /* リスト字下げを抑え幅を確保 */
  .affiliate-box li { overflow-wrap: anywhere; }
}

/* ============================================================
   記事デザイン改善（showcase2）: .cmp比較表 / .hn-kpポイントBOX / 著者信頼ボックス
   ============================================================ */
/* 【1】比較表 .cmp（濃紺ヘッダー・本命行ハイライト・行内購入）— JSで付与。inline色を上書き */
.cmp thead th { background: var(--c-ink) !important; color: #fff !important; font-family: var(--f-ui); font-weight: 600; font-size: 12px; letter-spacing: .04em; }
.cmp tr.pick > td { background: var(--c-pink-tint2) !important; }
.cmp .pickflag { display: inline-block; font-size: 9.5px; font-weight: 700; letter-spacing: .06em; color: #fff; background: var(--c-pink-deep); padding: 2px 8px; border-radius: 99px; margin-left: 6px; white-space: nowrap; }

/* 【4】この章のポイント BOX（[hadanote_points]） */
.hn-kp { background: var(--c-sage-tint); border-radius: 14px; padding: 22px 24px; border-left: 3px solid var(--c-sage); margin: 28px 0; }
.hn-kp__h { font-family: var(--f-display); font-weight: 700; font-size: 16px; margin: 0 0 14px; display: flex; align-items: center; gap: 9px; color: var(--c-ink); }
.hn-kp ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 11px; }
.hn-kp li { display: flex; gap: 10px; font-size: 14.5px; line-height: 1.7; color: var(--c-ink); }
.hn-kp li::before { content: "✓"; color: var(--c-sage-deep); font-weight: 700; flex-shrink: 0; }

/* 【5】記事末 著者信頼ボックス */
.hn-author-box { background: var(--c-paper); border: 1px solid var(--c-line); border-radius: 16px; padding: 24px; margin: 48px 0 8px; }
.hn-author-box__top { display: flex; align-items: center; gap: 16px; }
.hn-author-box__av { width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0; object-fit: cover; box-shadow: 0 6px 16px rgba(76,131,102,.18); }
.hn-author-box__name { font-family: var(--f-display); font-weight: 700; font-size: 18px; color: var(--c-ink); }
.hn-author-box__handle { font-family: var(--f-ui); font-size: 11.5px; color: var(--c-ink-faint); margin-top: 3px; }
.hn-author-box__creds { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0 0; }
.hn-author-box__cred { display: inline-flex; align-items: center; gap: 5px; font-family: var(--f-ui); font-size: 11.5px; font-weight: 600; color: var(--c-pink-deep); background: var(--c-pink-tint); padding: 5px 11px; border-radius: 99px; }
.hn-author-box__cred::before { content: "✓"; }
.hn-author-box__bio { font-size: 13.5px; line-height: 1.9; color: var(--c-ink-soft); margin: 16px 0 0; }
.hn-author-box__links { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 0; }
.btn-sage {
  background: var(--c-sage-deep);
  color: #fff;
  box-shadow: 0 6px 18px rgba(76, 131, 102, 0.3);
}
.btn-sage:hover { background: #3E6F54; transform: translateY(-2px); box-shadow: 0 10px 26px rgba(76, 131, 102, 0.4); }
.btn-ghost {
  background: transparent;
  color: var(--c-ink);
  border-color: var(--c-line);
}
.btn-ghost:hover { border-color: var(--c-pink); background: var(--c-pink-tint2); }

/* ---------- Tag / chip ---------- */
.chip {
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--c-sage-deep);
  background: var(--c-sage-tint);
  padding: 4px 11px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.chip.pink { color: var(--c-pink-deep); background: var(--c-pink-tint); }

/* category label inline */
.cat-tag {
  font-family: var(--f-ui);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--c-pink-deep);
}
