
/* ========================================
	ROOT VARIABLES / GLOBAL STYLES
======================================== */

:root {
	box-sizing: border-box;
	padding-top: env(safe-area-inset-top, 0px);
	padding-bottom: env(safe-area-inset-bottom, 0px);

	--bg: #fff;
	--ink: #1d1f22;
	--mute: #5d646c;
	--line: #dfe2e5;
	--band: #f4f5f6;
	--gold: #c8a24a;
	--btn: #1d1f22;
	--btnt: #fff;
	--ph: #e9ebed;

	/* Shared desktop accessory columns */
	--accessory-columns:
		64px minmax(0, 1fr) 110px 56px 84px 110px;

	--accessory-gap: 10px;
}

*,
*::before,
*::after {
	box-sizing: inherit;
}

html {
	scroll-padding-top: env(safe-area-inset-top, 0px);
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font: 16px/1.4 "Helvetica Neue", Arial, sans-serif;
}

:focus-visible {
	outline: 3px solid var(--gold);
	outline-offset: 2px;
}


/* ========================================
	MAIN PAGE
======================================== */

.wrap {
	max-width: 1000px;
	margin: 0 auto;
	padding: 16px;
}

header {
	border-top: 5px solid var(--gold);
	padding-top: 12px;
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 8px;
}

h1 {
	font-size: 1.25rem;
	margin: 0;
}

header a {
	color: var(--ink);
	font-size: 0.95rem;
}

h2 {
	font-size: 1.6rem;
	margin: 18px 0 0;
}

.sub {
	color: var(--mute);
	margin: 2px 0 10px;
	font-weight: 600;
}

.cat {
	font-weight: 700;
	margin: 20px 0 6px;
	padding-left: 10px;
	border-left: 5px solid var(--gold);
}


/* ========================================
	BOOTSTRAP VEHICLE TABS
======================================== */

.tabs {
	display: flex;
	gap: 6px;
	margin: 14px 0 4px;
	flex-wrap: wrap;
}

.tabs button {
	flex: 1 1 auto;
	padding: 12px 14px;
	font: inherit;
	font-weight: 700;
	background: var(--band);
	color: var(--ink);
	border: 1px solid var(--line);
	border-bottom: 3px solid transparent;
	border-radius: 6px;
	cursor: pointer;
}

.tabs button:hover {
	color: var(--ink);
	background: #e9ebed;
}

.tabs button[aria-selected="true"],
.tabs button.active {
	border-bottom-color: var(--gold);
	background: var(--bg);
	color: var(--ink);
}

/* Bootstrap tab visibility */

#main > .tab-pane {
	display: none;
}

#main > .tab-pane.active {
	display: block;
}


/* ========================================
	ACCESSORY ROWS
======================================== */

.accessory-row {
	display: grid;
	grid-template-columns: var(--accessory-columns);
	gap: var(--accessory-gap);
	align-items: center;

	width: 100%;
	margin: 0;
	padding: 8px;

	border-bottom: 1px solid var(--line);
}

/*
	Override Bootstrap's .row class if
	existing PHP still outputs:
	class="accessory-row row"
*/

.accessory-row.row {
	display: grid;
	flex-wrap: initial;

	margin-left: 0;
	margin-right: 0;
	margin-top: 0;

	--bs-gutter-x: 0;
	--bs-gutter-y: 0;
}

.accessory-row:nth-child(odd) {
	background: var(--band);
}

/* Description */

.desc {
	min-width: 0;
}

/* Desktop metadata columns */

.meta {
	min-width: 0;
}

.part {
	color: var(--mute);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.hrs {
	color: var(--mute);
	white-space: nowrap;
}

.price {
	font-weight: 700;
	text-align: right;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}


/* ========================================
	ACCESSORY THUMBNAILS
======================================== */

.th {
	width: 64px;
	height: 48px;

	overflow: hidden;
	padding: 0;
	border: 0;
	border-radius: 4px;

	background: var(--ph);
	color: var(--mute);

	font-size: 0.65rem;

	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
}

.th.has {
	cursor: zoom-in;
	background: #fff;
}

.th img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}


/* ========================================
	ACCESSORY COPY BUTTONS
======================================== */

.btns {
    display: flex;
    gap: 6px;
    min-width: 0;
}

.btns button {
    width: 100%;
}

.btns button,
.bz button {
	font: inherit;
	font-size: 0.85rem;

	padding: 8px 10px;
	min-height: 40px;

	background: var(--btn);
	color: var(--btnt);

	border: 0;
	border-radius: 5px;

	cursor: pointer;
	white-space: nowrap;
}

.btns button.ok,
.bz button.ok {
	background: #2e7d32;
	color: #fff;
}


/* ========================================
	BEZEL / SUB-ACCESSORY BOX
======================================== */

/*
	Same width as accessory rows.
	Gold border + padding equal the
	accessory row's 8px left padding.
*/

.bzbox {
	width: 100%;
	margin: 0;

	padding: 8px 8px 8px 5px;

	border-left: 3px solid var(--gold);
	border-bottom: 1px solid var(--line);

	background: var(--band);
}

/* Bezel group title */

.bzt {
	font-weight: 700;
	margin-bottom: 6px;
}

/*
	Same columns as accessory rows.

	Accessory:
	1 Image
	2 Description
	3 Part number
	4 Hours
	5 Price
	6 Buttons

	Bezel:
	1 Empty
	2 Description
	3 Part number
	4 Empty
	5 Empty
	6 Copy button
*/

.bz {
	display: grid;
	grid-template-columns: var(--accessory-columns);
	gap: var(--accessory-gap);
	align-items: center;

	width: 100%;

	padding: 6px 0;

	border-top: 1px solid var(--line);
}

/* Indented sub-accessory description */

.bzn {
	grid-column: 1 / 3;
	min-width: 0;
	padding-left: 18px;
}

/* Exact part-number column alignment */

.bz .part {
	grid-column: 3;
	justify-self: start;
	min-width: 0;
}

/* Copy button occupies last column */

.bz button {
	grid-column: 6;
	justify-self: stretch;
	width: 100%;
}


/* ========================================
	NOTES
======================================== */

.note {
	margin: 8px;
	color: var(--mute);
	font-size: 0.95rem;
}


/* ========================================
	FOOTER NOTICE
======================================== */

.notice {
	margin: 22px 0 6px;
	padding: 10px 12px;

	background: var(--band);
	border: 1px solid var(--line);

	text-align: center;
	font-weight: 700;
}

.notice span {
	display: block;
	font-weight: 400;
	color: var(--mute);
	margin-top: 2px;
}

.footer-txt {
	display: block;
	font-weight: 100;
	font-size: 0.70rem;
	margin-top: 2px;
}


/* ========================================
	BOOTSTRAP IMAGE MODAL
======================================== */

.image-modal {
	z-index: 1060;
}

.image-modal .modal-dialog {
	width: fit-content;
	max-width: 90vw;
	height: auto;
	margin: auto;

	pointer-events: none;
}

.image-modal .modal-content {
	position: relative;

	width: fit-content;
	height: auto;

	background: transparent;
	border: none;
	border-radius: 0;
	box-shadow: none;

	pointer-events: none;
}

/* Image */

.image-modal #modalImage {
	display: block;

	max-width: 85vw;
	max-height: 80vh;

	width: auto;
	height: auto;

	object-fit: contain;

	cursor: zoom-in;
	pointer-events: auto;

	transform: scale(1);
	transition: transform 0.2s ease;
}

/* 150% zoom */

.image-modal #modalImage.zoomed {
	transform: scale(1.5);
	cursor: zoom-out;
}

/* Close instructions below image */

.image-modal #close_title {
	position: absolute;

	top: 100%;
	left: 50%;

	transform: translateX(-50%);
	margin-top: 12px;

	width: max-content;
	max-width: 90vw;

	color: white;
	text-align: center;
	font-size: 1rem;

	pointer-events: none;

	transition: margin-top 0.2s ease;
}

/* Move instructions below enlarged image */

.image-modal #close_title.zoomed {
	margin-top: calc(
		var(--image-height, 0px) * 0.25 + 12px
	);
}


/* ========================================
	LEGACY LIGHTBOX STYLES
	Retained for compatibility.
======================================== */

.lb {
	position: fixed;
	inset: 0;
	z-index: 50;

	background: rgba(0, 0, 0, 0.85);

	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;

	gap: 10px;
	padding: 56px 12px 12px;
}

.lb[hidden] {
	display: none;
}

.lbw {
	max-width: 100%;

	max-height: calc(100vh - 110px);
	max-height: calc(100dvh - 110px);

	overflow: auto;
	border-radius: 6px;

	background: #fff;
	-webkit-overflow-scrolling: touch;
}

.lb img {
	display: block;
	max-width: 100%;

	max-height: calc(100vh - 110px);
	max-height: calc(100dvh - 110px);

	background: #fff;
	cursor: zoom-in;
}

.lb.z img {
	max-width: none;
	max-height: none;
	cursor: zoom-out;
}

.lbz {
	position: absolute;

	top: calc(12px + env(safe-area-inset-top, 0px));
	left: 12px;

	font: inherit;
	font-weight: 700;
	font-size: 1.05rem;

	padding: 10px 18px;
	min-height: 44px;

	background: #fff;
	color: #111;

	border: 2px solid #111;
	border-radius: 6px;

	cursor: pointer;
}

.lbc {
	position: absolute;

	top: calc(12px + env(safe-area-inset-top, 0px));
	right: 12px;

	font: inherit;
	font-weight: 700;
	font-size: 1.05rem;

	padding: 10px 22px;
	min-height: 44px;

	background: #fff;
	color: #111;

	border: 2px solid #111;
	border-radius: 6px;

	cursor: pointer;
}

.lbh {
	color: #d8dbde;
	font-size: 1rem;
	text-align: center;
}


/* ========================================
	RESPONSIVE - MOBILE
======================================== */

@media (max-width: 720px) {

	/* Accessory rows */

	.accessory-row {
		grid-template-columns:
			64px minmax(0, 1fr) auto;

		grid-template-areas:
			"th d p"
			"th m m"
			"b b b";

		gap: 10px;
	}

	.th {
		grid-area: th;
		align-self: start;
	}

	.desc {
		grid-area: d;
	}

	.price {
		grid-area: p;
	}

	.meta {
		grid-area: m;

		display: flex;
		gap: 14px;
	}

	.btns {
		grid-area: b;
	}

	.btns button {
		flex: 1;
	}

	/* Bezel rows */

	.bzbox {
		padding: 8px 8px 8px 5px;
	}

	.bz {
		grid-template-columns:
			64px minmax(0, 1fr) auto;

		grid-template-areas:
			". description part"
			". button button";

		gap: 8px;
	}

	.bzn {
		grid-area: description;
		padding-left: 0;
	}

	.bz .part {
		grid-area: part;
		text-align: right;
		justify-self: end;
	}

	.bz button {
		grid-area: button;
		justify-self: stretch;
		width: 100%;
	}

	/* Modal on smaller screens */

	.image-modal .modal-dialog {
		max-width: 95vw;
	}

	.image-modal #modalImage {
		max-width: 90vw;
		max-height: 75vh;
	}
}


/* ========================================
	RESPONSIVE - DESKTOP
======================================== */

@media (min-width: 721px) {

	/*
	   Makes .part and .hrs individual
	   grid items inside .accessory-row
	*/

	.accessory-row .meta {
		display: contents;
	}
}
