/* ==========================================================
   OLB PRODUCT_CARD ADAPTER v0.3  (runtime 0.13.9) – ÉN ejer af produktkortet
   Samler: Produktkort RC3 (tidl. Bricks global CSS) + PRODUCT_CARD_ADAPTER v0.2.
   Ændringer i v0.3:
     - RC3's mærkeblok (wrapper med :first-child/:last-child-farver) fjernet – den tabte
       altid til Nyhed-reglen (v0.1, låst 2026-10-07) og var død kode.
     - Vægt-enheden " g" via ::after fjernet; Bricks viser nu "{cf__weight} g" med
       betingelse {cf__weight} != "" (ingen "Mærke g", når vægten mangler).
   Bricks: RC3-blokken SKAL slettes fra Bricks → Indstillinger → Brugerdefineret CSS.
   ========================================================== */

/* ==========================================================
   OLB PRODUCT CARD SPECIALIST RC3
   Klassifikation: specialist component
   Requires: OLB Design System v1.0 (runtime: Farve 1.0.5 · Typo 0.9.8 ·
             Layout 1.0 LOCKED · F&D 1.0 · Buttons 1.0.2)
   Functional master: OLB_Produktkort_Laast_Specifikation_v2.3_SPRINT1_SYNCED
   Mockup: Produktkort – Forslag 2 (v2.3)
   Build mode: B — Native Bricks
   Owns: product-card composition and Woo/Bricks adapter rules only
   Does NOT own: global colors, type scale, spacing scale, radius,
                 shadow system, focus, global product-grid breakpoints
   RC3 (2026-10-02), oprydning af RC2 – ingen visuel redesign:
     PK-b  CTA-tekst-trick (font-size:0 + ::after "Læg i kurv") fjernet –
           teksten leveres nu af olb-product-data ≥ 0.1.0 (Woo-filter)
     PK-c  dubleret .olb-product-card__temperature fjernet (sidste vandt)
     PK-d  line-height 1.2 → var(--line-height-price)
           dubleret .olb-product-card__badge samlet
   SKAL INDLÆSES GLOBALT (shop, kategori, forside, produktside-relaterede)
   ========================================================== */

/* Card */
.olb-product-card {
  height: 100%;
  padding: var(--card-padding-product);
}

/* Media well */
.olb-product-card__media {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  padding: var(--gap-tight);
  margin-bottom: var(--product-media-to-text);
}

.olb-product-card__image,
.olb-product-card__image figure,
.olb-product-card__image a,
.olb-product-card__image picture {
  width: 100%;
  height: 100%;
  min-width: 0;
  margin: 0;
}

.olb-product-card__image figure,
.olb-product-card__image a,
.olb-product-card__image picture {
  display: grid;
  place-items: center;
}

.olb-product-card__image img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.olb-product-card__image figcaption,
.olb-product-card__image .wp-caption-text {
  display: none;
}

/* Mærke-slot: tomt → skjult (selve Nyhed-mærket står nederst, v0.1-reglen) */
.olb-product-card__badge:empty {
  display: none;
}

/* Temperature (Køl / Frost) */
.olb-product-card__temperature {
  position: absolute;
  right: var(--gap-tight);
  bottom: var(--gap-tight);
  z-index: var(--z-raised);
  display: flex;
  align-items: center;
  gap: var(--gap-hairline);
}

.olb-product-card__temperature > :empty {
  display: none;
}

.olb-product-card__temperature > :not(:empty) {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-badge);
  background: var(--olb-cat-koel-frost-500);
  color: var(--color-text-inverse);
  font-family: var(--font-family-ui);
  font-size: var(--font-size-badge);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-price);
}

/* Content */
.olb-product-card__content {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.olb-product-card__title {
  margin: 0;
  color: var(--color-text-primary);
  font-family: var(--font-family-body);
  font-size: var(--font-size-product-name);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-card);
  letter-spacing: var(--tracking-normal);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--product-name-lines);
  overflow: hidden;
}

.olb-product-card__title a {
  color: inherit;
  text-decoration: none;
}

/* Brand | weight */
.olb-product-card__meta {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  min-width: 0;
  margin-top: var(--product-name-to-variant);
  color: var(--color-text-secondary);
  font-family: var(--font-family-ui);
  font-size: var(--font-size-product-sub);
  line-height: var(--line-height-ui);
  letter-spacing: var(--tracking-meta);
}

.olb-product-card__meta > * {
  min-width: 0;
}

.olb-product-card__meta > :not(:empty) + :not(:empty)::before {
  content: "|";
  margin-inline: var(--gap-hairline);
  color: var(--color-text-muted);
}

/* v0.3: " g" står nu i Bricks-teksten ({cf__weight} g) med betingelse – ingen ::after */

/* Commerce */
.olb-product-card__commerce {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-top: auto;
}

.olb-product-card__price {
  margin-top: var(--product-variant-to-price);
  color: var(--color-text-primary);
  font-family: var(--font-family-numeric);
  font-size: var(--font-size-price);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-price);
  font-variant-numeric: tabular-nums lining-nums;
}

.olb-product-card__price .price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--gap-tight);
  margin: 0;
  color: inherit;
}

.olb-product-card__price ins {
  color: var(--color-sale);
  font-weight: var(--font-weight-bold);
  text-decoration: none;
}

.olb-product-card__price del {
  color: var(--color-text-secondary);
  font-size: var(--font-size-price-old);
  font-weight: var(--font-weight-regular);
}

/* CTA */
.olb-product-card__cta {
  width: 100%;
  margin-top: var(--product-data-to-cta);
}

.olb-product-card__cta > .button,
.olb-product-card__cta > a.button,
.olb-product-card__cta .single_add_to_cart_button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: var(--button-height);
  padding-inline: var(--button-padding-x-card);
  border: var(--border-width-strong) solid transparent;
  border-radius: var(--button-radius);
  background: var(--color-cta-bg);
  color: var(--color-cta-fg);
  font-family: var(--font-family-ui);
  font-size: var(--font-size-button-sm);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-price);
  text-align: center;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (hover: hover) and (pointer: fine) {
  .olb-product-card__cta > .button:hover,
  .olb-product-card__cta > a.button:hover,
  .olb-product-card__cta .single_add_to_cart_button:hover {
    background: var(--color-cta-hover);
    color: var(--color-cta-fg);
  }
}

.olb-product-card__cta > .added_to_cart.wc-forward {
  display: none;
}

/* Defensive */
.olb-product-card,
.olb-product-card__media,
.olb-product-card__image,
.olb-product-card__content,
.olb-product-card__meta,
.olb-product-card__commerce,
.olb-product-card__cta {
  min-inline-size: 0;
}

/* ==========================================================
   OLB PRODUCT_CARD ADAPTER v0.1
   Klassifikation: component adapter (global – alle produktkort på hele sitet)
   Requires: OLB Design System v1.0 LOCKED
   Owns: produktkortets state-mærker (Nyhed)
   Does NOT own: kortets layout, Køl/Frost-mærker, CTA, retained-/på vej-state
                 (sidstnævnte leveres af OLB Out of Stock Retention)

   Nyhed-mærke (LÅST 2026-10-07):
   - Bricks: tekst-element "Nyhed" med class `olb-product-card__badge` i
     `olb-product-card__media`, condition {olb_product_new} == 1
   - Vises 30 dage fra første lagerdag (nye varer) / udgivelse (øvrige); aldrig på varer på vej
   - Placering: øverste venstre hjørne af billedområdet
   - Guld #C9A227 (kampagne) med mørk tekst, 4 px hjørner, Inter 13/600
   - pointer-events: none → klik går igennem til billedlinket
   ========================================================== */

.olb-product-card .olb-product-card__media {
  position: relative;
}

.olb-product-card .olb-product-card__badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  background: #C9A227;
  color: #1F2A2E;
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  pointer-events: none;
}

/* ==========================================================
   v0.2 (runtime 0.12.1): produktbilledet i ALLE produktkort
   Flyttet fra OLB_SHOP_CATEGORY_ADAPTER (gjaldt kun i .olb-shop-category), så forsidens
   "Populære lige nu", relaterede varer m.fl. viser billedet ens: hele pakningen inde i den
   kvadratiske billedflade (DS: .olb-product-card__media, aspect-ratio 1/1), ingen beskæring,
   ingen ulige højder. WooCommerce' ".woocommerce img { height: auto }" overstyres.
   ========================================================== */
.olb-product-card .olb-product-card__media {
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  overflow: hidden;
}
.olb-product-card .olb-product-card__media > .olb-product-card__image,
.olb-product-card .olb-product-card__media > a,
.olb-product-card .olb-product-card__media > figure,
.olb-product-card .olb-product-card__image a,
.olb-product-card .olb-product-card__image figure,
.olb-product-card .olb-product-card__image picture {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}
.olb-product-card .olb-product-card__media img,
.olb-product-card img.olb-product-card__image {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}
