@font-face {
  font-family: 'Red Hat Text';
  src: url('./assets/fonts/RedHatText-VariableFont_wght.ttf');
  font-style: normal;
}

@font-face {
  font-family: 'Red Hat Text';
  src: url('./assets/fonts/RedHatText-Italic-VariableFont_wght.ttf');
  font-style: italic;
}


/* 1. Use a more-intuitive box-sizing model */
*, *::before, *::after {
  box-sizing: border-box;
}
/* 2. Remove default margin */
* {
  margin: 0;
}
/* 3. Enable keyword animations */
@media (prefers-reduced-motion: no-preference) {
  html {
    interpolate-size: allow-keywords;
  }
}
html {
  font-family: 'Red Hat Text', sans-serif;
}
body {
  /* 4. Add accessible line-height */
  line-height: 1.5;
  /* 5. Improve text rendering */
  -webkit-font-smoothing: antialiased;
}
/* 6. Improve media defaults */
img, picture, video, canvas, svg {
  border-radius: inherit;
  display: block;
  max-width: 100%;
}
/* 7. Inherit fonts for form controls */
input, button, textarea, select {
  font: inherit;
}
/* 8. Avoid text overflows */
p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}
/* 9. Improve line wrapping */
p, span {
  font-weight: 400;
  text-wrap: pretty;
}
h1, h2, h3, h4, h5, h6 {
  font-family: 'Red Hat Text', sans-serif;
  text-wrap: balance;
}

:root {
  --red: hsl(14, 86%, 42%);
  --green: hsl(159, 69%, 38%);
  --white: hsl(100, 100%, 100%);
  --rose-50: hsl(20, 50%, 98%);
  --rose-100: hsl(13, 31%, 94%);
  --rose-300: hsl(14, 25%, 72%);
  --rose-400: hsl(7, 20%, 60%);
  --rose-500: hsl(12, 20%, 44%);
  --rose-900: hsl(14, 65%, 9%);
}

main {
  background-color: var(--rose-50);
  padding: clamp(1.5rem, 2vw, 3rem);
}

.container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin: 0 auto;
  max-width: 100rem;
  width: 100%;
}

.product__section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

.product__section-headline {
  font-size: 2.5rem;
}

.product__section-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.product {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.product__image-wrapper {
  align-items: center;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
}

.product__add-to-cart {
  background-color: var(--white);
  border: 1px solid var(--rose-400);
  border-radius: 2rem;
  color: var(--rose-900);
  cursor: pointer;
  font-weight: 600;
  display: flex;
  gap: 0.5rem;
  margin: -1.75rem auto 0;
  max-width: 180px;
  padding: 0.75rem 1.5rem;
  transition: border-color 0.3s, color 0.3s;
  width: 100%;
  z-index: 100;
}

.product__add-to-cart:hover, .product__add-to-cart:focus {
  border-color: var(--red);
  color: var(--red);
}

.product__add-to-cart:focus-visible {
  outline: 2px solid var(--red);
}

.product__quantity-selector {
  align-items: center;
  background-color: var(--red);
  border-radius: 2rem;
  display: flex;
  justify-content: space-between;
  margin: -1.75rem auto 0;
  max-width: 180px;
  padding: 0.75rem 1rem;
  width: 100%;
}

.quantity-value {
  color: var(--white);
}

.quantity-decrease, .quantity-increase {
  border: 1px solid var(--white);
  border-radius: 50%;
  background-color: transparent;
  cursor: pointer;
  outline: none;
  height: 100%;
  width: auto;
}

.product__info-wrapper {
  display: flex;
  flex-direction: column;
}

.product__info-category {
  color: var(--rose-500);
  font-weight: 400;
}

.product__info-title {
  color: var(--rose-900);
  font-weight: 600;
}

.product__info-price {
  color: var(--red);
  font-size: 1.125rem;
  font-weight: 600;
}

.cart__section {
  align-self: flex-start;
  background-color: var(--white);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  font-size: 0.875rem;
  gap: 1.5rem;
  padding: 1.5rem;
  width: 100%;
}

.cart__section-headline {
  color: var(--red);
  font-size: 1.5rem;
}

.cart__counter {
  font-weight: 700;
}

.cart__list-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cart__line-item {
  border-block-end: 1px solid var(--rose-100);
  display: grid;
  grid-template: repeat(3, auto) / repeat(3, auto);
  gap: 0.5rem;
}

.cart__line-item-title {
  color: var(--rose-900);
  font-size: 0.875rem;
  grid-column: 1/-1;
}

.cart__line-item-quantity {
  color: var(--red);
  font-weight: 600;
}

.cart__line-item-info-wrapper {
  display: flex;
  gap: 1rem;
  padding-block-end: 0.5rem;
}

.cart__line-item-price {
  color: var(--rose-400);
  font-weight: 600;
}

.cart__line-item-subtotal {
  color: var(--rose-500);
  font-weight: 600;
  margin-inline-start: -0.5rem;
}

.cart__line-item-button-removal {
  align-self: center;
  background-color: transparent;
  border: 1px solid var(--rose-300);
  border-radius: 50%;
  cursor: pointer;
  grid-column: -1;
  grid-row: 1/-1;
  justify-self: center;
  margin-block-end: 0.5rem;
  outline: none;
  padding: 0.25rem;
}

.cart__subtotal-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cart__subtotal {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.cart__subtotal {
  color: var(--rose-500);
}

.cart__subtotal-amount {
  color: var(--rose-900);
  font-weight: 700;
  font-size: 1.5rem;
}

.carbon-neutral-delivery {
  background-color: var(--rose-50);
  border-radius: 8px;
  color: var(--rose-900);
  display: flex;
  gap: 0.25rem;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  width: 100%;
}

.emphasis {
  font-weight: 600;
}

.cart__confirm-order-button {
  background-color: var(--red);
  border: 1px solid var(--red);
  border-radius: 2rem;
  color: var(--rose-50);
  cursor: pointer;
  margin-block-start: 0.5rem;
  padding: 0.75rem 1.5rem;
  transition: background-color 0.3s, color 0.3s;
}

.cart__confirm-order-button:hover, .cart__confirm-order-button:focus {
  background-color: hsl(14, 86%, 36%);
}

.cart__empty-icon {
  margin: 0 auto;
}

.cart__empty-text {
  color: var(--rose-400);
  font-weight: 600;
  text-align: center;
}

.confirmation-order__dialog {
  align-items: flex-start;
  border: none;
  bottom: 0;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  flex-direction: column;
  gap: 1rem;
  max-width: none;
  padding: clamp(1.5rem, 2vw, 3rem);
  top: auto;
  width: 100%;
}

.confirmation-order__dialog:open {
  display: flex;
}

.confirmation-order__dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.5);
}

.confirmation-order__headline {
  font-size: 2.5rem;
  line-height: 1.2;
}

.confirmation-order__list {
  background-color: var(--rose-50);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  width: 100%;
}

.order__line-item {
  align-items: center;
  border-block-end: 1px solid var(--rose-100);
  display: grid;
  grid-template: repeat(2, auto) / repeat(2, auto);
  height: 100%;
  width: 100%;
}

.order__line-item-thumbnail {
  border-radius: 8px;
  max-height: 4rem;
  width: auto;
}

.order__line-item-title {
  color: var(--rose-900);
  font-size: 0.875rem;
  grid-column: 1/-1;
}

.order__line-item-quantity {
  color: var(--red);
  font-weight: 600;
}

.order__line-item-info-wrapper {
  display: flex;
  gap: 1rem;
}

.order__line-item-price {
  color: var(--rose-400);
  font-weight: 500;
}

.order__line-item-subtotal {
  align-self: center;
  color: var(--rose-500);
  font-weight: 700;
  grid-column: -1;
  grid-row: 1/-1;
  justify-self: flex-end;
}

.order-total__wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.order-total {
  align-items: center;
  color: var(--rose-500);
  display: flex;
  justify-content: space-between;
}

.order-total__amount {
  color: var(--rose-900);
  font-size: 1.5rem;
  font-weight: 700;
}

.new-order__button {
  background-color: var(--red);
  border: 1px solid var(--red);
  border-radius: 2rem;
  color: var(--rose-50);
  cursor: pointer;
  margin-block-start: 0.5rem;
  padding: 0.75rem 1.5rem;
  transition: background-color 0.3s, color 0.3s;
  width: 100%;
}

@media only screen and (min-width: 64rem) {
  main {
    flex-direction: row;
  }

  .container {
    flex-direction: row;
  }

  .product__section-list {
    grid-template-columns: repeat(auto-fit, minmax(clamp(300px, 20vw, 350px), 1fr));
  }

  .cart__section {
    box-sizing: content-box;
    width: clamp(400px, 20vw, 500px);
  }

  .confirmation-order__dialog {
    border-radius: 8px;
    bottom: 50%;
    left: 50%;
    max-width: 500px;
    transform: translate(-50%, 50%);
    width: 100%;
  }
}