/**
 * The Aisle cookie choice bar. Single stylesheet for theaisle-privacy.
 *
 * Not a wall: the page stays usable and readable while it shows. On phones and
 * tablets (< 768px) it is a strip across the bottom of the screen; on desktop
 * it is a small card in the bottom-left corner, clear of the page's centre
 * and of the toasts in the bottom-right corner. Both choices are full-size
 * buttons, so "Only essential" is as easy as "Accept". Tokens from the
 * design-tokens mu-plugin, read with their values as fallbacks (DESIGN.md).
 *
 * A Plum surface: white text 15.6:1, the Aisle Teal link 8.7:1, the red
 * Accept button's edge 3.6:1 against it (WCAG 1.4.11; Deep Teal would give
 * 2.5:1). On this dark surface the secondary button is inverted (white
 * outline) and the focus ring is white, because the usual Deep Teal ring
 * would vanish on Plum.
 *
 * Motif: a faint outline of the logo's "a" (assets/img/aisle-a-outline.png,
 * shipped with the plugin, fetched only when the bar shows). On the desktop
 * card it fills the card; on the strip it peeks in from the right edge.
 *
 * Specificity: the bar sits on pages styled by the parent theme
 * (`p{font-size:14px}`, `button:focus{outline:none}`, `a:hover{color}`) and by
 * Elementor's site kit (`.elementor-kit-N button`, `…:hover`, `… p`, `… a`).
 * Every rule here is therefore scoped `.theaisle-cookies <element>.<class>`
 * (0,2,1; states 0,3,1) and sets each property those rules touch, so the bar
 * looks the same on every page without `!important`.
 *
 * Stacking: 99990 sits below everything that must stay usable over it: the
 * onboarding report modal (100000), confirm dialogs and toasts (100001+), and
 * the WhatsApp gate notice (99999). While the bar is open, cookies.js sets
 * `html.theaisle-cookies-open` and `--theaisle-cookies-space` (the bar's
 * height + gap); the rules at the end of this file use them to keep focused
 * elements and other bottom pop-ups clear of the bar.
 */

.theaisle-cookies {
	position: fixed;
	right: 16px;
	/* Clear the iPhone home indicator and Safari's floating toolbar. */
	bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	left: 16px;
	z-index: 99990;
	box-sizing: border-box;
	max-width: 760px;
	margin: 0 auto;
	padding: 16px 20px;
	background-color: var(--theaisle-plum, #470B25);
	background-image: url(../img/aisle-a-outline.png);
	background-repeat: no-repeat;
	background-size: auto 190%;
	background-position: right -24px center;
	color: #FFFFFF;
	border-radius: var(--theaisle-radius-card, 12px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	font-family: Lato, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	text-align: left;
}

.theaisle-cookies[hidden] {
	display: none;
}

.theaisle-cookies div.theaisle-cookies__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 20px;
}

/* Text and status: every property the theme's and Elementor's `p` rules set. */
.theaisle-cookies p.theaisle-cookies__text,
.theaisle-cookies p.theaisle-cookies__status {
	margin: 0;
	padding: 0;
	color: #FFFFFF;
	font-family: inherit;
	font-size: 15px;
	font-weight: 400;
	line-height: 1.5;
	letter-spacing: normal;
	text-transform: none;
	text-align: left;
}

.theaisle-cookies p.theaisle-cookies__text {
	flex: 1 1 320px;
}

.theaisle-cookies p.theaisle-cookies__status {
	flex: 1 1 100%;
	order: -1;
	font-size: 14px;
}

.theaisle-cookies p.theaisle-cookies__status[hidden],
.theaisle-cookies .theaisle-cookies__status-text[hidden] {
	display: none;
}

.theaisle-cookies a.theaisle-cookies__link,
.theaisle-cookies a.theaisle-cookies__link:visited,
.theaisle-cookies a.theaisle-cookies__link:focus,
.theaisle-cookies a.theaisle-cookies__link:active {
	color: var(--theaisle-teal, #5DD4BE); /* 8.7:1 on Plum */
	font: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
	white-space: nowrap;
}

.theaisle-cookies div.theaisle-cookies__actions {
	display: flex;
	flex: 0 1 auto;
	flex-wrap: wrap;
	gap: 8px;
	min-width: 0;
}

/* Buttons: every property the theme's and Elementor's `button` rules set. */
.theaisle-cookies button.theaisle-cookies__btn {
	box-sizing: border-box;
	min-height: var(--theaisle-button-min-height, 44px);
	height: auto;
	margin: 0;
	padding: 0 18px;
	border: 0;
	border-radius: var(--theaisle-radius-button, 10px);
	font-family: inherit;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	text-align: center;
	text-decoration: none;
	white-space: normal;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.theaisle-cookies button.theaisle-cookies__btn:focus {
	outline: none;
}

.theaisle-cookies button.theaisle-cookies__btn:focus-visible,
.theaisle-cookies a.theaisle-cookies__link:focus-visible {
	outline: 2px solid #FFFFFF; /* dark surface: the Deep Teal ring would vanish */
	outline-offset: 2px;
}

.theaisle-cookies button.theaisle-cookies__btn--primary,
.theaisle-cookies button.theaisle-cookies__btn--primary:focus {
	background: var(--theaisle-red, #ED1C24);
	color: var(--theaisle-on-red, #FFFFFF);
	box-shadow: none;
}

.theaisle-cookies button.theaisle-cookies__btn--primary:active {
	background: var(--theaisle-red-hover, #c41620);
	color: var(--theaisle-on-red, #FFFFFF);
}

.theaisle-cookies button.theaisle-cookies__btn--secondary,
.theaisle-cookies button.theaisle-cookies__btn--secondary:focus {
	background: transparent;
	color: #FFFFFF;
	box-shadow: inset 0 0 0 2px #FFFFFF;
}

.theaisle-cookies button.theaisle-cookies__btn--secondary:active {
	background: #FFFFFF;
	color: var(--theaisle-plum, #470B25);
}

/* Hover only where there is a real pointer: on touch screens a tapped button
   would otherwise keep its hover colour until the next tap elsewhere. */
@media (hover: hover) {
	.theaisle-cookies button.theaisle-cookies__btn--primary:hover {
		background: var(--theaisle-red-hover, #c41620);
		color: var(--theaisle-on-red, #FFFFFF);
	}

	.theaisle-cookies button.theaisle-cookies__btn--secondary:hover {
		background: #FFFFFF;
		color: var(--theaisle-plum, #470B25);
	}

	.theaisle-cookies a.theaisle-cookies__link:hover {
		color: var(--theaisle-teal, #5DD4BE);
		text-decoration: none;
	}
}

/* Keyboard focus reached content the bar would hide at the end of the page
   (cookies.js): the bar moves to the top of the screen instead of the page
   moving, below the WordPress admin bar when there is one. */
.theaisle-cookies.is-top {
	top: calc(16px + var(--wp-admin--admin-bar--height, 0px) + env(safe-area-inset-top, 0px));
	bottom: auto;
}

@media (max-width: 600px) {
	.theaisle-cookies {
		right: 12px;
		bottom: calc(12px + env(safe-area-inset-bottom, 0px));
		left: 12px;
		padding: 14px 16px;
		font-size: 14px;
	}

	.theaisle-cookies p.theaisle-cookies__text {
		font-size: 14px;
	}

	.theaisle-cookies.is-top {
		top: calc(12px + var(--wp-admin--admin-bar--height, 0px) + env(safe-area-inset-top, 0px));
		bottom: auto;
	}

	.theaisle-cookies div.theaisle-cookies__actions {
		flex: 1 1 100%;
	}

	.theaisle-cookies button.theaisle-cookies__btn {
		flex: 1 1 auto;
	}
}

/* Desktop: a small card in the bottom-left corner. Text on top, the two
   choices stacked below it at full width, so both stay equally easy. */
@media (min-width: 768px) {
	.theaisle-cookies {
		right: auto;
		bottom: calc(24px + env(safe-area-inset-bottom, 0px));
		left: calc(24px + env(safe-area-inset-left, 0px));
		width: 320px;
		max-width: calc(100vw - 48px);
		/* A short window with enlarged text: scroll inside, never off-screen. */
		max-height: calc(100vh - 48px);
		overflow-y: auto;
		margin: 0;
		padding: 20px;
		background-size: 115% auto;
		background-position: 55px -51px;
	}

	.theaisle-cookies.is-top {
		top: calc(24px + var(--wp-admin--admin-bar--height, 0px) + env(safe-area-inset-top, 0px));
		bottom: auto;
		max-height: calc(100vh - 48px - var(--wp-admin--admin-bar--height, 0px));
	}

	.theaisle-cookies div.theaisle-cookies__inner {
		flex-direction: column;
		flex-wrap: nowrap;
		align-items: stretch;
		gap: 16px;
	}

	.theaisle-cookies p.theaisle-cookies__text,
	.theaisle-cookies p.theaisle-cookies__status,
	.theaisle-cookies div.theaisle-cookies__actions {
		flex: none;
	}

	.theaisle-cookies div.theaisle-cookies__actions {
		flex-direction: column;
		flex-wrap: nowrap;
	}

	.theaisle-cookies button.theaisle-cookies__btn {
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.theaisle-cookies button.theaisle-cookies__btn {
		transition: none;
	}
}

/* Windows high-contrast mode: system colours only, no decoration. */
@media (forced-colors: active) {
	.theaisle-cookies {
		background-image: none;
	}
}

/* Never printed over the page. */
@media print {
	.theaisle-cookies {
		display: none !important;
	}
}

/* ── While the bar is open ───────────────────────────────────────────────
   The bar floats over the page and never changes its layout: nothing here
   adds height, padding or margin to the page (a 100vh hero stays 100vh).
   --theaisle-cookies-space is the bar's height plus its gap, kept current by
   cookies.js. scroll-padding (no layout effect) keeps keyboard focus clear
   of the bar wherever the page can still scroll; near the very end of a page,
   cookies.js moves the bar to the top instead (.is-top). The site's other
   fixed bottom pop-ups move up so the bar never covers them: on phones and
   tablets all of them (and Find a Vendor's Map/List tabs and compare bar);
   on desktop only the checklist's centred toast, since the theme toasts and
   the WhatsApp gate notice sit bottom-right and Find a Vendor's "List view"
   button sits inside the map, all away from the bottom-left card. */
html.theaisle-cookies-open {
	scroll-padding-bottom: var(--theaisle-cookies-space, 0px);
}

@media (max-width: 767px) {
	html.theaisle-cookies-open .theaisle-toasts {
		bottom: calc(24px + env(safe-area-inset-bottom, 0px) + var(--theaisle-cookies-space, 0px));
	}

	html.theaisle-cookies-open .theaisle-held,
	html.theaisle-cookies-open .theaisle-gate-toast {
		bottom: calc(16px + var(--theaisle-cookies-space, 0px));
	}

	/* Find a Vendor on phones: the Map/List tabs and the compare bar are
	   fixed to the bottom edge (parent theme). */
	html.theaisle-cookies-open .explore-mobile-nav,
	html.theaisle-cookies-open .compare-bar {
		bottom: var(--theaisle-cookies-space, 0px);
	}
}

html.theaisle-cookies-open .ac-toast-host {
	bottom: calc(max(1rem, env(safe-area-inset-bottom)) + var(--theaisle-cookies-space, 0px));
}
