/*
 * Heroes: the homepage's (pci_hero_markup() in functions.php), replacing the
 * Smart Slider, with the search card below it, and the product pages'
 * (pci_product_hero_markup()), with the row of links below it. Only loaded
 * on those pages.
 */

.pc-hero {
	/* Same content width and gutters as the header, so the text lines up with the logo. */
	--pc-gutter: clamp(24px, 3.2vw, 56px);
	--pc-max: calc(1320px + 2 * var(--pc-gutter));

	position: relative;
	display: flex;
	align-items: center;
	min-height: clamp(480px, 74vh, 680px);
	overflow: hidden;
	isolation: isolate;
	background: #1e1e1e;
	color: #fff;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/*
 * Background images, stacked. The .is-active one fades in on top, and the
 * one before it stays put underneath until the fade is done, so the
 * background never shows through.
 */
.pc-hero-images img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0;
	transition: opacity 0s 1.5s;
}

.pc-hero-images img.is-active {
	z-index: 1;
	opacity: 1;
	transition: opacity 1.5s ease;
}

/* Darker on the left, behind the text, and a little at the bottom. */
.pc-hero::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	background:
		linear-gradient(90deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.65) 35%, rgba(0, 0, 0, 0.25) 65%, rgba(0, 0, 0, 0.05) 100%),
		linear-gradient(0deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0) 40%);
}

.pc-hero-content {
	position: relative;
	z-index: 2;
	box-sizing: border-box;
	width: 100%;
	max-width: var(--pc-max);
	margin-inline: auto;
	padding: 80px var(--pc-gutter);
}

.pc-hero .pc-hero-eyebrow,
.pc-hero .pc-hero-title,
.pc-hero .pc-hero-text {
	margin: 0;
	color: #fff;
}

.pc-hero .pc-hero-eyebrow {
	margin-bottom: 18px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	opacity: 0.8;
	text-wrap: balance;
}

.pc-hero .pc-hero-title {
	max-width: 13em;
	font-size: clamp(38px, 4.6vw, 60px);
	font-weight: 700;
	line-height: 1.05;
	letter-spacing: -0.025em;
	text-wrap: balance;
}

.pc-hero .pc-hero-text {
	max-width: 32em;
	margin-top: 20px;
	font-size: clamp(17px, 1.4vw, 19px);
	line-height: 1.55;
	opacity: 0.9;
	text-wrap: pretty;
}

.pc-hero-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 36px;
}

.pc-hero-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-height: 52px;
	padding: 0 28px;
	border-radius: 2px;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.01em;
	text-decoration: none;
	transition: background-color 0.2s ease;
}

.pc-hero .pc-hero-button-primary {
	background: var(--wp--preset--color--accent-4, #792215);
	color: #fff;
}

.pc-hero .pc-hero-button-primary:hover {
	background: #5f1a10;
}

.pc-hero .pc-hero-button-secondary {
	background: #fff;
	color: #1e1e1e;
}

.pc-hero .pc-hero-button-secondary:hover {
	background: #ece9e6;
}

.pc-hero-button:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

/*
 * Phones and tablets: no buttons, since the bar pinned to the bottom of the
 * screen has the same ones (see header.css).
 */
@media (max-width: 959px) {
	.pc-hero-buttons {
		display: none;
	}
}

/* Phones: the text spans the whole image, so darken it evenly. */
@media (max-width: 600px) {
	.pc-hero::after {
		background: rgba(0, 0, 0, 0.55);
	}

	.pc-hero-content {
		padding-block: 56px;
	}

	/* Only as tall as the text, so the search card shows on the first screen. */
	.pc-hero-home {
		min-height: 0;
	}

	.pc-hero-home .pc-hero-content {
		padding-bottom: 96px;
	}

	.pc-hero .pc-hero-eyebrow {
		font-size: 12px;
		letter-spacing: 0.1em;
	}
}

/*
 * "Search our Column Collection": the group block right after the homepage hero, in
 * the homepage's content, as a white card overlapping the bottom of the
 * hero. Heading and a short line on the left, search on the right.
 */
.pc-hero-home + .wp-block-group {
	--pc-gutter: clamp(24px, 3.2vw, 56px);

	position: relative;
	z-index: 3;
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	grid-template-areas:
		"title search"
		"note  search";
	gap: 4px 40px;
	align-items: center;
	box-sizing: border-box;
	width: calc(100% - 2 * var(--pc-gutter));
	max-width: 1100px;
	margin: -56px auto 24px !important;
	padding: 28px 32px !important;
	border-top: 3px solid var(--wp--preset--color--accent-4, #792215);
	background: #fff !important;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.14);
}

/* The group's layout centers its children and spaces them out; the grid places them here. */
.pc-hero-home + .wp-block-group > * {
	max-width: none;
	margin: 0 !important;
}

.pc-hero-home + .wp-block-group h2 {
	grid-area: title;
	align-self: end;
	color: #1e1e1e;
	font-size: 22px;
	letter-spacing: -0.01em;
}

.pc-hero-home + .wp-block-group .pc-search-note {
	grid-area: note;
	align-self: start;
	color: #6b6460;
	font-size: 14px;
}

.pc-hero-home + .wp-block-group .wp-block-search {
	grid-area: search;
}

.pc-hero-home + .wp-block-group .wp-block-search__inside-wrapper {
	gap: 8px;
}

.pc-hero-home + .wp-block-group .wp-block-search__input,
.pc-hero-home + .wp-block-group .wp-block-search__button {
	box-sizing: border-box;
	height: 52px;
	margin: 0;
	border-radius: 2px;
}

.pc-hero-home + .wp-block-group .wp-block-search__input {
	padding: 0 16px;
	border: 1px solid #d6d0c9;
	background: #fff;
	font-size: 16px;
}

.pc-hero-home + .wp-block-group .wp-block-search__input:focus {
	border-color: var(--wp--preset--color--accent-4, #792215);
	outline: 1px solid var(--wp--preset--color--accent-4, #792215);
}

.pc-hero-home + .wp-block-group .wp-block-search__button {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 0 28px;
	font-size: 15px;
	font-weight: 600;
}

/* Magnifying glass (Lucide, ISC license), before "Search". */
.pc-hero-home + .wp-block-group .wp-block-search__button::before {
	content: "";
	flex: none;
	width: 18px;
	height: 18px;
	background: currentColor;
	-webkit-mask: var(--pc-search-icon) center / contain no-repeat;
	mask: var(--pc-search-icon) center / contain no-repeat;
	--pc-search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
}

/* Smaller screens: stacked, search under the heading. */
@media (max-width: 800px) {
	.pc-hero-home + .wp-block-group {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas:
			"title"
			"note"
			"search";
		padding: 24px !important;
	}

	.pc-hero-home + .wp-block-group .wp-block-search {
		margin-top: 12px !important;
	}
}

/* Phones: a tighter card, and one search field with the button joined on as an icon. */
@media (max-width: 600px) {
	.pc-hero-home + .wp-block-group {
		margin-top: -40px !important;
		padding: 22px 20px 24px !important;
		box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
	}

	.pc-hero-home + .wp-block-group h2 {
		font-size: 20px;
	}

	.pc-hero-home + .wp-block-group .wp-block-search {
		margin-top: 16px !important;
	}

	.pc-hero-home + .wp-block-group .wp-block-search__inside-wrapper {
		gap: 0;
	}

	.pc-hero-home + .wp-block-group .wp-block-search__input {
		min-width: 0;
		border-right: 0;
		border-radius: 2px 0 0 2px;
	}

	/* Just the icon. The "Search" text stays for screen readers, at no size. */
	.pc-hero-home + .wp-block-group .wp-block-search__button {
		flex: none;
		gap: 0;
		width: 52px;
		padding: 0;
		border-radius: 0 2px 2px 0;
		font-size: 0;
	}

	.pc-hero-home + .wp-block-group .wp-block-search__button::before {
		width: 20px;
		height: 20px;
	}
}

/* Product pages: a shorter hero with the page's featured image. */
.pc-hero-product {
	min-height: clamp(360px, 50vh, 480px);
}

/* Right under the header, without WordPress's default gap above <main>. */
main:has(> .pc-hero-product:first-child) {
	margin-top: 0;
}

.pc-hero-product .pc-hero-content {
	padding-block: 64px;
}

/* Titles are all caps, so a bit smaller and without the tight spacing. */
.pc-hero-product .pc-hero-title {
	max-width: 20em;
	font-size: clamp(30px, 3.4vw, 46px);
	letter-spacing: 0;
}

/*
 * Product pages: the page's other links under the hero
 * (pci_product_links_markup()), e.g. View Catalog and Helpful Information,
 * lined up with the page content.
 */
.pc-product-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	box-sizing: content-box;
	padding: 32px var(--wp--style--root--padding-right, 24px) 0 var(--wp--style--root--padding-left, 24px);
}

.pc-product-links .pc-product-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	box-sizing: border-box;
	min-height: 46px;
	padding: 0 18px;
	border: 1px solid #d6d0c9;
	border-radius: 2px;
	background: #fff;
	color: #1e1e1e;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	transition: border-color 0.2s ease, color 0.2s ease;
}

.pc-product-links .pc-product-link:hover {
	border-color: var(--wp--preset--color--accent-4, #792215);
	color: var(--wp--preset--color--accent-4, #792215);
}

/* Arrows (Lucide, ISC license): down to a section, out to a new tab, or on to another page. */
.pc-product-link::after {
	content: "";
	flex: none;
	width: 16px;
	height: 16px;
	background: var(--wp--preset--color--accent-4, #792215);
	-webkit-mask: var(--pc-link-icon) center / contain no-repeat;
	mask: var(--pc-link-icon) center / contain no-repeat;
	--pc-link-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3Cpath d='m12 5 7 7-7 7'/%3E%3C/svg%3E");
}

.pc-product-link-section::after {
	--pc-link-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14'/%3E%3Cpath d='m19 12-7 7-7-7'/%3E%3C/svg%3E");
}

.pc-product-link-external::after {
	--pc-link-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 7h10v10'/%3E%3Cpath d='M7 17 17 7'/%3E%3C/svg%3E");
}

/* The section links scroll there, stopping below the sticky header. */
html:has(.pc-product-links) {
	scroll-padding-top: 96px;
}

@media (prefers-reduced-motion: no-preference) {
	html:has(.pc-product-links) {
		scroll-behavior: smooth;
	}
}

/* Phones: two to a row. */
@media (max-width: 600px) {
	.pc-product-links {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		padding-top: 24px;
	}

	/* Tall enough for a label on two lines, so every row matches. */
	.pc-product-links .pc-product-link {
		min-height: 52px;
		padding: 8px 12px;
		font-size: 14px;
	}
}
