/* Commerce example article. All rules are scoped to its cards or demo mounts. */
.wb-slot-main article.wb-card:has(> .wb-card-header h2[id^="commerce-in-action-example-"]) {
  > .wb-card-header {
    padding: clamp(0.85rem, 2.5vw, 1.2rem);
    background: color-mix(in srgb, var(--wb-accent) 8%, var(--wb-surface));

    > .wb-grid {
      align-items: center;

      @media (min-width: 621px) {
        grid-template-columns: minmax(0, min(28%, 17.5rem)) minmax(0, 1fr);
      }
    }

    img {
      display: block;
      inline-size: 100%;
      aspect-ratio: 3 / 2;
      max-block-size: 10rem;
      object-fit: cover;
      border-radius: var(--wb-r-md);
    }

    h2 {
      font-size: clamp(1.25rem, 2.65vw, 1.75rem);
      scroll-margin-block-start: 6rem;
    }
  }
}

.commerce-example-demo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;

  & [hidden] { display: none !important; }

  & .panel {
    min-width: 0;
    padding: clamp(0.8rem, 2.25vw, 1.1rem);
    border: 1px solid var(--wb-border);
    border-radius: var(--wb-r-md);
  }

  & :is(h3, p, ul, dl, dd) { margin: 0; }
  & h3 { margin-block-end: 0.6rem; font-size: 1.03rem; }
  & .products { list-style: none; padding: 0; }

  & :is(.control-row, .summary-row) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding-block: 0.45rem;
  }

  & :is(.control-row + .control-row, .summary-row + .summary-row) {
    border-block-start: 1px solid var(--wb-border);
  }

  & .summary-row dd { text-align: end; min-width: 0; overflow-wrap: anywhere; }
  & :is(.price, .quantity, .summary-row dd) { font-variant-numeric: tabular-nums; }
  & :is(.price, .item-count, .status, label, .checkout-note) { font-size: 0.875rem; }
  & .total { font-weight: 650; }
  & .quantity { min-width: 2ch; text-align: center; }

  & :is(.actions, .quantity-controls, .discount-control) {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  & :is(.actions, .discount-control, .status) { margin-block-start: 0.7rem; }
  & .status:empty { margin: 0; }
  & .status { font-weight: 650; }
  & label { flex-basis: 100%; font-weight: 650; }
  & input { width: min(10rem, 100%); min-width: 0; }

  & .receipt {
    margin-block-start: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--wb-r-md);
    background: color-mix(in srgb, var(--wb-accent) 8%, var(--wb-surface));
  }

  & :focus-visible { outline: 2px solid var(--wb-accent); outline-offset: 3px; }

  @media (max-width: 670px) {
    grid-template-columns: minmax(0, 1fr);
    & :is(button, input) { min-block-size: 44px; }
  }

  @media (max-width: 370px) {
    & .control-row { flex-wrap: wrap; }
  }
}