/**
 * Boat Sales Hub — finance-first search forms.
 *
 * Every colour is a custom property on .pm-search so a theme, or the Custom CSS
 * box, can restyle both forms without fighting specificity. Deliberately low
 * specificity throughout for the same reason.
 */

.pm-search {
	--pm-ink: #16233f;
	--pm-ink-soft: #5b6880;
	--pm-line: #dfe4ec;
	--pm-bg: #fff;
	--pm-accent: #2f9e63;
	--pm-navy: #16233f;
	--pm-radius: 10px;

	color: var(--pm-ink);
	font-family: inherit;
	box-sizing: border-box;
}

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

/* --- shared controls --- */

.pm-label {
	display: block;
	margin-bottom: 6px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--pm-ink-soft);
}

.pm-field { display: block; min-width: 0; }

/* `display` on the classes above outranks the browser's [hidden] rule, so a
   hidden pane would otherwise stay on screen. Matched on the attribute to keep
   this ahead of any display value a field variant sets. */
.pm-search [hidden] { display: none; }

.pm-field select,
.pm-field input[type="text"],
.pm-field input[type="email"],
.pm-field input[type="number"] {
	width: 100%;
	padding: 11px 12px;
	border: 1px solid var(--pm-line);
	border-radius: 8px;
	background: var(--pm-bg);
	color: inherit;
	font: inherit;
	font-size: 15px;
	line-height: 1.3;
}

.pm-field select:focus,
.pm-field input:focus {
	outline: none;
	border-color: var(--pm-navy);
	box-shadow: 0 0 0 3px rgba(22, 35, 63, .1);
}

.pm-btn {
	display: inline-block;
	border: 1px solid transparent;
	border-radius: 8px;
	padding: 13px 24px;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
}

.pm-btn--primary { background: var(--pm-navy); color: #fff; }
.pm-btn--primary:hover { filter: brightness(1.15); color: #fff; }
.pm-btn--outline { background: transparent; border-color: var(--pm-line); color: var(--pm-ink); }
.pm-btn--outline:hover { border-color: var(--pm-navy); }
.pm-btn--ghost { background: transparent; color: var(--pm-ink-soft); border: 0; text-decoration: underline; padding: 8px; }

.pm-hint { display: block; margin-top: 5px; font-size: 12px; color: var(--pm-ink-soft); }
.pm-hint.is-warning { color: #8a5300; }

/* --- manual (hero) search --- */

.pm-search--manual .pm-search-form {
	background: var(--pm-bg);
	border-radius: 14px;
	padding: 22px 24px 20px;
	box-shadow: 0 18px 40px rgba(9, 16, 33, .16);
}

.pm-tabs {
	display: flex;
	gap: 26px;
	border-bottom: 1px solid var(--pm-line);
	margin-bottom: 20px;
}

.pm-tab {
	appearance: none;
	background: none;
	border: 0;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
	padding: 0 0 12px;
	font: inherit;
	font-size: 15px;
	color: var(--pm-ink-soft);
	cursor: pointer;
}

.pm-tab.is-active {
	color: var(--pm-ink);
	font-weight: 600;
	border-bottom-color: var(--pm-accent);
}

.pm-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 16px;
}

/* The hero form lives in a column roughly half the page wide, so three
   across squeezes the labels and one across makes the card tower down the
   screen. Two is the readable middle. Container query, not a media query:
   what matters is the width of the form, not of the window. */
.pm-search--manual { container-type: inline-size; container-name: pmmanual; }
.pm-search--manual .pm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@container pmmanual (max-width: 460px) {
	.pm-search--manual .pm-grid { grid-template-columns: minmax(0, 1fr); }
}

.pm-field--submit { display: flex; align-items: flex-end; }
.pm-field--submit .pm-btn { width: 100%; }

.pm-foot {
	margin-top: 20px;
	padding-top: 18px;
	border-top: 1px solid var(--pm-line);
}

.pm-popular { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.pm-popular-label { font-size: 14px; color: var(--pm-ink-soft); margin-right: 2px; }

.pm-chip {
	display: inline-block;
	padding: 7px 14px;
	border: 1px solid var(--pm-line);
	border-radius: 999px;
	font-size: 14px;
	line-height: 1.2;
	color: var(--pm-ink);
	text-decoration: none;
	background: var(--pm-bg);
}

.pm-chip:hover { border-color: var(--pm-navy); color: var(--pm-ink); }

.pm-advanced-link {
	display: inline-block;
	margin-top: 14px;
	font-weight: 600;
	color: var(--pm-accent);
	text-decoration: none;
}

.pm-advanced-link:hover { text-decoration: underline; }

/* --- advanced search --- */

.pm-adv-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 300px;
	gap: 28px;
	align-items: start;
}

.pm-step {
	background: var(--pm-bg);
	border: 1px solid var(--pm-line);
	border-radius: 12px;
	padding: 24px;
	margin-bottom: 20px;
}

.pm-step--finance { background: #f7f9fc; }

.pm-step-num {
	margin: 0 0 4px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--pm-ink-soft);
}

.pm-step-title { margin: 0 0 18px; font-size: 22px; line-height: 1.25; }
.pm-step-intro { margin: -10px 0 18px; font-size: 14px; color: var(--pm-ink-soft); }

.pm-row { display: grid; gap: 16px; margin-bottom: 16px; }
.pm-row:last-child { margin-bottom: 0; }
.pm-row--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pm-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.pm-pair { display: flex; align-items: center; gap: 8px; }
.pm-pair-sep { color: var(--pm-ink-soft); }

/* Currency prefix as a real segment rather than an overlay. Absolutely
   positioning it meant its width had to be guessed with padding, and a wider
   symbol or a different font simply collided with the value. As a flex sibling
   it takes exactly the room it needs and the input starts after it. */
.pm-money {
	display: flex;
	align-items: stretch;
	border: 1px solid var(--pm-line);
	border-radius: 8px;
	background: var(--pm-bg);
	overflow: hidden;
}

.pm-money-sym {
	display: flex;
	align-items: center;
	padding: 0 10px;
	border-right: 1px solid var(--pm-line);
	background: #f4f6f9;
	color: var(--pm-ink-soft);
	font-size: 15px;
	line-height: 1;
	user-select: none;
}

/* The wrapper carries the border now, so the input must not draw its own. */
.pm-money input[type="number"] {
	flex: 1 1 auto;
	min-width: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
}

.pm-money input[type="number"]:focus { box-shadow: none; }

.pm-money:focus-within {
	border-color: var(--pm-navy);
	box-shadow: 0 0 0 3px rgba(22, 35, 63, .1);
}

/* Vessel cards: a radio group that reads as a row of choices. The input is
   hidden but still focusable, so keyboard and screen readers are unaffected. */
.pm-vessels {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 10px;
}

.pm-vessel {
	position: relative;
	display: block;
	padding: 12px 14px;
	border: 1px solid var(--pm-line);
	border-radius: 8px;
	cursor: pointer;
	background: var(--pm-bg);
}

.pm-vessel input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.pm-vessel-name { display: block; font-weight: 600; font-size: 15px; }
.pm-vessel-note { display: block; margin-top: 2px; font-size: 12px; color: var(--pm-ink-soft); }

.pm-vessel.is-active { background: var(--pm-navy); border-color: var(--pm-navy); color: #fff; }
.pm-vessel.is-active .pm-vessel-note { color: rgba(255, 255, 255, .75); }
.pm-vessel:focus-within { box-shadow: 0 0 0 3px rgba(22, 35, 63, .18); }

.pm-note {
	margin: 16px 0 0;
	padding: 12px 14px;
	background: #f7f9fc;
	border-radius: 8px;
	font-size: 13px;
	color: var(--pm-ink-soft);
}

/* Term buttons — same pattern as the vessel cards. */
.pm-terms { display: flex; flex-wrap: wrap; gap: 8px; }

.pm-term {
	position: relative;
	padding: 9px 16px;
	border: 1px solid var(--pm-line);
	border-radius: 8px;
	background: var(--pm-bg);
	font-size: 14px;
	cursor: pointer;
}

.pm-term input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pm-term.is-active { background: var(--pm-navy); border-color: var(--pm-navy); color: #fff; }
.pm-term:focus-within { box-shadow: 0 0 0 3px rgba(22, 35, 63, .18); }

/* --- summary panel --- */

.pm-panel {
	position: sticky;
	top: 24px;
	background: var(--pm-navy);
	color: #fff;
	border-radius: 12px;
	padding: 22px;
}

.pm-panel-eyebrow {
	margin: 0 0 10px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
	opacity: .7;
}

.pm-panel-count { margin: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pm-count-value { font-size: 38px; line-height: 1; font-weight: 700; }
.pm-count-label { font-size: 14px; opacity: .8; }
.pm-panel-priced { margin: 6px 0 0; font-size: 13px; opacity: .75; }
.pm-panel-priced:empty { display: none; }

.pm-panel-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 0; }
.pm-panel-chips:empty { display: none; }

.pm-panel-chip {
	padding: 5px 11px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .14);
	font-size: 12px;
}

.pm-panel-figures { list-style: none; margin: 18px 0 0; padding: 18px 0 0; border-top: 1px solid rgba(255, 255, 255, .18); }
.pm-panel-figures li { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 4px 0; }
.pm-fig-label { opacity: .75; }
.pm-fig { font-weight: 600; }

.pm-panel-submit { width: 100%; margin-top: 18px; background: var(--pm-accent); }
.pm-panel-submit:hover { filter: brightness(1.1); }
.pm-panel-reset { width: 100%; margin-top: 6px; color: rgba(255, 255, 255, .8); }
.pm-panel-small { margin: 14px 0 0; font-size: 11px; line-height: 1.5; opacity: .6; }

.pm-save-status { margin: 10px 0 0; font-size: 13px; color: var(--pm-ink-soft); }
.pm-save-status:empty { display: none; }
.pm-save-status.is-error { color: #c0392b; }

.pm-is-counting .pm-count-value { opacity: .45; }

/* --- responsive --- */

@media (max-width: 980px) {
	.pm-adv-layout { grid-template-columns: minmax(0, 1fr); }
	.pm-panel { position: static; }
}

@media (max-width: 760px) {
	.pm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.pm-row--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
	.pm-grid,
	.pm-row--2,
	.pm-row--3 { grid-template-columns: minmax(0, 1fr); }
	.pm-tabs { gap: 16px; }
	.pm-tab { font-size: 14px; }
	.pm-search--manual .pm-search-form { padding: 18px 16px 16px; }
}

/* --- [pm_monthly_bands] --- */

.pm-bands-head { margin-bottom: 18px; }
.pm-bands-title { margin: 0 0 6px; font-size: 28px; line-height: 1.2; }
.pm-bands-sub { margin: 0; font-size: 15px; color: var(--pm-ink-soft); }

/* auto-fit rather than a fixed column count, so any number of brackets lays
   out evenly and collapses to fewer columns on its own. */
.pm-bands-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 14px;
}

.pm-band {
	display: block;
	padding: 18px 20px;
	border: 1px solid var(--pm-line);
	border-radius: 12px;
	background: var(--pm-bg);
	text-decoration: none;
	color: var(--pm-ink);
}

.pm-band:hover {
	border-color: var(--pm-navy);
	color: var(--pm-ink);
	box-shadow: 0 6px 18px rgba(9, 16, 33, .08);
}

.pm-band-label { display: block; font-size: 19px; font-weight: 700; line-height: 1.2; }
.pm-band-count { display: block; margin-top: 6px; font-size: 13px; color: var(--pm-ink-soft); }

/* Counts are re-checked against the visitor's own deposit after load; dim them
   while that is in flight rather than flashing a number that is about to move. */
.pm-bands.is-recounting .pm-band-count { opacity: .45; }

@media (max-width: 520px) {
	.pm-bands-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.pm-band { padding: 14px 16px; }
	.pm-band-label { font-size: 17px; }
}

.pm-band.is-empty { opacity: .45; }
.pm-band.is-empty:hover { border-color: var(--pm-line); box-shadow: none; }

/* --- [pm_compact_search] --- */

.pm-search--compact .pm-compact-form {
	background: var(--pm-bg);
	border-radius: 14px;
	padding: 16px 18px;
	box-shadow: 0 8px 26px rgba(9, 16, 33, .10);
}

/* Controls share the space evenly and the button takes only what it needs, so
   the row stays one line until it genuinely cannot. */
.pm-compact-row {
	display: flex;
	align-items: flex-end;
	gap: 14px;
}

.pm-compact-row .pm-field { flex: 1 1 0; }
.pm-compact-row .pm-field--submit { flex: 0 0 auto; }
.pm-compact-row .pm-field--submit .pm-btn { width: auto; white-space: nowrap; }

@media (max-width: 860px) {
	.pm-compact-row { flex-wrap: wrap; }
	.pm-compact-row .pm-field { flex: 1 1 160px; }
	.pm-compact-row .pm-field--submit { flex: 1 1 100%; }
	.pm-compact-row .pm-field--submit .pm-btn { width: 100%; }
}

/* --- [pm_vessel_from] --- */

.pm-vessel-from { white-space: nowrap; }
.pm-vessel-from-prefix { opacity: .75; }

/* --- [pm_vessel_image] --- */

.pm-vessel-image,
.pm-vessel-image a { display: block; }

.pm-vessel-image-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* The UK-only opt-out. Inline so the checkbox reads as one phrase, and
   vertically centred against the selects it sits between. */
.pm-search .pm-field--check {
	display: flex;
	align-items: center;
	gap: 8px;
	align-self: center;
	cursor: pointer;
}

.pm-search .pm-field--check input[type="checkbox"] {
	width: 18px;
	height: 18px;
	margin: 0;
	accent-color: var(--color-primary, #74a57e);
}

.pm-search .pm-label--inline {
	display: inline;
	margin: 0;
	text-transform: none;
	font-weight: 500;
}

/* --- vessel cards with imagery -------------------------------------------
   The image variant of a band card: picture full-bleed on top, label and
   count in the padded footer — the same silhouette as a boat card, which is
   the point. Cards without an image keep the plain band look, so a term
   missing its picture never renders an empty slab. */
.pm-band--img {
	padding: 0;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.pm-band-image {
	display: block;
	position: relative;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--pm-line);
}

/* Absolutely positioned, because aspect-ratio only states a PREFERENCE: a
   taller image stretches the box to fit (min-height:auto), which is exactly
   what the portrait RIB photo did. Out of flow, the image cannot push — the
   box is 4:3 whatever shape the attachment is. height needs !important to
   beat the theme's global img { height: auto }. */
.pm-band-image img,
.pm-band-image .pm-band-image-img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100% !important;
	object-fit: cover;
}

.pm-band--img .pm-band-body {
	display: block;
	padding: 14px 16px 16px;
}

/* Match the boat cards' subtle lift rather than the flat band hover. */
.pm-band--img:hover .pm-band-image img {
	transform: scale(1.03);
}

.pm-band-image img {
	transition: transform .3s ease;
}

@media (prefers-reduced-motion: reduce) {
	.pm-band-image img { transition: none; }
	.pm-band--img:hover .pm-band-image img { transform: none; }
}
