/* Dealer Map (placeholder) — static map image with animated pins. */

.rally-dealer-map {
	padding-block: var(--rally-section-padding-y);
	background: var(--rally-gray-light);
}

.rally-dealer-map__inner {
	display: flex;
	flex-direction: column;
	gap: var(--rally-space-5);
}

.rally-dealer-map__header {
	text-align: center;
	display: flex;
	flex-direction: column;
	gap: var(--rally-space-2);
}

.rally-dealer-map__eyebrow {
	font-family: var(--rally-font-body);
	font-size: var(--rally-text-sm);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--rally-red);
	margin: 0;
}

.rally-dealer-map__heading {
	font-size: var(--rally-text-3xl);
	margin: 0;
}

.rally-dealer-map__description {
	font-size: var(--rally-text-lg);
	color: var(--rally-gray-dark);
	margin: 0 auto;
	max-width: 60ch;
	line-height: 1.6;
}

/* ============================================================
 * Zip code search box
 * ============================================================ */

.rally-dealer-map__search {
	max-width: 580px;
	margin: 0 auto;
	width: 100%;
}

.rally-dealer-map__search-inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--rally-space-2);
	background: var(--rally-white);
	padding: var(--rally-space-2);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
	border: 1px solid var(--rally-gray-light);
}

.rally-dealer-map__search-icon {
	flex: 0 0 auto;
	margin-left: var(--rally-space-2);
	color: var(--rally-red);
}

.rally-dealer-map__search-input {
	flex: 1 1 auto;
	min-width: 0;
	padding: var(--rally-space-2) var(--rally-space-2);
	font-family: var(--rally-font-body);
	font-size: var(--rally-text-base);
	font-weight: 500;
	color: var(--rally-black);
	background: transparent;
	border: 0;
	outline: none;
	letter-spacing: 0.04em;
}

.rally-dealer-map__search-input::placeholder {
	color: var(--rally-gray);
	font-weight: 400;
}

.rally-dealer-map__search-button {
	flex: 0 0 auto;
	font-size: 14px !important;
	padding: 12px 22px !important;
	white-space: nowrap;
}

.rally-dealer-map__search-message {
	margin: var(--rally-space-3) 0 0;
	padding: var(--rally-space-3) var(--rally-space-4);
	background: var(--rally-white);
	border-left: 4px solid var(--rally-red);
	font-size: var(--rally-text-sm);
	color: var(--rally-black);
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}

.rally-dealer-map__search-message[hidden] { display: none; }

@media (max-width: 600px) {
	.rally-dealer-map__search-button {
		flex: 1 1 100%;
		justify-content: center;
	}
}

.rally-dealer-map__map {
	position: relative;
	max-width: 1100px;
	margin-inline: auto;
	width: 100%;
}

.rally-dealer-map__image {
	width: 100%;
	height: auto;
	display: block;
}

/* ============================================================
 * Pin
 *   - Big (28×40px), Rally red, with white inner dot and shadow.
 *   - Continuous pulsing ripple halo so the eye is drawn to it.
 *   - Drops in from above on scroll-reveal (staggered per pin).
 *   - Hover: lifts + scales, label fades in above it.
 * ============================================================ */

.rally-dealer-map__pin {
	position: absolute;
	width: 28px;
	height: 40px;
	transform: translate(-50%, -100%);
	cursor: pointer;
	z-index: 1;
}

/* Pin body — teardrop shape via clip-path, white inner dot via ::before. */
.rally-dealer-map__pin::after {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--rally-grad-red);
	clip-path: path('M 14 0 C 22 0 28 6 28 14 C 28 24 14 40 14 40 C 14 40 0 24 0 14 C 0 6 6 0 14 0 Z');
	filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
	transition: transform 300ms var(--rally-ease), filter 300ms var(--rally-ease);
}

/* White inner dot. */
.rally-dealer-map__pin::before {
	content: "";
	position: absolute;
	top: 8px;
	left: 50%;
	width: 10px;
	height: 10px;
	background: var(--rally-white);
	border-radius: 50%;
	transform: translateX(-50%);
	z-index: 2;
}

/* Pulsing ripple — a small expanding circle at the pin base.
 * Sits on top of the pin's tip for the "active radar" feel. */
.rally-dealer-map__pin > .rally-dealer-map__pulse {
	position: absolute;
	left: 50%;
	bottom: -6px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: rgba(209, 0, 0, 0.45);
	transform: translate(-50%, 0);
	animation: rally-pin-pulse 2.4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
	z-index: 0;
	pointer-events: none;
}

@keyframes rally-pin-pulse {
	0%   { transform: translate(-50%, 0) scale(0.6); opacity: 0.8; }
	70%  { transform: translate(-50%, 0) scale(2.2); opacity: 0; }
	100% { transform: translate(-50%, 0) scale(2.2); opacity: 0; }
}

/* Hover/focus: pin lifts and scales, shadow deepens. */
.rally-dealer-map__pin:hover::after,
.rally-dealer-map__pin:focus::after {
	transform: translateY(-4px) scale(1.1);
	filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.5));
}

/* Label tooltip. */
.rally-dealer-map__pin-label {
	position: absolute;
	bottom: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%) translateY(4px);
	background: var(--rally-black);
	color: var(--rally-white);
	font-family: var(--rally-font-body);
	font-size: var(--rally-text-sm);
	font-weight: 600;
	padding: var(--rally-space-2) var(--rally-space-3);
	letter-spacing: 0.04em;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition:
		opacity 250ms var(--rally-ease),
		transform 250ms var(--rally-ease);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
	z-index: 3;
}

/* Label tail. */
.rally-dealer-map__pin-label::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 6px solid transparent;
	border-top-color: var(--rally-black);
}

.rally-dealer-map__pin:hover .rally-dealer-map__pin-label,
.rally-dealer-map__pin:focus .rally-dealer-map__pin-label {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* ============================================================
 * Drop-in entrance — pins fall from above when the map enters
 * the viewport. JS adds .is-visible to the section.
 * ============================================================ */

.rally-dealer-map__pin {
	opacity: 0;
	transition:
		opacity 500ms var(--rally-ease),
		top 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
	/* JS sets a custom delay per pin via inline --rally-pin-delay. */
	transition-delay: var(--rally-pin-delay, 0ms);
}

.rally-dealer-map.is-visible .rally-dealer-map__pin {
	opacity: 1;
}

/* Pre-reveal position: bumped up 40px from final spot. The CSS variable
 * --rally-pin-final-top is set inline per pin from the editor's "y"
 * percentage. JS triggers the slide-down by adding is-visible. */

@media (prefers-reduced-motion: reduce) {
	.rally-dealer-map__pin {
		opacity: 1 !important;
		transition: none !important;
	}
	.rally-dealer-map__pin > .rally-dealer-map__pulse {
		animation: none !important;
	}
}
