/*
 * CareBridge Core - front-end components (contact options, care picker, sticky bar, editor-only notes).
 * Uses the theme's color variables and falls back to brand values if another theme is active.
 */
:root {
	--cbc-ivory: var(--cb-ivory, #fbf8f2);
	--cbc-oat: var(--cb-oat, #f3ecdf);
	--cbc-sand: var(--cb-sand, #e2d6c1);
	--cbc-navy: var(--cb-navy, #263749);
	--cbc-ink: var(--cb-ink, #1b2a39);
	--cbc-slate: var(--cb-slate, #3f4d5b);
	--cbc-muted: var(--cb-muted, #55626f);
	--cbc-gold: var(--cb-gold, #bea87e);
	--cbc-gold-light: var(--cb-gold-light, #e7d0a4);
	--cbc-bronze: var(--cb-bronze, #715830);
	--cbc-field: var(--cb-field, #8a7d70);
}

.cb-ico {
	flex: none;
	height: 1.25rem;
	width: 1.25rem;
}

/* Contact links (footer, utility bar) */
.cb-contact-link {
	align-items: center;
	display: inline-flex;
	gap: 0.6rem;
	max-width: 100%;
}

/* A long email address may wrap rather than push the page wider than a small
   phone (320px). It breaks after the "@" first; see cb_email_html(). */
.cb-contact-link span {
	min-width: 0;
	overflow-wrap: anywhere;
}

@media (max-width: 22.49rem) {
	.cb-contact-lines .cb-contact-link {
		font-size: 0.9375rem;
	}

	/* On the narrowest phones the icon moves above the text, so that the text
	   of a contact card has the full width of the card. */
	.cb-option {
		align-items: flex-start;
		flex-direction: column;
		gap: 0.75rem;
	}
}

/* When the top bar sentence is left empty, the links keep the right-hand side. */
@media (min-width: 48rem) {
	.cb-utility__inner > .cb-utility__links:only-child {
		margin-inline-start: auto;
	}
}

.cb-contact-lines {
	display: grid;
	gap: 0.35rem;
	list-style: none;
	margin: 1.25rem 0 0;
	padding: 0;
}

.cb-contact-lines li {
	margin: 0;
}

.cb-contact-lines .cb-contact-link {
	align-items: flex-start;
	color: var(--cbc-ink);
	font-weight: 600;
	min-height: 2.5rem;
	padding-block: 0.4rem;
	text-decoration: none;
}

.cb-contact-lines a.cb-contact-link:hover span {
	text-decoration: underline;
	text-decoration-color: var(--cbc-gold);
}

.cb-contact-lines .cb-contact-link--plain {
	color: var(--cbc-slate);
	font-weight: 400;
}

.cb-contact-lines .cb-ico {
	color: var(--cbc-bronze);
	margin-block-start: 0.2rem;
}

.cb-contact-lines span span {
	overflow-wrap: anywhere;
}

/* Contact options (large tappable choices) */
.cb-options {
	display: grid;
	gap: 1rem;
	grid-template-columns: minmax(0, 1fr);
	margin: 2rem auto 0;
	max-width: 60rem;
	text-align: start;
}

@media (min-width: 40rem) {
	.cb-options--2,
	.cb-options--3,
	.cb-options--4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 40rem) {
	.cb-options--5,
	.cb-options--6 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 62rem) {
	.cb-options--3,
	.cb-options--5,
	.cb-options--6 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.cb-options--4 {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.cb-options--1 {
	max-width: 28rem;
}

.cb-option {
	align-items: center;
	background: #fff;
	border: 1px solid var(--cbc-sand);
	border-radius: 1.25rem;
	color: var(--cbc-ink);
	display: flex;
	gap: 1rem;
	min-height: 5rem;
	padding: 1.1rem 1.35rem;
	text-decoration: none;
	transition: border-color 0.2s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.cb-option:hover {
	border-color: var(--cbc-gold);
	box-shadow: 0 1.5rem 3rem -1.75rem rgba(27, 42, 57, 0.35);
}

@media (prefers-reduced-motion: no-preference) {
	.cb-option:hover {
		transform: translateY(-2px);
	}
}

.cb-option .cb-ico {
	background: var(--cbc-oat);
	border-radius: 999px;
	box-sizing: content-box;
	color: var(--cbc-bronze);
	height: 1.5rem;
	padding: 0.75rem;
	width: 1.5rem;
}

.cb-option__text {
	display: grid;
	gap: 0.1rem;
	min-width: 0;
}

.cb-option__text strong {
	color: var(--cbc-ink);
	font-size: 1.125rem;
	font-weight: 600;
}

.cb-option__text span {
	color: var(--cbc-muted);
	font-size: 1rem;
	overflow-wrap: anywhere;
}

.cb-option--primary {
	background: var(--cbc-navy);
	border-color: var(--cbc-navy);
}

.cb-option--primary .cb-option__text strong {
	color: #fff;
}

.cb-option--primary .cb-option__text span {
	color: #dfe5ea;
}

.cb-option--primary .cb-ico {
	background: rgba(231, 208, 164, 0.18);
	color: var(--cbc-gold-light);
}

.cb-options__fax {
	color: var(--cbc-muted);
	margin-block-start: 1rem;
	text-align: center;
}

.cb-tone-navy .cb-option:not(.cb-option--primary) {
	background: rgba(255, 255, 255, 0.07);
	border-color: rgba(231, 208, 164, 0.35);
}

.cb-tone-navy .cb-option:not(.cb-option--primary) .cb-option__text strong {
	color: #fff;
}

.cb-tone-navy .cb-option:not(.cb-option--primary) .cb-option__text span {
	color: #dfe5ea;
}

.cb-tone-navy .cb-option:not(.cb-option--primary) .cb-ico {
	background: rgba(231, 208, 164, 0.16);
	color: var(--cbc-gold-light);
}

.cb-cta .cb-options {
	margin-block-start: 2.25rem;
}

/* Search panel (0.7.1): an optional ZIP code and a type of care, handed to the
   guided inquiry, which fills in both answers. A plain GET form, so it works
   without JavaScript; nothing is searched and no results are shown. In the home
   hero it hangs under the photo (see the theme's "Home hero" rules). */
.cb-picker {
	background: #fff;
	border: 1px solid var(--cbc-sand);
	border-radius: 1rem;
	box-shadow: 0 1rem 2rem -1.5rem rgba(27, 42, 57, 0.35);
	margin: 0;
	padding: 1rem;
	position: relative;
}

/* The title and the ZIP message share one row: the message replaces the title,
   so showing it moves nothing. */
.cb-picker__head {
	margin: 0 0 0.75rem;
	min-height: 1.5rem;
}

.cb-picker__title {
	color: var(--cbc-ink);
	font-family: var(--cb-serif, Georgia, serif);
	font-size: 1.25rem;
	line-height: 1.2;
	margin: 0;
}

.cb-picker__err {
	align-items: center;
	color: #9b2c2c;
	display: none;
	font-size: 1rem;
	font-weight: 600;
	gap: 0.45rem;
	line-height: 1.5rem;
	margin: 0;
}

/* An icon as well as the colour, so the message never depends on colour alone. */
.cb-picker__err::before {
	background: currentColor;
	content: "";
	flex: none;
	height: 1.125rem;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M12 7v6.5M12 17v.01'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M12 7v6.5M12 17v.01'/%3E%3C/svg%3E") center / contain no-repeat;
	width: 1.125rem;
}

.cb-picker.is-invalid .cb-picker__title {
	display: none;
}

.cb-picker.is-invalid .cb-picker__err {
	display: flex;
}

.cb-picker__fields {
	align-items: end;
	display: grid;
	gap: 0.75rem;
	grid-template-columns: minmax(0, 1fr);
}

.cb-picker__field {
	margin: 0;
	min-width: 0;
}

.cb-picker__field label {
	color: var(--cbc-ink);
	display: block;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.25rem;
	margin: 0 0 0.25rem;
	white-space: nowrap;
}

.cb-picker input.cb-picker__zip,
.cb-picker select {
	-webkit-appearance: none;
	appearance: none;
	background-color: #fff;
	border: 1.5px solid var(--cbc-field);
	border-radius: 0.75rem;
	box-sizing: border-box;
	color: var(--cbc-ink);
	font: inherit;
	font-size: 1.0625rem;
	height: 3.25rem;
	line-height: 1.2;
	margin: 0;
	max-width: none;
	padding: 0 0.875rem;
	width: 100%;
}

.cb-picker input.cb-picker__zip::placeholder {
	color: #5b6670;
	opacity: 1;
}

.cb-picker select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23263749' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6l5 5 5-5'/%3E%3C/svg%3E");
	background-position: right 0.875rem center;
	background-repeat: no-repeat;
	background-size: 1rem;
	cursor: pointer;
	overflow: hidden;
	padding-right: 2.5rem;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cb-picker input.cb-picker__zip:focus-visible,
.cb-picker select:focus-visible {
	border-color: var(--cbc-navy);
	outline: 3px solid var(--cbc-navy);
	outline-offset: 2px;
}

.cb-picker.is-invalid input.cb-picker__zip {
	background-color: #fff8f6;
	border-color: #9b2c2c;
	box-shadow: inset 0 0 0 1px #9b2c2c;
}

/* Without JavaScript (or before it runs) the browser's own check marks a ZIP
   code that is not 5 digits once the visitor leaves the field. With JavaScript
   (the panel then has .is-js) the message waits for the button and is announced
   by the script, so this silent version is not used. */
@supports selector(:user-invalid) {
	.cb-picker:not(.is-js) input.cb-picker__zip:user-invalid {
		background-color: #fff8f6;
		border-color: #9b2c2c;
		box-shadow: inset 0 0 0 1px #9b2c2c;
	}

	.cb-picker:not(.is-js):has(input.cb-picker__zip:user-invalid) .cb-picker__title {
		display: none;
	}

	.cb-picker:not(.is-js):has(input.cb-picker__zip:user-invalid) .cb-picker__err {
		display: flex;
	}
}

button.cb-picker__go {
	-webkit-appearance: none;
	appearance: none;
	background: var(--cbc-navy);
	border: 0;
	border-radius: 999px;
	color: #fff;
	cursor: pointer;
	font: inherit;
	font-size: 1.0625rem;
	font-weight: 600;
	height: 3.5rem;
	line-height: 1.2;
	margin: 0;
	padding: 0 1.5rem;
	transition: background-color 0.2s ease, box-shadow 0.25s ease;
	white-space: nowrap;
	width: 100%;
}

@media (hover: hover) {
	button.cb-picker__go:hover {
		background: var(--cbc-ink);
		box-shadow: 0 0.9rem 1.8rem -1rem rgba(27, 42, 57, 0.6);
	}
}

button.cb-picker__go:focus-visible {
	outline: 3px solid var(--cbc-navy);
	outline-offset: 3px;
}

/* Tablets and small laptops: ZIP code and type of care side by side, the button
   under them across the panel. */
@media (min-width: 40rem) {
	.cb-picker__fields {
		gap: 0.625rem 0.75rem;
		grid-template-columns: 7.75rem minmax(0, 1fr);
	}

	button.cb-picker__go {
		grid-column: 1 / -1;
	}
}

/* Laptops: a slimmer panel, everything in one row from 80rem (1280 px) up
   (below that the list of care types would have to cut its words). */
@media (min-width: 64rem) {
	.cb-picker {
		padding: 0.75rem 1rem;
	}

	.cb-picker__head {
		margin-block-end: 0.375rem;
	}

	.cb-picker input.cb-picker__zip,
	.cb-picker select,
	button.cb-picker__go {
		height: 3rem;
	}
}

@media (min-width: 80rem) {
	.cb-picker__fields {
		gap: 0.625rem;
		grid-template-columns: 7.75rem minmax(0, 1fr) auto;
	}

	button.cb-picker__go {
		grid-column: auto;
		padding: 0 1.125rem;
		width: auto;
	}
}

@media (forced-colors: active) {
	.cb-picker {
		border: 1px solid CanvasText;
	}

	.cb-picker__err::before {
		background: CanvasText;
	}
}

/* Sticky action bar (phones) */
.cb-sticky-cta {
	display: none;
}

@media (max-width: 47.99rem) {
	/* Keyboard focus must never end up behind the bar: when the browser scrolls
	   a focused link into view, it stops this far above the bottom edge. Only
	   pages that have the bar get it. The script after the bar sets the exact
	   height; the fallback is the bar's usual height plus the phone's safe area. */
	html:has(body.cb-has-sticky) {
		scroll-padding-bottom: var(--cb-sticky-h, calc(5rem + env(safe-area-inset-bottom, 0px)));
	}

	.cb-sticky-cta {
		align-items: stretch;
		background: var(--cbc-ivory, #fbf8f2);
		border-top: 1px solid var(--cbc-sand);
		bottom: 0;
		box-shadow: 0 -0.75rem 2rem -1.25rem rgba(27, 42, 57, 0.45);
		display: flex;
		gap: 0.5rem;
		inset-inline: 0;
		padding: 0.6rem 0.75rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
		position: fixed;
		z-index: 80;
	}

	/* Tucked away while the page header's own button is on screen, so the same
	   button is never shown twice. Hidden from keyboard and screen readers too. */
	/* The distance also covers the close control, which sits above the bar. */
	.cb-sticky-cta.is-tucked {
		transform: translateY(calc(110% + 3rem));
		visibility: hidden;
	}

	@media (prefers-reduced-motion: no-preference) {
		.cb-sticky-cta {
			transition: transform 0.25s ease, visibility 0s linear 0s;
		}

		.cb-sticky-cta.is-tucked {
			transition: transform 0.25s ease, visibility 0s linear 0.25s;
		}
	}

	.cb-sticky-cta__main {
		align-items: center;
		background: var(--cbc-navy);
		border-radius: 999px;
		color: #fff;
		display: flex;
		flex: 1 1 auto;
		font-weight: 600;
		justify-content: center;
		min-height: 3rem;
		padding: 0.5rem 1rem;
		text-align: center;
		text-decoration: none;
	}

	.cb-sticky-cta__icon {
		align-items: center;
		background: #fff;
		border: 1.5px solid var(--cbc-sand);
		border-radius: 999px;
		color: var(--cbc-ink);
		display: flex;
		flex: none;
		flex-direction: column;
		font-size: 0.8125rem;
		font-weight: 600;
		gap: 0.1rem;
		justify-content: center;
		line-height: 1;
		min-height: 3rem;
		min-width: 3.5rem;
		padding: 0.25rem 0.6rem;
		text-decoration: none;
	}

	.cb-sticky-cta__icon .cb-ico {
		color: var(--cbc-bronze);
		height: 1.15rem;
		width: 1.15rem;
	}

	/* The small "x" that hides the bar for the rest of the visit. It sits just
	   above the right end of the bar, so it takes no room from the buttons and
	   the bar stays one row on the narrowest phones. The touch area is 44px;
	   the visible disc is smaller. It moves away with the bar when the bar is
	   tucked, and stays hidden (the hidden attribute) until its script has run. */
	.cb-sticky-cta__close {
		-webkit-appearance: none;
		appearance: none;
		align-items: center;
		background: transparent;
		border: 0;
		bottom: 100%;
		color: var(--cbc-ink);
		cursor: pointer;
		display: flex;
		height: 2.75rem;
		inset-inline-end: 0.25rem;
		justify-content: center;
		margin: 0;
		padding: 0;
		position: absolute;
		width: 2.75rem;
	}

	.cb-sticky-cta__close::before {
		background: var(--cbc-ivory, #fbf8f2);
		border: 1px solid var(--cbc-sand);
		border-radius: 999px;
		box-shadow: 0 0.25rem 0.75rem -0.25rem rgba(27, 42, 57, 0.45);
		content: "";
		height: 2rem;
		inset: 0;
		margin: auto;
		position: absolute;
		width: 2rem;
	}

	.cb-sticky-cta__close[hidden] {
		display: none;
	}

	.cb-sticky-cta__close .cb-ico {
		height: 1rem;
		position: relative;
		width: 1rem;
	}

	.cb-sticky-cta__close:focus-visible {
		outline: 0;
	}

	.cb-sticky-cta__close:focus-visible::before {
		outline: 3px solid var(--cbc-navy);
		outline-offset: 2px;
	}
}

@media print {
	.cb-sticky-cta,
	.cb-review-notes {
		display: none !important;
	}
}

/* Editor-only helpers (never rendered for the public) */
.cb-gated {
	outline: 2px dashed var(--cbc-bronze);
	outline-offset: -2px;
	position: relative;
}

.cb-gated__label {
	background: var(--cbc-bronze);
	color: #fff;
	font-size: 0.8125rem;
	font-weight: 600;
	margin: 0;
	padding: 0.35rem 0.9rem;
	text-align: center;
}

.cb-review-notes {
	background: #fff;
	border: 1px solid var(--cbc-bronze);
	border-radius: 0.75rem;
	bottom: 5.5rem;
	box-shadow: 0 1.5rem 3rem -1.5rem rgba(27, 42, 57, 0.5);
	color: var(--cbc-ink);
	font-size: 0.9375rem;
	inset-inline-start: 1rem;
	max-height: 60vh;
	max-width: min(26rem, calc(100vw - 2rem));
	overflow: auto;
	position: fixed;
	z-index: 85;
}

.cb-review-notes summary {
	background: var(--cbc-bronze);
	border-radius: 0.65rem;
	color: #fff;
	cursor: pointer;
	font-size: 0.8125rem;
	font-weight: 600;
	padding: 0.4rem 0.85rem;
}

/* Closed, it is a small pill at the bottom edge (editors only), so it does not
   sit over the page's words or buttons. Laptops have no phone action bar, so it
   can go right down to the edge there. */
.cb-review-notes:not([open]) {
	background: transparent;
	border: 0;
	box-shadow: none;
	opacity: 0.92;
}

@media (min-width: 48rem) {
	.cb-review-notes {
		bottom: 1rem;
	}
}

.cb-review-notes[open] summary {
	border-radius: 0.65rem 0.65rem 0 0;
}

.cb-review-notes ol {
	margin: 0;
	padding: 0.75rem 1rem 1rem 2.25rem;
}

.cb-review-notes li + li {
	margin-block-start: 0.5rem;
}

.cb-review-notes__hint {
	color: var(--cbc-muted);
	font-size: 0.8125rem;
	margin: 0.6rem 1rem 0;
}

/* "Print this checklist" on guides */
/* Padding, not margin: the page layout resets the margins of its direct children. */
.cb-print {
	margin: 0 auto;
	padding-block-start: 2rem;
	text-align: center;
}

.cb-print__btn {
	-webkit-appearance: none;
	appearance: none;
	align-items: center;
	background: #fff;
	border: 1.5px solid var(--cbc-navy);
	border-radius: 999px;
	color: var(--cbc-navy);
	cursor: pointer;
	display: inline-flex;
	font: inherit;
	font-weight: 600;
	gap: 0.6rem;
	min-height: 3rem;
	padding: 0.55rem 1.4rem;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.cb-print__btn:hover {
	background: var(--cbc-navy);
	color: #fff;
}

.cb-print__btn:focus-visible {
	outline: 3px solid var(--cbc-navy);
	outline-offset: 3px;
}

@media print {
	.cb-print,
	.cb-sticky-cta {
		display: none !important;
	}
}

/* Demo 1 and Demo 2 keep the theme's top bar. With the phone number in it (0.8.0) the area sentence no longer fits
   beside the links below laptop width, so it gives way there instead of wrapping into the bar's clipped second line. */
@media (max-width: 63.99rem) {
	.cb-utility__area {
		display: none;
	}
}
