/* Bording Divi: produktkort (woocommerce/content-product.php) og produktgitteret (ul.products) i shoppen, relaterede
   varer, mersalg og WooCommerce-shortcodes. Billedflade, radius og afstande kommer fra Divi (base.css-tokens).
   Kortet: billede på billedflade med mærkater, ønskeliste og "Læg i kurv" (vises ved hover; rund ikonknap på
   touch-skærme) | kategori, titel, pris. */

/* Gitter: antal kolonner fra løkkens columns-N (shoppen sætter selv 3 ved siden af filtrene). */
.bd-site ul.products { --bd-cols: 4; display: grid !important; grid-template-columns: repeat(var(--bd-cols), minmax(0, 1fr)); gap: calc(var(--bd-gap) * 1.25) calc(var(--bd-gap) * .75); margin: 0 !important; padding: 0 !important; list-style: none; }
.bd-site ul.products::before, .bd-site ul.products::after { content: none !important; display: none !important; }
.bd-site ul.products.columns-1 { --bd-cols: 1; }
.bd-site ul.products.columns-2 { --bd-cols: 2; }
.bd-site ul.products.columns-3 { --bd-cols: 3; }
.bd-site ul.products.columns-5 { --bd-cols: 5; }
.bd-site ul.products.columns-6 { --bd-cols: 6; }

.bd-site ul.products li.product.bd-card { --bd-bag-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 8h14l-1.2 11.1a2 2 0 0 1-2 1.9H8.2a2 2 0 0 1-2-1.9z'/%3E%3Cpath d='M9 8V6.5a3 3 0 0 1 6 0V8'/%3E%3Cpath d='M12 11.5v5M9.5 14h5'/%3E%3C/svg%3E"); container: bd-card / inline-size; position: relative; display: flex; flex-direction: column; width: auto !important; min-width: 0; margin: 0 !important; padding: 0 !important; float: none !important; clear: none !important; border: 0; background: none; text-align: left; }

/* Billedflade. overflow: clip, så flader ikke kan rulles (billedet zoomer 4 % ved hover, og fokus på knapperne
   rullede ellers fladen et par pixel, så kurveknappen flyttede sig) */
.bd-card .bd-card__media { position: relative; overflow: hidden; overflow: clip; aspect-ratio: 1 / 1; border-radius: var(--bd-radius-card); background: var(--bd-media); isolation: isolate; }
.bd-card .bd-card__img { display: block; width: 100%; height: 100%; }
.bd-site .bd-card .bd-card__img img { display: block; width: 100% !important; height: 100% !important; margin: 0 !important; border-radius: 0; box-shadow: none; object-fit: cover; transition: transform .6s cubic-bezier(.2, .7, .2, 1), opacity .35s ease; }
.bd-card .bd-card__alt { position: absolute; inset: 0; opacity: 0; }
@media (hover: hover) and (pointer: fine) {
	.bd-card:hover .bd-card__img img:first-child { transform: scale(1.04); }
	.bd-card--alt:hover .bd-card__img img:first-child { opacity: 0; }
	.bd-card--alt:hover .bd-card__alt { opacity: 1; }
}

/* Mærkater øverst til venstre */
.bd-card .bd-card__badges { position: absolute; top: 12px; left: 12px; z-index: 2; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; pointer-events: none; }
.bd-card .bd-card__badges:empty { display: none; }

/* Ønskeliste (bdk-woo-addon på woocommerce_after_shop_loop_item) øverst til højre på billedet */
.bd-card .bdk-wishlist-loop { position: absolute; top: 12px; right: 12px; z-index: 3; margin: 0; }
.bd-card .bdk-wishlist-btn { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: var(--bd-surface); color: var(--bd-text); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); transition: opacity .2s ease, transform .2s ease, color .15s ease; }
.bd-card .bdk-wishlist-btn .bdk-icon { width: 20px; height: 20px; }
/* Hover/fokus på hjertet: accentflade og hvidt hjerte (også når varen allerede er på ønskelisten) */
.bd-card .bdk-wishlist-btn:is(:hover, :focus-visible) { background: var(--bd-accent); color: var(--bd-on-accent); }
.bd-card .bdk-wishlist-btn:is(:hover, :focus-visible) .bdk-icon { color: var(--bd-on-accent); }
.bd-card .bdk-wishlist-btn[aria-pressed="true"]:is(:hover, :focus-visible) .bdk-icon { fill: var(--bd-on-accent); }
@media (hover: hover) and (pointer: fine) {
	.bd-card .bdk-wishlist-btn:not([aria-pressed="true"]) { opacity: 0; transform: translateY(-4px); }
	.bd-card:hover .bdk-wishlist-btn, .bd-card .bdk-wishlist-btn:focus-visible { opacity: 1; transform: none; }
	.bd-card:hover .bdk-wishlist-btn:hover { transform: scale(1.06); }
}

/* Læg i kurv: knap i bunden af billedet ved hover/fokus */
.bd-card .bd-card__atc { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 2; }
.bd-site .bd-card .bd-card__atc .button { display: flex !important; align-items: center; justify-content: center; width: 100%; min-height: 44px; text-align: center; margin: 0 !important; padding: 10px 16px !important; font-size: 14px !important; }
.bd-site .bd-card .bd-card__atc .button.loading { opacity: .6; }
.bd-card .bd-card__atc .added_to_cart { display: none !important; }
@media (hover: hover) and (pointer: fine) {
	.bd-card .bd-card__atc { opacity: 0; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease; }
	.bd-card:hover .bd-card__atc, .bd-card .bd-card__atc:focus-within { opacity: 1; transform: none; }
}
/* Touch: rund ikonknap nederst til højre (teksten bliver i knappen til skærmlæsere) */
@media (hover: none), (pointer: coarse) {
	.bd-card .bd-card__atc { left: auto; right: 12px; bottom: 12px; }
	.bd-site .bd-card .bd-card__atc .button { width: 40px; height: 40px; min-height: 40px; padding: 0 !important; border-radius: 50% !important; gap: 0 !important; font-size: 0 !important; line-height: 0 !important; overflow: hidden; }
	.bd-site .bd-card .bd-card__atc .button::before { content: "" !important; position: static !important; display: block !important; flex: none; width: 20px; height: 20px; margin: 0 !important; opacity: 1 !important; transform: none !important; background: currentColor; -webkit-mask: var(--bd-bag-icon) center / contain no-repeat; mask: var(--bd-bag-icon) center / contain no-repeat; }
	.bd-card.outofstock .bd-card__atc { display: none; }
}

/* Smalle kort (under 220 px, fx fire kort i en halv kolonne på forsiden): rund ikonknap, mindre mærkater og hjerte.
   Hjerte og kurv har samme størrelse og afstand til kanten (36 px, 8 px); på brede touch-kort 40 px, 12 px. */
@container bd-card (max-width: 220px) {
	.bd-card .bd-card__badges { top: 8px; left: 8px; }
	.bd-card .bd-badge { min-height: 22px; padding: 2px 8px; font-size: 12px; }
	.bd-card .bdk-wishlist-loop { top: 8px; right: 8px; }
	.bd-card .bdk-wishlist-btn { width: 36px; height: 36px; }
	.bd-card .bdk-wishlist-btn .bdk-icon { width: 18px; height: 18px; }
	.bd-card .bd-card__atc { left: auto; right: 8px; bottom: 8px; }
	.bd-site .bd-card .bd-card__atc .button { width: 36px; height: 36px; min-height: 36px; padding: 0 !important; border-radius: 50% !important; gap: 0 !important; font-size: 0 !important; line-height: 0 !important; overflow: hidden; }
	.bd-site .bd-card .bd-card__atc .button::before { content: "" !important; position: static !important; display: block !important; flex: none; width: 18px; height: 18px; margin: 0 !important; opacity: 1 !important; transform: none !important; background: currentColor; -webkit-mask: var(--bd-bag-icon) center / contain no-repeat; mask: var(--bd-bag-icon) center / contain no-repeat; }
	.bd-card.outofstock .bd-card__atc { display: none; }
	.bd-card .bd-card__body { padding-top: 10px; }
	.bd-site .bd-card .bd-card__cat { font-size: 11px; }
	.bd-site .bd-card .bd-card__title { font-size: 15px !important; }
	.bd-site .bd-card .price { font-size: 15px !important; }
	.bd-site .bd-card .price del { font-size: 13px; }
}

/* Tekst */
.bd-card .bd-card__body { display: flex; flex-direction: column; gap: 4px; padding: 14px 2px 0; }
.bd-site .bd-card .bd-card__cat { margin: 0; padding: 0; color: var(--bd-muted); font-size: 12px; font-weight: 600; line-height: 1.3; letter-spacing: .1em; text-transform: uppercase; }
.bd-site .bd-card .bd-card__title { margin: 0 !important; padding: 0 !important; color: var(--bd-text); font-size: 16px !important; font-weight: 500; line-height: 1.35 !important; }
.bd-card .bd-card__title a { color: inherit; text-decoration: none; }
.bd-card .bd-card__title a:hover { color: var(--bd-accent); }
.bd-site .bd-card .price { display: flex !important; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 2px 0 0 !important; color: var(--bd-text) !important; font-size: 16px !important; font-weight: 600; line-height: 1.3; }
.bd-site .bd-card .price del { order: 2; color: var(--bd-muted); font-size: 14px; font-weight: 400; opacity: 1; }
.bd-site .bd-card .price ins { color: var(--bd-accent); font-weight: 600; text-decoration: none; }
.bd-site .bd-card .star-rating { margin: 2px 0 0 !important; font-size: 12px; }

/* Tablet: fem/seks kolonner bliver til tre; fire bliver til to under 900 px (fire kort giver to hele rækker, ikke 3 + 1) */
@media (max-width: 1024px) {
	.bd-site ul.products:is(.columns-5, .columns-6) { --bd-cols: 3; }
}
@media (max-width: 900px) {
	.bd-site ul.products.columns-4 { --bd-cols: 2; }
}
@media (max-width: 767px) {
	.bd-site ul.products:is(.columns-3, .columns-4, .columns-5, .columns-6) { --bd-cols: 2; }
	.bd-site ul.products { gap: 28px 12px; }
	.bd-card .bd-card__badges { top: 8px; left: 8px; }
	.bd-card .bdk-wishlist-loop { top: 8px; right: 8px; }
	.bd-card .bdk-wishlist-btn { width: 36px; height: 36px; }
	.bd-card .bdk-wishlist-btn .bdk-icon { width: 18px; height: 18px; }
	.bd-card .bd-card__atc { right: 8px; bottom: 8px; }
	.bd-site .bd-card .bd-card__atc .button { width: 36px; height: 36px; min-height: 36px; }
	.bd-card .bd-badge { min-height: 22px; padding: 2px 8px; font-size: 12px; }
	.bd-card .bd-card__body { padding-top: 10px; }
	.bd-site .bd-card .bd-card__cat { font-size: 11px; }
	.bd-site .bd-card .bd-card__title { font-size: 15px !important; }
	.bd-site .bd-card .price { font-size: 15px !important; }
	.bd-site .bd-card .price del { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
	.bd-site .bd-card .bd-card__img img, .bd-card .bd-card__atc, .bd-card .bdk-wishlist-btn { transition: none; }
}
