/*!
 * Webko Side Cart
 * Every value that differs between themes is a custom property, set inline by
 * PHP. This file never changes when the theme or the colours change.
 */

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

.wsc[hidden] {
	display: none;
}

.wsc {
	position: fixed;
	inset: 0;
	z-index: 999999;
	font-family: var(--wsc-font);
	font-size: var(--wsc-body-size);
	line-height: var(--wsc-line-height);
	color: var(--wsc-text);
}

.wsc__overlay {
	position: absolute;
	inset: 0;
	background: var(--wsc-overlay);
	opacity: 0;
	transition: opacity 0.28s ease;
	cursor: pointer;
}

.wsc.is-open .wsc__overlay {
	opacity: 1;
}

.wsc__panel {
	position: absolute;
	top: 0;
	bottom: 0;
	width: min(var(--wsc-width), 100vw);
	display: flex;
	flex-direction: column;
	background: var(--wsc-surface);
	box-shadow: var(--wsc-shadow);
	transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
	will-change: transform;
	overscroll-behavior: contain;
}

.wsc--right .wsc__panel {
	right: 0;
	transform: translate3d(100%, 0, 0);
}

.wsc--left .wsc__panel {
	left: 0;
	transform: translate3d(-100%, 0, 0);
}

.wsc.is-open .wsc__panel {
	transform: translate3d(0, 0, 0);
}

/* ---------------------------------------------------------------- Header */

.wsc__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: var(--wsc-pad);
	border-bottom: 1px solid var(--wsc-border);
	background: var(--wsc-surface);
	flex: 0 0 auto;
}

.wsc__title {
	margin: 0;
	font-size: var(--wsc-title-size);
	font-weight: var(--wsc-title-weight);
	letter-spacing: var(--wsc-title-tracking);
	line-height: var(--wsc-line-height-tight);
	color: var(--wsc-text);
}

.wsc__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	margin: -6px -6px -6px 0;
	padding: 0;
	border: 0;
	border-radius: var(--wsc-radius);
	background: none;
	color: var(--wsc-text);
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.wsc__close:hover {
	opacity: 0.6;
}

/* -------------------------------------------------------- Free shipping */

.wsc__progress {
	flex: 0 0 auto;
	padding: 12px var(--wsc-content-pad);
	background: var(--wsc-surface-alt);
	border-bottom: 1px solid var(--wsc-border);
	text-align: center;
}

.wsc__progress-text {
	display: block;
	margin: 0 0 8px;
	font-size: var(--wsc-size-md);
	font-weight: var(--wsc-weight-strong);
	color: var(--wsc-text);
}

.wsc__progress-track {
	position: relative;
	height: 6px;
	border-radius: 999px;
	background: var(--wsc-progress-track);
	overflow: hidden;
}

.wsc__progress-bar {
	position: absolute;
	inset: 0 auto 0 0;
	width: 0;
	border-radius: inherit;
	background: var(--wsc-progress-fill);
	transition: width 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}

/* ------------------------------------------------------------------ Body */

.wsc__body {
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	background: var(--wsc-surface-alt);
	padding: var(--wsc-content-pad);
	scrollbar-width: thin;
}

.wsc__items {
	display: flex;
	flex-direction: column;
	gap: var(--wsc-item-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* ------------------------------------------------------------- Line item */

.wsc-item {
	display: grid;
	grid-template-columns: var(--wsc-img-size) 1fr auto;
	grid-template-rows: auto auto;
	column-gap: 10px;
	row-gap: 8px;
	align-items: start;
	padding: var(--wsc-item-padding);
	background: var(--wsc-item-bg);
	border-radius: var(--wsc-item-radius);
	box-shadow: var(--wsc-item-shadow);
	transition: opacity 0.2s ease;
}

.wsc__items > .wsc-item + .wsc-item {
	border-top: var(--wsc-item-divider);
}

.wsc-item.is-busy {
	opacity: 0.5;
	pointer-events: none;
}

.wsc-item__media {
	grid-row: 1 / span 2;
	display: block;
	width: var(--wsc-img-size);
	height: var(--wsc-img-size);
	background: var(--wsc-img-bg);
	border: var(--wsc-img-border);
	border-radius: var(--wsc-img-radius);
	overflow: hidden;
}

.wsc-item__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.wsc-item__info {
	min-width: 0;
}

.wsc-item__name {
	display: block;
	margin: 0;
	font-size: var(--wsc-size-md);
	font-weight: var(--wsc-weight-strong);
	line-height: var(--wsc-line-height-tight);
	color: var(--wsc-text);
	text-decoration: none;
}

.wsc-item__name:hover {
	text-decoration: underline;
}

.wsc-item__meta,
.wsc-item__price {
	margin: 2px 0 0;
	font-size: var(--wsc-size-sm);
	color: var(--wsc-text-muted);
}

.wsc-item__meta {
	display: block;
}

.wsc-item__meta[hidden] {
	display: none;
}

.wsc-item__remove {
	grid-column: 3;
	grid-row: 1;
	justify-self: end;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	margin: -2px -4px 0 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--wsc-text-muted);
	border-radius: var(--wsc-radius);
	cursor: pointer;
	transition: color 0.15s ease;
}

.wsc-item__remove:hover {
	color: var(--wsc-danger);
}

.wsc-item__foot {
	grid-column: 2 / -1;
	grid-row: 2;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.wsc-item__total {
	font-size: var(--wsc-size-md);
	font-weight: var(--wsc-weight-strong);
	color: var(--wsc-text);
	white-space: nowrap;
}

/* --------------------------------------------------------------- Stepper */

.wsc-qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--wsc-border);
	border-radius: var(--wsc-radius);
	background: var(--wsc-surface);
	overflow: hidden;
}

.wsc-qty button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--wsc-text);
	font-size: var(--wsc-size-lg);
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.wsc-qty button:hover:not(:disabled) {
	background: var(--wsc-surface-alt);
}

.wsc-qty button:disabled {
	opacity: 0.35;
	cursor: default;
}

.wsc-qty input {
	width: 34px;
	height: 28px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--wsc-text);
	font: inherit;
	font-weight: var(--wsc-weight-strong);
	text-align: center;
	-moz-appearance: textfield;
	appearance: textfield;
}

.wsc-qty input::-webkit-outer-spin-button,
.wsc-qty input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* ------------------------------------------------------- Recommendations */

.wsc__recs {
	margin: 20px 0 0;
}

.wsc__recs-title {
	margin: 0 0 12px;
	font-size: var(--wsc-size-lg);
	font-weight: var(--wsc-weight-strong);
	text-align: center;
	color: var(--wsc-text);
}

.wsc__recs-track {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(0, calc(50% - 5px));
	gap: 10px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
	padding-bottom: 2px;
}

.wsc__recs-track::-webkit-scrollbar {
	display: none;
}

.wsc-rec {
	scroll-snap-align: start;
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 10px;
	background: var(--wsc-item-bg);
	border-radius: var(--wsc-item-radius);
	box-shadow: var(--wsc-item-shadow);
	text-align: center;
}

.wsc-rec__media {
	display: block;
	aspect-ratio: 1;
	background: var(--wsc-img-bg);
	border-radius: var(--wsc-img-radius);
	overflow: hidden;
}

.wsc-rec__media img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.wsc-rec__name {
	font-size: var(--wsc-size-sm);
	font-weight: var(--wsc-weight-strong);
	line-height: var(--wsc-line-height-tight);
	color: var(--wsc-text);
	text-decoration: none;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.wsc-rec__price {
	font-size: var(--wsc-size-sm);
	color: var(--wsc-text-muted);
}

.wsc-rec__price del {
	opacity: 0.6;
}

.wsc-rec__add {
	margin-top: auto;
	padding: 7px 10px;
	border: 1px solid var(--wsc-accent);
	border-radius: var(--wsc-btn-radius);
	background: transparent;
	color: var(--wsc-accent);
	font: inherit;
	font-size: var(--wsc-size-sm);
	font-weight: var(--wsc-btn-weight);
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
	text-decoration: none;
	display: block;
}

.wsc-rec__add:hover {
	background: var(--wsc-accent);
	color: var(--wsc-accent-text);
}

/* ---------------------------------------------------------------- Footer */

.wsc__footer {
	flex: 0 0 auto;
	padding: var(--wsc-pad);
	background: var(--wsc-surface);
	border-top: 1px solid var(--wsc-border);
}

.wsc__footer[hidden] {
	display: none;
}

.wsc__row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 6px;
	font-size: var(--wsc-size-md);
}

.wsc__row--total {
	font-size: var(--wsc-size-xl);
	font-weight: var(--wsc-weight-strong);
}

.wsc__row--discount {
	color: var(--wsc-accent);
}

.wsc__shipping-note {
	margin: 0 0 12px;
	font-size: var(--wsc-size-sm);
	text-align: center;
	color: var(--wsc-text-muted);
}

.wsc__cta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	padding: var(--wsc-btn-padding);
	border: 1px solid var(--wsc-accent);
	border-radius: var(--wsc-btn-radius);
	background: var(--wsc-accent);
	color: var(--wsc-accent-text);
	font: inherit;
	font-size: var(--wsc-size-xl);
	font-weight: var(--wsc-btn-weight);
	letter-spacing: var(--wsc-btn-tracking);
	text-transform: var(--wsc-btn-transform);
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.18s ease, border-color 0.18s ease;
}

.wsc__cta:hover {
	background: var(--wsc-accent-hover);
	border-color: var(--wsc-accent-hover);
	color: var(--wsc-accent-text);
}

.wsc__continue {
	display: block;
	width: 100%;
	margin-top: 10px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--wsc-text-muted);
	font: inherit;
	font-size: var(--wsc-size-sm);
	text-align: center;
	text-decoration: underline;
	cursor: pointer;
}

/* -------------------------------------------------------- Coupon & note */

.wsc__coupon,
.wsc__note {
	margin-bottom: 12px;
}

.wsc__coupon-form {
	display: flex;
	gap: 8px;
}

.wsc__coupon input,
.wsc__note textarea {
	flex: 1 1 auto;
	width: 100%;
	padding: 9px 12px;
	border: 1px solid var(--wsc-border);
	border-radius: var(--wsc-radius);
	background: var(--wsc-surface);
	color: var(--wsc-text);
	font: inherit;
	font-size: var(--wsc-size-md);
}

.wsc__note textarea {
	resize: vertical;
	min-height: 60px;
}

.wsc__coupon button {
	flex: 0 0 auto;
	padding: 9px 16px;
	border: 1px solid var(--wsc-accent);
	border-radius: var(--wsc-btn-radius);
	background: transparent;
	color: var(--wsc-accent);
	font: inherit;
	font-weight: var(--wsc-btn-weight);
	cursor: pointer;
}

.wsc__coupon button:hover {
	background: var(--wsc-accent);
	color: var(--wsc-accent-text);
}

.wsc__coupons {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 8px;
}

.wsc__coupon-tag {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 8px;
	border: 1px solid var(--wsc-border);
	border-radius: 999px;
	font-size: var(--wsc-size-xs);
}

.wsc__coupon-tag button {
	border: 0;
	background: none;
	padding: 0;
	color: var(--wsc-text-muted);
	cursor: pointer;
	line-height: 1;
}

/* ----------------------------------------------- Empty, errors, loading */

.wsc__empty {
	padding: 48px 20px;
	text-align: center;
	color: var(--wsc-text-muted);
}

.wsc__error {
	margin: 0 0 12px;
	padding: 10px 12px;
	border-radius: var(--wsc-radius);
	background: color-mix(in srgb, var(--wsc-danger) 10%, transparent);
	color: var(--wsc-danger);
	font-size: var(--wsc-size-sm);
}

@supports not (background: color-mix(in srgb, red 10%, transparent)) {
	.wsc__error {
		background: rgba(0, 0, 0, 0.05);
	}
}

.wsc__skeleton {
	display: flex;
	flex-direction: column;
	gap: var(--wsc-item-gap);
}

.wsc__skeleton span {
	display: block;
	height: 84px;
	border-radius: var(--wsc-item-radius);
	background: linear-gradient(90deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.09), rgba(0, 0, 0, 0.05));
	background-size: 200% 100%;
	animation: wsc-shimmer 1.2s linear infinite;
}

@keyframes wsc-shimmer {
	from {
		background-position: 200% 0;
	}
	to {
		background-position: -200% 0;
	}
}

.wsc__sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* -------------------------------------------------------------- Triggers */

.wsc-trigger {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border: 0;
	background: none;
	padding: 0;
	color: inherit;
	cursor: pointer;
}

/*
 * Counters are hidden by attribute rather than by blanking their text, so an
 * empty badge does not keep painting its own background. The !important is
 * deliberate: the selector has to beat whatever display rule the shop theme
 * put on its own counter element.
 */
[data-wsc-count][hidden] {
	display: none !important;
}

/* Sits on the button while a request is in flight. */
.wsc-adding {
	opacity: 0.6;
	pointer-events: none;
}

/* --------------------------------------------------------------- Motion */

@media (prefers-reduced-motion: reduce) {
	.wsc__panel,
	.wsc__overlay,
	.wsc__progress-bar {
		transition-duration: 0.01ms;
	}

	.wsc__skeleton span {
		animation: none;
	}
}

/* --------------------------------------------------------------- Mobile */

@media (max-width: 520px) {
	.wsc__panel {
		width: 100vw;
	}

	.wsc__recs-track {
		grid-auto-columns: minmax(0, calc(50% - 5px));
	}
}
