/* span の入れ子をやめ意味的なタグへ置換。既定 margin を打ち消す。
   ⚠ <label> の中は phrasing content しか置けないため span のまま。 */
.bsc-coordinate :where(h3, h4, p, ul, ol, figure) { margin: 0; padding: 0; }
.bsc-coordinate :where(ul, ol) { list-style: none; }

/* Block: bigboss/sc-coordinate */
.bsc-coordinate { background: var(--bb-off-white, #f5f5f0); }

.bsc-coord__header { margin-bottom: 40px; }
/* 見出しスタイルは base.css の .sc-heading--sm に受け渡し */
.bsc-coord__desc { font-size: 14px; color: var(--bb-gray); }

/* フィルターバー */
.bsc-coord__filter-bar {
    display: flex; flex-wrap: wrap;
    gap: 8px; margin-bottom: 40px; align-items: center;
}
.bsc-coord__filter-btn {
    font-family: var(--bb-font-mono, monospace);
    font-size: 12px; letter-spacing: .08em;
    padding: 7px 16px; border-radius: 20px;
    border: 1.5px solid var(--bb-border-light, #e4e4e0);
    background: var(--bb-white, #fff); color: var(--bb-gray);
    cursor: pointer; transition: var(--bb-transition);
}
.bsc-coord__filter-btn:hover,
.bsc-coord__filter-btn.active {
    background: var(--bb-ink, #0c0c0c);
    color: var(--bb-on-ink, #fff);
    border-color: var(--bb-ink, #0c0c0c);
}
.bsc-coord__sort-select {
    margin-left: auto;
    font-family: var(--bb-font-mono, monospace);
    font-size: 12px; letter-spacing: .08em;
    padding: 7px 28px 7px 12px;
    border-radius: 6px;
    border: 1.5px solid var(--bb-border-light, #e4e4e0);
    background: var(--bb-white, #fff)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath fill='%23666' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E")
        no-repeat right 2px center;
    color: var(--bb-gray); cursor: pointer;
    -webkit-appearance: none; appearance: none;
}

/* カードグリッド */
.bsc-coord__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;

    @media screen and (min-width: 900px) {
        grid-template-columns: repeat(2, 1fr);
    }

    @media screen and (min-width: 1400px) {
        grid-template-columns: repeat(3, 1fr);
    }
}


/* カード */
.bsc-coord-card {
    background: var(--bb-white, #fff);
    border: 1px solid var(--bb-border-light, #e4e4e0);
    border-radius: var(--bb-radius-lg, 16px);
    overflow: hidden;
    transition: box-shadow var(--bb-transition), transform var(--bb-transition);
}
.bsc-coord-card:hover { box-shadow: 0 16px 48px rgba(0,0,0,.1); transform: translateY(-2px); }

.bsc-coord-card__header {
    background: var(--bb-ink, #0c0c0c);
    padding: 16px 24px;
    display: flex; align-items: center; justify-content: space-between;
}
.bsc-coord-card__staff { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.bsc-coord-card__avatar {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--bb-dark-mid, #2a2a2a); overflow: hidden; flex-shrink: 0;
}
.bsc-coord-card__avatar img { width: 44px; height: 44px; object-fit: cover; border-radius: 50%; display: block; }
.bsc-coord-card__staff-name { font-size: 14px; font-weight: 700; color: var(--bb-on-ink); }
.bsc-coord-card__staff-store { font-size: 12px; color: var(--bb-on-ink-muted); }
.bsc-coord-badge {
    background: var(--bb-accent, #e8547a); color: #fff;
    font-size: 12px; font-weight: 700; padding: 6px 12px;
    border-radius: var(--bb-radius-sm, 4px); flex-shrink: 0;
}

.bsc-coord-card__body { padding: 24px; }
.bsc-coord-card__title { font-size: 14px; font-weight: 700; color: var(--bb-black); margin: 0 0 12px; line-height: 1.4; }

/* 商品画像 */
.bsc-coord-card__image {
    width: 100%; padding-top: 75%;
    border-radius: var(--bb-radius-md, 8px);
    margin-bottom: 16px; overflow: hidden;
    position: relative; cursor: pointer; background: var(--bb-off-white, #f5f5f0);
}
.bsc-coord-card__image img {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block;
}
.bsc-coord-card__cam-icon {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 48px; height: 48px; font-size: 20px;
    background: rgba(255,255,255,.5);
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; pointer-events: none;
}
.bsc-coord-card__image:hover .bsc-coord-card__cam-icon {
    background: var(--bb-accent, #e8547a); color: #fff;
}
.bsc-coord-card__img-placeholder {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: var(--bb-gray, #888); letter-spacing: .1em;
}
.bsc-coord-card__quote {
    /* スタッフの一言。カードの中で読ませたい部分なので太字＋濃い文字色にする。
       ⚠ 色は --bb-black（役割トークン）。テーマが変わっても
          「濃い文字」であることは保たれる。 */
    font-size: 14px;
    font-weight: 700;
    color: var(--bb-black);
    border-left: 2px solid var(--bb-accent, #e8547a);
    padding-left: 12px; margin-bottom: 20px; line-height: 1.7;
}

/* アイテムリスト */
.bsc-coord-items {
    border: 1px solid var(--bb-border-light, #e4e4e0);
    border-radius: var(--bb-radius-md, 8px);
    overflow: hidden; margin-bottom: 20px;
}
.bsc-coord-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--bb-border-light, #e4e4e0);
    transition: background var(--bb-transition); text-decoration: none;
}
.bsc-coord-item:last-child { border-bottom: none; }
.bsc-coord-item:hover { background: var(--bb-off-white, #f5f5f0); }
.bsc-coord-item__icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 26px; border-radius: 3px;
    font-family: var(--bb-font-mono, monospace);
    font-size: 12px; font-weight: 500; flex-shrink: 0;
    letter-spacing: -.1em; line-height: 1; text-align: center;
}
.bsc-coord-item__icon--body { background: #eeebff; color: #5a42b8; }
.bsc-coord-item__icon--amp,
.bsc-coord-item__icon--efx  { background: var(--bb-accent-tint, #fdf0f4); color: var(--bb-accent-dark, #c4325c); }
.bsc-coord-item__icon--set  { background: #fff8e8; color: #9a6200; }
.bsc-coord-item__name {
    flex: 1; font-size: 14px; font-weight: 500; color: var(--bb-black, #0c0c0c);
    min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: inline-flex; align-items: center; gap: 5px;
}
.bsc-coord-item__price { font-family: var(--bb-font-mono, monospace); font-size: 14px; color: var(--bb-accent-dark, #c4325c); flex-shrink: 0; }
.bsc-coord-item__price-regular { display: block; text-decoration: line-through; color: var(--bb-gray-light, #bbb); font-size: 12px; line-height: 1.4; }
.bsc-coord-item__price-sale { display: block; color: var(--bb-accent, #e8547a); font-weight: 700; font-size: 12px; }
.bsc-coord-item__link {
    font-size: 12px; padding: 3px 8px; border-radius: 3px;
    background: #e8f0fb; color: #1a5fa8; font-weight: 500; flex-shrink: 0;
    text-decoration: none; transition: background var(--bb-transition);
}
.bsc-coord-item__link:hover { background: #1a5fa8; color: #fff; }

/* 選択可能アイテム */
.bsc-coord-item--selectable {
    cursor: pointer; border-radius: 6px;
    transition: background .18s, box-shadow .18s;
    margin: 0; position: relative; user-select: none;
}
.bsc-coord-item--selectable:hover { background: rgba(0,0,0,.03); }
.bsc-coord-item__checkbox {
    -webkit-appearance: none; appearance: none;
    width: 16px; height: 16px; min-width: 16px;
    border: 2px solid rgba(0,0,0,.3); border-radius: 3px;
    background: transparent; cursor: pointer; position: relative;
    transition: border-color .18s, background .18s; flex-shrink: 0;
}
.bsc-coord-item__checkbox:checked { border-color: var(--bb-accent, #e8547a); background: var(--bb-accent, #e8547a); }
.bsc-coord-item__checkbox:checked::after {
    content: ''; display: block; width: 9px; height: 5px;
    border-left: 2px solid #fff; border-bottom: 2px solid #fff;
    position: absolute; top: 43%; left: 50%;
    transform: translate(-50%,-50%) rotate(-45deg);
}

/* カメラボタン */
.sc-item-img-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border: none; border-radius: 50%;
    background: color-mix(in srgb, var(--bb-accent) 30%, transparent); color: var(--bb-accent, #e8547a);
    cursor: pointer; font-size: 12px; flex-shrink: 0;
    transition: background .18s, color .18s; padding: 0;
}
.sc-item-img-btn:hover { background: var(--bb-accent, #e8547a); color: #fff; }

/* フッター */
.bsc-coord-card__footer {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 16px; border-top: 1px solid var(--bb-border-light, #e4e4e0);
    gap: 12px; flex-wrap: wrap;
}
.bsc-coord-card__total-label { font-size: 12px; color: var(--bb-gray, #888); font-family: var(--bb-font-mono, monospace); letter-spacing: .06em; margin-bottom: 2px; }
.bsc-coord-card__total-price { font-family: var(--bb-font-display, sans-serif); font-size: 28px; color: var(--bb-accent-dark, #c4325c); letter-spacing: .02em; line-height: 1; }
.bsc-coord-card__total-note { font-size: 12px; color: var(--bb-accent-dark, #c4325c); margin-top: 3px; }
.bsc-coord-note { font-size: 14px; color: var(--bb-gray); text-align: right; margin-top: 8px; display: none; }
.bsc-coord-note.is-visible { display: block; }
.bsc-coord-summary { display: none; font-size: 14px; font-weight: 700; color: var(--bb-black); line-height: 1.5; margin-bottom: 8px; overflow-wrap: break-word; }
.bsc-coord-summary.is-visible { display: block; }

/* 空状態 */
.bsc-coord-card__empty {
    grid-column: 1/-1; text-align: center;
    padding: 60px 20px; color: var(--bb-gray, #888); font-size: 14px;
    border: 1px dashed var(--bb-border-light, #e4e4e0); border-radius: var(--bb-radius-lg, 16px);
}

/* ── 画像モーダル（ブロック内包含） ───────────────── */
.bsc-img-modal {
    display: none;
    position: fixed; inset: 0;
    z-index: 9999;
    align-items: center; justify-content: center;
}
.bsc-img-modal.is-open { display: flex; }
.bsc-img-modal__overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.75); cursor: pointer;
}
.bsc-img-modal__content {
    position: relative; z-index: 1;
    background: #fff; border-radius: 12px; padding: 20px;
    max-width: min(480px, 90vw); width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
    animation: bsc-modal-in .22s ease;
}
@keyframes bsc-modal-in {
    from { opacity: 0; transform: scale(.94); }
    to   { opacity: 1; transform: scale(1); }
}
.bsc-img-modal__close {
    position: absolute; top: 12px; right: 12px;
    width: 32px; height: 32px; border: none; border-radius: 50%;
    background: rgba(0,0,0,.08); color: #333; font-size: 16px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background .18s;
}
.bsc-img-modal__close:hover { background: rgba(0,0,0,.18); }
.bsc-img-modal__img-wrap {
    width: 100%; border-radius: 8px; overflow: hidden; background: #f5f5f5;
}
.bsc-img-modal__img {
    display: block; width: 100%; height: auto;
    max-height: 60vh; object-fit: contain;
}
.bsc-img-modal__name {
    margin-top: 14px; font-size: 14px; font-weight: 600;
    color: #222; text-align: center;
}

/* ── カメラボタン ── */
.bsc-cam-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border: none; border-radius: 50%;
    background: color-mix(in srgb, var(--bb-accent) 30%, transparent); color: var(--bb-accent, #e8547a);
    cursor: pointer; font-size: 12px; flex-shrink: 0;
    transition: background .18s, color .18s; padding: 0;
}
.bsc-cam-btn:hover { background: var(--bb-accent, #e8547a); color: #fff; }


/* 管理画面（ブロックエディタ）では position:fixed の要素を出さない。
   ブロックCSSは編集画面にも注入され、JS は動かないため閉じられず、
   編集画面を覆ってしまう（sc-products-list と同じ方式で統一）。 */
.block-editor-page .bsc-img-modal,
.wp-admin .bsc-img-modal,
body.block-editor-iframe__body .bsc-img-modal {
    display: none !important;
}
