/* Gift Box Upsell
 * Fonts are inherited from your theme. Colours can be overridden with the variables below.
 */
:root {
	--gbu-accent: #2f5d50;
	--gbu-accent-text: #ffffff;
	--gbu-ink: #1d1d1b;
	--gbu-muted: #6b6760;
	--gbu-line: #e4e0d8;
	--gbu-surface: #ffffff;
	--gbu-tint: #f7f5f1;
	--gbu-error: #a4262c;
}

html.gbu-is-open {
	overflow: hidden;
}

/* Overlay + dialog */
.gbu-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(20, 18, 15, 0.55);
	opacity: 0;
	transition: opacity 0.2s ease;
}
.gbu-overlay.is-visible {
	opacity: 1;
}

.gbu-modal {
	position: relative;
	width: 100%;
	max-width: 780px;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	overflow-y: auto;
	background: var(--gbu-surface);
	color: var(--gbu-ink);
	border-radius: 12px;
	border-top: 6px solid var(--gbu-accent);
	box-shadow: 0 24px 60px rgba(20, 18, 15, 0.25);
	padding: 32px 32px 24px;
	transform: translateY(12px);
	transition: transform 0.2s ease;
	font-family: inherit;
	line-height: 1.5;
	box-sizing: border-box;
}
.gbu-overlay.is-visible .gbu-modal {
	transform: none;
}
.gbu-modal *,
.gbu-modal *::before,
.gbu-modal *::after {
	box-sizing: border-box;
}

.gbu-close {
	position: absolute;
	top: 10px;
	right: 12px;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--gbu-muted);
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
}
.gbu-close:hover {
	background: var(--gbu-tint);
	color: var(--gbu-ink);
}

/* Header */
.gbu-header {
	text-align: center;
	max-width: 34em;
	margin: 0 auto 24px;
}
.gbu-context {
	margin: 0 0 8px;
	font-size: 0.875rem;
	color: var(--gbu-muted);
}
.gbu-context strong {
	color: var(--gbu-ink);
	font-weight: 600;
}
.gbu-title {
	margin: 0 0 8px;
	font-size: clamp(1.375rem, 3vw, 1.75rem);
	line-height: 1.2;
	font-weight: 700;
	color: var(--gbu-ink);
	text-transform: none;
	letter-spacing: normal;
}
.gbu-subtitle {
	margin: 0;
	color: var(--gbu-muted);
}

/* Options side by side */
.gbu-options {
	display: grid;
	gap: 16px;
	grid-template-columns: repeat(2, minmax(0, 1fr));
}
.gbu-options--1 {
	grid-template-columns: minmax(0, 360px);
	justify-content: center;
}
.gbu-options--3 {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gbu-option {
	display: flex;
	flex-direction: column;
	border: 1px solid var(--gbu-line);
	border-radius: 8px;
	overflow: hidden;
	background: var(--gbu-surface);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.gbu-option.is-added {
	border-color: var(--gbu-accent);
	box-shadow: 0 0 0 1px var(--gbu-accent);
}
.gbu-option.is-loading {
	opacity: 0.75;
}

.gbu-option__media {
	aspect-ratio: 4 / 3;
	background: var(--gbu-tint);
	overflow: hidden;
}
.gbu-option__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	margin: 0;
}

.gbu-option__body {
	padding: 16px 16px 0;
	flex: 1 1 auto;
}
.gbu-option__name {
	margin: 0 0 4px;
	font-size: 1.0625rem;
	line-height: 1.3;
	font-weight: 600;
	color: var(--gbu-ink);
	text-transform: none;
	letter-spacing: normal;
}
.gbu-option__price {
	font-size: 1.125rem;
	font-weight: 600;
	color: var(--gbu-ink);
}
.gbu-option__price del {
	color: var(--gbu-muted);
	font-weight: 400;
	margin-right: 4px;
}
.gbu-option__price ins {
	text-decoration: none;
}
.gbu-option__desc {
	margin: 8px 0 0;
	font-size: 0.875rem;
	color: var(--gbu-muted);
}

.gbu-option__actions {
	padding: 16px;
}

/* Quantity stepper */
.gbu-qty__label {
	display: block;
	margin-bottom: 6px;
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--gbu-muted);
}
.gbu-qty {
	display: inline-flex;
	align-items: stretch;
	border: 1px solid var(--gbu-line);
	border-radius: 6px;
	overflow: hidden;
	margin-bottom: 12px;
}
.gbu-modal .gbu-qty__btn {
	width: 40px;
	min-height: 40px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 0;
	background: var(--gbu-tint);
	color: var(--gbu-ink);
	font-size: 1.125rem;
	line-height: 1;
	cursor: pointer;
}
.gbu-modal .gbu-qty__btn:hover:not([disabled]) {
	background: var(--gbu-line);
}
.gbu-modal .gbu-qty__input {
	width: 56px;
	min-height: 40px;
	margin: 0;
	padding: 0 4px;
	border: 0;
	border-left: 1px solid var(--gbu-line);
	border-right: 1px solid var(--gbu-line);
	border-radius: 0;
	background: var(--gbu-surface);
	color: var(--gbu-ink);
	text-align: center;
	font: inherit;
	font-weight: 600;
	-moz-appearance: textfield;
	box-shadow: none;
}
.gbu-qty__input::-webkit-outer-spin-button,
.gbu-qty__input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* Add button */
.gbu-modal .gbu-add {
	display: block;
	width: 100%;
	min-height: 46px;
	margin: 0;
	padding: 10px 16px;
	border: 0;
	border-radius: 6px;
	background: var(--gbu-accent);
	color: var(--gbu-accent-text);
	font: inherit;
	font-weight: 600;
	line-height: 1.25;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	transition: filter 0.15s ease;
}
.gbu-modal .gbu-add:hover:not([disabled]) {
	filter: brightness(1.1);
}
.gbu-modal .gbu-add[disabled] {
	cursor: default;
}
.gbu-option.is-added .gbu-add::before {
	content: "\2713\00a0";
}

.gbu-option__msg {
	margin: 8px 0 0;
	font-size: 0.8125rem;
	min-height: 0;
}
.gbu-option__msg:empty {
	display: none;
}
.gbu-option__msg.is-error {
	color: var(--gbu-error);
}

/* Footer */
.gbu-footer {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 24px;
	margin-top: 20px;
}
.gbu-modal .gbu-decline {
	padding: 8px 4px;
	margin: 0;
	border: 0;
	background: none;
	color: var(--gbu-muted);
	font: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
	box-shadow: none;
}
.gbu-modal .gbu-decline:hover {
	color: var(--gbu-ink);
}
.gbu-view-cart {
	color: var(--gbu-accent);
	font-weight: 600;
}
.gbu-view-cart[hidden] {
	display: none;
}

/* Focus */
.gbu-modal button:focus-visible,
.gbu-modal input:focus-visible,
.gbu-modal a:focus-visible {
	outline: 2px solid var(--gbu-accent);
	outline-offset: 2px;
}

/* Mobile: stack options */
@media (max-width: 600px) {
	.gbu-overlay {
		align-items: flex-end;
		padding: 0;
	}
	.gbu-modal {
		max-height: 92vh;
		max-height: 92dvh;
		border-radius: 12px 12px 0 0;
		padding: 28px 16px 16px;
	}
	.gbu-options,
	.gbu-options--3 {
		grid-template-columns: minmax(0, 1fr);
	}
	.gbu-option {
		display: grid;
		grid-template-columns: 96px minmax(0, 1fr);
	}
	.gbu-option__media {
		aspect-ratio: 1 / 1;
		grid-row: span 2;
	}
	.gbu-option__body {
		padding: 12px 12px 0;
	}
	.gbu-option__actions {
		padding: 12px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.gbu-overlay,
	.gbu-modal,
	.gbu-option {
		transition: none;
	}
}

/* ---------------------------------------------------------------
 * Cart: linked gift box rows sit indented under their product
 * ------------------------------------------------------------ */
.woocommerce-cart-form .gbu-gift-box-item td {
	border-top-style: dashed;
}
.woocommerce-cart-form .gbu-gift-box-item td.product-name {
	position: relative;
	padding-left: 2.25em;
}
.woocommerce-cart-form .gbu-gift-box-item td.product-name::before {
	content: "\21B3";
	position: absolute;
	left: 0.75em;
	top: 50%;
	transform: translateY(-50%);
	color: var(--gbu-accent);
	font-size: 1.1em;
}
.woocommerce-mini-cart .gbu-gift-box-item {
	padding-left: 1.25em !important;
	border-left: 2px solid var(--gbu-accent);
}
