/* Sliding cart drawer. */

.cart-is-open {
  overflow: hidden;
}

.cart-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  visibility: hidden;
  background: rgba(17, 17, 17, 0.48);
  opacity: 0;
  transition:
    opacity 180ms ease,
    visibility 180ms ease;
}

.cart-overlay.is-open {
  visibility: visible;
  opacity: 1;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 90;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(520px, 100vw);
  height: 100vh;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: -28px 0 70px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  transition: transform 220ms ease;
}

.cart-drawer.is-open {
  transform: translateX(0);
}

.cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 30px 20px;
  border-bottom: 1px solid var(--line);
}

.cart-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.cart-head h2 {
  margin: 6px 0 0;
  font-size: 24px;
}

.cart-close {
  display: inline-grid;
  place-items: center;
  width: 42px;
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 26px;
  line-height: 1;
}

.cart-items {
  display: grid;
  align-content: start;
  gap: 0;
  overflow-y: auto;
}

.cart-item {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 16px;
  padding: 22px 30px;
  border-bottom: 1px solid var(--line);
}

.cart-item img {
  width: 86px;
  aspect-ratio: 1;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--surface-soft);
}

.cart-item-info {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.cart-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.cart-item h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.cart-item-top button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.cart-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.cart-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cart-quantity {
  display: grid;
  grid-template-columns: 34px 38px 34px;
  align-items: center;
  border: 1px solid var(--line);
}

.cart-quantity button {
  min-height: 32px;
  border: 0;
  background: #fff;
  font-weight: 900;
}

.cart-quantity span {
  text-align: center;
  font-size: 13px;
  font-weight: 800;
}

.cart-empty {
  display: none;
  align-content: center;
  justify-items: center;
  gap: 14px;
  padding: 46px 30px;
  color: var(--muted);
  text-align: center;
}

.cart-empty.is-visible {
  display: grid;
}

.cart-empty strong {
  color: var(--text);
  font-size: 20px;
}

.cart-empty p {
  max-width: 280px;
  margin: 0;
  line-height: 1.5;
}

.cart-empty-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-left: 5px solid var(--accent);
  border-radius: 4px;
  background: #111;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
}

.cart-view-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid #111;
  border-left: 6px solid var(--accent);
  border-radius: 4px;
  color: #111;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
}

.cart-footer {
  display: grid;
  gap: 18px;
  padding: 24px 30px 30px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.cart-footer[hidden] {
  display: none;
}

.cart-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.cart-total span {
  color: var(--muted);
  font-weight: 800;
}

.cart-total strong {
  font-size: 24px;
}

.cart-checkout {
  min-height: 52px;
  border: 0;
  border-left: 6px solid var(--accent);
  border-radius: 4px;
  background: #000;
  color: #fff;
  font-weight: 900;
  text-transform: uppercase;
}

.cart-checkout:disabled {
  border-left-color: var(--line);
  background: #d8d8de;
  color: #777482;
  cursor: not-allowed;
}

.cart-page {
  max-width: 1240px;
  min-height: calc(100vh - 160px);
  margin: 0 auto;
  padding: 66px var(--page-edge) 92px;
  background: #fff;
}

.cart-page-head {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) 150px 180px 170px;
  align-items: end;
  gap: 24px;
  margin-bottom: 42px;
}

.cart-page-head > div {
  grid-column: 1 / 3;
}

.cart-page-head h1 {
  margin: 0;
  font-size: clamp(42px, 5vw, 64px);
  line-height: 1;
}

.cart-page-return {
  grid-column: 3 / 5;
  justify-self: end;
  color: #111;
  font-weight: 800;
  text-align: right;
  text-decoration: underline;
  text-underline-offset: 5px;
  white-space: nowrap;
}

.cart-page-empty {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 70px 24px;
  border-top: 1px solid #111;
  border-bottom: 1px solid #111;
  text-align: center;
}

.cart-page-empty[hidden],
.cart-page-content[hidden] {
  display: none;
}

.cart-page-empty h2 {
  margin: 0;
  font-size: clamp(30px, 4vw, 52px);
}

.cart-page-empty p {
  max-width: 440px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.cart-page-empty a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border-left: 6px solid var(--accent);
  border-radius: 4px;
  background: #111;
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

.cart-page-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 34px;
}

.cart-page-table {
  display: grid;
}

.cart-page-row {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) 150px 180px 170px;
  gap: 24px;
  align-items: center;
  border-bottom: 1px solid #111;
}

.cart-page-row-head {
  min-height: 46px;
  border-top: 1px solid #111;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.cart-page-row-head span {
  align-self: center;
  justify-self: center;
  text-align: center;
}

.cart-page-item {
  min-height: 118px;
  padding: 26px 0;
}

.cart-page-product {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  min-width: 0;
}

.cart-page-product img {
  width: 92px;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--surface-soft);
}

.cart-page-product span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.cart-page-product h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
}

.cart-page-product p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.cart-page-price {
  font-size: 16px;
}

.cart-page-quantity {
  display: inline-grid;
  grid-template-columns: 38px 44px 38px;
  justify-self: start;
  align-items: center;
  border: 1px solid var(--line);
}

.cart-page-quantity button {
  min-height: 36px;
  border: 0;
  background: var(--surface-soft);
  font-size: 18px;
  font-weight: 800;
}

.cart-page-quantity span {
  text-align: center;
  font-size: 13px;
  font-weight: 800;
}

.cart-page-line-total {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  gap: 12px;
  justify-items: end;
}

.cart-page-line-total strong {
  font-size: 17px;
}

.cart-page-line-total button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid #111;
  border-left: 6px solid var(--accent);
  border-radius: 4px;
  background: #fff;
  color: #111;
  font-size: 22px;
  line-height: 1;
}

.cart-page-summary {
  display: grid;
  justify-self: end;
  gap: 22px;
  width: min(100%, 390px);
  padding-top: 2px;
}

.cart-page-summary-line,
.cart-page-summary-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.cart-page-summary-line span,
.cart-page-delivery p {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.cart-page-summary-total {
  padding-top: 20px;
  border-top: 1px solid #111;
  font-size: 18px;
  font-weight: 900;
}

.cart-page-checkout {
  width: 100%;
  min-height: 54px;
  border: 1px solid #111;
  border-left: 6px solid var(--accent);
  border-radius: 4px;
  background: #111;
  color: #fff;
  font-weight: 900;
  text-transform: uppercase;
}

.cart-page-checkout:disabled {
  border-left-color: var(--line);
  background: #d8d8de;
  color: #777482;
}

.cart-page-delivery {
  display: grid;
  gap: 10px;
  margin-top: 6px;
  padding: 28px;
  border: 1px solid #111;
}

.cart-page-delivery h2 {
  margin: 0;
  font-size: 22px;
}

.cart-page-delivery p {
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 1100px) {
  .cart-page {
    max-width: none;
    padding: 56px var(--page-gutter) 78px;
  }

  .cart-page-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    margin-bottom: 34px;
  }

  .cart-page-head > div,
  .cart-page-return {
    grid-column: 1;
  }

  .cart-page-return {
    justify-self: start;
    text-align: left;
    white-space: normal;
  }

  .cart-page-content {
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .cart-page-row-head {
    display: none;
  }

  .cart-page-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .cart-page-item {
    padding: 24px 0;
  }

  .cart-page-price,
  .cart-page-line-total {
    display: flex;
    justify-content: space-between;
    justify-self: stretch;
    gap: 18px;
  }

  .cart-page-price::before {
    content: "Ціна";
    color: var(--muted);
    font-weight: 800;
  }

  .cart-page-quantity {
    justify-self: start;
  }

  .cart-page-line-total::before {
    content: "Разом";
    color: var(--muted);
    font-weight: 800;
  }

  .cart-page-summary {
    justify-self: stretch;
    width: min(100%, 420px);
    padding-top: 0;
  }
}

@media (max-width: 560px) {
  .cart-drawer {
      width: 100vw;
    }
  .cart-head,
    .cart-item,
    .cart-footer {
      padding-right: 18px;
      padding-left: 18px;
    }

  .cart-page {
    padding: 44px 18px 68px;
  }

  .cart-page-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    margin-bottom: 34px;
  }

  .cart-page-head > div,
  .cart-page-return {
    grid-column: 1;
  }

  .cart-page-return {
    justify-self: start;
  }

  .cart-page-head h1 {
    font-size: 44px;
  }

  .cart-page-content {
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .cart-page-row-head {
    display: none;
  }

  .cart-page-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .cart-page-item {
    padding: 22px 0;
  }

  .cart-page-product {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 16px;
  }

  .cart-page-product img {
    width: 82px;
  }

  .cart-page-price,
  .cart-page-line-total {
    display: flex;
    justify-content: space-between;
    justify-self: stretch;
    gap: 18px;
  }

  .cart-page-price::before {
    content: "Ціна";
    color: var(--muted);
    font-weight: 800;
  }

  .cart-page-quantity {
    justify-self: start;
  }

  .cart-page-line-total::before {
    content: "Разом";
    color: var(--muted);
    font-weight: 800;
  }

  .cart-page-summary {
    padding-top: 0;
  }

  .cart-page-delivery {
    margin-top: 30px;
    padding: 22px;
  }
}
