* { box-sizing: border-box; }
:root { --shop-max-width: 1200px; --shop-padding: 1rem; }
[hidden] { display: none !important; }
body { margin: 0; color: #202124; background: #f5f7fa; font-family: system-ui, sans-serif; line-height: 1.6; }
a { color: #164ea5; }
.shop-container { max-width: var(--shop-max-width); margin: auto; padding: var(--shop-padding); }
.product-grid { display: grid; gap: 1.5rem; }
.product-filters { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.5rem; }
.product-filters button { padding: .65rem 1rem; border: 2px solid var(--color-primary, #1a73e8); border-radius: .5rem; background: transparent; color: var(--color-primary, #1a73e8); transition: background-color .15s ease, color .15s ease; }
.product-filters button[aria-pressed="true"] { background: var(--color-primary, #1a73e8); color: #fff; }
.product-filters button:focus-visible { outline-color: var(--color-secondary, #fbbc04); }
.product-card { background: #fff; padding: 1.5rem; border-radius: .75rem; border: 1px solid #d5d9df; min-width: 0; overflow-wrap: anywhere; }
.product-card { display: flex; flex-direction: column; gap: 16px; padding: 16px; border: 1px solid #e0e0e0; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.06); transition: transform .15s ease, box-shadow .15s ease; }
.product-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.12); }
.product-media { position: relative; flex-shrink: 0; width: 100%; height: 120px; }
.product-gallery { flex-shrink: 0; width: 100%; min-width: 0; }
.product-image-open { display: block; width: 100%; height: 100%; padding: 0; border-radius: 8px; background: #e0e0e0; cursor: pointer; }
.product-image-open:hover:not(:disabled) { opacity: .9; }
.product-media img, .product-placeholder { width: 100%; height: 100%; border-radius: 8px; object-fit: cover; }
.product-media { background: #e0e0e0; border-radius: 8px; }
.product-thumbnails { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 8px 0 4px; }
.product-thumbnail { position: relative; flex: 0 0 48px; width: 48px; height: 48px; padding: 0; border-radius: 6px; background: #e0e0e0; scroll-snap-align: start; }
.product-thumbnail img { display: block; width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.product-thumbnail:disabled { background: #e0e0e0; }
.thumbnail-more { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; border-radius: 6px; background: #0009; color: white; font-weight: 700; }
.image-modal { position: fixed; inset: 0; margin: 0; border: 0; padding: 0; background: transparent; max-width: none; max-height: none; width: 100vw; height: 100vh; height: 100dvh; }
.image-modal[open] { display: flex; align-items: center; justify-content: center; }
.image-modal::backdrop { background: rgba(0,0,0,.8); backdrop-filter: blur(4px); }
.image-modal-img { max-width: 90vw; max-height: 90vh; object-fit: contain; border-radius: 8px; background: #e0e0e0; }
.image-modal-close, .image-modal-prev, .image-modal-next { position: absolute; width: 40px; height: 40px; padding: 0; border-radius: 50%; background: rgba(255,255,255,.9); color: #202124; font-size: 24px; line-height: 1; }
.image-modal-close { top: 16px; right: 16px; }
.image-modal-prev { left: 8px; top: calc(50% - 20px); }
.image-modal-next { right: 8px; top: calc(50% - 20px); }
body:has(.image-modal[open]) { overflow: hidden; }
.product-placeholder { display: grid; place-items: center; background: #e0e0e0; color: #666; }
.product-promo { position: absolute; top: 4px; right: 4px; max-width: calc(100% - 8px); padding: 2px 4px; background: var(--color-primary, #1a73e8); color: #fff; font-size: 10px; font-weight: 700; border-radius: 4px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-details { display: flex; flex: 1; flex-direction: column; gap: 8px; min-width: 0; }
.product-card h2 { margin: 0; font-size: 18px; font-weight: 700; color: #1a1a1a; }
.product-description { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; margin: 0; font-size: 14px; color: #666; }
.product-card .inclusions { display: flex; flex-wrap: wrap; gap: 0 .35em; list-style: none; padding: 0; margin: 0; font-size: 13px; color: #666; }
.product-card .inclusions li:not(:last-child)::after { content: ","; }
.product-form { display: flex; flex: 1; flex-direction: column; margin: 0; gap: 8px; }
.product-quantity { display: grid; gap: 8px; }
.quantity-controls { display: flex; gap: 8px; }
.quantity-controls input { flex: 1; min-width: 0; text-align: center; }
.quantity-controls button { flex: 0 0 40px; padding: 8px; background: #f0f2f5; color: #1a1a1a; border: 1px solid #ddd; }
.quantity-controls button:disabled { opacity: .5; cursor: not-allowed; }
.product-form .price-preview p, .product-form .discount { margin: 0; }
.unit-price { color: var(--color-primary, #1a73e8); font-size: 16px; font-weight: 600; }
.line-total { color: #1a1a1a; font-size: 16px; font-weight: 700; }
.product-form .discount { font-size: 13px; color: #666; }
.product-form > button[type="submit"] { width: 100%; padding: 10px; background: var(--color-primary, #1a73e8); color: #fff; border-radius: 8px; font-weight: 600; margin-top: auto; }
.product-form > button[type="submit"]:hover:not(:disabled) { filter: brightness(.9); }
.product-form > button[type="submit"]:disabled { background: #666; }
.product-type, .discount { font-size: .9rem; }
form, label { display: grid; gap: .75rem; }
form { margin-block: 1rem; }
input, select, button, .button { font: inherit; padding: .75rem; border-radius: .4rem; }
input, select { width: 100%; max-width: 100%; border: 1px solid #626b77; background: #fff; color: #202124; }
button, .button { background: #164ea5; color: #fff; border: 0; cursor: pointer; text-decoration: none; text-align: center; }
button:disabled { background: #666; cursor: not-allowed; }
.checkout-form { max-width: 36rem; }
.shop-container.checkout-container { width: 100%; max-width: 960px; margin: 0 auto; padding: 16px; }
.checkout-layout { display: grid; gap: 24px; align-items: start; }
.checkout-customer, .checkout-summary { min-width: 0; }
.checkout-customer .checkout-form { max-width: none; margin: 0; }
.checkout-consent { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid #e0e0e0; border-radius: 8px; background: #fafafa; }
.checkout-consent input { flex: 0 0 auto; width: 20px; height: 20px; margin: 2px 0 0; padding: 0; }
.checkout-consent label { display: block; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.checkout-summary { background: #fff; padding: 0 16px; border: 1px solid #e0e0e0; border-radius: 12px; }
.checkout-summary-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.checkout-summary-row + .checkout-summary-row { border-top: 1px solid #eee; }
.checkout-summary-image { flex: 0 0 48px; width: 48px; height: 48px; }
.checkout-summary-image img, .checkout-image-placeholder { display: block; width: 48px; height: 48px; object-fit: cover; border-radius: 6px; background: #e0e0e0; }
.checkout-summary-details { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.checkout-summary p { margin: 0; }
.checkout-summary-title, .checkout-summary-price { font-size: 14px; font-weight: 700; }
.checkout-summary-variant, .checkout-summary-qty { font-size: 12px; color: #666; }
.checkout-summary-price { flex-shrink: 0; text-align: right; }
.checkout-summary-total { padding: 12px 0; border-top: 2px solid #ddd; font-size: 16px; font-weight: 700; }
@media (max-width: 767px) {
    .checkout-summary { order: -1; position: static; padding: 0 12px; }
    .checkout-summary-row { gap: 8px; padding: 8px 0; }
    .checkout-summary-image { flex-basis: 40px; width: 40px; height: 40px; }
    .checkout-summary-image img, .checkout-image-placeholder { width: 40px; height: 40px; }
    .checkout-summary-title, .checkout-summary-price { font-size: 13px; }
    .checkout-summary-variant, .checkout-summary-qty { font-size: 11px; }
    .checkout-summary-total { padding: 8px 0; font-size: 14px; }
}
@media (min-width: 768px) {
    .shop-container.checkout-container { padding: 0 16px; }
    .checkout-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (min-width: 768px) and (min-height: 700px) {
    .checkout-summary { position: sticky; top: 16px; max-height: calc(100dvh - 32px); overflow-y: auto; }
}
.checkout-payments { display: grid; gap: 12px; width: 100%; min-width: 0; --payment-button-height: 48px; }
.stripe-pay-button { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: var(--payment-button-height); padding: 0 .75rem; border: 1px solid #635bff; border-radius: 4px; background: #fff; color: #202124; line-height: 1.2; }
.stripe-pay-button:disabled { color: #fff; }
.stripe-wordmark { flex: 0 0 60px; }
#paypal-button-container { width: 100%; min-width: 0; min-height: var(--payment-button-height); line-height: 0; }
.total, .price-preview { font-weight: 700; }
.test-banner { padding: 1rem; background: #fff2bd; color: #302500; border: 1px solid #907300; }
.error { padding: 1rem; background: #ffe4e4; color: #8b0000; }
.shop-footer { padding: 2rem 1rem; text-align: center; }
.legal-page { max-width: 760px; margin: 0 auto; overflow-wrap: anywhere; }
.legal-page p { line-height: 1.6; }
.voucher-qr { max-width: 100%; height: auto; }
.cart-feedback { margin: 0; padding: 0 1rem; overflow-wrap: anywhere; }
.cart-feedback:not(:empty) { padding-block: .75rem; }
:focus-visible { outline: 3px solid #d78c00; outline-offset: 3px; }
.cart-title { font-size: 14px; }
.cart-card { max-width: 100%; min-width: 0; box-sizing: border-box; background: #fff; border: 1px solid #ddd; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.06); font-size: 12px; }
.cart-row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid #eee; }
/* Divide lo spazio netto dei due gap, mantenendo il rapporto 20/40/40. */
.cart-col-image { flex: 0 0 calc((100% - 16px) * .2); max-width: calc((100% - 16px) * .2); }
.cart-col-details, .cart-col-actions { flex: 0 0 calc((100% - 16px) * .4); max-width: calc((100% - 16px) * .4); min-width: 0; overflow-wrap: anywhere; }
.cart-col-image img, .cart-image-placeholder { display: block; width: 60px; max-width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 6px; background: #e0e0e0; }
.cart-item-title { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.4; }
.cart-item-variant, .cart-item-price { margin: 4px 0 0; font-size: 12px; color: #666; }
.cart-col-details form { display: block; margin: 6px 0 0; }
.cart-item-quantity { display: flex; align-items: center; gap: 2px; }
.cart-item-quantity input { flex: 0 0 40px; width: 40px; min-width: 0; padding: 4px 0; font-size: 13px; text-align: center; appearance: textfield; }
.cart-item-quantity input::-webkit-inner-spin-button, .cart-item-quantity input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.cart-item-quantity button { flex: 0 0 24px; padding: 4px 0; font-size: 13px; background: #f0f2f5; color: #202124; border: 1px solid #ddd; }
.cart-item-quantity button:disabled { opacity: .5; }
.cart-col-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.cart-col-actions form { display: none; }
.cart-col-actions button { padding: 6px 10px; font-size: 12px; }
.cart-col-actions .btn-remove { color: #b42318; background: #fff1f0; }
.cart-summary { padding: 12px; }
.cart-total { margin: 0 0 10px; font-weight: 700; }
.btn-checkout { display: block; width: 100%; padding: 12px; background: var(--color-primary, #1a73e8); color: #fff; border-radius: 8px; text-align: center; text-decoration: none; }
.cart-empty { font-size: 12px; }
@media (max-width: 767px) {
    .cart-row { padding: 8px 10px; }
    .cart-col-image img, .cart-image-placeholder { width: 48px; }
    .cart-item-title { font-size: 13px; }
    .cart-card, .cart-empty, .cart-item-variant, .cart-item-price, .cart-col-actions button { font-size: 11px; }
}
@media (min-width: 768px) {
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .product-card { flex-direction: row; }
    .product-media { width: 80px; height: 80px; }
    .product-gallery { width: 80px; }
    .product-thumbnails { display: grid; grid-template-columns: 48px; justify-content: center; overflow: visible; }
    .product-thumbnail:nth-child(n+4) { display: none; }
    .thumbnail-more { display: flex; }
    :root { --shop-padding: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
    .product-filters button, .product-card { transition: none; }
    .product-card:hover { transform: none; }
}
