/* ==========================================================================
   VELUNE — cart.css
   Cart drawer: same language as the mobile menu (dark blurred overlay,
   cream panel dropping from the top). Full width on mobile,
   a right-hand panel on desktop.
   ========================================================================== */

.cart {
  position: fixed;
  inset: 0;
  z-index: 46;               /* above the mobile menu, below the navbar */
  background: rgba(27, 24, 21, 0);
  -webkit-backdrop-filter: blur(0px);
  backdrop-filter: blur(0px);
  transition:
    background-color 0.7s var(--ease-soft),
    backdrop-filter 0.7s var(--ease-soft),
    -webkit-backdrop-filter 0.7s var(--ease-soft);
}
.cart.is-open {
  background: rgba(27, 24, 21, 0.45);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.cart__panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  max-height: 88vh;
  max-height: 88svh;
  padding-top: var(--nav-h);   /* the navbar stays visible above */
  background: var(--bg);
  clip-path: inset(0 0 100% 0);
  transition: clip-path 0.9s var(--ease-io);
}
.cart.is-open .cart__panel { clip-path: inset(0 0 0 0); }

@media (min-width: 900px) {
  .cart__panel {
    left: auto;
    width: min(480px, 100%);
    max-height: 100vh;
    max-height: 100svh;
    border-left: 1px solid var(--line);
  }
}

/* ---------- Head ---------- */
.cart__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--gutter);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.cart__head .label { font-weight: 400; }
.cart__close {
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---------- Body ---------- */
.cart__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 var(--gutter);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.cart__item {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  transition: opacity 0.5s ease, transform 0.5s var(--ease-out);
}
.cart__item:last-child { border-bottom: 0; }
.cart__item.is-removing {
  opacity: 0;
  transform: translateX(24px);
}

.cart__thumb {
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #E8E4DA;
}
.cart__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.2s var(--ease-out);
}
.cart__thumb:hover img { transform: scale(1.06); }

.cart__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.cart__name {
  font-family: var(--serif);
  font-size: clamp(19px, 1.6vw, 22px);
  line-height: 1.1;
}
.cart__line {
  font-family: var(--serif);
  font-size: clamp(16px, 1.3vw, 18px);
  white-space: nowrap;
}
.cart__material,
.cart__unit {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}
.cart__material { margin-top: 4px; }

.cart__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

/* Quantity stepper with a typeable field */
.qty {
  display: inline-flex;
  align-items: stretch;
  height: 34px;
  border: 1px solid var(--line);
}
.qty__btn {
  width: 34px;
  font-size: 16px;
  line-height: 1;
  transition: background-color 0.4s ease, opacity 0.3s ease;
}
.qty__btn:hover:not(:disabled) { background: rgba(42, 42, 42, 0.06); }
.qty__btn:disabled { opacity: 0.3; cursor: default; }
.qty__input {
  width: 40px;
  border: 0;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: 400 14px var(--sans);
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}
.qty__input::-webkit-outer-spin-button,
.qty__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty__input:focus-visible { outline-offset: -3px; }

.cart__remove {
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* Empty state */
.cart__empty {
  display: none;
  padding: 48px 0 56px;
}
.cart.is-empty .cart__empty { display: block; }
.cart.is-empty .cart__foot { display: none; }
.cart__empty-title {
  font-family: var(--serif);
  font-size: clamp(26px, 2.6vw, 34px);
  line-height: 1.1;
}
.cart__empty-link {
  margin-top: 18px;
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---------- Foot ---------- */
.cart__foot {
  padding: 18px var(--gutter) calc(20px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
}
.cart__subtotal {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.cart__subtotal-value {
  font-family: var(--serif);
  font-size: clamp(24px, 2.2vw, 32px);
}
.cart__note {
  margin: 6px 0 16px;
  font-size: 12.5px;
  color: var(--muted);
}
.cart__checkout {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--serif);
  font-size: clamp(15px, 1.3vw, 18px);
  text-transform: uppercase;
  transition: background-color 0.6s ease;
}
.cart__checkout:hover { background: #3a3835; }
.cart__checkout:focus-visible { outline-color: var(--cream); outline-offset: -6px; }

/* ---------- Motion ---------- */
.cart.is-open.is-entering .cart__item {
  animation: cart-item-in 0.9s var(--ease-out) both;
  animation-delay: calc(0.3s + var(--i, 0) * 0.08s);
}
@keyframes cart-item-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* Cart(n) in the navbar nudges when the count changes */
.nav__cart.is-bump { animation: cart-bump 0.6s var(--ease-out); }
@keyframes cart-bump {
  0%, 100% { transform: none; }
  35% { transform: translateY(-4px); }
}
