/* Slide-in mini cart. Sharp corners, deep green + amber to match the checkout. */

.npp-drawer {
  --mc-ink: #123b22;
  --mc-green: #14532d;
  --mc-amber: #f59e0b;
  --mc-line: #e3e8e3;
  --mc-muted: #5f6b63;
  position: fixed;
  inset: 0;
  z-index: 100000;
  pointer-events: none;
  font-family: "Montserrat", sans-serif;
}

.npp-drawer.is-open {
  pointer-events: auto;
}

html.npp-drawer-lock {
  overflow: hidden;
}

.npp-drawer__overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 29, 16, 0.55);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.npp-drawer.is-open .npp-drawer__overlay {
  opacity: 1;
}

.npp-drawer__panel {
  position: absolute;
  top: var(--wp-admin--admin-bar--height, 0px);
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 440px;
  background: #fffdf9;
  color: var(--mc-ink);
  box-shadow: -24px 0 60px rgba(7, 29, 16, 0.25);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.22, 0.8, 0.2, 1), visibility 0s linear 0.35s;
  visibility: hidden;
}

.npp-drawer.is-open .npp-drawer__panel {
  transform: none;
  transition-delay: 0s;
  visibility: visible;
}

@media (prefers-reduced-motion: reduce) {
  .npp-drawer__overlay,
  .npp-drawer__panel {
    transition: none;
  }
}

/* Header */
.npp-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--mc-line);
  border-top: 3px solid var(--mc-amber);
}

.npp-drawer__title {
  margin: 0;
  font-size: 1.125rem !important;
  line-height: 1.3 !important;
  color: var(--mc-ink);
}

.npp-drawer__title span:not(:empty) {
  margin-left: 4px;
  color: var(--mc-muted);
  font-weight: 700;
}

.npp-drawer__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--mc-line);
  background: #fffdf9;
  color: var(--mc-ink);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.npp-drawer__close:hover {
  background: var(--mc-ink);
  color: #faf6ef;
}

.npp-drawer__close svg {
  width: 18px;
  height: 18px;
}

.npp-drawer button:focus-visible,
.npp-drawer a:focus-visible {
  outline: 2px solid var(--mc-ink);
  outline-offset: 2px;
}

.npp-drawer__notice {
  margin: 0;
  padding: 12px 24px;
  background: #fdecea;
  color: #b42318;
  font-size: 0.875rem;
  font-weight: 700;
}

.npp-drawer__notice[hidden] {
  display: none;
}

/* Body */
.npp-drawer-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.npp-mc-list {
  flex: 1;
  margin: 0;
  padding: 0 24px;
  list-style: none;
  overflow-y: auto;
}

.npp-mc-item {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--mc-line);
}

.npp-mc-item:last-child {
  border-bottom: 0;
}

.npp-mc-thumb {
  display: block;
  width: 76px;
  height: 76px;
  border: 1px solid var(--mc-line);
  background: #faf6ef;
  padding: 6px;
}

.npp-mc-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.npp-mc-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.9375rem;
  font-weight: 800;
  line-height: 1.4;
  color: var(--mc-ink);
}

a.npp-mc-name:hover {
  color: var(--mc-green);
}

.npp-mc-unit {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
  margin-top: 4px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--mc-muted);
}

.npp-mc-unit del {
  color: #9ca3af;
  font-weight: 600;
}

.npp-mc-unit ins {
  text-decoration: none;
}

.npp-mc-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}

.npp-mc-qty {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid #cfd8d1;
}

.npp-mc-qty button {
  width: 32px;
  height: 32px;
  border: 0;
  background: #fffdf9;
  color: var(--mc-ink);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.npp-mc-qty button:hover:not(:disabled) {
  background: var(--mc-ink);
  color: #faf6ef;
}

.npp-mc-qty button:disabled {
  color: #b8c4bb;
  cursor: not-allowed;
}

.npp-mc-qty span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  border-left: 1px solid #cfd8d1;
  border-right: 1px solid #cfd8d1;
  font-size: 0.875rem;
  font-weight: 800;
}

.npp-mc-remove {
  border: 0;
  background: none;
  padding: 0;
  color: var(--mc-muted);
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.2s;
}

.npp-mc-remove:hover {
  color: #b42318;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.npp-mc-line {
  font-size: 0.9375rem;
  font-weight: 900;
  color: var(--mc-ink);
  white-space: nowrap;
}

/* Footer */
.npp-mc-foot {
  padding: 20px 24px 24px;
  border-top: 1px solid var(--mc-line);
  background: #faf6ef;
}

.npp-mc-sub {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 1rem;
  font-weight: 800;
}

.npp-mc-sub strong {
  font-size: 1.375rem;
  font-weight: 900;
}

.npp-mc-note {
  margin: 6px 0 16px;
  font-size: 0.8125rem;
  color: var(--mc-muted);
}

.npp-mc-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 0 20px;
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.npp-mc-btn--primary {
  background: var(--mc-amber);
  color: var(--mc-ink);
}

.npp-mc-btn--primary:hover {
  background: var(--mc-ink);
  color: #faf6ef;
}

.npp-mc-btn--ghost {
  margin-top: 10px;
  border-color: rgba(18, 59, 34, 0.25);
  background: #fffdf9;
  color: var(--mc-ink);
}

.npp-mc-btn--ghost:hover {
  border-color: var(--mc-ink);
  background: var(--mc-ink);
  color: #faf6ef;
}

/* Empty */
.npp-mc-empty {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  text-align: center;
}

.npp-mc-empty__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  background: #f5efe6;
  color: var(--mc-green);
}

.npp-mc-empty__icon svg {
  width: 34px;
  height: 34px;
}

.npp-mc-empty__title {
  margin: 20px 0 0;
  font-size: 1.125rem;
  font-weight: 900;
}

.npp-mc-empty__text {
  margin: 6px 0 24px;
  font-size: 0.875rem;
  color: var(--mc-muted);
}

.npp-mc-empty .npp-mc-btn {
  width: auto;
}

/* Loading veil while the cart request is in flight (localhost can be slow) */
.npp-drawer__loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.72);
}

.npp-drawer.is-loading .npp-drawer__loading {
  display: flex;
}

.npp-drawer__loading span {
  width: 34px;
  height: 34px;
  border: 3px solid var(--mc-line);
  border-top-color: var(--mc-ink);
  border-radius: 50% !important;
  animation: npp-mc-spin 0.8s linear infinite;
}

@keyframes npp-mc-spin {
  to { transform: rotate(360deg); }
}

/* Add-to-cart button while busy */
[data-npp-add].is-busy {
  opacity: 0.7;
  pointer-events: none;
}
