/* Consultation reference: template-parts/consult-form.php renders the fields while the
   shared lead handler validates and stores them. Tokens are defined in docs/design.md. */

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

/* -- floating toggle -- */

.onsil-consult__toggle {
	position: fixed;
	right: 50px;
	bottom: 40px;
	z-index: 900;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 0;
	border: 0;
	background-color: transparent;
	color: var(--c-ink);
	font-family: var(--f-ui), var(--f-body), sans-serif;
	font-weight: 400;
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
	transition: opacity 200ms ease;
}

.onsil-consult__toggle-label {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 235px;
	height: 40px;
	border-radius: var(--r-pill);
	background-color: #fff;
}

.onsil-consult__toggle-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 50px;
	width: 50px;
	height: 50px;
	border-radius: var(--r-pill);
	background-color: var(--c-btn);
	box-shadow: 0 2px 5px rgba(0, 0, 0, .1);
}

.onsil-consult__toggle:focus-visible {
	outline: 2px solid var(--c-btn);
	outline-offset: 4px;
	border-radius: var(--r-pill);
}

body.onsil-consult-open .onsil-consult__toggle {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

@media (hover: hover) {
	.onsil-consult__toggle:hover {
		opacity: .85;
	}
}

/* -- sticky bar -- */

.onsil-consult {
	--consult-bg: #816c59;
	--consult-field: #fff;
	--consult-submit: #000;
	position: fixed;
	left: 0;
	bottom: 0;
	z-index: 9000; /* fix-15 (audit LOW #15): consult-bar.md's "Sticky Lead Form Bar" table specs
	   9000, not 900 — the bar must sit above the popup modal (1000) and header (950) when open. */
	width: 100%;
	min-height: 93px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px 56px;
	background-color: var(--consult-bg);
	box-sizing: border-box;
}

@keyframes onsil-consult-enter {
	from {
		opacity: 0;
		transform: translateY(32px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.onsil-consult:not([hidden]) {
	animation: onsil-consult-enter 450ms cubic-bezier(.16, 1, .3, 1) both;
}

/* Exit mirrors the enter: same distance, duration and easing. consult.js sets
   [hidden] on animationend. */
@keyframes onsil-consult-exit {
	from {
		opacity: 1;
		transform: translateY(0);
	}
	to {
		opacity: 0;
		transform: translateY(32px);
	}
}

.onsil-consult.is-closing {
	animation: onsil-consult-exit 450ms cubic-bezier(.16, 1, .3, 1) both;
	pointer-events: none;
}

.onsil-consult__inner {
	display: flex;
	align-items: center;
	gap: 56px;
	width: 100%;
	max-width: 1344px;
}

.onsil-consult[hidden] {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	.onsil-consult:not([hidden]),
	.onsil-consult.is-closing {
		animation-duration: .01ms;
	}
}

/* No-JS fallback: a direct link to #consult (the CTA band's .onsil-pill, or a shared URL)
   still reveals the bar via :target, so the underlying <form> stays reachable without JS. */
html.no-js .onsil-consult:target {
	display: flex !important;
}

@media (min-width: 769px) {
	body.onsil-consult-open {
		padding-bottom: var(--onsil-consult-height, 93px);
	}
}

.onsil-consult__info {
	flex: 0 0 200px;
	text-align: left;
}

.onsil-consult__title {
	margin: 0;
	color: var(--c-on-dark);
	font-family: var(--f-ui), sans-serif;
	/* fix-16 (audit LOW #16): no 700 Pretendard face is self-hosted (fonts.css carries 400/500/600
	   only), so the browser was synthesising a faux-bold. Dropped to 600 — already hosted, and
	   matches the floating toggle button's own title weight (.onsil-consult__toggle, also 600) for
	   visual consistency — rather than adding a new woff2 for one 15px sticky-bar label. */
	font-weight: 600;
	font-size: 18px;
	line-height: 1.3;
}

.onsil-consult__sub {
	margin: 6px 0 0;
	color: var(--c-on-dark);
	font-size: 13px;
	line-height: 1.3;
	opacity: .85;
}

.onsil-consult__form {
	flex: 1 1 auto;
	min-width: 0;
}

/* -- post-submit feedback (final-review I4) -- */

.onsil-consult__feedback {
	flex: 0 1 auto;
	min-width: 0;
	text-align: center;
}

.onsil-consult__feedback[hidden] {
	display: none;
}

.onsil-consult__feedback-msg {
	margin: 0;
	color: var(--c-on-dark);
	font-family: var(--f-ui), var(--f-body), sans-serif;
	font-size: 14px;
	line-height: 1.5;
}

.onsil-consult__feedback-msg--error {
	color: #f2c9c2;
}

.onsil-consult__form .lead-form--db {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 170px)) minmax(110px, 1fr) 100px;
	align-items: center;
	gap: 10px;
}

.onsil-consult__form .lead-form--db p {
	margin: 0;
	display: flex;
	align-items: center;
}

.onsil-consult__form label {
	display: inline-flex;
	min-width: 0;
	align-items: center;
	gap: 6px;
	color: var(--c-on-dark);
	font-family: var(--f-ui), var(--f-body), sans-serif;
	font-size: 13px;
	white-space: nowrap;
}

/* Native controls keep their accessible labels; the screenshot's white pills are 44px tall. */
.onsil-consult__form input[type="text"],
.onsil-consult__form input[type="tel"],
.onsil-consult__form select {
	width: 100%;
	min-width: 0;
	height: 44px;
	padding: 0 18px;
	border: 0;
	border-radius: var(--r-pill);
	background-color: var(--consult-field);
	color: var(--c-ink);
	font-family: var(--f-ui), var(--f-body), sans-serif;
	font-size: 14px;
	box-sizing: border-box;
}

.onsil-consult-fields__field {
	width: 100%;
}

.onsil-consult__form select {
	appearance: none;
	color: #767676;
}

.onsil-consult__form input::placeholder,
.onsil-consult__form select:invalid {
	color: #767676;
}

.onsil-consult-fields__privacy {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 6px;
}

/* consent checkboxes — boot-base's own literal labels, sized down only */
.onsil-consult__form input[type="checkbox"] {
	flex: 0 0 auto;
	width: 14px;
	height: 14px;
	margin: 0;
	accent-color: var(--c-ink);
}

.onsil-consult__form button[type="submit"] {
	height: 44px;
	padding: 10px 24px;
	border: 0;
	border-radius: var(--r-pill);
	background-color: var(--consult-submit);
	color: #fff;
	font-family: var(--f-ui), sans-serif;
	font-weight: 600;
	font-size: 14px;
	white-space: nowrap;
	cursor: pointer;
	transition: opacity 200ms ease;
}

@media (hover: hover) {
	.onsil-consult__form button[type="submit"]:hover {
		opacity: .85;
	}
}

.onsil-consult__form .onsil-consult__privacy {
	color: var(--c-on-dark);
	font-size: 12px;
	text-decoration: underline;
	white-space: nowrap;
}

@media (min-width: 769px) and (max-width: 1200px) {
	.onsil-consult {
		padding-inline: 48px;
	}
	.onsil-consult__inner {
		gap: 24px;
	}
	.onsil-consult__info {
		flex-basis: 172px;
	}
	.onsil-consult__form .lead-form--db {
		grid-template-columns: repeat(4, minmax(0, 1fr)) auto 90px;
		gap: 8px;
	}
	.onsil-consult__form input[type="text"],
	.onsil-consult__form input[type="tel"],
	.onsil-consult__form select {
		padding-inline: 12px;
	}
}

@media (min-width: 769px) and (max-width: 980px) {
	.onsil-consult__inner {
		flex-direction: column;
		align-items: stretch;
		gap: 12px;
	}
	.onsil-consult__info {
		flex-basis: auto;
	}
}

@media (hover: hover) {
	.onsil-consult__privacy:hover {
		opacity: .85;
	}
}

/* -- mobile: bottom sheet, stacked fields, 80vh max -- */

@media (max-width: 768px) {
	.onsil-consult__toggle {
		right: 16px;
		bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	}

	.onsil-consult {
		flex-direction: column;
		align-items: stretch;
		height: auto;
		max-height: 80vh;
		overflow-y: auto;
		padding: 20px 16px;
		gap: 14px;
	}

	.onsil-consult__inner {
		flex-direction: column;
		align-items: stretch;
		gap: 14px;
	}
	.onsil-consult__info {
		flex-basis: auto;
		text-align: center;
	}

	.onsil-consult__form .lead-form--db {
		display: flex;
		flex-direction: column;
		align-items: stretch;
	}

	.onsil-consult__form .lead-form--db p {
		width: 100%;
		justify-content: center;
		flex-wrap: wrap;
		text-align: center;
	}

	.onsil-consult__form label {
		width: 100%;
		justify-content: center;
		white-space: normal;
		text-align: center;
	}

	.onsil-consult__form br {
		display: none;
	}

	.onsil-consult__form input[type="text"],
	.onsil-consult__form input[type="tel"],
	.onsil-consult__form select {
		width: 100%;
	}

	.onsil-consult-fields__privacy {
		justify-content: flex-end;
	}
	.onsil-consult-fields__privacy label {
		width: auto;
	}

	.onsil-consult__form button[type="submit"] {
		width: 100%;
	}

}
