/*
 * The shop's styles. The ones that depend on the site's settings (the price and cart heading
 * fonts, the responsive and centered layouts) are written into the page head.
 */

/* PRODUCTS AND THE CART LINK ---------------------------------------------------------------------- */

#pageEntries .addToCart {
    padding: 0 0 6px 0;
}

#pageEntries .addToCart div {
    float: right;
    clear: right;
}

#pageEntries .addToCart div.cartPrice,
#pageEntries .addToCart div.cartAttributes {
    float: left;
    clear: none;
}

#pageEntries .addToCart div.cartAttributes select {
    font-size: 11px;
    border: 1px solid #424242;
}

#pageEntries .addToCart button.addToCartButton {
    float: left;
    box-sizing: content-box;
    margin: 0;
    padding: 0 3px;
    border: 0;
    border-radius: 0;
    background-color: #424242;
    color: #FFFFFF;
    /* A button doesn't take the page's text styles by itself */
    font: inherit;
    letter-spacing: inherit;
    word-spacing: inherit;
    text-align: inherit;
    text-indent: inherit;
    text-transform: inherit;
    text-shadow: inherit;
    appearance: none;
    cursor: pointer;
}

#pageEntries .addToCart button.addToCartButton:hover {
    text-decoration: underline;
}

#pageEntries .addToCart select {
    float: right;
    margin: 0 6px 0 0;
}

#pageEntries .addedToCart {
    padding: 0 0 6px 0;
}

#pageEntries .outOfStock {
    padding: 0 0 6px 0;
    color: red;
}

#shoppingCart {
    position: absolute;
    right: 20px;
}

@media (max-width: 767px) {
    .bt-auto-responsive #shoppingCart {
        position: relative;
        float: right;
        right: inherit;
        margin: 0 10px 10px 10px;
    }
}

/* THE CART -----------------------------------------------------------------------------------------  */

/*
 * The cart section's page, and the same cart in a dialog on the other pages. Its text follows the
 * site's general font settings, only the color is the cart's own: the dialog is always white.
 * Sizes are in em, so the cart scales with the site's font size.
 */
.cart {
    --cart-text: #111111;
    --cart-muted: #6b6b6b;
    --cart-hairline: #e5e5e5;
    --cart-surface: #f5f5f5;
    --cart-field-border: #b0b0b0;
    --cart-error: #c62828;
    --cart-error-surface: #fdecec;
    --cart-radius: 8px;
    --cart-control-radius: 6px;
    --cart-control-height: 40px;
    /* The checkout button, matching PayPal's card button beside it */
    --cart-action-height: 48px;
    --cart-action: #2c2e2f;
    --cart-action-hover: #45484a;
    --cart-secondary: #e6e6e6;
    --cart-secondary-hover: #d9d9d9;
    --cart-stepper-button: max(2em, 28px);

    box-sizing: border-box;
    max-width: 640px;
    padding: 24px;
    color: var(--cart-text);
    container-type: inline-size;
}

.cart *,
.cart *::before,
.cart *::after {
    box-sizing: inherit;
}

/* The cart's own display rules would otherwise show what shop.js hides */
.cart .hidden {
    display: none !important;
}

/* Without specificity of their own, so the cart's classes below set their spacing */
.cart :where(h1, h2, p, ul, dl, dd) {
    margin: 0;
    padding: 0;
}

/* Over the site's link colors */
.cart a {
    color: inherit;
}

.cart :where(svg) {
    display: block;
}

@media (max-width: 480px) {
    .cart {
        padding: 16px;
    }
}

/* Title and notices */

.cart-title {
    margin-bottom: 1em;
    font-size: 1.6em;
}

.cart-notice {
    padding: 1em 1.25em;
    border-radius: var(--cart-radius);
    background-color: var(--cart-surface);
}

.cart-notice:empty {
    display: none;
}

/* The editor shows it above the cart's contents */
.cart-expired {
    margin-bottom: 1.5em;
}

.cart-note {
    color: var(--cart-muted);
}

.cart-message {
    animation: cart-reveal 200ms ease-out;
}

.cart-message--error {
    color: var(--cart-error);
}

/* The confirmation of a placed order, in place of the cart */
.cart-order-placed {
    display: grid;
    gap: 1em;
}

.cart-order-placed-headline {
    font-size: 1.3em;
}

/* Product lines: image, name, quantity, price and sum in a row, or in two rows in a narrow cart */

.cart-lines {
    list-style: none;
    border-top: 1px solid var(--cart-hairline);
}

.cart-lines-head {
    display: none;
    padding-bottom: 0.5em;
    color: var(--cart-muted);
}

.cart-lines-head > * {
    font-size: 0.85em;
}

.cart-line {
    display: grid;
    grid-template-columns: 3.5em auto minmax(0, 1fr) auto;
    grid-template-areas:
        "image name name sum"
        "image quantity price price";
    align-items: center;
    gap: 0.5em 1em;
    padding: 1em 0;
    border-bottom: 1px solid var(--cart-hairline);
}

.cart-line:has(> .cart-line-image.hidden) {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
        "name name sum"
        "quantity price price";
}

.cart-line-image {
    grid-area: image;
    align-self: start;
    width: 3.5em;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: var(--cart-control-radius);
    background-color: var(--cart-surface);
}

.cart-line-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-line-name {
    grid-area: name;
    min-width: 0;
    overflow-wrap: anywhere;
}

.cart-line-quantity {
    grid-area: quantity;
}

.cart-line-price {
    grid-area: price;
    color: var(--cart-muted);
}

.cart-line .cart-line-price::before {
    content: "\00d7\00a0";
}

.cart-line-sum {
    grid-area: sum;
    text-align: right;
}

.cart-line-price,
.cart-line-sum,
.cart-stepper-value,
.cart-totals dd,
.cart-pay-total {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.cart-stepper {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    border: 1px solid var(--cart-field-border);
    border-radius: var(--cart-control-radius);
}

.cart-stepper-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--cart-stepper-button);
    height: var(--cart-stepper-button);
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--cart-control-radius);
    background: none;
    color: inherit;
    cursor: pointer;
}

.cart-stepper-button:hover {
    background-color: var(--cart-surface);
}

.cart-stepper-button svg {
    width: 1em;
    height: 1em;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
}

.cart-stepper-value {
    min-width: 2em;
    text-align: center;
}

@container (min-width: 480px) {
    .cart-lines-head,
    .cart-line,
    .cart-line:has(> .cart-line-image.hidden) {
        display: grid;
        grid-template-columns: 3.5em minmax(0, 1fr) calc(var(--cart-stepper-button) * 2 + 2em + 2px) 6em 6em;
        grid-template-areas: "image name quantity price sum";
        align-items: center;
        column-gap: 1em;
    }

    /* The name takes the image's place when there's none */
    .cart-lines-head .cart-line-name,
    .cart-line:has(> .cart-line-image.hidden) .cart-line-name {
        grid-column: image-start / name-end;
    }

    .cart-line-price,
    .cart-lines-head .cart-line-sum {
        text-align: right;
    }

    .cart-line .cart-line-price::before {
        content: none;
    }
}

/* Promo code, shipping region and totals */

.cart-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14em, 1fr));
    gap: 1em;
    margin-top: 1.5em;
}

.cart-input-group {
    display: flex;
    gap: 0.5em;
}

.cart-input-group .cart-input {
    flex: 1;
    min-width: 0;
}

.cart-totals {
    margin-top: 1.5em;
}

.cart-totals-row {
    display: flex;
    justify-content: space-between;
    gap: 1em;
    padding: 0.25em 0;
    color: var(--cart-muted);
}

.cart-totals-row dd {
    text-align: right;
}

.cart-totals-row--total,
.cart-pay-total {
    color: var(--cart-text);
    font-size: 1.15em;
    font-weight: bold;
}

.cart-totals-row--total {
    margin-top: 0.5em;
    padding-top: 0.75em;
    border-top: 1px solid var(--cart-hairline);
}

.cart-totals-row--vat {
    padding-top: 0;
    font-size: 0.9em;
}

/* Checkout: billing and shipping addresses, payment method */

.cart-section {
    margin-top: 2em;
    padding-top: 1.5em;
    border-top: 1px solid var(--cart-hairline);
}

.cart-section-title {
    margin-bottom: 1em;
    font-size: 1.15em;
}

.cart-section-title + .cart-note {
    margin: -0.5em 0 1em;
}

.cart-fields {
    display: grid;
    gap: 1em;
    margin: 1em 0;
}

.cart-field {
    display: flex;
    flex-direction: column;
    gap: 0.35em;
    min-width: 0;
}

.cart-label {
    font-size: 0.9em;
}

.cart-field--required > .cart-label::after {
    content: "\00a0*";
    color: var(--cart-muted);
}

@container (min-width: 480px) {
    .cart-fields {
        grid-template-columns: 1fr 1fr;
    }

    .cart-field--wide {
        grid-column: 1 / -1;
    }
}

.cart-check {
    display: flex;
    align-items: flex-start;
    gap: 0.6em;
    margin-top: 1em;
    cursor: pointer;
}

.cart-check input,
.cart-payment-option input {
    flex: none;
    width: 1.15em;
    height: 1.15em;
    margin: 0;
    accent-color: var(--cart-text);
    cursor: pointer;
}

/* Centred on the label's first line */
.cart-check input {
    margin-top: calc((1lh - 1.15em) / 2);
}

/* Inputs, selects and buttons share one look */

.cart-input,
.cart-select,
.cart-button {
    min-height: var(--cart-control-height);
    margin: 0;
    padding: 0.5em 0.75em;
    border: 1px solid var(--cart-field-border);
    border-radius: var(--cart-control-radius);
    background-color: #fff;
    color: var(--cart-text);
    font: inherit;
    letter-spacing: inherit;
    word-spacing: inherit;
    text-transform: none;
    transition: border-color 150ms, background-color 200ms;
}

.cart-input,
.cart-select {
    width: 100%;
}

textarea.cart-input {
    min-height: 5.5em;
    resize: vertical;
}

.cart-select {
    padding-right: 2.25em;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23111' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.75em center;
    background-repeat: no-repeat;
    background-size: 1em;
    appearance: none;
    cursor: pointer;
}

.cart-input:hover,
.cart-select:hover {
    border-color: var(--cart-text);
}

.cart-input:focus-visible,
.cart-select:focus-visible,
.cart-button:focus-visible,
.cart-stepper-button:focus-visible,
.cart-link:focus-visible,
.cart-check input:focus-visible,
.cart-payment-option:has(input:focus-visible),
.cart-dialog-close:focus-visible {
    outline: 2px solid var(--cart-text);
    outline-offset: 1px;
}

/* Filled, unlike the fields, so a button next to a field doesn't pass for another one */
.cart-button {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    padding-right: 1.25em;
    padding-left: 1.25em;
    text-align: center;
    text-decoration: none;
    appearance: none;
    cursor: pointer;
}

/* The checkout: its label sized like the text of PayPal's buttons, which take its place */
.cart-button--primary {
    width: 100%;
    min-height: var(--cart-action-height);
    border-color: var(--cart-action);
    background-color: var(--cart-action);
    color: #fff;
    font-size: max(18px, 1.25em);
    font-weight: 500;
}

.cart-button--primary:hover {
    border-color: var(--cart-action-hover);
    background-color: var(--cart-action-hover);
}

/* A smaller step, such as applying the promo code: lighter, with the text at full contrast so
   it doesn't look disabled */
.cart-button--secondary {
    border-color: var(--cart-secondary);
    background-color: var(--cart-secondary);
    color: var(--cart-text);
}

.cart-button--secondary:hover {
    border-color: var(--cart-secondary-hover);
    background-color: var(--cart-secondary-hover);
}

/* The checkout couldn't go ahead */
.cart-button.is-error {
    border-color: var(--cart-error);
    background-color: var(--cart-error);
}

.cart-link {
    margin: 0;
    padding: 0.25em;
    border: 0;
    background: none;
    color: var(--cart-muted);
    font: inherit;
    letter-spacing: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.cart-link:hover {
    color: var(--cart-text);
}

/* A required field the checkout found empty, or a field the shop refused */
.cart-field.is-invalid .cart-label {
    color: var(--cart-error);
}

.cart-field.is-invalid .cart-input {
    border-color: var(--cart-error);
    background-color: var(--cart-error-surface);
}

/* Phones zoom into fields with text under 16px */
@media (pointer: coarse) {
    .cart-input,
    .cart-select {
        font-size: max(1em, 16px);
    }
}

/* Payment methods: one tile each, the chosen one outlined */

.cart-payment-methods {
    display: grid;
    gap: 0.5em;
}

.cart-payment-option {
    display: flex;
    align-items: center;
    gap: 0.75em;
    min-height: var(--cart-action-height);
    padding: 0.5em 1em;
    border: 1px solid var(--cart-field-border);
    border-radius: var(--cart-radius);
    background-color: #fff;
    cursor: pointer;
    transition: border-color 150ms, box-shadow 150ms;
}

.cart-payment-option:hover,
.cart-payment-option:has(input:checked) {
    border-color: var(--cart-text);
}

.cart-payment-option:has(input:checked) {
    box-shadow: inset 0 0 0 1px var(--cart-text);
}

/* The tile shows the focus */
.cart-payment-option input:focus-visible {
    outline: none;
}

.cart-payment-option-name {
    flex: 1;
    min-width: 0;
}

.cart-payment-option-marks {
    display: flex;
    flex: none;
    align-items: center;
    gap: 0.4em;
}

.cart-payment-mark {
    width: auto;
    height: 1.5em;
}

.cart-payment-mark--icon {
    fill: none;
    stroke: var(--cart-muted);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Total, terms and the button: the checkout button, or PayPal's in its place */

.cart-pay {
    display: grid;
    gap: 0.75em;
    margin-top: 1.5em;
}

.cart-pay-total {
    display: flex;
    justify-content: space-between;
    gap: 1em;
}

.cart-terms {
    color: var(--cart-muted);
    font-size: 0.9em;
}

.cart-terms a {
    text-decoration: underline;
}

/* Its message and buttons are spaced by the pay area, so the hidden ones leave no gap */
.cart-paypal-buttons {
    display: contents;
}

/* PayPal's buttons the same size as the checkout button */
.cart-paypal-button paypal-button,
.cart-paypal-button paypal-basic-card-button {
    --paypal-button-border-radius: var(--cart-control-radius);

    display: block;
    width: 100%;
    height: var(--cart-action-height);
}

.cart-paypal-button paypal-basic-card-container {
    display: block;
    width: 100%;
}

.cart-return {
    text-align: center;
}

/* The cart dialog: centred, a full-screen sheet on phones */

.cart-dialog {
    box-sizing: border-box;
    width: min(640px, 100% - 32px);
    max-width: none;
    max-height: calc(100% - 32px);
    padding: 0;
    border: 0;
    border-radius: 12px;
    background-color: #fff;
    color: #111111;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
    overscroll-behavior: contain;
    animation: cart-fade-in 250ms ease-in-out;
}

.cart-dialog:focus {
    outline: none;
}

.cart-dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.85);
    cursor: pointer;
    animation: cart-fade-in 250ms ease-in-out;
}

.cart-dialog--light::backdrop {
    background-color: rgba(255, 255, 255, 0.85);
}

.cart-dialog .cart {
    max-width: none;
}

/* Clear of the close button */
.cart-dialog .cart-title {
    padding-right: 32px;
}

/* Stays in the corner while the cart scrolls, without taking up a line of its own */
.cart-dialog-close {
    position: sticky;
    top: 8px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 8px 8px -48px auto;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.9);
    color: #111111;
    cursor: pointer;
}

.cart-dialog-close:hover {
    background-color: #f5f5f5;
}

.cart-dialog-close svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
}

@media (max-width: 480px) {
    .cart-dialog {
        width: 100%;
        height: 100%;
        max-height: none;
        margin: 0;
        border-radius: 0;
    }
}

@keyframes cart-fade-in {
    from {
        opacity: 0;
    }
}

@keyframes cart-reveal {
    from {
        opacity: 0;
        transform: translateY(-0.25em);
    }
}

@media (prefers-reduced-motion: reduce) {
    .cart-message,
    .cart-dialog,
    .cart-dialog::backdrop {
        animation: none;
    }
}
