/*
 * Cookie consent bar — slim bar pinned to the bottom of the screen.
 *
 * Owner report (17 Sep 2026): on a phone the Complianz banner opened as a tall
 * centred card that covered the hero headline — 367px of a 844px screen, 43%.
 *
 * Two causes, both fixed:
 *
 *  1. Plugin side. No row existed in wp_cmplz_cookiebanners, so Complianz fell
 *     back to cookiebanner/css/defaults/banner-optout.css — the centred layout,
 *     with all four consent categories listed and the long default message.
 *     A real banner row now exists (position "bottom", categories "no", soft
 *     cookie wall off, short message) and Complianz generates
 *     uploads/complianz/css/banner-1-optout.css from it.
 *
 *  2. Theme side. 97-fix-31-cookie-gallery.css deliberately re-anchored the
 *     banner with `top: 96px; left: 50%; transform: translateX(-50%)` to clear
 *     the sticky Continue button on /book/. That rule outranks the plugin's own
 *     bottom placement, so the card stayed mid-screen whatever the plugin said.
 *
 * This file must load AFTER 97 to win — same specificity (#id .class), later in
 * filename order, and functions.php enqueues assets/css/overhaul/*.css in
 * filename order. Hence 98-, not 14-. Do not renumber it below 97.
 *
 * The /book/ sticky action that 97 was avoiding is cleared a different way: the
 * bar is short enough, and page content is not covered because the bar sits in
 * the last ~150px of the viewport rather than across the middle of it.
 */

/* ---------- 1. Size tokens: smaller than 97's, container-scoped ---------- */

#cmplz-cookiebanner-container {
	--cmplz_text_font_size: 13.5px;
	--cmplz_link_font_size: 12.5px;
	--cmplz_button_font_size: 14px;
	--cmplz_banner_margin: 8px;
	--cmplz_banner_border_radius: 0px;
}

/* ---------- 2. Pin to the bottom edge, full width, capped height ---------- */

#cmplz-cookiebanner-container .cmplz-cookiebanner {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	top: auto;
	transform: none;
	margin: 0;
	width: 100%;
	max-width: 100%;
	/* Hard ceiling: the bar can never take more than a fifth of the screen. */
	max-height: 20vh;
	overflow-y: auto;
	border-radius: 0;
	border-style: solid;
	border-width: 1px 0 0 0;
	border-color: var(--rule);
	box-shadow: 0 -6px 20px rgba(20, 32, 27, .16);

	/* One flex row: message, then buttons, then the document links. The
	   plugin's grid put the buttons on their own row at every width. */
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-start;
	gap: 8px 18px;
	padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
	grid-gap: 8px 18px;
}

/*
 * Setting `display: flex` above outranks the plugin's own
 * `.cmplz-cookiebanner.cmplz-dismissed { display: none }` (0,2,0 against our
 * 1,1,0), which would leave the bar on screen after Accept or Only necessary.
 * Restate both hide rules at ID specificity so dismissal still wins.
 */
#cmplz-cookiebanner-container .cmplz-cookiebanner.cmplz-dismissed,
#cmplz-cookiebanner-container .cmplz-cookiebanner.cmplz-hidden {
	display: none;
}

/* The header row (logo, title, close) is already emptied by the plugin's
   generated CSS; drop the box itself so it cannot add height. */
#cmplz-cookiebanner-container .cmplz-header,
#cmplz-cookiebanner-container .cmplz-divider {
	display: none;
}

/* ---------- 3. Message: two short lines, no scroll box ---------- */

#cmplz-cookiebanner-container .cmplz-body {
	flex: 1 1 280px;
	min-width: 0;
	max-height: none;
	overflow: visible;
	grid-column: auto;
}

#cmplz-cookiebanner-container .cmplz-message {
	margin: 0;
	margin-right: 0;
	font-size: var(--cmplz_text_font_size);
	line-height: 1.45;
	grid-column: auto;
}

/* ---------- 4. Buttons: Accept + Only necessary, side by side ---------- */

#cmplz-cookiebanner-container .cmplz-buttons {
	flex: 0 0 auto;
	display: flex;
	flex-direction: row;
	gap: 8px;
	grid-column: auto;
	grid-row: auto;
	margin: 0;
}

#cmplz-cookiebanner-container .cmplz-buttons .cmplz-btn {
	width: auto;
	min-width: 0;
	min-height: 38px;
	padding: 8px 18px;
	font-size: var(--cmplz_button_font_size);
	line-height: 1.2;
	border-radius: 0;
	white-space: nowrap;
}

/*
 * Bring back the decline button.
 *
 * Complianz's optout.css hides `.cmplz-deny` because in an opt-out region its
 * model is "everything is on, opt out later on the policy page". The owner
 * asked for a one-click decline on the bar itself, which is strictly more
 * protective than the plugin's default and is the CCPA opt-out in one tap.
 * The click handler is not consent-type specific — cookiebanner/js/complianz.js
 * binds `.cmplz-deny` to cmplz_set_banner_status('dismissed') + cmplz_deny_all()
 * for every banner type — so showing the button is all that is needed.
 */
#cmplz-cookiebanner-container .cmplz-buttons .cmplz-btn.cmplz-deny {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/* ---------- 5. Policy links ---------- */

#cmplz-cookiebanner-container .cmplz-links.cmplz-documents {
	flex: 0 0 auto;
	justify-content: flex-start;
	grid-column: auto;
	grid-row: auto;
	margin: 0;
}

#cmplz-cookiebanner-container .cmplz-links ul {
	justify-content: flex-start;
	gap: 14px;
}

#cmplz-cookiebanner-container .cmplz-links .cmplz-link {
	font-size: var(--cmplz_link_font_size);
}

/* ---------- 6. Phone ---------- */

@media (max-width: 767px) {
	#cmplz-cookiebanner-container .cmplz-cookiebanner {
		max-height: 32vh;
		padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
		gap: 8px 12px;
		grid-gap: 8px 12px;
	}

	#cmplz-cookiebanner-container .cmplz-body {
		flex: 1 1 100%;
	}

	/* Plugin stacks the buttons vertically under 768px; keep them on one row
	   so the bar stays two lines of text plus one row of controls. */
	#cmplz-cookiebanner-container .cmplz-buttons {
		flex: 1 1 auto;
		flex-direction: row;
	}

	#cmplz-cookiebanner-container .cmplz-buttons .cmplz-btn {
		flex: 1 1 auto;
		min-height: 40px;
		padding: 8px 10px;
	}

	#cmplz-cookiebanner-container .cmplz-links.cmplz-documents {
		flex: 0 0 auto;
	}

	#cmplz-cookiebanner-container .cmplz-links ul {
		justify-content: flex-start;
		gap: 12px;
	}
}

/* Very short viewports (landscape phone): the plugin zooms the whole banner;
   keep it bottom-pinned and out of the way instead of full height. */
@media (max-height: 400px) {
	#cmplz-cookiebanner-container .cmplz-cookiebanner {
		height: auto;
		max-height: 45vh;
		zoom: 1;
		padding: 8px 14px;
	}
}

/* ---------- 7. The reopen pill ---------- */

/* Complianz hides it under 768px itself; on desktop keep it clear of the bar. */
#cmplz-manage-consent .cmplz-manage-consent {
	z-index: 9997;
}
