/* ─────────────────────────────
   CART-DRAWER.CSS — Lo Castro cart drawer
   wp-content/themes/twentytwentyfive-child/styles/cart-drawer.css

   Right-side panel for the WooCommerce cart (inc/cart-drawer.php,
   scripts/cart-drawer.js). Loaded site-wide except on the cart and
   checkout pages. Square corners, hairlines instead of shadows, the
   same backdrop and easing family as the mobile menu drawer.
   ───────────────────────────── */

.lc-cart-drawer {
  position: fixed;
  inset: 0;
  /* Modal, so above everything while open — including WooCommerce's store
     notice (WooPayments' "you started your visit from…" bar, 99998), which
     otherwise covers the top of the panel for foreign visitors. The cookie
     banner never competes: its full-screen overlay blocks every trigger. */
  z-index: 100000;
  visibility: hidden;
  pointer-events: none;
  /* Stay visible while the closing transition plays. */
  transition: visibility 0s linear 0.32s;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.lc-cart-drawer.is-open {
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

html.lc-cart-drawer-locked,
html.lc-cart-drawer-locked body {
  overflow: hidden;
}

html.lc-cart-drawer-locked body {
  padding-right: var(--lc-cart-scrollbar-gap, 0);
}

.lc-cart-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

.lc-cart-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 440px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--lc-bg);
  border-left: 1px solid var(--lc-border-subtle);
  color: var(--lc-text);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
  outline: none;
}

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

@media (max-width: 600px) { /* Drawer goes full width on phones */
  .lc-cart-drawer-panel {
    width: 100%;
    border-left: none;
  }
}

/* ── Head ── */
.lc-cart-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 32px 22px;
  border-bottom: 1px solid var(--lc-border-subtle);
}

.lc-cart-drawer-title {
  margin: 0;
  font-family: var(--lc-font-display);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: var(--lc-track-wide);
  text-transform: uppercase;
  color: var(--lc-text);
}

.lc-cart-drawer-count {
  color: var(--lc-text-muted);
}

.lc-cart-drawer-close {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: -6px -8px -6px 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--lc-text);
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.15s ease;
}

.lc-cart-drawer-close:hover {
  opacity: 1;
}

.lc-cart-drawer-close svg {
  width: 20px;
  height: 20px;
}

/* ── Status line (added / updated / errors) ── */
.lc-cart-drawer-status {
  display: none;
  margin: 0;
  padding: 14px 32px;
  border-bottom: 1px solid var(--lc-border-subtle);
  font-family: var(--lc-font-display);
  font-size: 10px;
  letter-spacing: var(--lc-track-wide);
  text-transform: uppercase;
  color: var(--lc-text-muted);
}

.lc-cart-drawer-status.is-visible {
  display: block;
}

.lc-cart-drawer-status.is-error {
  font-family: var(--lc-font-serif);
  font-size: 13px;
  letter-spacing: normal;
  text-transform: none;
  color: var(--lc-state-error);
}

/* ── Body ── */
.lc-cart-drawer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 32px;
}

.lc-cart-drawer-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lc-cart-item {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 20px;
  padding: 24px 0;
  border-bottom: 1px solid var(--lc-border-subtle);
  transition: opacity 0.2s ease;
}

.lc-cart-item:last-child {
  border-bottom: none;
}

.lc-cart-item.is-new {
  animation: lc-cart-item-in 0.45s ease both;
}

@keyframes lc-cart-item-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.lc-cart-item.is-busy {
  opacity: 0.45;
}

.lc-cart-item-media {
  display: block;
  aspect-ratio: 1 / 1;
  background: var(--lc-surface);
  overflow: hidden;
}

.lc-cart-item-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lc-cart-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lc-cart-item-name {
  font-family: var(--lc-font-serif);
  font-size: 14px;
  line-height: 1.45;
  color: var(--lc-text);
  text-decoration: none;
}

.lc-cart-item-name:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.lc-cart-item-meta {
  margin: 6px 0 0;
  font-family: var(--lc-font-serif);
  font-size: 12px;
  line-height: 1.5;
  color: var(--lc-text-muted);
}

.lc-cart-item-meta div {
  display: flex;
  gap: 4px;
}

.lc-cart-item-meta dt::after {
  content: ":";
}

.lc-cart-item-meta dd {
  margin: 0;
}

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

.lc-cart-item-price {
  font-family: var(--lc-font-serif);
  font-size: 14px;
  color: var(--lc-text);
  white-space: nowrap;
}

.lc-cart-item-qty-static {
  font-family: var(--lc-font-display);
  font-size: 10px;
  letter-spacing: var(--lc-track-default);
  text-transform: uppercase;
  color: var(--lc-text-muted);
}

.lc-cart-item-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--lc-border-default);
}

.lc-cart-item-qty-btn {
  appearance: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  background: none;
  color: var(--lc-text);
  font-family: var(--lc-font-serif);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.lc-cart-item-qty-btn:disabled {
  opacity: var(--lc-state-disabled-opacity);
  cursor: default;
}

.lc-cart-item-qty-value {
  min-width: 26px;
  text-align: center;
  font-family: var(--lc-font-display);
  font-size: 12px;
}

.lc-cart-item-remove {
  appearance: none;
  align-self: flex-start;
  margin-top: 12px;
  padding: 0;
  border: none;
  background: none;
  font-family: var(--lc-font-display);
  font-size: 10px;
  letter-spacing: var(--lc-track-default);
  text-transform: uppercase;
  color: var(--lc-text);
  opacity: 0.6;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.lc-cart-item-remove:hover {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Empty / loading / error states ── */
.lc-cart-drawer-loading {
  margin: 0;
  padding: 56px 0;
  text-align: center;
  font-family: var(--lc-font-display);
  font-size: 10px;
  letter-spacing: var(--lc-track-wide);
  text-transform: uppercase;
  color: var(--lc-text-muted);
}

.lc-cart-drawer-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 72px 8px 48px;
  text-align: center;
}

.lc-cart-drawer-state-title {
  margin: 0;
  font-family: var(--lc-font-serif);
  font-size: 20px;
  line-height: 1.35;
  color: var(--lc-text);
}

.lc-cart-drawer-state-text {
  max-width: 30ch;
  margin: 0 0 10px;
  font-family: var(--lc-font-serif);
  font-size: 13px;
  line-height: 1.7;
  color: var(--lc-text-muted);
}

/* ── Foot ── */
.lc-cart-drawer-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 32px calc(26px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--lc-border-subtle);
}

.lc-cart-drawer-foot[hidden] {
  display: none;
}

.lc-cart-drawer-subtotal {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--lc-font-display);
  font-size: 11px;
  letter-spacing: var(--lc-track-wide);
  text-transform: uppercase;
}

.lc-cart-drawer-subtotal span:last-child {
  font-family: var(--lc-font-serif);
  font-size: 18px;
  letter-spacing: normal;
  text-transform: none;
}

.lc-cart-drawer-note {
  margin: 0 0 8px;
  font-family: var(--lc-font-serif);
  font-size: 12px;
  color: var(--lc-text-muted);
}

.lc-cart-drawer-foot .lc-button {
  width: 100%;
  padding: 15px 20px;
  box-sizing: border-box;
}

/* ── Keyboard focus ── */
.lc-cart-drawer-close:focus-visible,
.lc-cart-item-qty-btn:focus-visible,
.lc-cart-item-remove:focus-visible,
.lc-cart-item-name:focus-visible {
  outline: var(--lc-focus-width) solid var(--lc-focus-color);
  outline-offset: var(--lc-focus-offset);
}

@media (max-width: 600px) { /* Phones: tighter gutters */
  .lc-cart-drawer-head {
    padding: 20px 20px 18px;
  }

  .lc-cart-drawer-status {
    padding: 12px 20px;
  }

  .lc-cart-drawer-body {
    padding: 0 20px;
  }

  .lc-cart-item {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 16px;
  }

  .lc-cart-drawer-foot {
    padding: 18px 20px calc(20px + env(safe-area-inset-bottom));
  }
}

/* ── Product page: adding state + inline error ── */
.single_add_to_cart_button.is-loading {
  opacity: 0.7;
  cursor: progress;
}

.lc-cart-inline-error {
  margin: 12px 0 0;
  font-family: var(--lc-font-serif);
  font-size: 13px;
  line-height: 1.6;
  color: var(--lc-state-error);
}

.lc-cart-inline-error .lc-button--text {
  font-size: 10px;
  color: var(--lc-text);
}

@media (prefers-reduced-motion: reduce) {
  .lc-cart-drawer,
  .lc-cart-drawer-backdrop,
  .lc-cart-drawer-panel {
    transition: none;
  }

  .lc-cart-item.is-new {
    animation: none;
  }
}
