/*
 * preloved-bazaar-theme — home.css
 *
 * Front-page styles only. Enqueued conditionally from functions.php
 * (is_front_page() gate) so it doesn't bloat catalog / PDP / settings pages.
 *
 * Spec ref: prelovedbazaar-rebuild-spec.md §4.1 + §8 (UI / design system).
 *
 * Token policy:
 *   - All colors via var(--wp--preset--color--*) from theme.json.
 *   - All spacing via var(--wp--preset--spacing--*).
 *   - All radii / shadows via var(--wp--custom--radius--*) and shadow.
 *
 * Perf:
 *   - content-visibility: auto on long below-fold sections so the browser
 *     skips paint until they scroll into view.
 *   - No render-blocking JS. The "carousel" is CSS overflow-x:auto + scroll-snap;
 *     no script required for it to function.
 */

/* ============================================================
 * 1. Hero band
 * ============================================================ */

.pb-home__hero {
	overflow: hidden;
}

.pb-home__h1 {
	font-family: var(--wp--preset--font-family--display);
	letter-spacing: -0.02em;
	max-width: 16ch;
}

.pb-home__cta-primary .wp-block-button__link,
.pb-home__cta-secondary .wp-block-button__link {
	border-radius: var(--wp--custom--radius--pill);
	padding-inline: 24px;
	padding-block: 12px;
	font-weight: 600;
	transition: transform 200ms var(--wp--custom--motion--ease-default, ease-in-out),
				box-shadow 200ms var(--wp--custom--motion--ease-default, ease-in-out);
}

.pb-home__cta-primary .wp-block-button__link:hover {
	transform: translateY(-1px);
	box-shadow: var(--wp--custom--shadow--md, 0 1px 4px rgba(21, 25, 26, 0.16));
}

.pb-home__cta-primary .wp-block-button__link:focus-visible,
.pb-home__cta-secondary .wp-block-button__link:focus-visible {
	outline: 2px solid var(--wp--preset--color--brand-blue);
	outline-offset: 3px;
}

.pb-home__hero-cover {
	overflow: hidden;
	border-radius: var(--wp--custom--radius--lg, 16px);
}

/* Hero is the LCP element. Make sure the cover background paints fast. */
.pb-home__hero-cover .wp-block-cover__background {
	content-visibility: auto;
}

/* ============================================================
 * 2. Search bar (pillbox)
 * ============================================================ */

.pb-home__search {
	display: flex;
	justify-content: center;
}

.pb-home__searchform {
	display: flex;
	align-items: center;
	gap: 8px;
	width: min(640px, 100%);
	padding: 8px 8px 8px 20px;
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--subtle);
	border-radius: var(--wp--custom--radius--pill);
	box-shadow: var(--wp--custom--shadow--sm, 0 0 2px rgba(21, 25, 26, 0.24));
	transition: box-shadow 200ms ease-in-out, border-color 200ms ease-in-out;
}

.pb-home__searchform:focus-within {
	border-color: var(--wp--preset--color--brand-green);
	box-shadow: 0 0 0 3px rgba(33, 106, 82, 0.16);
}

.pb-home__searchlabel {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.pb-home__searchinput {
	flex: 1;
	border: 0;
	outline: 0;
	background: transparent;
	font-family: var(--wp--preset--font-family--inter);
	font-size: 1rem;
	color: var(--wp--preset--color--contrast);
	min-height: 44px; /* WCAG 2.5.5 minimum target. */
}

.pb-home__searchinput::placeholder {
	color: var(--wp--preset--color--muted);
}

.pb-home__searchbtn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--brand-green);
	color: var(--wp--preset--color--surface);
	cursor: pointer;
	transition: background-color 200ms ease-in-out;
}

.pb-home__searchbtn:hover {
	background: var(--wp--preset--color--brand-green-mid);
}

.pb-home__searchbtn:focus-visible {
	outline: 2px solid var(--wp--preset--color--brand-blue);
	outline-offset: 2px;
}

/* ============================================================
 * 3. Department tiles
 * ============================================================ */

.pb-home__section--departments {
	content-visibility: auto;
	contain-intrinsic-size: 1px 600px;
}

.pb-dept-tiles {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 16px;
	grid-template-columns: 1fr;
}

@media (min-width: 600px) {
	.pb-dept-tiles {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 960px) {
	.pb-dept-tiles {
		grid-template-columns: repeat(4, 1fr);
	}
}

.pb-dept-tile {
	margin: 0;
}

.pb-dept-tile__link {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 20px;
	min-height: 140px;
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--subtle);
	border-radius: var(--wp--custom--radius--lg, 16px);
	text-decoration: none;
	color: var(--wp--preset--color--contrast);
	transition: transform 200ms ease-in-out, box-shadow 200ms ease-in-out, border-color 200ms ease-in-out;
}

.pb-dept-tile__link:hover {
	transform: translateY(-2px);
	box-shadow: var(--wp--custom--shadow--md, 0 1px 4px rgba(21, 25, 26, 0.16));
	border-color: var(--wp--preset--color--brand-green-mid);
}

.pb-dept-tile__link:focus-visible {
	outline: 2px solid var(--wp--preset--color--brand-blue);
	outline-offset: 2px;
}

.pb-dept-tile__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	font-size: 1.5rem;
	background: var(--wp--preset--color--brand-green-soft);
	color: var(--wp--preset--color--brand-green-mid);
	border-radius: var(--wp--custom--radius--pill);
}

.pb-dept-tile__name {
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.125rem;
	font-weight: 500;
	color: var(--wp--preset--color--brand-green);
}

.pb-dept-tile__tagline {
	font-size: 0.875rem;
	color: var(--wp--preset--color--muted);
}

.pb-dept-tiles__empty {
	padding: 32px;
	text-align: center;
	color: var(--wp--preset--color--muted);
	border: 1px dashed var(--wp--preset--color--subtle);
	border-radius: var(--wp--custom--radius--lg, 16px);
}

/* ============================================================
 * 4. "New in" carousel
 * ============================================================ */

.pb-home__section--newin {
	content-visibility: auto;
	contain-intrinsic-size: 1px 480px;
}

.pb-newin__rail {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(180px, 1fr);
	gap: 16px;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scrollbar-width: thin;
	padding-bottom: 12px;
	margin-top: 16px;
}

.pb-newin__rail > .pb-listing-card {
	scroll-snap-align: start;
}

@media (min-width: 960px) {
	.pb-newin__rail {
		grid-auto-columns: minmax(220px, 1fr);
	}
}

.pb-newin__empty {
	padding: 24px;
	text-align: center;
	color: var(--wp--preset--color--muted);
}

/* ============================================================
 * 5. Shop by occasion
 * ============================================================ */

.pb-home__section--occasion {
	content-visibility: auto;
	contain-intrinsic-size: 1px 240px;
}

.pb-home__occasion-grid {
	list-style: none;
	margin: 16px 0 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
}

@media (min-width: 600px) {
	.pb-home__occasion-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (min-width: 960px) {
	.pb-home__occasion-grid {
		grid-template-columns: repeat(6, 1fr);
	}
}

.pb-home__occasion {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 18px 12px;
	text-decoration: none;
	color: var(--wp--preset--color--contrast);
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--subtle);
	border-radius: var(--wp--custom--radius--md, 8px);
	font-weight: 500;
	transition: transform 200ms ease-in-out, border-color 200ms ease-in-out;
}

.pb-home__occasion:hover {
	transform: translateY(-1px);
	border-color: var(--wp--preset--color--brand-pink-accent);
}

.pb-home__occasion:focus-visible {
	outline: 2px solid var(--wp--preset--color--brand-blue);
	outline-offset: 2px;
}

.pb-home__occasion-emoji {
	font-size: 1.5rem;
	line-height: 1;
}

/* ============================================================
 * 6. Trust band
 * ============================================================ */

.pb-home__trust {
	content-visibility: auto;
	contain-intrinsic-size: 1px 280px;
}

.pb-trust {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: 1fr;
	gap: 24px;
	max-width: 1280px;
	margin-inline: auto;
}

@media (min-width: 720px) {
	.pb-trust {
		grid-template-columns: repeat(3, 1fr);
	}
}

.pb-trust__col {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 8px;
}

.pb-trust__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border-radius: var(--wp--custom--radius--pill);
	margin-bottom: 8px;
}

.pb-trust__col--green .pb-trust__icon { background: var(--wp--preset--color--brand-green-soft);  color: var(--wp--preset--color--brand-green-mid); }
.pb-trust__col--pink  .pb-trust__icon { background: var(--wp--preset--color--brand-pink-soft);   color: var(--wp--preset--color--brand-pink); }
.pb-trust__col--blue  .pb-trust__icon { background: var(--wp--preset--color--brand-blue-soft);   color: var(--wp--preset--color--brand-blue); }

.pb-trust__title {
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.125rem;
	font-weight: 500;
	margin: 0;
	color: var(--wp--preset--color--contrast);
}

.pb-trust__body {
	margin: 0;
	color: var(--wp--preset--color--muted);
	line-height: 1.5;
}

/* ============================================================
 * 7. Founder strip
 * ============================================================ */

.pb-home__founder {
	content-visibility: auto;
	contain-intrinsic-size: 1px 240px;
}

.pb-home__founder a {
	color: var(--wp--preset--color--brand-pink);
	font-weight: 600;
}

/* ============================================================
 * Reduced motion
 * ============================================================ */

@media (prefers-reduced-motion: reduce) {
	.pb-home__cta-primary .wp-block-button__link,
	.pb-home__cta-secondary .wp-block-button__link,
	.pb-dept-tile__link,
	.pb-home__occasion {
		transition: none;
	}
}
