/* =========================================================
   PRODUCT CARD — SINGLE SOURCE OF TRUTH
   =========================================================

   Every rule that styles a product card in a listing lives in this file, and
   nowhere else. Card rules used to be split between style.css and catalog.css,
   which produced the same bug three times in a row: an element styled in two
   files at two specificities, where changing one silently lost to the other, or
   matched on some page types but not others.

   WHAT COUNTS AS A CARD RULE
   Anything selecting .product-small, .related-products-wrapper .product-small,
   .add-to-cart-button, or our own .bt-eyebrow / .bt-specs / .bt-actions /
   .bt-details / .bt-badge. If you are styling a card, edit this file. If a rule
   you need is in style.css or catalog.css, it is in the wrong place — move it
   here rather than adding a competing one.

   Not card rules: .bt-stock (shared with the single-product summary, see
   style.css section 10) and .bt-filters / .bt-controls (catalog chrome, which
   only ever appears on archives — catalog.css).

   Two rules in style.css still name .product-small: the WooCommerce sale-badge
   reset and the `position: relative` group. Both also cover .product and
   .woocommerce-product-gallery, and must load on pages where this file does not,
   so they stay there deliberately. They are the only exception.

   THE SELECTOR CONVENTION: .product-small.box
   Flatsome renders product grids two different ways:

     ul.products > li.product-small.col > .col-inner > .product-small.box
     div.row     > .col                 > .col-inner > .product-small.box

   The first is shop/category/tag/brand/search; the second is what the
   [ux_products] shortcode emits on landing pages and the front page. Only
   `.product-small.box` is present in both, so it is the prefix for every rule
   here. Never write `.products .product-small …` — it silently skips every
   shortcode grid, which is exactly how landing pages ended up unstyled.

   `.col-inner` is the box's PARENT, not a descendant, so it needs
   `.col:has(> .col-inner > .product-small.box) > .col-inner`.

   SPECIFICITY
   `.product-small.box` + one class (0,3,0) is the baseline and beats everything
   Flatsome and landing.css bring. Four places need more; each is commented at
   the rule with the selector it has to outrank. Do not raise specificity
   anywhere else — if a rule is not applying, it is almost always the .products
   prefix problem above, not specificity.

   LOAD ORDER
   Enqueued after style.css and catalog.css (inc/bt-catalog.php), on any page
   that renders a product card. Rules below are in their original cascade order:
   former style.css rules first, then former catalog.css rules.
   ========================================================= */


/* =========================================================
   PART 1 — CARD SHELL, IMAGE, TITLE, PRICE, BUY BUTTON
   (was style.css section 12 + its responsive blocks)
   ========================================================= */
/* =========================================================
   12. SHOP + RELATED PRODUCT CARDS
========================================================= */
.product-small.col .col-inner,
.col:has(> .col-inner > .product-small.box) > .col-inner,
.related-products-wrapper .product-small .col-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.product-small.box,
.related-products-wrapper .product-small .box {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.product-small.box .box-image,
.related-products-wrapper .product-small .box-image {
  border: 1px solid var(--bt-border);
  background: var(--bt-white);
  padding: 8px;
}

.product-small.box .box-image img,
.related-products-wrapper .product-small .box-image img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.product-small.box:hover .box-image > div > a > img:not(.back-image),
.related-products-wrapper .product-small:hover .box-image > div > a > img:not(.back-image) {
  transform: scale(1.01);
}

/* Set all four sides here rather than only padding-top.
   The previous rule set padding-top alone and leaned on catalog.css for the
   rest — but catalog.css carries no box-text padding at all, and Flatsome only
   sets left/right (1.5em). So the bottom resolved to 0 and the buy button sat
   flush on the card's border, while the sides stayed at Flatsome's 24px, which
   is what made the cards feel cramped on mobile.
   A rule that depends on another file's declaration breaks silently when that
   file changes. This one stands on its own. */
.product-small.box .box-text.box-text-products,
.related-products-wrapper .product-small .box-text.box-text-products {
  padding: 12px 11px 14px;
}

.product-small.box .title-wrapper,
.related-products-wrapper .product-small .title-wrapper {
  margin-bottom: 6px;
}

.product-small.box .name.product-title,
.product-small.box .woocommerce-loop-product__title,
.related-products-wrapper .product-small .name.product-title,
.related-products-wrapper .product-small .woocommerce-loop-product__title {
  margin-bottom: 0;
  font-size: 15px;
  line-height: 1.45;
  font-weight: 500;
  color: var(--bt-navy);
}

.product-small.box .name.product-title a,
.product-small.box .woocommerce-loop-product__title a,
.related-products-wrapper .product-small .name.product-title a,
.related-products-wrapper .product-small .woocommerce-loop-product__title a {
  color: var(--bt-navy);
  text-decoration: none;
}

.product-small.box .name.product-title a:hover,
.product-small.box .woocommerce-loop-product__title a:hover,
.related-products-wrapper .product-small .name.product-title a:hover,
.related-products-wrapper .product-small .woocommerce-loop-product__title a:hover {
  color: var(--bt-navy-dark);
}

.product-small.box .price-wrapper,
.related-products-wrapper .product-small .price-wrapper {
  margin-top: 4px;
  margin-bottom: 8px;
  min-height: 24px;
}

.product-small.box .price,
.related-products-wrapper .product-small .price {
  font-size: 15px;
  line-height: 1.3;
  color: var(--bt-ink);
  font-weight: 700;
}

.product-small.box .price ins,
.related-products-wrapper .product-small .price ins {
  text-decoration: none;
  font-weight: 700;
  color: var(--bt-ink);
}

/* The old price stays struck through but readable: 4.8:1 on white. It used to be dimmed twice,
   opacity .55 here on top of Flatsome's .6 on del span.amount, which left #ced0d5 (1.5:1). */
.product-small.box .price del,
.related-products-wrapper .product-small .price del {
  color: var(--bt-muted, #6b7280);
  margin-right: 6px;
  font-size: 13px;
}

.product-small.box .price del span.amount,
.related-products-wrapper .product-small .price del span.amount {
  opacity: 1;
}

.product-small.box .add-to-cart-button,
.related-products-wrapper .product-small .add-to-cart-button {
  margin-top: 10px;
  height: auto !important;
}

.product-small.box .add-to-cart-button .button,
.related-products-wrapper .product-small .add-to-cart-button .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 118px;
  max-width: 100%;
  min-height: 38px;
  padding: 8px 14px !important;
  border: 1.5px solid var(--bt-navy);
  background: var(--bt-white);
  color: var(--bt-navy) !important;
  font-size: 14px !important;
  font-weight: 700;
  line-height: 1.2 !important;
  letter-spacing: 0.01em;
  text-transform: none;
  text-decoration: none;
  box-shadow: none;
  border-radius: 5px;
  white-space: nowrap;
}

.product-small.box .add-to-cart-button .button:hover,
.related-products-wrapper .product-small .add-to-cart-button .button:hover {
  background: var(--bt-navy);
  color: var(--bt-white) !important;
  border-color: var(--bt-navy);
}

/* =========================================================
   18. SINGLE PRODUCT TABS / RELATED PRODUCTS
========================================================= */
.single-product .related-products-wrapper {
  margin-top: 52px;
  padding-top: 0;
  padding-bottom: 48px;
  border-top: none !important;
}

@media (min-width: 850px) {.product-small.box .name.product-title,
  .product-small.box .woocommerce-loop-product__title,
  .related-products-wrapper .product-small .name.product-title,
  .related-products-wrapper .product-small .woocommerce-loop-product__title {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 65px;
  }

}

@media (max-width: 849px) {.product-small.box .box-text.box-text-products,
  .related-products-wrapper .product-small .box-text.box-text-products {
    padding-top: 10px;
  }

.product-small.box .name.product-title,
  .product-small.box .woocommerce-loop-product__title,
  .related-products-wrapper .product-small .name.product-title,
  .related-products-wrapper .product-small .woocommerce-loop-product__title {
    font-size: 14px;
    line-height: 1.4;
  }

.product-small.box .price-wrapper,
  .related-products-wrapper .product-small .price-wrapper {
    margin-bottom: 8px;
  }

.product-small.box .add-to-cart-button .button,
  .related-products-wrapper .product-small .add-to-cart-button .button {
    /*
     * Fill the card instead of forcing 140px: a 2-column mobile grid (front
     * page) gives the actions row only ~114px, and the fixed min-width pushed
     * the button 10px outside the card on 11 of 19 cards. Wrapping keeps the
     * full "Legg i handlekurv" label rather than shortening it.
     */
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 9px 8px !important;
    font-size: 13px !important;
    white-space: normal;
    line-height: 1.25;
  }

}

@media (max-width: 768px) {.single-product .related-products-wrapper {
    margin-top: 36px;
    padding-bottom: 36px;
  }

}



/* =========================================================
   PART 2 — CATALOG CARD DETAIL
   eyebrow, spec chips, condition pill, badges, actions row
   (was catalog.css)
   ========================================================= */
.product-small.box {
	background: #fff;
	border: 1px solid var(--btc-line);
	border-radius: var(--btc-radius);
	overflow: hidden;
	transition: border-color .16s ease, transform .16s ease;
}

.product-small.box:hover {
	border-color: var(--btc-accent);
	transform: translateY(-2px);
}

/* 11px sides rather than the mockup's 13px: the extra 4px is what gives the
   action row usable slack instead of one spare pixel. */
/*
 * 13px between groups, against 12px inside the price block and ~1px between the
 * eyebrow and the title. A card has four groups — identity, specs, commercial,
 * action — and uniform gaps make them read as one undifferentiated list. The
 * boundaries have to be wider than the spacing inside a group for the grouping
 * to register at all.
 */
.product-small.box .box-text {
	padding: 12px 11px 14px;
	gap: 13px;
}

/* Square thumbnails: uneven crops are what make a used-goods grid look untidy. */
.product-small.box .box-image img {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
}

.bt-badges {
	position: absolute;
	top: 8px;
	left: 8px;
	z-index: 2;
	display: flex;
	flex-direction: column;
	gap: 5px;
	align-items: flex-start;
	pointer-events: none;
}

/*
 * Scoped to the card, not bare `.bt-eyebrow`: landing.css styles section prose
 * with `.bt-landing-page .bt-lp p`, which outranks a single class and was
 * resetting the eyebrow to 16px on every shortcode landing page.
 */
.product-small.box .bt-eyebrow {
	margin: 0;
	overflow: hidden;
	font-size: 10.5px;
	font-weight: 600;
	letter-spacing: .04em;
	text-transform: uppercase;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--btc-muted);
}

/*
 * No min-height. It reserved a second line for every card, which was right when
 * titles carried the whole spec string; now that they are model-and-generation,
 * 23 of 24 fit on one line and the reserve was 19px of empty space per card.
 * The clamp stays as a guard for the occasional long one.
 */
.product-small.box .name a {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 14.5px;
	line-height: 1.3;
}

/* -----------------------------------------------------------
   Type hierarchy. Everything secondary was previously drawn in
   --bt-muted, which flattened the page: the title sat in link
   navy at weight 500 while spec chips were heavier, and the
   price rendered smaller than the chips beside it.
   ----------------------------------------------------------- */

/* Colour stays with style.css, which sets navy for product titles site-wide;
   only the weight is raised so the title outranks the chips beneath it. */
.product-small.box .name a {
	font-weight: 600;
}

/*
 * One baseline row: current price, what it was, the saving, and the scarcity.
 * WooCommerce prints <del> before <ins>; the order is flipped here so the price
 * you pay leads, as in the mockup. Wraps to a second line on a narrow card.
 */
.product-small.box .price-wrapper .price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 12px 7px;
	margin-top: auto;
	font-size: 20px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	letter-spacing: -.02em;
	line-height: 1.3;
	color: var(--btc-ink);
}

.product-small.box .price-wrapper .price ins {
	order: 1;
	text-decoration: none;
	background: none;
}

.product-small.box .price-wrapper .price del {
	order: 2;
	font-size: 12.5px;
	font-weight: 400;
	color: var(--btc-muted);
}

.product-small.box .price-wrapper .price del .amount {
	color: inherit;
}

.product-small.box .price-wrapper .price .bt-pct {
	order: 3;
}

/* Its own line under the price, as the mockup has it — flex-basis forces the
   break without moving it out of the price markup, which is what keeps it from
   becoming a separate flex item of the column and drifting. */
.product-small.box .price-wrapper .price .bt-loop-stock {
	order: 4;
	flex-basis: 100%;
	margin-left: 0;
}

.bt-specs {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.bt-specs li.bt-specs__cond {
	background: #fff;
	border: 1px solid var(--btc-line);
	font-family: inherit;
	font-weight: 600;
}

/*
 * Flatsome indents list items inside .col-inner by 1.3em, and its selector
 * outranks a plain .bt-specs li. On a row of pills that silently ate 14px per
 * chip and pushed a two-row spec block onto three.
 */
.product-small.box .bt-specs > li {
	margin-left: 0;
}

.bt-specs li {
	margin: 0;
	padding: 3px 6px;
	border-radius: 3px;
	background: var(--btc-wash);
	font-family: var(--btc-mono);
	font-size: 11px;
	line-height: 1.5;
	white-space: nowrap;
	color: var(--btc-ink);
}

/* Buy and view on one row; the primary action stays dominant but compact. */
.bt-actions {
	/* Matches the loop button height set in style.css, which was trimmed from 44px
	   to 38px so the button reads as one action among several rather than the card's
	   main event. Still above the 36px comfortable-tap floor. */
	--btc-action-h: 38px;

	display: flex;
	flex-wrap: wrap;
	/* Bottom-aligned: style.css gives .add-to-cart-button its own margin-top, so
	   aligning to the baseline of the row survives that changing. */
	align-items: flex-end;
	gap: 4px 6px;
	margin-top: 0;
}

/*
 * min-width: min-content, not 0. Zero let the wrapper shrink below the button's
 * own label — "Legg i handlekurv" needs 154px and was being clipped at 121px.
 * The row wraps instead when a card is too narrow for both actions.
 */
.product-small.box .bt-actions .add-to-cart-button,
.product-small.box .bt-actions form.cart {
	flex: 1 1 auto;
	min-width: min-content;
	height: auto !important; /* Flatsome sets an inline height that breaks alignment */
	margin: 0 !important;    /* style.css adds its own margin-top, which doubled the gap */
}

/*
 * WooCommerce prints an aria-describedby span between the button and our link.
 * It is a flex item otherwise, so it takes a slot and a gap.
 */
.product-small.box .bt-actions .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.product-small.box .bt-actions .add-to-cart-button {
	display: flex;
}

/* Height comes from style.css; this only centres the label and stops the
   button growing wider than its share of the row. */
.product-small.box .bt-actions .button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	margin: 0;
	padding: 0 10px;
	font-size: 12.5px;
	line-height: 1;
}

/*
 * The mockup's "ghost" secondary: same shape and height as the buy button,
 * muted rather than underlined text, so the pair reads as one control.
 * Height is pinned to --btc-action-h, the same value style.css gives the buy
 * button; with align-items: flex-end on the row, equal heights mean the tops
 * line up too. (Stretch was tried and made it 44px against the button's 38px.)
 */
/*
 * A quiet text link, not a second box. Two outlined boxes side by side made the
 * pair read as two equal choices and left the buy button cramped on a 240px card.
 *
 * line-height carries the vertical centring rather than flex alignment: as a flex
 * item the link's text was sitting at the top of its box, 12px above the button's
 * label. A line-height equal to the button height puts both on the same line.
 */
/*
 * A text link, not the mockup's ghost button.
 *
 * Measured at a 257px card: 213px of action row, 156px of which is
 * "Legg i handlekurv", leaving 51px. The smallest ghost that still looks like a
 * button needs 63px, and trimming the primary to the mockup's own 13.5px/10px
 * metrics only got it to a 7px overlap. Squeezing further puts the border hard
 * against the word, which reads squeezed rather than premium.
 *
 * The deeper reason is that the mockup pairs its ghost with a *filled* primary.
 * This site's loop button is outlined and fills on hover — deliberately, because
 * a grid of filled navy blocks competes with the product photographs. Given an
 * outlined primary, a text link is the secondary that separates cleanly.
 *
 * Selector carries .product-small.box .bt-actions because flatsome.css sets
 * `.box-text a:not(.button) { line-height: 1.3 }`, which outranks a plain
 * .bt-details and left the label 11px high.
 */
.product-small.box .bt-actions .bt-details {
	display: inline-block;
	flex: 0 1 auto;
	height: var(--btc-action-h);
	padding: 0;
	border: 0;
	background: none;
	font-size: 12px;
	font-weight: 600;
	line-height: var(--btc-action-h);
	white-space: nowrap;
	color: var(--btc-accent);
	text-decoration: underline;
	text-underline-offset: 3px;
	text-decoration-thickness: 1px;
	transition: color .15s ease;
}

.product-small.box .bt-actions .bt-details:hover {
	color: var(--btc-red);
}

@media (max-width: 849px) {/*
	 * Two-up cards leave ~162px of text width, and style.css gives the buy
	 * button a 140px minimum. Side by side, the button overflowed its wrapper.
	 * The image and the title already link to the product, so "Detaljer" is a
	 * third route to the same page — it gives up its space here.
	 */
	.product-small.box .bt-actions .bt-details {
		display: none;
	}

}

/* ---------------------------------------------------------
   Equal card heights: chips wrap to different depths, and the
   buy button should still line up across the row.
   --------------------------------------------------------- */

.product-small.col > .col-inner {
	height: 100%;
}

.product-small.box {
	display: flex;
	flex-direction: column;
	height: 100%;
}

.product-small.box .box-text {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
}

/* Same 9px rhythm the box-text uses, so eyebrow → title → chips → price → stock
   all sit on one grid instead of each carrying its own margin. */
.product-small.box .price-wrapper {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 13px;
}

.product-small.box .title-wrapper {
	margin: 0;
}

/*
 * Flatsome's equalize-box script writes inline heights onto .name, .box-text and
 * .price-wrapper so cards line up across a row. That made sense when titles were
 * two lines of spec string; with model-and-generation titles it reserved 65px for
 * a 19px line and pinned .box-text to a stale 291px, which trapped ~46px in the
 * gap above the price.
 *
 * It is redundant here anyway: the columns are flex items of equal height, the
 * thumbnails are square, and the price block is pinned to the bottom with
 * margin-top: auto — so the card lines up without measuring anything.
 *
 * !important because these are inline styles written by JavaScript, and rewritten
 * on resize.
 */
.product-small.box .name,
.product-small.box .box-text,
.product-small.box .price-wrapper {
	height: auto !important;
	min-height: 0 !important;
}

.product-small.box .name {
	margin: 0;
}

.product-small.box .price-wrapper .price {
	margin-top: auto;
	padding-top: 8px;
}

.product-small.box .add-to-cart-button {
	margin-top: 8px;
}

/* =========================================================
   CARD ALIGNMENT — INDEPENDENT OF THE SHORTCODE'S SETTING
   ========================================================= */
/*
 * Two [ux_products] instances (/brukt-thinkpad/, /brukt-hp-elitebook-840/) are
 * saved with text_align="center", so Flatsome renders `.box-text.text-center`
 * and centres the whole card while every other grid on the site is left-aligned.
 * The actions row also picked up auto side margins, insetting it 26px instead of
 * the 11px everything else uses.
 *
 * Card layout is defined here, not per shortcode instance — otherwise the same
 * product reads differently from one page to the next. Fixing it in CSS rather
 * than by re-saving the pages also means it survives deployment, since we ship
 * files and never the database.
 */
.product-small.box .box-text.text-center {
	text-align: start;
}

.product-small.box .box-text.text-center > *,
.product-small.box .box-text.text-center .bt-actions {
	margin-left: 0;
	margin-right: 0;
}


/* =========================================================
   AFTER ADD TO CART
   ========================================================= */
/*
 * WooCommerce's AJAX handler appends <a class="added_to_cart wc-forward">Vis
 * handlekurv</a> straight into .bt-actions. It arrives unstyled, so it became an
 * 89px uppercase flex item that pushed out past the card's right edge, squeezed
 * the button from 197px to 156px and grew the card by 16px — only on the cards
 * someone had actually clicked, which is what made it look like a bug in the
 * button itself.
 *
 * It is also redundant: Flatsome opens its cart-popup flyout on add, and the
 * header carries a cart link. So the row keeps one control, and the button
 * reports its own state instead.
 */
.product-small.box .bt-actions .added_to_cart {
	display: none;
}

/*
 * The confirmation: a tick appended to the label. WooCommerce leaves .added on
 * the button until the next page load, so this is a persistent "it is in your
 * cart", not a flash.
 *
 * Drawn with borders rather than a glyph so it inherits currentColor and stays
 * on the card's navy. A green variant was tried and dropped — it lost a cascade
 * fight with Flatsome's own outline-button colours, and navy is the more
 * consistent answer anyway.
 */
.product-small.box .add-to-cart-button .button.added::after {
	content: "";
	flex: none;
	width: 11px;
	height: 6px;
	margin-left: 8px;
	border-left: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(-45deg) translateY(-2px);
}