/**
 * Cool Bear — Homepage merchandising component styles.
 *
 * Mobile-first. Loaded only on the front page (gated on is_front_page()
 * in functions.php). Covers the textured hero backdrop, category tiles,
 * featured range strip, and trust band. Uses theme colour/spacing tokens
 * exclusively (no hard-coded colours) so it tracks theme.json.
 *
 * @package Cool_Bear
 * @since   2026-06-05 (quick 260605-br5)
 */

/* -------------------------------------------------------------------------
 * HERO — textured dark backdrop (issue #6/#hero polish)
 * Radial accent glow + faint diagonal grid lines over the base dark, so the
 * hero no longer reads as flat black. Text contrast preserved (tokens).
 * ---------------------------------------------------------------------- */
.cb-hero {
	position: relative;
	overflow: hidden;
	background-color: var(--wp--preset--color--base);
	background-image:
		radial-gradient(
			circle at 72% 18%,
			rgba(232, 255, 0, 0.10) 0%,
			rgba(232, 255, 0, 0.04) 32%,
			transparent 58%
		),
		repeating-linear-gradient(
			135deg,
			rgba(46, 46, 56, 0.35) 0,
			rgba(46, 46, 56, 0.35) 1px,
			transparent 1px,
			transparent 28px
		);
	background-repeat: no-repeat, repeat;
}

/* Keep the headline/subline/picker above the texture. */
.cb-hero > * {
	position: relative;
	z-index: 1;
}

/* Mobile: shrink the glow so it doesn't wash out the headline on small screens. */
@media (max-width: 600px) {
	.cb-hero {
		background-image:
			radial-gradient(
				circle at 80% 8%,
				rgba(232, 255, 0, 0.10) 0%,
				rgba(232, 255, 0, 0.03) 28%,
				transparent 50%
			),
			repeating-linear-gradient(
				135deg,
				rgba(46, 46, 56, 0.30) 0,
				rgba(46, 46, 56, 0.30) 1px,
				transparent 1px,
				transparent 24px
			);
	}
}

/* Shared section shell for the merchandising bands.
 * 2026-07-02: widened from the theme content size (760px) — the home
 * merchandising deserves more room than long-form copy ("everything is too
 * boxed in"). 1280 sits between contentSize and wideSize(1440). */
.cb-home-section {
	max-width: min(1280px, 94vw);
	margin-inline: auto;
	padding-inline: var(--wp--preset--spacing--40, 1rem);
}

.cb-home-section__heading {
	margin: 0 0 var(--wp--preset--spacing--40, 1rem);
	color: var(--wp--preset--color--text);
	font-weight: 600;
}

/* -------------------------------------------------------------------------
 * CATEGORY BANNERS (2026-07-02) — one wide cinematic band per category,
 * same visual language as the /coilovers/ + /brakes/ landing discipline
 * bands: photo well one side, body the other, alternating rhythm.
 * Single column stack with the photo on top at <=760px.
 * ---------------------------------------------------------------------- */
.cb-hbands {
	display: grid;
	gap: var(--wp--preset--spacing--40, 1rem);
}

.cb-hband {
	position: relative;
	display: grid;
	grid-template-columns: 11fr 9fr;
	min-height: 220px;
	overflow: hidden;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 10px;
	background-color: var(--wp--preset--color--surface);
	background-image: linear-gradient(
		135deg,
		var(--wp--preset--color--surface-raised) 0%,
		var(--wp--preset--color--surface) 60%
	);
	color: var(--wp--preset--color--text);
	text-decoration: none;
	transition: border-color 0.18s ease, transform 0.18s ease;
}

.cb-hband:hover,
.cb-hband:focus-visible {
	border-color: var(--wp--preset--color--accent);
	transform: translateY(-2px);
	outline: none;
}

.cb-hband--rev {
	grid-template-columns: 9fr 11fr;
}

.cb-hband--rev .cb-hband__media {
	order: 2;
}

.cb-hband__media {
	position: relative;
	overflow: hidden;
	pointer-events: none;
}

.cb-hband__media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	filter: saturate(0.92);
	transition: transform 0.35s ease;
}

/* Scrim so the photo melts toward the body side, either direction. */
.cb-hband__media::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(to right, transparent 55%, var(--wp--preset--color--surface) 100%);
}

.cb-hband--rev .cb-hband__media::after {
	background: linear-gradient(to left, transparent 55%, var(--wp--preset--color--surface) 100%);
}

.cb-hband:hover .cb-hband__media img,
.cb-hband:focus-visible .cb-hband__media img {
	transform: scale(1.04);
}

@media (prefers-reduced-motion: reduce) {
	.cb-hband,
	.cb-hband__media img {
		transition: none;
	}
}

.cb-hband__body {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 0.5rem;
	padding: var(--wp--preset--spacing--50, 1.5rem) var(--wp--preset--spacing--60, 2rem);
	min-width: 0;
}

.cb-hband__kicker {
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--wp--preset--color--accent);
}

.cb-hband__headline {
	max-width: 26ch;
	font-size: clamp(1.2rem, 1rem + 1vw, 1.6rem);
	font-weight: 650;
	line-height: 1.25;
	color: var(--wp--preset--color--text);
}

.cb-hband__foot {
	display: flex;
	align-items: baseline;
	gap: 1rem;
	margin-top: 0.5rem;
}

.cb-hband__count {
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--wp--preset--color--text-subtle);
}

.cb-hband__cta {
	font-size: 0.875rem;
	font-weight: 700;
	color: var(--wp--preset--color--accent);
}

.cb-hband__cta::after {
	content: " \2192";
}

@media (max-width: 760px) {
	.cb-hband,
	.cb-hband--rev {
		grid-template-columns: 1fr;
		min-height: 0;
	}

	.cb-hband__media,
	.cb-hband--rev .cb-hband__media {
		order: 0;
		height: 150px;
	}

	.cb-hband__media::after,
	.cb-hband--rev .cb-hband__media::after {
		background: linear-gradient(to bottom, transparent 55%, var(--wp--preset--color--surface) 100%);
	}
}

/* -------------------------------------------------------------------------
 * FEATURED RANGE STRIP (issue #8) — horizontal cards of coilover ranges.
 * Flex row on desktop; horizontal-scroll on mobile.
 * ---------------------------------------------------------------------- */
.cb-range-strip__track {
	/* Full 9-range line-up (2026-06-11): responsive grid, not one cramped
	   flex row. 3-up desktop, 2-up tablet; mobile rule below unchanged. */
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--wp--preset--spacing--40, 1rem);
}
@media (max-width: 1023px) and (min-width: 782px) {
	.cb-range-strip__track {
		grid-template-columns: repeat(2, 1fr);
	}
}

.cb-range-card {
	display: flex;
	flex: 1 1 0;
	min-width: 0;
	flex-direction: column;
	gap: 0.35rem;
	padding: var(--wp--preset--spacing--40, 1rem) var(--wp--preset--spacing--50, 1.25rem);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 8px;
	background-color: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--text);
	text-decoration: none;
	transition: border-color 0.18s ease, transform 0.18s ease;
}

.cb-range-card:hover,
.cb-range-card:focus-visible {
	border-color: var(--wp--preset--color--accent);
	transform: translateY(-2px);
	outline: none;
}

.cb-range-card__label {
	font-size: 1.0625rem;
	font-weight: 600;
}

/* What-is-it-for blurb — the range's short usage tag under the name. */
.cb-range-card__blurb {
	font-size: 0.8125rem;
	line-height: 1.35;
	color: var(--wp--preset--color--text-muted);
}

.cb-range-card__count {
	font-size: 0.75rem;
	color: var(--wp--preset--color--text-muted);
	opacity: 0.85;
}

/* Footer row: pins to the card bottom; holds the optional "From £X" chip and
   the "View range" CTA on one baseline-aligned line. */
.cb-range-card__foot {
	margin-top: auto;
	padding-top: 0.5rem;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.25rem 0.75rem;
}

.cb-range-card__price {
	font-size: 1.05rem;
	font-weight: 800;
	color: var(--wp--preset--color--accent);
	white-space: nowrap;
	letter-spacing: -0.01em;
}

.cb-range-card__cta {
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--wp--preset--color--text-muted);
	transition: color 0.18s ease;
}
.cb-range-card__cta::after {
	content: " \2192";
	color: var(--wp--preset--color--accent);
}
.cb-range-card:hover .cb-range-card__cta,
.cb-range-card:focus-visible .cb-range-card__cta {
	color: var(--wp--preset--color--text);
}

@media (max-width: 781px) {
	/* 9 ranges on mobile: horizontal snap-scroll carousel over the grid. */
	.cb-range-strip__track {
		display: flex;
		flex-wrap: nowrap;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		padding-bottom: 0.5rem;
	}

	.cb-range-card {
		flex: 0 0 70%;
		scroll-snap-align: start;
	}
}

/* -------------------------------------------------------------------------
 * ACCEPTED-PAYMENTS STRIP — slim band of official brand marks.
 * ---------------------------------------------------------------------- */
.cb-trust-band {
	border-top: 1px solid var(--wp--preset--color--border);
	border-bottom: 1px solid var(--wp--preset--color--border);
	background-color: var(--wp--preset--color--surface-sunken);
}

.cb-trust-band__inner {
	max-width: var(--wp--style--global--content-size, 1100px);
	margin-inline: auto;
	padding: var(--wp--preset--spacing--40, 1rem) var(--wp--preset--spacing--40, 1rem);
}

.cb-pay-strip {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.55rem 0.9rem;
}

.cb-pay-strip__label {
	margin: 0; /* it's a <p> (wpautop-safe); drop the default paragraph margin */
	font-size: 0.75rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wp--preset--color--text-subtle);
}

.cb-pay-strip__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.55rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.cb-pay-logo {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 30px;
	padding: 3px 6px;
	border-radius: 6px;
	background: #fff;
	box-shadow: 0 1px 2px rgb(0 0 0 / 0.18);
}

.cb-pay-logo img {
	height: 22px;
	width: auto;
	display: block;
}

/* Klarna ships as a 1:1 pink squircle that already fills its tile — give it a
   touch more height so its glyph optically matches the wider card marks. */
.cb-pay-logo--klarna img {
	height: 26px;
}

/* -------------------------------------------------------------------------
 * Footer rhythm — light spacing/border tweak (HOMEPAGE ONLY: this stylesheet
 * is enqueued only on is_front_page()) so the sitewide authorised-dealer band
 * + newsletter sit in the new merchandised rhythm beneath the trust band.
 * CSS only, no structural change (those bands render via the footer chain).
 * ---------------------------------------------------------------------- */
.cb-trust-band + .alignfull.has-surface-background-color {
	border-top: 1px solid var(--wp--preset--color--border);
}

.cb-home-merch {
	border-top: 1px solid var(--wp--preset--color--border);
}

/* === Atmosphere pass (2026-06-06) ====================================== */

/* (Photographic 2x2 category tiles retired 2026-07-02 — replaced by the
 * .cb-hband cinematic category banners above.) */

/* Range cards gain their studio shot above the label. */
.cb-range-card {
	overflow: hidden;
}
.cb-range-card__media {
	display: block;
	/* Bleed to the card edges (top = card's top padding, sides = card's H padding). */
	margin: calc(-1 * var(--wp--preset--spacing--40, 1rem)) calc(-1 * var(--wp--preset--spacing--50, 1.25rem)) 0.7rem;
	/* Was aspect-ratio:1/1 — a ~400px square well holding a tall, thin strut render,
	   which left huge empty graphite and made every card enormous ("bulky", 2026-07-03).
	   Cap the well height so cards are compact and uniform; the render contains to fit. */
	height: clamp(190px, 17vw, 232px);
	overflow: hidden;
	border-bottom: 1px solid var(--wp--preset--color--border);
	/* Well colour + blend are inherited from .cb-img-well (graphite, normal blend —
	   see atmosphere.css). Range cards carry both classes, so no override here. */
}
.cb-range-card__media img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	transition: transform 0.3s ease;
}
.cb-range-card:hover .cb-range-card__media img,
.cb-range-card:focus-visible .cb-range-card__media img {
	transform: scale(1.05);
}

/* Hero copy needs to sit confidently over the ghost. */
.cb-hero h1 {
	max-width: 19ch;
	text-wrap: balance;
}
.cb-hero > p {
	max-width: 52ch;
}

/* === Range bands atmosphere (2026-06-15) ================================
   Replaces the flat steel wash on the merchandising band with a layered
   graphite treatment: a darkened Macau motorsport shot + a strong scrim +
   a faint accent glow. Cards (white img-wells) float above it, legible. */
.cb-range-atmosphere {
	position: relative;
	isolation: isolate;
}
.cb-range-atmosphere::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -2;
	background-image: url('/wp-content/uploads/2026/06/cb-macau16-pack.jpg');
	background-size: cover;
	background-position: center 30%;
	opacity: 0.20;
	filter: saturate(0.55) brightness(0.55) contrast(1.05);
}
.cb-range-atmosphere::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background:
		radial-gradient(62% 90% at 85% 6%, color-mix(in srgb, var(--wp--preset--color--accent, #e8ff00) 8%, transparent), transparent 68%),
		linear-gradient(180deg, rgb(13 13 15 / 0.86) 0%, rgb(13 13 15 / 0.78) 45%, rgb(20 20 24 / 0.92) 100%);
}
/* Section headings get a hairline accent tick to anchor each band. */
.cb-range-atmosphere .cb-home-section__heading {
	position: relative;
	padding-left: 14px;
}
.cb-range-atmosphere .cb-home-section__heading::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.15em;
	bottom: 0.15em;
	width: 3px;
	border-radius: 2px;
	background: var(--wp--preset--color--accent, #e8ff00);
}
@media (max-width: 781px) {
	.cb-range-atmosphere::before { opacity: 0.12; }
}
@media (prefers-reduced-motion: reduce) {
	.cb-range-atmosphere::before { background-attachment: scroll; }
}

/* -------------------------------------------------------------------------
 * WHEEL SERIES SLIDERS (2026-07-02) — one horizontal snap-scroller per
 * series on the front page: 6 design tiles visible, arrow paging, every
 * tile linking to its design's sales page.
 * ---------------------------------------------------------------------- */
.cb-wslider {
	margin-bottom: var(--wp--preset--spacing--60, 2rem);
}

.cb-wslider__head {
	display: flex;
	align-items: baseline;
	gap: 1rem;
	margin: 0 0 0.6rem;
}

.cb-wslider__title {
	font-size: 1.05rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wp--preset--color--text);
	text-decoration: none;
	border-bottom: 2px solid var(--wp--preset--color--accent);
	padding-bottom: 2px;
}

.cb-wslider__title:hover,
.cb-wslider__title:focus-visible {
	color: var(--wp--preset--color--accent);
}

.cb-wslider__meta {
	font-size: 0.8125rem;
	color: var(--wp--preset--color--text-subtle);
}

.cb-wslider__nav {
	margin-left: auto;
	display: flex;
	gap: 6px;
}

.cb-wslider__arrow {
	appearance: none;
	-webkit-appearance: none;
	width: 34px;
	height: 34px;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 8px;
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--text);
	font-size: 1rem;
	line-height: 1;
	cursor: pointer;
	transition: border-color 0.15s ease, color 0.15s ease;
}

.cb-wslider__arrow:hover,
.cb-wslider__arrow:focus-visible {
	border-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--accent);
	outline: none;
}

.cb-wslider__track {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: calc((100% - 5 * 0.75rem) / 6);
	gap: 0.75rem;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	padding-bottom: 0.5rem;
	scrollbar-width: thin;
	scrollbar-color: var(--wp--preset--color--border) transparent;
}

.cb-wslider__tile {
	scroll-snap-align: start;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	padding: 0.5rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 8px;
	background: var(--wp--preset--color--surface);
	text-decoration: none;
	transition: border-color 0.18s ease;
}

.cb-wslider__tile:hover,
.cb-wslider__tile:focus-visible {
	border-color: var(--wp--preset--color--accent);
	outline: none;
}

.cb-wslider__media img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 6px;
}

.cb-wslider__code {
	font-size: 0.85rem;
	font-weight: 600;
	text-align: center;
	color: var(--wp--preset--color--text);
}

@media (max-width: 900px) {
	.cb-wslider__track {
		grid-auto-columns: calc((100% - 2 * 0.75rem) / 3);
	}
}

@media (max-width: 560px) {
	.cb-wslider__track {
		grid-auto-columns: calc((100% - 0.75rem) / 2);
	}
}

/* -------------------------------------------------------------------------
 * PARTS BANNER (2026-07-02) — single cinematic band replacing the four
 * keyword-group cards. Blueprint line-art from the components sheet sits on
 * the graphite gradient; the group deep-links survive as slim pills.
 * ---------------------------------------------------------------------- */
.cb-parts-banner__inner {
	position: relative;
	overflow: hidden;
	min-height: 300px;
	display: flex;
	align-items: center;
	padding: clamp(1.5rem, 4vw, 3rem) clamp(1.25rem, 4vw, 3rem);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 12px;
	background:
		radial-gradient(120% 160% at 85% 0%, rgba(232, 255, 0, 0.05) 0%, transparent 45%),
		linear-gradient(105deg, #1c1c22 0%, #17171b 55%, #121216 100%);
}

.cb-parts-banner__art {
	position: absolute;
	inset: 0 0 0 auto;
	height: 100%;
	width: auto;
	max-width: none;
	object-fit: cover;
	object-position: right center;
	pointer-events: none;
	user-select: none;
}

.cb-parts-banner__copy {
	position: relative;
	z-index: 1;
	max-width: 34rem;
}

.cb-parts-banner__copy .cb-home-section__heading {
	margin-top: 0;
}

.cb-parts-banner__sub {
	margin: 0.75rem 0 1.5rem;
	font-size: 0.95rem;
	line-height: 1.55;
	color: var(--wp--preset--color--text-muted);
}

.cb-parts-banner__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
}

.cb-parts-banner__cta {
	display: inline-flex;
	align-items: center;
	padding: 0.6rem 1.4rem;
	border-radius: 999px;
	background: var(--wp--preset--color--accent);
	color: #111;
	font-size: 0.85rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	text-decoration: none;
	transition: transform 0.18s ease;
}
.cb-parts-banner__cta:hover,
.cb-parts-banner__cta:focus-visible {
	transform: translateY(-2px);
	color: #111;
}

.cb-parts-banner__pill {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.5rem 0.95rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.02);
	color: var(--wp--preset--color--text);
	font-size: 0.8rem;
	text-decoration: none;
	transition: border-color 0.18s ease;
}
.cb-parts-banner__pill:hover,
.cb-parts-banner__pill:focus-visible {
	border-color: var(--wp--preset--color--accent);
}

.cb-parts-banner__pill-count {
	color: var(--wp--preset--color--text-muted);
	font-size: 0.72rem;
}

@media (max-width: 781px) {
	.cb-parts-banner__inner {
		min-height: 0;
	}
	/* Art becomes a faint full-bleed backdrop so the copy stays readable. */
	.cb-parts-banner__art {
		inset: 0;
		width: 100%;
		object-position: 70% center;
		opacity: 0.35;
	}
	.cb-parts-banner__copy {
		max-width: 100%;
	}
}
