/**
 * Inventory Reduction Deals — deals page sections and the product-page banner.
 * Cards are WooCommerce's shop cards; this file sets the page width, the
 * grid, the horizontal card, the whole-card link and what the plugin adds.
 *
 * #e01c00 is the theme's $red (campfire-cycling-2019
 * src/scss/inc/settings/_variables.scss).
 */

/*
 * Width: the theme narrows page articles to 45rem; product archives use its
 * .content box (60.75rem from 972px, 72rem from 1240px) inside main's 1rem
 * padding. Same content width here (body class from Deals_Page).
 */
.ird-deals-page article {
	max-width: none;
	padding: 0;
}

@media (min-width: 972px) {
	.ird-deals-page article {
		max-width: 58.75rem;
		margin: 0 auto;
	}
}

@media (min-width: 1240px) {
	.ird-deals-page article {
		max-width: 70rem;
	}
}

/*
 * Grid (0.2.1): horizontal cards, as many per row as fit — two in the
 * archive's 70rem / 58.75rem box, one on tablets and phones. Overrides
 * WooCommerce's float widths (and the theme's under-481px rule); the list's
 * clearfix pseudo-elements would otherwise take grid cells.
 */
.ird-deals .ird-deals__sections.woocommerce ul.products {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr));
	gap: 1rem;
	margin: 0;
	padding: 0;
}

.ird-deals .ird-deals__sections.woocommerce ul.products::before,
.ird-deals .ird-deals__sections.woocommerce ul.products::after {
	content: none;
	display: none;
}

/*
 * Card: image on the left at the size it had in the 5-up grid (11rem),
 * name / price / sizes on the right, the card no taller than the image needs.
 * The whole card links to the product (the card link's ::after covers it);
 * size links sit above that layer so they stay clickable. A thin red border
 * says it's clickable.
 */
.ird-deals .ird-deals__sections.woocommerce ul.products[class*=columns-] li.product {
	--ird-image: 11rem;
	position: relative;
	float: none;
	clear: none;
	width: auto;
	min-height: calc(var(--ird-image) + 2rem);
	margin: 0;
	padding: 1rem 1rem 1rem calc(var(--ird-image) + 2rem);
	border: 1px solid #e01c00;
	text-align: left;
}

@media (max-width: 480px) {
	.ird-deals .ird-deals__sections.woocommerce ul.products[class*=columns-] li.product {
		--ird-image: 7.5rem;
	}
}

.ird-deals .ird-deals__sections.woocommerce ul.products li.product a.woocommerce-LoopProduct-link {
	position: static;
	border: 0;
}

.ird-deals .ird-deals__sections.woocommerce ul.products li.product a.woocommerce-LoopProduct-link > img {
	position: absolute;
	top: 1rem;
	left: 1rem;
	width: var(--ird-image);
	height: var(--ird-image);
	margin: 0;
	object-fit: contain;
}

.ird-deals .ird-deals__sections.woocommerce ul.products li.product .woocommerce-loop-product__title {
	margin: 0 0 0.35rem;
	padding: 0;
	border: 0;
	font-size: 1.1rem;
	line-height: 1.25;
}

.ird-deals .ird-deals__sections.woocommerce ul.products li.product .price {
	display: block;
	margin: 0;
	padding: 0;
	border: 0;
	font-size: 1.1rem;
}

.ird-deals .ird-deals__sections.woocommerce ul.products li.product a.woocommerce-LoopProduct-link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.ird-deals .ird-deals__sections.woocommerce ul.products li.product a.woocommerce-LoopProduct-link:focus-visible {
	outline: none;
}

.ird-deals .ird-deals__sections.woocommerce ul.products li.product a.woocommerce-LoopProduct-link:focus-visible::after {
	outline: 2px solid #e01c00;
	outline-offset: 2px;
}

.ird-deals .ird-sizes {
	position: relative;
	z-index: 2;
}

.ird-deals__status {
	margin: 1em 0;
}

.ird-section {
	margin: 0 0 1.5em;
	scroll-margin-top: 6em;
}

.ird-section__header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5em 1.25em;
	margin: 0 0 0.75em;
	padding-bottom: 0.35em;
	border-bottom: 2px solid currentColor;
}

.ird-section__title {
	margin: 0;
}

.ird-section__title .ird-code {
	font-size: 0.8em;
}

/* Phones: the theme's h2 would wrap the heading onto three lines. */
@media (max-width: 599px) {
	.ird-section__title {
		font-size: 1.4rem;
		line-height: 1.3;
	}
}

.ird-section__note {
	font-size: 0.6em;
	font-weight: normal;
	white-space: normal;
}

.ird-code {
	display: inline-block;
	padding: 0.15em 0.5em;
	border: 1px dashed currentColor;
	border-radius: 3px;
	font-size: 1.1em;
	font-weight: 600;
	letter-spacing: 0.05em;
	user-select: all;
}

.ird-deals .ird-anchor {
	display: block;
	scroll-margin-top: 6em;
}

.ird-deals li.product {
	scroll-margin-top: 6em;
}

/* The theme bullets every list item inside page content; cards are list items. */
.ird-deals li.product::before {
	content: none;
	display: none;
}

.ird-sizes {
	margin: 0.4em 0 0;
	font-size: 0.9em;
}

.ird-deals .ird-deals__sections.woocommerce ul.products li.product a.ird-size,
.ird-size {
	display: inline-block;
	margin: 0 0.35em 0.35em 0;
	padding: 0.1em 0.6em;
	border: 1px solid currentColor;
	border-radius: 3px;
	text-decoration: none;
	scroll-margin-top: 6em;
}

.ird-banner {
	margin: 0.75em 0 1em;
	padding: 0.6em 0.9em;
	border-left: 4px solid currentColor;
	background: rgba(0, 0, 0, 0.04);
}

.ird-banner[hidden] {
	display: none;
}

.ird-banner a {
	font-weight: 600;
}
