/**
 * Home machine category teasers — 3×2 grid, 485×620 cards.
 * Design: 40-product-teaser-scroll.pdf, 42-hover-effects-detail.pdf
 *
 * Same visual rule as /products: thumb_bg plate + machine photo (contain, centered).
 * Hover: media slide-up + desc/arrow reveal.
 */

.spiro-hp-categories {
	--spiro-cat-ratio: 485 / 620;
	--spiro-cat-bg-fallback: #e8e8e8;
	--spiro-cat-radius: 22px;
	--spiro-cat-pad: 40px;
	--spiro-cat-hover-lift: 40px;
	padding-bottom: clamp(48px, 6vw, 96px);
}

.spiro-hp-categories__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: clamp(16px, 1.8vw, 24px);
}

.spiro-hp-categories__card {
	display: block;
	position: relative;
	width: 100%;
	aspect-ratio: var(--spiro-cat-ratio);
	border-radius: var(--spiro-cat-radius);
	background-color: var(--spiro-cat-bg-fallback);
	color: #000;
	text-decoration: none;
	overflow: hidden;
	isolation: isolate;
}

/* Plate + photo — slide up together on hover (same as /products).
   Plate is taller than the card so translateY does not reveal the gray fallback. */
.spiro-hp-categories__media {
	position: absolute;
	inset: 0;
	z-index: 0;
	overflow: visible;
	transform: translateY(0);
	transition: transform var(--spiro-hover-duration, 0.55s) var(--spiro-hover-ease, cubic-bezier(0.22, 1, 0.36, 1));
	pointer-events: none;
}

.spiro-hp-categories__card:hover .spiro-hp-categories__media,
.spiro-hp-categories__card:focus-visible .spiro-hp-categories__media {
	transform: translateY(calc(-1 * var(--spiro-cat-hover-lift)));
}

.spiro-hp-categories__bg {
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	bottom: calc(-1 * var(--spiro-cat-hover-lift));
	z-index: 0;
	background-color: var(--spiro-cat-bg-fallback);
	background-image: var(--spiro-cat-plate-bg, none);
	background-repeat: no-repeat;
	background-size: cover;
	background-position: center center;
}

.spiro-hp-categories__photo {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: block;
	width: auto;
	height: auto;
	max-width: 160%;
	max-height: 100%;
	transform: translateX(-20%);
	margin: auto;
	object-fit: contain;
	object-position: center;
	filter: drop-shadow(2px 5px 5px #afafaf);
}

.spiro-hp-categories__content {
	position: absolute;
	left: var(--spiro-cat-pad);
	right: var(--spiro-cat-pad);
	bottom: var(--spiro-cat-pad);
	z-index: 2;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	align-items: flex-start;
	max-height: calc(100% - (var(--spiro-cat-pad) * 2));
}

.spiro-hp-categories__track {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	align-items: flex-start;
	width: 100%;
	min-width: 0;
}

.spiro-hp-categories__title {
	display: block;
	margin: 0;
	padding: 0;
	font-family: var(--spiro-font-family, "Outfit", Arial, sans-serif);
	font-size: 35px;
	font-weight: var(--spiro-font-weight-extrabold, 800);
	line-height: 1.2;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: #000;
}

.spiro-hp-categories__desc {
	display: block;
	width: 100%;
	margin: 0;
	max-height: 0;
	opacity: 0;
	overflow: hidden;
	transition: max-height 0.55s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.45s ease, margin-top 0.45s ease;
}

.spiro-hp-categories__desc,
.spiro-hp-categories__desc p,
.spiro-hp-categories__desc div,
.spiro-hp-categories__desc span,
.spiro-hp-categories__desc a,
.spiro-hp-categories__desc strong,
.spiro-hp-categories__desc em {
	margin: 0;
	padding: 0;
	color: #000 !important;
	text-decoration: none;
	font-family: var(--spiro-font-family, "Outfit", Arial, sans-serif);
	font-size: 18px;
	font-weight: var(--spiro-font-weight-medium, 500);
	line-height: 1.1;
}

.spiro-hp-categories__desc p + p,
.spiro-hp-categories__desc div + div {
	margin-top: 0.6em;
}

.spiro-hp-categories__card:hover .spiro-hp-categories__desc,
.spiro-hp-categories__card:focus-visible .spiro-hp-categories__desc {
	margin-top: 12px;
	max-height: 10.5em;
	opacity: 1;
}

.spiro-hp-categories__arrow {
	display: block;
	max-height: 0;
	margin: 0;
	opacity: 0;
	overflow: hidden;
	line-height: 1;
	transition: max-height 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease 0.04s, margin-top 0.45s ease;
}

.spiro-hp-categories__arrow::before {
	/* content: "→"; */
	content: url(../images/black_arrow-s.svg);
	display: block;
	font-family: var(--spiro-font-family, "Outfit", Arial, sans-serif);
	font-size: 20px;
	font-weight: var(--spiro-font-weight-regular, 400);
	line-height: 1;
	color: #000;
	width: 28px;
    height: 28px;
}

.spiro-hp-categories__card:hover .spiro-hp-categories__arrow,
.spiro-hp-categories__card:focus-visible .spiro-hp-categories__arrow {
	max-height: 24px;
	margin-top: 20px;
	opacity: 1;
}

@media (max-width: 1200px) {
	.spiro-hp-categories {
		--spiro-cat-pad: clamp(24px, 3vw, 40px);
	}
}

@media (max-width: 992px) {
	.spiro-hp-categories__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	.spiro-hp-categories__grid {
		grid-template-columns: 1fr;
		max-width: 485px;
		margin-left: auto;
		margin-right: auto;
	}

	.spiro-hp-categories__desc {
		max-height: none;
		opacity: 1;
		margin-top: 12px;
	}

	.spiro-hp-categories__arrow {
		max-height: 24px;
		margin-top: 18px;
		opacity: 1;
	}

	/* Match /products: no media lift on small screens */
	.spiro-hp-categories__card:hover .spiro-hp-categories__media,
	.spiro-hp-categories__card:focus-visible .spiro-hp-categories__media {
		transform: translateY(0);
	}
}

/* Mobile: photo above text (no overlay) */
@media (max-width: 575px) {
	.spiro-hp-categories {
		--spiro-cat-pad: 20px;
	}

	.spiro-hp-categories__card {
		display: flex;
		flex-direction: column;
		aspect-ratio: auto;
		height: auto;
		min-height: 0;
		/* Full-card plate — thumb_bg on the card only */
		background-color: var(--spiro-cat-bg-fallback);
		background-image: var(--spiro-cat-plate-bg, none);
		background-repeat: no-repeat;
		background-size: cover;
		background-position: center center;
	}

	.spiro-hp-categories__media {
		position: relative;
		inset: auto;
		flex: 0 0 auto;
		width: 100%;
		aspect-ratio: 4 / 3;
		min-height: 200px;
		overflow: hidden;
		background: transparent;
	}

	/* Plate lives on the card — hide the dedicated bg layer */
	.spiro-hp-categories__bg {
		display: none;
	}

	.spiro-hp-categories__content {
		position: relative;
		left: auto;
		right: auto;
		bottom: auto;
		z-index: 1;
		flex: 1 1 auto;
		max-height: none;
		padding: var(--spiro-cat-pad);
		justify-content: flex-start;
		background: transparent;
	}

	.spiro-hp-categories__track {
		justify-content: flex-start;
	}

	.spiro-hp-categories__title {
		font-size: clamp(22px, 7vw, 28px);
	}

	.spiro-hp-categories__desc,
	.spiro-hp-categories__desc p,
	.spiro-hp-categories__desc div,
	.spiro-hp-categories__desc span {
		font-size: 15px;
		line-height: 1.35;
	}
}

/* ≤920px: fluid card titles so long names fit */
@media (max-width: 920px) {
	.spiro-hp-categories__title {
		font-size: clamp(18px, 4.5vw, 26px);
		line-height: 1.15;
		overflow-wrap: anywhere;
		hyphens: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.spiro-hp-categories__media,
	.spiro-hp-categories__desc,
	.spiro-hp-categories__arrow {
		transition: none !important;
	}

	.spiro-hp-categories__media {
		transform: translateY(0);
	}

	.spiro-hp-categories__desc {
		max-height: none;
		opacity: 1;
		margin-top: 12px;
	}

	.spiro-hp-categories__arrow {
		max-height: 24px;
		margin-top: 18px;
		opacity: 1;
	}
}
