/* Madison Marina Map Directory - frontend styles
   Scope: everything lives under .mmm-directory so theme styles stay out.
   Every selector starts with ".mmm-directory " on purpose: that is two classes,
   which outranks theme rules such as Kadence's input[type="search"] and
   .single-content ul / address / p (one class plus one element). A bare
   ".mmm-x" selector loses to those, so keep the prefix on any new rule. */

.mmm-directory {
	--mmm-bg: #ffffff;
	--mmm-fg: #1a202c;
	--mmm-muted: #5b6573;
	--mmm-border: #dfe4ea;
	--mmm-surface: #f5f7fa;
	--mmm-hover: #eef3f8;
	--mmm-accent: #0b5d8f;
	--mmm-accent-fg: #ffffff;
	--mmm-accent-dark: #083f61;
	--mmm-header: #10233a;
	--mmm-header-fg: #ffffff;
	--mmm-pin: #0b5d8f;
	--mmm-pin-hover: #f08a24;
	--mmm-pin-active: #d9480f;
	--mmm-radius: 10px;
	--mmm-shadow: 0 10px 30px rgba(16, 35, 58, 0.18);

	position: relative;
	z-index: 0;
	isolation: isolate;
	box-sizing: border-box;
	width: 100%;
	margin: var(--mmm-margin, 0 0 32px);
	color: var(--mmm-fg);
	/* Section background comes from the "Section background color" setting
	   (Tools > Marina Map > Layout). Blank = transparent, so the page shows through. */
	background: var(--mmm-section-bg, transparent);
	font-family: inherit;
	line-height: 1.45;
}

/* Full-width mode: break out of the theme's content column to the viewport edge.
   Block themes override this through their own .alignfull rules (with !important),
   which is what we want; this rule covers classic themes. Top/bottom margin still
   comes from --mmm-margin because it is declared first. */
.mmm-directory.mmm-full {
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
}

/* ponytail: 100vw includes the scrollbar on Windows, so a full-width directory
   can add ~15px of horizontal page scroll there. Upgrade: measure the scrollbar
   in JS and set --mmm-vw, or let the theme's own alignfull rule win. */

.mmm-directory .mmm-inner {
	box-sizing: border-box;
	max-width: var(--mmm-max-width, none);
	margin: 0 auto;
	padding: var(--mmm-padding, 0);
}

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

@media (prefers-color-scheme: dark) {
	.mmm-directory.mmm-auto-dark {
		--mmm-bg: #111827;
		--mmm-fg: #e5e7eb;
		--mmm-muted: #9ca3af;
		--mmm-border: #2b3544;
		--mmm-surface: #1a2332;
		--mmm-hover: #223049;
	}
}

.mmm-directory .mmm-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---- search bar ---- */

/* Pill field: white, fully rounded, soft drop shadow, no border, search icon on the
   right in the accent colour. The icon is Lucide "search" rendered by the CDN script;
   if that script is blocked the field still works, just without the icon. */

.mmm-directory .mmm-search {
	margin: 0 0 12px;
}

/* One size knob: everything below is in em, so font, padding, pill radius, icon
   and shadow all scale together. 16.8px = 5% over the original 16px. */
.mmm-directory .mmm-search-field {
	position: relative;
	font-size: 16.8px;
}

.mmm-directory .mmm-search-input {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0.9375em 3.5em 0.9375em 1.5em;
	font: inherit;
	font-size: 1em;
	color: var(--mmm-fg);
	background: #ffffff;
	border: 1px solid transparent;
	border-radius: 999px; /* full pill at any height */
	box-shadow: 0 0.125em 0.375em rgba(16, 35, 58, 0.10), 0 0.5em 1.375em rgba(16, 35, 58, 0.10);
	outline: none;
	transition: border-color 0.15s, box-shadow 0.15s;
	-webkit-appearance: none;
	appearance: none;
}

.mmm-directory .mmm-search-input:focus {
	border-color: var(--mmm-accent);
	box-shadow: 0 0.125em 0.375em rgba(16, 35, 58, 0.10), 0 0.5em 1.375em rgba(16, 35, 58, 0.10), 0 0 0 0.1875em rgba(11, 93, 143, 0.18);
}

.mmm-directory .mmm-search-input::placeholder {
	color: var(--mmm-fg);
	opacity: 0.85;
}

.mmm-directory .mmm-search-icon {
	position: absolute;
	top: 50%;
	right: 1.375em;
	width: 1.375em;
	height: 1.375em;
	transform: translateY(-50%);
	color: var(--mmm-accent);
	pointer-events: none;
	line-height: 0;
}

.mmm-directory .mmm-search-icon svg {
	display: block;
	width: 1.375em;
	height: 1.375em;
	stroke-width: 2.5;
}

.mmm-directory .mmm-search-input::-webkit-search-cancel-button {
	cursor: pointer;
}

/* ---- two-column body ---- */

.mmm-directory .mmm-body {
	display: grid;
	grid-template-columns: minmax(230px, var(--mmm-sidebar-width, 30%)) minmax(0, 1fr);
	height: var(--mmm-map-height, 600px);
	border: 1px solid var(--mmm-border);
	border-radius: var(--mmm-radius);
	overflow: hidden;
	background: var(--mmm-bg);
}

.mmm-directory .mmm-sidebar {
	display: flex;
	flex-direction: column;
	min-height: 0;
	border-right: 1px solid var(--mmm-border);
	background: var(--mmm-bg);
}

.mmm-directory .mmm-count {
	flex: 0 0 auto;
	padding: 10px 16px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--mmm-muted);
	background: var(--mmm-surface);
	border-bottom: 1px solid var(--mmm-border);
}

.mmm-directory .mmm-list {
	flex: 1 1 auto;
	min-height: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: #b8c2cf transparent;
}

.mmm-directory .mmm-list::-webkit-scrollbar {
	width: 8px;
}

.mmm-directory .mmm-list::-webkit-scrollbar-track {
	background: transparent;
}

.mmm-directory .mmm-list::-webkit-scrollbar-thumb {
	background: #b8c2cf;
	border-radius: 8px;
	border: 2px solid var(--mmm-bg);
}

.mmm-directory .mmm-list::-webkit-scrollbar-thumb:hover {
	background: #94a1b2;
}

.mmm-directory .mmm-item {
	margin: 0;
	padding: 0;
	border-bottom: 1px solid var(--mmm-border);
}

.mmm-directory .mmm-item[hidden] {
	display: none;
}

/* Scoped with .mmm-directory and written for every state, because themes style
   every <button> on the site (white text on hover, uppercase, letter-spacing,
   shadows) and those rules would otherwise win. */
.mmm-directory .mmm-item-button,
.mmm-directory .mmm-item-button:link,
.mmm-directory .mmm-item-button:visited {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	width: 100%;
	min-height: 0;
	margin: 0;
	padding: 12px 16px;
	font: inherit;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 0;
	text-transform: none;
	text-align: left;
	text-decoration: none;
	text-shadow: none;
	color: var(--mmm-fg);
	background: transparent;
	background-image: none;
	border: 0;
	border-left: 3px solid transparent;
	border-radius: 0;
	box-shadow: none;
	cursor: pointer;
	transition: background-color 0.12s, border-color 0.12s;
	-webkit-appearance: none;
	appearance: none;
}

.mmm-directory .mmm-item-button:hover,
.mmm-directory .mmm-item-button:focus,
.mmm-directory .mmm-item-button:focus-visible,
.mmm-directory .mmm-item-button:active {
	color: var(--mmm-fg);
	background: var(--mmm-hover);
	background-image: none;
	border-left-color: var(--mmm-pin-hover);
	box-shadow: none;
	text-decoration: none;
	outline: none;
	transform: none;
}

.mmm-directory .mmm-item-button:focus-visible {
	box-shadow: inset 0 0 0 2px var(--mmm-accent);
}

.mmm-directory .mmm-item.is-active .mmm-item-button,
.mmm-directory .mmm-item.is-active .mmm-item-button:hover {
	color: var(--mmm-fg);
	border-left-color: var(--mmm-accent);
	background: var(--mmm-hover);
	font-weight: 600;
}

.mmm-directory .mmm-item-name {
	flex: 1 1 auto;
	min-width: 0;
}

.mmm-directory .mmm-match {
	padding: 0 1px;
	color: inherit;
	background: rgba(240, 138, 36, 0.35);
	border-radius: 3px;
}

.mmm-directory .mmm-item-tag {
	flex: 0 0 auto;
	padding: 2px 7px;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.4;
	color: var(--mmm-muted);
	background: var(--mmm-surface);
	border: 1px solid var(--mmm-border);
	border-radius: 999px;
	white-space: nowrap;
}

/* Address + phone under the name. Lives outside the <button> so the tel: link is its
   own tap target; hover and active paint the button and this block together so the
   row reads as one. */
.mmm-directory .mmm-item-meta {
	padding: 0 16px 16px 16px; /* same 3px left border as the button, so text lines up */
	border-left: 3px solid transparent;
	font-size: 15px;
	line-height: 1.45;
	color: var(--mmm-fg);
	cursor: pointer;
	transition: background-color 0.12s, border-color 0.12s;
}

.mmm-directory .mmm-item-button:has(+ .mmm-item-meta) {
	padding-bottom: 4px;
}

/* Name reads as the row title: bold, navy. */
.mmm-directory .mmm-item-button .mmm-item-name {
	font-weight: 700;
	color: var(--mmm-accent-dark);
}

.mmm-directory .mmm-item-address {
	display: block;
	margin: 0; /* themes give <address> a 1.5em bottom margin */
	padding: 0;
	font-style: normal;
}

.mmm-directory .mmm-item-address span {
	display: block;
}

.mmm-directory .mmm-item-phone {
	margin: 6px 0 0;
	padding: 0;
	font-size: 15px;
	line-height: 1.45;
}

.mmm-directory .mmm-item-phone a,
.mmm-directory .mmm-item-phone a:link,
.mmm-directory .mmm-item-phone a:visited {
	color: var(--mmm-accent);
	font-weight: 700;
	text-decoration: none;
	border: 0;
	box-shadow: none;
}

/* Pill button, same tokens as the popup card's button. Written for every state
   because themes style every <a> and would otherwise win. */
.mmm-directory .mmm-item-cta,
.mmm-directory .mmm-item-cta:link,
.mmm-directory .mmm-item-cta:visited {
	display: block;
	width: fit-content; /* shrink to the label, then auto left margin pushes it right */
	margin: 14px 0 0 auto;
	padding: 11px 24px;
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0;
	text-transform: none;
	text-decoration: none;
	text-shadow: none;
	color: var(--mmm-accent-fg);
	background: var(--mmm-accent);
	background-image: none;
	border: 0;
	border-radius: 999px;
	box-shadow: none;
	cursor: pointer;
	transition: background-color 0.15s;
}

.mmm-directory .mmm-item-cta:hover,
.mmm-directory .mmm-item-cta:focus-visible {
	color: var(--mmm-accent-fg);
	background: var(--mmm-accent-dark);
	text-decoration: none;
	outline: none;
	box-shadow: 0 0 0 3px rgba(11, 93, 143, 0.25);
}

.mmm-directory .mmm-item-phone a:hover,
.mmm-directory .mmm-item-phone a:focus-visible {
	color: var(--mmm-accent-dark);
	text-decoration: underline;
	outline: none;
}

.mmm-directory .mmm-item:hover .mmm-item-button,
.mmm-directory .mmm-item:hover .mmm-item-meta {
	background: var(--mmm-hover);
	border-left-color: var(--mmm-pin-hover);
}

.mmm-directory .mmm-item.is-active .mmm-item-meta,
.mmm-directory .mmm-item.is-active:hover .mmm-item-meta {
	background: var(--mmm-hover);
	border-left-color: var(--mmm-accent);
}

.mmm-directory .mmm-item-card {
	padding: 0 12px 12px;
}

.mmm-directory .mmm-empty {
	padding: 24px 16px;
	color: var(--mmm-muted);
	text-align: center;
}

/* ---- map ---- */

.mmm-directory .mmm-map {
	position: relative;
	z-index: 0;
	min-height: 0;
	height: 100%;
	background: #e6ebf0;
}

.mmm-directory .leaflet-container {
	font: inherit;
	font-size: 14px;
}

.mmm-directory .leaflet-control-attribution {
	font-size: 10px;
}

/* ---- custom pin ---- */

.mmm-directory .mmm-pin-wrap {
	background: transparent;
	border: 0;
}

.mmm-directory .mmm-pin {
	position: relative;
	display: block;
	width: 30px;
	height: 34px;
	cursor: pointer;
	transform-origin: 50% 100%;
	transition: transform 0.15s ease;
}

.mmm-directory .mmm-pin::before {
	content: "";
	position: absolute;
	left: 3px;
	top: 3px;
	width: 24px;
	height: 24px;
	background: var(--mmm-pin);
	border: 2px solid #ffffff;
	border-radius: 50% 50% 50% 0;
	transform: rotate(-45deg);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
	transition: background-color 0.15s;
}

.mmm-directory .mmm-pin::after {
	content: "";
	position: absolute;
	left: 11px;
	top: 11px;
	width: 8px;
	height: 8px;
	background: #ffffff;
	border-radius: 50%;
}

.mmm-directory .mmm-pin.is-approximate::before {
	border-style: dashed;
}

.mmm-directory .mmm-pin.is-hover {
	transform: scale(1.18);
}

.mmm-directory .mmm-pin.is-hover::before {
	background: var(--mmm-pin-hover);
}

.mmm-directory .mmm-pin.is-active {
	transform: scale(1.18);
}

.mmm-directory .mmm-pin.is-active::before {
	background: var(--mmm-pin-active);
}

/* ---- popup card ---- */

.mmm-directory .mmm-popup .leaflet-popup-content-wrapper {
	padding: 0;
	border-radius: var(--mmm-radius);
	overflow: hidden;
	box-shadow: var(--mmm-shadow);
	background: var(--mmm-bg);
	color: var(--mmm-fg);
}

.mmm-directory .mmm-popup .leaflet-popup-content {
	margin: 0;
	width: auto;
	line-height: 1.45;
}

.mmm-directory .mmm-popup .leaflet-popup-tip {
	background: var(--mmm-bg);
}

.mmm-directory .mmm-popup .leaflet-popup-close-button {
	color: var(--mmm-header-fg);
	opacity: 0.8;
	top: 6px;
	right: 6px;
}

.mmm-directory .mmm-card {
	width: 272px;
	max-width: 100%;
}

.mmm-directory .mmm-item-card .mmm-card {
	width: 100%;
	border: 1px solid var(--mmm-border);
	border-radius: var(--mmm-radius);
	overflow: hidden;
}

.mmm-directory .mmm-card__header {
	padding: 14px 36px 14px 16px;
	background: var(--mmm-header);
	color: var(--mmm-header-fg);
}

.mmm-directory .mmm-card__title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	color: inherit;
}

.mmm-directory .mmm-card__body {
	padding: 14px 16px 16px;
}

.mmm-directory .mmm-card__address {
	margin: 0 0 8px;
	font-style: normal;
	color: var(--mmm-fg);
}

.mmm-directory .mmm-card__address span {
	display: block;
}

/* Leaflet's own ".leaflet-popup-content p" rule outranks a single class, so the
   card's paragraphs are also matched with the popup selector. */
.mmm-directory .mmm-card__phone,
.mmm-directory .leaflet-popup-content .mmm-card__phone {
	margin: 0 0 10px;
	font-size: 14px;
}

.mmm-directory .leaflet-popup-content .mmm-card__note {
	margin: 0 0 10px;
}

.mmm-directory .mmm-card__phone a {
	color: var(--mmm-accent);
	text-decoration: none;
	font-weight: 600;
}

.mmm-directory .mmm-card__phone a:hover {
	text-decoration: underline;
}

.mmm-directory .mmm-card__note {
	margin: 0 0 10px;
	font-size: 12px;
	color: var(--mmm-muted);
}

/* Future CPT amenity icons go here. Each child should be an element with class
   .marina-amenity carrying an icon and a title attribute. Hidden while empty. */
.marina-amenities-container {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 0 12px;
}

.marina-amenities-container:empty {
	display: none;
}

.marina-amenity {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px 8px;
	font-size: 12px;
	color: var(--mmm-muted);
	background: var(--mmm-surface);
	border: 1px solid var(--mmm-border);
	border-radius: 999px;
}

.mmm-directory .mmm-card__cta {
	display: block;
	width: 100%;
	padding: 11px 14px;
	font: inherit;
	font-size: 14px;
	font-weight: 700;
	text-align: center;
	text-decoration: none;
	color: var(--mmm-accent-fg) !important;
	background: var(--mmm-accent);
	border: 0;
	border-radius: 8px;
	cursor: pointer;
	transition: background-color 0.15s;
}

.mmm-directory .mmm-card__cta:hover,
.mmm-directory .mmm-card__cta:focus-visible {
	background: var(--mmm-accent-dark);
	color: var(--mmm-accent-fg) !important;
	text-decoration: none;
}

/* ---- placeholder shown in editors, feeds, SEO previews ---- */

.mmm-placeholder {
	padding: 24px;
	text-align: center;
	color: #5b6573;
	background: #f5f7fa;
	border: 1px dashed #c4ccd6;
	border-radius: 10px;
}

/* ---- mobile ---- */

@media (max-width: 767px) {
	.mmm-directory .mmm-body {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: auto 380px;
		height: auto;
	}

	.mmm-directory .mmm-sidebar {
		max-height: 260px;
		border-right: 0;
		border-bottom: 1px solid var(--mmm-border);
	}

	.mmm-directory .mmm-map {
		height: 380px;
	}

	.mmm-directory .mmm-item-button {
		padding: 11px 14px;
		font-size: 14px;
	}

	.mmm-directory .mmm-item-meta {
		padding: 0 14px 14px 14px;
		font-size: 14px;
	}

	.mmm-directory .mmm-item-phone,
	.mmm-directory .mmm-item-cta {
		font-size: 14px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mmm-directory .mmm-pin,
	.mmm-directory .mmm-pin::before,
	.mmm-directory .mmm-item-button,
	.mmm-directory .mmm-item-meta,
	.mmm-directory .mmm-item-cta,
	.mmm-directory .mmm-search-input {
		transition: none;
	}
}
