/* RXD Contact Box Widget */

.rxd-contact {
	font-family: inherit;
	/* Overridden per-widget by the Animation Speed control */
	--rxd-contact-duration: 450ms;
}

/* Each state is a collapsible grid row (0fr/1fr, same technique as the
   Accordion panel), so only the visible state contributes height and the
   box resizes between the two instead of always matching the taller one. */
.rxd-contact-inner {
	display: grid;
	grid-template-rows: 1fr 0fr;
	transition: grid-template-rows var( --rxd-contact-duration ) cubic-bezier( 0, 0, 0.2, 1 );
}

.rxd-contact:hover .rxd-contact-inner {
	grid-template-rows: 0fr 1fr;
	transition: grid-template-rows calc( var( --rxd-contact-duration ) * 0.85 ) cubic-bezier( 0.4, 0, 1, 1 );
}

.rxd-contact-default,
.rxd-contact-hover {
	min-height: 0;
	min-width: 0;
	overflow: hidden;
}

/* Default: visible; delay on visibility=hidden so it waits for the fade */
.rxd-contact-default {
	opacity: 1;
	visibility: visible;
	transition: opacity var( --rxd-contact-duration ) ease, visibility 0s linear 0s;
}

/* Hover state: hidden until parent is hovered */
.rxd-contact-hover {
	opacity: 0;
	visibility: hidden;
	transition: opacity var( --rxd-contact-duration ) ease, visibility 0s linear var( --rxd-contact-duration );
}

.rxd-contact:hover .rxd-contact-default {
	opacity: 0;
	visibility: hidden;
	transition: opacity var( --rxd-contact-duration ) ease, visibility 0s linear var( --rxd-contact-duration );
}

.rxd-contact:hover .rxd-contact-hover {
	opacity: 1;
	visibility: visible;
	transition: opacity var( --rxd-contact-duration ) ease, visibility 0s linear 0s;
}

/* Reserve Space mode (Hover Panel Sizing = "reserve"): restores the classic
   behaviour where both states share one grid cell, so the box is always
   sized to the taller (hover) state, even at rest. No resize to animate. */
.rxd-contact.rxd-contact-reserve-space .rxd-contact-inner,
.rxd-contact.rxd-contact-reserve-space:hover .rxd-contact-inner {
	grid-template-rows: auto;
	transition: none;
}

.rxd-contact.rxd-contact-reserve-space .rxd-contact-default,
.rxd-contact.rxd-contact-reserve-space .rxd-contact-hover {
	grid-area: 1 / 1;
}

/* Touch devices trigger :hover on tap and hold it while the finger stays
   down; in Resize mode that animates content underneath the touch point,
   which browsers misread as a text-selection drag. Reserve Space mode
   never shifts content, so it's left untouched — selection still works
   there, and on desktop hover (mouse never triggers this). */
@media ( hover: none ) and ( pointer: coarse ) {
	.rxd-contact:not( .rxd-contact-reserve-space ) .rxd-contact-inner {
		-webkit-user-select: none;
		user-select: none;
		-webkit-touch-callout: none;
	}
}

/* On mobile there's no hover, and tap-to-reveal is an awkward substitute —
   so skip the default/hover swap entirely and always show the map, stacked
   below the default content. The hover panel's own name and info block are
   suppressed since the default content already shows that. */
@media ( max-width: 767px ) {
	.rxd-contact-inner,
	.rxd-contact:hover .rxd-contact-inner,
	.rxd-contact.rxd-contact-reserve-space .rxd-contact-inner,
	.rxd-contact.rxd-contact-reserve-space:hover .rxd-contact-inner {
		display: block;
		grid-template-rows: unset;
		transition: none;
	}

	.rxd-contact-default,
	.rxd-contact-hover,
	.rxd-contact:hover .rxd-contact-default,
	.rxd-contact:hover .rxd-contact-hover {
		opacity: 1;
		visibility: visible;
		transition: none;
	}

	.rxd-contact.rxd-contact-reserve-space .rxd-contact-default,
	.rxd-contact.rxd-contact-reserve-space .rxd-contact-hover {
		grid-area: auto;
	}

	.rxd-contact-hover > .rxd-contact-name,
	.rxd-contact-hover-info {
		display: none;
	}

	.rxd-contact-hover-panel {
		margin-top: 14px;
	}
}

/* ── Shared elements ─────────────────────────────────────────────────────── */

.rxd-contact-name {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	font-size: 1.05em;
	font-weight: 700;
	margin: 0 0 14px;
	color: #1a1a1a;
}

.rxd-contact-badge {
	display: inline-block;
	font-size: 0.6em;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	padding: 3px 8px;
	border-radius: 4px;
	background-color: #555555;
	color: #ffffff;
	line-height: 1.5;
	white-space: nowrap;
}

.rxd-contact-address {
	margin: 0 0 8px;
	line-height: 1.55;
	color: #333333;
}

/* Strip margins from WYSIWYG-generated block elements inside address */
.rxd-contact-address p,
.rxd-contact-address ul,
.rxd-contact-address ol {
	margin: 0;
	line-height: 1.55;
}

.rxd-contact-phones {
	display: flex;
	flex-direction: column;
	gap: 1px;
	margin-bottom: 8px;
}

.rxd-contact-phone,
.rxd-contact-fax {
	display: block;
	line-height: 1.55;
	color: #333333;
}

/* Phone numbers are tap-to-call links; reset default anchor styling */
.rxd-contact-phone {
	text-decoration: none;
	cursor: pointer;
}

.rxd-contact-phone:hover,
.rxd-contact-phone:focus {
	text-decoration: underline;
	color: inherit;
}

.rxd-contact-fax-label {
	font-weight: 600;
}

.rxd-contact-closed {
	margin: 10px 0 0;
	color: #e53935;
	font-weight: 500;
}

/* ── Default state ───────────────────────────────────────────────────────── */

.rxd-contact-timings-heading {
	display: block;
	font-weight: 700;
	color: #1a1a1a;
	margin: 8px 0 2px;
}

.rxd-contact-timings {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.rxd-contact-timing-group {
	display: flex;
	flex-direction: column;
	gap: 0;
	margin-bottom: 1px;
}

.rxd-contact-timing-label {
	display: block;
	font-weight: 600;
	color: #1a1a1a;
}

.rxd-contact-timing-hours {
	display: block;
	line-height: 1.55;
	color: #333333;
}

/* ── Hover state ─────────────────────────────────────────────────────────── */

.rxd-contact-hover-panel {
	background-color: #ffffff;
	border-radius: 8px;
	overflow: hidden;
}

/* Map */
.rxd-contact-map-wrap {
	position: relative;
}

.rxd-contact-map-frame {
	display: block;
	width: 100%;
	height: 220px;
	border: none;
}

/* "Google Map Link" overlay button at the bottom of the map */
.rxd-contact-map-btn {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 8px 16px;
	background-color: rgba(20, 20, 20, 0.78);
	color: #ffffff;
	text-decoration: none;
	font-size: 0.82em;
	line-height: 1.3;
	transition: background-color 0.2s ease;
}

.rxd-contact-map-btn:hover {
	background-color: rgba(0, 0, 0, 0.92);
	color: #ffffff;
	text-decoration: none;
}

.rxd-contact-map-btn svg {
	flex-shrink: 0;
}

/* Map-placeholder shown in editor when no embed URL is set */
.rxd-contact-map-placeholder {
	background: #e8e8e8;
	height: 220px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #999;
	font-style: italic;
	font-size: 0.85em;
}

/* Hover-state info section (below the map) */
.rxd-contact-hover-info {
	padding: 14px 16px;
}

.rxd-contact-hover-info .rxd-contact-address,
.rxd-contact-hover-info .rxd-contact-phones,
.rxd-contact-hover-info .rxd-contact-phone {
	font-size: 0.9em;
}

.rxd-contact-hover-info .rxd-contact-phones {
	margin-bottom: 0;
}

.rxd-contact-hover-info .rxd-contact-closed {
	margin-top: 6px;
}
