.custom-box-builder,
.custom-box-builder * {
    box-sizing: border-box;
}

.custom-box-builder {
    --custom-box-max-width: 1440px;
    --custom-box-page-gap: 48px;
    --custom-box-layout-gap: 32px;
    --custom-box-summary-width: 360px;
    --custom-box-sticky-top: 120px;
    --custom-box-accent: #2f6f45;
    --custom-box-accent-dark: #245637;
    --custom-box-accent-soft: rgba(47, 111, 69, 0.08);

    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        minmax(320px, var(--custom-box-summary-width));

    grid-template-areas:
        "header header"
        "products summary";

    align-items: start;

    gap:
        32px
        var(--custom-box-layout-gap);

    width: min(
        var(--custom-box-max-width),
        calc(100vw - var(--custom-box-page-gap))
    );

    max-width: none;
    margin-left: auto;
    margin-right: auto;
    margin-top: 64px;
    margin-bottom: 80px;
}

.custom-box-builder__header {
    grid-area: header;
    margin-bottom: 4px;
}

.custom-box-builder__title {
    margin: 0 0 12px;
    font-size: 34px;
    line-height: 1.15;
}

.custom-box-builder__description {
    max-width: 760px;
    margin: 0;
    font-size: 17px;
    line-height: 1.6;
}

.custom-box-builder__grid {
    grid-area: products;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    min-width: 0;
}

.custom-box-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    background: #fff;
    border-radius: 16px;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.03);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease,
        background-color 0.2s ease;
}

.custom-box-card:hover {
    transform: translateY(-3px);
    border-color: rgba(25, 25, 20, 0.22);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
}

.custom-box-card--selected {
    border: 1px solid #2e6f40;
    background: #fbfdf9;
    box-shadow: 0 0 0 1px #2e6f40, 0 10px 28px rgba(47, 111, 69, 0.10);
}

.custom-box-card__image-wrapper {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f3f3ef;
}

.custom-box-card__image-wrapper > img.custom-box-card__image {
    display: block;

    width: 100%;
    height: 100% !important;
    max-width: none;

    object-fit: cover;
    object-position: center center;

    transition: transform 0.35s ease;
}

.custom-box-card:hover
.custom-box-card__image-wrapper > img.custom-box-card__image {
    transform: scale(1.01);
}

.custom-box-card__content {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 20px 22px 21px;
}

.custom-box-card__name {
    min-height: 2.6em;
    margin: 0 0 8px;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.3;
}

.custom-box-card__more {
    align-self: flex-start;
    margin: 0 0 18px;
    padding: 0;
    border: 0;
    background: transparent;
    color: rgba(20, 20, 18, 0.72);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.custom-box-card__more:hover {
    color: #2e6f40;
}

.custom-box-card__more:focus-visible {
    outline: 2px solid #2e6f40;
    outline-offset: 4px;
    border-radius: 2px;
}

.custom-box-card__weight {
    display: inline-flex;
    align-self: flex-start;
    margin: 0 0 16px;
    padding: 6px 10px;
    border: 1px solid rgba(47, 111, 69, 0.14);
    border-radius: 999px;
    background: rgba(47, 111, 69, 0.07);
    color: #31573c;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.custom-box-card__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: auto;
    padding-top: 4px;
}

.custom-box-card__price {
    min-width: 0;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.custom-box-card__quantity {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.custom-box-card__quantity-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.17);
    border-radius: 50%;
    background: #fff;
    color: #181818;
    font-size: 21px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    transition:
        color 0.2s ease,
        background-color 0.2s ease,
        border-color 0.2s ease,
        transform 0.15s ease,
        opacity 0.2s ease;
}

.custom-box-card__quantity-button:hover:not(:disabled) {
    border-color: #2e6f40;
    background: #2e6f40;
    color: #fff;
}

.custom-box-card__quantity-button:active:not(:disabled) {
    transform: scale(0.94);
}

.custom-box-card__quantity-button:focus-visible {
    outline: 2px solid #2e6f40;
    outline-offset: 3px;
}

.custom-box-card__quantity-button:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.custom-box-card__quantity-value {
    min-width: 26px;
    text-align: center;
    font-size: 17px;
    font-weight: 700;
}

.custom-box-card--selected
.custom-box-card__quantity-button--plus {
    border-color: #2e6f40;
}

.custom-box-summary {
    grid-area: summary;
    position: sticky;
    top: var(--custom-box-sticky-top);
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-height: calc(
        100vh -
        var(--custom-box-sticky-top) -
        24px
    );

    padding: 28px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.10);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

body.admin-bar .custom-box-summary {
    top: calc(
        var(--custom-box-sticky-top) + 32px
    );

    max-height: calc(
        100vh -
        var(--custom-box-sticky-top) -
        32px -
        24px
    );
}

.custom-box-summary__title {
    flex-shrink: 0;
    margin: 0 0 24px;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
}

.custom-box-summary__base {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 20px;
    padding: 0 0 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.10);
    font-size: 15px;
}

.custom-box-summary__base strong {
    flex-shrink: 0;
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;
}

.custom-box-summary__items {
    min-height: 0;
    padding: 10px 7px 10px 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color:
        rgba(0, 0, 0, 0.25)
        transparent;
}

.custom-box-summary__items::-webkit-scrollbar {
    width: 6px;
}

.custom-box-summary__items::-webkit-scrollbar-track {
    background: transparent;
}

.custom-box-summary__items::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.22);
}

.custom-box-summary__empty {
    margin: 20px 0;
    color: rgba(20, 20, 18, 0.58);
    font-size: 14px;
    line-height: 1.6;
}

.custom-box-summary__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

.custom-box-summary__item:last-child {
    border-bottom: 0;
}

.custom-box-summary__item-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 4px;
}

.custom-box-summary__item-name {
    color: #1a1a18;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
}

.custom-box-summary__item-details {
    color: rgba(20, 20, 18, 0.55);

    font-size: 13px;
    line-height: 1.3;
}

.custom-box-summary__item-price {
    flex-shrink: 0;
    color: #1a1a18;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.custom-box-summary__footer {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    margin-top: 10px;
}

.custom-box-summary__count {
    order: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.10);
    font-size: 15px;
}

.custom-box-summary__count strong {
    flex-shrink: 0;
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
}

.custom-box-summary__total {
    order: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 0;
    border-top: 2px solid rgba(0, 0, 0, 0.14);
    font-size: 19px;
    font-weight: 600;
}

.custom-box-summary__total-value {
    color: #2e6f40;
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.custom-box-summary__actions {
    order: 3;
    margin-top: 2px;
}

.custom-box-summary__add-button {
    width: 100%;
    padding: 16px 20px;
    border: 1px solid #2e6f40;
    border-radius: 12px;
    background: #2e6f40;
    color: #fff;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 5px 16px rgba(47, 111, 69, 0.16);
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.15s ease,
        opacity 0.2s ease;
}

.custom-box-summary__add-button:not(:disabled):hover {
    transform: translateY(-1px);
    border-color: var(--custom-box-accent-dark);
    background: var(--custom-box-accent-dark);
    box-shadow:
        0 7px 20px rgba(47, 111, 69, 0.22);
}

.custom-box-summary__add-button:not(:disabled):active {
    transform: translateY(0);
}

.custom-box-summary__add-button:focus-visible {
    outline: 3px solid rgba(47, 111, 69, 0.25);
    outline-offset: 3px;
}

.custom-box-summary__add-button:disabled {
    border-color: #e6e6e3;
    background: #eeeeeb;
    color: rgba(20, 20, 18, 0.28);
    box-shadow: none;
    opacity: 1;
    cursor: not-allowed;
}

.custom-box-summary__hint {
    margin: 10px 6px 0;
    color: rgba(20, 20, 18, 0.55);
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
}

.custom-box-summary__message:empty {
    display: none;
}

.custom-box-summary__message {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}

.custom-box-summary__message--success {
    border: 1px solid rgba(47, 111, 69, 0.16);
    background: var(--custom-box-accent-soft);
    color: #285b38;
}

.custom-box-summary__message--error {
    border: 1px solid rgba(160, 40, 40, 0.14);
    background: rgba(160, 40, 40, 0.07);
    color: #8a2929;
}

.custom-box-modal[hidden] {
    display: none;
}

.custom-box-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(18, 20, 17, 0.58);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.custom-box-modal__window {
    position: relative;
    width: min(100%, 620px);
    max-height: min(78vh, 720px);
    overflow-y: auto;
    padding: 36px 38px 38px;
    border: 1px solid rgba(0, 0, 0, 0.10);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
    animation: custom-box-modal-in 0.22s ease-out;
}

@keyframes custom-box-modal-in {

    from {
        opacity: 0;
        transform: translateY(10px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.custom-box-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    background: #f5f5f2;
    color: #1b1b19;
    font-size: 28px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.15s ease;
}

.custom-box-modal__close:hover {
    border-color: rgba(47, 111, 69, 0.18);
    background: var(--custom-box-accent-soft);
    color: var(--custom-box-accent);
}

.custom-box-modal__close:active {
    transform: scale(0.94);
}

.custom-box-modal__close:focus-visible {
    outline: 3px solid rgba(47, 111, 69, 0.25);
    outline-offset: 3px;
}

.custom-box-modal__title {
    margin: 0 52px 22px 0;
    color: #1a1a18;
    font-size: 27px;
    font-weight: 700;
    line-height: 1.2;
}

.custom-box-modal__content {
    color: rgba(20, 20, 18, 0.78);
    font-size: 16px;
    line-height: 1.75;
}

.custom-box-modal__content p {
    margin: 0 0 16px;
}

.custom-box-modal__content p:last-child {
    margin-bottom: 0;
}

.custom-box-modal__content strong {
    color: #1a1a18;
}

.custom-box-modal__content a {
    color: var(--custom-box-accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.custom-box-modal__window {
    scrollbar-width: thin;
    scrollbar-color:
        rgba(0, 0, 0, 0.25)
        transparent;
}

.custom-box-modal__window::-webkit-scrollbar {
    width: 7px;
}

.custom-box-modal__window::-webkit-scrollbar-track {
    background: transparent;
}

.custom-box-modal__window::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.22);
}

body.custom-box-modal-open {
    overflow: hidden;
}

.custom-box-builder--loading
.custom-box-card__quantity-button {
    cursor: wait;
}

@keyframes custom-box-modal-mobile-in {

    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wc-block-components-product-details
li:has(.custom-box-cart-contents) {
    display: block;
    margin-top: 6px;
}

.wc-block-components-product-details
li:has(.custom-box-cart-contents)
.wc-block-components-product-details__name {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    line-height: 1.35;
}

.wc-block-components-product-details
li:has(.custom-box-cart-contents)
.wc-block-components-product-details__value {
    display: block;
}

.custom-box-cart-contents {
    display: block;
    color: rgba(20, 20, 18, 0.70);
    font-size: 0.95em;
    font-weight: 400;
    line-height: 1.5;
}

.wc-block-mini-cart__drawer
.custom-box-cart-contents {
    font-size: 0.9em;
    line-height: 1.45;
}

.wc-block-mini-cart__drawer
.wc-block-components-product-details
li:has(.custom-box-cart-contents) {
    margin-top: 4px;
}

.wc-block-cart
.custom-box-cart-contents,
.wc-block-checkout
.custom-box-cart-contents {
    line-height: 1.55;
}

.custom-box-product-intro {
    margin: 28px 0 24px;
    color: #1a1a18;
}

.custom-box-product-intro__text {
    margin: 0 0 16px;
    font-size: 17px;
    line-height: 1.6;
}

.custom-box-product-intro__list {
    margin: 0;
    padding-left: 48px;
    list-style: disc;
}

.custom-box-product-intro__list li {
    display: list-item;
    margin: 6px 0;
    font-size: 16px;
    line-height: 1.45;
}

.custom-box-product-intro__list li::marker {
    font-size: 20px;
    color: #000000;
}

@media (max-width: 1279px) {

    .custom-box-builder {
        --custom-box-page-gap: 32px;
        --custom-box-layout-gap: 26px;
        --custom-box-summary-width: 320px;
    }

    .custom-box-builder__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px;
    }
}

@media (max-width: 960px) {

    .custom-box-builder__grid,
    .custom-box-card,
    .custom-box-summary {
        min-width: 0;
        max-width: 100%;
    }

    .custom-box-builder {
        display: block;
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        margin-top: 52px;
        margin-bottom: 64px;
        padding-left: 0;
        padding-right: 0;
        overflow-x: clip;
    }

    .custom-box-builder__header {
        margin-bottom: 28px;
    }

    .custom-box-builder__grid {
        width: 100%;

        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px;
    }

    .custom-box-card {
        width: 100%;
    }

    .custom-box-summary,
    body.admin-bar .custom-box-summary {
        position: static;
        width: 100%;
        max-height: none;
        margin-top: 36px;
        overflow: visible;
    }

    .custom-box-summary__items {
        overflow: visible;
    }
}

@media (max-width: 720px) {

    .custom-box-builder__title {
        font-size: 30px;
    }

    .custom-box-builder__description {
        font-size: 16px;
    }

    .custom-box-card__content {
        padding: 16px;
    }

    .custom-box-card__bottom {
        gap: 10px;
    }

    .custom-box-card__quantity {
        gap: 8px;
    }
}

@media (max-width: 600px) {

    .custom-box-builder,
    .custom-box-builder__grid,
    .custom-box-card,
    .custom-box-card__content,
    .custom-box-card__bottom,
    .custom-box-summary {
        min-width: 0;
        max-width: 100%;
    }

    .custom-box-builder {
        margin-top: 42px;
        margin-bottom: 52px;
    }

    .custom-box-builder__header {
        margin-bottom: 24px;
    }

    .custom-box-builder__title {
        font-size: 27px;
    }

    .custom-box-builder__grid {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .custom-box-card {
        width: 100%;
        border-radius: 15px;
    }

    .custom-box-card__image-wrapper,
    .custom-box-card__image {
        max-width: 100%;
    }

    .custom-box-card__image-wrapper {
        aspect-ratio: 1 / 1;
    }

    .custom-box-card__content {
        width: 100%;
        padding: 18px 20px 20px;
    }

    .custom-box-card__name,
    .custom-box-card__more {
        overflow-wrap: anywhere;
    }

    .custom-box-card__name {
        min-height: auto;
        font-size: 18px;
    }

    .custom-box-card__bottom {
        width: 100%;
        align-items: center;
        gap: 12px;
    }

    .custom-box-card__price {
        min-width: 0;
        font-size: 18px;
    }

    .custom-box-card__quantity {
        flex-shrink: 0;
        gap: 8px;
    }

    .custom-box-card__quantity-button {
        width: 40px;
        height: 40px;
    }

    .custom-box-summary {
        margin-top: 30px;
        padding: 22px;

        border-radius: 16px;
    }

    .custom-box-summary__item {
        align-items: flex-start;
    }

    .custom-box-summary__title {
        font-size: 23px;
    }

    .custom-box-summary__total {
        font-size: 18px;
    }

    .custom-box-summary__total-value {
        font-size: 23px;
    }

    .custom-box-modal {
        align-items: flex-end;
        padding: 12px;
    }

    .custom-box-modal__window {
        width: 100%;
        max-height: 85vh;
        padding: 32px 22px 24px;
        border-radius: 16px;
        animation: custom-box-modal-mobile-in 0.22s ease-out;
    }

    .custom-box-modal__close {
        top: 12px;
        right: 12px;
        width: 38px;
        height: 38px;
    }

    .custom-box-modal__title {
        margin-right: 46px;
        margin-bottom: 18px;

        font-size: 22px;
    }

    .custom-box-modal__content {
        font-size: 15px;
        line-height: 1.7;
    }

    .custom-box-product-intro {
        margin: 22px 0 20px;
    }

    .custom-box-product-intro__text {
        font-size: 16px;
    }

    .custom-box-product-intro__list li {
        font-size: 15px;
    }
}

@media (max-width: 460px) {

    .custom-box-card__bottom {
        align-items: flex-start;
        flex-direction: column;
    }

    .custom-box-card__quantity {
        width: 100%;
        justify-content: flex-end;
    }

    .custom-box-summary {
        padding: 18px;
    }
}

@media (max-width: 420px) {

    .custom-box-card__content {
        padding: 17px 18px 19px;
    }

    .custom-box-card__weight {
        max-width: 100%;
        white-space: normal;
    }

    .custom-box-summary {
        padding: 19px;
    }

    .custom-box-summary__base,
    .custom-box-summary__count,
    .custom-box-summary__total {
        gap: 12px;
    }

    .custom-box-summary__total-value {
        font-size: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {

    .custom-box-modal__window {
        animation: none;
    }

    .custom-box-modal__close {
        transition: none;
    }
}

html {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    max-width: 100%;
    overflow-x: hidden;
}

@supports (overflow-x: clip) {

    html {
        overflow-x: clip;
    }

    body {
        overflow-x: clip;
    }
}