/*
 * EstGhillie cookie consent. Uses the theme's colour tokens when they exist,
 * with fallbacks so it also works with any other theme.
 */
.egc-banner,
.egc-dialog {
	--egc-ink: var(--ink, #11140e);
	--egc-paper: var(--bone, #f3efe4);
	--egc-soft: var(--stone, #67635a);
	--egc-line: rgba(17, 20, 14, 0.16);
	--egc-dark: var(--forest, #141b12);
	--egc-accent: var(--signal, #e2672a);
	--egc-font: var(--font, system-ui, -apple-system, "Segoe UI", sans-serif);
	--egc-cut: 16px;
	font-family: var(--egc-font);
	color: var(--egc-ink);
}

/* Banner: a card in the bottom-left corner; it does not block the page, so
   the privacy policy and the shop can be read before choosing. */
.egc-banner {
	position: fixed;
	left: clamp(0.75rem, 2vw, 1.5rem);
	bottom: clamp(0.75rem, 2vw, 1.5rem);
	z-index: 9990;
	box-sizing: border-box;
	width: min(470px, 100vw - 1.5rem);
	max-height: calc(100vh - 1.5rem);
	overflow-y: auto;
	padding: 1.5rem 1.5rem 1.35rem;
	background: var(--egc-paper);
	border-top: 4px solid var(--egc-accent);
	box-shadow: 0 18px 50px rgba(12, 16, 11, 0.35), 0 0 0 1px rgba(12, 16, 11, 0.08);
	clip-path: polygon(0 0, calc(100% - var(--egc-cut)) 0, 100% var(--egc-cut), 100% 100%, var(--egc-cut) 100%, 0 calc(100% - var(--egc-cut)));
	animation: egc-rise 0.45s cubic-bezier(0.2, 0.7, 0.1, 1) both;
}

.egc-banner[hidden] {
	display: none;
}

@keyframes egc-rise {
	from {
		opacity: 0;
		transform: translateY(16px);
	}
}

.egc-banner__title,
.egc-dialog__title {
	margin: 0 0 0.6rem;
	color: var(--egc-ink);
	font-size: 1.25rem;
	font-weight: 800;
	font-stretch: 112%;
	line-height: 1.1;
	letter-spacing: 0;
	text-transform: uppercase;
}

.egc-banner__text {
	margin: 0 0 1.15rem;
	color: var(--egc-ink);
	font-size: 0.9375rem;
	line-height: 1.55;
}

.egc-banner__text a,
.egc-open-link {
	color: var(--egc-ink);
	text-decoration: underline;
	text-decoration-color: var(--egc-accent);
	text-decoration-thickness: 2px;
	text-underline-offset: 0.2em;
}

.egc-banner__actions,
.egc-dialog__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
}

/* "Accept" and "Reject" look exactly alike: neither choice is nudged. */
.egc-btn {
	flex: 1 1 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 3rem;
	margin: 0;
	padding: 0.7rem 1.1rem;
	border: 0;
	border-radius: 0;
	background: var(--egc-ink);
	color: var(--egc-paper);
	font-family: inherit;
	font-size: 0.875rem;
	font-weight: 700;
	letter-spacing: 0.07em;
	line-height: 1.2;
	text-transform: uppercase;
	cursor: pointer;
	clip-path: none;
	transition: background-color 0.2s, color 0.2s;
}

.egc-btn:hover {
	background: var(--moss, #3a4a30);
	color: var(--egc-paper);
}

.egc-btn:focus-visible,
.egc-dialog__close:focus-visible,
.egc-switch:focus-visible,
.egc-cat__cookies summary:focus-visible {
	outline: 3px solid var(--egc-accent);
	outline-offset: 2px;
}

.egc-btn--text {
	flex: 0 0 100%;
	min-height: 2.5rem;
	background: none;
	color: var(--egc-ink);
	text-decoration: underline;
	text-decoration-color: var(--egc-accent);
	text-decoration-thickness: 2px;
	text-underline-offset: 0.25em;
}

.egc-btn--text:hover {
	background: none;
	color: var(--egc-ink);
}

/* Preferences dialog.
   The dialog keeps its natural height and scrolls as a whole when the screen
   is shorter; the heading and the buttons stay in view (sticky). No flexbox
   sizing: Safari collapses a flex child with a 0 basis inside a box whose
   height is only capped, which hid the whole content. */
.egc-dialog {
	box-sizing: border-box;
	width: min(680px, 100vw - 1.5rem);
	max-width: none;
	/* As tall as its content (a modal dialog is pinned top and bottom, so
	   "auto" would stretch it to the full screen). */
	height: -webkit-fit-content;
	height: fit-content;
	max-height: calc(100vh - 1.5rem);
	max-height: calc(100dvh - 1.5rem);
	margin: auto;
	padding: 0;
	border: 0;
	background: var(--egc-paper);
	box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px));
}

.egc-dialog[open] {
	display: block;
}

.egc-dialog::backdrop {
	background: rgba(12, 16, 11, 0.7);
}

.egc-dialog__head {
	position: sticky;
	top: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1.1rem 1.5rem;
	background: var(--egc-dark);
	color: var(--egc-paper);
}

.egc-dialog__head .egc-dialog__title {
	margin: 0;
	color: var(--egc-paper);
}

.egc-dialog__close {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	margin-right: -0.5rem;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	cursor: pointer;
}

.egc-dialog__close:hover {
	background: rgba(243, 239, 228, 0.12);
}

.egc-dialog__body {
	padding: 1.25rem 1.5rem 0.5rem;
}

.egc-dialog__intro {
	margin: 0 0 1rem;
	font-size: 0.9375rem;
	line-height: 1.55;
}

.egc-cats {
	margin: 0;
	padding: 0;
	list-style: none;
	border-top: 1px solid var(--egc-line);
}

.egc-cat {
	margin: 0;
	padding: 1rem 0;
	border-bottom: 1px solid var(--egc-line);
}

.egc-cat__row {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.egc-cat__label {
	flex: 1;
	margin: 0;
	font-size: 1rem;
	font-weight: 800;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	cursor: pointer;
}

.egc-cat__always {
	color: var(--egc-soft);
	font-size: 0.8125rem;
	font-weight: 600;
}

/* Switch */
.egc-switch {
	-webkit-appearance: none;
	appearance: none;
	position: relative;
	flex: none;
	width: 3.1rem;
	height: 1.75rem;
	margin: 0;
	border: 2px solid var(--egc-ink);
	background: transparent;
	cursor: pointer;
	transition: background-color 0.2s;
}

.egc-switch::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: calc(1.75rem - 10px);
	height: calc(1.75rem - 10px);
	background: var(--egc-ink);
	transition: transform 0.2s, background-color 0.2s;
}

.egc-switch:checked {
	background: var(--egc-ink);
}

.egc-switch:checked::after {
	background: var(--egc-accent);
	transform: translateX(1.35rem);
}

.egc-switch:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.egc-cat__desc {
	margin: 0.5rem 0 0;
	color: var(--egc-soft);
	font-size: 0.9063rem;
	line-height: 1.5;
}

.egc-cat__cookies {
	margin-top: 0.6rem;
	font-size: 0.875rem;
}

.egc-cat__cookies summary {
	color: var(--egc-ink);
	font-weight: 600;
	cursor: pointer;
}

.egc-table-wrap {
	margin-top: 0.6rem;
	overflow-x: auto;
}

.egc-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.8125rem;
	line-height: 1.45;
}

.egc-table th,
.egc-table td {
	padding: 0.5rem 0.6rem 0.5rem 0;
	border-bottom: 1px solid var(--egc-line);
	text-align: left;
	vertical-align: top;
}

.egc-table th {
	font-size: 0.75rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.egc-table code {
	font-size: 0.8125rem;
	word-break: break-word;
}

.egc-dialog__id {
	margin: 1rem 0 0.5rem;
	color: var(--egc-soft);
	font-size: 0.8125rem;
}

.egc-dialog__id code {
	color: var(--egc-ink);
	word-break: break-all;
}

.egc-dialog__actions {
	position: sticky;
	bottom: 0;
	z-index: 2;
	padding: 1rem 1.5rem 1.25rem;
	background: var(--egc-paper);
	border-top: 1px solid var(--egc-line);
	box-shadow: 0 -10px 20px -14px rgba(12, 16, 11, 0.35);
}

/* Privacy-policy table (shortcode) */
.egc-policy .egc-table {
	font-size: 0.9375rem;
}

.egc-policy .egc-table code {
	font-size: 0.875rem;
}

@media (max-width: 560px) {
	.egc-banner {
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		max-height: 80vh;
		padding: 1.25rem 1.125rem calc(1rem + env(safe-area-inset-bottom));
		clip-path: none;
	}

	.egc-btn {
		flex: 1 1 40%;
	}

	.egc-dialog {
		width: 100vw;
		max-height: 94vh;
		max-height: 94dvh;
		margin: auto 0 0;
		clip-path: none;
	}

	.egc-dialog__head {
		padding: 0.85rem 1.125rem;
	}

	.egc-dialog__body {
		padding: 1rem 1.125rem 0.25rem;
	}

	/* Two buttons side by side, "save" across: one row less than stacking. */
	.egc-dialog__actions {
		display: grid;
		grid-template-columns: 1fr 1fr;
		padding: 0.75rem 1.125rem calc(0.75rem + env(safe-area-inset-bottom));
	}

	.egc-dialog__actions [data-egc="save"] {
		grid-column: 1 / -1;
		grid-row: 2;
	}

	.egc-dialog__actions .egc-btn {
		min-height: 2.9rem;
		padding-inline: 0.6rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.egc-banner {
		animation: none;
	}
}

/* Short screens (landscape phones, small laptop windows): tighter spacing. */
@media (max-height: 640px) {
	.egc-dialog__head {
		padding-block: 0.7rem;
	}

	.egc-cat {
		padding-block: 0.75rem;
	}

	.egc-dialog__actions {
		padding-block: 0.6rem;
	}

	.egc-dialog__actions .egc-btn {
		min-height: 2.6rem;
	}
}

/* In place of a blocked video or map */
.egc-embed-note {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1rem;
	padding: 1rem 1.25rem;
	background: var(--khaki, #d9d2bf);
	color: var(--ink, #11140e);
	font-family: var(--font, system-ui, sans-serif);
	font-size: 0.9375rem;
	line-height: 1.5;
}

.egc-embed-note .egc-btn {
	flex: 0 0 auto;
	--egc-ink: var(--ink, #11140e);
	--egc-paper: var(--bone, #f3efe4);
}

iframe[data-egc-src] {
	display: none;
}
