/* ============================================================
   CART — Drawer, badge, line items, checkout
   Shares design tokens from index.html :root
============================================================ */

/* Prevent logo from being squeezed by nav-links + cart icon */
.nav-logo { flex-shrink: 0; margin-left: -14px; }
.nav-logo-text { white-space: nowrap; }
/* Ensure minimum gap between logo and nav links */
header nav { gap: 2rem; }
/* Tighten nav gap slightly to accommodate cart icon without wrapping */
.nav-links { gap: 1.8rem; }
/* Prevent nav links and button from wrapping when cart icon is present */
.nav-links a, .nav-links .btn { white-space: nowrap; }

/* ---- CART ICON IN NAV ---- */
.cart-icon-wrap {
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-left: 0.8rem;
  transition: transform 0.2s;
}
.cart-icon-wrap:hover { transform: scale(1.1); }
.cart-icon-wrap svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--cream);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.2s;
}
.cart-icon-wrap:hover svg { stroke: var(--gold-light); }

.cart-badge {
  position: absolute;
  top: 0;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--red);
  color: white;
  font-family: 'Roboto Slab', serif;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
  pointer-events: none;
  transition: transform 0.25s ease;
}
.cart-badge:empty,
.cart-badge[data-count="0"] { display: none; }
.cart-badge.bump {
  animation: badge-bump 0.35s ease;
}
@keyframes badge-bump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* ---- DRAWER OVERLAY ---- */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s;
}
.cart-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* ---- DRAWER ---- */
.cart-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  max-width: 92vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(6,31,22,0.98);
  border-left: 4px solid var(--gold);
  box-shadow: -10px 0 40px rgba(0,0,0,0.6);
  z-index: 2001;
  display: flex;
  flex-direction: column;
  transition: right 0.35s ease;
  backdrop-filter: blur(12px);
}
.cart-drawer.open {
  right: 0;
}

/* ---- DRAWER HEADER ---- */
.cart-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 2px solid rgba(201,146,58,0.35);
  flex-shrink: 0;
}
.cart-drawer-title {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-light);
}
.cart-drawer-close {
  background: none;
  border: none;
  color: var(--cream);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  font-size: 1.4rem;
  opacity: 0.7;
}
.cart-drawer-close:hover { color: var(--gold-light); opacity: 1; }

/* ---- DRAWER BODY (scrollable) ---- */
.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(201,146,58,0.3) transparent;
}
.cart-drawer-body::-webkit-scrollbar { width: 5px; }
.cart-drawer-body::-webkit-scrollbar-track { background: transparent; }
.cart-drawer-body::-webkit-scrollbar-thumb { background: rgba(201,146,58,0.3); border-radius: 3px; }

/* ---- EMPTY STATE ---- */
.cart-empty {
  text-align: center;
  padding: 60px 28px;
}
.cart-empty-icon {
  font-size: 2.8rem;
  margin-bottom: 16px;
  opacity: 0.3;
}
.cart-empty-text {
  font-family: 'Lora', serif;
  font-size: 1rem;
  font-style: italic;
  color: var(--cream);
  opacity: 0.55;
  margin-bottom: 20px;
}
.cart-empty-link {
  font-family: 'Roboto Slab', serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-light);
  cursor: pointer;
  background: none;
  border: none;
  transition: color 0.2s;
}
.cart-empty-link:hover { color: var(--gold-pale); }

/* ---- LINE ITEM ---- */
.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(201,146,58,0.15);
  align-items: start;
}
.cart-item:last-child { border-bottom: none; }

.cart-item-name {
  font-family: 'Roboto Slab', serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--cream-light);
  letter-spacing: 0.02em;
  line-height: 1.3;
}
.cart-item-sku {
  font-family: 'Lora', serif;
  font-size: 0.65rem;
  color: var(--cream);
  opacity: 0.35;
  margin-top: 2px;
}
.cart-item-price {
  font-family: 'Roboto Slab', serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--gold-pale);
  text-align: right;
  white-space: nowrap;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 10px;
}
.cart-qty-btn {
  width: 30px;
  height: 30px;
  background: rgba(201,146,58,0.1);
  border: 1px solid rgba(201,146,58,0.4);
  color: var(--gold-light);
  font-family: 'Roboto Slab', serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  line-height: 1;
}
.cart-qty-btn:hover { background: rgba(201,146,58,0.25); }
.cart-qty-val {
  width: 36px;
  height: 30px;
  background: rgba(0,0,0,0.25);
  border-top: 1px solid rgba(201,146,58,0.4);
  border-bottom: 1px solid rgba(201,146,58,0.4);
  border-left: none;
  border-right: none;
  color: var(--cream);
  font-family: 'Roboto Slab', serif;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  line-height: 30px;
}
.cart-remove-btn {
  background: none;
  border: none;
  color: var(--red);
  font-family: 'Roboto Slab', serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  margin-left: 14px;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.cart-remove-btn:hover { opacity: 1; }

/* ---- DRAWER FOOTER ---- */
.cart-drawer-footer {
  flex-shrink: 0;
  border-top: 2px solid rgba(201,146,58,0.35);
  padding: 20px 24px 24px;
  background: rgba(4,16,10,0.95);
}
.cart-subtotal-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.cart-subtotal-label {
  font-family: 'Roboto Slab', serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--cream);
  opacity: 0.65;
}
.cart-subtotal-value {
  font-family: 'Roboto Slab', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold-pale);
}
.cart-shipping-note {
  font-family: 'Lora', serif;
  font-size: 0.72rem;
  font-style: italic;
  color: var(--cream);
  opacity: 0.45;
  margin-bottom: 18px;
}
.cart-checkout-btn {
  display: block;
  width: 100%;
  padding: 1rem;
  font-family: 'Roboto Slab', serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  background: var(--red);
  color: var(--cream-light);
  border: 3px solid var(--cream);
  box-shadow: 5px 5px 0 rgba(0,0,0,0.4);
  cursor: pointer;
  transition: all 0.22s ease;
}
.cart-checkout-btn:hover {
  background: var(--red-dark);
  transform: translate(-3px,-3px);
  box-shadow: 8px 8px 0 rgba(0,0,0,0.5);
}
.cart-checkout-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: 5px 5px 0 rgba(0,0,0,0.4);
}
.cart-checkout-btn:disabled:hover {
  background: var(--red);
  transform: none;
}

/* ---- ADDED-TO-CART FEEDBACK ---- */
.cart-added-feedback {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--gold);
  color: var(--green-dark);
  font-family: 'Roboto Slab', serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 14px 24px;
  box-shadow: 6px 6px 0 rgba(0,0,0,0.4);
  border: 2px solid var(--green-dark);
  z-index: 3000;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.cart-added-feedback.show {
  opacity: 1;
  transform: translateY(0);
}

/* ---- CHECKOUT ERROR ---- */
.cart-error {
  padding: 12px 24px;
  background: rgba(166,50,40,0.2);
  border: 1px solid var(--red);
  color: var(--cream);
  font-family: 'Lora', serif;
  font-size: 0.85rem;
  margin: 0 24px 12px;
  display: none;
}
.cart-error.show { display: block; }

/* ---- RESPONSIVE ---- */
@media (max-width: 480px) {
  .cart-drawer {
    width: 100vw;
    max-width: 100vw;
    right: -100vw;
  }
  .cart-item { padding: 14px 18px; }
  .cart-drawer-header { padding: 16px 18px; }
  .cart-drawer-footer { padding: 16px 18px 20px; }
  .cart-added-feedback { right: 14px; bottom: 14px; font-size: 0.75rem; }
}

/* ---- NAV CART ICON — mobile hamburger menu adjustments ---- */
@media (max-width: 768px) {
  .cart-icon-wrap {
    position: fixed;
    top: 44px;
    right: 56px;
    z-index: 1001;
    margin: 0;
    transition: top 0.35s ease;
  }
  .announcement-bar.hidden ~ header .cart-icon-wrap,
  header.at-top .cart-icon-wrap {
    top: 10px;
  }
}
