/* ==========================================================================
 * Cart drawer (2026-12-06, Impeccable pass). Astra's off-canvas cart (#astra-mobile-cart-drawer), restyled; markup is WooCommerce's mini cart.
 * Thesis: the drawer confirms what was added and offers ONE decision, "Gå til betaling". Same system as the product page (DESIGN.md): ink on
 * white, hairlines, 12px thumbnails, black pill primary button, Manrope for numbers and the title. No lime, no green outline.
 * The id selector is used on purpose: Astra's rules chain 4-5 classes and also come from generated CSS.
 * Revert: remove the "cart-drawer.css" enqueue in functions.php.
 * ========================================================================== */

html #astra-mobile-cart-drawer {
  --cd-ink: #1E293B;
  --cd-muted: #475569;
  --cd-line: rgba(30, 41, 59, 0.10);
  --cd-ease: cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  width: min(100vw, 440px);
  height: 100%;
  max-height: 100dvh;
  border: 0;
  background: #fff;
  color: var(--cd-ink);
  box-shadow: -1px 0 0 var(--cd-line), -24px 0 56px rgba(15, 23, 42, 0.16);
  overflow: hidden;
  transition: transform 380ms var(--cd-ease), visibility 0s linear 380ms;
}
html #astra-mobile-cart-drawer.active { transition: transform 380ms var(--cd-ease), visibility 0s; }

/* Header: title left, close right, one hairline under it. */
html #astra-mobile-cart-drawer .astra-cart-drawer-header {
  position: static;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  width: 100%;
  min-height: 68px;
  max-height: none;
  padding: 12px 12px 12px 24px;
  border-bottom: 1px solid var(--cd-line);
}
html #astra-mobile-cart-drawer .astra-cart-drawer-title {
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--cd-ink);
}
html #astra-mobile-cart-drawer .astra-cart-drawer-close {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0 !important;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: var(--cd-ink);
  cursor: pointer;
  transition: background-color 160ms var(--cd-ease);
}
html #astra-mobile-cart-drawer .astra-cart-drawer-close:hover { background: rgba(30, 41, 59, 0.08); }
html #astra-mobile-cart-drawer .astra-cart-drawer-close:focus-visible,
html #astra-mobile-cart-drawer .woocommerce-mini-cart a:focus-visible,
html #astra-mobile-cart-drawer .woocommerce-mini-cart input:focus-visible { outline: 2px solid var(--cd-ink); outline-offset: 2px; }

/* Content area fills the rest; the list scrolls, totals and button stay in view. */
html #astra-mobile-cart-drawer .astra-cart-drawer-content { flex: 1 1 auto; min-height: 0; height: auto; padding-top: 0; }
html #astra-mobile-cart-drawer .astra-cart-drawer-content .widget_shopping_cart,
html #astra-mobile-cart-drawer .astra-cart-drawer-content .widget_shopping_cart_content { height: 100%; }

/* ---- Item rows: thumbnail | name / quantity + price ---- */
html #astra-mobile-cart-drawer .woocommerce-mini-cart { margin: 0; padding: 4px 24px; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; }
html #astra-mobile-cart-drawer .woocommerce-mini-cart-item {
  position: relative;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  grid-template-areas: "img name name" "img qty price";
  column-gap: 16px;
  row-gap: 10px;
  align-items: start;
  min-height: 0;
  margin: 0;
  padding: 18px 0;
  border-bottom: 1px solid var(--cd-line);
  list-style: none;
}
html #astra-mobile-cart-drawer .woocommerce-mini-cart-item:last-child { border-bottom: 0; }
html #astra-mobile-cart-drawer .woocommerce-mini-cart-item > a:not(.remove) { display: contents; }
html #astra-mobile-cart-drawer .woocommerce-mini-cart-item img {
  grid-area: img;
  box-sizing: border-box;
  width: 72px;
  height: 72px;
  margin: 0;
  float: none;
  object-fit: contain;
  border: 1px solid var(--cd-line);
  border-radius: 12px;
  background: #fff;
}
html #astra-mobile-cart-drawer .woocommerce-mini-cart-item .ast-product-image { grid-area: name; display: block; margin: 0; padding: 0 36px 0 0; }
html #astra-mobile-cart-drawer .woocommerce-mini-cart-item .ast-product-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--cd-ink);
  text-wrap: balance;
}
html #astra-mobile-cart-drawer .woocommerce-mini-cart-item .variation { margin: 0; font-size: 0.8125rem; color: var(--cd-muted); }

/* Remove: a quiet 40px target at the row's top right (was a 20px outlined circle). */
html #astra-mobile-cart-drawer .woocommerce-mini-cart-item a.remove {
  position: absolute;
  top: 10px;
  right: -8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0 !important;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: var(--cd-muted);
  line-height: 1;
  transition: background-color 160ms var(--cd-ease), color 160ms var(--cd-ease);
}
html #astra-mobile-cart-drawer .woocommerce-mini-cart-item a.remove::before,
html #astra-mobile-cart-drawer .woocommerce-mini-cart-item a.remove::after { display: none !important; content: none !important; border: 0 !important; } /* Astra draws the old outlined circle here */
html #astra-mobile-cart-drawer .woocommerce-mini-cart-item a.remove:hover { background: rgba(30, 41, 59, 0.08); color: var(--cd-ink); }
html #astra-mobile-cart-drawer .woocommerce-mini-cart-item a.remove svg { width: 18px; height: 18px; }

/* Quantity: one pill, 40px high, 40px steps (hit area is the whole pill segment). */
html #astra-mobile-cart-drawer .woocommerce-mini-cart-item .quantity {
  grid-area: qty;
  display: inline-flex;
  align-items: center;
  justify-self: start;
  height: 40px;
  margin: 0;
  overflow: hidden;
  border: 1px solid #8290a3;
  border-radius: 999px;
  background: #fff;
}
html #astra-mobile-cart-drawer .woocommerce-mini-cart-item .quantity a.minus,
html #astra-mobile-cart-drawer .woocommerce-mini-cart-item .quantity a.plus {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--cd-ink);
  font-size: 1.25rem;
  line-height: 1;
  text-decoration: none;
  transition: background-color 160ms var(--cd-ease);
}
html #astra-mobile-cart-drawer .woocommerce-mini-cart-item .quantity a.minus:hover,
html #astra-mobile-cart-drawer .woocommerce-mini-cart-item .quantity a.plus:hover { background: rgba(30, 41, 59, 0.06); }
html #astra-mobile-cart-drawer .woocommerce-mini-cart-item .quantity input.qty {
  box-sizing: border-box;
  width: 36px;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--cd-ink);
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}
html #astra-mobile-cart-drawer .woocommerce-mini-cart-item .quantity input.qty::-webkit-outer-spin-button,
html #astra-mobile-cart-drawer .woocommerce-mini-cart-item .quantity input.qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
html #astra-mobile-cart-drawer .woocommerce-mini-cart-item .ast-mini-cart-price-wrap {
  grid-area: price;
  align-self: center;
  float: none;
  max-width: none;
  margin: 0;
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--cd-ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---- Total and the one button ---- */
html #astra-mobile-cart-drawer .woocommerce-mini-cart__total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0;
  padding: 18px 24px 4px;
  border-top: 1px solid var(--cd-line);
  border-bottom: 0;
  text-align: left;
}
html #astra-mobile-cart-drawer .woocommerce-mini-cart__total strong,
html #astra-mobile-cart-drawer .woocommerce-mini-cart__total .amount { width: auto; padding: 0; }
html #astra-mobile-cart-drawer .woocommerce-mini-cart__total strong { font-size: 0.9375rem; font-weight: 500; color: var(--cd-muted); }
html #astra-mobile-cart-drawer .woocommerce-mini-cart__total .amount {
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--cd-ink);
  font-variant-numeric: tabular-nums;
}
html #astra-mobile-cart-drawer .woocommerce-mini-cart__buttons {
  display: block;
  margin: 0;
  padding: 12px 24px calc(24px + env(safe-area-inset-bottom, 0px));
  text-align: center;
}
html #astra-mobile-cart-drawer .woocommerce-mini-cart__buttons a:not(.checkout) { display: none !important; } /* only one way forward */
html #astra-mobile-cart-drawer .woocommerce-mini-cart__buttons a.checkout {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 60px;
  margin: 0;
  padding: 16px 24px;
  border: 0;
  border-radius: 999px;
  background: #000;
  color: #fff;
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  transition: transform 160ms var(--cd-ease), background-color 160ms var(--cd-ease);
}
html #astra-mobile-cart-drawer .woocommerce-mini-cart__buttons a.checkout:hover { background: var(--cd-ink); color: #fff; }
html #astra-mobile-cart-drawer .woocommerce-mini-cart__buttons a.checkout:active { transform: scale(0.985); }
html #astra-mobile-cart-drawer .woocommerce-mini-cart__buttons a.checkout:focus-visible { outline: 2px solid var(--cd-ink); outline-offset: 3px; }

/* Empty drawer (opened from the header basket with nothing in it). */
html #astra-mobile-cart-drawer .woocommerce-mini-cart__empty-message,
html #astra-mobile-cart-drawer .ast-mini-cart-message { color: var(--cd-muted); font-size: 1rem; }

/* ---- Loading: the drawer opens at once; a skeleton row and button stand in until the cart arrives ---- */
html #astra-mobile-cart-drawer.cbd-cart-loading .widget_shopping_cart_content { position: relative; }
html #astra-mobile-cart-drawer.cbd-cart-loading .widget_shopping_cart_content > * { visibility: hidden; }
html #astra-mobile-cart-drawer.cbd-cart-loading .widget_shopping_cart_content::before {
  content: "";
  display: block;
  height: 72px;
  margin: 22px 24px 0;
  background:
    linear-gradient(#E6EAF0, #E6EAF0) 0 0 / 72px 72px no-repeat,
    linear-gradient(#E6EAF0, #E6EAF0) 88px 10px / 62% 15px no-repeat,
    linear-gradient(#E6EAF0, #E6EAF0) 88px 38px / 38% 15px no-repeat;
}
html #astra-mobile-cart-drawer.cbd-cart-loading .widget_shopping_cart_content::after {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  height: 60px;
  border-radius: 999px;
  background: #E2E8F0;
}
@media (prefers-reduced-motion: no-preference) {
  @keyframes cbd-cart-pulse { 50% { opacity: 0.45; } }
  html #astra-mobile-cart-drawer.cbd-cart-loading .widget_shopping_cart_content::before,
  html #astra-mobile-cart-drawer.cbd-cart-loading .widget_shopping_cart_content::after { animation: cbd-cart-pulse 1.2s ease-in-out infinite; }
}

/* Backdrop: calmer, fades with the slide. */
html .astra-mobile-cart-overlay { background: rgba(15, 23, 42, 0.45); transition: opacity 300ms var(--cd-ease, cubic-bezier(0.16, 1, 0.3, 1)); }

@media (prefers-reduced-motion: reduce) {
  html #astra-mobile-cart-drawer,
  html #astra-mobile-cart-drawer.active { transition: none; }
  html .astra-mobile-cart-overlay { transition: none; }
}

/* Product page: no inline "Se kurv" link after adding (the drawer is the confirmation). */
.added_to_cart.wc-forward { display: none !important; }
