/**
 * かねよ 購入ボタン
 *
 * テーマは全要素の margin・padding を 0 にし（style.css の `*`）、画像に左右の自動余白を付け（style.css:1708）、
 * リンクのフォーカス枠を消している（style.css の `a { outline: none }`）。ここではそれらを必要な分だけ指定し直す。
 */

/* 画面下のボタン。右下のページトップボタン（幅 96px）と重ならないよう、狭い画面では左に寄せる */
.kaneyo-bp__open {
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    z-index: 1000;
    margin: 0;
    padding: 12px 28px;
    border: 0;
    border-radius: 999px;
    background: #800000;
    color: #fff;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transform: translateX(-50%);
}

.kaneyo-bp__open[hidden] {
    display: none;
}

.kaneyo-bp__open:hover {
    background: #a72126;
}

.kaneyo-bp__open:focus-visible {
    outline: 3px solid #1a73e8;
    outline-offset: 3px;
}

@media (max-width: 420px) {
    .kaneyo-bp__open {
        left: 16px;
        transform: none;
    }
}

/* 一覧を開いている間は、後ろのページをスクロールさせない */
html.kaneyo-bp-is-open {
    overflow: hidden;
}

/* テーマの `*` で margin が 0 になり左上に寄るため、中央寄せを明示する */
.kaneyo-bp__dialog {
    box-sizing: border-box;
    width: calc(100% - 32px);
    max-width: 480px;
    max-height: 80vh;
    max-height: 80dvh;
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #fff;
    color: #333;
    overflow: auto;
    overscroll-behavior: contain;
}

.kaneyo-bp__dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

.kaneyo-bp__head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    margin: 0;
    padding: 8px 8px 8px 16px;
    border-bottom: 1px solid #ddd;
    background: #fff;
}

.kaneyo-bp__title {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: #333;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.5;
}

.kaneyo-bp__close {
    flex: none;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: none;
    color: #333;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.kaneyo-bp__list {
    margin: 0;
    padding: 0 16px 8px;
    list-style: none;
}

.kaneyo-bp__item {
    display: flex;
    gap: 12px;
    margin: 0;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    list-style: none;
}

.kaneyo-bp__item:last-child {
    border-bottom: 0;
}

.kaneyo-bp__img {
    flex: none;
    display: block;
    width: 96px;
    height: 96px;
    margin: 0;
    object-fit: contain;
}

.kaneyo-bp__body {
    flex: 1;
    min-width: 0;
}

.kaneyo-bp__name {
    margin: 0 0 4px;
    color: #333;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.kaneyo-bp__stock {
    margin: 0 0 8px;
    color: #555;
    font-size: 14px;
    line-height: 1.5;
}

.kaneyo-bp__stock--out {
    color: #a72126;
    font-weight: 700;
}

.kaneyo-bp__buy {
    display: inline-block;
    margin: 0;
    padding: 8px 16px;
    border-radius: 4px;
    background: #a72126;
    color: #fff !important;
    font-size: 15px;
    line-height: 1.5;
    text-decoration: none !important;
}

.kaneyo-bp__buy:hover {
    background: #800000;
}

.kaneyo-bp__buy:focus-visible,
.kaneyo-bp__close:focus-visible {
    outline: 3px solid #1a73e8;
    outline-offset: 2px;
}
