/* possweb-box のみ（components-checkbox-control 等の "box-" に当たらないよう限定） */
[class*=decoration-],
[class*="possweb-box"]{box-sizing:border-box;display:block;width:100%}

/* PC以上の基本スタイル */
html body [class*=decoration-],
html body [class*="possweb-box"],
.wp-block-possweb-decoration,
.wp-block-possweb-box {
  box-sizing: border-box;
  display: block;
  width: 100%;
  border-width: var(--pc-border-width, 0px) !important;
  border-radius: var(--pc-border-radius, 0px) !important;
}

/* タブレット用スタイル（1023px以下） */
@media (max-width: 1023px) {
    /*
     * パディング/マージンはデコレーターブロックのルート要素にのみ適用する。
     * 内包される子ブロックがデコレーターの値を継承しないようにクラスで限定。
     */
    [data-device="tablet"],
    .wp-block-possweb-decoration[data-tablet-padding],
    .wp-block-possweb-box[data-tablet-padding],
    [class*="decoration-"][data-tablet-padding],
    [class*="possweb-box"][data-tablet-padding],
    .wp-block-possweb-decoration[data-tablet-margin],
    .wp-block-possweb-box[data-tablet-margin],
    [class*="decoration-"][data-tablet-margin],
    [class*="possweb-box"][data-tablet-margin],
    .wp-block-possweb-decoration.tablet-padding-force,
    .wp-block-possweb-box.tablet-padding-force,
    [class*="decoration-"].tablet-padding-force,
    [class*="possweb-box"].tablet-padding-force,
    .wp-block-possweb-decoration.tablet-margin-force,
    .wp-block-possweb-box.tablet-margin-force,
    [class*="decoration-"].tablet-margin-force,
    [class*="possweb-box"].tablet-margin-force {
        padding-top: var(--tablet-padding-top, var(--pc-padding-top, 0px)) !important;
        padding-right: var(--tablet-padding-right, var(--pc-padding-right, 0px)) !important;
        padding-bottom: var(--tablet-padding-bottom, var(--pc-padding-bottom, 0px)) !important;
        padding-left: var(--tablet-padding-left, var(--pc-padding-left, 0px)) !important;
        margin-top: var(--tablet-margin-top, var(--pc-margin-top, 0px)) !important;
        margin-right: var(--tablet-margin-right, var(--pc-margin-right, 0px)) !important;
        margin-bottom: var(--tablet-margin-bottom, var(--pc-margin-bottom, 0px)) !important;
        margin-left: var(--tablet-margin-left, var(--pc-margin-left, 0px)) !important;
    }
    
    /* 個別のパディングとマージンの設定（クラスに基づく） */
    .wp-block-possweb-decoration.tablet-padding-force,
    .wp-block-possweb-box.tablet-padding-force,
    [class*="decoration-"].tablet-padding-force,
    [class*="possweb-box"].tablet-padding-force {
        padding-top: var(--tablet-padding-top, var(--pc-padding-top, 0px)) !important;
        padding-right: var(--tablet-padding-right, var(--pc-padding-right, 0px)) !important;
        padding-bottom: var(--tablet-padding-bottom, var(--pc-padding-bottom, 0px)) !important;
        padding-left: var(--tablet-padding-left, var(--pc-padding-left, 0px)) !important;
    }
    
    .wp-block-possweb-decoration.tablet-margin-force,
    .wp-block-possweb-box.tablet-margin-force,
    [class*="decoration-"].tablet-margin-force,
    [class*="possweb-box"].tablet-margin-force {
        margin-top: var(--tablet-margin-top, var(--pc-margin-top, 0px)) !important;
        margin-right: var(--tablet-margin-right, var(--pc-margin-right, 0px)) !important;
        margin-bottom: var(--tablet-margin-bottom, var(--pc-margin-bottom, 0px)) !important;
        margin-left: var(--tablet-margin-left, var(--pc-margin-left, 0px)) !important;
    }
    
    /* タブレット用ボーダー幅と角丸 */
    [data-device="tablet"],
    [data-tablet-padding],
    [data-tablet-margin],
    .tablet-padding-force,
    .tablet-margin-force,
    html body [class*=decoration-],
    html body [class*="possweb-box"],
    .wp-block-possweb-decoration,
    .wp-block-possweb-box {
        border-width: var(--tablet-border-width, var(--pc-border-width, 0px)) !important;
        border-radius: var(--tablet-border-radius, var(--pc-border-radius, 0px)) !important;
    }
}

/* モバイル用スタイル（639px以下） */
@media (max-width: 639px) {
    /*
     * パディング/マージンはデコレーターブロックのルート要素にのみ適用する。
     * .wp-block-possweb-decoration / .wp-block-possweb-box 等に限定することで、
     * 内包されるレスポンシブフォント等の子ブロックがデコレーターの値を
     * 継承しないようにする。
     */
    .wp-block-possweb-decoration[data-mobile-padding],
    .wp-block-possweb-box[data-mobile-padding],
    [class*="decoration-"][data-mobile-padding],
    [class*="possweb-box"][data-mobile-padding] {
        padding-top: var(--mobile-padding-top) !important;
        padding-right: var(--mobile-padding-right) !important;
        padding-bottom: var(--mobile-padding-bottom) !important;
        padding-left: var(--mobile-padding-left) !important;
    }

    .wp-block-possweb-decoration[data-mobile-margin],
    .wp-block-possweb-box[data-mobile-margin],
    [class*="decoration-"][data-mobile-margin],
    [class*="possweb-box"][data-mobile-margin] {
        margin-top: var(--mobile-margin-top) !important;
        margin-right: var(--mobile-margin-right) !important;
        margin-bottom: var(--mobile-margin-bottom) !important;
        margin-left: var(--mobile-margin-left) !important;
    }

    /* ボーダー幅・角丸は全ブロックに適用（変数は各ブロックのインラインスタイルで定義済み） */
    [data-device="mobile"],
    html body [class*=decoration-],
    html body [class*="possweb-box"],
    .wp-block-possweb-decoration,
    .wp-block-possweb-box {
        border-width: var(--mobile-border-width, var(--tablet-border-width, var(--pc-border-width, 0px))) !important;
        border-radius: var(--mobile-border-radius, var(--tablet-border-radius, var(--pc-border-radius, 0px))) !important;
    }
}

/* 編集画面：Pボックス（div/section 等）を中央寄せ（幅は維持） */
.block-editor-iframe__body .block-editor-block-list__block[data-type="possweb/decoration"],
.block-editor-page .block-editor-block-list__block[data-type="possweb/decoration"] {
	margin-left: auto !important;
	margin-right: auto !important;
}
.block-editor-iframe__body .block-editor-block-list__layout .block-editor-block-list__block.wp-block-possweb-decoration,
.block-editor-iframe__body .block-editor-block-list__layout .block-editor-block-list__block.wp-block-possweb-box,
.block-editor-page .block-editor-block-list__layout .block-editor-block-list__block.wp-block-possweb-decoration,
.block-editor-page .block-editor-block-list__layout .block-editor-block-list__block.wp-block-possweb-box {
	margin-left: auto !important;
	margin-right: auto !important;
}

.block-editor-iframe__body .block-editor-block-list__layout .block-editor-block-list__block.wp-block-possweb-decoration[data-align=full],.block-editor-iframe__body .block-editor-block-list__layout .block-editor-block-list__block.wp-block-possweb-box[data-align=full],.block-editor-page .block-editor-block-list__layout .block-editor-block-list__block.wp-block-possweb-decoration[data-align=full],.block-editor-page .block-editor-block-list__layout .block-editor-block-list__block.wp-block-possweb-box[data-align=full]{max-width:none!important}.block-editor-iframe__body .block-editor-block-list__layout .block-editor-block-list__block.wp-block-possweb-decoration[data-align=wide],.block-editor-iframe__body .block-editor-block-list__layout .block-editor-block-list__block.wp-block-possweb-box[data-align=wide],.block-editor-page .block-editor-block-list__layout .block-editor-block-list__block.wp-block-possweb-decoration[data-align=wide],.block-editor-page .block-editor-block-list__layout .block-editor-block-list__block.wp-block-possweb-box[data-align=wide]{max-width:var(--wp--style--global--wide-size)!important}.block-editor-iframe__body .block-editor-block-list__layout .block-editor-block-list__block.wp-block-possweb-decoration[style*="margin-left: auto"],.block-editor-iframe__body .block-editor-block-list__layout .block-editor-block-list__block.wp-block-possweb-box[style*="margin-left: auto"],.block-editor-page .block-editor-block-list__layout .block-editor-block-list__block.wp-block-possweb-decoration[style*="margin-left: auto"],.block-editor-page .block-editor-block-list__layout .block-editor-block-list__block.wp-block-possweb-box[style*="margin-left: auto"]{margin-left:auto}.block-editor-iframe__body .block-editor-block-list__layout .block-editor-block-list__block.wp-block-possweb-decoration[style*="margin-right: auto"],.block-editor-iframe__body .block-editor-block-list__layout .block-editor-block-list__block.wp-block-possweb-box[style*="margin-right: auto"],.block-editor-page .block-editor-block-list__layout .block-editor-block-list__block.wp-block-possweb-decoration[style*="margin-right: auto"],.block-editor-page .block-editor-block-list__layout .block-editor-block-list__block.wp-block-possweb-box[style*="margin-right: auto"]{margin-right:auto}.block-editor-iframe__body .possweb-decoration,.block-editor-iframe__body .possweb-decoration__inner,.block-editor-iframe__body .wp-block-possweb-box,.block-editor-page .possweb-decoration,.block-editor-page .possweb-decoration__inner,.block-editor-page .wp-block-possweb-box{box-sizing:border-box;position:relative;width:100%}body:not(.block-editor-iframe__body,.block-editor-page) .possweb-decoration,body:not(.block-editor-iframe__body,.block-editor-page) .wp-block-possweb-box{box-sizing:border-box;position:relative}body:not(.block-editor-iframe__body,.block-editor-page) .possweb-decoration__inner,body:not(.block-editor-iframe__body,.block-editor-page) .wp-block-possweb-box{box-sizing:border-box;position:relative;width:100%}
