/**
 * Brixius Commerce - product card (module product-card).
 *
 * One card for shop/category lists, search, TILKØB (related), upsells and
 * the cart's "Husk også at købe …" block. Markup: loop/product-card.php.
 * Everything is scoped under .bxc-card. The theme's global button and link
 * rules use !important, so the few properties they touch do too.
 */

.bxc-card {
  --bxc-card-navy: #013e8a;
  --bxc-card-navy-hover: #045bc8;
  --bxc-card-ink: #1d1d1b;
  --bxc-card-text: #555;
  --bxc-card-muted: #6b6b6b;
  --bxc-card-border: #dcdcdc;
  --bxc-card-media: #f4f4f4;
  --bxc-card-placeholder: #c9c9c9;
  --bxc-card-in: #2f7d25;
  --bxc-card-backorder: #a35f00;
  --bxc-card-out: #737373;

  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: 0;
  padding: 0;
  background: #fff;
  border: 1px solid var(--bxc-card-border);
  border-radius: 0;
  box-shadow: none;
  font-family: 'Nunito Sans', Helvetica, Arial, sans-serif;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.bxc-card:hover,
.bxc-card:focus-within {
  border-color: #c4c4c4;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
}

/* ---- image ---- */

.bxc-card__media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 220px;
  padding: 36px 20px 16px;
  background: var(--bxc-card-media);
  border-bottom: 1px solid #ececec;
  overflow: hidden;
  text-decoration: none !important;
}

.bxc-card .bxc-card__media img,
.bxc-card .bxc-card__img {
  display: block;
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 100% !important;
  margin: 0 auto;
  object-fit: contain;
  mix-blend-mode: multiply; /* white product photos sit on the grey */
}

.bxc-card__placeholder {
  width: 64px;
  height: 64px;
  color: var(--bxc-card-placeholder);
}

.bxc-card__brand {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 1;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--bxc-card-muted);
}

/* ---- body ---- */

.bxc-card__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  padding: 20px 22px 22px;
}

.bxc-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.bxc-card__sku {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--bxc-card-muted);
  overflow-wrap: anywhere;
}

.bxc-card__stock {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 4px 9px 3px;
  border-radius: 3px;
  background: var(--bxc-card-in);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.bxc-card__stock--backorder { background: var(--bxc-card-backorder); }
.bxc-card__stock--out { background: var(--bxc-card-out); }

.bxc-card .bxc-card__title {
  margin: 0 0 6px !important;
  padding: 0 !important;
  font-family: 'Nunito Sans', Helvetica, Arial, sans-serif !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  text-align: left !important;
  color: var(--bxc-card-ink) !important;
}

.bxc-card .bxc-card__title::after { display: none !important; }

.bxc-card .bxc-card__title a {
  color: inherit !important;
  text-decoration: none !important;
}

.bxc-card .bxc-card__title a:hover { color: var(--bxc-card-navy) !important; }

.bxc-card__desc {
  display: -webkit-box;
  margin: 0 0 18px !important;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.45;
  color: var(--bxc-card-text);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

/* ---- footer: price / login + button ---- */

.bxc-card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 12px;
  margin-top: auto;
}

.bxc-card__price {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--bxc-card-muted);
}

.bxc-card__price .price {
  display: inline;
  margin: 0 !important;
  color: var(--bxc-card-ink) !important;
  font-size: 16px !important;
  font-weight: 700;
}

.bxc-card__price .price .woocommerce-Price-amount { font-size: inherit !important; color: inherit !important; }
.bxc-card__price .price del { color: var(--bxc-card-muted); font-weight: 400; margin-right: 4px; }
.bxc-card__price .price ins { text-decoration: none; }

.bxc-card__price .price-prefix {
  color: var(--bxc-card-muted) !important;
  font-weight: 600;
}

.bxc-card .bxc-card__login {
  color: var(--bxc-card-muted) !important;
  text-decoration: none !important;
}

.bxc-card .bxc-card__login:hover {
  color: var(--bxc-card-navy) !important;
  text-decoration: underline !important;
}

.bxc-card .bxc-card__btn {
  position: relative;
  display: inline-flex !important;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  margin: 0 0 0 auto !important;
  padding: 10px 22px !important;
  border: 0 !important;
  border-radius: 4px !important;
  background: var(--bxc-card-navy) !important;
  box-shadow: none !important;
  color: #fff !important;
  font-family: 'Nunito Sans', Helvetica, Arial, sans-serif !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  letter-spacing: 0 !important;
  text-indent: 0 !important;
  text-transform: none !important;
  text-decoration: none !important;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.bxc-card .bxc-card__btn::before,
.bxc-card .bxc-card__btn::after {
  content: none !important;
}

.bxc-card .bxc-card__btn:hover,
.bxc-card .bxc-card__btn:focus {
  background: var(--bxc-card-navy-hover) !important;
  color: #fff !important;
}

.bxc-card .bxc-card__btn:focus-visible {
  outline: 2px solid var(--bxc-card-navy);
  outline-offset: 2px;
}

/* add to cart states (WooCommerce .loading/.added, loader.js .bdk-busy-btn/.bdk-added,
   cross-sell.js .is-loading/.is-added) */
.bxc-card .bxc-card__btn.loading,
.bxc-card .bxc-card__btn.bdk-busy-btn,
.bxc-card .bxc-card__btn.is-loading {
  opacity: 0.75;
  cursor: progress;
}

/* The cart cross-sell button gets its check from cross-sell.css (.is-added);
   WooCommerce also adds .added to it on added_to_cart, so it is left out here
   to avoid a second check. */
.bxc-card .bxc-card__btn.bdk-added:not(.bdk-cross-sell__add)::after,
.bxc-card .bxc-card__btn.added:not(.bdk-cross-sell__add)::after {
  content: '' !important;
  position: static;
  display: inline-block;
  width: 12px;
  height: 12px;
  margin: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") no-repeat 50% 50% / 12px 12px;
  font-family: inherit !important;
  animation: none !important;
}

/* WooCommerce adds a "Vis kurv" link after the button; the header cart updates instead */
.bxc-card .added_to_cart.wc-forward { display: none !important; }

/* ---- contexts ---- */

/* cart "Husk også at købe …" (the grid comes from cross-sell.css) */
.bxc-card .bdk-cross-sell__error {
  margin: 10px 0 0;
  font-size: 13px;
  color: #b3261e;
}

.bxc-card .bdk-cross-sell__error[hidden] { display: none; }

/* product hits on the WordPress search page */
.search-item--product .bxc-card { max-width: 380px; }

@media (max-width: 575px) {
  .bxc-card__media { height: 200px; }
  .bxc-card__body { padding: 16px 16px 18px; }
  .bxc-card .bxc-card__title { font-size: 17px !important; }
}

@media (prefers-reduced-motion: reduce) {
  .bxc-card,
  .bxc-card .bxc-card__btn { transition: none; }
}
