/* ==========================================================================
   NHV-16 — Add-to-cart modal
   ==========================================================================
   Replaces core's Bootstrap alert. Built on the panel language already used by
   the filter, categories and toolbar blocks, so it reads as part of the site
   rather than a component borrowed from somewhere else. */

.nhv-cart-modal {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
/* [hidden] alone loses to the display:flex above. */
.nhv-cart-modal[hidden] { display: none; }

.nhv-cart-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 19, 27, 0.72);
}

.nhv-cart-modal-panel {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--nhv-cream-bright);
  border: 1px solid var(--nhv-navy-border);
  border-radius: var(--nhv-radius-sm);
  box-shadow: 0 18px 50px rgba(2, 19, 27, 0.45);
  animation: nhv-cart-modal-in 0.18s ease-out;
}

@keyframes nhv-cart-modal-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* Someone who has asked for less motion gets the dialog without the slide. */
@media (prefers-reduced-motion: reduce) {
  .nhv-cart-modal-panel { animation: none; }
}

/* --- Head --- */

.nhv-cart-modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background-color: var(--nhv-navy-panel);
  background-image: linear-gradient(130deg, var(--nhv-navy-panel) 0%, var(--nhv-navy) 100%);
  border-bottom: 1px solid var(--nhv-navy-border);
}

.nhv-cart-modal-tick {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin: 0;
  font-size: 13px;
  color: var(--nhv-navy);
  background: var(--nhv-gold);
  border-radius: 50%;
}

.nhv-cart-modal-title {
  flex: 1 1 auto;
  margin: 0;
  font-family: var(--nhv-font-display);
  font-size: var(--nhv-fs-h4, 18px);
  font-weight: var(--nhv-fw-bold);
  line-height: 1.2;
  color: var(--nhv-cream);
}

.nhv-cart-modal-close {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
  color: var(--nhv-copper-text);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.nhv-cart-modal-close:hover { color: var(--nhv-cream-bright); }
.nhv-cart-modal-close:focus-visible { outline: 2px solid var(--nhv-copper); outline-offset: 2px; }

/* --- Body --- */

.nhv-cart-modal-body {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
}

.nhv-cart-modal-media {
  flex: 0 0 auto;
  display: block;
  width: 72px;
}
.nhv-cart-modal-media img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  display: block;
  background: var(--nhv-cream-bright);
  border: 1px solid var(--nhv-rule-warm);
  border-radius: var(--nhv-radius-sm);
}
/* No image: the media column collapses rather than leaving a hole. The class is
   set by cart-modal.js — not :has() — so the fallback does not depend on
   selector support. */
.nhv-cart-modal-panel.is-imageless .nhv-cart-modal-media { display: none; }

.nhv-cart-modal-info { flex: 1 1 auto; min-width: 0; }

.nhv-cart-modal-name {
  display: block;
  font-family: var(--nhv-font-body);
  font-size: var(--nhv-fs-base);
  font-weight: var(--nhv-fw-semi);
  line-height: 1.35;
  color: var(--nhv-navy);
}

.nhv-cart-modal-price {
  display: block;
  margin-top: 4px;
  font-family: var(--nhv-font-body);
  font-size: var(--nhv-fs-base);
  font-weight: var(--nhv-fw-bold);
  color: var(--nhv-copper);
}

.nhv-cart-modal-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 12px 16px;
  font-family: var(--nhv-font-body);
  font-size: var(--nhv-fs-small);
  color: var(--nhv-navy);
  background: var(--nhv-sand);
  border-top: 1px solid var(--nhv-rule-warm);
  border-bottom: 1px solid var(--nhv-rule-warm);
}
.nhv-cart-modal-total strong {
  font-size: var(--nhv-fs-base);
  font-weight: var(--nhv-fw-bold);
  color: var(--nhv-navy);
}

/* --- Actions --- */

.nhv-cart-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 16px;
}

.nhv-cart-modal-continue,
.nhv-cart-modal-cart,
.nhv-cart-modal-checkout {
  display: block;
  padding: 10px 12px;
  font-family: var(--nhv-font-display);
  font-size: var(--nhv-fs-small);
  font-weight: var(--nhv-fw-semi);
  letter-spacing: 0.03em;
  text-align: center;
  text-transform: uppercase;
  border-radius: var(--nhv-radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nhv-cart-modal-continue {
  color: var(--nhv-navy);
  background: var(--nhv-sand);
  border: 1px solid var(--nhv-rule-warm);
}
.nhv-cart-modal-continue:hover { background: var(--nhv-rule-warm); }

.nhv-cart-modal-cart {
  color: var(--nhv-navy);
  background: transparent;
  border: 1px solid var(--nhv-navy);
}
.nhv-cart-modal-cart:hover,
.nhv-cart-modal-cart:focus { color: var(--nhv-cream-bright); background: var(--nhv-navy); text-decoration: none; }

/* Checkout is the primary action, so it spans the row under the other two and
   takes the same ground as Add to Cart. */
.nhv-cart-modal-checkout {
  grid-column: 1 / -1;
  color: var(--nhv-cream-bright);
  background: var(--nhv-footer-ground);
  border: 1px solid var(--nhv-footer-ground);
}
.nhv-cart-modal-checkout:hover,
.nhv-cart-modal-checkout:focus { color: var(--nhv-cream-bright); background: var(--nhv-navy); border-color: var(--nhv-navy); text-decoration: none; }

.nhv-cart-modal-continue:focus-visible,
.nhv-cart-modal-cart:focus-visible,
.nhv-cart-modal-checkout:focus-visible { outline: 2px solid var(--nhv-copper); outline-offset: 2px; }

/* Stop the page behind scrolling while the dialog is open. */
body.nhv-modal-open { overflow: hidden; }

@media (max-width: 479px) {
  .nhv-cart-modal { padding: 12px; }
  .nhv-cart-modal-actions { grid-template-columns: 1fr; }
  .nhv-cart-modal-checkout { grid-column: auto; }
}
