/* ==========================================================================
   Slide-out cart drawer (inc/cart-drawer.php). Brand: porcelain + ink, 1px borders.
   ========================================================================== */
:root {
	--cst-d-bg: #FFFFFF;
	--cst-d-soft: #F8F5F0;
	--cst-d-line: #E6E0D6;
	--cst-d-ink: #11121B;
	--cst-d-muted: #6B6D7A;
	--cst-d-ease: cubic-bezier(.22, .61, .36, 1);
}
html.cst-drawer-lock, html.cst-drawer-lock body { overflow: hidden; }

.cst-drawer { position: fixed; inset: 0; z-index: 100000; visibility: hidden; pointer-events: none; transition: visibility 0s linear .35s; }
.cst-drawer.is-open { visibility: visible; pointer-events: auto; transition-delay: 0s; }
.cst-drawer__overlay { position: absolute; inset: 0; background: rgba(17, 18, 27, .45); opacity: 0; transition: opacity .3s var(--cst-d-ease); }
.cst-drawer.is-open .cst-drawer__overlay { opacity: 1; }

.cst-drawer__panel {
	position: absolute; top: 0; right: 0; bottom: 0; width: 440px; max-width: 100%;
	background: var(--cst-d-bg); color: var(--cst-d-ink);
	border-left: 1px solid var(--cst-d-line);
	transform: translateX(100%); transition: transform .35s var(--cst-d-ease);
	display: flex; flex-direction: column; outline: 0;
	box-shadow: -24px 0 60px -30px rgba(17, 18, 27, .35);
}
.cst-drawer.is-open .cst-drawer__panel { transform: none; }
.cst-drawer__inner { display: flex; flex-direction: column; height: 100%; min-height: 0; transition: opacity .2s ease; }
.cst-drawer.is-busy .cst-drawer__inner { opacity: .55; pointer-events: none; }

.cst-drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--cst-d-line); }
.cst-drawer__title { margin: 0; font-size: 18px; font-weight: 500; color: var(--cst-d-ink); display: flex; align-items: center; gap: 10px; }
.cst-drawer__count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border: 1px solid var(--cst-d-line); border-radius: 999px; font-size: 12px; color: var(--cst-d-muted); }
.cst-drawer__close { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 1px solid transparent; border-radius: 50%; color: var(--cst-d-ink); cursor: pointer; transition: background .2s ease, border-color .2s ease; }
@media (hover: hover) and (pointer: fine) {
  .cst-drawer__close:hover { background: var(--cst-d-soft); border-color: var(--cst-d-line);
  }
}

/* Free-shipping bar */
.cst-ship-bar { padding: 16px 24px; border-bottom: 1px solid var(--cst-d-line); background: var(--cst-d-soft); }
.cst-ship-bar__text { margin: 0 0 10px; font-size: 13px; color: var(--cst-d-ink); }
.cst-ship-bar__track { height: 4px; border-radius: 999px; background: var(--cst-d-line); overflow: hidden; }
.cst-ship-bar__fill { display: block; height: 100%; background: linear-gradient(90deg, #7C3AED, #8B5CF6); border-radius: 999px; transition: width .5s var(--cst-d-ease); }
.cst-ship-bar.is-complete .cst-ship-bar__fill { background: #1F7A4D; }

/* Items */
.cst-drawer__items { list-style: none; margin: 0; padding: 0 24px; flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.cst-item { display: grid; grid-template-columns: 76px 1fr; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--cst-d-line); }
.cst-item:last-child { border-bottom: 0; }
.cst-item__thumb { display: block; width: 76px; height: 76px; border: 1px solid var(--cst-d-line); border-radius: 10px; overflow: hidden; background: var(--cst-d-soft); }
.cst-item__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; margin: 0; }
.cst-item__top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.cst-item__name { font-size: 14px; font-weight: 500; line-height: 1.4; color: var(--cst-d-ink); text-decoration: none; }
.cst-item__meta { margin-top: 2px; font-size: 12px; color: var(--cst-d-muted); }
.cst-item__remove { flex: 0 0 auto; width: 26px; height: 26px; line-height: 1; font-size: 20px; background: transparent; border: 0; border-radius: 50%; color: var(--cst-d-muted); cursor: pointer; transition: color .2s ease, background .2s ease; }
@media (hover: hover) and (pointer: fine) {
  .cst-item__remove:hover { color: var(--cst-d-ink); background: var(--cst-d-soft);
  }
}
.cst-item__row { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.cst-item__price { font-size: 14px; font-weight: 500; color: var(--cst-d-ink); }

.cst-qty { display: inline-flex; align-items: center; border: 1px solid var(--cst-d-line); border-radius: 999px; overflow: hidden; }
.cst-qty button { width: 32px; height: 32px; background: transparent; border: 0; font-size: 16px; line-height: 1; color: var(--cst-d-ink); cursor: pointer; transition: background .2s ease; }
@media (hover: hover) and (pointer: fine) {
  .cst-qty button:hover:not(:disabled) { background: var(--cst-d-soft);
  }
}
.cst-qty button:disabled { opacity: .35; cursor: not-allowed; }
.cst-qty__value { min-width: 28px; text-align: center; font-size: 13px; font-weight: 500; }

/* Footer */
.cst-drawer__foot { padding: 18px 24px 24px; border-top: 1px solid var(--cst-d-line); background: var(--cst-d-bg); }
.cst-promo { margin-bottom: 14px; border: 1px solid var(--cst-d-line); border-radius: 10px; padding: 0 14px; }
.cst-promo summary { list-style: none; cursor: pointer; padding: 12px 0; font-size: 13px; color: var(--cst-d-ink); display: flex; justify-content: space-between; align-items: center; }
.cst-promo summary::-webkit-details-marker { display: none; }
.cst-promo summary::after { content: "+"; font-size: 18px; color: var(--cst-d-muted); }
.cst-promo[open] summary::after { content: "\2212"; }
.cst-promo__form { display: flex; gap: 8px; padding-bottom: 12px; }
.cst-promo__input { flex: 1; height: 44px; padding: 0 14px; border: 1px solid var(--cst-d-line); border-radius: 8px; background: #fff; color: var(--cst-d-ink); font-size: 14px; transition: border-color .2s ease, box-shadow .2s ease; }
.cst-promo__input:focus { outline: 0; border-color: #7C3AED; box-shadow: 0 0 0 3px rgba(124, 58, 237, .3); }
.cst-promo__msg { margin: 0 0 12px; font-size: 12px; color: #1F7A4D; }
.cst-promo__msg:empty { display: none; }
.cst-promo__msg.is-error { color: #B3261E; }
.cst-promo__applied { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.cst-promo__applied li { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 10px; border: 1px solid var(--cst-d-line); border-radius: 999px; background: var(--cst-d-soft); font-size: 12px; }
.cst-promo__applied button { background: transparent; border: 0; font-size: 16px; line-height: 1; cursor: pointer; color: var(--cst-d-muted); }

.cst-drawer__line { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; color: var(--cst-d-ink); }
.cst-drawer__line--discount { color: #1F7A4D; }
.cst-drawer__subtotal { font-size: 16px; font-weight: 500; }
.cst-drawer__note { margin: 0 0 16px; font-size: 12px; color: var(--cst-d-muted); }

.cst-btn { display: flex; align-items: center; justify-content: center; width: 100%; height: 52px; padding: 0 20px; border-radius: 10px; font-size: 15px; font-weight: 500; text-decoration: none; cursor: pointer; transition: background .2s ease, border-color .2s ease, transform .2s ease; }
.cst-btn--primary { background: var(--cst-d-ink) !important; color: #fff !important; border: 1px solid var(--cst-d-ink) !important; }
@media (hover: hover) and (pointer: fine) {
  .cst-btn--primary:hover { background: #1F202E !important; transform: translateY(-1px);
  }
}
.cst-btn--ghost { background: transparent; color: var(--cst-d-ink); border: 1px solid var(--cst-d-line); width: auto; height: 44px; }
@media (hover: hover) and (pointer: fine) {
  .cst-btn--ghost:hover { border-color: var(--cst-d-ink);
  }
}
.cst-drawer__continue { display: block; width: 100%; margin-top: 12px; padding: 6px; background: transparent; border: 0; font-size: 13px; color: var(--cst-d-muted); text-decoration: underline; cursor: pointer; }

.cst-drawer__empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 40px 24px; text-align: center; }
.cst-drawer__empty-title { margin: 0; font-size: 17px; font-weight: 500; }
.cst-drawer__empty-text { margin: 0 0 12px; font-size: 14px; color: var(--cst-d-muted); }

@media (max-width: 480px) {
	.cst-drawer__panel { width: 100%; border-left: 0; }
	.cst-drawer__head, .cst-ship-bar, .cst-drawer__foot { padding-left: 18px; padding-right: 18px; }
	.cst-drawer__items { padding: 0 18px; }
}
@media (prefers-reduced-motion: reduce) {
	.cst-drawer, .cst-drawer__overlay, .cst-drawer__panel, .cst-ship-bar__fill { transition: none; }
}
