.cart-nav-link,
.floating-cart {
  text-decoration: none;
}

.cart-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.cart-count-badge,
.floating-cart-count {
  display: inline-grid;
  min-width: 1.35rem;
  height: 1.35rem;
  place-items: center;
  border-radius: 999px;
  background: #b66345;
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 950;
  line-height: 1;
}

.floating-cart {
  position: fixed;
  right: clamp(0.9rem, 3vw, 1.4rem);
  bottom: clamp(0.9rem, 3vw, 1.4rem);
  z-index: 80;
  display: inline-grid;
  width: 3.65rem;
  height: 3.65rem;
  place-items: center;
  background: #181613;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  color: #ffffff;
  box-shadow: 0 18px 48px rgba(24, 22, 19, 0.26);
  transition: box-shadow 220ms ease, background 220ms ease;
}

.floating-cart:hover,
.floating-cart:focus-visible {
  background: #b66345;
  box-shadow: 0 0 0 4px rgba(182, 99, 69, 0.22), 0 18px 48px rgba(24, 22, 19, 0.26);
}

.floating-cart svg {
  width: 1.45rem;
  height: 1.45rem;
}

.floating-cart-count {
  position: absolute;
  top: -0.2rem;
  right: -0.1rem;
}

.floating-cart-label {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.cart-preview {
  position: fixed;
  top: clamp(4.6rem, 9vw, 5.8rem);
  right: clamp(0.9rem, 3vw, 1.4rem);
  z-index: 120;
  display: grid;
  width: min(23rem, calc(100vw - 1.8rem));
  gap: 0.85rem;
  padding: 1rem;
  background: #fffdf8;
  border: 1px solid rgba(24, 22, 19, 0.14);
  border-radius: 8px;
  color: #181613;
  box-shadow: 0 22px 62px rgba(24, 22, 19, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, -0.55rem, 0) scale(0.98);
  transition: opacity 240ms ease, transform 360ms cubic-bezier(0.16, 1, 0.3, 1);
}

.cart-preview.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
}

.cart-preview-close {
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  display: inline-grid;
  width: 1.7rem;
  height: 1.7rem;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(24, 22, 19, 0.07);
  color: #181613;
  cursor: pointer;
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
}

.cart-preview-head,
.cart-preview-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.cart-preview-head {
  padding-right: 2rem;
}

.cart-preview-head span,
.cart-preview-total span {
  color: #71695f;
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cart-preview-head strong,
.cart-preview-total strong {
  font-size: 0.92rem;
}

.cart-preview-product {
  display: grid;
  grid-template-columns: 4.8rem minmax(0, 1fr);
  gap: 0.85rem;
  align-items: center;
  min-width: 0;
}

.cart-preview-product img {
  width: 4.8rem;
  height: 5.8rem;
  object-fit: cover;
  border-radius: 8px;
  background: #f3eadf;
}

.cart-preview-product strong {
  display: block;
  overflow: hidden;
  margin-bottom: 0.22rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cart-preview-product p {
  margin: 0 0 0.26rem;
  color: #71695f;
  font-size: 0.9rem;
  line-height: 1.35;
}

.cart-preview-product span {
  color: #b66345;
  font-size: 0.95rem;
  font-weight: 900;
}

.cart-preview-total {
  padding-top: 0.75rem;
  border-top: 1px solid rgba(24, 22, 19, 0.12);
}

.cart-preview-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
}

.cart-preview-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.55rem;
  border: 1px solid rgba(24, 22, 19, 0.16);
  border-radius: 999px;
  padding: 0.62rem 0.9rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.cart-preview-button.primary {
  background: #181613;
  border-color: #181613;
  color: #ffffff;
}

.cart-preview-button.ghost {
  background: #fffdf8;
  color: #181613;
}

.cart-preview-button:hover,
.cart-preview-button:focus-visible,
.cart-preview-close:hover,
.cart-preview-close:focus-visible {
  box-shadow: 0 0 0 3px rgba(182, 99, 69, 0.18);
  outline: 0;
}

@media (max-width: 640px) {
  .floating-cart {
    width: 3.35rem;
    height: 3.35rem;
  }

  .cart-preview {
    top: 0.85rem;
    right: 0.85rem;
    left: 0.85rem;
    width: auto;
  }

  .cart-preview-actions {
    grid-template-columns: 1fr;
  }
}
