/* The product and checkout compositions follow their Style A reference frames. */
body[data-view="product"] .style-a-product {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    row-gap: 16px;
}

body[data-view="product"] .style-a-product .gallery {
    min-width: 0;
    position: static;
}

body[data-view="product"] .style-a-product .main-photo {
    height: auto;
    max-height: none;
    border-radius: 12px;
}

body[data-view="product"] .style-a-product .main-photo img {
    height: auto;
    max-height: min(57svh, 560px);
    object-fit: contain;
}

body[data-view="product"] .style-a-product .main-photo:has(img[hidden]) {
    min-height: 180px;
}

.style-a-product .product-gallery-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}

.style-a-product .product-gallery-tools .thumbnails {
    min-width: 0;
    margin: 0;
    overflow-x: auto;
    scrollbar-width: thin;
}

.style-a-product .product-gallery-tools .thumbnails:empty {
    display: none;
}

.style-a-product .product-gallery-navigation {
    flex: none;
    margin: 0;
    margin-inline-start: auto;
}

body[data-view="product"] .style-a-product .product-purchase-panel {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

body[data-view="product"] .style-a-product .product-purchase-panel h1 {
    margin-bottom: 4px;
    line-height: 1.36;
}

body[data-view="product"] .style-a-product .product-context-row {
    justify-content: space-between;
    margin: 0;
}

body[data-view="product"] .style-a-product .product-context-row .product-category {
    background: transparent;
    color: var(--muted);
}

body[data-view="product"] .style-a-product .product-price-row {
    margin: 6px 0 12px;
    padding: 0;
    border: 0;
}

body[data-view="product"] .style-a-product .product-order-controls {
    display: grid;
    gap: 6px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

body[data-view="product"] .style-a-product .product-purchase-panel h1 {
    text-wrap: pretty;
}

body[data-view="product"] .style-a-product .product-context-row {
    min-height: 36px;
}

body[data-view="product"] .style-a-product .product-context-row button {
    min-height: 36px;
    padding: 5px 8px;
}

body[data-view="product"] .style-a-product .product-price-row {
    align-items: flex-end;
    column-gap: 8px;
}

body[data-view="product"] .style-a-product .product-price-row .availability {
    margin-block-end: 2px;
}

body[data-view="product"] .style-a-product .main-photo img {
    border-radius: inherit;
}

.style-a-product .product-order-controls :is(.field-error, .product-options-intro):empty {
    display: none;
}

body[data-view="product"] .style-a-product .product-options-intro {
    padding: 0;
    margin: 0;
    border: 0;
}

body[data-view="product"] .style-a-product .option-group {
    margin: 6px 0 10px;
}

body[data-view="product"] .style-a-product .option-group legend {
    margin-bottom: 5px;
}

.style-a-product .product-order-controls .quantity-row {
    margin-block: 0;
}

.style-a-product .product-extra-details {
    display: grid;
    align-content: start;
    gap: 8px;
    min-width: 0;
}

body[data-view="product"] .style-a-product .product-extra-details :is(.product-info-card, .product-shopping-note, .upsell-box) {
    margin: 0;
    border-radius: 10px;
    box-shadow: none;
}

body[data-view="product"] .related-section {
    margin-block-start: 20px;
}

body[data-view="cart"] .style-a-checkout .cart-main-column {
    display: grid;
    gap: 14px;
    min-width: 0;
}

body[data-view="cart"] .style-a-checkout :is(.cart-products-panel, .cart-extras-panel, .checkout-form) {
    min-width: 0;
    margin: 0;
    padding: clamp(12px, 1.65vw, 20px);
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: none;
}

body[data-view="cart"] .style-a-checkout .cart-section-heading {
    margin: 0;
    padding: 0 0 8px;
    border: 0;
}

body[data-view="cart"] .style-a-checkout .cart-products-panel .cart-section-heading {
    border-block-end: 1px solid var(--line);
}

body[data-view="cart"] .style-a-checkout .cart-item {
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: start;
    gap: 6px 10px;
    padding-block: 12px;
}

.style-a-checkout .cart-item-photo {
    grid-row: 1 / span 4;
    aspect-ratio: 1;
    border-radius: 8px;
}

body[data-view="cart"] .style-a-checkout .cart-item-info {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 14px;
    min-width: 0;
}

body[data-view="cart"] .style-a-checkout .cart-item-info > :is(h3, .cart-item-options, .cart-unit-row) {
    grid-column: 1;
    grid-row: auto;
}

body[data-view="cart"] .style-a-checkout .cart-item-info .cart-item-bottom {
    display: flex;
    grid-column: 2;
    grid-row: 1 / span 3;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    margin: 0;
}

body[data-view="cart"] .style-a-checkout .cart-item-info .cart-unit-row {
    justify-content: flex-start;
    gap: 10px;
    margin: 1px 0 0;
}

body[data-view="cart"] .style-a-checkout .cart-item-info .cart-item-status {
    grid-column: 1 / -1;
}

body[data-view="cart"] .style-a-checkout .cart-line-summary {
    min-width: 60px;
}

.style-a-checkout .cart-item-info h3 {
    font-size: 14px;
    line-height: 1.55;
}

.style-a-checkout .cart-item-bottom {
    gap: 6px;
    padding: 0;
    margin: 5px 0 0;
    border: 0;
}

body[data-view="cart"] .style-a-checkout .cart-extra-choice,
body[data-view="cart"] .style-a-checkout .checkout-pay-choice {
    border-radius: 8px;
}

body[data-view="cart"] .style-a-checkout .checkout-recipient-jump {
    display: flex;
    justify-content: flex-end;
}

body[data-view="cart"] .style-a-checkout .cart-next {
    padding-inline: 5px;
    border: 0;
    background: transparent;
    color: var(--accent);
}

.style-a-checkout .checkout-recipient {
    margin-bottom: 14px;
}

.style-a-checkout .checkout-recipient .fields {
    gap: 8px 12px;
}

.style-a-checkout .checkout-recipient :is(input:not([type="hidden"]), select, textarea) {
    border-radius: 8px;
    background: var(--surface);
}

.style-a-checkout .checkout-recipient textarea {
    min-height: 56px;
}

.style-a-checkout .checkout-payment-methods {
    margin-block-start: 0;
}

.style-a-checkout .order-summary {
    background: var(--surface);
    border-color: var(--theme-selection-line);
}

.style-a-checkout .order-summary .summary-row.total {
    margin-inline: -6px;
    padding-inline: 8px;
    border: 0;
    border-radius: 8px;
    background: var(--theme-tint);
}

@media (min-width: 960px) {
    body[data-view="product"] .style-a-product {
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
        column-gap: clamp(24px, 4vw, 52px);
        row-gap: 20px;
    }

    .style-a-product .product-extra-details {
        grid-column: 1 / -1;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    body[data-view="cart"] .style-a-checkout {
        grid-template-columns: minmax(0, 1fr) minmax(270px, 33%);
        gap: clamp(22px, 4vw, 48px);
    }

    .style-a-checkout .checkout-pay-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    body[data-view="cart"] .style-a-checkout .checkout-pay-grid .checkout-pay-choice {
        border: 1px solid var(--line);
        grid-template-columns: 42px minmax(0, 1fr) 18px;
        padding-inline: 8px;
    }

    .style-a-checkout .checkout-pay-grid .checkout-pay-logo {
        width: 42px;
    }
}

@media (max-width: 639px) {
    body[data-view="product"] .style-a-product .main-photo img {
        max-height: min(42svh, 320px);
    }

    .style-a-product .product-gallery-navigation button {
        width: 40px;
        height: 40px;
    }

    .style-a-product .product-gallery-tools .thumbnails button {
        width: 48px;
        height: 48px;
    }

    body[data-view="cart"] .style-a-checkout .cart-item-info {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 2px;
    }

    body[data-view="cart"] .style-a-checkout .cart-item-info .cart-item-bottom {
        grid-column: 1;
        grid-row: auto;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 4px 8px;
    }

    body[data-view="cart"] .style-a-checkout .cart-item-photo {
        grid-row: auto;
    }

    body[data-view="cart"] .style-a-checkout .cart-unit-row .remove-item {
        margin: 0;
    }
}
