/**
 * Off-canvas cart drawer (Figma 42:925).
 *
 * @package Atsko
 */

.cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 400;
  pointer-events: none;
}

.cart-drawer:not([hidden]) {
  pointer-events: auto;
}

.cart-drawer[hidden] {
  display: block !important;
  visibility: hidden;
}

.cart-drawer__overlay {
  position: absolute;
  inset: 0;
  background: rgba(54, 54, 54, 0.55);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.cart-drawer.is-open .cart-drawer__overlay {
  opacity: 1;
}

.cart-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  width: min(100%, 26.5rem);
  height: 100%;
  background: var(--atsko-white);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  transition: transform 0.28s ease;
  box-sizing: border-box;
}

.cart-drawer.is-open .cart-drawer__panel {
  transform: translateX(0);
}

.cart-drawer__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.cart-drawer__close img {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
}

.cart-drawer__fragment,
.cart-drawer__inner {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.cart-drawer__header {
  flex: 0 0 auto;
  padding: 1.75rem 3.5rem 0.75rem 1.5rem;
}

.cart-drawer__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--atsko-charcoal);
}

.cart-drawer__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 1.5rem 1.5rem;
  min-height: 0;
}

.cart-drawer__empty {
  margin: 0 0 1.75rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--atsko-charcoal);
}

/* —— Line items —— */
.cart-drawer__items {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.cart-drawer__item {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
}

.cart-drawer__item-media {
  width: 5rem;
  height: 5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--atsko-gray-100);
  border-radius: 4px;
  overflow: hidden;
}

.cart-drawer__item-media a {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
}

.cart-drawer__item-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.cart-drawer__item-title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--atsko-charcoal);
}

.cart-drawer__item-title a {
  color: inherit;
  text-decoration: none;
}

.cart-drawer__item-title a:hover {
  color: var(--atsko-blue);
}

.cart-drawer__item-price {
  margin: 0 0 0.5rem;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--atsko-orange);
}

.cart-drawer__item-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--atsko-charcoal);
  border-radius: 4px;
  overflow: hidden;
}

.cart-drawer__qty-btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  background: var(--atsko-white);
  font-size: 1rem;
  line-height: 1;
  color: var(--atsko-charcoal);
  cursor: pointer;
}

.cart-drawer__qty-input {
  width: 2.25rem;
  height: 2rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-inline: 1px solid var(--atsko-gray-200);
  text-align: center;
  font-size: 0.875rem;
  color: var(--atsko-charcoal);
  -moz-appearance: textfield;
}

.cart-drawer__qty-input::-webkit-outer-spin-button,
.cart-drawer__qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cart-drawer__item-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0.7;
}

.cart-drawer__item-remove:hover {
  opacity: 1;
}

.cart-drawer__item-remove img {
  width: 1rem;
  height: 1rem;
}

/* —— Upsells —— */
.cart-drawer__upsells {
  margin-top: 0.5rem;
}

.cart-drawer__upsells-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.cart-drawer__upsells-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--atsko-charcoal);
}

.cart-drawer__upsells-nav {
  display: inline-flex;
  gap: 0.25rem;
}

.cart-drawer__nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.cart-drawer__nav-btn[disabled] {
  opacity: 0.35;
  cursor: default;
}

.cart-drawer__upsells-track {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.cart-drawer__upsells-track::-webkit-scrollbar {
  display: none;
}

.cart-drawer__upsells-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1rem;
}

.cart-drawer__upsell {
  flex: 0 0 calc(50% - 0.5rem);
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  box-sizing: border-box;
}

.cart-drawer__upsell-media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 7.5rem;
}

.cart-drawer__upsell-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.cart-drawer__upsell-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--atsko-charcoal);
}

.cart-drawer__upsell-title a {
  color: inherit;
  text-decoration: none;
}

.cart-drawer__upsell-title a:hover {
  color: var(--atsko-blue);
}

.cart-drawer__upsell-price {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.4;
}

.cart-drawer__upsell-price-prefix {
  font-weight: 400;
  color: var(--atsko-charcoal);
}

.cart-drawer__upsell-price-amount,
.cart-drawer__upsell-price-amount .amount {
  font-weight: 700;
  color: var(--atsko-orange);
}

.cart-drawer__upsell-cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.25rem;
  padding: 0.4rem 1.1rem;
  border: 1px solid var(--atsko-charcoal);
  border-radius: 999px;
  background: var(--atsko-white);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--atsko-charcoal);
  text-decoration: none;
}

.cart-drawer__upsell-cart:hover {
  background: var(--atsko-blue);
  border-color: var(--atsko-blue);
  color: var(--atsko-white);
}

/* —— Checkout strip —— */
.cart-drawer__checkout {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--atsko-gray-200);
}

.cart-drawer__subtotal {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0;
  font-size: 1.125rem;
  color: var(--atsko-charcoal);
}

.cart-drawer__subtotal-label {
  font-weight: 400;
}

.cart-drawer__subtotal-amount {
  font-weight: 700;
}

.cart-drawer__checkout-btn {
  width: 100%;
  text-align: center;
  box-sizing: border-box;
}

.cart-drawer__view-cart {
  text-align: center;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--atsko-charcoal);
  text-decoration: underline;
}

.cart-drawer__view-cart:hover {
  color: var(--atsko-blue);
}

/* —— Bundle promo —— */
.cart-drawer__bundle {
  flex: 0 0 auto;
  display: flex;
  gap: 1rem;
  align-items: center;
  margin: 0;
  padding: 1.25rem 1.5rem;
  background: #f5fbff;
  border-top: 1px solid var(--atsko-link-light);
}

.cart-drawer__bundle-media {
  flex: 0 0 5.5rem;
  width: 5.5rem;
  height: 5.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 4px;
  background: var(--atsko-white);
}

.cart-drawer__bundle-media img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.cart-drawer__bundle-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.cart-drawer__bundle-title {
  margin: 0 0 0.25rem;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--atsko-charcoal);
}

.cart-drawer__bundle-body {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--atsko-charcoal);
}

.cart-drawer__bundle-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--atsko-blue);
  text-decoration: none;
}

.cart-drawer__bundle-link:hover {
  text-decoration: underline;
}

body.cart-drawer-open {
  overflow: hidden;
}

@media (max-width: 480px) {
  .cart-drawer__panel {
    width: 100%;
  }

  .cart-drawer__upsell {
    flex-basis: calc(50% - 0.5rem);
  }
}
