/**
 * Towbar Toolkit — customer-facing styles.
 *
 * Every rule is scoped under .ttk. Flatsome restyles global buttons, inputs and
 * headings aggressively, so specificity here is won with a scoped double-class
 * (.ttk .ttk-btn) rather than !important. The handful of unavoidable
 * !important declarations each name the rule they are overriding.
 *
 * Tokens are declared on .ttk rather than :root so the block cannot leak into
 * the theme, and the theme cannot accidentally recolour it.
 */

.ttk {
	--ttk-ink:         #1e2327;
	--ttk-ink-2:       #5b6169;
	--ttk-ink-3:       #8a9096;
	--ttk-surface:     #ffffff;
	--ttk-surface-2:   #f5f6f7;
	--ttk-surface-3:   #eceef0;
	--ttk-line:        #dbdee1;
	--ttk-line-strong: #c3c8cd;
	--ttk-accent:      #e8a33d;
	--ttk-accent-ink:  #1a1a1a;
	--ttk-ok:          #2f7d5d;
	--ttk-ok-bg:       #e8f3ed;
	--ttk-warn:        #9a6a12;
	--ttk-warn-bg:     #fdf3e0;
	--ttk-bad:         #a8342a;
	--ttk-bad-bg:      #fbeae8;
	--ttk-info:        #22607f;
	--ttk-info-bg:     #e7f1f7;

	--ttk-s1: 4px;
	--ttk-s2: 8px;
	--ttk-s3: 12px;
	--ttk-s4: 16px;
	--ttk-s5: 24px;
	--ttk-s6: 32px;
	--ttk-s7: 48px;

	--ttk-radius:    4px;
	--ttk-radius-md: 8px;
	--ttk-radius-lg: 12px;

	--ttk-shadow-1: 0 1px 2px rgba(30, 35, 39, .07);
	--ttk-shadow-2: 0 4px 16px rgba(30, 35, 39, .10);

	color: var(--ttk-ink);
	font-size: 16px;
	line-height: 1.6;
}

.ttk *,
.ttk *::before,
.ttk *::after {
	box-sizing: border-box;
}

/* ------------------------------------------------------------- structure */

.ttk-section {
	margin: 0 0 var(--ttk-s6);
}

.ttk-section:last-child {
	margin-bottom: 0;
}

.ttk .ttk-h {
	margin: 0 0 var(--ttk-s2);
	font-size: 1.35rem;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -.01em;
	color: var(--ttk-ink);
}

.ttk .ttk-h--sub {
	font-size: 1.05rem;
	font-weight: 600;
}

.ttk .ttk-lede {
	max-width: 62ch;
	margin: 0 0 var(--ttk-s5);
	color: var(--ttk-ink-2);
}

.ttk-eyebrow {
	display: block;
	margin-bottom: var(--ttk-s1);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--ttk-ink-3);
}

/* ----------------------------------------------------------------- cards */

.ttk-card {
	position: relative;
	padding: var(--ttk-s5);
	background: var(--ttk-surface);
	border: 1px solid var(--ttk-line);
	border-radius: var(--ttk-radius-md);
	box-shadow: var(--ttk-shadow-1);
}

.ttk-card + .ttk-card {
	margin-top: var(--ttk-s4);
}

/* The spec-plate rule: the signature element, carried over from the admin. */
.ttk-card--plate {
	border-left: 3px solid var(--ttk-accent);
}

.ttk-card__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--ttk-s2);
	margin-bottom: var(--ttk-s3);
}

.ttk-card__head h3 {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 700;
}

/* ---------------------------------------------------------------- pills */

.ttk .ttk-pill {
	display: inline-flex;
	align-items: center;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .05em;
	text-transform: uppercase;
	line-height: 1.6;
	white-space: nowrap;
	background: var(--ttk-surface-3);
	color: var(--ttk-ink-2);
}

.ttk .ttk-pill--ok      { background: var(--ttk-ok-bg);   color: var(--ttk-ok); }
.ttk .ttk-pill--warn    { background: var(--ttk-warn-bg); color: var(--ttk-warn); }
.ttk .ttk-pill--bad     { background: var(--ttk-bad-bg);  color: var(--ttk-bad); }
.ttk .ttk-pill--info    { background: var(--ttk-info-bg); color: var(--ttk-info); }

/* --------------------------------------------------------------- buttons */

.ttk .ttk-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--ttk-s2);
	min-height: 46px;
	padding: 12px 22px;
	border: 1px solid var(--ttk-line-strong);
	border-radius: var(--ttk-radius);
	background: var(--ttk-surface);
	color: var(--ttk-ink);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
	transition: background-color .15s ease-out, border-color .15s ease-out, transform .15s ease-out;
}

.ttk .ttk-btn:hover {
	background: var(--ttk-surface-2);
	border-color: var(--ttk-ink-3);
	color: var(--ttk-ink);
}

.ttk .ttk-btn:active {
	transform: translateY(1px);
}

.ttk .ttk-btn:focus-visible {
	outline: 3px solid var(--ttk-accent);
	outline-offset: 2px;
}

.ttk .ttk-btn--primary {
	background: var(--ttk-accent);
	border-color: var(--ttk-accent);
	color: var(--ttk-accent-ink);
}

.ttk .ttk-btn--primary:hover {
	background: #d4912f;
	border-color: #d4912f;
	color: var(--ttk-accent-ink);
}

.ttk .ttk-btn--quiet {
	background: transparent;
	border-color: transparent;
	color: var(--ttk-ink-2);
	min-height: 40px;
	padding: 8px 12px;
}

.ttk .ttk-btn--quiet:hover {
	background: var(--ttk-surface-2);
	color: var(--ttk-ink);
}

.ttk .ttk-btn[disabled],
.ttk .ttk-btn[aria-disabled="true"] {
	opacity: .55;
	cursor: not-allowed;
	transform: none;
}

.ttk .ttk-btn--quote {
	margin-left: var(--ttk-s2);
}

/* ----------------------------------------------------------------- forms */

.ttk-form {
	max-width: 720px;
}

.ttk-fieldset {
	margin: 0 0 var(--ttk-s6);
	padding: 0;
	border: 0;
}

.ttk-fieldset__legend {
	display: block;
	width: 100%;
	padding: 0 0 var(--ttk-s2);
	margin: 0 0 var(--ttk-s4);
	border-bottom: 1px solid var(--ttk-line);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--ttk-ink-2);
}

.ttk-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: var(--ttk-s4);
	margin-bottom: var(--ttk-s4);
}

.ttk-row--single {
	grid-template-columns: 1fr;
}

.ttk-field {
	display: flex;
	flex-direction: column;
	gap: var(--ttk-s1);
	min-width: 0;
}

.ttk-field--wide {
	grid-column: 1 / -1;
}

.ttk .ttk-field > label {
	font-size: 13px;
	font-weight: 600;
	color: var(--ttk-ink-2);
}

.ttk .ttk-field input[type="text"],
.ttk .ttk-field input[type="email"],
.ttk .ttk-field input[type="tel"],
.ttk .ttk-field input[type="number"],
.ttk .ttk-field input[type="password"],
.ttk .ttk-field input[type="date"],
.ttk .ttk-field input[type="file"],
.ttk .ttk-field select,
.ttk .ttk-field textarea {
	width: 100%;
	min-height: 46px;
	padding: 11px 14px;
	background: var(--ttk-surface);
	border: 1px solid var(--ttk-line-strong);
	border-radius: var(--ttk-radius);
	color: var(--ttk-ink);
	font-size: 16px; /* 16px stops iOS zooming the page on focus */
	line-height: 1.4;
	box-shadow: none;
	transition: border-color .15s ease-out, box-shadow .15s ease-out;
}

.ttk .ttk-field textarea {
	min-height: 120px;
	resize: vertical;
}

.ttk .ttk-field input:focus,
.ttk .ttk-field select:focus,
.ttk .ttk-field textarea:focus {
	border-color: var(--ttk-accent);
	box-shadow: 0 0 0 3px rgba(232, 163, 61, .25);
	outline: 2px solid transparent;
}

.ttk .ttk-field input[aria-invalid="true"],
.ttk .ttk-field select[aria-invalid="true"] {
	border-color: var(--ttk-bad);
}

.ttk-field__help {
	font-size: 13px;
	color: var(--ttk-ink-3);
}

.ttk-required {
	color: var(--ttk-bad);
}

.ttk-check {
	display: flex;
	align-items: flex-start;
	gap: var(--ttk-s2);
	margin-bottom: var(--ttk-s3);
	font-size: 15px;
	line-height: 1.5;
}

.ttk .ttk-check input[type="checkbox"] {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	margin-top: 2px;
}

.ttk-check span {
	flex: 1 1 auto;
}

/* The honeypot must be hidden from people but reachable by a naive bot, so
   it cannot use display:none — that is what most bots check for. */
.ttk-hp {
	position: absolute !important; /* overrides theme form layout rules */
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* -------------------------------------------------------------- messages */

.ttk-notice {
	padding: var(--ttk-s3) var(--ttk-s4);
	margin: 0 0 var(--ttk-s4);
	border-radius: var(--ttk-radius);
	border-left: 3px solid var(--ttk-ink-3);
	background: var(--ttk-surface-2);
	font-size: 15px;
}

.ttk-notice--ok  { background: var(--ttk-ok-bg);  border-left-color: var(--ttk-ok); }
.ttk-notice--bad { background: var(--ttk-bad-bg); border-left-color: var(--ttk-bad); }
.ttk-notice--warn{ background: var(--ttk-warn-bg);border-left-color: var(--ttk-warn); }

.ttk-notice ul {
	margin: var(--ttk-s2) 0 0;
	padding-left: 1.2em;
}

.ttk-notice li {
	margin-bottom: var(--ttk-s1);
}

/* --------------------------------------------------------------- garage */

.ttk-vehicles {
	display: grid;
	gap: var(--ttk-s4);
	margin: 0;
	padding: 0;
	list-style: none;
}

.ttk-vehicle__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--ttk-s2);
	padding-bottom: var(--ttk-s3);
	margin-bottom: var(--ttk-s3);
	border-bottom: 1px solid var(--ttk-line);
}

.ttk-vehicle__name {
	margin: 0;
	font-size: 1.1rem;
	font-weight: 700;
}

.ttk-vehicle__reg {
	display: inline-block;
	padding: 2px 10px;
	border: 2px solid var(--ttk-ink);
	border-radius: 3px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: .08em;
	color: var(--ttk-ink);
	background: var(--ttk-surface-2);
}

/* Fitments list — each row is an independent warranty. */
.ttk-fitments {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ttk-fitment {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: var(--ttk-s2) var(--ttk-s4);
	align-items: start;
	padding: var(--ttk-s3) 0;
	border-bottom: 1px solid var(--ttk-line);
}

.ttk-fitment:last-child {
	border-bottom: 0;
	padding-bottom: 0;
}

.ttk-fitment__name {
	margin: 0 0 var(--ttk-s1);
	font-size: 15px;
	font-weight: 600;
}

.ttk-fitment__meta {
	margin: 0;
	font-size: 13.5px;
	color: var(--ttk-ink-2);
}

.ttk-fitment__meta span + span::before {
	content: "·";
	margin: 0 6px;
	color: var(--ttk-ink-3);
}

.ttk-fitment__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--ttk-s2);
	grid-column: 1 / -1;
}

@media (min-width: 700px) {
	.ttk-fitment__actions {
		grid-column: auto;
		justify-content: flex-end;
	}
}

/* --------------------------------------------------------------- tables */

.ttk-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14.5px;
}

.ttk-table th {
	padding: var(--ttk-s2) var(--ttk-s3);
	text-align: left;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--ttk-ink-2);
	border-bottom: 2px solid var(--ttk-line-strong);
	white-space: nowrap;
}

.ttk-table td {
	padding: var(--ttk-s3);
	border-bottom: 1px solid var(--ttk-line);
	vertical-align: top;
}

.ttk-table .ttk-num {
	text-align: right;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* Wide tables scroll inside themselves; the page never scrolls sideways. */
.ttk-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin: 0 0 var(--ttk-s4);
}

/* On a phone, a document table reads better as stacked rows than as a
   miniature spreadsheet. */
@media (max-width: 640px) {
	.ttk-table--stack thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}

	.ttk-table--stack tr {
		display: block;
		padding: var(--ttk-s3) 0;
		border-bottom: 1px solid var(--ttk-line);
	}

	.ttk-table--stack td {
		display: flex;
		justify-content: space-between;
		gap: var(--ttk-s3);
		padding: 4px 0;
		border: 0;
		text-align: right;
	}

	.ttk-table--stack td::before {
		content: attr(data-label);
		flex: 0 0 auto;
		font-size: 12px;
		font-weight: 700;
		text-transform: uppercase;
		letter-spacing: .05em;
		color: var(--ttk-ink-3);
		text-align: left;
	}
}

/* ------------------------------------------------------- portal nav & misc */

.ttk-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: var(--ttk-s1);
	margin: 0 0 var(--ttk-s5);
	padding: 0;
	list-style: none;
	border-bottom: 1px solid var(--ttk-line);
}

.ttk .ttk-tabs a {
	display: block;
	padding: 10px 14px;
	border-bottom: 3px solid transparent;
	color: var(--ttk-ink-2);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
}

.ttk .ttk-tabs a:hover {
	color: var(--ttk-ink);
}

.ttk .ttk-tabs a[aria-current="page"] {
	color: var(--ttk-ink);
	border-bottom-color: var(--ttk-accent);
}

.ttk-summary {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: var(--ttk-s3);
	margin: 0 0 var(--ttk-s5);
	padding: 0;
	list-style: none;
}

.ttk-summary li {
	padding: var(--ttk-s3) var(--ttk-s4);
	background: var(--ttk-surface-2);
	border-radius: var(--ttk-radius);
	border-left: 3px solid var(--ttk-line-strong);
}

.ttk-summary strong {
	display: block;
	font-size: 22px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	line-height: 1.2;
}

.ttk-summary span {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .05em;
	text-transform: uppercase;
	color: var(--ttk-ink-2);
}

.ttk-code {
	display: inline-block;
	padding: 4px 10px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: .14em;
	background: var(--ttk-surface-3);
	border-radius: var(--ttk-radius);
}

.ttk-specs {
	display: flex;
	flex-wrap: wrap;
	gap: var(--ttk-s2) var(--ttk-s5);
	margin: var(--ttk-s3) 0;
	padding: var(--ttk-s3) 0;
	border-top: 1px solid var(--ttk-line);
	border-bottom: 1px solid var(--ttk-line);
	list-style: none;
}

.ttk-specs__item {
	display: flex;
	flex-direction: column;
}

.ttk-specs__label {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--ttk-ink-3);
}

.ttk-specs__value {
	font-size: 16px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.ttk-price-tier {
	display: inline-block;
	margin-left: 6px;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--ttk-info-bg);
	color: var(--ttk-info);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .05em;
	text-transform: uppercase;
}

.ttk-empty {
	padding: var(--ttk-s6) var(--ttk-s4);
	text-align: center;
	color: var(--ttk-ink-2);
	background: var(--ttk-surface-2);
	border-radius: var(--ttk-radius-md);
}

.ttk-empty p {
	max-width: 46ch;
	margin: 0 auto var(--ttk-s4);
}

.ttk-empty p:last-child {
	margin-bottom: 0;
}

/* ------------------------------------------------------------ small print */

.ttk-terms {
	max-height: 220px;
	overflow-y: auto;
	padding: var(--ttk-s3) var(--ttk-s4);
	margin-bottom: var(--ttk-s3);
	background: var(--ttk-surface-2);
	border: 1px solid var(--ttk-line);
	border-radius: var(--ttk-radius);
	font-size: 13.5px;
	line-height: 1.6;
	color: var(--ttk-ink-2);
	white-space: pre-wrap;
}

.ttk-fine {
	font-size: 13px;
	color: var(--ttk-ink-3);
}

/* Progressive enhancement: anything marked js-only stays hidden until the
   script confirms it is running. */
.ttk-js-only { display: none; }
.ttk-has-js .ttk-js-only { display: block; }

@media (prefers-reduced-motion: reduce) {
	.ttk .ttk-btn,
	.ttk .ttk-field input,
	.ttk .ttk-field select,
	.ttk .ttk-field textarea {
		transition: none;
	}

	.ttk .ttk-btn:active { transform: none; }
}
