/*
 * Coastal Supply — Store Locator Section block.
 *
 * Wraps the [wpsl] shortcode and uses CSS Grid to put heading on the left
 * and the WPSL search input on the right (row 1), subheading full-width
 * (row 2), and the result list + map (row 3). `display: contents` on
 * #wpsl-wrap promotes its children into our grid so we don't need any JS
 * DOM moves.
 */

.coastal-store-locator-section {
	width: 100%;
}

/*
 * `!important` on max-width is required to beat Astra's page-builder layout
 * rule at (0,4,0) specificity:
 *   .ast-page-builder-template .entry-content[data-ast-blocks-layout]
 *     > *:not(.wp-block-group):where(...) > *
 * which forces `max-width: none` on every grandchild of .entry-content.
 * Same trade-off as the hero-banner block.
 */
.coastal-store-locator-section__inner {
	max-width: 1440px !important;
	margin-inline: auto;
	padding: 32px 24px;
	display: grid;
	/* 6-column grid lets us mix ratios per row: heading 2/3 + search 1/3 on
	   row 1, store list 1/3 + map 2/3 on row 3. */
	grid-template-columns: repeat(6, minmax(0, 1fr));
	grid-template-rows: auto auto auto;
	column-gap: 32px;
	row-gap: 16px;
	align-items: center;
}

.coastal-store-locator-section__heading {
	grid-column: 1 / span 4;
	grid-row: 1;
	margin: 0;
	font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-weight: 700;
	font-size: 36px;
	line-height: 1.2;
	color: #2c2c75;
}

.coastal-store-locator-section__subheading {
	grid-column: 1 / -1;
	grid-row: 2;
	margin: 0;
	font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-weight: 600;
	font-size: 16px;
	line-height: 1.4;
	color: #000;
}

/* Flatten WPSL's wrapper so its children participate in our grid. */
.coastal-store-locator-section__inner #wpsl-wrap {
	display: contents;
}

.coastal-store-locator-section__inner #wpsl-wrap .wpsl-search {
	grid-column: 5 / span 2;
	grid-row: 1;
	flex: none;
	width: 100%;
	background: transparent;
	margin: 0;
	padding: 0;
}

.coastal-store-locator-section__inner #wpsl-wrap #wpsl-result-list {
	grid-column: 1 / span 2;
	grid-row: 3;
	flex: none;
	width: 100%;
	margin: 0;
}

.coastal-store-locator-section__inner #wpsl-wrap #wpsl-gmap {
	grid-column: 3 / span 4;
	grid-row: 3;
	flex: none;
	width: 100%;
	margin: 0;
}

.coastal-store-locator-section__inner #wpsl-wrap .wpsl-provided-by {
	grid-column: 1 / -1;
	grid-row: 4;
}

/* Search field — pill, white bg, hidden label, single field on the row. */
.coastal-store-locator-section #wpsl-search-wrap {
	width: 100%;
	margin: 0;
}

.coastal-store-locator-section #wpsl-search-wrap form {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
}

.coastal-store-locator-section .wpsl-input {
	flex: 1 1 auto;
	margin: 0;
	padding: 0;
}

/* Visually hide the search input label without breaking screen readers. */
.coastal-store-locator-section .wpsl-input > div:first-child label[for="wpsl-search-input"] {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.coastal-store-locator-section #wpsl-search-input {
	width: 100%;
	height: 48px;
	padding: 12px 20px;
	border-radius: 1000px;
	border: 1px solid var(--Secondary-color, #212529);
	background: var(--Default-White, #fff);
	font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 16px;
	line-height: 1.4;
	color: #212529;
	box-shadow: none;
}

.coastal-store-locator-section #wpsl-search-input:focus {
	outline: 2px solid #2c2c75;
	outline-offset: 2px;
}

/* Hide the radius/results dropdowns, the search submit button, and the
   WPSL credits — search runs automatically while typing. */
.coastal-store-locator-section .wpsl-select-wrap,
.coastal-store-locator-section .wpsl-search-btn-wrap,
.coastal-store-locator-section #wpsl-search-btn {
	display: none !important;
}

/* === Result list (left column) =============================================
   Replaces WPSL's default <li> markup via the wpsl_listing_template filter
   in inc/blocks/store-locator-section.php. Field families:
     .__name        store title (Manrope 700/24)
     .__address     street + "City, ST 10000" (Source Sans 3 400/16)
     .__today       "Open today HH:MM AM - HH:MM PM" / "Closed today" (700/16)
     .__hours       grouped weekly hours (Source Sans 3 400/16)
     .__actions     Get Directions  ↔  phone link (space-between, #5091CD) */
.coastal-store-locator-section #wpsl-stores ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.coastal-store-locator-section .coastal-locator-list__item {
	list-style: none;
	display: flex;
	gap: 20px;
	padding: 24px 0;
	border-bottom: 1px solid #e5e5e5;
}

.coastal-store-locator-section .coastal-locator-list__item:first-child {
	padding-top: 0;
}

.coastal-store-locator-section .coastal-locator-list__item:last-child {
	border-bottom: 0;
}

.coastal-store-locator-section .coastal-locator-list__thumb {
	flex: 0 0 160px;
	max-width: 160px;
	overflow: hidden;
	aspect-ratio: 4 / 3;
}

/* `!important` overrides the floated 120x90 thumb sizing in
   store-locator.css that targets the same WPSL classes site-wide. */
.coastal-store-locator-section .coastal-locator-list__thumb img,
.coastal-store-locator-section #wpsl-wrap #wpsl-stores .coastal-locator-list__thumb .wpsl-store-thumb.wp-post-image {
	display: block;
	width: 100% !important;
	height: auto !important;
	margin: 0 !important;
	border: 0;
	border-radius: 8px;
	object-fit: cover;
	float: none;
}

.coastal-store-locator-section .coastal-locator-list__info {
	flex: 1 1 auto;
	min-width: 0;
}

.coastal-store-locator-section .coastal-locator-list__name {
	margin: 0 0 12px;
	font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-weight: 700;
	font-size: 24px;
	line-height: 1.2;
	color: #000;
}

.coastal-store-locator-section .coastal-locator-list__address {
	margin: 0 0 16px;
	font-family: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-weight: 400;
	font-size: 16px;
	line-height: 1.4;
	color: #000;
}

.coastal-store-locator-section .coastal-locator-list__address span {
	display: block;
}

.coastal-store-locator-section .coastal-locator-list__today {
	margin: 0 0 16px;
	font-family: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-weight: 700;
	font-size: 16px;
	line-height: 1.4;
	color: #000;
}

.coastal-store-locator-section .coastal-locator-list__hours {
	margin-bottom: 20px;
	font-family: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-weight: 400;
	font-size: 16px;
	line-height: 1.6;
	color: #000;
}

.coastal-store-locator-section .coastal-locator-list__hours-row {
	display: flex;
	align-items: baseline;
	gap: 16px;
}

.coastal-store-locator-section .coastal-locator-list__hours-day {
	flex: 0 0 96px;
}

.coastal-store-locator-section .coastal-locator-list__hours-time {
	flex: 1 1 auto;
}

.coastal-store-locator-section .coastal-locator-list__actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
}

.coastal-store-locator-section .coastal-locator-list__directions,
.coastal-store-locator-section .coastal-locator-list__phone {
	font-family: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-weight: 400;
	font-size: 16px;
	line-height: 1.4;
	color: #5091cd;
	text-decoration: none;
}

.coastal-store-locator-section .coastal-locator-list__directions:hover,
.coastal-store-locator-section .coastal-locator-list__phone:hover {
	text-decoration: underline;
}

/* Reset WPSL's global list styles so they don't fight the new card layout. */
.coastal-store-locator-section #wpsl-wrap #wpsl-stores .coastal-locator-list__item p {
	min-height: 0;
}

/* === Editor preview placeholders ============================================
   ACF blocks render in Gutenberg's iframe but WPSL's JS does not run there,
   so the [wpsl] markup would be empty. These placeholders give the editor a
   readable preview of where the search field, store list, and map will sit. */
.coastal-store-locator-section__preview-search {
	grid-column: 5 / span 2;
	grid-row: 1;
}

.coastal-store-locator-section__preview-search input {
	width: 100%;
	height: 48px;
	padding: 12px 20px;
	border-radius: 1000px;
	border: 1px solid var(--Secondary-color, #212529);
	background: var(--Default-White, #fff);
	font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 16px;
	color: #6c757d;
}

.coastal-store-locator-section__preview {
	grid-column: 1 / -1;
	grid-row: 3;
	display: grid;
	/* Mirror the front-end 1/3 list / 2/3 map split. */
	grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
	gap: 16px;
}

.coastal-store-locator-section__preview-list,
.coastal-store-locator-section__preview-map {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 280px;
	padding: 24px;
	border: 1px dashed #c3c4c7;
	border-radius: 8px;
	background: #f6f7f7;
	color: #50575e;
	font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 14px;
	text-align: center;
}

@media (max-width: 900px) {
	.coastal-store-locator-section__inner {
		grid-template-columns: minmax(0, 1fr);
	}

	.coastal-store-locator-section__heading {
		grid-column: 1;
		grid-row: 1;
	}

	.coastal-store-locator-section__inner #wpsl-wrap .wpsl-search,
	.coastal-store-locator-section__preview-search {
		grid-column: 1;
		grid-row: 2;
	}

	.coastal-store-locator-section__subheading {
		grid-row: 3;
	}

	.coastal-store-locator-section__inner #wpsl-wrap #wpsl-result-list,
	.coastal-store-locator-section__inner #wpsl-wrap #wpsl-gmap,
	.coastal-store-locator-section__preview {
		grid-column: 1;
	}

	.coastal-store-locator-section__inner #wpsl-wrap #wpsl-result-list {
		grid-row: 4;
	}

	.coastal-store-locator-section__inner #wpsl-wrap #wpsl-gmap {
		grid-row: 5;
	}

	.coastal-store-locator-section__preview {
		grid-template-columns: minmax(0, 1fr);
		grid-row: 4;
	}
}

/*
 * Refresh the layout description at the top of this file:
 * - 6 equal columns let row 1 use heading (cols 1-4 = 2/3) + search (cols 5-6
 *   = 1/3), row 2 use a full-width subheading, and row 3 use store list
 *   (cols 1-2 = 1/3) + map (cols 3-6 = 2/3).
 */
