/**
 * Shop + product-category archives (child theme).
 * Loaded only on /butiken/ and product_cat archives.
 */

/* Collapsed intro: keep full text in the DOM for SEO, show more of the catalogue. */
div.shop-main-desc-closed,
div.term-description-closed {
	position: relative;
	overflow: hidden;
	height: 4.4em;
	mask-image: linear-gradient(to bottom, #000 40%, transparent 100%);
	-webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent 100%);
}

@media (min-width: 768px) {
	div.shop-main-desc-closed,
	div.term-description-closed {
		height: 5.6em;
	}
}

div.shop-main-desc:not(.shop-main-desc-closed),
div.term-description:not(.term-description-closed) {
	mask-image: none;
	-webkit-mask-image: none;
	height: auto;
	overflow: auto;
}

button.toggle-cat-desc-btn {
	margin-top: 0.6em;
	margin-bottom: 1.4em;
}

.woocommerce-shop .page-title,
.tax-product_cat .page-title {
	margin-bottom: 0.35em;
}

.kf-archive-heading,
.term-description > h1:first-child {
	font-size: 1.55rem;
	font-weight: 600;
	line-height: 1.25;
	margin: 0 0 0.45em;
	color: #163a55;
}

/* Category cards: calmer type, same grid Woodmart already uses. */
.woocommerce .wd-cats-element .wd-entities-title,
.woocommerce .products .wd-cat .wd-entities-title {
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.01em;
	text-transform: none;
	line-height: 1.3;
}

.woocommerce .wd-cat .wd-cat-count,
.woocommerce .wd-cat .more-products {
	font-size: 12px;
	opacity: 0.72;
}

/* Sidebar: stop the full tree from dominating the first screen. */
.widget_product_categories .product-categories ul.children {
	margin-top: 2px;
}

.widget_product_categories .product-categories > li > a {
	font-weight: 600;
}

.widget_product_categories .product-categories ul.children li a {
	font-weight: 400;
	font-size: 0.95em;
}

.widget_product_categories .current-cat > a {
	color: #163a55;
}

/* Full-width section labels inside Woodmart's category grid. */
.products .kf-cat-group,
.wd-products-holder .kf-cat-group {
	--wd-col: 12;
	--wd-col-md: 12;
	--wd-col-sm: 12;
	--wd-col-lg: 12;
	grid-column: 1 / -1;
	flex: 0 0 100%;
	width: 100%;
	max-width: 100%;
	padding: 4px 0 0;
}

.kf-cat-group-title {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #163a55;
	margin: 18px 0 8px;
	padding-bottom: 8px;
	border-bottom: 1px solid #e8e8e8;
}

.kf-cat-group[data-kf-group="opening"] .kf-cat-group-title {
	margin-top: 4px;
}

.kf-loop-series {
	font-size: 12px;
	font-weight: 600;
	color: #163a55;
	margin: 2px 0 4px;
	letter-spacing: 0.02em;
}

/* Category drawings: show the whole window, not a cropped slice. */
.woocommerce .wd-cat .wd-cat-thumb,
.woocommerce .wd-cat .category-image-wrapp {
	position: relative;
	background: #fff;
	aspect-ratio: 1 / 1;
	overflow: hidden;
}

.woocommerce .wd-cat .wd-cat-image {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
}

.woocommerce .wd-cat .wd-cat-thumb img,
.woocommerce .wd-cat .category-image img {
	object-fit: contain !important;
	object-position: center;
	width: auto !important;
	height: auto !important;
	max-width: 86%;
	max-height: 86%;
	background: #fff;
}

.woocommerce .wd-cat:hover .wd-cat-image {
	transform: none;
}

.woocommerce .wd-cat .kf-material-pills {
	display: none;
}

/* Product cards: square image well + even title block so price/pills line up. */
.tax-product_cat .wd-product .product-element-top,
.woocommerce-shop .wd-product .product-element-top {
	position: relative;
	aspect-ratio: 1 / 1;
	background: #f4f6f8;
	overflow: hidden;
}

.tax-product_cat .wd-product .product-image-link,
.woocommerce-shop .wd-product .product-image-link {
	position: absolute;
	inset: 0;
}

.tax-product_cat .wd-product .product-image-link img,
.tax-product_cat .wd-product img.attachment-woocommerce_thumbnail,
.woocommerce-shop .wd-product .product-image-link img {
	position: absolute;
	inset: 0;
	width: 100% !important;
	height: 100% !important;
	object-fit: contain;
	object-position: center;
	background: #f4f6f8;
	padding: 6%;
	box-sizing: border-box;
}

.tax-product_cat .wd-product .wd-entities-title,
.tax-product_cat .products .product-title,
.woocommerce-shop .wd-product .wd-entities-title {
	min-height: 3.6em;
	line-height: 1.35;
}

.tax-product_cat .wd-product .product-wrapper,
.woocommerce-shop .wd-product .product-wrapper {
	display: flex;
	flex-direction: column;
	height: 100%;
}

.tax-product_cat .wd-product .product-element-bottom,
.woocommerce-shop .wd-product .product-element-bottom {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
}

.tax-product_cat .wd-product .wd-product-footer,
.woocommerce-shop .wd-product .wd-product-footer {
	margin-top: auto;
}

.kf-material-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	min-height: 1.7em;
	margin-top: 6px;
}

.kf-material-pill {
	display: inline-block;
	font-size: 11px;
	line-height: 1.3;
	padding: 2px 8px;
	border: 1px solid #d7dee5;
	border-radius: 999px;
	background: #f4f7fa;
	color: #163a55;
}

.kf-from-price {
	display: inline-block;
	margin-top: 2px;
	font-size: 13px;
	color: #163a55;
}

/* ── Shop landing: Sekel + ytterdörrar trä (inside .products grid) ── */

.products .kf-shop-highlights,
.wd-products .kf-shop-highlights {
	--wd-col: 12;
	--wd-col-lg: 12;
	--wd-col-md: 12;
	--wd-col-sm: 12;
	grid-column: 1 / -1;
	flex: 0 0 100%;
	width: 100%;
	max-width: 100%;
	margin: 0 0 8px;
	padding: 0;
	list-style: none;
}

.kf-shop-highlights-list {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	margin: 0 0 12px;
	padding: 0;
	list-style: none;
}

.kf-shop-highlight {
	margin: 0;
	padding: 0;
	list-style: none;
}

.kf-shop-highlight-link {
	display: flex;
	flex-direction: column;
	height: 100%;
	background: #fff;
	border: 1px solid #e8eef2;
	border-radius: 8px;
	overflow: hidden;
	text-decoration: none !important;
	color: inherit;
	box-shadow: 0 2px 14px rgba(22, 58, 85, 0.07);
	transition: box-shadow 0.22s ease, transform 0.22s ease;
}

.kf-shop-highlight-link:hover,
.kf-shop-highlight-link:focus-visible {
	box-shadow: 0 10px 28px rgba(22, 58, 85, 0.14);
	transform: translateY(-2px);
}

.kf-shop-highlight-media {
	display: block;
	position: relative;
	aspect-ratio: 3 / 2;
	background: #e8eef2;
	overflow: hidden;
}

.kf-shop-highlight-media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center 28%;
	display: block;
}

.kf-shop-highlight[data-slug="ytterdorrar-tra"] .kf-shop-highlight-media img,
.kf-shop-highlight:nth-child(2) .kf-shop-highlight-media img {
	object-position: center 38%;
}

.kf-shop-highlight-body {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 16px 18px 18px;
	border-top: 3px solid #ffeb34;
	background: #fff;
}

.kf-shop-highlight-title {
	font-size: 18px;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: 0.01em;
	color: #163a55;
}

.kf-shop-highlight-sub {
	font-size: 13px;
	line-height: 1.45;
	color: #5a6a7a;
}

/* Stacked full-width cards took two thirds of a phone screen before the first
   product, so on phones the photo becomes a thumbnail beside the text and the
   card reads as a link row. */
@media (max-width: 767px) {
	.kf-shop-highlights-list {
		grid-template-columns: 1fr;
		gap: 10px;
		margin-bottom: 6px;
	}

	.kf-shop-highlight-link {
		flex-direction: row;
		align-items: stretch;
		/* One line of text or two, both cards keep the same height. */
		min-height: 88px;
	}

	.kf-shop-highlight-media {
		flex: 0 0 34%;
		max-width: 132px;
		aspect-ratio: auto;
	}

	.kf-shop-highlight-body {
		flex: 1 1 auto;
		justify-content: center;
		gap: 2px;
		padding: 12px 14px;
		border-top: 0;
		border-left: 3px solid #ffeb34;
	}

	.kf-shop-highlight-title {
		font-size: 15px;
	}

	.kf-shop-highlight-sub {
		font-size: 12.5px;
		line-height: 1.35;
	}
}
