/*
 * Cookie banner + the footer's "Cookie settings" button.
 * Markup: template-parts/cookie-banner.php · behaviour: assets/js/cookie-banner.js.
 * A full-width strip at the bottom, white at 80%. Phones: compact, stacked.
 * Tablet and up: text on the start side, buttons in one row on the end side.
 * While it shows, the accessibility button and panel move up above it
 * (--consent-h, set by the script).
 */

.consent {
	display: none;
	position: fixed;
	z-index: 999; /* under the accessibility button + panel (1000 / 1001) */
	inset-inline: 0;
	inset-block-end: 0;
	max-height: 100vh;
	max-height: 100dvh;
	overflow-y: auto;
	padding: 20px var(--page-pad-x);
	border-block-start: 1px solid var(--c-line-strong);
	/* White at 80%; the page behind is blurred, so text stays readable over photos. */
	background: color-mix(in srgb, var(--c-white) 80%, transparent);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	color: var(--c-text);
	box-shadow: 0 -6px 24px color-mix(in srgb, var(--c-footer-bg) 12%, transparent);
	font-size: var(--fs-body);
	line-height: 1.6;
}

html[data-consent="unset"] .consent,
.consent.is-open {
	display: block;
}

.consent__title {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 8px;
	padding-inline-end: 40px; /* room for the close button */
	font-size: var(--fs-h3);
	font-weight: var(--fw-bold);
	line-height: 1.3;
}

.consent__icon {
	flex: none;
	color: var(--c-accent);
}

.consent__title:focus {
	outline: none; /* focused only by script, to start reading here */
}

.consent__close {
	position: absolute;
	inset-block-start: 12px;
	inset-inline-end: 12px;
	display: flex;
	padding: 8px;
	border: 0;
	background: none;
	color: var(--c-text);
	cursor: pointer;
}

.consent__close[hidden] {
	display: none;
}

.consent__text {
	margin: 0;
	color: var(--c-body);
}

.consent__text a {
	white-space: nowrap; /* each link's words stay on one line */
	color: var(--c-text);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.consent__text a:hover {
	color: var(--c-accent-text);
}

/* ---- Choices ---- */

.consent__choices {
	margin: 16px 0 0;
	padding: 0;
	border: 0;
}

.consent__choices[hidden] {
	display: none;
}

.consent__legend {
	margin-block-end: 8px;
	padding: 0;
	font-weight: var(--fw-semibold);
}

.consent__option {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 2px 12px;
	align-items: center;
	padding: 12px 0;
	border-block-start: 1px solid var(--c-line);
}

.consent__option input {
	width: 22px;
	height: 22px;
	margin: 0;
	accent-color: var(--c-text);
	cursor: pointer;
}

.consent__option label {
	font-weight: var(--fw-semibold);
	cursor: pointer;
}

.consent__desc {
	grid-column: 2;
	margin: 0;
	font-size: var(--fs-small);
	color: var(--c-body);
}

/* ---- Buttons: "Accept all" and "Reject all" look the same (equally easy) ---- */

.consent__actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	margin-block-start: 16px;
}

.consent__actions .button {
	padding: 13px 12px;
}

.consent__actions .button[hidden] {
	display: none;
}

.consent__actions .button--outline {
	grid-column: 1 / -1;
}


/* "Customize" next to the privacy policy link, as part of the text — phones
   only (bigger screens have the button in the row). Click again to fold the
   choices; aria-expanded tells screen readers. */
.consent__customize {
	display: inline;
	margin-inline-start: 8px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--c-text);
	font: inherit;
	white-space: nowrap;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.consent__customize:hover {
	color: var(--c-accent-text);
}

/* The accessibility button and panel sit above the banner while it shows. */
html[data-consent="unset"] .a11y__toggle,
html:has(.consent.is-open) .a11y__toggle {
	inset-block-end: calc(var(--consent-h, 0px) + 16px);
}

html[data-consent="unset"] .a11y__panel,
html:has(.consent.is-open) .a11y__panel {
	inset-block-end: calc(var(--consent-h, 0px) + 76px);
	max-height: calc(100dvh - var(--consent-h, 0px) - 100px);
}

/* Phones: compact. Exception to the "nothing under 16px on phones" rule
   (Tamar, 2026-10-05): the banner covers the page, so it's kept as small as
   still comfortable to read — 14px text. */
@media (max-width: 767px) {
	.consent {
		padding: 10px 16px;
		font-size: 14px;
		line-height: 1.45;
	}

	.consent__title {
		margin-block-end: 2px;
		padding-inline-end: 32px;
		font-size: 15px;
		gap: 6px;
	}

	.consent__icon {
		width: 18px;
		height: 18px;
	}

	.consent__close {
		inset-block-start: 4px;
		inset-inline-end: 6px;
	}

	.consent__choices {
		margin-block-start: 8px;
	}

	.consent__legend {
		margin-block-end: 2px;
	}

	.consent__option {
		gap: 0 10px;
		padding: 6px 0;
	}

	.consent__option input {
		width: 18px;
		height: 18px;
	}

	.consent__desc {
		font-size: 14px;
	}

	.consent__actions {
		gap: 6px;
		margin-block-start: 8px;
	}

	.consent__actions .button {
		padding: 9px 8px;
		font-size: 13px;
	}

	.consent__customize-wide {
		display: none !important;
	}
}

/* Tablet and up: one shorter strip — text on the start side, buttons in a
   row on the end side, choices underneath. Content lines up with the page. */
@media (min-width: 768px) {
	.consent {
		grid-template-columns: 1fr auto;
		grid-template-areas:
			"title   actions"
			"text    actions"
			"choices choices";
		column-gap: 40px;
		align-items: center;
		padding: 16px max(var(--page-pad-x), (100% - var(--max-width)) / 2);
		line-height: 1.5;
	}

	html[data-consent="unset"] .consent,
	.consent.is-open {
		display: grid;
	}

	.consent__title {
		grid-area: title;
		margin-block-end: 2px;
		font-size: var(--fs-body);
	}

	.consent__icon {
		width: 22px;
		height: 22px;
	}

	.consent__text {
		grid-area: text;
		font-size: var(--fs-small);
	}

	.consent__customize {
		display: none;
	}

	.consent__choices {
		grid-area: choices;
		display: grid;
		grid-template-columns: auto 1fr 1fr;
		gap: 0 32px;
		align-items: start;
		margin-block-start: 12px;
	}

	.consent__legend {
		float: inline-start; /* a legend can't be a grid item; floated, it sits in the first column */
		padding-block-start: 12px;
	}

	.consent__actions {
		grid-area: actions;
		display: flex;
		margin: 0;
	}

	.consent__close {
		inset-block-start: 8px;
		inset-inline-end: 8px;
	}

	.consent.is-open .consent__actions {
		margin-inline-end: 32px; /* room for the close button */
	}
}

/* ---- Footer: "Cookie settings" is a button (it opens the banner), styled like the links beside it ---- */

.site-footer__legal button {
	padding: 0;
	border: 0;
	background: none;
	color: var(--c-footer-muted);
	font: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.site-footer__legal button:hover {
	color: var(--c-sand);
}
