/*
 * NorthForged Diesel — finder band + shop filters/grid (Piece B).
 * Port of the approved mockup's shop styles onto the theme tokens.
 * Enqueue AFTER nfd-style (see functions.php note at merge).
 */

/* ============================================================
   1. FINDER BAND (homepage)
   Band layout already lives in style.css (.nfd-finder); these are
   the mockup's field/label/count pieces it doesn't have yet.
   ============================================================ */
.nfd-finder .nfd-wrap { flex-wrap: wrap; align-items: stretch; }
.nfd-finder h2 { flex: 0 0 100%; }
.nfd-finder h2 span { color: var(--nfd-orange); }
.nfd-finder .sel-sub {
	flex: 0 0 100%;
	color: var(--nfd-muted);
	margin: -6px 0 4px;
	font-size: 0.95rem;
}
.nfd-finder .sel-sub b { color: var(--nfd-text); }
.nfd-finder form { flex: 1 1 100%; }
.nfd-finder .field { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 170px; }
.nfd-finder .field label {
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--nfd-muted);
}
.nfd-finder .field select { width: 100%; }
.nfd-finder .sel-actions { display: flex; flex-direction: column; gap: 8px; flex: 0 0 auto; justify-content: flex-end; }
.nfd-finder .sel-count { font-size: 0.88rem; font-weight: 600; color: var(--nfd-muted); }
.nfd-finder .sel-count b { color: var(--nfd-orange); font-size: 1rem; }
.nfd-finder .sel-btns { display: flex; gap: 8px; }
.nfd-finder .btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ============================================================
   2. SHOP LAYOUT
   ============================================================ */
.nfd-shoppage { padding: 48px 0 64px; }
.nfd-shop-title { margin: 0 0 20px; }
.nfd-noscript { color: var(--nfd-muted); padding: 24px 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.shop { display: grid; grid-template-columns: 272px 1fr; gap: 26px; align-items: start; padding-bottom: 30px; }

/* Ghost/line button variant used by the mockup ("Change truck", clear) */
.btn-line {
	background: transparent;
	border: 2px solid var(--nfd-border);
	color: var(--nfd-text);
}
.btn-line:hover { border-color: var(--nfd-orange); background: var(--nfd-orange-soft); color: var(--nfd-text); }

/* ============================================================
   3. FIT BANNER (shows when a full truck is selected)
   ============================================================ */
.fitbanner {
	display: none;
	background: var(--nfd-orange-soft);
	border: 1px solid var(--nfd-orange);
	color: var(--nfd-text);
	border-radius: var(--nfd-radius);
	padding: 12px 16px;
	margin-bottom: 16px;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}
.fitbanner.show { display: flex; }
.fitbanner b {
	font-family: var(--nfd-font-head);
	font-size: 1.2rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}
.fitbanner button { margin-left: auto; }

/* ============================================================
   4. FILTER SIDEBAR
   ============================================================ */
.filters {
	background: var(--nfd-panel);
	border: 1px solid var(--nfd-border);
	border-radius: var(--nfd-radius);
	padding: 6px 18px 14px;
	position: sticky;
	top: 118px;
	max-height: calc(100dvh - 132px);
	overflow-y: auto;
}
.fgroup { border-bottom: 1px solid var(--nfd-border); padding: 14px 0 12px; }
.fgroup:last-child { border-bottom: 0; }
.fgroup h3 {
	font-size: 1.05rem;
	font-weight: 600;
	display: flex;
	justify-content: space-between;
	align-items: center;
	cursor: pointer;
	user-select: none;
	margin: 0;
}
.fgroup h3 .chev { color: var(--nfd-muted); font-size: 13px; transition: transform 0.15s; }
.fgroup.closed .fbody { display: none; }
.fgroup.closed h3 .chev { transform: rotate(-90deg); }

.fopt {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 5px 6px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 0.88rem;
}
.fopt:hover { background: var(--nfd-charcoal); }
.fopt input { accent-color: var(--nfd-orange); width: 16px; height: 16px; flex: none; margin: 0; }
.fopt .nm { flex: 1; }
.fopt .ct { color: var(--nfd-muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.fopt.dis { opacity: 0.42; cursor: not-allowed; }
.fopt.dis input { cursor: not-allowed; }

.fsub {
	font-size: 0.7rem;
	font-weight: 800;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--nfd-muted);
	margin: 9px 6px 2px;
}
.fselect {
	width: 100%;
	padding: 9px 10px;
	border: 1px solid var(--nfd-border);
	border-radius: 7px;
	background: var(--nfd-charcoal);
	color: var(--nfd-text);
	font-weight: 600;
}
.price-row { display: flex; align-items: center; gap: 10px; }
.price-row input[type="range"] { flex: 1; accent-color: var(--nfd-orange); }
.price-val { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.switchrow {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 5px 6px;
	cursor: pointer;
	font-size: 0.88rem;
}
.switchrow input { accent-color: var(--nfd-orange); width: 16px; height: 16px; margin: 0; }
.switchrow .ct { color: var(--nfd-muted); font-size: 0.78rem; }
.fclear { width: 100%; margin-top: 12px; }

/* ============================================================
   5. TOOLBAR + CHIPS
   ============================================================ */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .count { font-weight: 700; }
.toolbar .count span { color: var(--nfd-muted); font-weight: 500; }
.toolbar .sp { flex: 1; }
.toolbar label {
	font-size: 0.75rem;
	font-weight: 800;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--nfd-muted);
}
.toolbar select {
	padding: 8px 10px;
	border: 1px solid var(--nfd-border);
	border-radius: 7px;
	background: var(--nfd-panel);
	color: var(--nfd-text);
	font-weight: 600;
}
.toolbar input[type="search"] {
	padding: 8px 12px;
	border: 1px solid var(--nfd-border);
	border-radius: 7px;
	background: var(--nfd-panel);
	color: var(--nfd-text);
	min-width: 200px;
	font-size: 0.9rem;
}
.filters-btn { display: none; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chips:empty { display: none; }
.chip {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	background: var(--nfd-panel);
	border: 1px solid var(--nfd-border);
	border-radius: 999px;
	padding: 5px 8px 5px 12px;
	font-size: 0.82rem;
	font-weight: 600;
}
.chip button {
	border: 0;
	background: var(--nfd-text);
	color: var(--nfd-black);
	width: 17px;
	height: 17px;
	border-radius: 999px;
	font-size: 11px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}
.chip.clearall {
	background: var(--nfd-orange-soft);
	border-color: var(--nfd-orange);
	color: var(--nfd-orange);
	cursor: pointer;
	padding-right: 12px;
}

/* ============================================================
   6. PRODUCT GRID CARDS (JS-rendered)
   ============================================================ */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card {
	background: var(--nfd-panel);
	border: 1px solid var(--nfd-border);
	border-radius: var(--nfd-radius);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: border-color 0.15s, box-shadow 0.15s;
}
.card:hover { border-color: var(--nfd-orange); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
.card .imgw {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 4 / 2.9;
	background: #fff; /* real product photos show whole, never cropped */
	overflow: hidden;
	border: 0;
	padding: 0;
	text-align: left;
}
.card .imgw img { width: 100%; height: 100%; object-fit: contain; object-position: center; }
.card .noimg {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	color: var(--nfd-muted);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	font-size: 0.8rem;
}
.badge {
	position: absolute;
	top: 10px;
	left: 10px;
	font-size: 0.66rem;
	font-weight: 800;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	padding: 4px 9px;
	border-radius: 5px;
	color: #fff;
	background: #b3352b;
}
.card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.card .brandrow { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card .brand {
	font-size: 0.7rem;
	font-weight: 800;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--nfd-orange);
}
.card .pnum {
	font-size: 0.72rem;
	font-weight: 700;
	color: var(--nfd-muted);
	letter-spacing: 0.03em;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}
.card h3 {
	font-family: var(--nfd-font-body);
	text-transform: none;
	letter-spacing: 0;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.3;
	min-height: 2.6em;
	margin: 0;
}
.card h3 a { color: var(--nfd-text); }
.card h3 a:hover { color: var(--nfd-orange); }
.card .fit { color: var(--nfd-muted); font-size: 0.82rem; }
.card .pricerow { margin-top: auto; padding-top: 8px; display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.card .price { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.card .was { color: var(--nfd-muted); text-decoration: line-through; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.card .save { color: #e0685e; font-weight: 800; font-size: 0.78rem; }
.card .add { margin-top: 10px; width: 100%; justify-content: center; }

.empty {
	grid-column: 1 / -1;
	background: var(--nfd-panel);
	border: 1px dashed var(--nfd-border);
	border-radius: var(--nfd-radius);
	padding: 44px 24px;
	text-align: center;
}
.empty h3 { font-size: 1.6rem; margin-bottom: 6px; }
.empty p { color: var(--nfd-muted); margin: 0 auto 16px; max-width: 420px; }

/* Fallback loop card fitment line (woocommerce/content-product.php) */
.nfd-fitline { color: var(--nfd-muted); font-size: 0.82rem; padding: 0 16px 6px; }

/* ============================================================
   7. MOBILE FILTER DRAWER
   ============================================================ */
.scrim2 {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s;
	z-index: 80;
}
.scrim2.show { opacity: 1; pointer-events: auto; }

/* ============================================================
   8. RESPONSIVE
   ============================================================ */
@media (max-width: 1080px) {
	.grid { grid-template-columns: repeat(2, 1fr); }
	.shop { grid-template-columns: 230px 1fr; }
}
@media (max-width: 820px) {
	.shop { grid-template-columns: 1fr; }
	.filters {
		position: fixed;
		inset: 0 auto 0 0;
		width: min(330px, 88vw);
		z-index: 95;
		border-radius: 0;
		overflow-y: auto;
		max-height: none;
		transform: translateX(-105%);
		visibility: hidden;
		transition: transform 0.25s ease, visibility 0s linear 0.25s;
		top: 0;
	}
	.filters.show {
		transform: none;
		visibility: visible;
		transition: transform 0.25s ease;
		box-shadow: 12px 0 34px rgba(0, 0, 0, 0.3);
	}
	.filters-btn { display: inline-flex; }
}
@media (max-width: 600px) {
	.grid { grid-template-columns: 1fr; }
	.card .imgw { aspect-ratio: 16 / 10; }
}
@media (prefers-reduced-motion: reduce) {
	.filters, .scrim2, .card { transition: none; }
}
