/* Block: bigboss/sc-products-list
 * ============================================================
 * 複数 EC-CUBE カテゴリをリスト表示するセクション
 * --bb-* トークン使用、テーマ非依存
 * カテゴリごとに小見出し + 商品グリッド +「もっと見る」ボタンを表示
 * ============================================================ */

.bsc-products-list {
    background: var(--bb-off-white);
    color: var(--bb-black);
    padding: 0;
}

.bsc-products-list > .bsc-products-list__inner {
    padding-block: 64px;

    @media screen and (min-width: 768px) {
        padding-block: 88px;
    }

    @media screen and (min-width: 1200px) {
        padding-block: 112px;
    }
}


/* ─── Section Header ─────────────────────────────────────── */
.bsc-products-list__header {
    margin-bottom: 48px;

    @media screen and (max-width: 640px) {
        margin-bottom: 32px;
    }
}

/* アイブロウ・見出しスタイルは base.css の .sc-eyebrow-* / .sc-heading に受け渡し */
/* intro スタイルは base.css の .sc-intro に受け渡し（トークン --bb-intro-* 参照）*/

/* ─── Category Block ─────────────────────────────────────── */
.bsc-products-list__category {
    margin-bottom: 64px;
    /* 他ブロックからアンカーで飛んできたとき、固定ヘッダー(.sc-topbar 57px)に
       見出しが隠れないようにする。 */
    scroll-margin-top: 80px;

    @media screen and (max-width: 640px) {
        margin-bottom: 48px;
    }
}

.bsc-products-list__category:last-child {
    margin-bottom: 0;
}

/* ─── Category Header (per category) ─────────────────────── */
.bsc-products-list__cat-header {
    margin-bottom: 24px;
}

.bsc-products-list__subheading {
    /* サイズ/フォントは base.css の .sc-heading--md に受け渡し */
    margin: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--bb-border-light, #e0d5c2);
}

.bsc-products-list__subdesc {
    /* サイズ/カラーは base.css の .sc-intro に受け渡し */
    margin-top: 12px;
}

/* ─── Grid ───────────────────────────────────────────────── */
.bsc-products-list__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 24px;

    @media screen and (max-width: 1024px) {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    @media screen and (max-width: 540px) {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
}


/* ─── Card ───────────────────────────────────────────────── */
.bsc-products-list-card {
    display: flex;
    flex-direction: column;
    background: var(--bb-white, #faf4ea);
    border: 1px solid var(--bb-border-light, #e0d5c2);
    border-radius: var(--bb-radius-sm, 2px);
    overflow: hidden;
    transition: var(--bb-transition);
    text-decoration: none;
    color: inherit;
}

.bsc-products-list-card:hover {
    transform: translateY(-2px);
    border-color: var(--bb-accent);
    box-shadow: 0 12px 32px rgba(139, 90, 60, 0.12);
    text-decoration: none;
    color: inherit;
}

.bsc-products-list-card__media {
    /* NEW バッジを重ねる基準にするため relative。
       （動画カードは別途 relative を持っていたが、通常カードには無かった） */
    position: relative;
    aspect-ratio: 4 / 3;
    background: var(--bb-off-white, #f4ece0);
    overflow: hidden;
}

/* ─── NEW バッジ ──────────────────────────────────────────
   ブロック設定「NEW バッジ」ON のときだけ、登録から N 日以内の商品に出る。
   未設定のページには出力自体がないので、既存ページの見た目は変わらない。 */
.bsc-products-list-card__new {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 1;
    /* 背景は敷かず、赤字だけで示す。
       写真の上に載るため、薄い影で最低限の可読性を確保する。 */
    color: var(--bb-new, red);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;

    pointer-events: none;
    /* 「New Arrival」は「NEW」の約3倍幅。SP の狭いカードで折り返さないようにする */
    white-space: nowrap;

    @media screen and (min-width: 768px) {
        top: 10px;
        left: 10px;
        font-size: 14px;
    }
}

/* 掲載日（新着感を出すため、価格の下に小さく置く） */
.bsc-products-list-card__date {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.4;
opacity: 0.5;
    font-feature-settings: "tnum";
    text-align: right;
}
/* ─── 中古・アウトレットの表示 ────────────────────────────
   ⚠ 新品と同じ見た目で並ぶと、中古であることが伝わらない（2026-08-18 指摘）。
      一点物で状態に差があるため、カードの時点で区別が付く必要がある。
   ⚠ New Arrival（左上・赤文字）とは位置も形も変える。
      同じ左上に置くと、どちらのバッジか読み取れない。
      → 中古は「右上・塗りのラベル」。写真の上でも埋もれない。 */
.bsc-products-list-card__cond {
    /* ⚠ 左上に置かない。ギターのヘッドや New Arrival と重なる（2026-08-18 指示）。
          写真の左中央に置く。ボディの上に載るので、赤の塗りで可読性を確保する。
       ⚠ 位置の基準は .__media（写真の枠）。カード全体を基準にすると
          商品名の高さで上下がずれる。 */
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    z-index: 1;
    padding: 3px 8px;
    border-radius: 0 3px 3px 0;
    /* ⚠ 赤の塗り＋白文字（2026-08-18 指示）。
          New Arrival と同じ赤を使い、「文字だけ＝新着」「塗り＝中古」で区別する。
          写真の上に載るため、塗りにして可読性を確保する。 */
    background: var(--bb-new, red);
    color: #fff;
    font-family: var(--bb-font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    line-height: 1.3;
    pointer-events: none;
    white-space: nowrap;

    @media screen and (min-width: 768px) {
        font-size: 12px;
        padding: 4px 10px;
    }
}

/* 写真そのものも少し落ち着かせ、新品の列と並んでも紛れないようにする。
   ⚠ 暗くしすぎない。状態を見たい商品なので、写真の情報量は残す。 */
.bsc-products-list-card--used .bsc-products-list-card__media img,
.bsc-products-list-card--outlet .bsc-products-list-card__media img {
    filter: saturate(.92);
}

/* 価格の隣に「中古」と日本語でも添える（英字ラベルだけだと読み飛ばされるため） */
.bsc-products-list-card--used .bsc-products-list-card__price::after {
    content: '（中古）';
    margin-left: 4px;
    font-size: 11px;
    font-weight: 400;
    color: var(--bb-on-ink-muted);
}

.bsc-products-list-card--outlet .bsc-products-list-card__price::after {
    content: '（アウトレット）';
    margin-left: 4px;
    font-size: 11px;
    font-weight: 400;
    color: var(--bb-on-ink-muted);
}


/* NEW の期間内は掲載日も赤にして、バッジと呼応させる */
/* .bsc-products-list-card--new .bsc-products-list-card__date {
    color: var(--bb-new, red);
} */

.bsc-products-list-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bsc-products-list-card__media-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bb-off-white) 0%, var(--bb-border-light) 100%);
}

.bsc-products-list-card__body {
    padding: 14px 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bsc-products-list-card__title {
    font-size: 14px;
    line-height: 1.45;
    font-weight: 500;
    color: var(--bb-black);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* 商品名には「(PRS/ポールリードスミス)」「S/N CTI I010149」等、
       途中で改行できない長い半角連結が入る。320px で clientWidth を超えて
       はみ出す個体があったため折り返しを許可する（実測: sw=119 / cw=104）。 */
    overflow-wrap: break-word;
}

.bsc-products-list-card__price {
    margin-top: 4px;
    font-family: var(--bb-font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--bb-accent-dark);
}

/* ─── More link (per category) ───────────────────────────── */
/* ボタンは base.css の .sc-btn / .sc-btn--dark を使用 */
.bsc-products-list__more {
    text-align: center;
    margin-top: 24px;
}

/* ─── Empty state ────────────────────────────────────────── */
.bsc-products-list__empty {
    text-align: center;
    padding: 48px 20px;
    border: 1px dashed var(--bb-border-light, #e0d5c2);
    border-radius: var(--bb-radius-sm);
    color: var(--bb-intro-color);
}

.bsc-products-list__empty p {
    margin: 0 0 16px;
    font-size: 14px;
}

/* ─── Responsive ─────────────────────────────────────────── */


/* ─── 動画カード（任意・カテゴリに動画を設定したときだけ出る）─────
 * 商品カードとまったく同じ寸法（.bsc-products-list-card を継承）。
 * クリックでモーダル再生。ページ読み込み時に YouTube は読まない。
 * ──────────────────────────────────────────────────────────── */
.bsc-products-list-card--video {
    padding: 0;
    font: inherit;
    text-align: left;
    cursor: pointer;
    appearance: none;
}

.bsc-products-list-card--video .bsc-products-list-card__media {
    position: relative;
    background: #000;
}

.bsc-products-list-card--video .bsc-products-list-card__media img {
    opacity: 0.88;
    transition: opacity 0.2s ease;
}

.bsc-products-list-card--video:hover .bsc-products-list-card__media img {
    opacity: 1;
}

/* 再生ボタン（画像1枚も足さない CSS だけの三角）*/
.bsc-products-list-card__play {
    position: absolute;
    inset: 50% auto auto 50%;
    translate: -50% -50%;
    width: 48px;
    height: 34px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.72);
    transition: background 0.2s ease;

    @media screen and (min-width: 768px) {
        width: 56px;
        height: 39px;
    }
}

.bsc-products-list-card__play::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    translate: -40% -50%;
    border-style: solid;
    border-width: 7px 0 7px 12px;
    border-color: transparent transparent transparent #fff;
}

.bsc-products-list-card--video:hover .bsc-products-list-card__play {
    background: rgba(232, 84, 122, 0.92);
}

.bsc-products-list-card__badge {
    align-self: flex-start;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.5;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--bb-black);
    color: var(--bb-white);
}

/* ─── 動画モーダル（1ページに1つ）───────────────────────── */
body.bsc-video-modal-open {
    overflow: hidden;
}

.bsc-video-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;

    @media screen and (min-width: 768px) {
        padding: 32px;
    }
}

/* ⚠ [hidden] は必ず display:flex に勝たせる。
   ブロックエディタは CSS の読み込み順が異なり、!important 無しだと
   モーダルが開きっぱなしに見える事故が起きた（2026-07-31）。 */
.bsc-video-modal[hidden] {
    display: none !important;
}

/* 管理画面（ブロックエディタ）ではモーダル自体を出さない。
   JS が動かないため閉じられず、編集画面を覆ってしまう。 */
.block-editor-page .bsc-video-modal,
.wp-admin .bsc-video-modal,
body.block-editor-iframe__body .bsc-video-modal {
    display: none !important;
}

.bsc-video-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
}

.bsc-video-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 1100px;
}

.bsc-video-modal__frame {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--bb-radius-md, 8px);
    overflow: hidden;
}

.bsc-video-modal__frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.bsc-video-modal__title {
    margin: 10px 0 0;
    font-size: 14px;
    line-height: 1.7;
    color: #fff;

    @media screen and (min-width: 768px) {
        font-size: 14px;
    }
}

.bsc-video-modal__close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;

    @media screen and (min-width: 768px) {
        top: -44px;
        width: 40px;
        height: 40px;
    }
}

.bsc-video-modal__close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ═══════════════════════════════════════════════════════════
   レイアウト「左右分割」（bsc_pl_layout = split）
   店舗企画など、在庫一覧と違う見え方にしたいとき用。
   見出しと商品を左右に分け、2件目・4件目… は左右を反転させて
   同じ形の繰り返しに見えないようにする。
   ⚠ 既定は grid。--split 配下だけに書き、在庫一覧に影響させない。
   ═══════════════════════════════════════════════════════════ */
.bsc-products-list--split .bsc-products-list__category {
    display: grid;
    grid-template-columns: 1fr;      /* SP は縦積み */
    gap: 20px;
    align-items: start;

    @media screen and (min-width: 768px) {
        grid-template-columns: 34% minmax(0, 1fr);
        gap: 32px;
    }

    /* 2件目・4件目… は左右を入れ替える（クラスは render.php が付ける）
       ⚠ order で入れ替えない。grid は order を見てから左上→右下へ自動配置するため、
          「もっと見る」が2列目に入り、見出しが次の行へ押し出される（2026-08-12 実測）。
          どの列に置くかは grid-column で明示する。 */
    & .bsc-products-list__cat-header {
        @media screen and (min-width: 768px) {
            grid-column: 1;
            grid-row: 1 / span 2;
        }
    }

    & .bsc-products-list__grid,
    & .bsc-products-list__more {
        @media screen and (min-width: 768px) {
            grid-column: 2;
        }
    }

    &.is-reversed {
        @media screen and (min-width: 768px) {
            grid-template-columns: minmax(0, 1fr) 34%;

            & .bsc-products-list__cat-header {
                grid-column: 2;
            }

            & .bsc-products-list__grid,
            & .bsc-products-list__more {
                grid-column: 1;
            }
        }
    }
}

/* 見出し側 */
/* ⚠ 余白は一律の gap で済ませない。要素の関係で決める。
      画像は独立した塊なので見出しから離し、見出しと説明文は一体なので近づける。
      2026-08-12 まで gap:12px 一律で、画像→見出し 12px・見出し→説明 24px と
      近さの関係が逆転していた（画像とタイトルがくっついて見える）。 */
.bsc-products-list--split .bsc-products-list__cat-header {
    display: flex;
    flex-direction: column;
    gap: 14px;          /* 見出し ↔ 説明文。一体なので近く */
    min-width: 0;

    /* ⚠ 企画名は「Dr.住吉オススメ!! E-IIの魅力（広島店）」のように
       英数字と記号が続き、既定では折り返せず数px はみ出す（390px で実測）。
       単語の途中でも折り返してよい。 */
    & .bsc-products-list__subheading {
        /* ⚠ keep-all にしない。「E-IIの魅力」で E- / II に分断される（実測）。 */
        word-break: normal;
        overflow-wrap: break-word;
    }

    @media screen and (min-width: 768px) {
        position: sticky;   /* 商品を追う間も見出しが残る */
        top: 24px;
        align-self: start;  /* セルの高さに引き伸ばされないようにする */
    }
}

/* ⚠ 素材の比率が揃わない（実測 1.33 / 1.78 / 1.33）。
      height:auto のままだと見出しの高さが企画ごとにバラつくので、
      16:9 に固定して cover で切り抜く。 */
.bsc-products-list--split .bsc-products-list__cat-image {
    /* 画像だけは下に大きく空ける。見出しの一部ではなく独立したビジュアルなので、
       ここが詰まると窮屈に見える。 */
    margin: 0 0 24px;
    overflow: hidden;
    border-radius: var(--bb-radius-md);

    @media screen and (min-width: 768px) {
        margin-bottom: 28px;
    }

    /* ⚠ 縦長のカタログ写真（500×1750 など）を 16/9 で切ると、
          ボディが切れてネックだけが映る（2026-08-19 実測）。
          縦長は「全体を収める」、横長は従来どおり 16/9 で切る。
          判定は CMS 側で持たず、画像の向きに応じた指定を1つ足すだけにする。 */
    &.is-portrait img {
        aspect-ratio: auto;
        max-height: 420px;
        width: auto;
        margin-inline: auto;
        object-fit: contain;
    }

    & img {
        display: block;
        width: 100%;
        aspect-ratio: 16 / 9;
        object-fit: cover;
    }
}

/* 商品側。
   ⚠ 2列だとカードが大きすぎて（1280px でカード幅384px）、4件が2行になり
      見出しの下に 467px の空白ができる（2026-08-11 実測）。
      3列に増やしてカードを約30%小さくし、行数と余白を減らす。 */
.bsc-products-list--split .bsc-products-list__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));

    @media screen and (min-width: 768px) {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px;
    }
}

/* ⚠ 商品名は読ませる本文。密度のために small(12px) にしない（2026-08-12 是正）。
      「カードを30%小さく」の指示はカードの寸法の話で、文字を小さくしろではなかった。 */
.bsc-products-list--split .bsc-products-list-card__title {
    font-size: 14px;
    line-height: 1.6;
}

.bsc-products-list--split .bsc-products-list-card__price {
    font-size: 14px;
}


/* ── 即納可能／試奏可能（見出し直下のタグ）───────────────
   売上の90.4%が即納なので「今すぐ手に入るか」に見出し直下で答える。
   ⚠ 見た目は pr-ladder のタグに合わせる（同じページ内で作法を揃えるため）。
   ⚠ 色は役割トークンを使う。地の明暗はテーマで反転するため固定色にしない。 */
.bsc-products-list__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;

    @media screen and (min-width: 1024px) {
        margin-top: 20px;
    }
}
/* ⚠ .pr-block を付ける。base.css の `.pr-block :where(p, li, …){font-size:16px}` と
      詳細度が同点(0,1,0)で、後に読まれる base.css に負けて PC で 16px になるため。 */
.pr-block .bsc-products-list__fact {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: var(--bb-radius-sm);
    color: var(--bb-on-ink);
    font-size: 12px;               /* 補助情報。PC でも拡大しない */
    font-weight: 500;
    white-space: nowrap;
}
.pr-block .bsc-products-list__fact strong {
    font-weight: 700;
    color: var(--bb-accent);
    margin: 0 1px;
}


/* 「試奏可能」タグの注釈（セクションに1回だけ）*/
/* ⚠ 同上。p なので .pr-block を付けないと PC で 16px に上書きされる。 */
.pr-block .bsc-products-list__tryout-note {
    margin: 12px 0 0;
    /* ⚠ 規約の下限 12px に対する【例外】。2026-08-12 にユーザー指示で 11px。
       対象はこの注釈1行だけ。他へ広げない（12px は下限であって標準ではない）。
       10px は本文 14px との比率が小さすぎ SP 実機で判読が落ちるため採らない。 */
    font-size: 11px;               /* PC でも拡大しない */
    line-height: 1.7;
    color: var(--bb-on-ink-muted);
}

/* 注釈番号
   ⚠ sup は既定で font-size:smaller が効き、12px のタグ内で 9px 程度まで落ちて読めない。
      サイズを明示し、位置だけ上げる。 */
.bsc-products-list__fact-ref {
    font-size: 12px;
    line-height: 0;
    vertical-align: super;
    margin-left: 2px;
    color: var(--bb-on-ink-muted);
}
.bsc-products-list__tryout-ref {
    margin-right: 4px;
}
/* ⚠ sup の既定 font-size:smaller に任せない。12px の注釈内では 9px 程度まで落ちて読めない。 */
.bsc-products-list__tryout-ref sup {
    font-size: 11px;               /* 親（注釈）に合わせる */
    line-height: 0;
    vertical-align: super;
}

/* ─── バッジ帯（写真の下端・横書き）──────────────────────
   コラボやアーティストモデルなど、ひと目で区別したい区分に付ける。
   ⚠ 文言・色は CMS（区分ごとの設定）から来る。ここでは形だけを決める。
   ⚠ 当初は左端の縦書きで実装したが、幅が狭く読み取れなかったため
      写真の下端に横書きで敷く形にした（2026-08-18 指示）。 */
.bsc-products-list-card__ribbon {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;

    padding: 0.5rem;
    box-sizing: border-box;
    text-align: center;

    background: var(--bb-accent);
    color: var(--bb-on-accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    line-height: 1.2;

    /* ⚠ 長い文言でも高さが伸びないよう1行に収め、あふれは省略記号にする */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}
