/* Responsive foundations for present and future WooCommerce screen modules. */
@media (max-width: 1024px) {
  .kanteen-child-commerce.single-product div.product[id^='product-'] {
    column-gap: var(--kanteen-space-5);
  }

  .kanteen-child-commerce.single-product .kanteen-product-trust {
    grid-template-columns: minmax(0, 1fr);
  }

  .kanteen-child-commerce.single-product div.product :is(.related, .upsells) ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kanteen-child-commerce .kanteen-shop-layout {
    gap: var(--kanteen-space-5);
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .kanteen-child-commerce .kanteen-shop-results ul.products {
    gap: var(--kanteen-space-5);
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kanteen-child-commerce .kanteen-commerce-shell {
    padding-inline: var(--kanteen-space-5);
  }

  .kanteen-child-commerce .kanteen-commerce-hero {
    padding-block: var(--kanteen-space-6) var(--kanteen-space-5);
  }

  .kanteen-child-commerce.woocommerce-shop:has(.header-wrap) .kanteen-shop-hero {
    padding-top: calc(var(--kanteen-transparent-header-height) + var(--kanteen-space-6));
  }
}

@media (max-width: 768px) {
  .kanteen-child-commerce.single-product div.product[id^='product-'] {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--kanteen-space-6);
  }

  .kanteen-child-commerce.single-product #content div.product[id^='product-'] > .summary {
    grid-column: 1;
    grid-row: 2;
  }

  .kanteen-child-commerce.single-product div.product .woocommerce-tabs ul.tabs li {
    display: block;
    margin: 0;
  }

  .kanteen-child-commerce .kanteen-shop-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .kanteen-child-commerce .kanteen-filter-toggle {
    margin-bottom: var(--kanteen-space-4);
    width: 100%;
  }

  .kanteen-child-commerce .kanteen-shop-results :is(.woocommerce-result-count, .woocommerce-ordering) {
    float: none;
    line-height: 1.5;
    width: 100%;
  }

  .kanteen-child-commerce main {
    overflow-wrap: anywhere;
  }

  .kanteen-child-commerce .kanteen-commerce-shell {
    padding-inline: var(--kanteen-space-4);
  }

  .kanteen-child-commerce :is(.wc-block-cart, .wp-block-woocommerce-cart, .wp-block-woocommerce-checkout, .wc-block-checkout, .woocommerce-cart-form, .woocommerce-checkout) {
    grid-template-columns: minmax(0, 1fr);
  }

  .kanteen-child-commerce :is(.wc-block-cart__sidebar, .wc-block-checkout__sidebar, .cart-collaterals, .order-review) {
    min-width: 0;
    width: 100%;
  }

  .kanteen-child-commerce main :is(input:not([type='checkbox']):not([type='radio']), select, textarea, .wc-block-components-text-input input, .wc-block-components-combobox .wc-block-components-combobox-control) {
    box-sizing: border-box;
    max-width: none;
    width: 100%;
  }

  .kanteen-child-commerce main :is(button, input[type='button'], input[type='submit'], input[type='reset'], .button, .wc-block-components-button) {
    min-height: 44px;
  }

  /* Cart Block rows become cards while retaining its native controls and table semantics. */
  .kanteen-child-commerce .wp-block-woocommerce-cart {
    min-width: 0;
    padding-block: var(--kanteen-space-6) var(--kanteen-space-7);
  }

  .kanteen-child-commerce .wp-block-woocommerce-cart .wc-block-cart {
    display: grid;
    gap: var(--kanteen-space-6);
    grid-template-columns: minmax(0, 1fr);
  }

  .kanteen-child-commerce .wp-block-woocommerce-cart .wc-block-cart__sidebar {
    grid-row: 2;
    position: static;
  }

  .kanteen-child-commerce .wp-block-woocommerce-cart .wc-block-cart > .kanteen-cart-secure-payment {
    grid-column: 1;
    grid-row: 3;
  }

  .kanteen-child-commerce .wp-block-woocommerce-cart table.wc-block-cart-items,
  .kanteen-child-commerce .wp-block-woocommerce-cart table.wc-block-cart-items tbody {
    display: block;
    width: 100%;
  }

  .kanteen-child-commerce .wp-block-woocommerce-cart table.wc-block-cart-items thead {
    display: none;
  }

  .kanteen-child-commerce .wp-block-woocommerce-cart table.wc-block-cart-items .wc-block-cart-items__row {
    display: grid;
    gap: var(--kanteen-space-3) var(--kanteen-space-4);
    grid-template-columns: 84px minmax(0, 1fr);
    padding-block: var(--kanteen-space-5);
    width: 100%;
  }

  .kanteen-child-commerce .wp-block-woocommerce-cart table.wc-block-cart-items .wc-block-cart-items__row > td {
    box-sizing: border-box;
    min-width: 0;
    padding: 0;
  }

  .kanteen-child-commerce .wp-block-woocommerce-cart table.wc-block-cart-items .wc-block-cart-items__row > .wc-block-cart-item__image {
    grid-column: 1;
    grid-row: 1 / span 2;
    padding: 0;
  }

  .kanteen-child-commerce .wp-block-woocommerce-cart table.wc-block-cart-items .wc-block-cart-items__row > .wc-block-cart-item__product {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .kanteen-child-commerce .wp-block-woocommerce-cart .wc-block-cart-item__quantity {
    justify-content: space-between;
  }

  .kanteen-child-commerce .wp-block-woocommerce-cart table.wc-block-cart-items .wc-block-cart-items__row > .wc-block-cart-item__total {
    grid-column: 2;
    grid-row: 2;
    text-align: left;
  }

  .kanteen-child-commerce .wp-block-woocommerce-cart .wc-block-cart-item__remove-link {
    margin-left: auto;
  }

  .kanteen-child-commerce .wp-block-woocommerce-cart .wc-block-components-totals-wrapper {
    padding: var(--kanteen-space-5);
  }

  .kanteen-child-commerce .wp-block-woocommerce-cart .wc-block-components-totals-coupon__form,
  .kanteen-child-commerce .wp-block-woocommerce-checkout .wc-block-components-totals-coupon__form {
    align-items: stretch;
    flex-direction: column;
    flex-wrap: nowrap;
  }

  .kanteen-child-commerce .wp-block-woocommerce-cart .wc-block-components-totals-coupon__form .wc-block-components-text-input,
  .kanteen-child-commerce .wp-block-woocommerce-checkout .wc-block-components-totals-coupon__form .wc-block-components-text-input {
    flex: 0 1 auto;
  }

  .kanteen-child-commerce .wp-block-woocommerce-cart .wc-block-components-totals-coupon__form :is(.wc-block-components-text-input, input, button),
  .kanteen-child-commerce .wp-block-woocommerce-checkout .wc-block-components-totals-coupon__form :is(.wc-block-components-text-input, input, button) {
    width: 100%;
  }

  .kanteen-child-commerce .wc-block-cart__empty-cart {
    padding: var(--kanteen-space-6) var(--kanteen-space-4);
  }

  /* Checkout Block: preserve DOM order and consent/payment controls while stacking. */
  .kanteen-child-commerce .wp-block-woocommerce-checkout {
    max-width: 100%;
    min-width: 0;
    padding-block: var(--kanteen-space-6) var(--kanteen-space-7);
  }

  .kanteen-child-commerce .wp-block-woocommerce-checkout .wc-block-checkout.wc-block-components-sidebar-layout {
    column-gap: 0;
    display: grid;
    gap: var(--kanteen-space-6);
    grid-template-columns: minmax(0, 1fr);
  }

  .kanteen-child-commerce .wp-block-woocommerce-checkout .wc-block-checkout.wc-block-components-sidebar-layout > .wc-block-checkout__main,
  .kanteen-child-commerce .wp-block-woocommerce-checkout .wc-block-checkout.wc-block-components-sidebar-layout > .wc-block-checkout__sidebar {
    grid-column: 1;
    min-width: 0;
    width: 100%;
  }

  .kanteen-child-commerce .wp-block-woocommerce-checkout .wc-block-checkout.wc-block-components-sidebar-layout > .wc-block-checkout__sidebar {
    grid-row: 2;
    position: static;
  }

  .kanteen-child-commerce .wp-block-woocommerce-checkout .wc-block-components-address-form :is(.wc-block-components-address-form__first_name, .wc-block-components-address-form__last_name, .wc-block-components-address-form__email, .wc-block-components-address-form__phone) {
    flex-basis: 100%;
  }

  .kanteen-child-commerce .wp-block-woocommerce-checkout .wc-block-components-order-summary,
  .kanteen-child-commerce .wp-block-woocommerce-checkout .wp-block-woocommerce-checkout-order-summary-block {
    padding: var(--kanteen-space-5);
  }

  .kanteen-child-commerce .wp-block-woocommerce-checkout .wc-block-components-shipping-rates-control,
  .kanteen-child-commerce .wp-block-woocommerce-checkout .wc-block-components-radio-control-accordion-option,
  .kanteen-child-commerce .wp-block-woocommerce-checkout .wc-block-components-checkout-terms,
  .kanteen-child-commerce .wp-block-woocommerce-checkout .wc-block-checkout__use-address-for-billing {
    max-width: 100%;
    min-width: 0;
  }
}

/* WooCommerce uses a compact expandable summary on is-mobile checkouts.
   Keep that native panel first and hide its duplicate full-detail fill block. */
@media (max-width: 699px) {
  .kanteen-child-commerce .wp-block-woocommerce-checkout .wc-block-checkout.is-mobile > .wc-block-checkout__sidebar {
    grid-row: 1;
  }

  .kanteen-child-commerce .wp-block-woocommerce-checkout .wc-block-checkout.is-mobile > .wc-block-checkout__main {
    grid-row: 2;
  }

  .kanteen-child-commerce .wp-block-woocommerce-checkout .wc-block-checkout.is-mobile .checkout-order-summary-block-fill-wrapper {
    display: none;
  }
}

@media (max-width: 540px) {
  .kanteen-child-commerce.single-product div.product .single_add_to_cart_button {
    clear: both;
    width: 100%;
  }

  .kanteen-child-commerce.single-product div.product :is(.related, .upsells) ul.products {
    grid-template-columns: minmax(0, 1fr);
  }

  .kanteen-child-commerce .kanteen-shop-results ul.products {
    grid-template-columns: minmax(0, 1fr);
  }

  .kanteen-child-commerce .kanteen-commerce-shell {
    padding-inline: var(--kanteen-space-3);
  }

  .kanteen-child-commerce .kanteen-commerce-hero {
    padding-block: var(--kanteen-space-5) var(--kanteen-space-4);
  }

  .kanteen-child-commerce .kanteen-button:not(.kanteen-buybar__cta) {
    width: 100%;
  }
}
