/* =========================================================
   OBA COOKIES — SHARED CART STYLES
   File: /css/cart.css

   Powers:
   - header cart count
   - cart trigger button
   - slide-out cart drawer
   - overlay
   - mini-cart items
   - quantity controls
   - subtotal/footer
   - responsive mobile behavior

========================================================= */


/* =========================================================
   CART COUNT
========================================================= */

.cart-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: 1.45rem;
  height: 1.45rem;

  margin-left: 0.35rem;
  padding: 0 0.38rem;

  border-radius: 999px;

  background:
    var(--gold, #e8b84a);

  color:
    var(--brown-dark, #4d3026);

  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;

  vertical-align: middle;
}


.cart-count[hidden] {
  display: none !important;
}



/* =========================================================
   CART TRIGGER
========================================================= */

.cart-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  gap: 0.35rem;

  border: 0;
  background: transparent;

  color: inherit;

  font: inherit;
  font-weight: 800;

  cursor: pointer;
}


.cart-trigger:hover {
  opacity: 0.78;
}


.cart-trigger:focus-visible {
  outline:
    3px solid rgba(88, 55, 42, 0.2);

  outline-offset: 4px;

  border-radius: 8px;
}



/* =========================================================
   BODY LOCK
========================================================= */

body.cart-open {
  overflow: hidden;
}



/* =========================================================
   OVERLAY
========================================================= */

.cart-overlay {
  position: fixed;
  inset: 0;

  z-index: 9998;

  background:
    rgba(40, 26, 20, 0.42);

  opacity: 0;

  transition:
    opacity 0.25s ease;

  backdrop-filter:
    blur(1px);

  -webkit-backdrop-filter:
    blur(1px);
}


.cart-overlay.is-open {
  opacity: 1;
}


.cart-overlay[hidden] {
  display: none !important;
}



/* =========================================================
   DRAWER
========================================================= */

.cart-drawer {
  position: fixed;

  top: 0;
  right: 0;

  z-index: 9999;

  display: flex;
  flex-direction: column;

  width: min(430px, 100%);
  height: 100dvh;

  background:
    var(--cream, #fffaf1);

  border-left:
    2px solid rgba(88, 55, 42, 0.12);

  box-shadow:
    -18px 0 45px rgba(51, 34, 25, 0.18);

  transform:
    translateX(105%);

  transition:
    transform 0.28s ease;

  visibility: hidden;
}


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

  visibility: visible;
}



/* =========================================================
   DRAWER HEADER
========================================================= */

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 1rem;

  padding:
    1.4rem 1.4rem 1.2rem;

  border-bottom:
    1px solid rgba(88, 55, 42, 0.12);

  background:
    rgba(255, 255, 255, 0.45);
}


.cart-drawer-title-wrap {
  min-width: 0;
}


.cart-drawer-eyebrow {
  display: block;

  margin-bottom: 0.25rem;

  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;

  opacity: 0.6;
}


.cart-drawer-header h2 {
  margin: 0;

  font-size: 1.45rem;
  line-height: 1.1;
}


.cart-drawer-close {
  display: grid;
  place-items: center;

  flex: 0 0 auto;

  width: 42px;
  height: 42px;

  border:
    2px solid rgba(88, 55, 42, 0.12);

  border-radius: 999px;

  background: #fff;

  color:
    inherit;

  font: inherit;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;

  cursor: pointer;

  transition:
    transform 0.18s ease,
    background 0.18s ease;
}


.cart-drawer-close:hover {
  transform:
    scale(1.05);

  background:
    rgba(88, 55, 42, 0.05);
}


.cart-drawer-close:focus-visible {
  outline:
    3px solid rgba(88, 55, 42, 0.2);

  outline-offset: 3px;
}



/* =========================================================
   DRAWER BODY
========================================================= */

.cart-drawer-body {
  flex: 1;

  overflow-y: auto;

  padding:
    1.15rem 1.4rem 1.4rem;

  overscroll-behavior:
    contain;
}



/* =========================================================
   EMPTY CART
========================================================= */

.mini-cart-empty {
  display: grid;
  place-items: center;

  min-height: 280px;

  padding:
    2rem 1rem;

  text-align: center;
}


.mini-cart-empty-icon {
  display: block;

  margin-bottom: 0.85rem;

  font-size: 2.6rem;
  line-height: 1;
}


.mini-cart-empty h3 {
  margin:
    0 0 0.5rem;

  font-size: 1.15rem;
}


.mini-cart-empty p {
  max-width: 250px;

  margin: 0 auto;

  font-size: 0.9rem;
  line-height: 1.55;

  opacity: 0.68;
}


.mini-cart-empty[hidden] {
  display: none !important;
}



/* =========================================================
   MINI CART ITEMS CONTAINER
========================================================= */

.mini-cart-items {
  display: flex;
  flex-direction: column;
}



/* =========================================================
   MINI CART ITEM
========================================================= */

.mini-cart-item {
  display: grid;

  grid-template-columns:
    minmax(0, 1fr)
    auto;

  gap:
    0.75rem 1rem;

  padding:
    1.15rem 0;

  border-bottom:
    1px solid rgba(88, 55, 42, 0.11);
}


.mini-cart-item:last-child {
  border-bottom: 0;
}



/* =========================================================
   ITEM INFO
========================================================= */

.mini-cart-item-info {
  min-width: 0;
}


.mini-cart-item-name {
  display: block;

  margin-bottom: 0.25rem;

  font-size: 0.98rem;
  font-weight: 900;
  line-height: 1.3;
}


.mini-cart-item-unit-price {
  display: block;

  font-size: 0.8rem;

  opacity: 0.6;
}



/* =========================================================
   ITEM TOTAL
========================================================= */

.mini-cart-item-price {
  align-self: start;

  font-size: 0.95rem;
  font-weight: 900;

  white-space: nowrap;
}



/* =========================================================
   MINI CART QUANTITY
========================================================= */

.mini-cart-quantity {
  display: inline-flex;
  align-items: center;

  justify-self: start;

  overflow: hidden;

  border:
    2px solid rgba(88, 55, 42, 0.12);

  border-radius: 999px;

  background: #fff;
}


.mini-cart-quantity button {
  display: grid;
  place-items: center;

  width: 34px;
  height: 34px;

  padding: 0;

  border: 0;
  background: transparent;

  color: inherit;

  font: inherit;
  font-size: 1rem;
  font-weight: 900;

  cursor: pointer;
}


.mini-cart-quantity button:hover {
  background:
    rgba(88, 55, 42, 0.06);
}


.mini-cart-quantity button:focus-visible {
  outline:
    3px solid rgba(88, 55, 42, 0.18);

  outline-offset: -3px;
}


.mini-cart-quantity-value {
  min-width: 30px;

  text-align: center;

  font-size: 0.86rem;
  font-weight: 900;
}



/* =========================================================
   REMOVE ITEM
========================================================= */

.mini-cart-remove {
  justify-self: end;
  align-self: center;

  padding: 0;

  border: 0;
  background: transparent;

  color: inherit;

  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;

  text-decoration: underline;

  opacity: 0.55;

  cursor: pointer;
}


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


.mini-cart-remove:focus-visible {
  outline:
    2px solid rgba(88, 55, 42, 0.18);

  outline-offset: 3px;

  border-radius: 4px;
}



/* =========================================================
   DRAWER FOOTER
========================================================= */

.cart-drawer-footer {
  flex: 0 0 auto;

  padding:
    1.15rem 1.4rem
    calc(
      1.25rem +
      env(safe-area-inset-bottom)
    );

  border-top:
    2px solid rgba(88, 55, 42, 0.11);

  background:
    rgba(255, 250, 241, 0.98);

  box-shadow:
    0 -10px 24px rgba(73, 45, 32, 0.06);
}



/* =========================================================
   SUBTOTAL
========================================================= */

.mini-cart-subtotal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 1rem;

  margin-bottom: 0.35rem;
}


.mini-cart-subtotal-label {
  font-size: 0.92rem;
  font-weight: 800;
}


.mini-cart-subtotal-value {
  font-size: 1.12rem;
  font-weight: 900;
}


.mini-cart-subtext {
  margin:
    0 0 1rem;

  font-size: 0.76rem;
  line-height: 1.45;

  opacity: 0.6;
}



/* =========================================================
   DRAWER ACTIONS
========================================================= */

.cart-drawer-actions {
  display: grid;

  grid-template-columns:
    1fr;

  gap: 0.7rem;
}


.cart-drawer-actions .btn {
  width: 100%;

  box-sizing: border-box;

  text-align: center;
}


.cart-continue-shopping {
  width: 100%;

  padding:
    0.75rem 1rem;

  border: 0;
  background: transparent;

  color: inherit;

  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;

  cursor: pointer;

  opacity: 0.7;
}


.cart-continue-shopping:hover {
  opacity: 1;
}


.cart-continue-shopping:focus-visible {
  outline:
    3px solid rgba(88, 55, 42, 0.18);

  outline-offset: 2px;

  border-radius: 8px;
}



/* =========================================================
   CART FOOTER COUNT
========================================================= */

.mini-cart-count {
  display: inline;
}



/* =========================================================
   OPTIONAL LITTLE DRAWER NOTE
========================================================= */

.cart-drawer-note {
  display: grid;

  grid-template-columns:
    auto 1fr;

  gap: 0.7rem;

  align-items: start;

  margin-top: 1rem;
  padding: 0.9rem 1rem;

  border-radius: 14px;

  background:
    rgba(88, 55, 42, 0.05);
}


.cart-drawer-note-icon {
  font-size: 1.25rem;
  line-height: 1;
}


.cart-drawer-note p {
  margin: 0;

  font-size: 0.76rem;
  line-height: 1.45;

  opacity: 0.68;
}



/* =========================================================
   HEADER CART BUTTON VARIANT

   Useful if we replace the current "Order" nav item later
   with a clickable cart trigger.

========================================================= */

.nav-cart {
  display: flex;
  align-items: center;
}


.nav-cart .cart-trigger {
  display: inline-flex;
  align-items: center;

  gap: 0.3rem;
}



/* =========================================================
   ACCESSIBILITY / MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {

  .cart-overlay,
  .cart-drawer,
  .cart-drawer-close {
    transition: none;
  }

}



/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 680px) {

  .cart-drawer {
    width: 100%;
    max-width: none;

    border-left: 0;
  }


  .cart-drawer-header {
    padding:
      1.1rem 1rem 1rem;
  }


  .cart-drawer-body {
    padding:
      0.9rem 1rem 1.2rem;
  }


  .cart-drawer-footer {
    padding:
      1rem 1rem
      calc(
        1rem +
        env(safe-area-inset-bottom)
      );
  }


  .mini-cart-empty {
    min-height: 220px;
  }

}



/* =========================================================
   VERY SMALL SCREENS
========================================================= */

@media (max-width: 380px) {

  .cart-drawer-header h2 {
    font-size: 1.25rem;
  }


  .mini-cart-item {
    gap:
      0.65rem 0.75rem;
  }


  .mini-cart-item-name {
    font-size: 0.92rem;
  }


  .mini-cart-item-price {
    font-size: 0.88rem;
  }

}

.footer-cart-trigger {
  padding: 0;
  border: 0;
  background: transparent;

  color: inherit;

  font: inherit;
  text-align: left;

  cursor: pointer;
}

.footer-cart-trigger:hover {
  text-decoration: underline;
}
/* =========================================================
   NAV CART — DESKTOP + MOBILE SPACING
========================================================= */

/* Desktop */
.nav-cart {
  display: flex;
  align-items: center;

  margin-left: 0.25rem;
  margin-right: 0;
}

.nav-cart .cart-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  gap: 0.3rem;

  padding: 0.65rem 0;

  white-space: nowrap;
}


/* Mobile navigation */
@media (max-width: 900px) {

  .nav-cart {
    display: block;

    margin: 0.8rem 0 0;
  }

  .nav-cart .cart-trigger {
    justify-content: flex-start;

    width: auto;

    padding: 0;

    gap: 0.45rem;

    font-size: inherit;
    line-height: inherit;
  }

}
