/* KL Printful Catalog — conversion-focused, mobile-first.
   High-specificity + !important on key text rules to override opinionated theme styles. */

.klpc {
	--klpc-accent: #6b4423;          /* brown "Shop Now" brand tone */
	--klpc-accent-hover: #543419;
	--klpc-ink: #1c1c1c;
	--klpc-muted: #6b6b6b;
	--klpc-line: #e6e2dc;
	--klpc-bg: #ffffff;
	--klpc-radius: 12px;
	--klpc-shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);
	--klpc-gap: 20px;
	font-family: inherit;
	color: var(--klpc-ink);
	max-width: 1280px;
	margin: 0 auto;
}
.klpc *, .klpc *::before, .klpc *::after { box-sizing: border-box; }

/* ---------- Sticky filter bar ---------- */
.klpc-filterbar {
	position: sticky;
	top: 0;
	z-index: 30;
	background: var(--klpc-bg);
	border-bottom: 1px solid var(--klpc-line);
	margin-bottom: 16px;
	backdrop-filter: saturate(1.1) blur(6px);
}
.klpc-filterbar__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	padding: 12px 4px;
}
.klpc-filter-toggle {
	display: none;
	align-items: center;
	gap: 8px;
	padding: 10px 16px;
	border: 1px solid var(--klpc-line);
	border-radius: 999px;
	background: #fff;
	font-weight: 600;
	cursor: pointer;
}
.klpc-filter-count {
	background: var(--klpc-accent);
	color: #fff;
	border-radius: 999px;
	font-size: 12px;
	padding: 1px 7px;
}
.klpc-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 18px;
	align-items: center;
	flex: 1 1 auto;
}
.klpc-fgroup { display: flex; align-items: center; gap: 8px; }
.klpc-fgroup__label {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--klpc-muted);
	font-weight: 700;
	white-space: nowrap;
}
.klpc-fgroup__options { display: flex; flex-wrap: wrap; gap: 6px; }

.klpc-pill, .klpc-chip {
	border: 1px solid var(--klpc-line);
	background: #fff;
	color: var(--klpc-ink);
	border-radius: 999px;
	padding: 6px 14px;
	font-size: 13px;
	line-height: 1.2;
	cursor: pointer;
	transition: all .15s ease;
}
.klpc-chip { min-width: 40px; text-align: center; font-weight: 600; }
.klpc-pill:hover, .klpc-chip:hover { border-color: var(--klpc-accent); }
.klpc-pill[aria-pressed="true"], .klpc-chip[aria-pressed="true"] {
	background: var(--klpc-accent);
	border-color: var(--klpc-accent);
	color: #fff;
}

.klpc-swatch {
	width: 26px; height: 26px;
	border-radius: 50%;
	border: 2px solid #fff;
	box-shadow: 0 0 0 1px var(--klpc-line);
	background: var(--klpc-swatch, #ccc);
	cursor: pointer;
	padding: 0;
	transition: transform .12s ease, box-shadow .12s ease;
}
.klpc-swatch:hover { transform: scale(1.1); }
.klpc-swatch[aria-pressed="true"] {
	box-shadow: 0 0 0 2px var(--klpc-accent);
	transform: scale(1.1);
}

.klpc-sort__select {
	border: 1px solid var(--klpc-line);
	border-radius: 8px;
	padding: 9px 12px;
	background: #fff;
	font-size: 13px;
	cursor: pointer;
}
.klpc-clear {
	background: none;
	border: none;
	color: var(--klpc-accent);
	font-weight: 600;
	cursor: pointer;
	text-decoration: underline;
	font-size: 13px;
}

.klpc-meta { padding: 0 4px 12px; }
.klpc-count { color: var(--klpc-muted); font-size: 13px; }

/* ---------- Grid ---------- */
.klpc-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: var(--klpc-gap);
	transition: opacity .2s ease;
}
.klpc-grid[aria-busy="true"] { opacity: .5; pointer-events: none; }

@media (min-width: 600px) {
	.klpc-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 900px) {
	.klpc[data-columns="4"] .klpc-grid { grid-template-columns: repeat(4, 1fr); }
	.klpc[data-columns="3"] .klpc-grid { grid-template-columns: repeat(3, 1fr); }
	.klpc[data-columns="5"] .klpc-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ---------- Card ---------- */
.klpc-card {
	display: flex;
	flex-direction: column;
	background: var(--klpc-bg);
	border: 1px solid var(--klpc-line);
	border-radius: var(--klpc-radius);
	overflow: hidden;
	transition: transform .18s ease, box-shadow .18s ease;
}
.klpc-card:hover { transform: translateY(-3px); box-shadow: var(--klpc-shadow); }

.klpc-card__media { position: relative; background: #f6f4f1; }
.klpc-card__imglink { display: block; }
.klpc-card__img {
	display: block;
	width: 100%;
	height: auto;            /* natural aspect ratio — no forced square distortion */
	aspect-ratio: 1 / 1;
	object-fit: cover;
}
.klpc-card__badges {
	position: absolute; top: 10px; left: 10px;
	display: flex; gap: 6px; flex-wrap: wrap;
}
.klpc-badge {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
	padding: 4px 9px;
	border-radius: 999px;
	color: #fff;
}
.klpc-badge--sale { background: #c0392b; }
.klpc-badge--best { background: var(--klpc-accent); }
.klpc-badge--new  { background: #2e7d57; }

.klpc-card__quickview {
	position: absolute;
	left: 50%; bottom: 12px;
	transform: translateX(-50%) translateY(8px);
	background: rgba(28,28,28,.9);
	color: #fff;
	border: none;
	padding: 9px 18px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	opacity: 0;
	transition: opacity .18s ease, transform .18s ease;
	white-space: nowrap;
}
.klpc-card:hover .klpc-card__quickview { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (hover: none) { .klpc-card__quickview { opacity: 1; transform: translateX(-50%); } }

.klpc-card__body {
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1 1 auto;
}
/* Override aggressive theme heading styles (e.g. gold H2/H3). */
.klpc .klpc-card__title,
.klpc .klpc-card__title a {
	font-size: 15px !important;
	line-height: 1.35 !important;
	font-weight: 600 !important;
	color: var(--klpc-ink) !important;
	margin: 0 !important;
	text-transform: none !important;
	text-decoration: none !important;
}
.klpc .klpc-card__title a:hover { color: var(--klpc-accent) !important; }
.klpc-card__price { font-weight: 700; color: var(--klpc-ink); }
.klpc-card__price del { color: var(--klpc-muted); font-weight: 400; margin-right: 6px; }

.klpc-card__add {
	margin-top: auto;
	width: 100%;
	border: none;
	background: var(--klpc-accent);
	color: #fff !important;
	font-weight: 700;
	padding: 11px 14px;
	border-radius: 8px;
	cursor: pointer;
	font-size: 14px;
	transition: background .15s ease;
}
.klpc-card__add:hover { background: var(--klpc-accent-hover); }
.klpc-card__add.is-added { background: #2e7d57; }
.klpc-card__add[disabled] { opacity: .6; cursor: default; }

.klpc-empty {
	grid-column: 1 / -1;
	text-align: center;
	padding: 60px 20px;
	color: var(--klpc-muted);
}

/* ---------- Pagination ---------- */
.klpc-pagination-wrap { margin: 32px 0 8px; }
.klpc-pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 6px;
}
.klpc-page {
	min-width: 40px;
	height: 40px;
	padding: 0 12px;
	border: 1px solid var(--klpc-line);
	background: #fff;
	color: var(--klpc-ink);
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all .15s ease;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}
.klpc-page:hover:not(:disabled):not(.is-current) {
	border-color: var(--klpc-accent);
	color: var(--klpc-accent);
}
.klpc-page.is-current {
	background: var(--klpc-accent);
	border-color: var(--klpc-accent);
	color: #fff;
	cursor: default;
}
.klpc-page:disabled {
	opacity: .4;
	cursor: not-allowed;
}
.klpc-page--prev, .klpc-page--next {
	font-size: 20px;
	font-weight: 400;
}
.klpc-page-ellipsis {
	min-width: 24px;
	text-align: center;
	color: var(--klpc-muted);
	user-select: none;
}

@media (max-width: 480px) {
	.klpc-page { min-width: 36px; height: 36px; padding: 0 8px; font-size: 13px; }
}

/* ---------- Quick-view modal ---------- */
/* Very high z-index so catalog overlays always sit above the theme's
   sticky search bar and any other plugin overlays. */
.klpc-modal { position: fixed; inset: 0; z-index: 2147483640; display: none; }
.klpc-modal.is-open { display: block; }
.klpc-modal__overlay { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.klpc-modal__panel {
	position: absolute;
	top: 50%; left: 50%;
	transform: translate(-50%, -50%);
	width: min(900px, 94vw);
	max-height: 90vh;
	overflow: auto;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 20px 60px rgba(0,0,0,.3);
	animation: klpc-pop .2s ease;
}
@keyframes klpc-pop { from { opacity: 0; transform: translate(-50%, -46%); } to { opacity: 1; transform: translate(-50%, -50%); } }
.klpc-modal__close {
	position: absolute; top: 12px; right: 14px;
	width: 36px; height: 36px;
	border: none; background: #f1efec; border-radius: 50%;
	font-size: 22px; line-height: 1; cursor: pointer; z-index: 2;
}
.klpc-modal__content { display: grid; grid-template-columns: 1fr; }
@media (min-width: 700px) { .klpc-modal__content { grid-template-columns: 1fr 1fr; } }

.klpc-qv__media { background: #f6f4f1; }
.klpc-qv__img { width: 100%; height: auto; display: block; aspect-ratio: 1/1; object-fit: cover; }
.klpc-qv__info { padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.klpc .klpc-qv__title {
	font-size: 22px !important;
	font-weight: 700 !important;
	color: var(--klpc-ink) !important;
	margin: 0 !important;
	line-height: 1.25 !important;
	text-transform: none !important;
}
.klpc-qv__price { font-size: 20px; font-weight: 700; }
.klpc-qv__price del { color: var(--klpc-muted); font-weight: 400; margin-right: 8px; }
.klpc-qv__desc { color: var(--klpc-muted); font-size: 14px; line-height: 1.55; }

.klpc-qv__attr { display: flex; flex-direction: column; gap: 8px; }
.klpc-qv__attr-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--klpc-muted); }
.klpc-qv__attr-label span { color: var(--klpc-ink); margin-left: 6px; text-transform: none; letter-spacing: 0; }
.klpc-qv__opts { display: flex; flex-wrap: wrap; gap: 8px; }
.klpc-opt {
	border: 1px solid var(--klpc-line);
	background: #fff; color: var(--klpc-ink);
	padding: 8px 14px; border-radius: 8px;
	cursor: pointer; font-size: 13px; font-weight: 600;
	transition: all .12s ease;
}
.klpc-opt:hover { border-color: var(--klpc-accent); }
.klpc-opt[aria-pressed="true"] { background: var(--klpc-accent); border-color: var(--klpc-accent); color: #fff; }
.klpc-opt[data-unavailable="1"] { opacity: .35; text-decoration: line-through; cursor: not-allowed; }
.klpc-opt--swatch {
	width: 34px; height: 34px; padding: 0; border-radius: 50%;
	background: var(--klpc-swatch, #ccc);
	box-shadow: 0 0 0 1px var(--klpc-line);
}
.klpc-opt--swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--klpc-accent); }

.klpc-qv__add {
	border: none; background: var(--klpc-accent); color: #fff !important;
	font-weight: 700; padding: 14px; border-radius: 10px; cursor: pointer;
	font-size: 15px; transition: background .15s ease; width: 100%;
}
.klpc-qv__add:hover { background: var(--klpc-accent-hover); }
.klpc-qv__add[disabled] { opacity: .5; cursor: not-allowed; }
.klpc-qv__add.is-added { background: #2e7d57; }
.klpc-qv__error { color: #c0392b; font-size: 13px; min-height: 18px; }
.klpc-qv__viewcart { text-align: center; font-size: 13px; }
.klpc-qv__viewcart a { color: var(--klpc-accent); font-weight: 600; }

/* ---------- Toast ---------- */
.klpc-toast {
	position: fixed;
	bottom: 24px; left: 50%;
	transform: translateX(-50%) translateY(20px);
	background: #1c1c1c; color: #fff;
	padding: 14px 22px; border-radius: 999px;
	font-weight: 600; font-size: 14px;
	box-shadow: 0 10px 30px rgba(0,0,0,.3);
	z-index: 2147483645;
	opacity: 0; transition: opacity .2s ease, transform .2s ease;
	display: flex; align-items: center; gap: 14px;
}
.klpc-toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.klpc-toast a { color: #ffd9a8; font-weight: 700; text-decoration: underline; white-space: nowrap; }

/* ---------- Mobile: full-screen filter & sort panel ---------- */
@media (max-width: 899px) {
	/* Hide the desktop inline groups; show the trigger button. */
	.klpc-filters { display: none; }
	.klpc-sort { display: none; }
	.klpc-clear { display: none; }
	.klpc-filter-toggle { display: inline-flex; }
	.klpc-filterbar__inner { padding: 12px 4px; }
}

/* The panel itself is mobile-only; never shown on desktop. It may be moved to
   <body>, so it carries its own copy of the design tokens (custom properties
   defined on .klpc don't cascade once the panel is relocated out of .klpc). */
.klpc-mpanel {
	--klpc-accent: #6b4423;
	--klpc-accent-hover: #543419;
	--klpc-ink: #1c1c1c;
	--klpc-muted: #6b6b6b;
	--klpc-line: #e6e2dc;
	--klpc-bg: #ffffff;
	font-family: inherit;
	display: none;
}

@media (max-width: 899px) {
	.klpc-mpanel {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 2147483642;
		visibility: hidden;
	}
	.klpc-mpanel.is-open { visibility: visible; }

	.klpc-mpanel__overlay {
		position: absolute;
		inset: 0;
		background: rgba(0,0,0,.4);
		opacity: 0;
		transition: opacity .25s ease;
	}
	.klpc-mpanel.is-open .klpc-mpanel__overlay { opacity: 1; }

	/* The sheet slides up and owns the viewport; internal scroll only. */
	.klpc-mpanel__sheet {
		position: absolute;
		inset: 0;
		background: #fff;
		display: flex;
		flex-direction: column;
		transform: translateY(100%);
		transition: transform .28s ease;
	}
	.klpc-mpanel.is-open .klpc-mpanel__sheet { transform: translateY(0); }

	/* Views container flexes to fill space above the footer; positioning ctx. */
	.klpc-mpanel__views {
		position: relative;
		flex: 1 1 auto;
		overflow: hidden;
	}

	/* Views stack; only the active one shows. */
	.klpc-mpanel__view {
		position: absolute;
		inset: 0;
		display: flex;
		flex-direction: column;
		background: #fff;
		transform: translateX(100%);
		transition: transform .25s ease;
		visibility: hidden;
	}
	.klpc-mpanel__view.is-active {
		transform: translateX(0);
		visibility: visible;
	}
	.klpc-mpanel__view--root { transform: translateX(0); }
	.klpc-mpanel__view--root.is-active { visibility: visible; }
	/* Root sits beneath sub-views; sub-views slide over it from the right. */
	.klpc-mpanel__view--root:not(.is-active) {
		transform: translateX(-30%);
		visibility: visible;
	}

	.klpc-mpanel__head {
		display: flex;
		align-items: center;
		gap: 12px;
		padding: 18px 20px;
		border-bottom: 1px solid var(--klpc-line);
		flex: 0 0 auto;
	}
	.klpc-mpanel__title {
		flex: 1 1 auto;
		text-align: center;
		font-size: 17px;
		font-weight: 700;
		color: var(--klpc-ink);
		line-height: 1.2;
	}
	.klpc-mpanel__count {
		display: block;
		font-size: 13px;
		font-weight: 400;
		color: var(--klpc-muted);
		margin-top: 2px;
	}
	.klpc-mpanel__subtitle {
		flex: 1 1 auto;
		font-size: 17px;
		font-weight: 700;
		color: var(--klpc-ink);
	}
	.klpc-mpanel__close, .klpc-mpanel__back {
		background: none;
		border: none;
		font-size: 26px;
		line-height: 1;
		color: var(--klpc-ink);
		cursor: pointer;
		padding: 4px 8px;
		flex: 0 0 auto;
	}
	.klpc-mpanel__back { font-size: 24px; }

	.klpc-mpanel__body {
		flex: 1 1 auto;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		padding: 4px 0 12px;
	}

	/* Root facet rows. */
	.klpc-mrow {
		display: flex;
		align-items: center;
		width: 100%;
		background: none;
		border: none;
		border-bottom: 1px solid var(--klpc-line);
		padding: 20px;
		font-size: 16px;
		color: var(--klpc-ink);
		cursor: pointer;
		text-align: left;
		gap: 10px;
	}
	.klpc-mrow__label { flex: 0 0 auto; font-weight: 500; }
	.klpc-mrow__summary {
		flex: 1 1 auto;
		text-align: right;
		color: var(--klpc-accent);
		font-size: 14px;
		font-weight: 600;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.klpc-mrow__arrow { flex: 0 0 auto; color: var(--klpc-muted); font-size: 18px; }
	.klpc-mrow--sort { cursor: default; }
	.klpc-mrow--sort .klpc-mpanel__sort {
		flex: 1 1 auto;
		margin-left: auto;
		max-width: 60%;
		border: 1px solid var(--klpc-line);
		border-radius: 8px;
		padding: 10px 12px;
		font-size: 15px;
		background: #fff;
		color: var(--klpc-ink);
	}

	/* Option rows within a sub-view. */
	.klpc-mopt {
		display: flex;
		align-items: center;
		width: 100%;
		background: none;
		border: none;
		padding: 16px 20px;
		font-size: 16px;
		color: var(--klpc-ink);
		cursor: pointer;
		text-align: left;
		gap: 14px;
	}
	.klpc-mopt__check {
		flex: 0 0 auto;
		width: 22px; height: 22px;
		border: 2px solid var(--klpc-line);
		border-radius: 5px;
		position: relative;
		transition: all .15s ease;
	}
	.klpc-mopt[aria-pressed="true"] .klpc-mopt__check {
		background: var(--klpc-accent);
		border-color: var(--klpc-accent);
	}
	.klpc-mopt[aria-pressed="true"] .klpc-mopt__check::after {
		content: "";
		position: absolute;
		left: 6px; top: 2px;
		width: 6px; height: 11px;
		border: solid #fff;
		border-width: 0 2px 2px 0;
		transform: rotate(45deg);
	}
	.klpc-mopt__swatch {
		flex: 0 0 auto;
		width: 22px; height: 22px;
		border-radius: 50%;
		background: var(--klpc-swatch, #ccc);
		box-shadow: 0 0 0 1px var(--klpc-line);
	}
	.klpc-mopt__label { flex: 1 1 auto; }
	.klpc-mopt__count { flex: 0 0 auto; color: var(--klpc-muted); font-size: 14px; }

	/* Footer with Clear / Apply. */
	.klpc-mpanel__foot {
		flex: 0 0 auto;
		display: flex;
		align-items: center;
		gap: 16px;
		padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
		border-top: 1px solid var(--klpc-line);
		background: #fff;
	}
	.klpc-mpanel__clear {
		flex: 0 0 auto;
		background: none;
		border: none;
		text-decoration: underline;
		font-size: 16px;
		color: var(--klpc-ink);
		cursor: pointer;
		padding: 12px 4px;
	}
	.klpc-mpanel__apply {
		flex: 1 1 auto;
		background: var(--klpc-accent);
		color: #fff;
		border: none;
		border-radius: 8px;
		font-size: 16px;
		font-weight: 700;
		padding: 15px;
		cursor: pointer;
	}
	/* The footer lives once at the sheet level, not per-view. */
	.klpc-mpanel__foot { position: relative; z-index: 5; }
}

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden; clip: rect(1px,1px,1px,1px);
	white-space: nowrap;
}
