/* クセ強CMラボ 商品ハブ — ブランド色はここ（:root）だけで調整できます */
:root {
  --bg: #F6F1E7;        /* 紙っぽいオフホワイト */
  --paper: #FFFDF8;     /* カード */
  --ink: #1E1B17;       /* 墨 */
  --sub: #6A6157;       /* 補助文字 */
  --yellow: #FFD23F;    /* メイン（ボタン・ロゴ） */
  --red: #E8452C;       /* 差し色（第N弾スタンプ） */
  --line: 2px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);
  --radius: 18px;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans CJK JP",
          "Yu Gothic UI", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", "Noto Serif CJK JP", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  /* 背景にうっすら方眼（ラボ感） */
  background-image:
    linear-gradient(rgba(30,27,23,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30,27,23,.045) 1px, transparent 1px);
  background-size: 24px 24px;
}
img { max-width: 100%; display: block; }
/* サイト自身のリンクだけ。発行HTML内のリンクには効かせない */
.foot-nav a, .back { color: inherit; }
h1, h2, h3, p { margin: 0; }

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}

/* ---------- ヘッダー ---------- */
.hero {
  text-align: center;
  padding: 22px 0 20px;
}
.logo {
  width: 60px; height: 60px;
  margin: 0 auto 8px;
  transform: rotate(-6deg);
}
.title {
  font-size: clamp(32px, 9.4vw, 46px);
  font-weight: 900;
  letter-spacing: .02em;
  line-height: 1.15;
}
.t-kuse {
  background: linear-gradient(transparent 58%, var(--yellow) 58%, var(--yellow) 92%, transparent 92%);
  padding: 0 .06em;
}
.t-tsuyo {
  display: inline-block;
  transform: rotate(9deg) translateY(-.04em);
  color: var(--red);
}
.lead {
  margin-top: 10px;
  font-size: 14px;
  color: var(--sub);
  line-height: 1.75;
}

/* ---------- 一覧見出し ---------- */
.sec-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: var(--line);
}
.sec-head h2 {
  font-size: 21px;
  font-weight: 900;
  line-height: 1.35;
}
.sec-meta {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 2px;
  font-size: 12px;
  color: var(--sub);
  white-space: nowrap;
}
.sec-meta #product-count { font-weight: 700; color: var(--ink); font-size: 13px; }
.pr::before { content: "PR｜"; }
.sp { display: inline; }

/* カテゴリ切り替え（商品が増えると自動表示） */
.filter {
  display: flex; gap: 8px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 2px 2px 12px;
  margin: 0 -2px;
  scrollbar-width: none;
}
.filter::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  font: inherit; font-size: 14px; font-weight: 700;
  color: var(--ink);
  background: var(--paper);
  border: var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  min-height: 40px;
  cursor: pointer;
}
.chip.is-on { background: var(--ink); color: var(--paper); }

/* ---------- カード ---------- */
.cards {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  gap: 18px;
}
.card {
  background: var(--paper);
  border: var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-columns: 112px 1fr;
}
.media {
  position: relative;
  background: #D8CBB6;
  border-right: var(--line);
  min-height: 100%;
}
/* 自作画像（image）だけを枠に合わせてトリミング。アフィリエイト画像（.embed 内）には効かない */
.media > img { width: 100%; height: 100%; object-fit: cover; }
.media-note {
  position: absolute; right: 8px; bottom: 8px;
  font-size: 10px; line-height: 1;
  padding: 4px 6px;
  border-radius: 4px;
  background: rgba(255,253,248,.82);
  color: var(--sub);
}
.ph {
  height: 100%; min-height: 112px;
  display: grid; place-items: center;
  background:
    repeating-linear-gradient(45deg, rgba(30,27,23,.07) 0 8px, transparent 8px 16px),
    #EDE4D3;
  color: var(--sub);
  font-size: 12px; font-weight: 700;
}
.body { padding: 14px 14px 16px; min-width: 0; }

.tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.no {
  display: inline-block;
  font-size: 12px; font-weight: 900; letter-spacing: .04em;
  color: var(--paper);
  background: var(--red);
  border: var(--line);
  border-radius: 6px;
  padding: 1px 7px;
  transform: rotate(-4deg);
}
.cat {
  font-size: 12px; font-weight: 700;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 1px 9px;
}
.new {
  font-size: 11px; font-weight: 900; letter-spacing: .08em;
  color: var(--ink);
}
.new::before { content: "● "; color: var(--red); }

.name {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.copy {
  margin-top: 6px;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.6;
  color: #3A342D;
}

.action { margin-top: 12px; }
.cta {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px;
  padding: 10px 16px;
  background: var(--yellow);
  color: var(--ink);
  border: var(--line);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 17px; font-weight: 900; letter-spacing: .04em;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform .08s, box-shadow .08s;
}
a.cta:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
@media (hover: hover) { a.cta:hover { background: #FFC61A; } }
.cta-arrow { font-size: 18px; line-height: 1; }
.cta.is-pending {
  background: #FBEBB0;
  color: #5E564C;
  border-style: dashed;
  border-color: #7A7166;
  box-shadow: none;
  cursor: not-allowed;
}
.cta-soon {
  font-size: 11px; font-weight: 700; letter-spacing: 0;
  background: var(--paper);
  border: 1.5px solid #7A7166;
  border-radius: 999px;
  padding: 1px 8px;
}
.cta-note {
  margin-top: 7px;
  font-size: 11px;
  color: var(--sub);
  text-align: center;
}

/* 2件目以降：サムネイル付きのコンパクトな行（30件あっても長くなりすぎない） */
.card:not(.is-latest) { grid-template-columns: 96px 1fr; align-items: start; }
.card:not(.is-latest) .media {
  margin: 14px 0 0 14px;
  aspect-ratio: 1 / 1;
  min-height: 0;
  border: var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.card:not(.is-latest) .ph { min-height: 0; font-size: 11px; }
.card:not(.is-latest) .media-note { right: 4px; bottom: 4px; font-size: 9px; padding: 3px 4px; }
.card:not(.is-latest) .body { padding: 12px 14px 14px 12px; }
.card:not(.is-latest) .name {
  font-size: 15px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.card:not(.is-latest) .copy {
  font-size: 14px; margin-top: 4px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.card:not(.is-latest) .action { margin-top: 10px; }
.card:not(.is-latest) .cta { min-height: 46px; font-size: 15px; padding: 8px 12px; box-shadow: 2px 2px 0 var(--ink); }
.card:not(.is-latest) .cta-soon { display: none; }
.card:not(.is-latest) .cta-note { font-size: 10.5px; margin-top: 5px; }

/* ---------- 画像付きアフィリエイトリンク（affiliateEmbedHtml） ----------
   発行されたHTMLは書き換えず、CSSで「はみ出さない・縮小のみ・縦横比は自然なまま」にする */
.media.is-embed {
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: #fff;
  aspect-ratio: auto;
  min-height: 0;
  overflow: hidden;
}
.embed {
  max-width: 100%;
  min-width: 0;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  overflow-wrap: anywhere;
}
/* サイト全体の border-box を発行HTMLには持ち込まない（width と padding の指定どおりに表示） */
.embed, .embed *, .embed *::before, .embed *::after,
.cta-html *, .cta-html *::before, .cta-html *::after { box-sizing: content-box; }
.embed img, .cta-html img {
  max-width: 100% !important;   /* インラインの width 指定より優先して縮小 */
  height: auto !important;      /* 縦横比を保つ */
  display: inline-block;
  vertical-align: middle;
}
.embed table {
  max-width: 100% !important;
  table-layout: auto;
  margin: 0 auto;
}
.embed div, .embed td, .embed p, .embed iframe,
.cta-html table, .cta-html div, .cta-html td, .cta-html p, .cta-html iframe { max-width: 100% !important; }

/* affiliateCtaHtml（正式発行のテキストリンク等）を入れる外枠。中身のHTMLには手を加えない */
.cta-html {
  max-width: 100%;
  overflow: hidden;
  padding: 14px 16px;
  border: var(--line);
  border-radius: 14px;
  background: #FFF7D6;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.card:not(.is-latest) .cta-html { padding: 10px 12px; font-size: 15px; }
.embed-note { margin-top: 0; }

.card.has-embed:not(.is-latest) { grid-template-columns: 1fr; }
.card.has-embed:not(.is-latest) .media {
  margin: 14px 14px 0;
  aspect-ratio: auto;
  border-width: 1.5px;
}
.card.has-embed:not(.is-latest) .media.is-embed { padding: 12px; }
.card.has-embed:not(.is-latest) .embed img { max-height: 240px; width: auto !important; }
.card.has-embed:not(.is-latest) .body { padding: 12px 14px 14px; }

/* 最新のCM（いちばん上）は大きく */
.card.is-latest { grid-template-columns: 1fr; }
.card.is-latest .media { border-right: 0; border-bottom: var(--line); aspect-ratio: 16 / 10; }
.card.is-latest .ph { min-height: 0; }
.card.is-latest .media.is-embed { aspect-ratio: auto; padding: 20px 16px; }
.card.is-latest .body { padding: 14px 16px 18px; }
.card.is-latest .name { font-size: 19px; }
.card.is-latest .copy { font-size: 18px; margin-top: 6px; }
.card.is-latest .action { margin-top: 14px; }
.card.is-latest .cta { min-height: 58px; font-size: 18px; }

.empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--sub);
  border: 2px dashed #B9AE9F;
  border-radius: var(--radius);
}

/* ---------- フッター ---------- */
.foot {
  margin-top: 44px;
  padding: 22px 0 calc(28px + env(safe-area-inset-bottom));
  border-top: var(--line);
  text-align: center;
  font-size: 13px;
  color: var(--sub);
}
.disclosure { font-weight: 700; color: var(--ink); }
.foot-nav {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 4px 18px;
  margin-top: 12px;
}
.foot-nav a { padding: 6px 0; text-underline-offset: 3px; }
.copyright { margin-top: 12px; font-size: 12px; }

/* ---------- 下層ページ（about.html） ---------- */
.page-head { padding: 24px 0 8px; }
.back { display: inline-block; padding: 8px 0; font-size: 14px; font-weight: 700; text-decoration: none; }
.page-head h1 { margin-top: 8px; font-size: 24px; font-weight: 900; }
.doc { display: grid; gap: 16px; margin-top: 16px; }
.doc section {
  background: var(--paper);
  border: var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 20px;
  scroll-margin-top: 16px;
}
.doc h2 { font-size: 18px; font-weight: 900; margin-bottom: 8px; }
.doc p, .doc li { font-size: 15px; }
.doc p + p { margin-top: 8px; }
.doc ul { margin: 6px 0 0; padding-left: 1.2em; }
.doc dl { margin: 0; display: grid; grid-template-columns: 6.5em 1fr; gap: 6px 10px; font-size: 15px; }
.doc dt { font-weight: 700; color: var(--sub); }
.doc dd { margin: 0; }
.doc .date { margin-top: 12px; font-size: 13px; color: var(--sub); }

/* ---------- PC・タブレット ---------- */
@media (min-width: 560px) {
  .sp { display: none; }
  .card:not(.is-latest) { grid-template-columns: 120px 1fr; }
}
@media (min-width: 760px) {
  .hero { padding: 48px 0 36px; }
  .logo { width: 76px; height: 76px; }
  .lead { font-size: 16px; }
  .lead br { display: none; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 22px; }
  .card, .card:not(.is-latest) { grid-template-columns: 1fr; }
  .card .media, .card:not(.is-latest) .media {
    margin: 0; border: 0; border-radius: 0; border-bottom: var(--line); aspect-ratio: 4 / 3;
  }
  .card:not(.is-latest) .body { padding: 14px 16px 16px; }
  .card .ph { min-height: 0; }
  /* 最新は横長で2列ぶち抜き */
  .card.is-latest { grid-column: 1 / -1; grid-template-columns: 1.15fr 1fr; }
  .card.is-latest .media { aspect-ratio: auto; border-bottom: 0; border-right: var(--line); min-height: 340px; }
  .card.is-latest .body { display: flex; flex-direction: column; justify-content: center; padding: 28px; }
  .card.is-latest .name { font-size: 22px; }
  .card.is-latest .copy { font-size: 21px; }
  /* アフィリエイト画像は 4:3 に固定しない */
  .card.has-embed:not(.is-latest) .media {
    margin: 0; border: 0; border-radius: 0; border-bottom: var(--line);
    aspect-ratio: auto; min-height: 220px;
  }
  .card.has-embed:not(.is-latest) .media.is-embed { padding: 16px; }
}
@media (min-width: 960px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .cta { transition: none; } }
