/*
 * Bottom call to action on posts (markup: header.php, #poparide-bottom-cta; fade-in on scroll: inline script in
 * header.php; close button: assets/js/custom.js). Replaces the blue bar with the yellow button from custom.css:
 * a white floating card (fully rounded, 16px from the screen edges, as wide as the header's content) with a soft shadow, a Roca title, and the design
 * system's dark orange action button (poparide-client --color-action #d23f00, hover --color-action-dark #a53000),
 * like "Sign in" in the header.
 * Loaded after custom.css; the #ids below match its selectors and win by order.
 */

#poparide-bottom-cta {
	/* Design system tokens (poparide-client globals.css) */
	--cta-action: #d23f00;
	--cta-action-dark: #a53000;
	--cta-primary: #183154;     /* navy-500 */
	--cta-text: #466682;        /* navy-400 */
	--cta-border: #edeff2;      /* neutral-300 */
	--cta-tint: #f1faff;        /* blue-100 */

	/* A floating card: the same 16px gap to the left, right and bottom edge of the screen (12px on phones); custom.css
	   pinned the old bar to the bottom edge at full width. On phones the bottom gap also clears the home indicator. */
	--cta-gap: 16px;
	right: 0;
	bottom: calc(var(--cta-gap) + env(safe-area-inset-bottom, 0px));
	left: 0;
	box-sizing: border-box;
	/* Centered, and no wider than the header's content (same widths as the theme's .container, see below). */
	width: calc(100% - 2 * var(--cta-gap));
	max-width: none;
	margin-right: auto;
	margin-left: auto;
	background: #fff;
	border: 1px solid var(--cta-border);
	border-radius: 24px;
	box-shadow: 0 8px 32px -8px rgba(24, 49, 84, 0.28);
	/* Slides up as it fades in (the .fade-in / .fade-out classes come from the scroll script in header.php). Until it
	   is shown it also stops blocking clicks on the page below, which the old bar did while transparent. */
	transform: translateY(24px);
	visibility: hidden;
}

#poparide-bottom-cta.fade-in {
	transform: none;
	visibility: visible;
}

/* Same width as the header's content and the post cards (the .container widths minus their 15px gutters), so the
   card's edges line up with the logo on the left and "Sign in" on the right. Below 768px it spans the screen. */
@media (min-width: 768px) {
	#poparide-bottom-cta {
		max-width: 720px;
	}
}

@media (min-width: 992px) {
	#poparide-bottom-cta {
		max-width: 940px;
	}
}

@media (min-width: 1200px) {
	#poparide-bottom-cta {
		max-width: 1140px;
	}
}

@media (prefers-reduced-motion: reduce) {
	#poparide-bottom-cta,
	#poparide-bottom-cta.fade-in,
	#poparide-bottom-cta.fade-out {
		transition: none;
		transform: none;
	}
}

/* ─── Layout: text on the left, button on the right ─────────────────────── */

#poparide-bottom-cta #poparide-bottom-cta-container {
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 40px;
	padding: 22px 64px 22px 32px;
}

#poparide-bottom-cta #poparide-bottom-cta-container .clear {
	display: none;
}

#poparide-bottom-cta #poparide-bottom-cta-left {
	float: none;
	flex: 1;
	min-width: 0;
	color: var(--cta-text);
}

#poparide-bottom-cta #poparide-bottom-cta-left #poparide-bottom-cta-left-title {
	margin: 0 0 4px;
	font-family: var(--font-display, "Roca-Bold", "proxima-soft", sans-serif);
	font-size: 26px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.01em;
	color: var(--cta-primary);
}

#poparide-bottom-cta #poparide-bottom-cta-left #poparide-bottom-cta-left-subtitle {
	font-size: 16px;
	line-height: 1.4;
	color: var(--cta-text);
}

#poparide-bottom-cta #poparide-bottom-cta-right {
	float: none;
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
}

/* The main button: filled dark orange. */
#poparide-bottom-cta #poparide-bottom-cta-right .poparide-bottom-cta-right-button {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	margin: 0;
	padding: 0 28px;
	border: 0;
	border-radius: 12px;
	background: var(--cta-action);
	font-size: 17px;
	font-weight: 600;
	line-height: 1.2;
	color: #fff;
	text-decoration: none;
	white-space: nowrap;
	transition: background 0.15s;
}

#poparide-bottom-cta #poparide-bottom-cta-right .poparide-bottom-cta-right-button:hover,
#poparide-bottom-cta #poparide-bottom-cta-right .poparide-bottom-cta-right-button:focus,
#poparide-bottom-cta #poparide-bottom-cta-right .poparide-bottom-cta-right-button:active {
	background: var(--cta-action-dark);
	color: #fff;
	text-decoration: none;
	opacity: 1;
}

/* The second choice: a quiet text link with the app's caret, no underline. */
#poparide-bottom-cta #poparide-bottom-cta-right .poparide-bottom-cta-right-small-button {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border: 0;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	color: var(--cta-text);
	text-decoration: none;
	transition: color 0.15s;
}

#poparide-bottom-cta #poparide-bottom-cta-right .poparide-bottom-cta-right-small-button::after {
	content: "";
	width: 6px;
	height: 9px;
	background: currentColor;
	-webkit-mask: url("../images/chevron-right.svg") center / contain no-repeat;
	mask: url("../images/chevron-right.svg") center / contain no-repeat;
}

#poparide-bottom-cta #poparide-bottom-cta-right .poparide-bottom-cta-right-small-button:hover,
#poparide-bottom-cta #poparide-bottom-cta-right .poparide-bottom-cta-right-small-button:focus,
#poparide-bottom-cta #poparide-bottom-cta-right .poparide-bottom-cta-right-small-button:active {
	color: var(--cta-primary);
	text-decoration: none;
	opacity: 1;
}

/* ─── Close button: a round, 36px target (it was a bare "×" in a 25px box) ─ */

#poparide-bottom-cta #poparide-bottom-cta-close {
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	position: absolute;
	top: 14px;
	right: 14px;
	width: 36px;
	height: 36px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	font-size: 0;
	color: var(--cta-text);
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
}

#poparide-bottom-cta #poparide-bottom-cta-close:hover {
	background: var(--cta-tint);
	color: var(--cta-primary);
}

/* ─── Narrower screens ──────────────────────────────────────────────────── */

@media (max-width: 991px) {
	#poparide-bottom-cta #poparide-bottom-cta-container {
		gap: 24px;
	}

	#poparide-bottom-cta #poparide-bottom-cta-left #poparide-bottom-cta-left-title {
		font-size: 22px;
	}
}

/* Phones: title on top, full-width button, the second choice under it. */
@media (max-width: 768px) {
	#poparide-bottom-cta {
		--cta-gap: 12px;
		border-radius: 20px;
	}

	#poparide-bottom-cta #poparide-bottom-cta-container {
		flex-direction: column;
		align-items: stretch;
		gap: 12px;
		padding: 16px 16px 14px;
	}

	#poparide-bottom-cta #poparide-bottom-cta-left {
		/* Leaves room for the close button in the corner. */
		padding: 0 30px;
	}

	#poparide-bottom-cta #poparide-bottom-cta-left #poparide-bottom-cta-left-title {
		margin: 0;
		font-size: 17px;
		line-height: 1.25;
		text-align: center;
	}

	/* The extra "and sign up is free!" text runs on in the same paragraph instead of taking a third line. */
	#poparide-bottom-cta #poparide-bottom-cta-left-title .show-on-mobile {
		display: inline;
	}

	/* Two equal buttons side by side, like the mobile app's primary + secondary pair: "Find a ride" filled orange,
	   "Post a trip" outlined in navy on white (poparide-client apps/mobile Button.tsx: 48px high, 16px radius,
	   1px border, semibold label). */
	#poparide-bottom-cta #poparide-bottom-cta-right {
		flex-direction: row;
		align-items: stretch;
		gap: 8px;
	}

	#poparide-bottom-cta #poparide-bottom-cta-right .poparide-bottom-cta-right-button,
	#poparide-bottom-cta #poparide-bottom-cta-right .poparide-bottom-cta-right-small-button {
		box-sizing: border-box;
		flex: 1 1 0;
		justify-content: center;
		min-width: 0;
		min-height: 48px;
		margin: 0;
		padding: 0 10px;
		border: 1px solid var(--cta-action);
		border-radius: 16px;
		font-size: 16px;
		font-weight: 600;
		line-height: 1.15;
		text-align: center;
		white-space: normal;
		width: auto;
	}

	#poparide-bottom-cta #poparide-bottom-cta-right .poparide-bottom-cta-right-small-button {
		border-color: var(--cta-primary);
		background: #fff;
		color: var(--cta-primary);
	}

	#poparide-bottom-cta #poparide-bottom-cta-right .poparide-bottom-cta-right-small-button:hover,
	#poparide-bottom-cta #poparide-bottom-cta-right .poparide-bottom-cta-right-small-button:focus,
	#poparide-bottom-cta #poparide-bottom-cta-right .poparide-bottom-cta-right-small-button:active {
		background: var(--cta-tint);
		color: var(--cta-primary);
	}

	/* The "Or," of the text link makes no sense on a button: hide it and capitalize the label ("Post a trip"). */
	#poparide-bottom-cta #poparide-bottom-cta-right .poparide-bottom-cta-or {
		display: none;
	}

	#poparide-bottom-cta #poparide-bottom-cta-right .poparide-bottom-cta-label {
		display: inline-block;
	}

	#poparide-bottom-cta #poparide-bottom-cta-right .poparide-bottom-cta-label::first-letter {
		text-transform: uppercase;
	}

	/* No caret on the outlined button (it is only there for the text link). */
	#poparide-bottom-cta #poparide-bottom-cta-right .poparide-bottom-cta-right-small-button::after {
		display: none;
	}

	#poparide-bottom-cta #poparide-bottom-cta-close {
		top: 10px;
		right: 10px;
	}
}

@media (max-width: 359px) {
	#poparide-bottom-cta #poparide-bottom-cta-right .poparide-bottom-cta-right-button,
	#poparide-bottom-cta #poparide-bottom-cta-right .poparide-bottom-cta-right-small-button {
		padding: 0 8px;
		font-size: 15px;
	}
}
