.cart {
  @include bg-color(filled);
  border: $border;
  border-radius: border-radius(1);

  & > :not(:first-child) {
    border-top: $border;
  }
}

.cart[role="list"] > [role="listitem"] {
  display: grid;

  & > :first-child {
    $image-size-sm: size(3.625);
    display: grid;
    grid-template-columns: $image-size-sm 1fr auto;
    gap: spacer(4);
    padding: spacer(4);

    @include breakpoint-up(sm) {
      grid-template-columns: size(8.5) 1fr auto;
      padding: 0;
      padding-right: spacer(4);
    }

    & > figure {
      background: url("~images/placeholders/product-cover.png") center;
      background-size: cover;
      aspect-ratio: 1;
      border: $border;
      border-radius: border-radius(1);
      overflow: hidden;

      @include breakpoint-up(sm) {
        border: none;
        border-right: $border;
        border-radius: 0;
        height: 100%;
      }

      img {
        width: 100%;
        height: 100%;
      }
    }

    ul {
      display: grid;
      gap: spacer(1) spacer(4);
      padding: 0;
      list-style: none;

      @include breakpoint-up(sm) {
        display: flex;
        flex-wrap: wrap;
      }
    }

    & > section {
      display: flex;
      flex-direction: column;
      gap: spacer(1);

      @include breakpoint-up(sm) {
        padding: spacer(4) 0;
      }

      &:last-child {
        align-items: end;
      }

      footer {
        margin-top: auto;
      }
    }

    h4 {
      font-weight: bold;
      @include max-lines(2);
    }
  }

  @include breakpoint-up(sm) {
    &:first-child > :first-child > figure {
      border-top-left-radius: border-radius(1);
    }
    &:last-child > :only-child > figure {
      border-bottom-left-radius: border-radius(1);
    }
  }

  .footer {
    display: grid;
    gap: spacer(4);
    padding: spacer(4);
    border-top: $border;

    & > [role="listitem"] > :first-child {
      @include breakpoint-up(sm) {
        grid-template-columns: size(6.5) 1fr auto;
      }
    }
  }
}

.cart > .cart-summary {
  padding: spacer(4);
  display: grid;
  gap: spacer(4);

  & > * {
    display: grid;
    gap: spacer(4);
    grid-auto-flow: column;
    justify-content: space-between;
  }

  h4 {
    display: inline-flex;
    flex-wrap: wrap;
    gap: spacer(2);
  }
}

.cart > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: spacer(4);

  & > * {
    @include font-size(3);
  }
}
