/**
 * Goedert Cart Drawer — Shopify-style slide-out cart + icon trigger.
 * Brand: black (#1a1a1a) + safety yellow (#f1de58).
 */

.gcd-drawer,
.gcd-overlay,
.gcd-trigger {
	--gcd-yellow: #f1de58;
	--gcd-ink: #1a1a1a;
	--gcd-surface: #ffffff;
	--gcd-muted: #6b6b6b;
	--gcd-border: #e6e6e6;
	--gcd-width: 420px;
	--gcd-radius: 8px;
	box-sizing: border-box;
}

.gcd-drawer *,
.gcd-drawer *::before,
.gcd-drawer *::after {
	box-sizing: border-box;
}

/* ------------------------------------------------------------ Icon group */
.gcd-icons {
	display: inline-flex;
	align-items: center;
	justify-content: flex-end;
	gap: 2px;
}

/* ---------------------------------------------------------------- Trigger */
.gcd-trigger {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px;
	margin: 0;
	border: 0;
	background: transparent;
	color: var(--gcd-ink);
	cursor: pointer;
	line-height: 1;
	font: inherit;
	-webkit-appearance: none;
	appearance: none;
}

.gcd-trigger:focus-visible {
	outline: 2px solid var(--gcd-yellow);
	outline-offset: 3px;
	border-radius: 4px;
}

.gcd-trigger__icon {
	display: inline-flex;
}

.gcd-trigger__icon svg {
	width: var(--gcd-icon-size, 24px);
	height: var(--gcd-icon-size, 24px);
	display: block;
	/* Default to brand ink (NOT `inherit`): some Divi Theme Builder header
	   templates force a yellow link colour on <a>, which the icon would otherwise
	   inherit. A custom "Icon Color" still wins (it sets --gcd-icon-color). */
	color: var(--gcd-icon-color, var(--gcd-ink, #1a1a1a));
}

.gcd-trigger__label {
	font-size: 0.95em;
	font-weight: 600;
}

.gcd-count {
	position: absolute;
	top: -2px;
	left: 50%;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 999px;
	background: var(--gcd-badge-bg, var(--gcd-yellow));
	color: var(--gcd-badge-color, var(--gcd-ink));
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	transform: translate(4px, 0);
	transition: transform 0.15s ease;
}

.gcd-trigger__label + .gcd-count,
.gcd-trigger__icon + .gcd-count {
	pointer-events: none;
}

.gcd-count--empty {
	display: none;
}

.gcd-trigger.gcd-bump .gcd-count {
	transform: translate(4px, 0) scale(1.25);
}

/* ---------------------------------------------------------------- Overlay */
.gcd-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	opacity: 0;
	z-index: 100000;
	transition: opacity 0.28s ease;
}

.gcd-overlay.is-open {
	opacity: 1;
}

/* ---------------------------------------------------------------- Drawer */
.gcd-drawer {
	position: fixed;
	top: 0;
	right: 0;
	/* dvh so the drawer fills the *visible* viewport on iOS Safari (where the dynamic
	   bottom toolbar makes 100vh / bottom:0 leave a gap). vh kept as a fallback. */
	height: 100vh;
	height: 100dvh;
	width: min(var(--gcd-width), 100vw);
	max-width: 100%;
	display: flex;
	flex-direction: column;
	background: var(--gcd-surface);
	color: var(--gcd-ink);
	box-shadow: -8px 0 40px rgba(0, 0, 0, 0.18);
	z-index: 100001;
	transform: translateX(100%);
	transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	will-change: transform;
}

.gcd-drawer.is-open {
	transform: translateX(0);
}

body.gcd-drawer-open {
	overflow: hidden;
}

/* When WordPress shows the admin bar (logged-in users only), start the drawer
   below it so its header isn't hidden behind the bar. The bar is 32px on
   desktop and 46px on the mobile breakpoint (<=782px). bottom:0 keeps the drawer
   anchored, so its height shrinks to fit the remaining viewport. */
body.admin-bar .gcd-drawer {
	top: 32px;
	height: calc(100vh - 32px);
	height: calc(100dvh - 32px);
}

@media screen and (max-width: 782px) {
	body.admin-bar .gcd-drawer {
		top: 46px;
		height: calc(100vh - 46px);
		height: calc(100dvh - 46px);
	}
}

.gcd-drawer__header {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px;
	border-bottom: 1px solid var(--gcd-border);
}

.gcd-drawer__title {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	letter-spacing: 0.01em;
	color: var(--gcd-ink);
}

.gcd-drawer__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--gcd-ink);
	cursor: pointer;
	transition: background 0.15s ease;
}

.gcd-drawer__close:hover {
	background: #f3f3f3;
}

.gcd-drawer__close:focus-visible {
	outline: 2px solid var(--gcd-yellow);
	outline-offset: 2px;
}

/* ---------------------------------------------------------------- Items */
.gcd-drawer__items {
	flex: 1 1 auto;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 6px 20px;
}

.gcd-drawer.is-busy .gcd-drawer__items {
	opacity: 0.6;
	pointer-events: none;
}

.gcd-line-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.gcd-line {
	display: grid;
	grid-template-columns: 72px 1fr auto;
	gap: 14px;
	padding: 18px 0;
	border-bottom: 1px solid var(--gcd-border);
	position: relative;
}

.gcd-line.is-loading {
	opacity: 0.5;
	pointer-events: none;
}

.gcd-line__media {
	display: block;
	width: 72px;
	height: 72px;
	border: 1px solid var(--gcd-border);
	border-radius: 6px;
	overflow: hidden;
	background: #fafafa;
}

.gcd-line__media img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	mix-blend-mode: multiply;
}

.gcd-line__info {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.gcd-line__name {
	font-size: 14px;
	font-weight: 600;
	color: var(--gcd-ink);
	text-decoration: none;
	line-height: 1.3;
}

.gcd-line__name:hover {
	text-decoration: underline;
}

.gcd-line__meta {
	font-size: 12px;
	color: var(--gcd-muted);
	line-height: 1.4;
}

.gcd-line__meta p {
	margin: 0;
}

.gcd-line__price {
	font-size: 12px;
	color: var(--gcd-muted);
}

/* Quantity stepper */
.gcd-qty {
	display: inline-flex;
	align-items: center;
	margin-top: 6px;
	border: 1px solid var(--gcd-border);
	border-radius: 6px;
	overflow: hidden;
	width: max-content;
}

.gcd-qty__btn {
	width: 30px;
	height: 30px;
	border: 0;
	background: #fff;
	color: var(--gcd-ink);
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.15s ease;
}

.gcd-qty__btn:hover {
	background: #f3f3f3;
}

.gcd-qty__btn:focus-visible {
	outline: 2px solid var(--gcd-yellow);
	outline-offset: -2px;
}

.gcd-qty__input {
	width: 40px;
	height: 30px;
	border: 0;
	border-left: 1px solid var(--gcd-border);
	border-right: 1px solid var(--gcd-border);
	text-align: center;
	font-size: 14px;
	color: var(--gcd-ink);
	-moz-appearance: textfield;
	appearance: textfield;
	background: #fff;
}

.gcd-qty__input::-webkit-outer-spin-button,
.gcd-qty__input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.gcd-qty__input:focus-visible {
	outline: 2px solid var(--gcd-yellow);
	outline-offset: -2px;
}

.gcd-line__aside {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	justify-content: space-between;
	gap: 8px;
}

.gcd-line__remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--gcd-muted);
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.gcd-line__remove:hover {
	background: #fdecec;
	color: #c0392b;
}

.gcd-line__remove:focus-visible {
	outline: 2px solid var(--gcd-yellow);
	outline-offset: 1px;
}

.gcd-line__total {
	font-size: 14px;
	font-weight: 700;
	color: var(--gcd-ink);
	white-space: nowrap;
}

/* Empty state */
.gcd-drawer__empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: 16px;
	padding: 64px 20px;
	color: var(--gcd-muted);
	min-height: 50vh;
	min-height: 50dvh;
}

.gcd-drawer__empty-icon {
	color: #cfcfcf;
}

.gcd-drawer__empty-text {
	margin: 0;
	font-size: 15px;
	color: var(--gcd-ink);
}
/* `.gcd-btn` has flex:1 for the side-by-side footer; inside this column-flex empty box
   that stretches the lone "Continue shopping" button vertically into a huge block.
   Size it to its content instead. */
.gcd-drawer__empty .gcd-btn {
	flex: 0 0 auto;
	min-width: 200px;
}

/* ---------------------------------------------------------------- Footer */
.gcd-drawer__footer {
	flex: 0 0 auto;
	padding: 18px 20px calc(18px + env(safe-area-inset-bottom, 0px));
	border-top: 1px solid var(--gcd-border);
	background: var(--gcd-surface);
	box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.04);
}

.gcd-drawer__footer--empty {
	display: none;
}

.gcd-drawer__subtotal {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	font-size: 16px;
	font-weight: 700;
	color: var(--gcd-ink);
}

.gcd-drawer__subtotal-amount {
	font-size: 18px;
}

.gcd-drawer__note {
	margin: 4px 0 14px;
	font-size: 12px;
	color: var(--gcd-muted);
}

.gcd-drawer__actions {
	display: flex;
	gap: 10px;
}

.gcd-btn {
	flex: 1 1 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 0 18px;
	border-radius: var(--gcd-radius);
	font-size: 14px;
	font-weight: 700;
	text-decoration: none;
	text-align: center;
	cursor: pointer;
	border: 2px solid transparent;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.gcd-btn--primary {
	background: var(--gcd-yellow);
	color: var(--gcd-ink);
}

.gcd-btn--primary:hover {
	background: #ffce26;
}

.gcd-btn--ghost {
	background: #fff;
	color: var(--gcd-ink);
	border-color: var(--gcd-ink);
}

.gcd-btn--ghost:hover {
	background: var(--gcd-ink);
	color: #fff;
}

.gcd-btn:focus-visible {
	outline: 2px solid var(--gcd-ink);
	outline-offset: 2px;
}

/* ---------------------------------------------------------- Search panel */
/* .gcd-search-drawer extends .gcd-drawer, so it inherits position, width, the
   slide transition, the mobile full-width rule and reduced-motion handling. */
.gcd-search__form {
	flex: 0 0 auto;
	padding: 16px 20px;
	border-bottom: 1px solid var(--gcd-border);
}

.gcd-search__field {
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
	border: 1px solid var(--gcd-border);
	border-radius: var(--gcd-radius);
	background: #fff;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.gcd-search__field:focus-within {
	border-color: var(--gcd-ink);
	box-shadow: 0 0 0 3px rgba(241, 222, 88, 0.35);
}

.gcd-search__field-icon {
	display: inline-flex;
	flex: 0 0 auto;
	margin-left: 12px;
	color: var(--gcd-muted);
}

.gcd-search__field-icon svg {
	width: 20px;
	height: 20px;
	display: block;
}

.gcd-search__input {
	flex: 1 1 auto;
	min-width: 0;
	height: 48px;
	border: 0;
	background: transparent;
	color: var(--gcd-ink);
	font-size: 16px; /* >=16px avoids iOS zoom-on-focus. */
	line-height: 1.2;
	-webkit-appearance: none;
	appearance: none;
}

.gcd-search__input::-webkit-search-cancel-button {
	-webkit-appearance: none;
	appearance: none;
}

.gcd-search__input:focus {
	outline: none;
}

.gcd-search__submit {
	flex: 0 0 auto;
	height: 48px;
	padding: 0 18px;
	border: 0;
	border-radius: 0 var(--gcd-radius) var(--gcd-radius) 0;
	background: var(--gcd-yellow);
	color: var(--gcd-ink);
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	transition: background 0.15s ease;
}

.gcd-search__submit:hover {
	background: #ffce26;
}

.gcd-search__submit:focus-visible {
	outline: 2px solid var(--gcd-ink);
	outline-offset: -2px;
}

.gcd-search__results {
	flex: 1 1 auto;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 6px 20px 20px;
}

.gcd-search__state {
	margin: 0;
	padding: 32px 0;
	text-align: center;
	font-size: 14px;
	color: var(--gcd-muted);
}

.gcd-search__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.gcd-search__item {
	border-bottom: 1px solid var(--gcd-border);
}

.gcd-search__link {
	display: grid;
	grid-template-columns: 56px 1fr;
	align-items: center;
	gap: 14px;
	padding: 12px 0;
	text-decoration: none;
	color: var(--gcd-ink);
}

.gcd-search__link:hover .gcd-search__name {
	text-decoration: underline;
}

.gcd-search__link:focus-visible {
	outline: 2px solid var(--gcd-yellow);
	outline-offset: 2px;
	border-radius: 4px;
}

.gcd-search__thumb {
	display: block;
	width: 56px;
	height: 56px;
	border: 1px solid var(--gcd-border);
	border-radius: 6px;
	overflow: hidden;
	background: #fafafa;
}

.gcd-search__thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	mix-blend-mode: multiply;
}

.gcd-search__text {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.gcd-search__name {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--gcd-ink);
}

.gcd-search__price {
	font-size: 13px;
	color: var(--gcd-muted);
}

.gcd-search__price del {
	opacity: 0.6;
	margin-right: 4px;
}

.gcd-search__view-all {
	margin-top: 16px;
}

/* ---------------------------------------------------------------- Utils */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------------------------------------------------------------- Mobile */
@media (max-width: 480px) {
	.gcd-drawer {
		--gcd-width: 100vw;
	}

	/* Comfortable tap targets on touch screens (WCAG 2.5.5 / platform guidance);
	   the icon-only search + cart triggers and the close button are otherwise
	   below the recommended 44px. */
	.gcd-trigger {
		min-width: 44px;
		min-height: 44px;
		justify-content: center;
	}

	.gcd-drawer__close {
		width: 44px;
		height: 44px;
	}

	.gcd-line {
		grid-template-columns: 64px 1fr auto;
	}

	.gcd-line__media,
	.gcd-line__media img {
		width: 64px;
		height: 64px;
	}
}

/* ---------------------------------------------------- Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.gcd-drawer,
	.gcd-overlay,
	.gcd-count {
		transition: none !important;
	}
}

/* Unit display ("4 cartons") replacing the raw pair count for pack products */
.gcd-qty__display {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  padding: 0 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gcd-ink, #1a1a1a);
  white-space: nowrap;
}
