/* Toggle Box block (acf/toggle) — pill tabs swapping image / floor-plan panels.
   The pill scheme and copy color derive from the native background color:
   light band (default) → green pills, active pill green w/ lime text;
   dark band (green/black) → lime pills, active pill lime w/ green text. */

.toggle--block {
	padding: 50px 0 64px;
}

/* --- header copy ----------------------------------------------------------- */

.toggle--header p {
	max-width: 706px;
}
.toggle--header p.has-text-align-center {
	margin-inline: auto;
}
.toggle--header p.has-text-align-right {
	margin-left: auto;
}

/* --- pill rows ------------------------------------------------------------- */

.toggle--pills {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px 22px;
	margin-top: 45px;
}
.toggle--pills-left .toggle--pills {
	justify-content: flex-start;
}

.toggle--pill,
.toggle--plantype {
	appearance: none;
	display: inline-flex;
	align-items: center;
	padding: 12px 16px;
	border: 1px solid var(--wp--preset--color--green, #1a3d39);
	border-radius: 999px;
	background: transparent;
	color: var(--wp--preset--color--green, #1a3d39);
	font-family: inherit;
	font-size: 16px;
	line-height: 1.15;
	font-weight: 500;
	letter-spacing: 0.01em;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}
.toggle--pill:hover:not([aria-selected="true"]),
.toggle--plantype:hover:not([aria-pressed="true"]) {
	background: color-mix(in srgb, currentColor 8%, transparent);
}
.toggle--pill:focus-visible,
.toggle--plantype:focus-visible,
.toggle--download:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}
.toggle--pill[aria-selected="true"] {
	background: var(--wp--preset--color--green, #1a3d39);
	color: var(--wp--preset--color--lime, #c3d941);
}

/* --- plan-type switch (floors mode) ---------------------------------------- */

.toggle--plantypes {
	display: flex;
	justify-content: center;
	margin-top: 18px;
}
.toggle--pills-left .toggle--plantypes {
	justify-content: flex-start;
}
.toggle--plantypes.is-hidden {
	display: none;
}
.toggle--plantypes-inner {
	display: inline-flex;
	background: var(--wp--preset--color--off-white, #fdfbf3);
	border-radius: 999px;
}
.toggle--plantype {
	border-color: transparent;
	padding: 13px 22px;
}
.toggle--plantype[aria-pressed="true"] {
	background: var(--wp--preset--color--green, #1a3d39);
	color: var(--wp--preset--color--lime, #c3d941);
}

/* --- panels ---------------------------------------------------------------- */

.toggle--panels {
	position: relative;
	margin-top: 35px;
}
.toggle--panel {
	display: none;
}
.toggle--panel.is-active {
	display: block;
	animation: toggle-fade 0.25s ease;
}
@keyframes toggle-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
	.toggle--panel.is-active {
		animation: none;
	}
}

.toggle--panel img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 10px;
}

/* floors mode: plan variants + download button */
.toggle--plan-wrap {
	position: relative;
}
.toggle--plan-furniture {
	display: none;
}
.toggle--show-furniture .toggle--plan-furniture {
	display: block;
}
.toggle--show-furniture .toggle--plan-floorplan {
	display: none;
}

.toggle--download {
	position: absolute;
	top: 24px;
	right: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--wp--preset--color--green, #1a3d39);
	color: var(--wp--preset--color--lime, #c3d941);
	transition: transform 0.2s ease;
}
.toggle--download:hover {
	transform: translateY(2px);
}
@media (prefers-reduced-motion: reduce) {
	.toggle--download {
		transition: none;
	}
}

/* --- map mode (Google) ------------------------------------------------------
   One persistent map that the pills reconfigure; the panels still exist but
   hold only a screen-reader copy of each view's pin list, so they collapse to
   zero height and their top margin is dropped here. */

.toggle--map-wrap {
	position: relative;
	margin-top: 35px;
}

.toggle--map {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	min-height: 400px; /* takes over below ~711px wide, where 16:9 gets too short */
	border-radius: 10px;
	overflow: hidden;
	background: var(--wp--preset--color--gray, #d9d9d9);
}

.toggle--mode-map .toggle--panels {
	margin-top: 0;
}

/* Something went wrong loading the Maps JS API — say so rather than leaving a
   silent gray rectangle. */
.toggle--map.is-failed::after {
	content: "The map could not be loaded.";
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	text-align: center;
	color: var(--wp--preset--color--green, #1a3d39);
	font-size: 16px;
}

/* --- markers + popups ------------------------------------------------------- */

/* Light fill + dark ring, NOT the reverse: the project's Mapbox style is a
   dark monochrome green, and a green-filled pin disappears into it — only the
   ring stayed visible. This pairing reads on light and dark styles alike. */
.toggle--marker {
	position: relative;
	cursor: pointer;
	/* Advanced markers are created with gmpClickable:false so the pins stay out
	   of the tab order (they are aria-hidden; the panel's text list is the
	   accessible path). Google suppresses pointer events on non-clickable
	   marker content, so clicks have to be handed back explicitly. */
	pointer-events: all;
	transition: transform 0.15s ease;
}

/* Dot: light fill + dark ring, NOT the reverse. The brand style is a dark
   monochrome green and a green-filled pin disappears into it — only the ring
   stayed visible. This pairing reads on light and dark basemaps alike. */
.toggle--marker-dot {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #bed600; /* client, 2026-09-23 — #bee0c0 did not pop on the dark basemap; deliberately not a theme.json token */
	border: 2px solid var(--wp--preset--color--green, #1a3d39);
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.toggle--marker-dot:hover {
	transform: scale(1.2);
}

/* Text label: the designer supplied these as flat SVGs with the wording baked
   in. Rebuilt as CSS so the copy is CMS-editable, reaches assistive tech via
   the panel list, and does not need a new file per pin. Geometry measured off
   those SVGs (142.63x50.68 @ radius 4, two centred lines). */
.toggle--marker-label {
	--pill: #fff;
	--tail: 7px;
	max-width: 160px;
	/* The tail lives in this padding, so the element's bottom edge IS the tip.
	   Markers anchor at bottom-centre, which then lands the tip exactly on the
	   coordinate — drawing the tail outside the box instead would push it a
	   tail's height past the real location. */
	padding-bottom: var(--tail);
}
/* One variable per variant so the pill and its tail can never disagree. */
.toggle--marker-white { --pill: #fff; }
.toggle--marker-green { --pill: #bee0c0; }
.toggle--marker-grey  { --pill: #dfe1df; }

.toggle--marker-label .toggle--marker-text {
	display: block;
	padding: 7px 12px;
	border-radius: 4px;
	background: var(--pill);
	color: #010101;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.15;
	text-align: center;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.toggle--marker-label::after {
	content: "";
	position: absolute;
	left: 50%;
	bottom: 0;
	transform: translateX(-50%);
	border-left: var(--tail) solid transparent;
	border-right: var(--tail) solid transparent;
	border-top: var(--tail) solid var(--pill);
}

/* Logo: an uploaded mark, drawn as a background so a 1x1-metadata SVG upload
   can never impose a square aspect-ratio on it (see CLAUDE.md trap 13). */
.toggle--marker-logo {
	width: 104px; /* fallback; the per-pin Logo Width sets this inline */
	height: auto; /* the image's own ratio decides - never pin a height here */
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}
.toggle--marker-logo img {
	display: block;
	width: 100%;
	height: auto;
	/* Belt and braces against trap 13 if a 1x1-metadata SVG ever reaches an
	   <img> that does carry dimension attributes. */
	aspect-ratio: auto;
}
.toggle--marker-logo:hover,
.toggle--marker-label:hover {
	transform: scale(1.04);
}
/* transform-origin below keeps this from making the pin jump off its point. */
.toggle--marker-building:hover {
	transform: scale(1.08);
}
/* The building uses the project's own pin artwork, whose point sits at
   bottom-centre — hence anchor:'bottom' in toggle.js, unlike the round POI
   dots which anchor at their centre. 53:100 is the file's own ratio, so 32x60
   keeps it undistorted; `contain` guards the rounding either way. */
.toggle--marker-building {
	width: 32px;
	height: 60px;
	background: url(../../images/dy_map_icon.svg) no-repeat center / contain;
	border: 0;
	border-radius: 0;
	/* box-shadow would trace the square element; drop-shadow follows the pin outline */
	box-shadow: none;
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
	transform-origin: bottom center;
}

/* Client sizes for the building pin. Heights are the widths carried through
   the artwork's own 53:100 ratio, so it never distorts. The popup is a child
   of the marker, so it tracks these sizes on its own — there is no matching
   offset to update in the JS. */
@media (min-width: 992px) {
	.toggle--marker-building {
		width: 70px;
		height: 132px;
	}
}
@media (min-width: 1200px) {
	.toggle--marker-building {
		width: 100px;
		height: 189px;
	}
}
/* The 70/100px sizes above are for the single-building homepage map, which
   sits at zoom ~15. A map framed around its own pins is a whole-city view,
   where that artwork is wildly out of scale AND — because the building marker
   is REQUIRED — its collision box suppresses the surrounding labels. Hold it
   at the base size there. */
.toggle--map-views .toggle--marker-building {
	width: 32px;
	height: 60px;
}

@media (prefers-reduced-motion: reduce) {
	.toggle--marker {
		transition: none;
	}
}

/* The popup is our own DOM inside the marker, not a google.maps.InfoWindow —
   .gm-style-iw ships chrome and a close button that is awkward to restyle, and
   a child element tracks the pin at every breakpoint for free. That means all
   the bubble chrome Mapbox used to supply lives here now, including the
   max-width (its Popup defaulted to 240px, so nothing in this file set one and
   a long place name would otherwise render as one unwrapped line). */
.toggle--popup {
	position: absolute;
	left: 50%;
	bottom: calc(100% + 9px);
	transform: translateX(-50%);
	z-index: 2;
	display: none;
	flex-direction: column;
	gap: 2px;
	width: max-content;
	max-width: 240px;
	padding: 10px 14px;
	border-radius: 8px;
	background: var(--wp--preset--color--off-white, #fdfbf3);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
	color: var(--wp--preset--color--green, #1a3d39);
	font-family: inherit;
	text-align: left;
	cursor: default;
}
.toggle--marker.is-open .toggle--popup {
	display: flex;
}
/* The tip, which Mapbox drew for us. */
.toggle--popup::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border-left: 9px solid transparent;
	border-right: 9px solid transparent;
	border-top: 9px solid var(--wp--preset--color--off-white, #fdfbf3);
}
.toggle--popup strong {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.25;
}
.toggle--popup span {
	font-size: 13px;
	opacity: 0.75;
}

/* Google's two-finger / ctrl-scroll hint is .gm-style-pbt — an undocumented
   internal class, so it is deliberately left at its default look rather than
   restyled against something that can rename itself in any release. */

/* --- map mode: editor canvas ------------------------------------------------ */

.toggle--map-placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	color: var(--wp--preset--color--green, #1a3d39);
	font-size: 16px;
}

/* --- dark background scheme (green / black band) ---------------------------- */

.toggle--block.has-green-background-color,
.toggle--block.has-black-background-color {
	color: var(--wp--preset--color--white, #ffffff);
}
.toggle--block.has-green-background-color .toggle--pill,
.toggle--block.has-black-background-color .toggle--pill {
	border-color: var(--wp--preset--color--lime, #c3d941);
	color: var(--wp--preset--color--lime, #c3d941);
}
.toggle--block.has-green-background-color .toggle--pill[aria-selected="true"],
.toggle--block.has-black-background-color .toggle--pill[aria-selected="true"] {
	background: var(--wp--preset--color--lime, #c3d941);
	color: var(--wp--preset--color--green, #1a3d39);
}

/* --- editor canvas --------------------------------------------------------- */

.editor-styles-wrapper .toggle--pill,
.editor-styles-wrapper .toggle--plantype {
	pointer-events: none;
}

/* Canvas bridge for the dark scheme above (CLAUDE.md trap 10). ACF renders the
   block's markup INSIDE the editor wrapper, so get_block_wrapper_attributes()
   puts has-*-background-color on .acf-block-preview one level up — the
   front-end `.toggle--block.has-green-background-color` rules match nothing
   here, and the dark-band instances showed dark copy on dark green. Scoped to
   .acf-block-preview so it is canvas-only and can't leak or misfire when
   blocks nest. The block declares `color.text: false`, so there is no
   has-text-color case to guard against. */
.acf-block-preview.has-green-background-color .toggle--block,
.acf-block-preview.has-black-background-color .toggle--block {
	color: var(--wp--preset--color--white, #ffffff);
}
.acf-block-preview.has-green-background-color .toggle--pill,
.acf-block-preview.has-black-background-color .toggle--pill {
	border-color: var(--wp--preset--color--lime, #c3d941);
	color: var(--wp--preset--color--lime, #c3d941);
}
.acf-block-preview.has-green-background-color .toggle--pill[aria-selected="true"],
.acf-block-preview.has-black-background-color .toggle--pill[aria-selected="true"] {
	background: var(--wp--preset--color--lime, #c3d941);
	color: var(--wp--preset--color--green, #1a3d39);
}

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

@media (max-width: 755px) {
	.toggle--block {
		padding: 40px 0 48px;
	}
	.toggle--pills {
		gap: 10px 12px;
		margin-top: 32px;
	}
	.toggle--pill {
		padding: 10px 14px;
		font-size: 15px;
	}
	.toggle--plantype {
		padding: 11px 18px;
		font-size: 15px;
	}
	.toggle--panels {
		margin-top: 24px;
	}
	.toggle--map-wrap {
		margin-top: 24px;
	}
	.toggle--download {
		top: 14px;
		right: 14px;
		width: 38px;
		height: 38px;
	}
}
