/*
 * vandrangl-art – checkout-layout.css
 * Checkout page only (not order-received), see inc/enqueue.php.
 *
 * Turns the Checkout block's sidebar layout into a grid:
 *   wide:   [ order summary 1fr | EU guarantee label ≤600px ]
 *           [ checkout form (full width)                     ]
 *   narrow: summary → label → form (one column)
 *
 * WooCommerce 11 switches its layout via container queries on
 * .wp-block-woocommerce-checkout (container-type: inline-size,
 * breakpoint 700px), so the @container rules below measure the same
 * box WC does. No display: contents on WC containers.
 * The grid only applies once the label is present (:has), so a JS
 * failure leaves WC's own layout untouched.
 */

.wp-block-woocommerce-checkout .wc-block-components-sidebar-layout:has(> .vr-eu-guarantee) {
  display: grid;
  /* Summary keeps a usable width; the label scales down instead */
  grid-template-columns: minmax(340px, 1fr) minmax(0, 600px);
  grid-template-areas:
    "summary label"
    "main    main";
  column-gap: var(--space-xl);
  row-gap: var(--space-xl);
  align-items: start;
}

.wp-block-woocommerce-checkout .wc-block-components-sidebar-layout:has(> .vr-eu-guarantee) > .wc-block-checkout__sidebar {
  grid-area: summary;
  width: auto;
  margin: 0;
  padding: 0;
  /* No sticky summary – it sits above the form now */
  position: static;
}

.wp-block-woocommerce-checkout .wc-block-components-sidebar-layout:has(> .vr-eu-guarantee) > .wc-block-checkout__main {
  grid-area: main;
  /* Desktop: form doesn't need the full width (reset in the stacked layout) */
  width: 70%;
  margin: 0;
  padding: 0;
}

/* The label: only ever scaled proportionally – never cropped */
.vr-eu-guarantee {
  grid-area: label;
  display: block;
  min-width: 0;
}

.vr-eu-guarantee img {
  display: block;
  width: 100%;
  max-width: 600px;
  height: auto;
}

/* Too narrow for summary + label side by side: stack like mobile */
@container (max-width: 799px) {
  .wp-block-woocommerce-checkout .wc-block-components-sidebar-layout:has(> .vr-eu-guarantee) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "summary"
      "label"
      "main";
    row-gap: var(--space-lg);
  }

  .wp-block-woocommerce-checkout .wc-block-components-sidebar-layout:has(> .vr-eu-guarantee) > .wc-block-checkout__main {
    width: auto;
  }
}

/* Mobile: label spans the full container width */
@container (max-width: 699px) {
  .vr-eu-guarantee img {
    max-width: none;
  }
}
