/* スタジオ比較表 */
.studio-hikaku {
  margin: 2em 0;
}

/* ---------- ボタンを横並びにする ----------
   絞り込み群・並び替え群は wp-block-group でまとまっている。
   その group を flex(nowrap) にして、どの端末幅でも改行させない。
   収まらない狭小端末のみ横スクロールに逃がす。 */
.studio-hikaku .wp-block-group.u-mb-ctrl.u-mb-10 {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

.studio-hikaku .swell-block-button {
  display: inline-flex !important;
  width: auto !important;
  flex: 0 0 auto !important;
  margin: 0 4px 0 0 !important;
  vertical-align: top;
}

/* ボタンの押下(アクティブ)状態：塗りつぶしで表現(枠線のfilterは使わない) */
.studio-hikaku .swell-block-button.sh-active .swell-block-button__link,
.studio-hikaku .sh-active .swell-block-button__link {
  background-color: var(--color_main, #f47c7c) !important;
  color: #fff !important;
  border-color: var(--color_main, #f47c7c) !important;
  filter: none !important;
  outline: none !important;
}

/* クリックで先頭へ飛ばないよう、リンクはカーソルだけポインタに。
   改行させず、幅に応じてフォントを縮める(狭小端末は縮小／大画面は上限14px)。 */
.studio-hikaku .swell-block-button__link {
  cursor: pointer;
  padding: 3px 6px !important;
  min-height: auto !important;
  white-space: nowrap !important;
  font-size: clamp(8px, 5vw - 8.5px, 14px) !important;
}

/* ---------- テーブル ----------
   テーブルの体裁(横スクロール・幅固定列・罫線・ヘッダー色)は
   SWELL標準のスクロールテーブル(figureのdata-table-scrollable等 + tableのstyle変数)で
   再現しているため、自前定義は持たない。 */

/* 一覧性向上のための縮小(マイベスト基準)：
   フォントと行高・パディングを詰めてセル高さを圧縮させる。 */
.studio-hikaku table th,
.studio-hikaku table td {
  font-size: 11px !important;
  line-height: 1.35 !important;
  padding: 3px 5px !important;
  vertical-align: middle !important;
}

/* 公式サイトセル内の画像(アフィリエイト計測タグ等) */
.studio-hikaku .sh-link img {
  max-width: 100%;
  height: auto;
}

/* スタジオ名のセル内テキストのリンク */
.studio-hikaku .sh-name__link {
  text-decoration: underline;
}

/* 順位バッジ(スタジオ名先頭)。1〜3位は金/銀/銅の丸、4位以降は数字のみ。 */
.studio-hikaku .sh-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  margin-right: 4px;
  vertical-align: middle;
  color: #fff;
  background: #bbb;
}
.studio-hikaku .sh-rank--1 { background: #f2b50d; }
.studio-hikaku .sh-rank--2 { background: #738c8c; }
.studio-hikaku .sh-rank--3 { background: #b36b4d; }
.studio-hikaku .sh-rank--n { background: transparent; color: #333; }

/* 絞り込みで非表示(DOMには残す)。
   table にクラスが付かないSWELL標準テーブルでも効くよう、ラッパ基準で指定する。 */
.studio-hikaku tr.is-hidden {
  display: none;
}

/* 画像列(縮小後は60px) */
.studio-hikaku .sh-image img {
  width: 60px !important;
  max-width: 60px !important;
  height: auto !important;
  display: block !important;
}
.studio-hikaku .sh-image .p-blogParts,
.studio-hikaku .sh-image figure,
.studio-hikaku .sh-image figure a {
  line-height: 0 !important;
  margin: 0 !important;
}
.studio-hikaku .sh-image figcaption {
  display: none !important;
}
.studio-hikaku .sh-image img[width="1"],
.studio-hikaku .sh-image img[height="1"] {
  display: none !important;
}

/* 公式サイト ボタン(テーブルセル内)。
   既定は白背景。アフィリエイトリンクのみ緑(#62D847)に上書き。中央寄せで統一。 */
.studio-hikaku .sh-link {
  text-align: center !important;
  vertical-align: middle !important;
}
.studio-hikaku .sh-link__btn {
  display: inline-block;
  padding: 2px 6px;
  background-color: #fff;
  color: #333 !important;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  text-decoration: none !important;
  white-space: nowrap;
  line-height: 1.4;
  margin: 0;
  vertical-align: middle;
}

/* アフィリエイト(ASPドメイン)は緑背景 */
.studio-hikaku .sh-link__btn[href*="afi-b.com"],
.studio-hikaku .sh-link__btn[href*="moshimo.com"],
.studio-hikaku .sh-link__btn[href*="a8.net"],
.studio-hikaku .sh-link__btn[href*="accesstrade"],
.studio-hikaku .sh-link__btn[href*="valuecommerce"],
.studio-hikaku .sh-link__btn[href*="felmat"] {
  background-color: #62D847;
  color: #fff !important;
  border-color: #62D847;
}
.studio-hikaku .sh-link__btn:hover {
  filter: brightness(0.95);
}

/* 公式サイトセル内の1×1計測ピクセルは画面外へ(中央寄せの邪魔をしない) */
.studio-hikaku .sh-link img[width="1"],
.studio-hikaku .sh-link img[height="1"] {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
}

.studio-hikaku .sh-trial,
.studio-hikaku .sh-male {
  text-align: center;
}

.studio-hikaku thead th {
  white-space: nowrap;
}

/* ---------- もっと見る（折りたたみ） ----------
   SWELL標準スクロールテーブル(figure)の overflow には触らず、
   外側ラッパ(.sh-collapse)で縦方向だけを制御する。
   これで横スクロール(figureのoverflow-x:scroll)と1列目固定(sticky z-index:3)を壊さない。 */
.studio-hikaku .sh-collapse {
  position: relative;
}

/* 折りたたみ時：7行目途中で切る（行高が変わったら max-height を調整） */
.studio-hikaku .sh-collapse.is-collapsed {
  max-height: 563px;
  overflow: hidden;
}
.studio-hikaku .sh-collapse.is-collapsed figure {
  margin-bottom: 0;
}

/* フェード(グラデーション)。z-index:4 で1列目固定セル(z-index:3)より前面に出し、
   店舗名(1列目)を含む全列にグラデーションをかける */
.studio-hikaku .sh-collapse.is-collapsed::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 5em;
  width: 100%;
  height: 4em;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(hsla(0, 0%, 100%, 0), var(--color_bg, #fff));
}
/* フェード下部のベタ塗り */
.studio-hikaku .sh-collapse.is-collapsed::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 5em;
  z-index: 4;
  background: var(--color_bg, #fff);
  opacity: .85;
}

/* 「もっと見る」ボタン：コンテンツ上にオーバーレイ */
.studio-hikaku .sh-more {
  position: absolute;
  left: 50%;
  bottom: .6em;
  transform: translateX(-50%);
  z-index: 5;
  display: block;
  min-width: 8em;
  padding: .5em 1.2em;
  font-size: 13px;
  line-height: 1.5;
  color: #333;
  background: #f7f7f7;
  border: 1px solid rgba(0, 0, 0, .2);
  border-radius: 5em;
  box-shadow: 0 0 0 1px #bbb;
  cursor: pointer;
}
.studio-hikaku .sh-more:hover {
  box-shadow: 0 0 0 2px #bbb;
}

/* 展開時：全行表示。フェードを消し、ボタンを通常配置に戻す */
.studio-hikaku .sh-collapse.is-expanded {
  max-height: none;
  overflow: visible;
}
.studio-hikaku .sh-collapse.is-expanded::before,
.studio-hikaku .sh-collapse.is-expanded::after {
  display: none;
}
.studio-hikaku .sh-collapse.is-expanded .sh-more {
  position: static;
  transform: none;
  margin: .75em auto 0;
}